1
2
3
4
5
6
7
8 package org.opendaylight.lispflowmapping.implementation;
9
10 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
11 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
12 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
13 import org.opendaylight.lispflowmapping.interfaces.mappingservice.IMappingService;
14 import org.opendaylight.lispflowmapping.interfaces.mappingservice.IMappingServiceShell;
15 import org.opendaylight.lispflowmapping.lisp.util.LispAddressUtil;
16 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.authkey.container.MappingAuthkey;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.authkey.container.MappingAuthkeyBuilder;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
22
23
24
25
26
27 public class MappingServiceShell implements IMappingServiceShell, BindingAwareProvider, AutoCloseable {
28 protected static final Logger LOG = LoggerFactory.getLogger(MappingServiceShell.class);
29
30 private BindingAwareBroker bindingAwareBroker;
31 private IMappingService mappingService;
32
33 public void setBindingAwareBroker(BindingAwareBroker bindingAwareBroker) {
34 this.bindingAwareBroker = bindingAwareBroker;
35 }
36
37 public void setMappingService(IMappingService mappingService) {
38 this.mappingService = mappingService;
39 }
40
41 public void initialize() {
42 bindingAwareBroker.registerProvider(this);
43 }
44
45 @Override
46 public String printMappings() {
47 return mappingService.printMappings();
48 }
49
50 @Override
51 public void addDefaultKeyIPv4() {
52 Eid eid = LispAddressUtil.toEid(new Ipv4Prefix("0.0.0.0/0"), null);
53 MappingAuthkey key = new MappingAuthkeyBuilder().setKeyType(1).setKeyString("password").build();
54 mappingService.addAuthenticationKey(eid, key);
55 }
56
57 @Override
58 public void close() throws Exception {
59 }
60
61 @Override
62 public void onSessionInitiated(ProviderContext arg0) {
63
64
65 }
66 }