Exemple #1
0
    def generate_data_center(self):
        self.stdout.write('Generating Data Center assets')
        data_center_status = DataCenterAssetStatus()
        parent_category = DataCenterCategoryFactory(name='DATA CENTER',
                                                    imei_required=False)
        for i in range(2):
            server_room = ServerRoomFactory()
            visualization_col = 1
            visualization_row = 1
            for j in range(10):
                rack = RackFactory(server_room=server_room,
                                   visualization_row=visualization_row,
                                   visualization_col=visualization_col)
                visualization_row += 1
                if (visualization_row >
                        server_room.data_center.visualization_rows_num):
                    visualization_row = 1
                    visualization_col += 1

                accessory = AccessoryFactory()
                RackAccessoryFactory(rack=rack, accessory=accessory)
                position = 1
                for status_id, name in data_center_status:
                    for i in range(2):
                        asset_model = DataCenterAssetModelFactory(
                            category=DataCenterCategoryFactory(
                                parent=parent_category))
                        DataCenterAssetFactory(
                            rack=rack,
                            status=status_id,
                            position=position,
                            slot_no='',
                            service_env=ServiceEnvironmentFactory(),
                            model=asset_model)
                        position += asset_model.height_of_device
                        if position > rack.max_u_height:
                            position = 1

            chassis = DataCenterAssetFactory(
                rack=rack,
                status=DataCenterAssetStatus.used.id,
                position=38,
                slot_no=None,
                service_env=ServiceEnvironmentFactory(),
                model=DataCenterAssetModelFactory(
                    name='Chassis',
                    category=DataCenterCategoryFactory(parent=parent_category),
                    height_of_device=5))
            for i in range(5):
                DataCenterAssetFactory(rack=rack,
                                       status=DataCenterAssetStatus.used.id,
                                       position=None,
                                       service_env=ServiceEnvironmentFactory(),
                                       slot_no=i,
                                       parent=chassis,
                                       model=DataCenterAssetModelFactory(
                                           name='Blade',
                                           has_parent=True,
                                           category=DataCenterCategoryFactory(
                                               parent=parent_category)))
Exemple #2
0
 def setUp(self):
     super().setUp()
     self.server_room = ServerRoomFactory()
     self.accessory = AccessoryFactory()
     self.rack = RackFactory(server_room=self.server_room)
     self.rack_accessory = RackAccessoryFactory(
         accessory=self.accessory, rack=self.rack
     )
Exemple #3
0
    def setUp(self):
        get_user_model().objects.create_superuser(
            'test', '*****@*****.**', 'test'
        )

        self.client = APIClient()
        self.client.login(username='******', password='******')

        environment = EnvironmentFactory()
        service = ServiceFactory(name='Service1')
        service_env = ServiceEnvironment.objects.create(
            service=service,
            environment=environment
        )
        asset_model = DataCenterAssetModelFactory(
            type=ObjectModelType.data_center
        )
        self.server_room = ServerRoomFactory()

        self.accesory_1 = AccessoryFactory()

        self.rack_1 = RackFactory(
            server_room=self.server_room,
            max_u_height=3
        )

        self.asset_1 = DataCenterAssetFactory(
            service_env=service_env,
            position=1,
            slot_no='',
            force_depreciation=False,
            model=asset_model,
            rack=self.rack_1,
        )
        self.asset_1.management_ip = '10.15.25.45'

        self.pdu_1 = DataCenterAssetFactory(
            service_env=service_env,
            rack=self.rack_1,
            orientation=Orientation.left,
            force_depreciation=False,
            model=asset_model,
            position=0,
        )
        self.rack1_accessory = RackAccessoryFactory(
            rack=self.rack_1,
            orientation=Orientation.front,
            accessory=self.accesory_1,
            position=1
        )