OPNFLWPLUG-1032: Neon-MRI: Bump odlparent, yangtools, mdsal
[openflowplugin.git] / applications / forwardingrules-manager / src / main / java / org / opendaylight / openflowplugin / applications / frm / impl / FlowNodeReconciliationImpl.java
index 7f62bdd138ee203916133c117257905fb371326c..c4e9ad8b726980fa60d30512b4e312df3f88f1e1 100644 (file)
@@ -65,9 +65,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.StaleGroup;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.StaleGroupKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.AddBundleMessagesInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.AddBundleMessagesInputBuilder;
@@ -175,7 +175,7 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
 
         @Override
         public Boolean call() {
-            String node = nodeIdentity.firstKeyOf(Node.class, NodeKey.class).getId().getValue();
+            String node = nodeIdentity.firstKeyOf(Node.class).getId().getValue();
             Optional<FlowCapableNode> flowNode = Optional.absent();
             BundleId bundleIdValue = new BundleId(BUNDLE_ID.getAndIncrement());
             BigInteger dpnId = getDpnIdFromNodeName(node);
@@ -272,6 +272,8 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
     public ListenableFuture<Boolean> startReconciliation(DeviceInfo node) {
         InstanceIdentifier<FlowCapableNode> connectedNode = node.getNodeInstanceIdentifier()
                 .augmentation(FlowCapableNode.class);
+        // Clearing the group registry cache for the connected node if exists
+        provider.getDevicesGroupRegistry().clearNodeGroups(node.getNodeId());
         return futureMap.computeIfAbsent(node, future -> reconcileConfiguration(connectedNode));
     }
 
@@ -307,7 +309,7 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
 
         @Override
         public Boolean call() {
-            String node = nodeIdentity.firstKeyOf(Node.class, NodeKey.class).getId().getValue();
+            String node = nodeIdentity.firstKeyOf(Node.class).getId().getValue();
             BigInteger dpnId = getDpnIdFromNodeName(node);
 
             ReadOnlyTransaction trans = provider.getReadTranaction();
@@ -731,6 +733,8 @@ public class FlowNodeReconciliationImpl implements FlowNodeReconciliation {
 
         if (flowNode.get().getGroup() != null) {
             for (Group gr : flowNode.get().getGroup()) {
+                NodeId nodeId = nodeRef.getValue().firstKeyOf(Node.class).getId();
+                provider.getDevicesGroupRegistry().storeGroup(nodeId,gr.getGroupId().getValue());
                 messages.add(new MessageBuilder().setNode(nodeRef).setBundleInnerMessage(new BundleAddGroupCaseBuilder()
                         .setAddGroupCaseData(new AddGroupCaseDataBuilder(gr).build()).build()).build());
             }