示例#1
0
 def setUp(self):
     super().setUp()
     self.envs = EnvironmentFactory.create_batch(2)
     self.services = ServiceFactory.create_batch(2)
     ServiceEnvironment.objects.create(service=self.services[0],
                                       environment=self.envs[0])
     self.team = TeamFactory()
     self.profit_center = ProfitCenterFactory()
示例#2
0
    def setUp(self):
        super().setUp()
        self.envs = EnvironmentFactory.create_batch(2)
        self.services = ServiceFactory.create_batch(2)
        self.service_env = []
        for i in range(0, 2):
            self.service_env.append(ServiceEnvironment.objects.create(
                service=self.services[i], environment=self.envs[i]
            ))
        self.service_env[0].service.business_owners = [self.user1]
        self.service_env[0].service.technical_owners = [self.user2]
        self.service_env[0].save()
        self.cloud_provider = CloudProviderFactory(name='openstack')
        self.cloud_flavor = CloudFlavorFactory()
        self.cloud_project = CloudProjectFactory(
            service_env=self.service_env[0]
        )
        self.cloud_host = CloudHostFactory(
            parent=self.cloud_project,
            cloudflavor=self.cloud_flavor
        )
        self.cloud_host2 = CloudHostFactory()

        self.test_cpu = ComponentModel.objects.create(
            name='vcpu1',
            cores=5,
            family='vCPU',
            type=ComponentType.processor,
        )
        self.test_mem = ComponentModel.objects.create(
            name='2000 MiB vMEM',
            size='2000',
            type=ComponentType.memory,
        )
        self.test_disk = ComponentModel.objects.create(
            name='4 GiB vDISK',
            size='4096',
            type=ComponentType.disk,
        )

        VirtualComponent.objects.create(
            base_object=self.cloud_flavor,
            model=self.test_cpu,
        )
        VirtualComponent.objects.create(
            base_object=self.cloud_flavor,
            model=self.test_mem,
        )
        VirtualComponent.objects.create(
            base_object=self.cloud_flavor,
            model=self.test_disk,
        )
示例#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
        )
示例#4
0
    def setUp(self):
        self.envs = EnvironmentFactory.create_batch(2)
        self.services = ServiceFactory.create_batch(2)
        self.service_env = []
        for i in range(0, 2):
            self.service_env.append(
                ServiceEnvironment.objects.create(service=self.services[i],
                                                  environment=self.envs[i]))

        self.cloud_provider = CloudProviderFactory(name='openstack')
        self.cloud_flavor = CloudFlavorFactory()
        self.cloud_project = CloudProjectFactory()
        self.cloud_host = CloudHostFactory(parent=self.cloud_project)

        self.test_cpu = ComponentModel.objects.create(
            name='vcpu1',
            cores=4,
            family='vCPU',
            type=ComponentType.processor,
        )
        self.test_mem = ComponentModel.objects.create(
            name='1024 MiB vMEM',
            size='1024',
            type=ComponentType.memory,
        )
        self.test_disk = ComponentModel.objects.create(
            name='4 GiB vDISK',
            size='4096',
            type=ComponentType.disk,
        )

        VirtualComponent.objects.create(
            base_object=self.cloud_flavor,
            model=self.test_cpu,
        )
        VirtualComponent.objects.create(
            base_object=self.cloud_flavor,
            model=self.test_mem,
        )
        VirtualComponent.objects.create(
            base_object=self.cloud_flavor,
            model=self.test_disk,
        )