2 * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.lispflowmapping.implementation;
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.LispAFIConvertor;
16 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.lispaddress.LispAddressContainer;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.lispaddress.lispaddresscontainer.address.ipv4.Ipv4AddressBuilder;
19 import org.slf4j.Logger;
20 import org.slf4j.LoggerFactory;
23 * @author Lorand Jakab
26 public class MappingServiceShell implements IMappingServiceShell, BindingAwareProvider, AutoCloseable {
27 protected static final Logger LOG = LoggerFactory.getLogger(MappingServiceShell.class);
29 private BindingAwareBroker bindingAwareBroker;
30 private IMappingService mappingService;
32 public void setBindingAwareBroker(BindingAwareBroker bindingAwareBroker) {
33 this.bindingAwareBroker = bindingAwareBroker;
36 public void setMappingService(IMappingService mappingService) {
37 this.mappingService = mappingService;
40 public void initialize() {
41 bindingAwareBroker.registerProvider(this);
45 public String printMappings() {
46 return mappingService.printMappings();
50 public void addDefaultKeyIPv4() {
51 LispAddressContainer address = LispAFIConvertor.toContainer(
52 new Ipv4AddressBuilder().setIpv4Address(new Ipv4Address("0.0.0.0")).setMask((short)0).build());
53 mappingService.addAuthenticationKey(address, "password");
57 public void close() throws Exception {
61 public void onSessionInitiated(ProviderContext arg0) {
62 // TODO Auto-generated method stub