Ejemplo n.º 1
0
    def testNoValues(self):
        template=createTemplate(self.dmd, 'TestTemplate1')
        device=createTestDevice( self.dmd, 'TestDevice1', dict(
                                zDeviceTemplates=[template.id] ) )

        records=interface().run( self.dmd, {'deviceClass':'/Devices/Server', 'generate':True} )
        self.assertEquals( 0, len( records ) )
Ejemplo n.º 2
0
 def testOneValue(self):
     testSpeed=100
     testInputOctets=5
     testOutputOctets=20
     createInterfaceTemplate( self.dmd )      
     device=createTestDeviceWithInterfaceTemplateBound( self.dmd, 
                                                       'TestDevice2' )
     interface1=createInterface( device, 'TestFilesystem2', testSpeed,
                                   testInputOctets, testOutputOctets )
 
     plugin = interface()
     records = plugin.run( self.dmd, {'deviceClass':'/Devices/Server', 'generate':True} )
     
     self.assertEquals( 1, len( records ) )
     assertInterfaceRowIsCorrect( self, records, device, interface1, 
                                   testSpeed, testInputOctets,
                                   testOutputOctets )
Ejemplo n.º 3
0
 def testMultipleValues(self):
     #import pydevd;pydevd.settrace()
     testProperties = [
                       ( 'testdevice3', [ ('testfs3_1', 100, 20, 15 ),
                                          ('testfs3_2', 50, 100, 98 )] ),
                       ( 'testdevice4', [ ( 'testfs4_1', 300, 20, 15 ) ] ),
                       ( 'testdevice5', [ ( 'testfs5_1', 100, 20, 15 ),
                                          ( 'testfs5_2', 30, 20, 15 ),
                                          ( 'testfs5_3', 160, 20, 15 ) ] ),
                       ( 'testdevice6', [] )
                     ]         
     createInterfaceTemplate( self.dmd )
     interfaceCount = 0
     testObjects = {}
     for propertySet in testProperties:
         device = createTestDeviceWithInterfaceTemplateBound( self.dmd,
                                                               propertySet[0] )
         testInterfaces = []
         for interfaceProperties in propertySet[1]:
             interfaceN = createInterface( device,
                                            interfaceProperties[0],
                                            interfaceProperties[1],
                                            interfaceProperties[2],
                                            interfaceProperties[3]                                               
                                            )
             testInterfaces.append( interfaceN )
             interfaceCount += 1
         testObjects[device]=testInterfaces
     
     plugin = interface()
     records = plugin.run( self.dmd, {'deviceClass':'/Devices/Server', 'generate':True} )
     
     self.assertEquals( interfaceCount, len( records ) )
     for device, interfaceObjects in testObjects.iteritems():
         for interfaceObject in interfaceObjects:
             assertInterfaceRowIsCorrect( self, records, device, 
                 interfaceObject,
                 interfaceObject.speed,
                 interfaceObject.ifInputOctets_ifInputOctets,
                 interfaceObject.ifOutputOctets_ifOutputOctets )