/* * (3)10.1.1.2<>R1<>10.1.3.1 (2)---(1) 10.1.3.2 <>R3<> * 10.1.2.1 <>R3<> * (1) <>R3<> * | <>R3<>10.1.4.1 (2)---(1) 10.1.4.2<>R4 * (1) <>R3<> * 10.1.2.2 <>R3<> * <>R2<>10.1.5.1 (2)---(3) 10.1.5.2 <>R3<> */ @Test @JUnitSnmpAgents( value = { @JUnitSnmpAgent( host = "10.1.1.2", port = 161, resource = "classpath:linkd/nms4005/10.1.1.2-walk.txt"), @JUnitSnmpAgent( host = "10.1.2.2", port = 161, resource = "classpath:linkd/nms4005/10.1.2.2-walk.txt"), @JUnitSnmpAgent( host = "10.1.3.2", port = 161, resource = "classpath:linkd/nms4005/10.1.3.2-walk.txt"), @JUnitSnmpAgent( host = "10.1.4.2", port = 161, resource = "classpath:linkd/nms4005/10.1.4.2-walk.txt") }) public void testNms4005Network() throws Exception { m_nodeDao.save(getR1()); m_nodeDao.save(getR2()); m_nodeDao.save(getR3()); m_nodeDao.save(getR4()); final OnmsNode cisco1 = m_nodeDao.findByForeignId("linkd", R1_NAME); final OnmsNode cisco2 = m_nodeDao.findByForeignId("linkd", R2_NAME); final OnmsNode cisco3 = m_nodeDao.findByForeignId("linkd", R3_NAME); final OnmsNode cisco4 = m_nodeDao.findByForeignId("linkd", R4_NAME); assertTrue(m_linkd.scheduleNodeCollection(cisco1.getId())); assertTrue(m_linkd.scheduleNodeCollection(cisco2.getId())); assertTrue(m_linkd.scheduleNodeCollection(cisco3.getId())); assertTrue(m_linkd.scheduleNodeCollection(cisco4.getId())); assertTrue(m_linkd.runSingleSnmpCollection(cisco1.getId())); assertTrue(m_linkd.runSingleSnmpCollection(cisco2.getId())); assertTrue(m_linkd.runSingleSnmpCollection(cisco3.getId())); assertTrue(m_linkd.runSingleSnmpCollection(cisco4.getId())); assertTrue(m_linkd.runSingleLinkDiscovery("example1")); final List<DataLinkInterface> ifaces = m_dataLinkInterfaceDao.findAll(); for (final DataLinkInterface link : ifaces) { printLink(link); } assertEquals("we should have found 4 data links", 4, ifaces.size()); // Rerun collectionand discovery must be all the same... assertTrue(m_linkd.runSingleSnmpCollection(cisco1.getId())); assertTrue(m_linkd.runSingleSnmpCollection(cisco2.getId())); assertTrue(m_linkd.runSingleSnmpCollection(cisco3.getId())); assertTrue(m_linkd.runSingleSnmpCollection(cisco4.getId())); assertTrue(m_linkd.runSingleLinkDiscovery("example1")); assertEquals("we should have found 4 data links", 4, ifaces.size()); }
/** * This test is the same as {@link #testNms4005Network()} except that it spawns multiple threads * for each scan to ensure that the upsert code is working properly. */ @Test @JUnitSnmpAgents( value = { @JUnitSnmpAgent( host = "10.1.1.2", port = 161, resource = "classpath:linkd/nms4005/10.1.1.2-walk.txt"), @JUnitSnmpAgent( host = "10.1.2.2", port = 161, resource = "classpath:linkd/nms4005/10.1.2.2-walk.txt"), @JUnitSnmpAgent( host = "10.1.3.2", port = 161, resource = "classpath:linkd/nms4005/10.1.3.2-walk.txt"), @JUnitSnmpAgent( host = "10.1.4.2", port = 161, resource = "classpath:linkd/nms4005/10.1.4.2-walk.txt") }) public void testNms4005NetworkWithThreads() throws Exception { m_nodeDao.save(getR1()); m_nodeDao.save(getR2()); m_nodeDao.save(getR3()); m_nodeDao.save(getR4()); final OnmsNode cisco1 = m_nodeDao.findByForeignId("linkd", R1_NAME); final OnmsNode cisco2 = m_nodeDao.findByForeignId("linkd", R2_NAME); final OnmsNode cisco3 = m_nodeDao.findByForeignId("linkd", R3_NAME); final OnmsNode cisco4 = m_nodeDao.findByForeignId("linkd", R4_NAME); assertTrue(m_linkd.scheduleNodeCollection(cisco1.getId())); assertTrue(m_linkd.scheduleNodeCollection(cisco2.getId())); assertTrue(m_linkd.scheduleNodeCollection(cisco3.getId())); assertTrue(m_linkd.scheduleNodeCollection(cisco4.getId())); final int NUMBER_OF_THREADS = 20; List<Thread> waitForMe = new ArrayList<Thread>(); for (int i = 0; i < NUMBER_OF_THREADS; i++) { Thread thread = new Thread("NMS-4005-Test-Thread-" + i) { @Override public void run() { assertTrue(m_linkd.runSingleSnmpCollection(cisco1.getId())); } }; thread.start(); waitForMe.add(thread); } for (Thread thread : waitForMe) { thread.join(); } waitForMe.clear(); for (int i = 0; i < NUMBER_OF_THREADS; i++) { Thread thread = new Thread("NMS-4005-Test-Thread-" + i) { @Override public void run() { assertTrue(m_linkd.runSingleSnmpCollection(cisco2.getId())); } }; thread.start(); waitForMe.add(thread); } for (Thread thread : waitForMe) { thread.join(); } waitForMe.clear(); for (int i = 0; i < NUMBER_OF_THREADS; i++) { Thread thread = new Thread("NMS-4005-Test-Thread-" + i) { @Override public void run() { assertTrue(m_linkd.runSingleSnmpCollection(cisco3.getId())); } }; thread.start(); waitForMe.add(thread); } for (Thread thread : waitForMe) { thread.join(); } waitForMe.clear(); for (int i = 0; i < NUMBER_OF_THREADS; i++) { Thread thread = new Thread("NMS-4005-Test-Thread-" + i) { @Override public void run() { assertTrue(m_linkd.runSingleSnmpCollection(cisco4.getId())); } }; thread.start(); waitForMe.add(thread); } for (Thread thread : waitForMe) { thread.join(); } waitForMe.clear(); assertTrue(m_linkd.runSingleLinkDiscovery("example1")); final List<DataLinkInterface> ifaces = m_dataLinkInterfaceDao.findAll(); for (final DataLinkInterface link : ifaces) { printLink(link); } assertEquals("we should have found 4 data links", 4, ifaces.size()); }
/* * * Get only ospf links. */ @Test @JUnitSnmpAgents( value = { @JUnitSnmpAgent( host = MUMBAI_IP, port = 161, resource = "classpath:linkd/nms10205/" + MUMBAI_NAME + "_" + MUMBAI_IP + ".txt"), @JUnitSnmpAgent( host = CHENNAI_IP, port = 161, resource = "classpath:linkd/nms10205/" + CHENNAI_NAME + "_" + CHENNAI_IP + ".txt"), @JUnitSnmpAgent( host = DELHI_IP, port = 161, resource = "classpath:linkd/nms10205/" + DELHI_NAME + "_" + DELHI_IP + ".txt"), @JUnitSnmpAgent( host = BANGALORE_IP, port = 161, resource = "classpath:linkd/nms10205/" + BANGALORE_NAME + "_" + BANGALORE_IP + ".txt"), @JUnitSnmpAgent( host = BAGMANE_IP, port = 161, resource = "classpath:linkd/nms10205/" + BAGMANE_NAME + "_" + BAGMANE_IP + ".txt"), @JUnitSnmpAgent( host = MYSORE_IP, port = 161, resource = "classpath:linkd/nms10205/" + MYSORE_NAME + "_" + MYSORE_IP + ".txt"), @JUnitSnmpAgent( host = SPACE_EX_SW1_IP, port = 161, resource = "classpath:linkd/nms10205/" + SPACE_EX_SW1_NAME + "_" + SPACE_EX_SW1_IP + ".txt"), @JUnitSnmpAgent( host = SPACE_EX_SW2_IP, port = 161, resource = "classpath:linkd/nms10205/" + SPACE_EX_SW2_NAME + "_" + SPACE_EX_SW2_IP + ".txt"), @JUnitSnmpAgent( host = J6350_41_IP, port = 161, resource = "classpath:linkd/nms10205/" + J6350_41_NAME + "_" + J6350_41_IP + ".txt"), @JUnitSnmpAgent( host = J6350_42_IP, port = 161, resource = "classpath:linkd/nms10205/" + "J6350-42_" + J6350_42_IP + ".txt"), @JUnitSnmpAgent( host = SRX_100_IP, port = 161, resource = "classpath:linkd/nms10205/" + "SRX-100_" + SRX_100_IP + ".txt"), @JUnitSnmpAgent( host = SSG550_IP, port = 161, resource = "classpath:linkd/nms10205/" + SSG550_NAME + "_" + SSG550_IP + ".txt") }) public void testNetwork10205OspfLinks() throws Exception { m_nodeDao.save(getMumbai()); m_nodeDao.save(getChennai()); m_nodeDao.save(getDelhi()); m_nodeDao.save(getBangalore()); m_nodeDao.save(getBagmane()); m_nodeDao.save(getMysore()); m_nodeDao.save(getSpaceExSw1()); m_nodeDao.save(getSpaceExSw2()); m_nodeDao.save(getJ635041()); m_nodeDao.save(getJ635042()); m_nodeDao.save(getSRX100()); m_nodeDao.save(getSGG550()); m_nodeDao.flush(); Package example1 = m_linkdConfig.getPackage("example1"); example1.setUseLldpDiscovery(false); example1.setUseCdpDiscovery(false); example1.setUseBridgeDiscovery(false); example1.setUseIpRouteDiscovery(false); example1.setSaveRouteTable(false); example1.setSaveStpInterfaceTable(false); example1.setSaveStpNodeTable(false); final OnmsNode mumbai = m_nodeDao.findByForeignId("linkd", MUMBAI_NAME); final OnmsNode chennai = m_nodeDao.findByForeignId("linkd", CHENNAI_NAME); final OnmsNode delhi = m_nodeDao.findByForeignId("linkd", DELHI_NAME); final OnmsNode bangalore = m_nodeDao.findByForeignId("linkd", BANGALORE_NAME); final OnmsNode bagmane = m_nodeDao.findByForeignId("linkd", BAGMANE_NAME); final OnmsNode mysore = m_nodeDao.findByForeignId("linkd", MYSORE_NAME); final OnmsNode spaceexsw1 = m_nodeDao.findByForeignId("linkd", SPACE_EX_SW1_NAME); final OnmsNode spaceexsw2 = m_nodeDao.findByForeignId("linkd", SPACE_EX_SW2_NAME); final OnmsNode j635041 = m_nodeDao.findByForeignId("linkd", J6350_41_NAME); final OnmsNode j635042 = m_nodeDao.findByForeignId("linkd", J6350_42_NAME); final OnmsNode srx100 = m_nodeDao.findByForeignId("linkd", SRX_100_NAME); final OnmsNode ssg550 = m_nodeDao.findByForeignId("linkd", SSG550_NAME); assertTrue(m_linkd.scheduleNodeCollection(chennai.getId())); assertTrue(m_linkd.scheduleNodeCollection(mumbai.getId())); assertTrue(m_linkd.scheduleNodeCollection(delhi.getId())); assertTrue(m_linkd.scheduleNodeCollection(bangalore.getId())); assertTrue(m_linkd.scheduleNodeCollection(bagmane.getId())); assertTrue(m_linkd.scheduleNodeCollection(mysore.getId())); assertTrue(m_linkd.scheduleNodeCollection(spaceexsw1.getId())); assertTrue(m_linkd.scheduleNodeCollection(spaceexsw2.getId())); assertTrue(m_linkd.scheduleNodeCollection(j635041.getId())); assertTrue(m_linkd.scheduleNodeCollection(j635042.getId())); assertTrue(m_linkd.scheduleNodeCollection(srx100.getId())); assertTrue(m_linkd.scheduleNodeCollection(ssg550.getId())); assertTrue(m_linkd.runSingleSnmpCollection(mumbai.getId())); assertTrue(m_linkd.runSingleSnmpCollection(chennai.getId())); assertTrue(m_linkd.runSingleSnmpCollection(delhi.getId())); assertTrue(m_linkd.runSingleSnmpCollection(bangalore.getId())); assertTrue(m_linkd.runSingleSnmpCollection(bagmane.getId())); assertTrue(m_linkd.runSingleSnmpCollection(mysore.getId())); assertTrue(m_linkd.runSingleSnmpCollection(spaceexsw1.getId())); assertTrue(m_linkd.runSingleSnmpCollection(spaceexsw2.getId())); assertTrue(m_linkd.runSingleSnmpCollection(j635041.getId())); assertTrue(m_linkd.runSingleSnmpCollection(j635042.getId())); assertTrue(m_linkd.runSingleSnmpCollection(srx100.getId())); assertTrue(m_linkd.runSingleSnmpCollection(ssg550.getId())); assertEquals(0, m_dataLinkInterfaceDao.countAll()); assertTrue(m_linkd.runSingleLinkDiscovery("example1")); final List<DataLinkInterface> links = m_dataLinkInterfaceDao.findAll(); assertEquals(9, links.size()); int start = getStartPoint(links); for (final DataLinkInterface datalinkinterface : links) { int id = datalinkinterface.getId().intValue(); if (start == id) { checkLink(chennai, mumbai, 528, 520, datalinkinterface); } else if (start + 1 == id) { checkLink(delhi, mumbai, 28503, 519, datalinkinterface); } else if (start + 2 == id) { checkLink(bangalore, mumbai, 2401, 507, datalinkinterface); } else if (start + 3 == id) { checkLink(bagmane, mumbai, 534, 977, datalinkinterface); } else if (start + 4 == id) { checkLink(mysore, mumbai, 508, 978, datalinkinterface); } else if (start + 5 == id) { checkLink(mysore, chennai, 505, 517, datalinkinterface); } else if (start + 6 == id) { checkLink(bangalore, delhi, 2397, 3674, datalinkinterface); } else if (start + 7 == id) { checkLink(bagmane, bangalore, 1732, 2396, datalinkinterface); } else if (start + 8 == id) { checkLink(mysore, bagmane, 520, 654, datalinkinterface); } else { checkLink(mumbai, mumbai, -1, -1, datalinkinterface); } } }
public void resetDatabase() { LOG.debug("==== DatabasePopulator Reset ===="); for (final DataLinkInterface iface : m_dataLinkInterfaceDao.findAll()) { m_dataLinkInterfaceDao.delete(iface); } for (final OnmsOutage outage : m_outageDao.findAll()) { m_outageDao.delete(outage); } for (final OnmsUserNotification not : m_userNotificationDao.findAll()) { m_userNotificationDao.delete(not); } for (final OnmsNotification not : m_notificationDao.findAll()) { m_notificationDao.delete(not); } for (final OnmsAlarm alarm : m_alarmDao.findAll()) { m_alarmDao.delete(alarm); } for (final OnmsEvent event : m_eventDao.findAll()) { m_eventDao.delete(event); } for (final OnmsSnmpInterface iface : m_snmpInterfaceDao.findAll()) { m_snmpInterfaceDao.delete(iface); } for (final OnmsIpInterface iface : m_ipInterfaceDao.findAll()) { m_ipInterfaceDao.delete(iface); } for (final OnmsNode node : m_nodeDao.findAll()) { m_nodeDao.delete(node); } for (final OnmsServiceType service : m_serviceTypeDao.findAll()) { m_serviceTypeDao.delete(service); } LOG.debug("= DatabasePopulatorExtension Reset Starting ="); for (Extension eachExtension : extensions) { DaoSupport daoSupport = eachExtension.getDaoSupport(); OnmsDao dao = daoSupport != null && daoSupport.getDaoClass() != null ? lookupDao(daoSupport.getDaoClass()) : null; eachExtension.onShutdown(this, dao); if (dao != null) { dao.flush(); } } LOG.debug("= DatabasePopulatorExtension Reset Finished ="); m_dataLinkInterfaceDao.flush(); m_outageDao.flush(); m_userNotificationDao.flush(); m_notificationDao.flush(); m_alarmDao.flush(); m_eventDao.flush(); m_snmpInterfaceDao.flush(); m_ipInterfaceDao.flush(); m_nodeDao.flush(); m_serviceTypeDao.flush(); LOG.debug("==== DatabasePopulator Reset Finished ===="); }
/* * The * MUMBAI:port ge 0/1/3:ip 192.168.5.5 ------> CHENNAI:port ge 4/0/2: ip 192.168.5.6 * MUMBAI:port ge 0/1/2:ip 192.168.5.9 ------> DELHI:port ge 1/0/2: ip 192.168.5.10 * MUMBAI:port ge 0/0/1:ip 192.168.5.13 ------> BANGALORE:port ge 0/0/0: ip 192.168.5.14 * DELHI:port ge 1/0/1:ip 192.168.1.5 ------> BANGALORE:port ge 0/0/1: ip 192.168.1.6 * DELHI:port ge 1/1/6:ip 172.16.7.1 ------> Space-EX-SW1: port 0/0/6: ip 172.16.7.1 ???? same ip address * CHENNAI:port ge 4/0/3:ip 192.168.1.1 ------> DELHI: port ge 1/1/0: ip 192.168.1.2 * * a lot of duplicated ip this is a clear proof that linkd is not able to * gather topology of this lab using the useBridgeTopology and ip routes. */ @Test @JUnitSnmpAgents( value = { @JUnitSnmpAgent( host = MUMBAI_IP, port = 161, resource = "classpath:linkd/nms10205/" + MUMBAI_NAME + "_" + MUMBAI_IP + ".txt"), @JUnitSnmpAgent( host = CHENNAI_IP, port = 161, resource = "classpath:linkd/nms10205/" + CHENNAI_NAME + "_" + CHENNAI_IP + ".txt"), @JUnitSnmpAgent( host = DELHI_IP, port = 161, resource = "classpath:linkd/nms10205/" + DELHI_NAME + "_" + DELHI_IP + ".txt"), @JUnitSnmpAgent( host = BANGALORE_IP, port = 161, resource = "classpath:linkd/nms10205/" + BANGALORE_NAME + "_" + BANGALORE_IP + ".txt"), @JUnitSnmpAgent( host = BAGMANE_IP, port = 161, resource = "classpath:linkd/nms10205/" + BAGMANE_NAME + "_" + BAGMANE_IP + ".txt"), @JUnitSnmpAgent( host = MYSORE_IP, port = 161, resource = "classpath:linkd/nms10205/" + MYSORE_NAME + "_" + MYSORE_IP + ".txt"), @JUnitSnmpAgent( host = SPACE_EX_SW1_IP, port = 161, resource = "classpath:linkd/nms10205/" + SPACE_EX_SW1_NAME + "_" + SPACE_EX_SW1_IP + ".txt"), @JUnitSnmpAgent( host = SPACE_EX_SW2_IP, port = 161, resource = "classpath:linkd/nms10205/" + SPACE_EX_SW2_NAME + "_" + SPACE_EX_SW2_IP + ".txt"), @JUnitSnmpAgent( host = J6350_41_IP, port = 161, resource = "classpath:linkd/nms10205/" + J6350_41_NAME + "_" + J6350_41_IP + ".txt"), @JUnitSnmpAgent( host = J6350_42_IP, port = 161, resource = "classpath:linkd/nms10205/" + "J6350-42_" + J6350_42_IP + ".txt"), @JUnitSnmpAgent( host = SRX_100_IP, port = 161, resource = "classpath:linkd/nms10205/" + "SRX-100_" + SRX_100_IP + ".txt"), @JUnitSnmpAgent( host = SSG550_IP, port = 161, resource = "classpath:linkd/nms10205/" + SSG550_NAME + "_" + SSG550_IP + ".txt") }) public void testNetwork10205Links() throws Exception { m_nodeDao.save(getMumbai()); m_nodeDao.save(getChennai()); m_nodeDao.save(getDelhi()); m_nodeDao.save(getBangalore()); m_nodeDao.save(getBagmane()); m_nodeDao.save(getMysore()); m_nodeDao.save(getSpaceExSw1()); m_nodeDao.save(getSpaceExSw2()); m_nodeDao.save(getJ635041()); m_nodeDao.save(getJ635042()); m_nodeDao.save(getSRX100()); m_nodeDao.save(getSGG550()); m_nodeDao.flush(); Package example1 = m_linkdConfig.getPackage("example1"); assertEquals(false, example1.hasForceIpRouteDiscoveryOnEthernet()); example1.setForceIpRouteDiscoveryOnEthernet(true); example1.setUseCdpDiscovery(false); final OnmsNode mumbai = m_nodeDao.findByForeignId("linkd", MUMBAI_NAME); final OnmsNode chennai = m_nodeDao.findByForeignId("linkd", CHENNAI_NAME); final OnmsNode delhi = m_nodeDao.findByForeignId("linkd", DELHI_NAME); final OnmsNode bangalore = m_nodeDao.findByForeignId("linkd", BANGALORE_NAME); final OnmsNode bagmane = m_nodeDao.findByForeignId("linkd", BAGMANE_NAME); final OnmsNode mysore = m_nodeDao.findByForeignId("linkd", MYSORE_NAME); final OnmsNode spaceexsw1 = m_nodeDao.findByForeignId("linkd", SPACE_EX_SW1_NAME); final OnmsNode spaceexsw2 = m_nodeDao.findByForeignId("linkd", SPACE_EX_SW2_NAME); final OnmsNode j635041 = m_nodeDao.findByForeignId("linkd", J6350_41_NAME); final OnmsNode j635042 = m_nodeDao.findByForeignId("linkd", J6350_42_NAME); final OnmsNode srx100 = m_nodeDao.findByForeignId("linkd", SRX_100_NAME); final OnmsNode ssg550 = m_nodeDao.findByForeignId("linkd", SSG550_NAME); assertTrue(m_linkd.scheduleNodeCollection(chennai.getId())); assertTrue(m_linkd.scheduleNodeCollection(mumbai.getId())); assertTrue(m_linkd.scheduleNodeCollection(delhi.getId())); assertTrue(m_linkd.scheduleNodeCollection(bangalore.getId())); assertTrue(m_linkd.scheduleNodeCollection(bagmane.getId())); assertTrue(m_linkd.scheduleNodeCollection(mysore.getId())); assertTrue(m_linkd.scheduleNodeCollection(spaceexsw1.getId())); assertTrue(m_linkd.scheduleNodeCollection(spaceexsw2.getId())); assertTrue(m_linkd.scheduleNodeCollection(j635041.getId())); assertTrue(m_linkd.scheduleNodeCollection(j635042.getId())); assertTrue(m_linkd.scheduleNodeCollection(srx100.getId())); assertTrue(m_linkd.scheduleNodeCollection(ssg550.getId())); assertTrue(m_linkd.runSingleSnmpCollection(mumbai.getId())); assertTrue(m_linkd.runSingleSnmpCollection(chennai.getId())); assertTrue(m_linkd.runSingleSnmpCollection(delhi.getId())); assertTrue(m_linkd.runSingleSnmpCollection(bangalore.getId())); assertTrue(m_linkd.runSingleSnmpCollection(bagmane.getId())); assertTrue(m_linkd.runSingleSnmpCollection(mysore.getId())); assertTrue(m_linkd.runSingleSnmpCollection(spaceexsw1.getId())); assertTrue(m_linkd.runSingleSnmpCollection(spaceexsw2.getId())); assertTrue(m_linkd.runSingleSnmpCollection(j635041.getId())); assertTrue(m_linkd.runSingleSnmpCollection(j635042.getId())); assertTrue(m_linkd.runSingleSnmpCollection(srx100.getId())); assertTrue(m_linkd.runSingleSnmpCollection(ssg550.getId())); assertEquals(0, m_dataLinkInterfaceDao.countAll()); assertTrue(m_linkd.runSingleLinkDiscovery("example1")); final List<DataLinkInterface> links = m_dataLinkInterfaceDao.findAll(); assertEquals(9, links.size()); // Linkd is able to find partially the topology using the next hop router // among the core nodes: // mumbai, chennai, delhi, mysore,bangalore and bagmane // the link between chennai and delhi is lost // the link between chennai and bagmane is lost // the link between bagmane and delhi is lost // I checked the walks and no route info // is there for discovering the link. // I have to guess that linkd is working as expected // The bridge and RSTP topology information are // unusuful, the devices supporting RSTP // have themselves as designated bridge. // Other links are lost... // no routing entry and no bridge // forwarding int start = getStartPoint(links); for (final DataLinkInterface datalinkinterface : links) { int id = datalinkinterface.getId().intValue(); if (start == id) { checkLink(delhi, mumbai, 28503, 519, datalinkinterface); } else if (start + 1 == id) { checkLink(bangalore, mumbai, 2401, 507, datalinkinterface); } else if (start + 2 == id) { checkLink(bagmane, mumbai, 534, 977, datalinkinterface); } else if (start + 3 == id) { checkLink(mysore, mumbai, 508, 978, datalinkinterface); } else if (start + 4 == id) { checkLink(chennai, mumbai, 528, 520, datalinkinterface); } else if (start + 5 == id) { checkLink(mysore, chennai, 505, 517, datalinkinterface); } else if (start + 6 == id) { checkLink(bangalore, delhi, 2397, 3674, datalinkinterface); } else if (start + 7 == id) { checkLink(bagmane, bangalore, 1732, 2396, datalinkinterface); } else if (start + 8 == id) { checkLink(mysore, bagmane, 520, 654, datalinkinterface); } else { checkLink(mumbai, mumbai, -1, -1, datalinkinterface); } } }