use of org.opennms.netmgt.model.CdpLink in project opennms by OpenNMS.
the class Nms7467EnIT method testCisco01Links.
@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = CISCO_WS_C2948_IP, port = 161, resource = CISCO_WS_C2948_SNMP_RESOURCE) })
public void testCisco01Links() throws Exception {
m_nodeDao.save(builder.getCiscoWsC2948());
m_nodeDao.flush();
m_linkdConfig.getConfiguration().setUseBridgeDiscovery(false);
m_linkdConfig.getConfiguration().setUseOspfDiscovery(false);
m_linkdConfig.getConfiguration().setUseIsisDiscovery(false);
m_linkdConfig.getConfiguration().setUseLldpDiscovery(false);
assertTrue(!m_linkdConfig.useIsisDiscovery());
assertTrue(!m_linkdConfig.useBridgeDiscovery());
assertTrue(!m_linkdConfig.useOspfDiscovery());
assertTrue(!m_linkdConfig.useLldpDiscovery());
assertTrue(m_linkdConfig.useCdpDiscovery());
final OnmsNode cisco01 = m_nodeDao.findByForeignId("linkd", CISCO_WS_C2948_NAME);
assertTrue(m_linkd.scheduleNodeCollection(cisco01.getId()));
assertTrue(m_linkd.runSingleSnmpCollection(cisco01.getId()));
for (final OnmsNode node : m_nodeDao.findAll()) {
assertNotNull(node.getCdpElement());
printCdpElement(node.getCdpElement());
assertEquals(TruthValue.TRUE, node.getCdpElement().getCdpGlobalRun());
assertEquals(CISCO_WS_C2948_GLOBAL_DEVICEID, node.getCdpElement().getCdpGlobalDeviceId());
assertEquals(CdpGlobalDeviceIdFormat.other, node.getCdpElement().getCdpGlobalDeviceIdFormat());
}
assertEquals(5, m_cdpLinkDao.countAll());
for (CdpLink link : m_cdpLinkDao.findAll()) {
assertNotNull(link);
printCdpLink(link);
}
}
use of org.opennms.netmgt.model.CdpLink in project opennms by OpenNMS.
the class EnhancedLinkdTopologyProvider method reverseCdpLink.
private CdpLink reverseCdpLink(OnmsIpInterface iface, CdpElement element, CdpLink link) {
CdpLink reverseLink = new CdpLink();
reverseLink.setId(-link.getId());
reverseLink.setNode(iface.getNode());
reverseLink.setCdpCacheIfIndex(iface.getIfIndex());
reverseLink.setCdpInterfaceName(link.getCdpCacheDevicePort());
reverseLink.setCdpCacheDeviceId(element.getCdpGlobalDeviceId());
reverseLink.setCdpCacheDevicePort(link.getCdpInterfaceName());
return reverseLink;
}
use of org.opennms.netmgt.model.CdpLink in project opennms by OpenNMS.
the class EnhancedLinkdTopologyProvider method getCdpLinks.
private void getCdpLinks(Map<Integer, OnmsNode> nodemap, Map<Integer, List<OnmsSnmpInterface>> nodesnmpmap, Map<Integer, OnmsIpInterface> ipprimarymap, Map<InetAddress, OnmsIpInterface> ipmap) {
Map<Integer, CdpElement> cdpelementmap = new HashMap<Integer, CdpElement>();
for (CdpElement cdpelement : m_cdpElementDao.findAll()) {
cdpelementmap.put(cdpelement.getNode().getId(), cdpelement);
}
List<CdpLink> allLinks = m_cdpLinkDao.findAll();
Set<CdpLinkDetail> combinedLinkDetails = new HashSet<CdpLinkDetail>();
Set<Integer> parsed = new HashSet<Integer>();
for (CdpLink sourceLink : allLinks) {
if (parsed.contains(sourceLink.getId()))
continue;
LOG.debug("loadtopology: cdp link with id '{}' link '{}' ", sourceLink.getId(), sourceLink);
CdpElement sourceCdpElement = cdpelementmap.get(sourceLink.getNode().getId());
CdpLink targetLink = null;
for (CdpLink link : allLinks) {
if (sourceLink.getId().intValue() == link.getId().intValue() || parsed.contains(link.getId()))
continue;
LOG.debug("loadtopology: checking cdp link with id '{}' link '{}' ", link.getId(), link);
CdpElement element = cdpelementmap.get(link.getNode().getId());
//Compare the remote data to the targetNode element data
if (!sourceLink.getCdpCacheDeviceId().equals(element.getCdpGlobalDeviceId()) || !link.getCdpCacheDeviceId().equals(sourceCdpElement.getCdpGlobalDeviceId()))
continue;
if (sourceLink.getCdpInterfaceName().equals(link.getCdpCacheDevicePort()) && link.getCdpInterfaceName().equals(sourceLink.getCdpCacheDevicePort())) {
targetLink = link;
LOG.info("loadtopology: found cdp mutual link: '{}' and '{}' ", sourceLink, targetLink);
break;
}
}
if (targetLink == null) {
if (sourceLink.getCdpCacheAddressType() == CiscoNetworkProtocolType.ip) {
try {
InetAddress targetAddress = InetAddressUtils.addr(sourceLink.getCdpCacheAddress());
if (ipmap.containsKey(targetAddress)) {
targetLink = reverseCdpLink(ipmap.get(targetAddress), sourceCdpElement, sourceLink);
LOG.info("loadtopology: found cdp link using cdp cache address: '{}' and '{}'", sourceLink, targetLink);
}
} catch (Exception e) {
LOG.warn("loadtopology: cannot convert ip address: {}", sourceLink.getCdpCacheAddress(), e);
}
}
}
if (targetLink == null) {
LOG.info("loadtopology: cannot found target node for link: '{}'", sourceLink);
continue;
}
parsed.add(sourceLink.getId());
parsed.add(targetLink.getId());
Vertex source = getOrCreateVertex(nodemap.get(sourceLink.getNode().getId()), ipprimarymap.get(sourceLink.getNode().getId()));
Vertex target = getOrCreateVertex(nodemap.get(targetLink.getNode().getId()), ipprimarymap.get(targetLink.getNode().getId()));
combinedLinkDetails.add(new CdpLinkDetail(Math.min(sourceLink.getId(), targetLink.getId()) + "|" + Math.max(sourceLink.getId(), targetLink.getId()), source, sourceLink, target, targetLink));
}
for (CdpLinkDetail linkDetail : combinedLinkDetails) {
LinkdEdge edge = connectVertices(linkDetail, CDP_EDGE_NAMESPACE);
edge.setTooltipText(getEdgeTooltipText(linkDetail, nodesnmpmap));
}
}
use of org.opennms.netmgt.model.CdpLink in project opennms by OpenNMS.
the class NodeDiscoveryCdp method runCollection.
protected void runCollection() {
final Date now = new Date();
final CdpGlobalGroupTracker cdpGlobalGroup = new CdpGlobalGroupTracker();
SnmpAgentConfig peer = m_linkd.getSnmpAgentConfig(getPrimaryIpAddress(), getLocation());
try {
m_linkd.getLocationAwareSnmpClient().walk(peer, cdpGlobalGroup).withDescription("cdpGlobalGroup").withLocation(getLocation()).execute().get();
} catch (ExecutionException e) {
LOG.info("run: node [{}]: Agent error while scanning the cdpGlobalGroup table", getNodeId(), e);
return;
} catch (final InterruptedException e) {
LOG.info("run: node [{}]: Cdp cdpGlobalGroup collection interrupted, exiting", getNodeId(), e);
return;
}
if (cdpGlobalGroup.getCdpDeviceId() == null) {
LOG.info("run: node [{}]: CDP_MIB not supported", getNodeId());
return;
}
CdpElement cdpElement = cdpGlobalGroup.getCdpElement();
m_linkd.getQueryManager().store(getNodeId(), cdpElement);
if (cdpElement.getCdpGlobalRun() == TruthValue.FALSE) {
LOG.info("run: node [{}]. CDP disabled.", getNodeId());
return;
}
List<CdpLink> links = new ArrayList<CdpLink>();
CdpCacheTableTracker cdpCacheTable = new CdpCacheTableTracker() {
public void processCdpCacheRow(final CdpCacheRow row) {
links.add(row.getLink());
}
};
try {
m_linkd.getLocationAwareSnmpClient().walk(peer, cdpCacheTable).withDescription("cdpCacheTable").withLocation(getLocation()).execute().get();
} catch (ExecutionException e) {
LOG.error("run: node [{}]: collection execution failed, exiting", getNodeId(), e);
return;
} catch (final InterruptedException e) {
LOG.error("run: node [{}]: Cdp Linkd collection interrupted, exiting", getNodeId(), e);
return;
}
final CdpInterfacePortNameGetter cdpInterfacePortNameGetter = new CdpInterfacePortNameGetter(peer, m_linkd.getLocationAwareSnmpClient(), getLocation());
for (CdpLink link : links) m_linkd.getQueryManager().store(getNodeId(), cdpInterfacePortNameGetter.get(link));
m_linkd.getQueryManager().reconcileCdp(getNodeId(), now);
}
use of org.opennms.netmgt.model.CdpLink in project opennms by OpenNMS.
the class Nms17216EnIT method testNetwork17216CdpLinks.
/*
* switch1 GigabitEthernet 0/9 0/10 0/11 0/12 ---> switch2 GigabitEthernet 0/1 0/2 0/3 0/4
* switch1 GigabitEthernet0/1 ---> router1 FastEthernet0/0
*
* switch2 GigabitEthernet 0/1 0/2 0/3 0/4 ---> switch1 GigabitEthernet 0/9 0/10 0/11 0/12
* switch2 GigabitEthernet 0/19 Gi0/20 ---> switch3 FastEthernet 0/19 0/20
*
* switch3 FastEthernet 0/19 0/20 ---> switch2 GigabitEthernet 0/19 0/20
* switch3 FastEthernet 0/23 0/24 ---> switch5 FastEthernet 0/1 0/13
*
* switch4 FastEthernet0/1 ---> router3 GigabitEthernet0/1
*
* switch5 FastEthernet 0/1 0/13 ---> switch3 FastEthernet 0/23 0/24
*
* router1 FastEthernet0/0 ---> switch1 GigabitEthernet0/1
* router1 Serial0/0/0 ---> router2 Serial0/0/0
*
* router2 Serial0/0/0 ---> router1 Serial0/0/0
* router2 Serial0/0/1 ---> router3 Serial0/0/1
*
* router3 GigabitEthernet0/0 ---> router4 GigabitEthernet0/1
* router3 GigabitEthernet0/1 ---> switch4 FastEthernet0/1
* router3 Serial0/0/1 ---> router2 Serial0/0/1
*
* router4 GigabitEthernet0/1 ---> router3 GigabitEthernet0/0
*
*/
@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = SWITCH1_IP, port = 161, resource = SWITCH1_SNMP_RESOURCE), @JUnitSnmpAgent(host = SWITCH2_IP, port = 161, resource = SWITCH2_SNMP_RESOURCE), @JUnitSnmpAgent(host = SWITCH3_IP, port = 161, resource = SWITCH3_SNMP_RESOURCE), @JUnitSnmpAgent(host = SWITCH4_IP, port = 161, resource = SWITCH4_SNMP_RESOURCE), @JUnitSnmpAgent(host = SWITCH5_IP, port = 161, resource = SWITCH5_SNMP_RESOURCE), @JUnitSnmpAgent(host = ROUTER1_IP, port = 161, resource = ROUTER1_SNMP_RESOURCE), @JUnitSnmpAgent(host = ROUTER2_IP, port = 161, resource = ROUTER2_SNMP_RESOURCE), @JUnitSnmpAgent(host = ROUTER3_IP, port = 161, resource = ROUTER3_SNMP_RESOURCE), @JUnitSnmpAgent(host = ROUTER4_IP, port = 161, resource = ROUTER4_SNMP_RESOURCE) })
public void testNetwork17216CdpLinks() throws Exception {
m_nodeDao.save(builder.getSwitch1());
m_nodeDao.save(builder.getSwitch2());
m_nodeDao.save(builder.getSwitch3());
m_nodeDao.save(builder.getSwitch4());
m_nodeDao.save(builder.getSwitch5());
m_nodeDao.save(builder.getRouter1());
m_nodeDao.save(builder.getRouter2());
m_nodeDao.save(builder.getRouter3());
m_nodeDao.save(builder.getRouter4());
m_nodeDao.flush();
m_linkdConfig.getConfiguration().setUseBridgeDiscovery(false);
m_linkdConfig.getConfiguration().setUseCdpDiscovery(true);
m_linkdConfig.getConfiguration().setUseOspfDiscovery(false);
m_linkdConfig.getConfiguration().setUseLldpDiscovery(false);
m_linkdConfig.getConfiguration().setUseIsisDiscovery(false);
assertTrue(!m_linkdConfig.useLldpDiscovery());
assertTrue(m_linkdConfig.useCdpDiscovery());
assertTrue(!m_linkdConfig.useOspfDiscovery());
assertTrue(!m_linkdConfig.useBridgeDiscovery());
assertTrue(!m_linkdConfig.useIsisDiscovery());
final OnmsNode switch1 = m_nodeDao.findByForeignId("linkd", SWITCH1_NAME);
final OnmsNode switch2 = m_nodeDao.findByForeignId("linkd", SWITCH2_NAME);
final OnmsNode switch3 = m_nodeDao.findByForeignId("linkd", SWITCH3_NAME);
final OnmsNode switch4 = m_nodeDao.findByForeignId("linkd", SWITCH4_NAME);
final OnmsNode switch5 = m_nodeDao.findByForeignId("linkd", SWITCH5_NAME);
final OnmsNode router1 = m_nodeDao.findByForeignId("linkd", ROUTER1_NAME);
final OnmsNode router2 = m_nodeDao.findByForeignId("linkd", ROUTER2_NAME);
final OnmsNode router3 = m_nodeDao.findByForeignId("linkd", ROUTER3_NAME);
final OnmsNode router4 = m_nodeDao.findByForeignId("linkd", ROUTER4_NAME);
assertTrue(m_linkd.scheduleNodeCollection(switch1.getId()));
assertTrue(m_linkd.scheduleNodeCollection(switch2.getId()));
assertTrue(m_linkd.scheduleNodeCollection(switch3.getId()));
assertTrue(m_linkd.scheduleNodeCollection(switch4.getId()));
assertTrue(m_linkd.scheduleNodeCollection(switch5.getId()));
assertTrue(m_linkd.scheduleNodeCollection(router1.getId()));
assertTrue(m_linkd.scheduleNodeCollection(router2.getId()));
assertTrue(m_linkd.scheduleNodeCollection(router3.getId()));
assertTrue(m_linkd.scheduleNodeCollection(router4.getId()));
assertTrue(m_linkd.runSingleSnmpCollection(switch1.getId()));
assertEquals(5, m_cdpLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(switch2.getId()));
assertEquals(11, m_cdpLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(switch3.getId()));
assertEquals(15, m_cdpLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(switch4.getId()));
assertEquals(16, m_cdpLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(switch5.getId()));
assertEquals(18, m_cdpLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(router1.getId()));
assertEquals(20, m_cdpLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(router2.getId()));
assertEquals(22, m_cdpLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(router3.getId()));
assertEquals(25, m_cdpLinkDao.countAll());
assertTrue(m_linkd.runSingleSnmpCollection(router4.getId()));
assertEquals(26, m_cdpLinkDao.countAll());
assertEquals(13, m_cdpLinkDao.findLinksForTopology().size());
for (final OnmsNode node : m_nodeDao.findAll()) {
assertNotNull(node.getCdpElement());
printCdpElement(node.getCdpElement());
assertEquals(TruthValue.TRUE, node.getCdpElement().getCdpGlobalRun());
if (node.getId().intValue() == switch1.getId().intValue()) {
assertEquals(SWITCH1_NAME, node.getCdpElement().getCdpGlobalDeviceId());
} else if (node.getId().intValue() == switch2.getId().intValue()) {
assertEquals(SWITCH2_NAME, node.getCdpElement().getCdpGlobalDeviceId());
} else if (node.getId().intValue() == switch3.getId().intValue()) {
assertEquals(SWITCH3_NAME, node.getCdpElement().getCdpGlobalDeviceId());
} else if (node.getId().intValue() == switch4.getId().intValue()) {
assertEquals(SWITCH4_NAME, node.getCdpElement().getCdpGlobalDeviceId());
} else if (node.getId().intValue() == switch5.getId().intValue()) {
assertEquals(SWITCH5_NAME, node.getCdpElement().getCdpGlobalDeviceId());
} else if (node.getId().intValue() == router1.getId().intValue()) {
assertEquals(ROUTER1_NAME, node.getCdpElement().getCdpGlobalDeviceId());
} else if (node.getId().intValue() == router2.getId().intValue()) {
assertEquals(ROUTER2_NAME, node.getCdpElement().getCdpGlobalDeviceId());
} else if (node.getId().intValue() == router3.getId().intValue()) {
assertEquals(ROUTER3_NAME, node.getCdpElement().getCdpGlobalDeviceId());
} else if (node.getId().intValue() == router4.getId().intValue()) {
assertEquals(ROUTER4_NAME, node.getCdpElement().getCdpGlobalDeviceId());
} else {
assertTrue(false);
}
}
for (CdpLink link : m_cdpLinkDao.findAll()) {
printCdpLink(link);
assertEquals(CiscoNetworkProtocolType.ip, link.getCdpCacheAddressType());
if (link.getNode().getId().intValue() == switch1.getId().intValue()) {
if (link.getCdpCacheIfIndex().intValue() == 10101 && link.getCdpCacheDeviceIndex().intValue() == 1) {
assertEquals(SWITCH1_IF_IFDESCR_MAP.get(10101), link.getCdpInterfaceName());
assertEquals(ROUTER1_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, 2800 Software (C2800NM-ADVENTERPRISEK9-M), Version 12.4(24)T1, RELEASE SOFTWARE (fc3) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2009 by Cisco Systems, Inc. Compiled Fri 19-Jun-09 15:13 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(ROUTER1_NAME, link.getCdpCacheDeviceId());
assertEquals("Cisco 2811", link.getCdpCacheDevicePlatform());
assertEquals(ROUTER1_IF_IFDESCR_MAP.get(7), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 10109 && link.getCdpCacheDeviceIndex().intValue() == 5) {
assertEquals(SWITCH1_IF_IFDESCR_MAP.get(10109), link.getCdpInterfaceName());
assertEquals(SWITCH2_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(58)SE1, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Thu 05-May-11 02:53 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH2_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C2960G-24TC-L", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH2_IF_IFDESCR_MAP.get(10101), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 10110 && link.getCdpCacheDeviceIndex().intValue() == 2) {
assertEquals(SWITCH1_IF_IFDESCR_MAP.get(10110), link.getCdpInterfaceName());
assertEquals(SWITCH2_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(58)SE1, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Thu 05-May-11 02:53 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH2_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C2960G-24TC-L", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH2_IF_IFDESCR_MAP.get(10102), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 10111 && link.getCdpCacheDeviceIndex().intValue() == 3) {
assertEquals(SWITCH1_IF_IFDESCR_MAP.get(10111), link.getCdpInterfaceName());
assertEquals(SWITCH2_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(58)SE1, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Thu 05-May-11 02:53 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH2_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C2960G-24TC-L", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH2_IF_IFDESCR_MAP.get(10103), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 10112 && link.getCdpCacheDeviceIndex().intValue() == 4) {
assertEquals(SWITCH1_IF_IFDESCR_MAP.get(10112), link.getCdpInterfaceName());
assertEquals(SWITCH2_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(58)SE1, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Thu 05-May-11 02:53 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH2_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C2960G-24TC-L", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH2_IF_IFDESCR_MAP.get(10104), link.getCdpCacheDevicePort());
} else {
assertTrue(false);
}
} else if (link.getNode().getId().intValue() == switch2.getId().intValue()) {
if (link.getCdpCacheIfIndex().intValue() == 10101 && link.getCdpCacheDeviceIndex().intValue() == 3) {
assertEquals(SWITCH2_IF_IFDESCR_MAP.get(10101), link.getCdpInterfaceName());
assertEquals(SWITCH1_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C3560 Software (C3560-IPSERVICESK9-M), Version 12.2(58)SE1, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Thu 05-May-11 02:19 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH1_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C3560G-24PS", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH1_IF_IFDESCR_MAP.get(10109), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 10102 && link.getCdpCacheDeviceIndex().intValue() == 4) {
assertEquals(SWITCH2_IF_IFDESCR_MAP.get(10102), link.getCdpInterfaceName());
assertEquals(SWITCH1_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C3560 Software (C3560-IPSERVICESK9-M), Version 12.2(58)SE1, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Thu 05-May-11 02:19 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH1_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C3560G-24PS", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH1_IF_IFDESCR_MAP.get(10110), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 10103 && link.getCdpCacheDeviceIndex().intValue() == 5) {
assertEquals(SWITCH2_IF_IFDESCR_MAP.get(10103), link.getCdpInterfaceName());
assertEquals(SWITCH1_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C3560 Software (C3560-IPSERVICESK9-M), Version 12.2(58)SE1, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Thu 05-May-11 02:19 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH1_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C3560G-24PS", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH1_IF_IFDESCR_MAP.get(10111), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 10104 && link.getCdpCacheDeviceIndex().intValue() == 6) {
assertEquals(SWITCH2_IF_IFDESCR_MAP.get(10104), link.getCdpInterfaceName());
assertEquals(SWITCH1_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C3560 Software (C3560-IPSERVICESK9-M), Version 12.2(58)SE1, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Thu 05-May-11 02:19 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH1_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C3560G-24PS", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH1_IF_IFDESCR_MAP.get(10112), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 10119 && link.getCdpCacheDeviceIndex().intValue() == 1) {
assertEquals(SWITCH2_IF_IFDESCR_MAP.get(10119), link.getCdpInterfaceName());
assertEquals(SWITCH3_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(50)SE5, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2010 by Cisco Systems, Inc. Compiled Tue 28-Sep-10 13:44 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH3_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C2960-24TT-L", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH3_IF_IFDESCR_MAP.get(10019), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 10120 && link.getCdpCacheDeviceIndex().intValue() == 2) {
assertEquals(SWITCH2_IF_IFDESCR_MAP.get(10120), link.getCdpInterfaceName());
assertEquals(SWITCH3_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(50)SE5, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2010 by Cisco Systems, Inc. Compiled Tue 28-Sep-10 13:44 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH3_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C2960-24TT-L", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH3_IF_IFDESCR_MAP.get(10020), link.getCdpCacheDevicePort());
} else {
assertTrue(false);
}
} else if (link.getNode().getId().intValue() == switch3.getId().intValue()) {
if (link.getCdpCacheIfIndex().intValue() == 10019 && link.getCdpCacheDeviceIndex().intValue() == 3) {
assertEquals(SWITCH3_IF_IFDESCR_MAP.get(10019), link.getCdpInterfaceName());
assertEquals(SWITCH2_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(58)SE1, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Thu 05-May-11 02:53 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH2_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C2960G-24TC-L", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH2_IF_IFDESCR_MAP.get(10119), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 10020 && link.getCdpCacheDeviceIndex().intValue() == 4) {
assertEquals(SWITCH3_IF_IFDESCR_MAP.get(10020), link.getCdpInterfaceName());
assertEquals(SWITCH2_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(58)SE1, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Thu 05-May-11 02:53 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH2_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C2960G-24TC-L", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH2_IF_IFDESCR_MAP.get(10120), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 10023 && link.getCdpCacheDeviceIndex().intValue() == 1) {
assertEquals(SWITCH3_IF_IFDESCR_MAP.get(10023), link.getCdpInterfaceName());
assertEquals(SWITCH5_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(50)SE5, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2010 by Cisco Systems, Inc. Compiled Tue 28-Sep-10 13:44 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH5_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C2960-24TT-L", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH5_IF_IFDESCR_MAP.get(10001), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 10024 && link.getCdpCacheDeviceIndex().intValue() == 2) {
assertEquals(SWITCH3_IF_IFDESCR_MAP.get(10024), link.getCdpInterfaceName());
assertEquals(SWITCH5_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(50)SE5, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2010 by Cisco Systems, Inc. Compiled Tue 28-Sep-10 13:44 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH5_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C2960-24TT-L", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH5_IF_IFDESCR_MAP.get(10013), link.getCdpCacheDevicePort());
} else {
assertTrue(false);
}
} else if (link.getNode().getId().intValue() == switch4.getId().intValue()) {
if (link.getCdpCacheIfIndex().intValue() == 10001 && link.getCdpCacheDeviceIndex().intValue() == 1) {
assertEquals(SWITCH4_IF_IFDESCR_MAP.get(10001), link.getCdpInterfaceName());
assertEquals(ROUTER3_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version 15.1(4)M4, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2012 by Cisco Systems, Inc. Compiled Tue 20-Mar-12 18:57 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(ROUTER3_NAME, link.getCdpCacheDeviceId());
assertEquals("Cisco CISCO2911/K9", link.getCdpCacheDevicePlatform());
assertEquals(ROUTER3_IF_IFDESCR_MAP.get(9), link.getCdpCacheDevicePort());
} else {
assertTrue(false);
}
} else if (link.getNode().getId().intValue() == switch5.getId().intValue()) {
if (link.getCdpCacheIfIndex().intValue() == 10001 && link.getCdpCacheDeviceIndex().intValue() == 1) {
assertEquals(SWITCH5_IF_IFDESCR_MAP.get(10001), link.getCdpInterfaceName());
assertEquals(SWITCH3_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(50)SE5, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2010 by Cisco Systems, Inc. Compiled Tue 28-Sep-10 13:44 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH3_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C2960-24TT-L", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH3_IF_IFDESCR_MAP.get(10023), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 10013 && link.getCdpCacheDeviceIndex().intValue() == 2) {
assertEquals(SWITCH5_IF_IFDESCR_MAP.get(10013), link.getCdpInterfaceName());
assertEquals(SWITCH3_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(50)SE5, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2010 by Cisco Systems, Inc. Compiled Tue 28-Sep-10 13:44 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH3_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C2960-24TT-L", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH3_IF_IFDESCR_MAP.get(10024), link.getCdpCacheDevicePort());
} else {
assertTrue(false);
}
} else if (link.getNode().getId().intValue() == router1.getId().intValue()) {
if (link.getCdpCacheIfIndex().intValue() == 7 && link.getCdpCacheDeviceIndex().intValue() == 2) {
assertEquals(ROUTER1_IF_IFDESCR_MAP.get(7), link.getCdpInterfaceName());
assertEquals(10101, SWITCH1_IP_IF_MAP.get(InetAddressUtils.addr(link.getCdpCacheAddress())).intValue());
assertEquals("Cisco IOS Software, C3560 Software (C3560-IPSERVICESK9-M), Version 12.2(58)SE1, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2011 by Cisco Systems, Inc. Compiled Thu 05-May-11 02:19 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH1_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C3560G-24PS", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH1_IF_IFDESCR_MAP.get(10101), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 13 && link.getCdpCacheDeviceIndex().intValue() == 1) {
assertEquals(ROUTER1_IF_IFDESCR_MAP.get(13), link.getCdpInterfaceName());
assertEquals(12, ROUTER2_IP_IF_MAP.get(InetAddressUtils.addr(link.getCdpCacheAddress())).intValue());
assertEquals("Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version 15.1(4)M4, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2012 by Cisco Systems, Inc. Compiled Tue 20-Mar-12 18:57 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(ROUTER2_NAME, link.getCdpCacheDeviceId());
assertEquals("Cisco CISCO2911/K9", link.getCdpCacheDevicePlatform());
assertEquals(ROUTER2_IF_IFDESCR_MAP.get(12), link.getCdpCacheDevicePort());
} else {
assertTrue(false);
}
} else if (link.getNode().getId().intValue() == router2.getId().intValue()) {
if (link.getCdpCacheIfIndex().intValue() == 12 && link.getCdpCacheDeviceIndex().intValue() == 2) {
assertEquals(ROUTER2_IF_IFDESCR_MAP.get(12), link.getCdpInterfaceName());
assertEquals(13, ROUTER1_IP_IF_MAP.get(InetAddressUtils.addr(link.getCdpCacheAddress())).intValue());
assertEquals("Cisco IOS Software, 2800 Software (C2800NM-ADVENTERPRISEK9-M), Version 12.4(24)T1, RELEASE SOFTWARE (fc3) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2009 by Cisco Systems, Inc. Compiled Fri 19-Jun-09 15:13 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(ROUTER1_NAME, link.getCdpCacheDeviceId());
assertEquals("Cisco 2811", link.getCdpCacheDevicePlatform());
assertEquals(ROUTER1_IF_IFDESCR_MAP.get(13), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 13 && link.getCdpCacheDeviceIndex().intValue() == 1) {
assertEquals(ROUTER2_IF_IFDESCR_MAP.get(13), link.getCdpInterfaceName());
assertEquals(13, ROUTER3_IP_IF_MAP.get(InetAddressUtils.addr(link.getCdpCacheAddress())).intValue());
assertEquals("Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version 15.1(4)M4, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2012 by Cisco Systems, Inc. Compiled Tue 20-Mar-12 18:57 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(ROUTER3_NAME, link.getCdpCacheDeviceId());
assertEquals("Cisco CISCO2911/K9", link.getCdpCacheDevicePlatform());
assertEquals(ROUTER3_IF_IFDESCR_MAP.get(13), link.getCdpCacheDevicePort());
} else {
assertTrue(false);
}
} else if (link.getNode().getId().intValue() == router3.getId().intValue()) {
if (link.getCdpCacheIfIndex().intValue() == 8 && link.getCdpCacheDeviceIndex().intValue() == 2) {
assertEquals(ROUTER3_IF_IFDESCR_MAP.get(8), link.getCdpInterfaceName());
assertEquals(3, ROUTER4_IP_IF_MAP.get(InetAddressUtils.addr(link.getCdpCacheAddress())).intValue());
assertEquals("Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version 15.1(4)M4, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2012 by Cisco Systems, Inc. Compiled Tue 20-Mar-12 18:57 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(ROUTER4_NAME, link.getCdpCacheDeviceId());
assertEquals("Cisco CISCO2911/K9", link.getCdpCacheDevicePlatform());
assertEquals(ROUTER4_IF_IFDESCR_MAP.get(3), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 9 && link.getCdpCacheDeviceIndex().intValue() == 3) {
assertEquals(ROUTER3_IF_IFDESCR_MAP.get(9), link.getCdpInterfaceName());
assertEquals(SWITCH4_IP, link.getCdpCacheAddress());
assertEquals("Cisco IOS Software, C2960 Software (C2960-LANBASEK9-M), Version 12.2(50)SE5, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2010 by Cisco Systems, Inc. Compiled Tue 28-Sep-10 13:44 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(SWITCH4_NAME, link.getCdpCacheDeviceId());
assertEquals("cisco WS-C2960-24TT-L", link.getCdpCacheDevicePlatform());
assertEquals(SWITCH4_IF_IFDESCR_MAP.get(10001), link.getCdpCacheDevicePort());
} else if (link.getCdpCacheIfIndex().intValue() == 13 && link.getCdpCacheDeviceIndex().intValue() == 1) {
assertEquals(ROUTER3_IF_IFDESCR_MAP.get(13), link.getCdpInterfaceName());
assertEquals(13, ROUTER2_IP_IF_MAP.get(InetAddressUtils.addr(link.getCdpCacheAddress())).intValue());
assertEquals("Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version 15.1(4)M4, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2012 by Cisco Systems, Inc. Compiled Tue 20-Mar-12 18:57 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(ROUTER2_NAME, link.getCdpCacheDeviceId());
assertEquals("Cisco CISCO2911/K9", link.getCdpCacheDevicePlatform());
assertEquals(ROUTER2_IF_IFDESCR_MAP.get(13), link.getCdpCacheDevicePort());
} else {
assertTrue(false);
}
} else if (link.getNode().getId().intValue() == router4.getId().intValue()) {
if (link.getCdpCacheIfIndex().intValue() == 3 && link.getCdpCacheDeviceIndex().intValue() == 1) {
assertEquals(ROUTER4_IF_IFDESCR_MAP.get(3), link.getCdpInterfaceName());
assertEquals(8, ROUTER3_IP_IF_MAP.get(InetAddressUtils.addr(link.getCdpCacheAddress())).intValue());
assertEquals("Cisco IOS Software, C2900 Software (C2900-UNIVERSALK9-M), Version 15.1(4)M4, RELEASE SOFTWARE (fc1) Technical Support: http://www.cisco.com/techsupport Copyright (c) 1986-2012 by Cisco Systems, Inc. Compiled Tue 20-Mar-12 18:57 by prod_rel_team", link.getCdpCacheVersion());
assertEquals(ROUTER3_NAME, link.getCdpCacheDeviceId());
assertEquals("Cisco CISCO2911/K9", link.getCdpCacheDevicePlatform());
assertEquals(ROUTER3_IF_IFDESCR_MAP.get(8), link.getCdpCacheDevicePort());
} else {
assertTrue(false);
}
} else {
assertTrue(false);
}
}
}
Aggregations