def __init__(self, id, buildRelations=True): ManagedEntity.__init__(self, id, buildRelations=buildRelations) os = OperatingSystem() self._setObject(os.id, os) hw = IBM3584DeviceHW() self._setObject(hw.id, hw) self._lastPollSnmpUpTime = ZenStatus(0) self._snmpLastCollection = 0 self._lastChange = 0
def __init__(self, id, buildRelations=True): ManagedEntity.__init__(self, id, buildRelations=buildRelations) os = DellEqualLogicDeviceOS() self._setObject(os.id, os) hw = DeviceHW() self._setObject(hw.id, hw) self._lastPollSnmpUpTime = ZenStatus(0) self._snmpLastCollection = 0 self._lastChange = 0 self.buildRelations()
def __init__(self, id, buildRelations=True): ManagedEntity.__init__(self, id, buildRelations=buildRelations) os = AIXOperatingSystem() self._setObject(os.id, os) hw = AIXDeviceHW() self._setObject(hw.id, hw) #self.commandStatus = "Not Tested" self._lastPollSnmpUpTime = ZenStatus(0) self._snmpLastCollection = 0 self._lastChange = 0
def __init__(self, id, buildRelations=True): ManagedEntity.__init__(self, id, buildRelations=buildRelations) os = SNIADeviceOS() self._setObject(os.id, os) hw = SNIADeviceHW() self._setObject(hw.id, hw) self._lastPollSnmpUpTime = ZenStatus(0) self._snmpLastCollection = 0 self._lastChange = 0 self.buildRelations()
def component_to_tests(component, one_sided=True): device_path = '/'.join(component.device().getPrimaryPath()) component_path = '/'.join(component.getPrimaryPath()) component_path = re.sub('^' + device_path + '/', '', component_path) me = ManagedEntity('') propnames = sorted(set(component.propertyIds()) - set(me.propertyIds())) relnames = sorted( set(component.getRelationshipNames()) - set(me.getRelationshipNames()) - set(('depedencies', 'dependents', 'maintenanceWindows'))) if one_sided: # remove relationships that are not alphabetically the first # one between themselves and the remote end of of the relationship. # This assumes that we'll be building tests for the other side of the # relationship and avoids duplicate tests. new_relnames = [] for relname in relnames: rel = component._getOb(relname) if rel.id < rel.remoteName(): new_relnames.append(relname) relnames = new_relnames out = [] out.append(" component = self.device.getObjByPath(%r)" % component_path) for propname in ['title'] + propnames: out.append(" self.assertEquals(component.%s, %r)" % (propname, getattr(component, propname))) for relname in relnames: rel = getattr(component, relname) objs = rel() if objs is None: out.append(" self.assertIsNone(component.%s())" % relname) elif isinstance(objs, list): out.append(" self.assertIsNotNone(component.%s())" % relname) objids = sorted([x.id for x in objs]) out.append( " self.assertEquals(sorted([x.id for x in component.%s()]), %r)" % (relname, objids)) else: out.append(" self.assertIsNotNone(component.%s())" % relname) out.append(" self.assertEquals(component.%s().id, %r)" % (relname, objs.id)) return "\n".join(out)
def component_to_tests(component, one_sided=True): device_path = '/'.join(component.device().getPrimaryPath()) component_path = '/'.join(component.getPrimaryPath()) component_path = re.sub('^' + device_path + '/', '', component_path) me = ManagedEntity('') propnames = sorted(set(component.propertyIds()) - set(me.propertyIds())) relnames = sorted(set(component.getRelationshipNames()) - set(me.getRelationshipNames()) - set(('depedencies', 'dependents', 'maintenanceWindows'))) if one_sided: # remove relationships that are not alphabetically the first # one between themselves and the remote end of of the relationship. # This assumes that we'll be building tests for the other side of the # relationship and avoids duplicate tests. new_relnames = [] for relname in relnames: rel = component._getOb(relname) if rel.id < rel.remoteName(): new_relnames.append(relname) relnames = new_relnames out = [] out.append(" component = self.device.getObjByPath(%r)" % component_path) for propname in ['title'] + propnames: out.append(" self.assertEquals(component.%s, %r)" % (propname, getattr(component, propname))) for relname in relnames: rel = getattr(component, relname) objs = rel() if objs is None: out.append(" self.assertIsNone(component.%s())" % relname) elif isinstance(objs, list): out.append(" self.assertIsNotNone(component.%s())" % relname) objids = sorted([x.id for x in objs]) out.append(" self.assertEquals(sorted([x.id for x in component.%s()]), %r)" % (relname, objids)) else: out.append(" self.assertIsNotNone(component.%s())" % relname) out.append(" self.assertEquals(component.%s().id, %r)" % (relname, objs.id)) return "\n".join(out)
def __init__(self, id, buildRelations=True): ''' Initialize a new device. Overridden so that the os property can be created as subclass of the standard OperatingSystem class. ''' ManagedEntity.__init__(self, id, buildRelations=buildRelations) os = OperatingSystem() self._setObject(os.id, os) hw = DeviceHW() self._setObject(hw.id, hw) self._lastPollSnmpUpTime = ZenStatus(0) self._snmpLastCollection = 0 self._lastChange = 0 if hasattr(self, '_create_componentSearch'): self._create_componentSearch()
def snmpIgnore(self): return ManagedEntity.snmpIgnore(self) or self.snmpindex < 0