/*
- * Copyright (C) 2014 SDN Hub, LLC.
+ * Copyright (c) 2014, 2015 SDN Hub, LLC. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Srini Seetharaman
*/
package org.opendaylight.ovsdb.openstack.netvirt;
import java.util.List;
import java.util.Map;
-import org.opendaylight.neutron.spi.INeutronLoadBalancerCRUD;
-import org.opendaylight.neutron.spi.INeutronLoadBalancerPoolAware;
-import org.opendaylight.neutron.spi.INeutronNetworkCRUD;
-import org.opendaylight.neutron.spi.INeutronPortCRUD;
-import org.opendaylight.neutron.spi.INeutronSubnetCRUD;
-import org.opendaylight.neutron.spi.NeutronLoadBalancer;
-import org.opendaylight.neutron.spi.NeutronLoadBalancerPool;
-import org.opendaylight.neutron.spi.NeutronLoadBalancerPoolMember;
+import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancer;
+import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPool;
+import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronLoadBalancerPoolMember;
+import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronLoadBalancerCRUD;
+import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronNetworkCRUD;
+import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronPortCRUD;
+import org.opendaylight.ovsdb.openstack.netvirt.translator.crud.INeutronSubnetCRUD;
+import org.opendaylight.ovsdb.openstack.netvirt.translator.iaware.INeutronLoadBalancerPoolAware;
import org.opendaylight.ovsdb.openstack.netvirt.api.Action;
import org.opendaylight.ovsdb.openstack.netvirt.api.EventDispatcher;
import org.opendaylight.ovsdb.openstack.netvirt.api.LoadBalancerConfiguration;
import org.opendaylight.ovsdb.openstack.netvirt.api.NodeCacheManager;
import org.opendaylight.ovsdb.utils.servicehelper.ServiceHelper;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
-import org.osgi.framework.BundleContext;
+
import org.osgi.framework.ServiceReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
List<LoadBalancerConfiguration> lbConfigList = extractLBConfiguration(neutronLBPool);
final List<Node> nodes = nodeCacheManager.getBridgeNodes();
if (lbConfigList == null) {
- LOG.debug("Neutron LB configuration invalid for pool {} ", neutronLBPool.getLoadBalancerPoolID());
+ LOG.debug("Neutron LB configuration invalid for pool {} ", neutronLBPool.getID());
} else if (lbConfigList.size() == 0) {
- LOG.debug("No Neutron LB VIP not created yet for pool {} ", neutronLBPool.getLoadBalancerPoolID());
+ LOG.debug("No Neutron LB VIP not created yet for pool {} ", neutronLBPool.getID());
} else if (nodes.isEmpty()) {
- LOG.debug("Noop with LB pool {} creation because no nodes available.", neutronLBPool.getLoadBalancerPoolID());
+ LOG.debug("Noop with LB pool {} creation because no nodes available.", neutronLBPool.getID());
} else {
for (LoadBalancerConfiguration lbConfig: lbConfigList) {
if (!lbConfig.isValid()) {
List<LoadBalancerConfiguration> lbConfigList = extractLBConfiguration(neutronLBPool);
final List<Node> nodes = nodeCacheManager.getBridgeNodes();
if (lbConfigList == null) {
- LOG.debug("Neutron LB configuration invalid for pool {} ", neutronLBPool.getLoadBalancerPoolID());
+ LOG.debug("Neutron LB configuration invalid for pool {} ", neutronLBPool.getID());
} else if (lbConfigList.size() == 0) {
- LOG.debug("No Neutron LB VIP not created yet for pool {} ", neutronLBPool.getLoadBalancerPoolID());
+ LOG.debug("No Neutron LB VIP not created yet for pool {} ", neutronLBPool.getID());
} else if (nodes.isEmpty()) {
- LOG.debug("Noop with LB pool {} deletion because no nodes available.", neutronLBPool.getLoadBalancerPoolID());
+ LOG.debug("Noop with LB pool {} deletion because no nodes available.", neutronLBPool.getID());
} else {
for (LoadBalancerConfiguration lbConfig: lbConfigList) {
if (!lbConfig.isValid()) {
/**
* Useful utility for extracting the loadbalancer instance. With
* each LB pool, we allow multiple VIP and LB to be instantiated.
+ * @param neutronLBPool Neutron load balancer pool object
+ * @return list of loadbalancer configuration of pool members
*/
public List<LoadBalancerConfiguration> extractLBConfiguration(NeutronLoadBalancerPool neutronLBPool) {
String poolProtocol = neutronLBPool.getLoadBalancerPoolProtocol();
memberSubnetID = neutronLBPoolMember.getPoolMemberSubnetID();
if (memberSubnetID != null && memberAdminStateIsUp != null &&
memberSubnetID.equals(loadBalancerSubnetID) && memberAdminStateIsUp) {
- memberID = neutronLBPoolMember.getPoolMemberID();
+ memberID = neutronLBPoolMember.getID();
memberIP = neutronLBPoolMember.getPoolMemberAddress();
memberPort = neutronLBPoolMember.getPoolMemberProtoPort();
if (memberID == null || memberIP == null || memberPort == null) {
}
@Override
- public void setDependencies(BundleContext bundleContext, ServiceReference serviceReference) {
+ public void setDependencies(ServiceReference serviceReference) {
loadBalancerProvider =
(LoadBalancerProvider) ServiceHelper.getGlobalInstance(LoadBalancerProvider.class, this);
nodeCacheManager =
(NodeCacheManager) ServiceHelper.getGlobalInstance(NodeCacheManager.class, this);
eventDispatcher =
(EventDispatcher) ServiceHelper.getGlobalInstance(EventDispatcher.class, this);
- eventDispatcher.eventHandlerAdded(
- bundleContext.getServiceReference(INeutronLoadBalancerPoolAware.class.getName()), this);
+ eventDispatcher.eventHandlerAdded(serviceReference, this);
}
@Override