aboutsummaryrefslogtreecommitdiffstats
path: root/src/onaptests/steps/onboard/vendor.py
blob: b3761d2295e845a2772dffa0db6481b53e7601ef (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
33
34
35
36
37
38
from onapsdk.configuration import settings
from onapsdk.sdc.vendor import Vendor

from ..base import BaseStep


class VendorOnboardStep(BaseStep):
    """Vendor onboard step."""

    @property
    def description(self) -> str:
        """Step description."""
        return "Onboard vendor in SDC."

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

    @BaseStep.store_state
    def execute(self):
        """Onboard vendor.

        Use settings values:
         - VENDOR_NAME.

        """
        super().execute()
        vendor: Vendor = Vendor(name=settings.VENDOR_NAME)
        vendor.onboard()

    @BaseStep.store_state(cleanup=True)
    def cleanup(self) -> None:
        vendor: Vendor = Vendor(name=settings.VENDOR_NAME)
        if vendor.exists():
            vendor.archive()
            vendor.delete()
        super().cleanup()