2 * Copyright (c) 2014 Cisco Systems, Inc. and others. 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
9 package org.opendaylight.lispflowmapping.neutron;
12 import org.slf4j.Logger;
13 import org.slf4j.LoggerFactory;
14 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
15 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
16 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
17 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
18 import org.opendaylight.lispflowmapping.interfaces.lisp.IFlowMapping;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mapping.database.rev150314.LfmMappingDatabaseService;
22 public class LispNeutronService implements ILispNeutronService, BindingAwareProvider {
24 protected static final Logger LOG = LoggerFactory.getLogger(LispNeutronService.class);
25 private IFlowMapping mappingService;
26 private LfmMappingDatabaseService lfmDbService;
27 private static ILispNeutronService neutronService;
30 void setBindingAwareBroker(BindingAwareBroker bindingAwareBroker) {
31 LOG.debug("LISP NEUTRON BindingAwareBroker set!");
32 bindingAwareBroker.registerProvider(this);
33 neutronService = this;
36 void unsetBindingAwareBroker(BindingAwareBroker bindingAwareBroker) {
40 public static ILispNeutronService getLispNeutronService() {
41 return neutronService;
45 public IFlowMapping getMappingService() {
46 return this.mappingService;
49 public LfmMappingDatabaseService getMappingDbService() {
50 return this.lfmDbService;
53 public void setMappingService(IFlowMapping mappingService) {
54 LOG.debug("MappingService set in Lisp Neutron");
55 this.mappingService = mappingService;
58 public void unsetMappingService(IFlowMapping mappingService) {
59 LOG.debug("MappingService was unset in LISP Neutron");
60 this.mappingService = null;
64 public void onSessionInitiated(ProviderContext session) {
65 LOG.debug("LFMDBSERVICE IS BEING FILLED! SESSION INITIATED");
66 RpcProviderRegistry rpcRegistry = session.getSALService(RpcProviderRegistry.class);
67 lfmDbService = rpcRegistry.getRpcService(LfmMappingDatabaseService.class);
68 LOG.debug("LFMDBSERVICE was FILLED! SESSION INITIATED");
73 LOG.info("LISP Neutron Service is down!");
76 public void destroy() {
77 LOG.debug("LISP Neutron Service is destroyed!");
78 mappingService = null;