Ejemplo n.º 1
0
 def setUp(self):
     self.client = login_as_su()
     venture = Venture(name=DEVICE['venture'],
                       symbol=DEVICE['ventureSymbol'])
     venture.save()
     self.venture = venture
     venture_role = VentureRole(name=DEVICE['venture_role'],
                                venture=self.venture)
     venture_role.save()
     self.venture_role = venture_role
     self.device = Device.create(
         sn=DEVICE['sn'],
         barcode=DEVICE['barcode'],
         remarks=DEVICE['remarks'],
         model_name=DEVICE['model_name'],
         model_type=DeviceType.unknown,
         venture=self.venture,
         venture_role=self.venture_role,
         rack=DEVICE['rack'],
         position=DEVICE['position'],
         dc=DATACENTER,
     )
     self.device.name = DEVICE['name']
     self.device.save()
     self.ip = IPAddress(address=DEVICE['ip'], device=self.device)
     self.ip.save()
     self.db_ip = IPAddress.objects.get(address=DEVICE['ip'])
     self.network_terminator = NetworkTerminator(name='simple_terminator')
     self.network_terminator.save()
     self.network_datacenter = DataCenter(name=DATACENTER)
     self.network_datacenter.save()
     self.network = Network(
         name=NETWORK['name'],
         address=NETWORK['address'],
         data_center=self.network_datacenter,
     )
     self.diskshare_device = Device.create(
         sn=DISKSHARE['sn'],
         barcode=DISKSHARE['barcode'],
         model_name='xxx',
         model_type=DeviceType.storage,
     )
     self.diskshare_device.name = DISKSHARE['device']
     self.diskshare_device.save()
     self.cm_generic = ComponentModel(name='GenericModel')
     self.cm_diskshare = ComponentModel(name='DiskShareModel')
     self.cm_processor = ComponentModel(name='ProcessorModel')
     self.cm_memory = ComponentModel(name='MemoryModel')
     self.cm_storage = ComponentModel(name='ComponentModel')
     self.cm_fibre = ComponentModel(name='FibreChannalMidel')
     self.cm_ethernet = ComponentModel(name='EthernetMidel')
     self.cm_software = ComponentModel(name='SoftwareModel')
     self.cm_splunkusage = ComponentModel(name='SplunkusageModel')
     self.cm_operatingsystem = ComponentModel(name='OperatingSystemModel')
     self.generic_component = GenericComponent(
         device=self.device,
         model=self.cm_generic,
         label=COMPONENT['GenericComponent'],
         sn=GENERIC['sn'],
     )
     self.generic_component.save()
     self.diskshare = DiskShare(
         device=self.device,
         model=self.cm_diskshare,
         share_id=self.device.id,
         size=80,
         wwn=DISKSHARE['wwn'],
     )
     self.diskshare.save()
     self.disksharemount = DiskShareMount.concurrent_get_or_create(
         share=self.diskshare,
         device=self.device,
         volume=COMPONENT['DiskShareMount'],
     )
     self.processor = Processor(
         device=self.device,
         model=self.cm_processor,
         label=COMPONENT['Processor'],
     )
     self.processor.save()
     self.memory = Memory(
         device=self.device,
         model=self.cm_memory,
         label=COMPONENT['Memory'],
     )
     self.memory.save()
     self.storage = Storage(
         device=self.device,
         model=self.cm_storage,
         label=COMPONENT['Storage'],
     )
     self.storage.save()
     self.fibrechannel = FibreChannel(
         device=self.device,
         model=self.cm_fibre,
         label=COMPONENT['Fibre'],
         physical_id='01234',
     )
     self.fibrechannel.save()
     self.ethernet = Ethernet(
         model=self.cm_ethernet,
         device=self.device,
         mac=DEVICE['mac'],
     )
     self.ethernet.save()
     self.software = Software(
         device=self.device,
         model=self.cm_software,
         label=COMPONENT['Software'],
     )
     self.software.save()
     self.splunkusage = SplunkUsage(
         device=self.device,
         model=self.cm_splunkusage,
     )
     self.splunkusage.save()
     self.operatingsystem = OperatingSystem(
         device=self.device,
         model=self.cm_operatingsystem,
         label=COMPONENT['OS'],
     )
     self.operatingsystem.save()