示例#1
0
文件: cmdb.py 项目: 4i60r/ralph
 def generate_data(self, data):
     for service in data['services'].values():
         for env in data['envs'].values():
             CIRelationFactory.create(
                 parent=service,
                 child=env,
                 type=CI_RELATION_TYPES.CONTAINS,
             )
示例#2
0
 def generate_data(self, data):
     for service in data['services'].values():
         for env in data['envs'].values():
             CIRelationFactory.create(
                 parent=service,
                 child=env,
                 type=CI_RELATION_TYPES.CONTAINS,
             )
示例#3
0
文件: cmdb.py 项目: 4i60r/ralph
 def generate_data(self, data):
     business = BusinessLineFactory(name='IT')
     profit_center = ProfitCenterFactory(name='Default profit center')
     CIRelationFactory.create(
         parent=business,
         child=profit_center,
         type=CI_RELATION_TYPES.CONTAINS,
     )
     for service in data['services'].values():
         CIRelationFactory.create(
             parent=profit_center,
             child=service,
             type=CI_RELATION_TYPES.CONTAINS,
         )
示例#4
0
 def generate_data(self, data):
     business = BusinessLineFactory(name='IT')
     profit_center = ProfitCenterFactory(name='Default profit center')
     CIRelationFactory.create(
         parent=business,
         child=profit_center,
         type=CI_RELATION_TYPES.CONTAINS,
     )
     for service in data['services'].values():
         CIRelationFactory.create(
             parent=profit_center,
             child=service,
             type=CI_RELATION_TYPES.CONTAINS,
         )
示例#5
0
 def setUp(self):
     self.client = login_as_su(is_superuser=True)
     self.category_blade = AssetCategory.objects.get(name='Server Blade')
     self.category_non_blade = AssetCategory.objects.get(name='Server Rack')
     self.model_blade = AssetModelFactory(category=self.category_blade)
     self.model_none_blade = AssetModelFactory(
         category=self.category_non_blade,
     )
     self.warehouse = WarehouseFactory()
     self.ci_relation = CIRelationFactory()
示例#6
0
    def device_environment(self, create, extracted, **kwargs):
        if not create:
            # Simple build, do nothing.
            return

        if extracted:
            self.device_environment = extracted
        else:
            if self.service:
                ci_relation = CIRelationFactory(parent=self.service)
                self.device_environment = ci_relation.child
 def setUp(self):
     self.client = login_as_su()
     self.warehouse = WarehouseFactory()
     self.category = AssetCategoryFactory()
     self.model = AssetModelFactory(category=self.category)
     self.addform = '/assets/dc/add/device/'
     ci_relation = CIRelationFactory()
     self.common_test_data = dict(
         asset=True,
         deprecation_rate=0,
         device_environment=ci_relation.child.id,
         invoice_date='2001-01-02',
         model=self.model.id,
         price='10',
         production_year=2011,
         ralph_device_id='',
         service=ci_relation.parent.id,
         size=1,
         slots=1,
         source=1,
         status=AssetStatus.new.id,
         type=AssetType.data_center.id,
         warehouse=self.warehouse.id,
     )
示例#8
0
 def test_getting_environments(self):
     service = ServiceCatalogFactory()
     env = DeviceEnvironmentFactory()
     self.assertEqual(len(service.get_environments()), 0)
     CIRelationFactory(parent=service, child=env)
     self.assertEqual(len(service.get_environments()), 1)