2 * Copyright (c) 2017 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.neutron.intenthandler;
10 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
11 import org.opendaylight.controller.md.sal.binding.api.MountPointService;
12 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
13 import org.opendaylight.controller.sal.binding.api.BindingAwareProvider;
14 import org.opendaylight.lispflowmapping.neutron.intenthandler.listener.service.VbridgeTopologyListenerService;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
19 * Created by Shakib Ahmed on 1/19/17.
23 * This is the bean instantiated when lisp neutron service is installed. This bean
24 * registers and maintain listeners for getting updates of Neutron Topology
25 * maintained by groupbasedpolicy and honeycomb vbd.
27 public class GroupBasedPolicyNeutronIntentHandlerBean implements AutoCloseable, BindingAwareProvider {
28 private static final Logger LOG = LoggerFactory.getLogger(GroupBasedPolicyNeutronIntentHandlerBean.class);
30 private DataBroker dataBroker;
31 private MountPointService mountService;
33 private VbridgeTopologyListenerService vbridgeTopologyListenerService;
35 private IntentHandlerAsyncExecutorProvider intentHandlerAsyncExecutorProvider =
36 IntentHandlerAsyncExecutorProvider.getInstace();
38 public GroupBasedPolicyNeutronIntentHandlerBean(final BindingAwareBroker bindingAwareBroker) {
39 bindingAwareBroker.registerProvider(this);
44 public void close() throws Exception {
45 LOG.info("Clustering provider closed for {}", this.getClass().getSimpleName());
46 intentHandlerAsyncExecutorProvider.close();
50 public void onSessionInitiated(BindingAwareBroker.ProviderContext session) {
51 LOG.info("LFM neutron handler service registered", this.getClass().getSimpleName());
52 dataBroker = session.getSALService(DataBroker.class);
53 mountService = session.getSALService(MountPointService.class);
54 vbridgeTopologyListenerService = VbridgeTopologyListenerService.initialize(dataBroker, mountService);