Revert "Revert "Create basic_cnf test leveraging onapsdk""
[testsuite/pythonsdk-tests.git] / src / onaptests / configuration / basic_cnf_yaml_settings.py
1 import os
2 import openstack
3 import sys
4 from yaml import load
5
6 import onaptests.utils.exceptions as onap_test_exceptions
7 from .settings import * # pylint: disable=W0614
8
9 """ Specific basic_cnf with multicloud-k8s and yaml config scenario."""
10
11 # This scenario uses multicloud-k8s and not multicloud
12 # (no registration requested)
13 USE_MULTICLOUD = False
14 # Set ONLY_INSTANTIATE to true to run an instantiation without repeating
15 # onboarding and related AAI configuration (Cloud config)
16 ONLY_INSTANTIATE= False
17
18 # if a yaml file is define, retrieve info from this yaml files
19 # if not declare the parameters in the settings
20 SERVICE_YAML_TEMPLATE = (sys.path[-1] + "/onaptests/templates/vnf-services/" +
21                          "basic_cnf-service.yaml")
22
23 try:
24     # Try to retrieve the SERVICE NAME from the yaml file
25     with open(SERVICE_YAML_TEMPLATE, "r") as yaml_template:
26         yaml_config_file = load(yaml_template)
27         SERVICE_NAME = next(iter(yaml_config_file.keys()))
28 except (FileNotFoundError, ValueError):
29     raise onap_test_exceptions.TestConfigurationException
30
31 CLEANUP_FLAG = True
32 # nb of seconds before cleanup in case cleanup option is set
33 CLEANUP_ACTIVITY_TIMER = 10
34
35 # Definition of k8s profile version
36 K8S_PROFILE_K8S_VERSION = "1.0"
37 # Relative path to k8s profile artifact in the python package (so under /src)
38 K8S_PROFILE_ARTIFACT_PATH = (sys.path[-1] +
39                              "/onaptests/templates/artifacts/k8sprof.tar.gz")
40 # Relative path to config file to set k8s connectivity information
41 K8S_KUBECONFIG_FILE = (sys.path[-1] +
42                        "/onaptests/templates/artifacts/config")
43
44 VENDOR_NAME = "basicnf_vendor"
45
46 CLOUD_REGION_CLOUD_OWNER = "basicnf-owner" # must not contain _
47 CLOUD_REGION_ID = "k8sregion"
48 CLOUD_REGION_TYPE = "k8s"
49 CLOUD_REGION_VERSION = "1.0"
50 CLOUD_DOMAIN = "Default"
51 CLOUD_OWNER_DEFINED_TYPE = "t1"
52
53 COMPLEX_PHYSICAL_LOCATION_ID = "lannion"
54 COMPLEX_DATA_CENTER_CODE = "1234-5"
55 AVAILABILITY_ZONE_NAME = "basicnf-availability-zone"
56 AVAILABILITY_ZONE_TYPE = "nova"
57
58 GLOBAL_CUSTOMER_ID = "basicnf-customer"
59
60 OWNING_ENTITY = "basicnf_owning_entity"
61 PROJECT = "basicnf_project"
62 LINE_OF_BUSINESS = "basicnf_lob"
63 PLATFORM = "basicnf_platform"
64
65 SERVICE_INSTANCE_NAME = "basic_cnf_service_instance"
66
67 # The cloud Part
68 # Assuming a cloud.yaml is available, use the openstack client
69 # to retrieve cloud info and avoid data duplication
70 # For basic_cnf, no tenant information is required but some dummy
71 # information shall be provided by default
72 # So it is not requested to set OS_TEST_CLOUD
73 TEST_CLOUD = os.getenv('OS_TEST_CLOUD')
74 cloud = openstack.connect(cloud=TEST_CLOUD)
75 VIM_USERNAME = cloud.config.auth.get('username','dummy')
76 VIM_PASSWORD = cloud.config.auth.get('password','dummy123')
77 VIM_SERVICE_URL = cloud.config.auth.get('auth_url','http://10.12.25.2:5000/v3')
78 TENANT_ID = cloud.config.auth.get('project_id','123456')
79 TENANT_NAME = cloud.config.auth.get('project_name','dummy_test')