2 * Copyright (C) 2013 Red Hat, Inc.
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 * Authors : Madhu Venugopal
11 package org.opendaylight.ovsdb.openstack.netvirt.providers;
13 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
14 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ConsumerContext;
15 import org.opendaylight.controller.sal.binding.api.BindingAwareConsumer;
16 import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
18 import org.apache.felix.dm.Component;
19 import org.osgi.framework.BundleContext;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
22 public class MdsalConsumerImpl implements BindingAwareConsumer, MdsalConsumer {
24 private BundleContext ctx = null;
25 private volatile BindingAwareBroker broker;
26 private ConsumerContext consumerContext = null;
27 private DataBrokerService dataBrokerService;
29 static final Logger logger = LoggerFactory.getLogger(MdsalConsumerImpl.class);
31 void init(Component c) {
32 this.ctx = c.getDependencyManager().getBundleContext();
33 logger.info("Open vSwitch OpenFlow 1.3 Neutron Networking Provider Registered with MD-SAL");
34 broker.registerConsumer(this, this.ctx);
38 // Now lets close MDSAL session
39 if (this.consumerContext != null) {
40 //this.consumerContext.close();
41 this.consumerContext = null;
52 public void onSessionInitialized(ConsumerContext session) {
53 this.consumerContext = session;
54 dataBrokerService = session.getSALService(DataBrokerService.class);
55 logger.info("OVSDB Neutron Session Initilized with CONSUMER CONTEXT {}", session.toString());
59 public ConsumerContext getConsumerContext() {
60 return consumerContext;
63 public DataBrokerService getDataBrokerService() {
64 return dataBrokerService;