Example #1
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)
 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
     )
Example #3
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)
Example #4
0
    def test_SubDeviceClassCreate(self):
        dc = DeviceClass(self.zp, 'Storage/Foo')
        sdc = dc.addClass('Bar')
        self.assertEqual(sdc.path, '/zport/dmd/Storage/Foo/Bar')
        self.assertEqual(sdc.zPythonClass, 'Products.ZenModel.Device.Device')

        sdc_zp = dc.addClass('Bar2', zPythonClass='Products.ZenModel.Foo.Foo')
        self.assertEqual(sdc_zp.path, '/zport/dmd/Storage/Foo/Bar2')
        self.assertEqual(sdc_zp.zPythonClass, 'Products.ZenModel.Foo.Foo')

        sdc_p = dc.addClass('Bar3', prefix='bah')
        self.assertEqual(sdc_p.path, '/zport/dmd/Storage/Foo/Bar3')
    def test_SubDeviceClassCreate(self):
        dc = DeviceClass(self.zp, "Storage/Foo")
        sdc = dc.addClass("Bar")
        self.assertEqual(sdc.path, "/zport/dmd/Storage/Foo/Bar")
        self.assertEqual(sdc.zPythonClass, "Products.ZenModel.Device.Device")

        sdc_zp = dc.addClass("Bar2", zPythonClass="Products.ZenModel.Foo.Foo")
        self.assertEqual(sdc_zp.path, "/zport/dmd/Storage/Foo/Bar2")
        self.assertEqual(sdc_zp.zPythonClass, "Products.ZenModel.Foo.Foo")

        sdc_p = dc.addClass("Bar3", prefix="bah")
        self.assertEqual(sdc_p.path, "/zport/dmd/Storage/Foo/Bar3")
Example #6
0
 def test_zPythonClassProperty(self):
     dc = DeviceClass(self.zp, 'Devices/Server/Organizer')
     org = Organizer(self.zp,
                     'Devices/Server/Organizer',
                     type_='DeviceClass')
     self.assertEqual(dc.path, '/zport/dmd/Devices/Server/Organizer')
     self.assertEqual(dc.zPythonClass, 'Products.ZenModel.Device.Device')
     self.assertEqual(org.properties['zPythonClass'].value,
                      'Products.ZenModel.Device.Device')
Example #7
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])
 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])
Example #9
0
 def test_setzPythonClass_shortClass(self):
     dc = DeviceClass(self.zp, 'Storage/Foo', zPythonClass='Device')
     self.assertEqual(dc.zPythonClass, 'a.b.c.Device')
     self.assertEqual(dc.deviceType.id, 'a.b.c.Device')
Example #10
0
 def test_DeviceClassComponentId(self):
     dc = DeviceClass(self.zp, 'Storage/Foo')
     self.assertEqual(dc.deviceType.id, 'Products.ZenModel.Device.Device')
Example #11
0
 def test_DeviceClassCreate(self):
     dc = DeviceClass(self.zp, '/Storage/Foo')
     self.assertIsInstance(dc, DeviceClass)
     self.assertEqual(dc.zPythonClass, 'Products.ZenModel.Device.Device')
 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)