aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests/steps/cloud/cloud_region_create.py
diff options
context:
space:
mode:
authorMichal Jagiello <michal.jagiello@t-mobile.pl>2021-01-25 12:00:25 +0000
committerMichal Jagiello <michal.jagiello@t-mobile.pl>2021-01-25 14:40:39 +0000
commit5021508f4b6f8bf2bb6ef890b4bb960dc144484b (patch)
tree2451b62511bb2de23d0515684bf6555717100321 /src/onaptests/steps/cloud/cloud_region_create.py
parent511400315961caba0aa7b96d1ecf6aa2c912b4c4 (diff)
PNF simulator CNF instantiation and registation steps
Use CNF of PNF simulator in pnf_macro scenario Issue-ID: INT-1822 Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl> Change-Id: Id7f70b45219a36b7fc70921a1438b0cbe57a1756
Diffstat (limited to 'src/onaptests/steps/cloud/cloud_region_create.py')
-rw-r--r--src/onaptests/steps/cloud/cloud_region_create.py51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/onaptests/steps/cloud/cloud_region_create.py b/src/onaptests/steps/cloud/cloud_region_create.py
new file mode 100644
index 0000000..ba46466
--- /dev/null
+++ b/src/onaptests/steps/cloud/cloud_region_create.py
@@ -0,0 +1,51 @@
+"""A&AI cloud region creation module."""
+from onapsdk.aai.cloud_infrastructure import CloudRegion
+from onapsdk.configuration import settings
+
+from ..base import BaseStep
+
+
+class CloudRegionCreateStep(BaseStep):
+ """Cloud region creation step."""
+
+ @property
+ def description(self) -> str:
+ """Step description."""
+ return "Create cloud region."
+
+ @property
+ def component(self) -> str:
+ """Component name."""
+ return "AAI"
+
+ @BaseStep.store_state
+ def execute(self):
+ """Create cloud region.
+
+ Use settings values:
+ - CLOUD_REGION_CLOUD_OWNER,
+ - CLOUD_REGION_ID,
+ - CLOUD_REGION_TYPE,
+ - CLOUD_REGION_VERSION,
+ - CLOUD_OWNER_DEFINED_TYPE,
+ - COMPLEX_PHYSICAL_LOCATION_ID.
+
+ """
+ super().execute()
+ self._logger.info("*Check if cloud region exists *")
+ try:
+ CloudRegion.get_by_id(
+ cloud_owner=settings.CLOUD_REGION_CLOUD_OWNER,
+ cloud_region_id=settings.CLOUD_REGION_ID,
+ )
+ except ValueError:
+ CloudRegion.create(
+ cloud_owner=settings.CLOUD_REGION_CLOUD_OWNER,
+ cloud_region_id=settings.CLOUD_REGION_ID,
+ orchestration_disabled=False,
+ in_maint=False,
+ cloud_type=settings.CLOUD_REGION_TYPE,
+ cloud_region_version=settings.CLOUD_REGION_VERSION,
+ owner_defined_type=settings.CLOUD_OWNER_DEFINED_TYPE,
+ complex_name=settings.COMPLEX_PHYSICAL_LOCATION_ID
+ )