aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests
diff options
context:
space:
mode:
Diffstat (limited to 'src/onaptests')
-rw-r--r--src/onaptests/configuration/settings.py31
-rw-r--r--src/onaptests/configuration/ubuntu16_multicloud_yaml_settings.py38
-rw-r--r--src/onaptests/configuration/ubuntu16_nomulticloud_noyaml_settings.py56
-rw-r--r--src/onaptests/steps/cloud/connect_service_subscription_to_cloud_region.py31
-rw-r--r--src/onaptests/steps/instantiate/service_ala_carte.py7
5 files changed, 129 insertions, 34 deletions
diff --git a/src/onaptests/configuration/settings.py b/src/onaptests/configuration/settings.py
index 2765415..7385fa0 100644
--- a/src/onaptests/configuration/settings.py
+++ b/src/onaptests/configuration/settings.py
@@ -38,35 +38,4 @@ LOG_CONFIG = {
}
}
-VENDOR_NAME = "sdktests_vendor"
-VSP_NAME = "sdktests_vsp"
-VSP_FILE_PATH = "vfw.zip"
-SERVICE_NAME = "sdktests-service"
-VF_NAME = "sdktests_vf"
-
-CLOUD_REGION_CLOUD_OWNER = "sdktests_cloud_region_owner"
-CLOUD_REGION_ID = "sdktests_cloud_region_id"
-CLOUD_REGION_TYPE = "openstack"
-CLOUD_REGION_VERSION = "titanium_cloud"
-CLOUD_DOMAIN = "Default"
-
-COMPLEX_PHYSICAL_LOCATION_ID = "sdktests_complex_physical_location_id"
-COMPLEX_DATA_CENTER_CODE = "sdktests_complex_data_center_code"
-
-GLOBAL_CUSTOMER_ID = "sdktests_global_customer_id"
-TENANT_ID = "" # Fill me in your custom settings
-
-VIM_USERNAME = "" # Fill me in your custom settings
-VIM_PASSWORD = "" # Fill me in your custom settings
-VIM_SERVICE_URL = "" # Fill me in your custom settings
-
-OWNING_ENTITY = "sdktests_owning_entity"
-PROJECT = "sdktests_project"
-LINE_OF_BUSINESS = "sdktests_line_of_business"
-PLATFORM = "sdktests_platform"
-
-SERVICE_INSTANCE_NAME = "sdktests_service_instance_name"
-
-SERVICE_YAML_TEMPLATE = "templates/vnf-services/ubuntu16test-service.yaml"
-
# SOCK_HTTP = "socks5h://127.0.0.1:8080"
diff --git a/src/onaptests/configuration/ubuntu16_multicloud_yaml_settings.py b/src/onaptests/configuration/ubuntu16_multicloud_yaml_settings.py
new file mode 100644
index 0000000..4b97866
--- /dev/null
+++ b/src/onaptests/configuration/ubuntu16_multicloud_yaml_settings.py
@@ -0,0 +1,38 @@
+# pylint: disable=unused-import
+from .settings import *
+
+""" Specific ubuntu16 with multicloud and yaml config scenario."""
+# pylint: disable=bad-whitespace
+
+USE_MULTICLOUD = True
+
+VENDOR_NAME = "sdktests_vendor"
+VSP_NAME = "sdktests_vsp"
+VSP_FILE_PATH = "vfw.zip"
+SERVICE_NAME = "sdktests-service"
+VF_NAME = "sdktests_vf"
+
+CLOUD_REGION_CLOUD_OWNER = "sdktests_cloud_region_owner"
+CLOUD_REGION_ID = "sdktests_cloud_region_id"
+CLOUD_REGION_TYPE = "openstack"
+CLOUD_REGION_VERSION = "titanium_cloud"
+CLOUD_DOMAIN = "Default"
+
+COMPLEX_PHYSICAL_LOCATION_ID = "sdktests_complex_physical_location_id"
+COMPLEX_DATA_CENTER_CODE = "sdktests_complex_data_center_code"
+
+GLOBAL_CUSTOMER_ID = "sdktests_global_customer_id"
+TENANT_ID = "" # Fill me in your custom settings
+
+VIM_USERNAME = "" # Fill me in your custom settings
+VIM_PASSWORD = "" # Fill me in your custom settings
+VIM_SERVICE_URL = "" # Fill me in your custom settings
+
+OWNING_ENTITY = "sdktests_owning_entity"
+PROJECT = "sdktests_project"
+LINE_OF_BUSINESS = "sdktests_line_of_business"
+PLATFORM = "sdktests_platform"
+
+SERVICE_INSTANCE_NAME = "sdktests_service_instance_name"
+
+SERVICE_YAML_TEMPLATE = "templates/vnf-services/ubuntu16test-service.yaml"
diff --git a/src/onaptests/configuration/ubuntu16_nomulticloud_noyaml_settings.py b/src/onaptests/configuration/ubuntu16_nomulticloud_noyaml_settings.py
new file mode 100644
index 0000000..52d5922
--- /dev/null
+++ b/src/onaptests/configuration/ubuntu16_nomulticloud_noyaml_settings.py
@@ -0,0 +1,56 @@
+import os
+import openstack
+
+# pylint: disable=unused-import
+from .settings import *
+
+# The ONAP part
+USE_MULTICLOUD = False
+
+VENDOR_NAME = "basicvm_vendor"
+VSP_NAME = "basicvm_ubuntu_vsp"
+SERVICE_NAME = "basicvm-ubuntu-service"
+VF_NAME = "basicvm_ubuntu_vf"
+
+CLOUD_REGION_CLOUD_OWNER = "basicvm-cloud-owner"
+CLOUD_REGION_ID = "RegionOne"
+CLOUD_REGION_TYPE = "openstack"
+CLOUD_REGION_VERSION = "openstack"
+CLOUD_DOMAIN = "Default"
+
+AVAILABILITY_ZONE_NAME = "basicvm-availability-zone"
+AVAILABILITY_ZONE_TYPE = "nova"
+COMPLEX_PHYSICAL_LOCATION_ID = "lannion"
+COMPLEX_DATA_CENTER_CODE = "1234-5"
+
+GLOBAL_CUSTOMER_ID = "basicvm-customer"
+
+OWNING_ENTITY = "basicvm-oe"
+PROJECT = "basicvm-project"
+LINE_OF_BUSINESS = "basicvm-lob"
+PLATFORM = "basicvm-platform"
+
+SERVICE_INSTANCE_NAME = "basicvm_ubuntu16_service_instance"
+
+VSP_FILE_PATH = "templates/heat_files/ubuntu16/ubuntu16.zip"
+
+# The cloud Part
+# TODO use the openstack client and assume a cloud.yaml is Provided
+# to avoid data duplication
+CLOUD_REGION_ID = "RegionOne"
+
+TEST_CLOUD = os.getenv('OS_TEST_CLOUD', 'onap-cloud-config')
+try:
+ cloud = openstack.connect(cloud=TEST_CLOUD)
+ VIM_USERNAME = cloud.config.auth['username']
+ VIM_PASSWORD = cloud.config.auth['password']
+ VIM_SERVICE_URL = cloud.config.auth['auth_url']
+ # need a keystone authent to retrieve project info
+ TENANT_ID = "" # Fill me
+ TENANT_NAME = "" # Fill me
+except ValueError:
+ TENANT_ID = "" # Fill me
+ TENANT_NAME = "" # Fill me
+ VIM_USERNAME = "" # Fill me
+ VIM_PASSWORD = "" # Fill me
+ VIM_SERVICE_URL = "" # Fill me
diff --git a/src/onaptests/steps/cloud/connect_service_subscription_to_cloud_region.py b/src/onaptests/steps/cloud/connect_service_subscription_to_cloud_region.py
index 23ba994..8b11bc1 100644
--- a/src/onaptests/steps/cloud/connect_service_subscription_to_cloud_region.py
+++ b/src/onaptests/steps/cloud/connect_service_subscription_to_cloud_region.py
@@ -36,11 +36,38 @@ class ConnectServiceSubToCloudRegionStep(BaseStep):
"""
super().execute()
- customer: Customer = Customer.get_by_global_customer_id(settings.GLOBAL_CUSTOMER_ID)
- service_subscription: ServiceSubscription = customer.get_service_subscription_by_service_type(settings.SERVICE_NAME)
+ customer: Customer = Customer.get_by_global_customer_id(
+ settings.GLOBAL_CUSTOMER_ID)
+ service_subscription: ServiceSubscription = customer.get_service_subscription_by_service_type(
+ settings.SERVICE_NAME)
cloud_region: CloudRegion = CloudRegion.get_by_id(
cloud_owner=settings.CLOUD_REGION_CLOUD_OWNER,
cloud_region_id=settings.CLOUD_REGION_ID,
)
+
+ # Retrieve the tenant
+ # if it does not exist, create it
+ try:
+ tenant: Tenant = cloud_region.get_tenant(settings.TENANT_ID)
+ except ValueError:
+ self._logger.warning("Impossible to retrieve the Specificed Tenant")
+ self._logger.debug("If no multicloud selected, add the tenant")
+ cloud_region.add_tenant(
+ tenant_id=settings.TENANT_ID,
+ tenant_name=settings.TENANT_NAME)
+
+ # be sure that an availability zone has been created
+ # if not, create it
+ try:
+ cloud_region.get_availability_zone_by_name(
+ settings.AVAILABILITY_ZONE_NAME)
+ except ValueError:
+ cloud_region.add_availability_zone(
+ settings.AVAILABILITY_ZONE_NAME,
+ settings.AVAILABILITY_ZONE_TYPE)
+
+ # retrieve tenant
+ # for which we are sure that an availability zone has been created
tenant: Tenant = cloud_region.get_tenant(settings.TENANT_ID)
+
service_subscription.link_to_cloud_region_and_tenant(cloud_region=cloud_region, tenant=tenant)
diff --git a/src/onaptests/steps/instantiate/service_ala_carte.py b/src/onaptests/steps/instantiate/service_ala_carte.py
index dad6563..011528d 100644
--- a/src/onaptests/steps/instantiate/service_ala_carte.py
+++ b/src/onaptests/steps/instantiate/service_ala_carte.py
@@ -50,7 +50,12 @@ class ServiceAlaCarteInstantiateStep(BaseStep):
cloud_region_id=settings.CLOUD_REGION_ID,
)
tenant: Tenant = cloud_region.get_tenant(settings.TENANT_ID)
- owning_entity = AaiOwningEntity.get_by_owning_entity_name(settings.OWNING_ENTITY)
+ try:
+ owning_entity = AaiOwningEntity.get_by_owning_entity_name(
+ settings.OWNING_ENTITY)
+ except ValueError:
+ self._logger.info("Owning entity not found, create it")
+ owning_entity = AaiOwningEntity.create(settings.OWNING_ENTITY)
vid_project = Project.create(settings.PROJECT)
service_instantiation = ServiceInstantiation.instantiate_so_ala_carte(