Make sure we record a reused node 77/4577/2
authorRobert Varga <rovarga@cisco.com>
Wed, 22 Jan 2014 13:27:28 +0000 (14:27 +0100)
committerRobert Varga <rovarga@cisco.com>
Wed, 22 Jan 2014 13:33:47 +0000 (14:33 +0100)
This fixes a bug where we fail to record the base node identifier when
we reuse an already-existing node in MD-SAL.

Change-Id: I33f407810da6ab452a0c12933d3572bfa14a1f53
Signed-off-by: Robert Varga <rovarga@cisco.com>
pcep/topology-provider/src/main/java/org/opendaylight/bgpcep/pcep/topology/provider/ServerSessionManager.java

index 95e5ec79cf0f42e155fecefe2db58a8052685b72..4448330f196c7cde15ced8d7f2a45a7c74bb3969 100644 (file)
@@ -124,6 +124,9 @@ final class ServerSessionManager implements SessionListenerFactory<PCEPSessionLi
                        for (final Node n : topo.getNode()) {
                                LOG.debug("Matching topology node {} to id {}", n, pccId);
                                if (n.getNodeId().getValue().equals(pccId)) {
+                                       this.topologyNode =
+                                                       InstanceIdentifier.builder(ServerSessionManager.this.topology).child(Node.class, n.getKey()).toInstance();
+                                       LOG.debug("Reusing topology node {} for id {} at {}", n, pccId, this.topologyNode);
                                        return n;
                                }
                        }
@@ -139,6 +142,7 @@ final class ServerSessionManager implements SessionListenerFactory<PCEPSessionLi
                        final Node ret = new NodeBuilder().setKey(nk).setNodeId(id).build();
 
                        trans.putOperationalData(nti, ret);
+                       LOG.debug("Created topology node {} for id {} at {}", ret, pccId, nti);
                        this.ownsTopology = true;
                        this.topologyNode = nti;
                        return ret;