COE:Generate segmentation-id from vni pool 03/78603/5
authorFaseela K <faseela.k@ericsson.com>
Mon, 10 Dec 2018 10:57:40 +0000 (16:27 +0530)
committerSam Hague <shague@redhat.com>
Thu, 20 Dec 2018 19:42:06 +0000 (19:42 +0000)
segmentation-id should be internally generated
using the common vni-pool, instead of being passed
down from COE. This will avoid vni collisions
in the datapath.

JIRA: NETVIRT-1514

Change-Id: I26b0c52bab6f15fe6f27c93d4087f8366ef9d8af
Signed-off-by: Faseela K <faseela.k@ericsson.com>
coe/impl/pom.xml
coe/impl/src/main/java/org/opendaylight/netvirt/coe/listeners/PodListener.java
coe/impl/src/main/java/org/opendaylight/netvirt/coe/listeners/TerminationPointStateListener.java
coe/impl/src/main/java/org/opendaylight/netvirt/coe/utils/CoeUtils.java
coe/impl/src/main/resources/OSGI-INF/blueprint/coe-renderer.xml

index 7e1292e0ada1c387d3c01f985d43a9f911b68bcd..46885e7ab0c98c310f4e19a563ee207001e568ae 100644 (file)
@@ -69,6 +69,11 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
             <artifactId>mdsalutil-api</artifactId>
             <version>${genius.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.genius</groupId>
+            <artifactId>networkutils</artifactId>
+            <version>0.6.0-SNAPSHOT</version>
+        </dependency>
     </dependencies>
 
     <build>
index 2aa0b5bd9a05873acecea08708209d41328461e8..c39d26d5792164185c8e4d17bb36c6a50f2946d0 100644 (file)
@@ -50,12 +50,14 @@ public class PodListener implements DataTreeChangeListener<Pods> {
     private ListenerRegistration<PodListener> listenerRegistration;
     private final JobCoordinator jobCoordinator;
     private final ManagedNewTransactionRunner txRunner;
+    private final CoeUtils coeUtils;
 
     @Inject
-    public PodListener(final DataBroker dataBroker, JobCoordinator jobCoordinator) {
+    public PodListener(final DataBroker dataBroker, JobCoordinator jobCoordinator, CoeUtils coeUtils) {
         registerListener(LogicalDatastoreType.CONFIGURATION, dataBroker);
         this.txRunner = new ManagedNewTransactionRunnerImpl(dataBroker);
         this.jobCoordinator = jobCoordinator;
+        this.coeUtils = coeUtils;
     }
 
     protected InstanceIdentifier<Pods> getWildCardPath() {
@@ -125,8 +127,8 @@ public class PodListener implements DataTreeChangeListener<Pods> {
             LOG.warn("pod {} added with insufficient information to process", pods.getName());
             return;
         }
-        jobCoordinator.enqueueJob(pods.getName(), new PodConfigAddWorker(txRunner, instanceIdentifier,
-                pods, podInterface));
+        jobCoordinator.enqueueJob(pods.getName(), new PodConfigAddWorker(txRunner, coeUtils,
+                instanceIdentifier, pods, podInterface));
     }
 
     private void update(InstanceIdentifier<Pods> instanceIdentifier, Pods podsAfter, Pods podsBefore,
@@ -139,8 +141,8 @@ public class PodListener implements DataTreeChangeListener<Pods> {
                 // issue a delete of all previous configuration, and add the new one.
                 //jobCoordinator.enqueueJob(podsAfter.getName(), new PodConfigRemoveWorker(txRunner, podsBefore));
             //}
-            jobCoordinator.enqueueJob(podsAfter.getName(), new PodConfigAddWorker(txRunner, instanceIdentifier,
-                    podsAfter, podInterfaceAfter));
+            jobCoordinator.enqueueJob(podsAfter.getName(), new PodConfigAddWorker(txRunner, coeUtils,
+                    instanceIdentifier, podsAfter, podInterfaceAfter));
         }
     }
 
@@ -151,7 +153,7 @@ public class PodListener implements DataTreeChangeListener<Pods> {
             return;
         }
 
-        jobCoordinator.enqueueJob(pods.getName(), new PodConfigRemoveWorker(txRunner, pods));
+        jobCoordinator.enqueueJob(pods.getName(), new PodConfigRemoveWorker(txRunner, coeUtils, pods));
     }
 
     private static class PodConfigAddWorker implements Callable<List<ListenableFuture<Void>>> {
@@ -159,37 +161,40 @@ public class PodListener implements DataTreeChangeListener<Pods> {
         private final Pods pods;
         private final Interface podInterface;
         private final ManagedNewTransactionRunner txRunner;
+        private final CoeUtils coeUtils;
 
-        PodConfigAddWorker(ManagedNewTransactionRunner txRunner, InstanceIdentifier<Pods> podsInstanceIdentifier,
+        PodConfigAddWorker(ManagedNewTransactionRunner txRunner, CoeUtils coeUtils,
+                           InstanceIdentifier<Pods> podsInstanceIdentifier,
                            Pods pods, Interface podInterface) {
             this.pods = pods;
             this.podInterface = podInterface;
             this.txRunner = txRunner;
             this.podsInstanceIdentifier = podsInstanceIdentifier;
+            this.coeUtils = coeUtils;
         }
 
         @Override
         public List<ListenableFuture<Void>> call() {
             LOG.trace("Adding Pod : {}", podInterface);
-            String interfaceName = CoeUtils.buildInterfaceName(pods.getClusterId().getValue(), pods.getName());
+            String interfaceName = coeUtils.buildInterfaceName(pods.getClusterId().getValue(), pods.getName());
             List<ListenableFuture<Void>> futures = new ArrayList<>();
             futures.add(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, tx ->  {
                 String nodeIp = pods.getHostIpAddress().stringValue();
-                ElanInstance elanInstance = CoeUtils.createElanInstanceForTheFirstPodInTheNetwork(
+                ElanInstance elanInstance = coeUtils.createElanInstanceForTheFirstPodInTheNetwork(
                         pods.getClusterId().getValue(), nodeIp, podInterface, tx);
                 LOG.info("interface creation for pod {}", interfaceName);
-                String portInterfaceName = CoeUtils.createOfPortInterface(interfaceName, tx);
+                String portInterfaceName = coeUtils.createOfPortInterface(interfaceName, tx);
                 LOG.debug("Creating ELAN Interface for pod {}", interfaceName);
-                CoeUtils.createElanInterface(portInterfaceName,
+                coeUtils.createElanInterface(portInterfaceName,
                         elanInstance.getElanInstanceName(), tx);
                 LOG.debug("Creating VPN instance for namespace {}", pods.getNetworkNS());
                 List<String> rd = Arrays.asList("100:1");
-                CoeUtils.createVpnInstance(pods.getClusterId().getValue(), rd, null, null,
+                coeUtils.createVpnInstance(pods.getClusterId().getValue(), rd, null, null,
                         VpnInstance.Type.L3, 0, IpVersionChoice.IPV4, tx);
             }));
             if (podInterface.getIpAddress() != null) {
                 futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL, tx -> {
-                    CoeUtils.createPodNameToPodUuidMap(interfaceName, podsInstanceIdentifier, tx);
+                    coeUtils.createPodNameToPodUuidMap(interfaceName, podsInstanceIdentifier, tx);
                 }));
             }
             return futures;
@@ -199,32 +204,33 @@ public class PodListener implements DataTreeChangeListener<Pods> {
     private static class PodConfigRemoveWorker implements Callable<List<ListenableFuture<Void>>> {
         private final Pods pods;
         private final ManagedNewTransactionRunner txRunner;
+        private final CoeUtils coeUtils;
 
-
-        PodConfigRemoveWorker(ManagedNewTransactionRunner txRunner,
+        PodConfigRemoveWorker(ManagedNewTransactionRunner txRunner, CoeUtils coeUtils,
                               Pods pods) {
             this.pods = pods;
             this.txRunner = txRunner;
+            this.coeUtils = coeUtils;
         }
 
         @Override
         public List<ListenableFuture<Void>> call() {
             List<ListenableFuture<Void>> futures = new ArrayList<>();
-            String podInterfaceName = CoeUtils.buildInterfaceName(pods.getClusterId().getValue(), pods.getName());
+            String podInterfaceName = coeUtils.buildInterfaceName(pods.getClusterId().getValue(), pods.getName());
             futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(CONFIGURATION, tx -> {
                 LOG.trace("Deleting Pod : {}", podInterfaceName);
                 LOG.debug("Deleting VPN Interface for pod {}", podInterfaceName);
-                CoeUtils.deleteVpnInterface(podInterfaceName, tx);
+                coeUtils.deleteVpnInterface(podInterfaceName, tx);
                 LOG.debug("Deleting ELAN Interface for pod {}", podInterfaceName);
-                CoeUtils.deleteElanInterface(podInterfaceName, tx);
+                coeUtils.deleteElanInterface(podInterfaceName, tx);
                 LOG.info("interface deletion for pod {}", podInterfaceName);
-                CoeUtils.deleteOfPortInterface(podInterfaceName, tx);
-                CoeUtils.unbindKubeProxyService(podInterfaceName, tx);
+                coeUtils.deleteOfPortInterface(podInterfaceName, tx);
+                coeUtils.unbindKubeProxyService(podInterfaceName, tx);
                 // TODO delete elan-instance if this is the last pod in the host
                 // TODO delete vpn-instance if this is the last pod in the network
             }));
             futures.add(txRunner.callWithNewWriteOnlyTransactionAndSubmit(OPERATIONAL, tx -> {
-                CoeUtils.deletePodNameToPodUuidMap(podInterfaceName, tx);
+                coeUtils.deletePodNameToPodUuidMap(podInterfaceName, tx);
             }));
             return futures;
         }
index 2580362c8c9e537cd222d607f7e64bf2e7547b3e..078347b4752c6854bffb4f04562cf886fe697a7f 100644 (file)
@@ -57,16 +57,18 @@ public class TerminationPointStateListener extends
     private final PodsCache  podsCache;
     private final DataTreeEventCallbackRegistrar eventCallbacks;
     private final ManagedNewTransactionRunner txRunner;
+    private final CoeUtils coeUtils;
 
     @Inject
     public TerminationPointStateListener(DataBroker dataBroker,
-        PodsCache podsCache, DataTreeEventCallbackRegistrar eventCallbacks) {
+        PodsCache podsCache, DataTreeEventCallbackRegistrar eventCallbacks, CoeUtils coeUtils) {
         super(dataBroker, LogicalDatastoreType.OPERATIONAL,
                 InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class).child(Node.class)
                         .child(TerminationPoint.class).augmentation(OvsdbTerminationPointAugmentation.class).build());
         this.podsCache = podsCache;
         this.eventCallbacks = eventCallbacks;
         this.txRunner = new ManagedNewTransactionRunnerImpl(dataBroker);
+        this.coeUtils = coeUtils;
     }
 
     @Override
@@ -78,8 +80,8 @@ public class TerminationPointStateListener extends
     public void update(@Nullable OvsdbTerminationPointAugmentation tpOld, OvsdbTerminationPointAugmentation tpNew) {
         LOG.debug("Received Update DataChange Notification for ovsdb termination point {}", tpNew.getName());
 
-        SouthboundInterfaceInfo tpNewDetails = CoeUtils.getSouthboundInterfaceDetails(tpNew);
-        SouthboundInterfaceInfo tpOldDetails = CoeUtils.getSouthboundInterfaceDetails(tpOld);
+        SouthboundInterfaceInfo tpNewDetails = coeUtils.getSouthboundInterfaceDetails(tpNew);
+        SouthboundInterfaceInfo tpOldDetails = coeUtils.getSouthboundInterfaceDetails(tpOld);
 
         if (!Objects.equals(tpNewDetails, tpOldDetails)) {
             Optional<String> interfaceNameOptional = tpNewDetails.getInterfaceName();
@@ -91,20 +93,20 @@ public class TerminationPointStateListener extends
                 LOG.debug("Detected external interface-id {} and attached mac address {} for {}", interfaceName,
                         macAddress, tpNew.getName());
                 eventCallbacks.onAddOrUpdate(LogicalDatastoreType.OPERATIONAL,
-                        CoeUtils.getPodMetaInstanceId(interfaceName), (unused, alsoUnused) -> {
+                        coeUtils.getPodMetaInstanceId(interfaceName), (unused, alsoUnused) -> {
                         LOG.info("Pod configuration {} detected for termination-point {},"
                                     + "proceeding with l2 and l3 configurations", interfaceName, tpNew.getName());
                         ListenableFutures.addErrorLogging(txRunner.callWithNewReadWriteTransactionAndSubmit(
                                 CONFIGURATION, tx -> {
-                                InstanceIdentifier<Pods> instanceIdentifier = CoeUtils.getPodUUIDforPodName(
+                                InstanceIdentifier<Pods> instanceIdentifier = coeUtils.getPodUUIDforPodName(
                                         interfaceName, getDataBroker());
                                 Pods pods = podsCache.get(instanceIdentifier).get();
                                 if (pods != null) {
                                     IpAddress podIpAddress = pods.getInterface().get(0).getIpAddress();
-                                    CoeUtils.updateElanInterfaceWithStaticMac(macAddress, podIpAddress,
+                                    coeUtils.updateElanInterfaceWithStaticMac(macAddress, podIpAddress,
                                             interfaceName, tx);
                                     if (!isServiceGateway) {
-                                        CoeUtils.createVpnInterface(pods.getClusterId().getValue(), pods, interfaceName,
+                                        coeUtils.createVpnInterface(pods.getClusterId().getValue(), pods, interfaceName,
                                                 macAddress,false, tx);
                                         LOG.debug("Bind Kube Proxy Service for {}", interfaceName);
                                         bindKubeProxyService(tx, interfaceName);
@@ -122,7 +124,7 @@ public class TerminationPointStateListener extends
         update(null, tpNew);
     }
 
-    private static void bindKubeProxyService(TypedReadWriteTransaction<Datastore.Configuration> tx,
+    private void bindKubeProxyService(TypedReadWriteTransaction<Datastore.Configuration> tx,
                                              String interfaceName) {
         int priority = ServiceIndex.getIndex(NwConstants.COE_KUBE_PROXY_SERVICE_NAME,
                 NwConstants.COE_KUBE_PROXY_SERVICE_INDEX);
@@ -136,7 +138,7 @@ public class TerminationPointStateListener extends
                                 NwConstants.COE_KUBE_PROXY_SERVICE_INDEX),
                         priority, NwConstants.COOKIE_COE_KUBE_PROXY_TABLE, instructions);
         InstanceIdentifier<BoundServices> boundServicesInstanceIdentifier =
-                CoeUtils.buildKubeProxyServicesIId(interfaceName);
+                coeUtils.buildKubeProxyServicesIId(interfaceName);
         tx.put(boundServicesInstanceIdentifier, serviceInfo,true);
     }
 
index c481a0d70f7f5175ea3f7f661f889d6ad1a8774a..95abcbd18cc27dddff3610d3e9260cab5093e19a 100644 (file)
@@ -16,6 +16,8 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.UUID;
 import java.util.concurrent.ExecutionException;
+import javax.inject.Inject;
+import javax.inject.Singleton;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.ReadTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@@ -24,6 +26,7 @@ import org.opendaylight.genius.infra.Datastore;
 import org.opendaylight.genius.infra.TypedReadWriteTransaction;
 import org.opendaylight.genius.infra.TypedWriteTransaction;
 import org.opendaylight.genius.mdsalutil.NwConstants;
+import org.opendaylight.genius.networkutils.VniUtils;
 import org.opendaylight.netvirt.coe.api.SouthboundInterfaceInfo;
 import org.opendaylight.netvirt.coe.api.SouthboundInterfaceInfoBuilder;
 import org.opendaylight.netvirt.neutronvpn.api.enums.IpVersionChoice;
@@ -94,6 +97,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@Singleton
 public final class CoeUtils {
     private static final Logger LOG = LoggerFactory.getLogger(CoeUtils.class);
 
@@ -107,7 +111,12 @@ public final class CoeUtils {
                     .put(NetworkAttributes.NetworkType.VXLAN, SegmentTypeVxlan.class)
                     .build();
 
-    private CoeUtils() { }
+    private final VniUtils vniUtils;
+
+    @Inject
+    public CoeUtils(VniUtils vniUtils) {
+        this.vniUtils = vniUtils;
+    }
 
     public static InstanceIdentifier<Interface> buildVlanInterfaceIdentifier(String interfaceName) {
         InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508
@@ -121,6 +130,39 @@ public final class CoeUtils {
         return new StringBuilder().append(networkNS).append(SEPARATOR).append(podName).toString();
     }
 
+    public static Class<? extends SegmentTypeBase> getSegmentTypeFromNetwork(
+            org.opendaylight.yang.gen.v1.urn.opendaylight.coe.northbound.pod.rev170611.pod_attributes.Interface
+                    elanInterface) {
+        return CoeUtils.NETWORK_MAP.get(elanInterface.getNetworkType());
+    }
+
+    public static String buildElanInstanceName(String nodeIp, String networkNS) {
+        return new StringBuilder().append(nodeIp).append(SEPARATOR).append(networkNS).toString();
+    }
+
+    public static InstanceIdentifier<PodIdentifier> getPodMetaInstanceId(String externalInterfaceId) {
+        return InstanceIdentifier.builder(PodidentifierInfo.class)
+                .child(PodIdentifier.class, new PodIdentifierKey(externalInterfaceId)).build();
+    }
+
+    public static InstanceIdentifier<BoundServices> buildKubeProxyServicesIId(String interfaceName) {
+        return InstanceIdentifier.builder(ServiceBindings.class)
+                .child(ServicesInfo.class, new ServicesInfoKey(interfaceName, ServiceModeIngress.class))
+                .child(BoundServices.class, new BoundServicesKey(NwConstants.COE_KUBE_PROXY_SERVICE_INDEX)).build();
+    }
+
+    static InstanceIdentifier<VpnInterface> buildVpnInterfaceIdentifier(String ifName) {
+        InstanceIdentifier<VpnInterface> id = InstanceIdentifier.builder(VpnInterfaces.class).child(VpnInterface
+                .class, new VpnInterfaceKey(ifName)).build();
+        return id;
+    }
+
+    static InstanceIdentifier<ElanInstance> createElanInstanceIdentifier(String elanInstanceName) {
+        InstanceIdentifier<ElanInstance> id = InstanceIdentifier.builder(ElanInstances.class).child(ElanInstance.class,
+                new ElanInstanceKey(elanInstanceName)).build();
+        return id;
+    }
+
     static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces
             .Interface buildInterface(String interfaceName) {
         IfL2vlan.L2vlanMode l2VlanMode = IfL2vlan.L2vlanMode.Trunk;
@@ -134,15 +176,12 @@ public final class CoeUtils {
         return interfaceBuilder.build();
     }
 
-    static ElanInstance buildElanInstance(String elanInstanceName, Class<? extends SegmentTypeBase> segmentType,
-                                           String segmentationId,
-                                           Boolean isExternal) {
+    ElanInstance buildElanInstance(String elanInstanceName, Class<? extends SegmentTypeBase> segmentType,
+                                   Boolean isExternal) throws ExecutionException, InterruptedException {
         ElanInstanceBuilder elanInstanceBuilder = new ElanInstanceBuilder().setElanInstanceName(elanInstanceName);
         if (segmentType != null) {
             elanInstanceBuilder.setSegmentType(segmentType);
-            if (segmentationId != null) {
-                elanInstanceBuilder.setSegmentationId(Long.valueOf(segmentationId));
-            }
+            elanInstanceBuilder.setSegmentationId(vniUtils.getVNI(elanInstanceName).longValue());
         }
 
         elanInstanceBuilder.setExternal(isExternal);
@@ -150,7 +189,7 @@ public final class CoeUtils {
         return elanInstanceBuilder.build();
     }
 
-    public static void createElanInterface(String elanInterfaceName, String elanInstanceName,
+    public void createElanInterface(String elanInterfaceName, String elanInstanceName,
                                            TypedReadWriteTransaction<Datastore.Configuration> wrtConfigTxn) {
         InstanceIdentifier<ElanInterface> id = InstanceIdentifier.builder(ElanInterfaces.class).child(ElanInterface
                 .class, new ElanInterfaceKey(elanInterfaceName)).build();
@@ -160,7 +199,7 @@ public final class CoeUtils {
         LOG.debug("Creating new ELAN Interface {}", elanInterface);
     }
 
-    public static void updateElanInterfaceWithStaticMac(String macAddress, IpAddress ipAddress,
+    public void updateElanInterfaceWithStaticMac(String macAddress, IpAddress ipAddress,
                                                         String elanInterfaceName,
                                                         TypedReadWriteTransaction<Datastore.Configuration>
                                                                 wrtConfigTxn) {
@@ -177,7 +216,7 @@ public final class CoeUtils {
         LOG.debug("Updating ELAN Interface with static mac {}", elanInterface);
     }
 
-    public static void createPodNameToPodUuidMap(String podName, InstanceIdentifier<Pods> pod,
+    public void createPodNameToPodUuidMap(String podName, InstanceIdentifier<Pods> pod,
                                                  TypedWriteTransaction<Datastore.Operational> writeTransaction) {
         InstanceIdentifier<PodIdentifier> id = InstanceIdentifier.builder(PodidentifierInfo.class)
                 .child(PodIdentifier.class, new PodIdentifierKey(podName)).build();
@@ -187,7 +226,7 @@ public final class CoeUtils {
         LOG.debug("Creating podnametouuid map {} to {}", podName, pod);
     }
 
-    public static void deletePodNameToPodUuidMap(String podName,
+    public void deletePodNameToPodUuidMap(String podName,
                                                  TypedWriteTransaction<Datastore.Operational> writeTransaction) {
         InstanceIdentifier<PodIdentifier> id = InstanceIdentifier.builder(PodidentifierInfo.class)
                 .child(PodIdentifier.class, new PodIdentifierKey(podName)).build();
@@ -195,7 +234,7 @@ public final class CoeUtils {
         LOG.debug("Deleting podnametouuid map for {}", podName);
     }
 
-    public static InstanceIdentifier<Pods> getPodUUIDforPodName(String podName, DataBroker dataBroker)
+    public InstanceIdentifier<Pods> getPodUUIDforPodName(String podName, DataBroker dataBroker)
             throws ExecutionException, InterruptedException {
         ReadTransaction readTransaction = dataBroker.newReadOnlyTransaction();
         InstanceIdentifier<PodIdentifier> id = InstanceIdentifier.builder(PodidentifierInfo.class)
@@ -208,7 +247,7 @@ public final class CoeUtils {
         return null;
     }
 
-    public static void deleteElanInterface(String elanInterfaceName,
+    public void deleteElanInterface(String elanInterfaceName,
                                            TypedWriteTransaction<Datastore.Configuration> wrtConfigTxn) {
         InstanceIdentifier<ElanInterface> id = InstanceIdentifier.builder(ElanInterfaces.class).child(ElanInterface
                 .class, new ElanInterfaceKey(elanInterfaceName)).build();
@@ -216,7 +255,7 @@ public final class CoeUtils {
         LOG.debug("Deleting ELAN Interface {}", elanInterfaceName);
     }
 
-    public static String createOfPortInterface(String interfaceName,
+    public String createOfPortInterface(String interfaceName,
                                                TypedReadWriteTransaction<Datastore.Configuration> wrtConfigTxn) {
         org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface inf =
                 buildInterface(interfaceName);
@@ -227,30 +266,14 @@ public final class CoeUtils {
         return infName;
     }
 
-    public static void deleteOfPortInterface(String infName,
+    public void deleteOfPortInterface(String infName,
                                              TypedWriteTransaction<Datastore.Configuration> wrtConfigTxn) {
         LOG.debug("Deleting OFPort Interface {}", infName);
         InstanceIdentifier interfaceIdentifier = CoeUtils.buildVlanInterfaceIdentifier(infName);
         wrtConfigTxn.delete(interfaceIdentifier);
     }
 
-    static InstanceIdentifier<ElanInstance> createElanInstanceIdentifier(String elanInstanceName) {
-        InstanceIdentifier<ElanInstance> id = InstanceIdentifier.builder(ElanInstances.class).child(ElanInstance.class,
-                new ElanInstanceKey(elanInstanceName)).build();
-        return id;
-    }
-
-    public static Class<? extends SegmentTypeBase> getSegmentTypeFromNetwork(
-            org.opendaylight.yang.gen.v1.urn.opendaylight.coe.northbound.pod.rev170611.pod_attributes.Interface
-                    elanInterface) {
-        return CoeUtils.NETWORK_MAP.get(elanInterface.getNetworkType());
-    }
-
-    public static String buildElanInstanceName(String nodeIp, String networkNS) {
-        return new StringBuilder().append(nodeIp).append(SEPARATOR).append(networkNS).toString();
-    }
-
-    public static ElanInstance
+    public ElanInstance
         createElanInstanceForTheFirstPodInTheNetwork(String clusterId, String nodeIp,
                                                  org.opendaylight.yang.gen.v1.urn.opendaylight.coe.northbound.pod
                                                          .rev170611.pod_attributes.Interface podInterface,
@@ -263,18 +286,16 @@ public final class CoeUtils {
             return existingElanInstance;
         }
         Class<? extends SegmentTypeBase> segmentType = getSegmentTypeFromNetwork(podInterface);
-        String segmentationId = String.valueOf(podInterface.getSegmentationId());
         //FIXME String physicalNetworkName = ??
         // TODO external network support not added currently
         Boolean isExternal = false;
-        ElanInstance elanInstance = CoeUtils.buildElanInstance(elanInstanceName, segmentType,
-                segmentationId, isExternal);
+        ElanInstance elanInstance = buildElanInstance(elanInstanceName, segmentType, isExternal);
         wrtConfigTxn.put(id, elanInstance);
         LOG.info("ELAN instance created for the first pod in the network {}", podInterface.getUid());
         return elanInstance;
     }
 
-    public static SouthboundInterfaceInfo getSouthboundInterfaceDetails(OvsdbTerminationPointAugmentation ovsdbTp) {
+    public SouthboundInterfaceInfo getSouthboundInterfaceDetails(OvsdbTerminationPointAugmentation ovsdbTp) {
         SouthboundInterfaceInfoBuilder southboundInterfaceInfoBuilder = new SouthboundInterfaceInfoBuilder();
         if (ovsdbTp != null) {
             List<InterfaceExternalIds> ifaceExtIds = ovsdbTp.getInterfaceExternalIds();
@@ -305,12 +326,7 @@ public final class CoeUtils {
         return southboundInterfaceInfoBuilder.build();
     }
 
-    public static InstanceIdentifier<PodIdentifier> getPodMetaInstanceId(String externalInterfaceId) {
-        return InstanceIdentifier.builder(PodidentifierInfo.class)
-                .child(PodIdentifier.class, new PodIdentifierKey(externalInterfaceId)).build();
-    }
-
-    public static void createVpnInstance(String vpnName, List<String> rd, List<String> irt, List<String> ert,
+    public void createVpnInstance(String vpnName, List<String> rd, List<String> irt, List<String> ert,
                                          VpnInstance.Type type, long l3vni, IpVersionChoice ipVersion,
                                          TypedReadWriteTransaction<Datastore.Configuration> tx) {
         List<VpnTarget> vpnTargetList = new ArrayList<>();
@@ -376,13 +392,7 @@ public final class CoeUtils {
         tx.put(vpnIdentifier, newVpn);
     }
 
-    static InstanceIdentifier<VpnInterface> buildVpnInterfaceIdentifier(String ifName) {
-        InstanceIdentifier<VpnInterface> id = InstanceIdentifier.builder(VpnInterfaces.class).child(VpnInterface
-                .class, new VpnInterfaceKey(ifName)).build();
-        return id;
-    }
-
-    public static void createVpnInterface(String vpnName, Pods pod, String interfaceName, String macAddress,
+    public void createVpnInterface(String vpnName, Pods pod, String interfaceName, String macAddress,
                                           boolean isRouterInterface,
                                           TypedReadWriteTransaction<Datastore.Configuration> wrtConfigTxn) {
         LOG.trace("createVpnInterface for Port: {}, isRouterInterface: {}", interfaceName, isRouterInterface);
@@ -405,14 +415,14 @@ public final class CoeUtils {
 
     }
 
-    public static void deleteVpnInterface(String interfaceName,
+    public void deleteVpnInterface(String interfaceName,
                                           TypedWriteTransaction<Datastore.Configuration> wrtConfigTxn) {
         LOG.trace("deleteVpnInterface for Pod {}", interfaceName);
         InstanceIdentifier<VpnInterface> vpnIfIdentifier = buildVpnInterfaceIdentifier(interfaceName);
         wrtConfigTxn.delete(vpnIfIdentifier);
     }
 
-    static Adjacencies createPortIpAdjacencies(Pods pod, String interfaceName, String macAddress) {
+    Adjacencies createPortIpAdjacencies(Pods pod, String interfaceName, String macAddress) {
         List<Adjacency> adjList = new ArrayList<>();
         LOG.trace("create config adjacencies for Port: {}", interfaceName);
         IpAddress ip = pod.getInterface().get(0).getIpAddress();
@@ -441,13 +451,7 @@ public final class CoeUtils {
         return new AdjacenciesBuilder().setAdjacency(adjList).build();
     }
 
-    public static InstanceIdentifier<BoundServices> buildKubeProxyServicesIId(String interfaceName) {
-        return InstanceIdentifier.builder(ServiceBindings.class)
-                .child(ServicesInfo.class, new ServicesInfoKey(interfaceName, ServiceModeIngress.class))
-                .child(BoundServices.class, new BoundServicesKey(NwConstants.COE_KUBE_PROXY_SERVICE_INDEX)).build();
-    }
-
-    public static void unbindKubeProxyService(String interfaceName, TypedWriteTransaction<Datastore.Configuration> tx) {
+    public void unbindKubeProxyService(String interfaceName, TypedWriteTransaction<Datastore.Configuration> tx) {
         tx.delete(buildKubeProxyServicesIId(interfaceName));
     }
 }
index 73076cd2ba28fc66b4884bd4eb7e0282758dc078..7264ef8e562c44b289bee23e097c24bf599a33df 100644 (file)
@@ -20,6 +20,8 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
                interface="org.opendaylight.infrautils.caches.CacheProvider"/>
     <reference id="iMdsalApiManager"
                interface="org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager"/>
+    <reference id="vniUtils"
+               interface="org.opendaylight.genius.networkutils.VniUtils"/>
 
     <odl:clustered-app-config id="coeConfig"
                               binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.coe.config.rev180703.CoeConfig"