}
}
- private boolean nodeConnectorsExist(Edge e) {
+ private boolean headNodeConnectorExist(Edge e) {
+ /*
+ * Only check the head end point which is supposed to be part of a
+ * network node we control (present in our inventory). If we checked the
+ * tail end point as well, we would not store the edges that connect to
+ * a non sdn enable port on a non sdn capable production switch. We want
+ * to be able to see these switches on the topology.
+ */
NodeConnector head = e.getHeadNodeConnector();
- NodeConnector tail = e.getTailNodeConnector();
- return (switchManager.doesNodeConnectorExist(head) &&
- switchManager.doesNodeConnectorExist(tail));
+ return (switchManager.doesNodeConnectorExist(head));
}
private TopoEdgeUpdate edgeUpdate(Edge e, UpdateType type, Set<Property> props) {
log.trace("Skipping redundant edge addition: {}", e);
return null;
}
- // Ensure that both tail and head node connectors exist.
- if (!nodeConnectorsExist(e)) {
+
+ // Ensure that head node connector exists
+ if (!headNodeConnectorExist(e)) {
log.warn("Ignore edge that contains invalid node connector: {}", e);
return null;
}
@Test
public void testAddDeleteUserLink() {
TopologyUserLinkConfig link1 = new TopologyUserLinkConfig("default1",
- "OF|1@OF|2", "OF|1@OF|2");
+ "OF|1@OF|2", "OF|1@OF|3");
TopologyUserLinkConfig link2 = new TopologyUserLinkConfig("default1",
- "OF|10@OF|20", "OF|10@OF|20");
+ "OF|10@OF|20", "OF|10@OF|30");
TopologyUserLinkConfig link3 = new TopologyUserLinkConfig("default2",
- "OF|1@OF|2", "OF|1@OF|2");
+ "OF|1@OF|2", "OF|1@OF|3");
TopologyUserLinkConfig link4 = new TopologyUserLinkConfig("default20",
- "OF|10@OF|20", "OF|10@OF|20");
+ "OF|10@OF|20", "OF|10@OF|30");
TopologyManagerImpl topoManagerImpl = new TopologyManagerImpl();
TestSwitchManager swMgr = new TestSwitchManager();
Assert.assertTrue(topoManagerImpl.getUserLinks().isEmpty());
TopologyUserLinkConfig badlink1 =
- new TopologyUserLinkConfig("bad1", "OF|1@OF|2", "OF|1@OF|3");
+ new TopologyUserLinkConfig("bad1", "OF|1@OF|4", "OF|1@OF|5");
TopologyUserLinkConfig badlink2 =
- new TopologyUserLinkConfig("bad2", "OF|10@OF|21", "OF|10@OF|20");
+ new TopologyUserLinkConfig("bad2", "OF|10@OF|7", "OF|7@OF|13");
Assert.assertEquals(StatusCode.NOTFOUND,
topoManagerImpl.addUserLink(badlink1).getCode());
Assert.assertEquals(StatusCode.NOTFOUND,
for (int i = 0; i < 5; i++) {
Host host = topoManagerImpl.getHostAttachedToNodeConnector(nc[i]);
- if (i == 4)
+ if (i == 4) {
Assert.assertTrue(host == null);
- else
+ } else {
Assert.assertTrue(host.equals(h[i]));
+ }
}
Set<NodeConnector> ncSet = topoManagerImpl.getNodeConnectorWithHost();