aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests/steps/cloud/customer_create.py
blob: 1cc08794a1b08e54b1296ac2d418529eb7be36b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from onapsdk.aai.business import Customer
from onapsdk.configuration import settings
from onapsdk.exceptions import APIError

from ..base import BaseStep


class CustomerCreateStep(BaseStep):
    """Customer creation step."""

    @property
    def description(self) -> str:
        """Step description."""
        return "Create customer."

    @property
    def component(self) -> str:
        """Component name."""
        return "AAI"

    @BaseStep.store_state
    def execute(self):
        """Create cutomer.

        Use settings values:
         - GLOBAL_CUSTOMER_ID.
        """
        super().execute()
        try:
            Customer.create(settings.GLOBAL_CUSTOMER_ID, settings.GLOBAL_CUSTOMER_ID, "INFRA")
        except APIError:
            self._logger.warn("Try to update the Customer failed.")