コード例 #1
0
 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
コード例 #2
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()
コード例 #3
0
 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
コード例 #4
0
 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
コード例 #5
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()
コード例 #6
0
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)
コード例 #7
0
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)
コード例 #8
0
    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()
コード例 #9
0
    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()
コード例 #10
0
 def snmpIgnore(self):
     return ManagedEntity.snmpIgnore(self) or self.snmpindex < 0
 def snmpIgnore(self):
     return ManagedEntity.snmpIgnore(self) or self.snmpindex < 0