diff options
author | Michal Jagiello <michal.jagiello@t-mobile.pl> | 2022-01-27 08:31:36 +0000 |
---|---|---|
committer | Michal Jagiello <michal.jagiello@t-mobile.pl> | 2022-01-27 08:31:36 +0000 |
commit | b1112188466a5712cd41f1a88b5f4bcf31949d15 (patch) | |
tree | 6ad033eb9c9ceb6a768d3a8082bcb8f36dec8b9a /onap_data_provider | |
parent | 4ffd0d95b7a875372447d6193a978bd451adb7ae (diff) |
Add xNFs category and subcategory
Issue-ID: INT-2054
Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl>
Change-Id: Iae6e95e882570740d7fe761ad673511a346c9c57
Diffstat (limited to 'onap_data_provider')
-rw-r--r-- | onap_data_provider/resources/pnf_resource.py | 2 | ||||
-rw-r--r-- | onap_data_provider/resources/vnf_resource.py | 5 | ||||
-rw-r--r-- | onap_data_provider/schemas/infra_1_1.schema | 12 |
3 files changed, 17 insertions, 2 deletions
diff --git a/onap_data_provider/resources/pnf_resource.py b/onap_data_provider/resources/pnf_resource.py index 553018b..1a02052 100644 --- a/onap_data_provider/resources/pnf_resource.py +++ b/onap_data_provider/resources/pnf_resource.py @@ -47,7 +47,7 @@ class PnfResource(Resource, XnfResource): """ if not self.exists: logging.debug("Create Pnf %s", self.data["name"]) - self._xnf = Pnf(self.data["name"]) + self._xnf = Pnf(self.data["name"], category=self.data.get("category"), subcategory=self.data.get("subcategory")) if (vendor_name := self.data.get("vendor")) is not None: self._xnf.vendor = Vendor(vendor_name) self.onboard_resource_with_properties(self.data) diff --git a/onap_data_provider/resources/vnf_resource.py b/onap_data_provider/resources/vnf_resource.py index 1d47413..9c77f19 100644 --- a/onap_data_provider/resources/vnf_resource.py +++ b/onap_data_provider/resources/vnf_resource.py @@ -18,6 +18,7 @@ import logging from typing import Any, Dict +from onapsdk.sdc.vendor import Vendor # type: ignore from onapsdk.sdc.vf import Vf # type: ignore from .resource import Resource from .xnf_resource import XnfResource @@ -46,7 +47,9 @@ class VnfResource(Resource, XnfResource): """ if not self.exists: logging.debug("Create Vnf %s", self.data["name"]) - self._xnf = Vf(name=self.data["name"]) + self._xnf = Vf(name=self.data["name"], category=self.data.get("category"), subcategory=self.data.get("subcategory")) + if (vendor_name := self.data.get("vendor")) is not None: + self._xnf._vendor = Vendor(vendor_name) self.onboard_resource_with_properties(self.data) @property diff --git a/onap_data_provider/schemas/infra_1_1.schema b/onap_data_provider/schemas/infra_1_1.schema index eac5dcb..124a00e 100644 --- a/onap_data_provider/schemas/infra_1_1.schema +++ b/onap_data_provider/schemas/infra_1_1.schema @@ -281,6 +281,12 @@ properties: type: string vsp: type: string + category: + type: string + subcategory: + type: string + vendor: + type: string deployment_artifact: type: object properties: @@ -327,6 +333,12 @@ properties: type: string vsp: type: string + category: + type: string + subcategory: + type: string + vendor: + type: string deployment_artifact: type: object properties: |