aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests/steps/cloud/customer_service_subscription_create.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/onaptests/steps/cloud/customer_service_subscription_create.py')
-rw-r--r--src/onaptests/steps/cloud/customer_service_subscription_create.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/onaptests/steps/cloud/customer_service_subscription_create.py b/src/onaptests/steps/cloud/customer_service_subscription_create.py
new file mode 100644
index 0000000..c797d56
--- /dev/null
+++ b/src/onaptests/steps/cloud/customer_service_subscription_create.py
@@ -0,0 +1,30 @@
+from onapsdk.aai.business import Customer
+from onapsdk.sdc.service import Service
+from onapsdk.configuration import settings
+
+from ..base import BaseStep
+from .customer_create import CustomerCreateStep
+
+
+class CustomerServiceSubscriptionCreateStep(BaseStep):
+ """Cutomer service subsription creation step"""
+
+ def __init__(self, cleanup=False):
+ """Initialize step.
+
+ Substeps:
+ - CustomerCreateStep.
+ """
+ super().__init__(cleanup=cleanup)
+ self.add_step(CustomerCreateStep(cleanup=cleanup))
+
+ def execute(self):
+ """Create customer service subsription.
+
+ Use settings values:
+ - GLOBAL_CUSTOMER_ID,
+ - SERVICE_NAME.
+ """
+ service = Service(name=settings.SERVICE_NAME)
+ customer = Customer.get_by_global_customer_id(settings.GLOBAL_CUSTOMER_ID)
+ customer.subscribe_service(service)