示例#1
0
  @Test
  public void testGetNextMultipleVarbinds() throws Exception {

    request(".1.0.8802.1.1.2.1.3.1")
        .andExpect(".1.0.8802.1.1.2.1.3.1.0", SMIConstants.SYNTAX_INTEGER32, new Integer32(4));

    doGetNext();

    m_agent.getUsm().setEngineBoots(15);

    byte[] hexString =
        new byte[] {(byte) 0x80, (byte) 0x71, (byte) 0x1F, (byte) 0x8F, (byte) 0xAF, (byte) 0xC0};
    request(".1.0.8802.1.1.2.1.3.1")
        .andExpect(".1.0.8802.1.1.2.1.3.1.0", SMIConstants.SYNTAX_INTEGER32, new Integer32(4));
    request(".1.0.8802.1.1.2.1.3.2")
        .andExpect(
            ".1.0.8802.1.1.2.1.3.2.0",
            SMIConstants.SYNTAX_OCTET_STRING,
            new OctetString(hexString));
    request(".1.0.8802.1.1.2.1.3.3")
        .andExpect(
            ".1.0.8802.1.1.2.1.3.3.0",
            SMIConstants.SYNTAX_OCTET_STRING,
            new OctetString("penrose-mx480".getBytes()));

    doGetNext();

    // This statement breaks the internal state of the SNMP4J agent
    // m_agent.getUsm().setLocalEngine(m_agent.getUsm().getLocalEngineID(), 15, 200);
    m_agent.getUsm().removeEngineTime(m_usm.getLocalEngineID());
    m_usm.removeEngineTime(m_agent.getUsm().getLocalEngineID());

    request(".1.0.8802.1.1.2.1.3.1")
        .andExpect(".1.0.8802.1.1.2.1.3.1.0", SMIConstants.SYNTAX_INTEGER32, new Integer32(4));
    doGetNext();
  }