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 | |
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
-rw-r--r-- | docs/source/schemas/version_1_1.rst | 20 | ||||
-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 | ||||
-rw-r--r-- | samples/xnfs.yaml | 5 |
5 files changed, 42 insertions, 2 deletions
diff --git a/docs/source/schemas/version_1_1.rst b/docs/source/schemas/version_1_1.rst index ee0db96..cb78222 100644 --- a/docs/source/schemas/version_1_1.rst +++ b/docs/source/schemas/version_1_1.rst @@ -190,6 +190,14 @@ PNF - string - NO - + * - category + - string + - NO + - + * - subcategory + - string + - NO + - * - deployment_artifact - `PNF deployment artifact 1.1`_ - NO @@ -221,10 +229,22 @@ VNF - string - YES - + * - vendor + - string + - NO + - * - vsp - string - NO - + * - category + - string + - NO + - + * - subcategory + - string + - NO + - * - deployment_artifact - `VNF deployment artifact 1.1`_ - NO 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: diff --git a/samples/xnfs.yaml b/samples/xnfs.yaml index 35f3024..81f344b 100644 --- a/samples/xnfs.yaml +++ b/samples/xnfs.yaml @@ -20,6 +20,11 @@ resources: artifact_name: BASIC_VM_enriched.zip artifact_label: vfwcds artifact_file_name: BASIC_VM_enriched.zip + - vnf: + name: allotted-resource-vf + vendor: sample-vendor # Make sure it exists! + category: Allotted Resource + subcategory: Allotted Resource pnfs: - pnf: |