本文整理汇总了Python中Products.ZenEvents.TrapFilter.TrapFilter._parseV1FilterDefinition方法的典型用法代码示例。如果您正苦于以下问题:Python TrapFilter._parseV1FilterDefinition方法的具体用法?Python TrapFilter._parseV1FilterDefinition怎么用?Python TrapFilter._parseV1FilterDefinition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Products.ZenEvents.TrapFilter.TrapFilter
的用法示例。
在下文中一共展示了TrapFilter._parseV1FilterDefinition方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testParseV1FilterDefinitionFailsForInvalidEnterpriseSpecificTrap
# 需要导入模块: from Products.ZenEvents.TrapFilter import TrapFilter [as 别名]
# 或者: from Products.ZenEvents.TrapFilter.TrapFilter import _parseV1FilterDefinition [as 别名]
def testParseV1FilterDefinitionFailsForInvalidEnterpriseSpecificTrap(self):
filter = TrapFilter()
results = filter._parseV1FilterDefinition(99, "include", [".1.3.6.1.4.5", "abc"])
self.assertEquals(results, "Specific trap 'abc' invalid; must be non-negative integer")
results = filter._parseV1FilterDefinition(99, "include", [".1.3.6.1.4.5", "-1"])
self.assertEquals(results, "Specific trap '-1' invalid; must be non-negative integer")
示例2: testParseV1FilterDefinitionFailsForInvalidTrap
# 需要导入模块: from Products.ZenEvents.TrapFilter import TrapFilter [as 别名]
# 或者: from Products.ZenEvents.TrapFilter.TrapFilter import _parseV1FilterDefinition [as 别名]
def testParseV1FilterDefinitionFailsForInvalidTrap(self):
filter = TrapFilter()
results = filter._parseV1FilterDefinition(99, "include", ["a"])
self.assertEquals(results, "Invalid generic trap 'a'; must be one of 0-5")
results = filter._parseV1FilterDefinition(99, "include", ["6"])
self.assertEquals(results, "Invalid generic trap '6'; must be one of 0-5")
示例3: testParseV1FilterDefinitionForGenericTrap
# 需要导入模块: from Products.ZenEvents.TrapFilter import TrapFilter [as 别名]
# 或者: from Products.ZenEvents.TrapFilter.TrapFilter import _parseV1FilterDefinition [as 别名]
def testParseV1FilterDefinitionForGenericTrap(self):
filter = TrapFilter()
results = filter._parseV1FilterDefinition(99, "include", ["0"])
self.assertEquals(results, None)
self.assertEquals(len(filter._v1Traps), 1)
self.assertEquals(len(filter._v1Filters), 0)
self.assertEquals(len(filter._v2Filters), 0)
genericTrapDefinition = filter._v1Traps["0"]
self.assert_(genericTrapDefinition != None)
self.assertEquals(genericTrapDefinition.lineNumber, 99)
self.assertEquals(genericTrapDefinition.action, "include")
self.assertEquals(genericTrapDefinition.genericTrap, "0")
# Now add another to make sure we can parse more than one
results = filter._parseV1FilterDefinition(100, "exclude", ["5"])
self.assertEquals(results, None)
self.assertEquals(len(filter._v1Traps), 2)
self.assertEquals(len(filter._v1Filters), 0)
self.assertEquals(len(filter._v2Filters), 0)
genericTrapDefinition = filter._v1Traps["5"]
self.assert_(genericTrapDefinition != None)
self.assertEquals(genericTrapDefinition.lineNumber, 100)
self.assertEquals(genericTrapDefinition.action, "exclude")
self.assertEquals(genericTrapDefinition.genericTrap, "5")
示例4: testParseV1FilterDefinitionFailsForConflictingTrap
# 需要导入模块: from Products.ZenEvents.TrapFilter import TrapFilter [as 别名]
# 或者: from Products.ZenEvents.TrapFilter.TrapFilter import _parseV1FilterDefinition [as 别名]
def testParseV1FilterDefinitionFailsForConflictingTrap(self):
filter = TrapFilter()
results = filter._parseV1FilterDefinition(99, "include", ["1"])
self.assertEquals(results, None)
results = filter._parseV1FilterDefinition(100, "include", ["1"])
self.assertEquals(results, "Generic trap '1' conflicts with previous definition at line 99")
# Verify we find a conflict for generic traps where the action differs
results = filter._parseV1FilterDefinition(100, "exclude", ["1"])
self.assertEquals(results, "Generic trap '1' conflicts with previous definition at line 99")
示例5: testParseV1FilterDefinitionFailsForEmptyOID
# 需要导入模块: from Products.ZenEvents.TrapFilter import TrapFilter [as 别名]
# 或者: from Products.ZenEvents.TrapFilter.TrapFilter import _parseV1FilterDefinition [as 别名]
def testParseV1FilterDefinitionFailsForEmptyOID(self):
filter = TrapFilter()
results = filter._parseV1FilterDefinition(99, "include", [])
self.assertEquals(results, "'' is not a valid OID: Empty OID is invalid")
results = filter._parseV1FilterDefinition(99, "include", [""])
self.assertEquals(results, "'' is not a valid OID: Empty OID is invalid")
results = filter._parseV1FilterDefinition(99, "include", ["."])
self.assertEquals(results, "'' is not a valid OID: Empty OID is invalid")
results = filter._parseV1FilterDefinition(99, "include", ["..."])
self.assertEquals(results, "'' is not a valid OID: Empty OID is invalid")
示例6: testParseV1FilterDefinitionFailsForConflictingOID
# 需要导入模块: from Products.ZenEvents.TrapFilter import TrapFilter [as 别名]
# 或者: from Products.ZenEvents.TrapFilter.TrapFilter import _parseV1FilterDefinition [as 别名]
def testParseV1FilterDefinitionFailsForConflictingOID(self):
filter = TrapFilter()
results = filter._parseV1FilterDefinition(99, "include", [".1.3.6.1.4.5", "2"])
self.assertEquals(results, None)
results = filter._parseV1FilterDefinition(100, "include", [".1.3.6.1.4.5", "2"])
self.assertEquals(results, "OID '1.3.6.1.4.5' conflicts with previous definition at line 99")
# Verify we find a conflict for OIDs where the action differs
results = filter._parseV1FilterDefinition(100, "exclude", [".1.3.6.1.4.5", "2"])
self.assertEquals(results, "OID '1.3.6.1.4.5' conflicts with previous definition at line 99")
results = filter._parseV1FilterDefinition(101, "include", [".1.3.6.1.4.*"])
self.assertEquals(results, None)
# Verify we find a conflict for glob-based OIDs
results = filter._parseV1FilterDefinition(102, "include", [".1.3.6.1.4.*"])
self.assertEquals(results, "OID '1.3.6.1.4.*' conflicts with previous definition at line 101")
# Verify we find a conflict for glob-based OIDs where the action differs
results = filter._parseV1FilterDefinition(102, "exclude", [".1.3.6.1.4.*"])
self.assertEquals(results, "OID '1.3.6.1.4.*' conflicts with previous definition at line 101")
示例7: testParseV1FilterDefinitionFailsForMissingEnterpriseSpecificTrap
# 需要导入模块: from Products.ZenEvents.TrapFilter import TrapFilter [as 别名]
# 或者: from Products.ZenEvents.TrapFilter.TrapFilter import _parseV1FilterDefinition [as 别名]
def testParseV1FilterDefinitionFailsForMissingEnterpriseSpecificTrap(self):
filter = TrapFilter()
results = filter._parseV1FilterDefinition(99, "include", [".1.3.6.1.4.5"])
self.assertEquals(results, "Missing specific trap number or '*'")
示例8: testParseV1FilterDefinitionFailsForEnterpriseSpecificGlob
# 需要导入模块: from Products.ZenEvents.TrapFilter import TrapFilter [as 别名]
# 或者: from Products.ZenEvents.TrapFilter.TrapFilter import _parseV1FilterDefinition [as 别名]
def testParseV1FilterDefinitionFailsForEnterpriseSpecificGlob(self):
filter = TrapFilter()
results = filter._parseV1FilterDefinition(99, "include", [".1.3.6.1.4.5.*", "23"])
self.assertEquals(results, "Specific trap not allowed with globbed OID")
示例9: testParseV1FilterDefinitionFailsForInvalidOID
# 需要导入模块: from Products.ZenEvents.TrapFilter import TrapFilter [as 别名]
# 或者: from Products.ZenEvents.TrapFilter.TrapFilter import _parseV1FilterDefinition [as 别名]
def testParseV1FilterDefinitionFailsForInvalidOID(self):
filter = TrapFilter()
results = filter._parseV1FilterDefinition(99, "include", ["invalidOID"])
self.assertEquals(results, "'invalidOID' is not a valid OID: Invalid character found; only digits, '.' and '*' allowed")
示例10: testParseV1FilterDefinitionFailsForTooManyArgs
# 需要导入模块: from Products.ZenEvents.TrapFilter import TrapFilter [as 别名]
# 或者: from Products.ZenEvents.TrapFilter.TrapFilter import _parseV1FilterDefinition [as 别名]
def testParseV1FilterDefinitionFailsForTooManyArgs(self):
filter = TrapFilter()
results = filter._parseV1FilterDefinition(99, "include", ["0", "1", "2"])
self.assertEquals(results, "Too many fields found; at most 4 fields allowed for V1 filters")
示例11: testParseV1FilterDefinitionEnterpriseSpecificTrap
# 需要导入模块: from Products.ZenEvents.TrapFilter import TrapFilter [as 别名]
# 或者: from Products.ZenEvents.TrapFilter.TrapFilter import _parseV1FilterDefinition [as 别名]
def testParseV1FilterDefinitionEnterpriseSpecificTrap(self):
filter = TrapFilter()
results = filter._parseV1FilterDefinition(99, "include", ["1.2.3.*"])
self.assertEquals(results, None)
self.assertEquals(len(filter._v1Traps), 0)
self.assertEquals(len(filter._v1Filters), 1)
self.assertEquals(len(filter._v2Filters), 0)
oidLevels = 4
mapByLevel = filter._v1Filters[oidLevels]
self.assert_(mapByLevel != None)
self.assertEquals(len(mapByLevel), 1)
filterDef = mapByLevel["1.2.3.*"]
self.assert_(filterDef != None)
self.assertEquals(filterDef.lineNumber, 99)
self.assertEquals(filterDef.action, "include")
self.assertEquals(filterDef.oid, "1.2.3.*")
self.assertEquals(filterDef.specificTrap, None)
# Add another 4-level OID
results = filter._parseV1FilterDefinition(100, "exclude", ["1.2.3.4", "25"])
self.assertEquals(results, None)
self.assertEquals(len(filter._v1Traps), 0)
self.assertEquals(len(filter._v1Filters), 1)
self.assertEquals(len(filter._v2Filters), 0)
mapByLevel = filter._v1Filters[oidLevels]
self.assert_(mapByLevel != None)
self.assertEquals(len(mapByLevel), 2)
filterDef = mapByLevel["1.2.3.4-25"]
self.assert_(filterDef != None)
self.assertEquals(filterDef.lineNumber, 100)
self.assertEquals(filterDef.action, "exclude")
self.assertEquals(filterDef.oid, "1.2.3.4")
self.assertEquals(filterDef.specificTrap, "25")
# Add a different specific trap for the same OID
results = filter._parseV1FilterDefinition(101, "exclude", ["1.2.3.4", "99"])
self.assertEquals(results, None)
self.assertEquals(len(filter._v1Traps), 0)
self.assertEquals(len(filter._v1Filters), 1)
self.assertEquals(len(filter._v2Filters), 0)
mapByLevel = filter._v1Filters[oidLevels]
self.assert_(mapByLevel != None)
self.assertEquals(len(mapByLevel), 3)
filterDef = mapByLevel["1.2.3.4-99"]
self.assert_(filterDef != None)
self.assertEquals(filterDef.lineNumber, 101)
self.assertEquals(filterDef.action, "exclude")
self.assertEquals(filterDef.oid, "1.2.3.4")
self.assertEquals(filterDef.specificTrap, "99")
# Add another single-level OID
results = filter._parseV1FilterDefinition(101, "exclude", ["*"])
self.assertEquals(results, None)
self.assertEquals(len(filter._v1Traps), 0)
self.assertEquals(len(filter._v1Filters), 2)
self.assertEquals(len(filter._v2Filters), 0)
oidLevels = 1
mapByLevel = filter._v1Filters[oidLevels]
self.assert_(mapByLevel != None)
self.assertEquals(len(mapByLevel), 1)
filterDef = mapByLevel["*"]
self.assert_(filterDef != None)
self.assertEquals(filterDef.lineNumber, 101)
self.assertEquals(filterDef.action, "exclude")
self.assertEquals(filterDef.oid, "*")
self.assertEquals(filterDef.specificTrap, None)