def create_ocp_provider(self, cluster_id, cluster_alias): """Create OCP test provider.""" authentication_data = { 'uuid': uuid4(), 'provider_resource_name': cluster_id, } authentication_id = ProviderAuthentication(**authentication_data) authentication_id.save() billing_source_data = { 'uuid': uuid4(), 'bucket': '', } billing_source_id = ProviderBillingSource(**billing_source_data) billing_source_id.save() provider_uuid = uuid4() provider_data = { 'uuid': provider_uuid, 'name': cluster_alias, 'authentication': authentication_id, 'billing_source': billing_source_id, 'customer': None, 'created_by': None, 'type': 'OCP', 'setup_complete': False } provider = Provider(**provider_data) provider.save() self.cluster_alias = cluster_alias self.provider_uuid = provider_uuid return provider
def create_ocp_provider(self, cluster_id, cluster_alias, infrastructure_type="Unknown"): """Create OCP test provider.""" authentication_data = {"uuid": uuid4(), "provider_resource_name": cluster_id} authentication_id = ProviderAuthentication(**authentication_data) authentication_id.save() billing_source_data = {"uuid": uuid4(), "bucket": ""} billing_source_id = ProviderBillingSource(**billing_source_data) billing_source_id.save() provider_uuid = uuid4() provider_data = { "uuid": provider_uuid, "name": cluster_alias, "authentication": authentication_id, "billing_source": billing_source_id, "customer": None, "created_by": None, "type": Provider.PROVIDER_OCP, "setup_complete": False, "infrastructure": None, } provider = Provider(**provider_data) infrastructure = ProviderInfrastructureMap( infrastructure_provider=provider, infrastructure_type=infrastructure_type ) infrastructure.save() provider.infrastructure = infrastructure provider.save() self.cluster_alias = cluster_alias self.provider_uuid = provider_uuid return provider