ISSUE: Discovery service is able to discover any non SDN enable
switch directly conencted to the controlled SDN switches which
advertise itself through LLDP. It is a nice feature to be able
to see on the topology to which non-SDN switches the controlled
network nodes are conencted to.
Change in https://git.opendaylight.org/gerrit/#/c/1450/ breaks this feature.
CHANGE: Limit the validation check introduced in the above commit
to the edge head end point only.
Change-Id: I081f4320a73eea9bf2a39ca80717771d9c7adfb3
Signed-off-by: Alessandro Boch <aboch@cisco.com>
- 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 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) {
}
private TopoEdgeUpdate edgeUpdate(Edge e, UpdateType type, Set<Property> props) {
log.trace("Skipping redundant edge addition: {}", e);
return null;
}
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;
}
log.warn("Ignore edge that contains invalid node connector: {}", e);
return null;
}
@Test
public void testAddDeleteUserLink() {
TopologyUserLinkConfig link1 = new TopologyUserLinkConfig("default1",
@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",
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",
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",
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();
TopologyManagerImpl topoManagerImpl = new TopologyManagerImpl();
TestSwitchManager swMgr = new TestSwitchManager();
Assert.assertTrue(topoManagerImpl.getUserLinks().isEmpty());
TopologyUserLinkConfig badlink1 =
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 =
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,
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]);
for (int i = 0; i < 5; i++) {
Host host = topoManagerImpl.getHostAttachedToNodeConnector(nc[i]);
Assert.assertTrue(host == null);
Assert.assertTrue(host == null);
Assert.assertTrue(host.equals(h[i]));
Assert.assertTrue(host.equals(h[i]));
}
Set<NodeConnector> ncSet = topoManagerImpl.getNodeConnectorWithHost();
}
Set<NodeConnector> ncSet = topoManagerImpl.getNodeConnectorWithHost();