def __init__(self, oid=None, oid_index=None, value=None, snmp_type=None): self.oid, self.oid_index = normalize_oid(oid, oid_index) self.value = value self.snmp_type = snmp_type
def test_normalize_oid_with_index(): oid, oid_index = normalize_oid('abc', 'def') assert oid == 'abc' assert oid_index == 'def'
def test_normalize_oid_regular(): oid, oid_index = normalize_oid('sysContact.0') assert oid == 'sysContact' assert oid_index == '0'
def test_normalize_oid_full_qualified(): oid, oid_index = normalize_oid( '.iso.org.dod.internet.mgmt.mib-2.system.sysDescr.0' ) assert oid == '.iso.org.dod.internet.mgmt.mib-2.system.sysDescr' assert oid_index == '0'
def test_normalize_oid_numeric(): oid, oid_index = normalize_oid('.1.3.6.1.2.1.1.1.0') assert oid == '.1.3.6.1.2.1.1.1.0' assert oid_index == ''
def test_normalize_oid_regular(): oid, oid_index = normalize_oid("sysContact.0") assert oid == "sysContact" assert oid_index == "0"
def test_normalize_oid_with_index(): oid, oid_index = normalize_oid("abc", "def") assert oid == "abc" assert oid_index == "def"
def test_normalize_oid_numeric(): oid, oid_index = normalize_oid(".1.3.6.1.2.1.1.1.0") assert oid == ".1.3.6.1.2.1.1.1.0" assert oid_index == ""