2 * Copyright (c) 2015 Red Hat, 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
8 package org.opendaylight.ovsdb.openstack.netvirt.impl;
10 import com.google.common.collect.Sets;
12 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
13 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
14 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
15 import org.opendaylight.ovsdb.openstack.netvirt.ConfigInterface;
16 import org.opendaylight.ovsdb.openstack.netvirt.api.OvsdbInventoryService;
17 import org.opendaylight.ovsdb.openstack.netvirt.api.OvsdbInventoryListener;
18 import org.osgi.framework.BundleContext;
19 import org.osgi.framework.ServiceReference;
20 import org.slf4j.Logger;
21 import org.slf4j.LoggerFactory;
24 * MdsalConsumerImpl is the implementation for {@link OvsdbInventoryService}
26 * @author Sam Hague (shague@redhat.com)
28 public class OvsdbInventoryServiceImpl implements ConfigInterface, OvsdbInventoryService {
29 private static final Logger LOG = LoggerFactory.getLogger(OvsdbInventoryServiceImpl.class);
30 private static DataBroker dataBroker = null;
31 private static Set<OvsdbInventoryListener> mdsalConsumerListeners = Sets.newCopyOnWriteArraySet();
32 private OvsdbDataChangeListener ovsdbDataChangeListener = null;
33 //private static SouthboundImpl southboundImpl = null;
34 private volatile BindingAwareBroker broker;
36 public OvsdbInventoryServiceImpl(ProviderContext providerContext) {
37 dataBroker = providerContext.getSALService(DataBroker.class);
38 LOG.info("netvirt MdsalConsumer initialized");
39 ovsdbDataChangeListener = new OvsdbDataChangeListener(dataBroker);
40 //southboundImpl = new SouthboundImpl(dataBroker);
44 public void listenerAdded(OvsdbInventoryListener listener) {
45 mdsalConsumerListeners.add(listener);
46 LOG.info("listenerAdded: {}", listener);
50 public void listenerRemoved(OvsdbInventoryListener listener) {
51 mdsalConsumerListeners.remove(listener);
52 LOG.info("listenerRemoved: {}", listener);
56 public void providersReady() {
57 ovsdbDataChangeListener.start();
60 public static Set<OvsdbInventoryListener> getMdsalConsumerListeners() {
61 return mdsalConsumerListeners;
65 public void setDependencies(BundleContext bundleContext, ServiceReference serviceReference) {}
68 public void setDependencies(Object impl) {}