Search in sources :

Example 11 with LldpLink

use of org.opennms.netmgt.model.LldpLink in project opennms by OpenNMS.

the class LinkdEdgeStatusProviderTest method setUp.

@Before
public void setUp() {
    m_node1 = new OnmsNode();
    m_node1.setId(1);
    m_node2 = new OnmsNode();
    m_node2.setId(2);
    m_node3 = new OnmsNode();
    m_node3.setId(3);
    m_node4 = new OnmsNode();
    m_node4.setId(4);
    m_node5 = new OnmsNode();
    m_node5.setId(5);
    m_nodeDehli = new OnmsNode();
    m_nodeDehli.setId(10);
    m_nodeChennai = new OnmsNode();
    m_nodeChennai.setId(14);
    m_edges = new ArrayList<LinkdEdge>();
    Vertex sourceCloud = new AbstractVertex("nodes", "1", "source");
    // Cloud is identified by the designated bridge and designated port
    Vertex cloud = new AbstractVertex("nodes", "1:48", "cloud");
    Vertex targetCloud1 = new AbstractVertex("nodes", "2", "target1");
    Vertex targetCloud2 = new AbstractVertex("nodes", "3", "target2");
    Vertex source = new AbstractVertex("nodes", "4", "source");
    Vertex target = new AbstractVertex("nodes", "5", "target");
    Vertex dehli = new AbstractVertex("nodes", "10", "dehli");
    Vertex chennai = new AbstractVertex("nodes", "14", "chennai");
    // identification of link is done with targets id..that is port or mac        
    BridgePort bpnode1port48 = new BridgePort();
    bpnode1port48.setNode(m_node1);
    bpnode1port48.setBridgePort(48);
    bpnode1port48.setBridgePortIfIndex(48);
    m_edges.add(connectVertices(bpnode1port48, cloud, sourceCloud, BRIDGE_EDGE_NAMESPACE));
    BridgePort bpnode2port24 = new BridgePort();
    bpnode2port24.setNode(m_node2);
    bpnode2port24.setBridgePort(24);
    bpnode2port24.setBridgePortIfIndex(24);
    m_edges.add(connectVertices(bpnode2port24, cloud, targetCloud1, BRIDGE_EDGE_NAMESPACE));
    m_edges.add(connectCloudMacVertices("a8d0e5a0a467", cloud, targetCloud2, BRIDGE_EDGE_NAMESPACE));
    // isis link
    IsIsLink link1 = createIsIsLink(m_node4, 599, 599, 1, 1, "001f12accbf1", "000110255062");
    link1.setId(104);
    IsIsLink link2 = createIsIsLink(m_node5, 578, 578, 1, 1, "0021590e47c1", "000110088500");
    link2.setId(105);
    m_edges.add(connectVertices(new IsIsLinkDetail(Math.min(link1.getId(), link2.getId()) + "|" + Math.max(link1.getId(), link2.getId()), source, link1.getId(), link1.getIsisCircIfIndex(), target, link2.getId(), link2.getIsisCircIfIndex()), ISIS_EDGE_NAMESPACE));
    // lldp link
    LldpLink link3 = new LldpLink(m_node4, 12, 1, "node4PortId", "node4PortDescr", LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, "node4ChassisId", "node4SysName", LldpChassisIdSubType.LLDP_CHASSISID_SUBTYPE_LOCAL, "node4PortId", LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, "node2PortDescr");
    link3.setId(204);
    LldpLink link4 = new LldpLink(m_node5, 21, 2, "node5PortId", "node5PortDescr", LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, "node5ChassisId", "node5SysName", LldpChassisIdSubType.LLDP_CHASSISID_SUBTYPE_LOCAL, "node5PortId", LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, "node1PortDescr");
    link4.setId(205);
    m_edges.add(connectVertices(new LldpLinkDetail(Math.min(link3.getId(), link4.getId()) + "|" + Math.max(link3.getId(), link4.getId()), source, link3, target, link4), LLDP_EDGE_NAMESPACE));
    //ospf link
    OspfLink link5 = createOspfLink(m_node4, "192.168.100.246", "255.255.255.252", 0, 10101, "192.168.100.249", "192.168.100.245", 0);
    link5.setId(404);
    OspfLink link6 = createOspfLink(m_node5, "192.168.100.245", "255.255.255.252", 0, 10100, "192.168.100.250", "192.168.100.246", 0);
    link6.setId(405);
    m_edges.add(connectVertices(new OspfLinkDetail(Math.min(link5.getId(), link6.getId()) + "|" + Math.max(link5.getId(), link6.getId()), source, link5, target, link6), OSPF_EDGE_NAMESPACE));
    //cdp link
    LinkdEdge edgeG = new LinkdEdge(EnhancedLinkdTopologyProvider.CDP_EDGE_NAMESPACE, "504|505", source, target);
    edgeG.setSourceNodeid(m_node4.getId());
    edgeG.setTargetNodeid(m_node5.getId());
    edgeG.setSourceEndPoint("101");
    edgeG.setTargetEndPoint("100");
    m_edges.add(edgeG);
    // another ospf link
    LinkdEdge edgeChennaiTodehli = new LinkdEdge(EnhancedLinkdTopologyProvider.OSPF_EDGE_NAMESPACE, "310|314", dehli, chennai);
    edgeChennaiTodehli.setSourceNodeid(m_nodeDehli.getId());
    edgeChennaiTodehli.setTargetNodeid(m_nodeChennai.getId());
    edgeChennaiTodehli.setSourceEndPoint("13");
    edgeChennaiTodehli.setTargetEndPoint("13");
    m_edges.add(edgeChennaiTodehli);
    m_alarmDao = EasyMock.createMock(AlarmDao.class);
    m_edgeProvider = EasyMock.createMock(EdgeProvider.class);
    m_statusProvider = new LinkdEdgeStatusProvider();
    m_statusProvider.setAlarmDao(m_alarmDao);
}
Also used : Vertex(org.opennms.features.topology.api.topo.Vertex) AbstractVertex(org.opennms.features.topology.api.topo.AbstractVertex) BridgePort(org.opennms.netmgt.model.topology.BridgePort) IsIsLink(org.opennms.netmgt.model.IsIsLink) OnmsNode(org.opennms.netmgt.model.OnmsNode) LldpLink(org.opennms.netmgt.model.LldpLink) EdgeProvider(org.opennms.features.topology.api.topo.EdgeProvider) AlarmDao(org.opennms.netmgt.dao.api.AlarmDao) AbstractVertex(org.opennms.features.topology.api.topo.AbstractVertex) OspfLink(org.opennms.netmgt.model.OspfLink) Before(org.junit.Before)

Example 12 with LldpLink

use of org.opennms.netmgt.model.LldpLink in project opennms by OpenNMS.

the class EnhancedLinkdMockDataPopulator method populateDatabase.

public void populateDatabase() {
    final String icmp = "ICMP";
    final String snmp = "SNMP";
    final String http = "HTTP";
    final NetworkBuilder builder = new NetworkBuilder();
    setNode1(builder.addNode("node1").setForeignSource("imported:").setForeignId("1").setType(OnmsNode.NodeType.ACTIVE).setSysObjectId("1.3.6.1.4.1.5813.1.25").getNode());
    Assert.assertNotNull("newly built node 1 should not be null", getNode1());
    builder.setBuilding("HQ");
    builder.addSnmpInterface(1).setCollectionEnabled(true).setIfOperStatus(1).setIfSpeed(10000000).setIfDescr("ATM0").setIfAlias("Initial ifAlias value").setIfType(37).addIpInterface("192.168.1.1").setIsManaged("M").setIsSnmpPrimary("P");
    builder.addService(icmp);
    builder.addService(snmp);
    builder.addSnmpInterface(2).setCollectionEnabled(true).setIfOperStatus(1).setIfSpeed(10000000).setIfName("eth0").setIfType(6).addIpInterface("192.168.1.2").setIsManaged("M").setIsSnmpPrimary("S");
    builder.addService(icmp);
    builder.addService(http);
    builder.addSnmpInterface(3).setCollectionEnabled(false).setIfOperStatus(1).setIfSpeed(10000000).addIpInterface("192.168.1.3").setIsManaged("M").setIsSnmpPrimary("N");
    builder.addService(icmp);
    builder.addSnmpInterface(4).setCollectionEnabled(false).setIfOperStatus(1).setIfSpeed(10000000).addIpInterface("fe80:0000:0000:0000:aaaa:bbbb:cccc:dddd%5").setIsManaged("M").setIsSnmpPrimary("N");
    builder.addService(icmp);
    final OnmsNode node1 = builder.getCurrentNode();
    node1.setLldpElement(new LldpElement(node1, "node1ChassisId", "node1SysName", LldpChassisIdSubType.LLDP_CHASSISID_SUBTYPE_LOCAL));
    setNode1(node1);
    builder.addNode("node2").setForeignSource("imported:").setForeignId("2").setType(OnmsNode.NodeType.ACTIVE);
    builder.setBuilding("HQ");
    builder.addInterface("192.168.2.1").setIsManaged("M").setIsSnmpPrimary("P");
    builder.addService(icmp);
    builder.addService(snmp);
    builder.addInterface("192.168.2.2").setIsManaged("M").setIsSnmpPrimary("S");
    builder.addService(icmp);
    builder.addService(http);
    builder.addInterface("192.168.2.3").setIsManaged("M").setIsSnmpPrimary("N");
    builder.addService(icmp);
    OnmsNode node2 = builder.getCurrentNode();
    node2.setLldpElement(new LldpElement(node2, "node2ChassisId", "node2SysName", LldpChassisIdSubType.LLDP_CHASSISID_SUBTYPE_LOCAL));
    setNode2(node2);
    builder.addNode("node3").setForeignSource("imported:").setForeignId("3").setType(OnmsNode.NodeType.ACTIVE);
    builder.addInterface("192.168.3.1").setIsManaged("M").setIsSnmpPrimary("P");
    builder.addService(icmp);
    builder.addService(snmp);
    builder.addInterface("192.168.3.2").setIsManaged("M").setIsSnmpPrimary("S");
    builder.addService(icmp);
    builder.addService(http);
    builder.addInterface("192.168.3.3").setIsManaged("M").setIsSnmpPrimary("N");
    builder.addService(icmp);
    OnmsNode node3 = builder.getCurrentNode();
    node3.setLldpElement(new LldpElement(node3, "node3ChassisId", "node3SysName", LldpChassisIdSubType.LLDP_CHASSISID_SUBTYPE_LOCAL));
    setNode3(node3);
    builder.addNode("node4").setForeignSource("imported:").setForeignId("4").setType(OnmsNode.NodeType.ACTIVE);
    builder.addInterface("192.168.4.1").setIsManaged("M").setIsSnmpPrimary("P");
    builder.addService(icmp);
    builder.addService(snmp);
    builder.addInterface("192.168.4.2").setIsManaged("M").setIsSnmpPrimary("S");
    builder.addService(icmp);
    builder.addService(http);
    builder.addInterface("192.168.4.3").setIsManaged("M").setIsSnmpPrimary("N");
    builder.addService(icmp);
    OnmsNode node4 = builder.getCurrentNode();
    node4.setLldpElement(new LldpElement(node4, "node4ChassisId", "node4SysName", LldpChassisIdSubType.LLDP_CHASSISID_SUBTYPE_LOCAL));
    setNode4(node4);
    //This node purposely doesn't have a foreignId style assetNumber
    builder.addNode("alternate-node1").setType(OnmsNode.NodeType.ACTIVE).getAssetRecord().setAssetNumber("5");
    builder.addInterface("10.1.1.1").setIsManaged("M").setIsSnmpPrimary("P");
    builder.addService(icmp);
    builder.addService(snmp);
    builder.addInterface("10.1.1.2").setIsManaged("M").setIsSnmpPrimary("S");
    builder.addService(icmp);
    builder.addService(http);
    builder.addInterface("10.1.1.3").setIsManaged("M").setIsSnmpPrimary("N");
    builder.addService(icmp);
    OnmsNode node5 = builder.getCurrentNode();
    node5.setLldpElement(new LldpElement(node5, "node5ChassisId", "node5SysName", LldpChassisIdSubType.LLDP_CHASSISID_SUBTYPE_LOCAL));
    setNode5(node5);
    //This node purposely doesn't have a assetNumber and is used by a test to check the category
    builder.addNode("alternate-node2").setType(OnmsNode.NodeType.ACTIVE).getAssetRecord().setDisplayCategory("category1");
    builder.addInterface("10.1.2.1").setIsManaged("M").setIsSnmpPrimary("P");
    builder.addService(icmp);
    builder.addService(snmp);
    builder.addInterface("10.1.2.2").setIsManaged("M").setIsSnmpPrimary("S");
    builder.addService(icmp);
    builder.addService(http);
    builder.addInterface("10.1.2.3").setIsManaged("M").setIsSnmpPrimary("N");
    builder.addService(icmp);
    OnmsNode node6 = builder.getCurrentNode();
    node6.setLldpElement(new LldpElement(node6, "node6ChassisId", "node6SysName", LldpChassisIdSubType.LLDP_CHASSISID_SUBTYPE_LOCAL));
    setNode6(node6);
    builder.addNode("alternate-node3").setType(OnmsNode.NodeType.ACTIVE).getAssetRecord().setDisplayCategory("category1");
    builder.addInterface("10.1.3.1").setIsManaged("M").setIsSnmpPrimary("P");
    builder.addService(icmp);
    builder.addService(snmp);
    builder.addInterface("10.1.3.2").setIsManaged("M").setIsSnmpPrimary("S");
    builder.addService(icmp);
    builder.addService(http);
    builder.addInterface("10.1.3.3").setIsManaged("M").setIsSnmpPrimary("N");
    builder.addService(icmp);
    OnmsNode node7 = builder.getCurrentNode();
    node7.setLldpElement(new LldpElement(node7, "node7ChassisId", "node7SysName", LldpChassisIdSubType.LLDP_CHASSISID_SUBTYPE_LOCAL));
    setNode7(node7);
    builder.addNode("alternate-node4").setType(OnmsNode.NodeType.ACTIVE).getAssetRecord().setDisplayCategory("category1");
    builder.addInterface("10.1.4.1").setIsManaged("M").setIsSnmpPrimary("P");
    builder.addService(icmp);
    builder.addService(snmp);
    builder.addInterface("10.1.4.2").setIsManaged("M").setIsSnmpPrimary("S");
    builder.addService(icmp);
    builder.addService(http);
    builder.addInterface("10.1.4.3").setIsManaged("M").setIsSnmpPrimary("N");
    builder.addService(icmp);
    OnmsNode node8 = builder.getCurrentNode();
    node8.setLldpElement(new LldpElement(node8, "node8ChassisId", "mode8SysName", LldpChassisIdSubType.LLDP_CHASSISID_SUBTYPE_LOCAL));
    setNode8(node8);
    List<OnmsNode> nodes = new ArrayList<OnmsNode>();
    nodes.add(node1);
    nodes.add(node2);
    nodes.add(node3);
    nodes.add(node4);
    nodes.add(node5);
    nodes.add(node6);
    nodes.add(node7);
    nodes.add(node8);
    setNodes(nodes);
    //final OnmsNode node, final int ifIndex, final int nodeParentId, final int parentIfIndex, final StatusType status,final Date lastPollTime
    /*OnmsNode node, Integer localPortNum, Integer portIfIndex, String portId,
                String portDescr, String remChassisId, String remSysname, LldpElement.LldpChassisIdSubType
        remChassisIdSubType,
                String remPortId, String remPortDescr*/
    final LldpLink dli12 = createLldpLink(getNode1(), "node1PortId", "node1PortDescr", 12, 10, LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, getNode2().getLldpElement(), "node2PortDescr", "node2PortId");
    final LldpLink dli21 = createLldpLink(getNode2(), "node2PortId", "node2PortDescr", 22, 20, LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, getNode1().getLldpElement(), "node1PortDescr", "node1PortId");
    final LldpLink dli23 = createLldpLink(getNode2(), "node2PortId", "node2PortDescr", 22, 20, LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, getNode3().getLldpElement(), "node3PortDescr", "node3PortId");
    final LldpLink dli32 = createLldpLink(getNode3(), "node3PortId", "node3PortDescr", 33, 30, LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, getNode2().getLldpElement(), "node2PortDescr", "node2PortId");
    final LldpLink dli34 = createLldpLink(getNode3(), "node3PortId", "node3PortDescr", 33, 30, LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, getNode4().getLldpElement(), "node4PortDescr", "node4PortId");
    final LldpLink dli43 = createLldpLink(getNode4(), "node4PortId", "node4PortDescr", 44, 40, LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, getNode3().getLldpElement(), "node3PortDescr", "node3PortId");
    final LldpLink dli45 = createLldpLink(getNode4(), "node4PortId", "node4PortDescr", 44, 40, LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, getNode5().getLldpElement(), "node5PortDescr", "node5PortId");
    final LldpLink dli54 = createLldpLink(getNode5(), "node5PortId", "node5PortDescr", 55, 50, LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, getNode4().getLldpElement(), "node4PortDescr", "node4PortId");
    final LldpLink dli56 = createLldpLink(getNode5(), "node5PortId", "node5PortDescr", 55, 50, LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, getNode6().getLldpElement(), "node6PortDescr", "node6PortId");
    final LldpLink dli65 = createLldpLink(getNode6(), "node6PortId", "node6PortDescr", 66, 60, LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, getNode5().getLldpElement(), "node5PortDescr", "node5PortId");
    final LldpLink dli67 = createLldpLink(getNode6(), "node6PortId", "node6PortDescr", 66, 60, LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, getNode7().getLldpElement(), "node7PortDescr", "node7PortId");
    final LldpLink dli76 = createLldpLink(getNode7(), "node7PortId", "node7PortDescr", 77, 70, LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, getNode6().getLldpElement(), "node6PortDescr", "node6PortId");
    final LldpLink dli78 = createLldpLink(getNode7(), "node7PortId", "node7PortDescr", 77, 70, LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, getNode8().getLldpElement(), "node8PortDescr", "node8PortId");
    final LldpLink dli87 = createLldpLink(getNode8(), "node8PortId", "node8PortDescr", 88, 80, LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, getNode7().getLldpElement(), "node7PortDescr", "node7PortId");
    final LldpLink dli81 = createLldpLink(getNode8(), "node8PortId", "node8PortDescr", 88, 80, LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, getNode1().getLldpElement(), "node1PortDescr", "node1PortId");
    final LldpLink dli18 = createLldpLink(getNode1(), "node1PortId", "node1PortDescr", 12, 10, LldpPortIdSubType.LLDP_PORTID_SUBTYPE_LOCAL, getNode8().getLldpElement(), "node8PortDescr", "node8PortId");
    dli12.setId(10012);
    dli21.setId(10021);
    dli23.setId(10023);
    dli32.setId(10032);
    dli34.setId(10034);
    dli43.setId(10043);
    dli45.setId(10045);
    dli54.setId(10054);
    dli56.setId(10056);
    dli65.setId(10065);
    dli67.setId(10067);
    dli76.setId(10076);
    dli78.setId(10078);
    dli87.setId(10087);
    dli81.setId(10081);
    dli18.setId(10018);
    List<LldpLink> links = new ArrayList<LldpLink>();
    links.add(dli12);
    links.add(dli21);
    links.add(dli23);
    links.add(dli32);
    links.add(dli34);
    links.add(dli43);
    links.add(dli45);
    links.add(dli54);
    links.add(dli56);
    links.add(dli65);
    links.add(dli67);
    links.add(dli76);
    links.add(dli78);
    links.add(dli87);
    links.add(dli81);
    links.add(dli18);
    setLinks(links);
    //OSPF links
    OspfLink ospfLink12 = createOspfLink(getNode1(), "192.168.100.246", "255.255.255.252", 0, 10101, "192.168.100.249", "192.168.100.245", 0);
    OspfLink ospfLink21 = createOspfLink(getNode2(), "192.168.100.245", "255.255.255.252", 0, 10101, "192.168.100.250", "192.168.100.246", 0);
    ospfLink12.setId(10112);
    ospfLink21.setId(10121);
    List<OspfLink> ospfLinks = new ArrayList<OspfLink>();
    ospfLinks.add(ospfLink12);
    ospfLinks.add(ospfLink21);
    setOspfLinks(ospfLinks);
}
Also used : NetworkBuilder(org.opennms.netmgt.model.NetworkBuilder) OnmsNode(org.opennms.netmgt.model.OnmsNode) ArrayList(java.util.ArrayList) LldpElement(org.opennms.netmgt.model.LldpElement) LldpLink(org.opennms.netmgt.model.LldpLink) OspfLink(org.opennms.netmgt.model.OspfLink)

Example 13 with LldpLink

use of org.opennms.netmgt.model.LldpLink in project opennms by OpenNMS.

the class EnhancedLinkdTopologyProviderTest method testDataCorrectness.

@Test
public void testDataCorrectness() {
    LldpLinkDao lldpLinkDao = m_databasePopulator.getLldpLinkDao();
    List<LldpLink> links = lldpLinkDao.findAll();
    assertEquals(16, links.size());
    OspfLinkDao ospfLinkDao = m_databasePopulator.getOspfLinkDao();
    List<OspfLink> ospfLinks = ospfLinkDao.findAll();
    assertEquals(2, ospfLinks.size());
}
Also used : OspfLinkDao(org.opennms.netmgt.dao.api.OspfLinkDao) LldpLinkDao(org.opennms.netmgt.dao.api.LldpLinkDao) LldpLink(org.opennms.netmgt.model.LldpLink) OspfLink(org.opennms.netmgt.model.OspfLink) Test(org.junit.Test)

Example 14 with LldpLink

use of org.opennms.netmgt.model.LldpLink in project opennms by OpenNMS.

the class EnLinkdSnmpIT method testLldpLocGetter.

@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = SWITCH1_IP, port = 161, resource = "classpath:/linkd/nms17216/switch1-walk.txt") })
public void testLldpLocGetter() throws Exception {
    SnmpAgentConfig config = SnmpPeerFactory.getInstance().getAgentConfig(InetAddress.getByName(SWITCH1_IP));
    final LldpLocPortGetter lldpLocPort = new LldpLocPortGetter(config, m_client, null);
    LldpLink link = new LldpLink();
    link.setLldpLocalPortNum(9);
    link = lldpLocPort.getLldpLink(link);
    assertEquals(9, link.getLldpLocalPortNum().intValue());
    assertEquals("Gi0/9", link.getLldpPortId());
    assertEquals("GigabitEthernet0/9", link.getLldpPortDescr());
    assertEquals(LldpPortIdSubType.LLDP_PORTID_SUBTYPE_INTERFACENAME, link.getLldpPortIdSubType());
    link = new LldpLink();
    link.setLldpLocalPortNum(10);
    link = lldpLocPort.getLldpLink(link);
    assertEquals(10, link.getLldpLocalPortNum().intValue());
    assertEquals("Gi0/10", link.getLldpPortId());
    assertEquals("GigabitEthernet0/10", link.getLldpPortDescr());
    assertEquals(LldpPortIdSubType.LLDP_PORTID_SUBTYPE_INTERFACENAME, link.getLldpPortIdSubType());
}
Also used : SnmpAgentConfig(org.opennms.netmgt.snmp.SnmpAgentConfig) LldpLocPortGetter(org.opennms.netmgt.enlinkd.snmp.LldpLocPortGetter) LldpLink(org.opennms.netmgt.model.LldpLink) Test(org.junit.Test) JUnitSnmpAgents(org.opennms.core.test.snmp.annotations.JUnitSnmpAgents)

Example 15 with LldpLink

use of org.opennms.netmgt.model.LldpLink in project opennms by OpenNMS.

the class EnLinkdSnmpIT method testLldpDragonWaveLldpLocGetter.

/**
     * This test is designed to test the issues in bug NMS-6921.
     * 
     * @see http://issues.opennms.org/browse/NMS-6912

     * 
     * @throws Exception
     */
@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = DW_IP, port = 161, resource = DW_SNMP_RESOURCE) })
public void testLldpDragonWaveLldpLocGetter() throws Exception {
    SnmpAgentConfig config = SnmpPeerFactory.getInstance().getAgentConfig(InetAddress.getByName(DW_IP));
    final LldpLocPortGetter lldpLocPort = new LldpLocPortGetter(config, m_client, null);
    LldpLink link = new LldpLink();
    link.setLldpLocalPortNum(1);
    link = lldpLocPort.getLldpLink(link);
    assertEquals(1, link.getLldpLocalPortNum().intValue());
    assertEquals("cf", link.getLldpPortId());
    assertEquals("NuDesign", link.getLldpPortDescr());
    assertEquals(LldpPortIdSubType.LLDP_PORTID_SUBTYPE_INTERFACEALIAS, link.getLldpPortIdSubType());
}
Also used : SnmpAgentConfig(org.opennms.netmgt.snmp.SnmpAgentConfig) LldpLocPortGetter(org.opennms.netmgt.enlinkd.snmp.LldpLocPortGetter) LldpLink(org.opennms.netmgt.model.LldpLink) Test(org.junit.Test) JUnitSnmpAgents(org.opennms.core.test.snmp.annotations.JUnitSnmpAgents)

Aggregations

LldpLink (org.opennms.netmgt.model.LldpLink)23 Test (org.junit.Test)16 JUnitSnmpAgents (org.opennms.core.test.snmp.annotations.JUnitSnmpAgents)14 OnmsNode (org.opennms.netmgt.model.OnmsNode)12 SnmpAgentConfig (org.opennms.netmgt.snmp.SnmpAgentConfig)7 ArrayList (java.util.ArrayList)5 LldpLocPortGetter (org.opennms.netmgt.enlinkd.snmp.LldpLocPortGetter)5 LldpRemTableTracker (org.opennms.netmgt.enlinkd.snmp.LldpRemTableTracker)4 LldpElement (org.opennms.netmgt.model.LldpElement)3 OspfLink (org.opennms.netmgt.model.OspfLink)3 HashSet (java.util.HashSet)2 ExecutionException (java.util.concurrent.ExecutionException)2 AbstractVertex (org.opennms.features.topology.api.topo.AbstractVertex)2 Vertex (org.opennms.features.topology.api.topo.Vertex)2 MalformedURLException (java.net.MalformedURLException)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 List (java.util.List)1 JAXBException (javax.xml.bind.JAXBException)1 Before (org.junit.Before)1