Bug 7669: Add multi-provider network support to NetVirt for L2 Gateway.
[netvirt.git] / vpnservice / elanmanager / elanmanager-impl / src / main / java / org / opendaylight / netvirt / elan / l2gw / jobs / AssociateHwvtepToElanJob.java
index 61d6953a74b1fb491b7551170ea64f56aaa9d298..525f83cebae60e76ab1f95539367499930e174b6 100644 (file)
@@ -7,30 +7,28 @@
  */
 package org.opendaylight.netvirt.elan.l2gw.jobs;
 
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.concurrent.Callable;
-
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.genius.utils.hwvtep.HwvtepSouthboundUtils;
+import org.opendaylight.genius.utils.hwvtep.HwvtepUtils;
 import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayMulticastUtils;
 import org.opendaylight.netvirt.elan.l2gw.utils.ElanL2GatewayUtils;
 import org.opendaylight.netvirt.elan.utils.ElanUtils;
 import org.opendaylight.netvirt.neutronvpn.api.l2gw.L2GatewayDevice;
-import org.opendaylight.genius.utils.hwvtep.HwvtepSouthboundUtils;
-import org.opendaylight.genius.utils.hwvtep.HwvtepUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l2gateways.rev150712.l2gateway.attributes.Devices;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepNodeName;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
-
 /**
 * Created by ekvsver on 4/15/2016.
 */
@@ -98,12 +96,10 @@ public class AssociateHwvtepToElanJob implements Callable<List<ListenableFuture<
     private ListenableFuture<Void> createLogicalSwitch(L2GatewayDevice l2GatewayDevice, ElanInstance elanInstance) {
         final String logicalSwitchName = ElanL2GatewayUtils.getLogicalSwitchFromElan(
                 elanInstance.getElanInstanceName());
-        String segmentationId = elanInstance.getSegmentationId().toString();
+        String segmentationId = ElanUtils.getVxlanSegmentationId(elanInstance).toString();
 
-        if (LOG.isTraceEnabled()) {
-            LOG.trace("logical switch {} is created on {} with VNI {}", logicalSwitchName,
-                    l2GatewayDevice.getHwvtepNodeId(), segmentationId);
-        }
+        LOG.trace("logical switch {} is created on {} with VNI {}", logicalSwitchName,
+                l2GatewayDevice.getHwvtepNodeId(), segmentationId);
         NodeId hwvtepNodeId = new NodeId(l2GatewayDevice.getHwvtepNodeId());
         InstanceIdentifier<LogicalSwitches> path = HwvtepSouthboundUtils
                 .createLogicalSwitchesInstanceIdentifier(hwvtepNodeId, new HwvtepNodeName(logicalSwitchName));
@@ -117,9 +113,7 @@ public class AssociateHwvtepToElanJob implements Callable<List<ListenableFuture<
                 // Listener will be closed after all configuration completed
                 // on hwvtep by
                 // listener itself
-                if (LOG.isTraceEnabled()) {
-                    LOG.trace("Successful in initiating logical switch {} creation", logicalSwitchName);
-                }
+                LOG.trace("Successful in initiating logical switch {} creation", logicalSwitchName);
             }
 
             @Override