COE: elan-interface creation exception 89/78789/6
authorFaseela K <faseela.k@ericsson.com>
Fri, 14 Dec 2018 09:37:01 +0000 (15:07 +0530)
committerSam Hague <shague@redhat.com>
Sun, 27 Jan 2019 15:26:32 +0000 (15:26 +0000)
JIRA: NETVIRT-1533

Change-Id: Ieb8e914a950c39b9e436ba2a6c744a9329c4bfb5
Signed-off-by: Faseela K <faseela.k@ericsson.com>
Signed-off-by: Sam Hague <shague@redhat.com>
coe/impl/src/main/java/org/opendaylight/netvirt/coe/listeners/TerminationPointStateListener.java
coe/impl/src/main/java/org/opendaylight/netvirt/coe/utils/CoeUtils.java

index 22d49058f2fe0f5618b7d13975ebd46c42b1aa9e..3195634516db0091606e7be8498134f5345f48ef 100644 (file)
@@ -104,10 +104,13 @@ public class TerminationPointStateListener extends
                                 Pods pods = podsCache.get(instanceIdentifier).get();
                                 if (pods != null) {
                                     IpAddress podIpAddress = pods.getInterface().get(0).getIpAddress();
+                                    String clusterId = pods.getClusterId().getValue();
+                                    String elanInstanceName = CoeUtils.buildElanInstanceName(
+                                            pods.getHostIpAddress().stringValue(), clusterId);
                                     coeUtils.updateElanInterfaceWithStaticMac(macAddress, podIpAddress,
-                                            interfaceName, tx);
+                                            interfaceName, elanInstanceName, tx);
                                     if (!isServiceGateway) {
-                                        coeUtils.createVpnInterface(pods.getClusterId().getValue(), pods, interfaceName,
+                                        coeUtils.createVpnInterface(clusterId, pods, interfaceName,
                                                 macAddress,false, tx);
                                         LOG.debug("Bind Kube Proxy Service for {}", interfaceName);
                                         bindKubeProxyService(tx, interfaceName);
index e669d15868b6f5e145423f2f8996c883efa43f52..996e382ac7604ecffc1c7f43caf8c19915a77f6e 100644 (file)
@@ -201,9 +201,8 @@ public final class CoeUtils {
     }
 
     public void updateElanInterfaceWithStaticMac(String macAddress, IpAddress ipAddress,
-                                                        String elanInterfaceName,
-                                                        TypedReadWriteTransaction<Datastore.Configuration>
-                                                                wrtConfigTxn) {
+                                                 String elanInterfaceName, String elanInstanceName,
+                                                 TypedReadWriteTransaction<Datastore.Configuration> wrtConfigTxn) {
         InstanceIdentifier<ElanInterface> id = InstanceIdentifier.builder(ElanInterfaces.class).child(ElanInterface
                 .class, new ElanInterfaceKey(elanInterfaceName)).build();
         PhysAddress physAddress = PhysAddress.getDefaultInstance(macAddress);
@@ -212,7 +211,8 @@ public final class CoeUtils {
                 physAddress)).setMacAddress(physAddress).setIpPrefix(ipAddress).build();
         staticMacEntriesList.add(staticMacEntries);
         ElanInterface elanInterface = new ElanInterfaceBuilder().setName(elanInterfaceName)
-                .withKey(new ElanInterfaceKey(elanInterfaceName)).setStaticMacEntries(staticMacEntriesList).build();
+                .setElanInstanceName(elanInstanceName).withKey(
+                        new ElanInterfaceKey(elanInterfaceName)).setStaticMacEntries(staticMacEntriesList).build();
         wrtConfigTxn.merge(id, elanInterface);
         LOG.debug("Updating ELAN Interface with static mac {}", elanInterface);
     }