use of org.opennms.netmgt.snmp.SnmpAgentConfig in project opennms by OpenNMS.
the class EnLinkdSnmpIT method testLldpDragonWaveRemTableWalk.
@Test
@JUnitSnmpAgent(host = DW_IP, port = 161, resource = DW_SNMP_RESOURCE)
public void testLldpDragonWaveRemTableWalk() throws Exception {
final SnmpAgentConfig config = SnmpPeerFactory.getInstance().getAgentConfig(InetAddress.getByName(DW_IP));
LldpRemTableTracker lldpRemTable = new LldpRemTableTracker() {
public void processLldpRemRow(final LldpRemRow row) {
System.err.println("----------lldp rem----------------");
System.err.println("columns number in the row: " + row.getColumnCount());
assertEquals(6, row.getColumnCount());
LldpLink link = row.getLldpLink();
assertEquals(1, row.getLldpRemLocalPortNum().intValue());
System.err.println("local port number: " + row.getLldpRemLocalPortNum());
assertEquals(LldpChassisIdSubType.LLDP_CHASSISID_SUBTYPE_CHASSISCOMPONENT, link.getLldpRemChassisIdSubType());
System.err.println("remote chassis type: " + LldpChassisIdSubType.getTypeString(link.getLldpRemChassisIdSubType().getValue()));
assertEquals("cf", link.getLldpRemChassisId());
System.err.println("remote chassis: " + link.getLldpRemChassisId());
assertEquals(LldpPortIdSubType.LLDP_PORTID_SUBTYPE_INTERFACEALIAS, link.getLldpRemPortIdSubType());
System.err.println("remote port type: " + LldpPortIdSubType.getTypeString(link.getLldpRemPortIdSubType().getValue()));
assertEquals("cf", link.getLldpRemPortId());
System.err.println("remote port id: " + link.getLldpRemPortId());
assertEquals("NuDesign", link.getLldpRemPortDescr());
System.err.println("remote port descr: " + link.getLldpRemPortDescr());
assertEquals("NuDesign", link.getLldpRemSysname());
System.err.println("remote sysname: " + link.getLldpRemSysname());
}
};
String trackerName = "lldpRemTable";
try {
m_client.walk(config, lldpRemTable).withDescription(trackerName).withLocation(null).execute().get();
} catch (final InterruptedException e) {
assertEquals(false, true);
}
}
use of org.opennms.netmgt.snmp.SnmpAgentConfig in project opennms by OpenNMS.
the class EnLinkdSnmpIT method testLldpDragonWaveLocalGroupWalk.
/**
* 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 testLldpDragonWaveLocalGroupWalk() throws Exception {
String trackerName = "lldpLocalGroup";
SnmpAgentConfig config = SnmpPeerFactory.getInstance().getAgentConfig(InetAddress.getByName(DW_IP));
LldpLocalGroupTracker lldpLocalGroup = new LldpLocalGroupTracker();
try {
m_client.walk(config, lldpLocalGroup).withDescription(trackerName).withLocation(null).execute().get();
} catch (final InterruptedException e) {
LOG.error("run: collection interrupted, exiting", e);
return;
}
LldpElement eiA = lldpLocalGroup.getLldpElement();
System.err.println("local chassis type: " + LldpChassisIdSubType.getTypeString(eiA.getLldpChassisIdSubType().getValue()));
System.err.println("local chassis id: " + eiA.getLldpChassisId());
System.err.println("local sysname: " + eiA.getLldpSysname());
assertEquals("cf", eiA.getLldpChassisId());
assertEquals(LldpChassisIdSubType.LLDP_CHASSISID_SUBTYPE_CHASSISCOMPONENT, eiA.getLldpChassisIdSubType());
assertEquals("NuDesign", eiA.getLldpSysname());
}
use of org.opennms.netmgt.snmp.SnmpAgentConfig in project opennms by OpenNMS.
the class EnLinkdSnmpIT method testCdpGlobalGroupCollection.
@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = RPict001_IP, port = 161, resource = RPict001_SNMP_RESOURCE) })
public void testCdpGlobalGroupCollection() throws Exception {
SnmpAgentConfig config = SnmpPeerFactory.getInstance().getAgentConfig(InetAddress.getByName(RPict001_IP));
String trackerName = "cdpGlobalGroup";
final CdpGlobalGroupTracker cdpGlobalGroup = new CdpGlobalGroupTracker();
try {
m_client.walk(config, cdpGlobalGroup).withDescription(trackerName).withLocation(null).execute().get();
} catch (final InterruptedException e) {
LOG.error("run: Cdp Linkd collection interrupted, exiting", e);
return;
}
assertEquals("r-ro-suce-pict-001.infra.u-ssi.net", cdpGlobalGroup.getCdpDeviceId());
assertEquals(1, cdpGlobalGroup.getCdpGlobalRun().intValue());
assertNull(cdpGlobalGroup.getCdpGlobalDeviceFormat());
}
use of org.opennms.netmgt.snmp.SnmpAgentConfig in project opennms by OpenNMS.
the class EnLinkdSnmpIT method testDot1dStpPortTableWalk.
@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = DLINK1_IP, port = 161, resource = DLINK1_SNMP_RESOURCE) })
public void testDot1dStpPortTableWalk() throws Exception {
String trackerName = "dot1dbaseStpTable";
final List<BridgeStpLink> links = new ArrayList<BridgeStpLink>();
SnmpAgentConfig config = SnmpPeerFactory.getInstance().getAgentConfig(InetAddress.getByName(DLINK1_IP));
Dot1dStpPortTableTracker tracker = new Dot1dStpPortTableTracker() {
@Override
public void processDot1dStpPortRow(final Dot1dStpPortRow row) {
links.add(row.getLink());
}
};
try {
m_client.walk(config, tracker).withDescription(trackerName).withLocation(null).execute().get();
} catch (final InterruptedException e) {
LOG.error("run: collection interrupted, exiting", e);
return;
}
assertEquals(26, links.size());
int i = 0;
for (BridgeStpLink link : links) {
assertEquals(++i, link.getStpPort().intValue());
assertEquals(128, link.getStpPortPriority().intValue());
if (link.getStpPort() <= 6 || link.getStpPort() == 24)
assertEquals(BridgeDot1dStpPortState.DOT1D_STP_PORT_STATUS_FORWARDING, link.getStpPortState());
else
assertEquals(BridgeDot1dStpPortState.DOT1D_STP_PORT_STATUS_DISABLED, link.getStpPortState());
assertEquals(BridgeDot1dStpPortEnable.DOT1D_STP_PORT_ENABLED, link.getStpPortEnable());
assertEquals(2000000, link.getStpPortPathCost().intValue());
assertEquals("0000000000000000", link.getDesignatedRoot());
assertEquals(0, link.getDesignatedCost().intValue());
assertEquals("0000000000000000", link.getDesignatedBridge());
assertEquals("0000", link.getDesignatedPort());
}
}
use of org.opennms.netmgt.snmp.SnmpAgentConfig in project opennms by OpenNMS.
the class EnLinkdSnmpIT method test3LldpRemoteTableWalk.
@Test
@JUnitSnmpAgents(value = { @JUnitSnmpAgent(host = SWITCH2_IP, port = 161, resource = "classpath:/linkd/nms17216/switch2-walk.txt") })
public void test3LldpRemoteTableWalk() throws Exception {
SnmpAgentConfig config = SnmpPeerFactory.getInstance().getAgentConfig(InetAddress.getByName(SWITCH2_IP));
final List<LldpLink> links = new ArrayList<LldpLink>();
LldpRemTableTracker lldpRemTable = new LldpRemTableTracker() {
public void processLldpRemRow(final LldpRemRow row) {
links.add(row.getLldpLink());
}
};
try {
m_client.walk(config, lldpRemTable).withDescription("lldpRemTable").withLocation(null).execute().get();
} catch (ExecutionException e) {
// pass
LOG.error("run: collection failed, exiting", e);
return;
} catch (final InterruptedException e) {
LOG.error("run: collection interrupted, exiting", e);
return;
}
final LldpLocPortGetter lldpLocPort = new LldpLocPortGetter(config, m_client, null);
for (LldpLink link : links) {
assertNotNull(link);
assertNotNull(link.getLldpLocalPortNum());
assertNull(link.getLldpPortId());
assertNull(link.getLldpPortIdSubType());
assertNull(link.getLldpPortDescr());
LldpLink updated = lldpLocPort.getLldpLink(link);
assertNotNull(updated.getLldpPortId());
assertEquals(5, updated.getLldpPortIdSubType().getValue().intValue());
assertNotNull(updated.getLldpPortDescr());
}
}
Aggregations