def testParseFilterDefinitionForInvalidVersion(self): filter = TrapFilter() results = filter._parseFilterDefinition("include V3 ignored", 99) self.assertEquals( results, "Invalid SNMP version 'V3'; the only valid versions are 'v1' or 'v2'" )
def testParseFilterDefinitionForInvalidAction(self): filter = TrapFilter() results = filter._parseFilterDefinition("invalid V1 ignored", 99) self.assertEquals( results, "Invalid action 'invalid'; the only valid actions are 'include' or 'exclude'" )
def testParseFilterDefinitionForValidV2Definition(self): filter = TrapFilter() results = filter._parseFilterDefinition("include V2 .1.3.6.1.4.*", 99) self.assertEquals(results, None)
def testParseFilterDefinitionForInvalidV2Definition(self): filter = TrapFilter() results = filter._parseFilterDefinition("include V2 .", 99) self.assertEquals(results, "'' is not a valid OID: Empty OID is invalid")
def testParseFilterDefinitionForCaseInsensitiveDefinition(self): filter = TrapFilter() results = filter._parseFilterDefinition("InClude v1 3", 99) self.assertEquals(results, None)
def testParseFilterDefinitionForInvalidVersion(self): filter = TrapFilter() results = filter._parseFilterDefinition("include V3 ignored", 99) self.assertEquals(results, "Invalid SNMP version 'V3'; the only valid versions are 'v1' or 'v2'")
def testParseFilterDefinitionForInvalidAction(self): filter = TrapFilter() results = filter._parseFilterDefinition("invalid V1 ignored", 99) self.assertEquals(results, "Invalid action 'invalid'; the only valid actions are 'include' or 'exclude'")
def testParseFilterDefinitionForIncompleteLine(self): filter = TrapFilter() results = filter._parseFilterDefinition("a b", 99) self.assertEquals(results, "Incomplete filter definition")
def testParseFilterDefinitionForValidV2Definition(self): filter = TrapFilter() results = filter._parseFilterDefinition("include V2 .1.3.6.1.4.*", 99) self.assertEquals(results, None)
def testParseFilterDefinitionForInvalidV2Definition(self): filter = TrapFilter() results = filter._parseFilterDefinition("include V2 .", 99) self.assertEquals(results, "'' is not a valid OID: Empty OID is invalid")
def testParseFilterDefinitionForCaseInsensitiveDefinition(self): filter = TrapFilter() results = filter._parseFilterDefinition("InClude v1 3", 99) self.assertEquals(results, None)
def testParseFilterDefinitionForIncompleteLine(self): filter = TrapFilter() results = filter._parseFilterDefinition("a b", 99) self.assertEquals(results, "Incomplete filter definition")