コード例 #1
0
ファイル: SnmpDetectorTest.java プロジェクト: OpenNMS/opennms
  @Test(timeout = 20000)
  public void testDetectTableAny() throws UnknownHostException {
    // Set to table with 3 and 2 mixed
    m_detector.setOid(".1.3.6.1.2.1.2.2.1.7");
    m_detector.setIsTable("true");
    m_detector.setMatchType(MatchType.Any.name());

    // Detect service if 2 is somewhere in the table
    m_detector.setVbvalue("2");
    assertEquals(true, m_detector.isServiceDetected(m_testIpAddress));

    // Do not detect service if 1 is not in the table
    m_detector.setVbvalue("1");
    assertEquals(false, m_detector.isServiceDetected(m_testIpAddress));
  }
コード例 #2
0
ファイル: SnmpDetectorTest.java プロジェクト: OpenNMS/opennms
  @Test(timeout = 20000)
  public void testDetectTableHexString() throws UnknownHostException {
    m_detector.setOid(".1.3.6.1.2.1.3.1.1.2.4.1");
    m_detector.setIsTable("true");

    // Validate against data type Hex-STRING for a MAC address
    m_detector.setHex("true");
    m_detector.setMatchType(MatchType.Any.name());
    m_detector.setVbvalue("000f662002fd");
    assertEquals(true, m_detector.isServiceDetected(m_testIpAddress));

    // Should not detect, input not interpreted as Hex-STRING
    m_detector.setHex("false");
    m_detector.setVbvalue("000f662002fd");
    assertEquals(false, m_detector.isServiceDetected(m_testIpAddress));
  }