Пример #1
0
 def test_componentTypes(self):
     dc = DeviceClass(self.zp, "Storage/Example", zPythonClass="Device")
     fc = dc.addComponentType("Fan")
     dc.addComponentType("Battery")
     dc.addComponentType("Cpu")
     fc.addComponentType("Blade")
     self.assertEqual(["a.b.c.Battery", "a.b.c.Blade", "a.b.c.Cpu", "a.b.c.Fan"], [c.id for c in dc.componentTypes])
Пример #2
0
 def test_componentTypes(self):
     dc = DeviceClass(self.zp, 'Storage/Example', zPythonClass='Device')
     fc = dc.addComponentType('Fan')
     dc.addComponentType('Battery')
     dc.addComponentType('Cpu')
     fc.addComponentType('Blade')
     self.assertEqual(
         ['a.b.c.Battery', 'a.b.c.Blade', 'a.b.c.Cpu', 'a.b.c.Fan'],
         [c.id for c in dc.componentTypes])
Пример #3
0
 def test_addSubComponentToCustomDeviceComponent(self):
     dc = DeviceClass(self.zp, 'Storage/NetApp', zPythonClass='Device')
     sc = dc.addComponentType('Fan')
     self.assertIsInstance(sc, Component)
     self.assertEqual(
         Relationship.relationships['a.b.c.Device a.b.c.Fan'].hasComponent(
             sc), True)
     self.assertEqual(
         Relationship.relationships['a.b.c.Device a.b.c.Fan'].hasComponent(
             dc.deviceType), True)
Пример #4
0
 def test_addSubComponentToDefaultDeviceComponent(self):
     dc2 = DeviceClass(self.zp, "Server/Linux")
     sc2 = dc2.addComponentType("Fan2")
     self.assertIsInstance(sc2, Component)
     self.assertEqual(
         Relationship.relationships["Products.ZenModel.Device.Device a.b.c.Fan2"].hasComponent(sc2), True
     )
     self.assertEqual(
         Relationship.relationships["Products.ZenModel.Device.Device a.b.c.Fan2"].hasComponent(dc2.deviceType), True
     )
Пример #5
0
 def test_addSubComponentToDefaultDeviceComponent(self):
     dc2 = DeviceClass(self.zp, 'Server/Linux')
     sc2 = dc2.addComponentType('Fan2')
     self.assertIsInstance(sc2, Component)
     self.assertEqual(
         Relationship.
         relationships['Products.ZenModel.Device.Device a.b.c.Fan2'].
         hasComponent(sc2), True)
     self.assertEqual(
         Relationship.relationships[
             'Products.ZenModel.Device.Device a.b.c.Fan2'].hasComponent(
                 dc2.deviceType), True)
Пример #6
0
 def test_addSubComponentToCustomDeviceComponent(self):
     dc = DeviceClass(self.zp, "Storage/NetApp", zPythonClass="Device")
     sc = dc.addComponentType("Fan")
     self.assertIsInstance(sc, Component)
     self.assertEqual(Relationship.relationships["a.b.c.Device a.b.c.Fan"].hasComponent(sc), True)
     self.assertEqual(Relationship.relationships["a.b.c.Device a.b.c.Fan"].hasComponent(dc.deviceType), True)