aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--onap_data_provider/resources/sdc_properties_mixins.py109
-rw-r--r--onap_data_provider/resources/service_resource.py36
-rw-r--r--onap_data_provider/resources/xnf_resource.py14
-rw-r--r--onap_data_provider/schemas/infra.schema888
-rw-r--r--onap_data_provider/schemas/infra_1_1.schema907
-rw-r--r--tests/test_service_resource.py8
-rw-r--r--tests/test_validator.py31
7 files changed, 1059 insertions, 934 deletions
diff --git a/onap_data_provider/resources/sdc_properties_mixins.py b/onap_data_provider/resources/sdc_properties_mixins.py
new file mode 100644
index 0000000..9a2b625
--- /dev/null
+++ b/onap_data_provider/resources/sdc_properties_mixins.py
@@ -0,0 +1,109 @@
+"""SDC properties mixins module."""
+"""
+ Copyright 2021 Deutsche Telekom AG
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+"""
+from typing import Any, List, Union
+
+from onapsdk.exceptions import SDKException, ValidationError, ParameterError # type: ignore
+from onapsdk.sdc.component import Component # type: ignore
+from onapsdk.sdc.properties import Property # type: ignore
+from onapsdk.sdc.sdc_resource import SdcResource # type: ignore
+
+
+class SdcPropertiesMixins:
+ """Mixins class for properties handling.
+
+ Mixin class for propoerties preparation for SdcResources and Components.
+ """
+
+ def set_properties(
+ self, propresource: Union[SdcResource, Component], data: List[Any]
+ ) -> None:
+ """Set properties an SdcResource.
+
+ Args:
+ sdcresource (SdcResource): the SdcResource the properties should belong to
+ data (Dict[List, Any]): Data needed to create resource.
+
+ Raises ValidationError
+ """
+ for property_data in data:
+
+ if any(
+ (prop.name == property_data["name"] for prop in propresource.properties)
+ ):
+ prop = propresource.get_property(property_data["name"])
+ prop.value = property_data.get("value")
+ else:
+ proptype = property_data.get("type")
+ if proptype is None:
+ raise ValidationError(
+ f"New Property '{str(property_data['name'])}' is missing a type!"
+ )
+
+ property = Property(
+ name=property_data["name"],
+ property_type=proptype,
+ value=property_data.get("value"),
+ )
+ try:
+ propresource.add_property(property)
+ except SDKException:
+ raise ParameterError(
+ f"Creation of new property '{str(property_data['name'])}' "
+ f"for resourceclass '{str(propresource.__class__.__name__)}' is not provided yet!"
+ )
+
+ def set_inputs(
+ self, propresource: Union[SdcResource, Component], data: List[Any]
+ ) -> None:
+ """Set inputs of an SdcResource.
+
+ Args:
+ sdcresource (SdcResource): the SdcResource the inputs should belong to
+ data (Dict[str, Any]): Data needed to create resource.
+
+ Raises ValidationError
+ """
+ for property_data in data:
+
+ if any(
+ (prop.name == property_data["name"] for prop in propresource.inputs)
+ ):
+ propresource.set_input_default_value(
+ propresource.get_input(property_data["name"]),
+ property_data.get("value"),
+ )
+ else:
+ proptype = property_data.get("type")
+ if proptype is None:
+ raise ValidationError(
+ "New input '{0}' is missing a type!".format(
+ str(property_data["name"])
+ )
+ )
+
+ property = Property(
+ name=property_data["name"],
+ property_type=proptype,
+ value=property_data.get("value"),
+ )
+ try:
+ propresource.add_property(property)
+ propresource.declare_input(property)
+ except SDKException:
+ raise ParameterError(
+ f"Creation of new input '{str(property_data['name'])}' is not provided yet!"
+ )
diff --git a/onap_data_provider/resources/service_resource.py b/onap_data_provider/resources/service_resource.py
index 8489982..ab05bde 100644
--- a/onap_data_provider/resources/service_resource.py
+++ b/onap_data_provider/resources/service_resource.py
@@ -14,26 +14,22 @@
See the License for the specific language governing permissions and
limitations under the License.
"""
-from typing import Any, Dict, Mapping, Optional, Type
+from typing import Any, Dict, List, Mapping, Optional, Type
from onapsdk.sdc.pnf import Pnf # type: ignore
-from onapsdk.sdc.properties import Property # type: ignore
from onapsdk.sdc.sdc_resource import SdcResource # type: ignore
from onapsdk.sdc.service import Service, ServiceInstantiationType # type: ignore
from onapsdk.sdc.vf import Vf # type: ignore
from onapsdk.sdc.vl import Vl # type: ignore
from .resource import Resource
+from .sdc_properties_mixins import SdcPropertiesMixins
-class ServiceResource(Resource):
+class ServiceResource(Resource, SdcPropertiesMixins):
"""Service resource class."""
- RESOURCES: Mapping[str, Type[SdcResource]] = {
- "PNF": Pnf,
- "VF": Vf,
- "VL": Vl,
- }
+ RESOURCES: Mapping[str, Type[SdcResource]] = {"PNF": Pnf, "VF": Vf, "VL": Vl}
def __init__(self, data: Dict[str, Any]) -> None:
"""Initialize Service resource.
@@ -59,17 +55,19 @@ class ServiceResource(Resource):
)
service.add_resource(resource)
component = service.get_component(resource)
- for prop_key, prop_value in resource_data.get("properties", {}).items():
- prop = component.get_property(prop_key)
- prop.value = prop_value
- for property_data in self.data.get("properties", []):
- service.add_property(
- Property(
- property_data["name"],
- property_data["type"],
- value=property_data.get("value"),
- )
- )
+ properties_data = resource_data.get("properties", [])
+ if properties_data and isinstance(properties_data, List):
+ self.set_properties(component, properties_data)
+ else:
+ # backward compatibility
+ for prop_key, prop_value in resource_data.get(
+ "properties", {}
+ ).items():
+ prop = component.get_property(prop_key)
+ prop.value = prop_value
+ self.set_inputs(component, resource_data.get("inputs", []))
+ self.set_properties(service, self.data.get("properties", []))
+ self.set_inputs(service, self.data.get("inputs", []))
service.checkin()
service.onboard()
self._service = service
diff --git a/onap_data_provider/resources/xnf_resource.py b/onap_data_provider/resources/xnf_resource.py
index cada088..efede03 100644
--- a/onap_data_provider/resources/xnf_resource.py
+++ b/onap_data_provider/resources/xnf_resource.py
@@ -21,8 +21,10 @@ from onapsdk.sdc.vsp import Vsp # type: ignore
from onapsdk.sdc.sdc_resource import SdcResource # type: ignore
from onapsdk.sdc.properties import Property # type: ignore
+from .sdc_properties_mixins import SdcPropertiesMixins
-class XnfResource(ABC):
+
+class XnfResource(ABC, SdcPropertiesMixins):
"""Xnf resource class.
Network function base class.
@@ -49,12 +51,6 @@ class XnfResource(ABC):
artifact_label=data["deployment_artifact"]["artifact_label"],
artifact=data["deployment_artifact"]["artifact_file_name"],
)
- for property_data in data.get("properties", []):
- self._xnf.add_property(
- Property(
- name=property_data["name"],
- property_type=property_data["type"],
- value=property_data.get("value"),
- )
- )
+ self.set_properties(self._xnf, data.get("properties", []))
+ self.set_inputs(self._xnf, data.get("inputs", []))
self._xnf.onboard()
diff --git a/onap_data_provider/schemas/infra.schema b/onap_data_provider/schemas/infra.schema
index 61e7bf2..55c5cbf 100644
--- a/onap_data_provider/schemas/infra.schema
+++ b/onap_data_provider/schemas/infra.schema
@@ -22,512 +22,506 @@ properties:
complexes:
type: array
items:
- - type: object
- properties:
- complex:
- type: object
- properties:
- physical-location-id:
- type: string
- complex-name:
- type: string
- data-center-code:
- type: string
- identity-url:
- type: string
- physical-location-type:
- type: string
- street1:
- type: string
- street2:
- type: string
- city:
- type: string
- state:
- type: string
- postal-code:
- type: string
- country:
- type: string
- region:
- type: string
- latitude:
- type: string
- longitude:
- type: string
- elevation:
- type: string
- lata:
- type: string
- required:
- - physical-location-id
- required:
- - complex
+ type: object
+ properties:
+ complex:
+ type: object
+ properties:
+ physical-location-id:
+ type: string
+ complex-name:
+ type: string
+ data-center-code:
+ type: string
+ identity-url:
+ type: string
+ physical-location-type:
+ type: string
+ street1:
+ type: string
+ street2:
+ type: string
+ city:
+ type: string
+ state:
+ type: string
+ postal-code:
+ type: string
+ country:
+ type: string
+ region:
+ type: string
+ latitude:
+ type: string
+ longitude:
+ type: string
+ elevation:
+ type: string
+ lata:
+ type: string
+ required:
+ - physical-location-id
+ required:
+ - complex
cloud-regions:
type: array
items:
- - type: object
- properties:
- cloud-region:
- type: object
- properties:
- cloud-owner:
- type: string
- cloud-region-id:
- type: string
- orchestration-disabled:
- type: boolean
- in-maint:
- type: boolean
- cloud-type:
- type: string
- kube-config:
- type: string
- tenants:
- type: array
- items:
- - type: object
- properties:
- tenant-id:
- type: string
- tenant-name:
- type: string
- tenant-context:
- type: string
- required:
- - tenant-id
- - tenant-name
- esr-system-infos:
- type: array
- items:
- - type: object
- properties:
- esr-system-info-id:
- type: string
- user-name:
- type: string
- password:
- type: string
- system-type:
- type: string
- service-url:
- type: string
- cloud-domain:
- type: string
- default-tenant:
- type: string
- required:
- - esr-system-info-id
- - user-name
- - password
- - system-type
- - service-url
- - cloud-domain
- complex:
+ type: object
+ properties:
+ cloud-region:
+ type: object
+ properties:
+ cloud-owner:
+ type: string
+ cloud-region-id:
+ type: string
+ orchestration-disabled:
+ type: boolean
+ in-maint:
+ type: boolean
+ tenants:
+ type: array
+ items:
type: object
properties:
- physical-location-id:
+ tenant-id:
+ type: string
+ tenant-name:
+ type: string
+ tenant-context:
type: string
required:
- - physical-location-id
- availability-zones:
- type: array
- items:
- - type: object
- properties:
- availability-zone-name:
- type: string
- hypervisor-type:
- type: string
- required:
- - availability-zone-name
- - hypervisor-type
- required:
- - cloud-owner
- - cloud-region-id
- - orchestration-disabled
- - in-maint
- required:
- - cloud-region
+ - tenant-id
+ - tenant-name
+ esr-system-infos:
+ type: array
+ items:
+ type: object
+ properties:
+ esr-system-info-id:
+ type: string
+ user-name:
+ type: string
+ password:
+ type: string
+ system-type:
+ type: string
+ service-url:
+ type: string
+ cloud-domain:
+ type: string
+ default-tenant:
+ type: string
+ required:
+ - esr-system-info-id
+ - user-name
+ - password
+ - system-type
+ - service-url
+ - cloud-domain
+ complex:
+ type: object
+ properties:
+ physical-location-id:
+ type: string
+ required:
+ - physical-location-id
+ availability-zones:
+ type: array
+ items:
+ type: object
+ properties:
+ availability-zone-name:
+ type: string
+ hypervisor-type:
+ type: string
+ required:
+ - availability-zone-name
+ - hypervisor-type
+ required:
+ - cloud-owner
+ - cloud-region-id
+ - orchestration-disabled
+ - in-maint
+ required:
+ - cloud-region
customers:
type: array
items:
- - type: object
- properties:
- customer:
- type: object
- properties:
- global-customer-id:
- type: string
- subscriber-name:
- type: string
- subscriber-type:
- type: string
- service-subscriptions:
- type: array
- items:
- - type: object
- properties:
- service-type:
- type: string
- tenants:
- type: array
- items:
- - type: object
- properities:
- tenant-id:
- type: string
- cloud-owner:
- type: string
- cloud-region-id:
- type: string
- required:
- - tenant-id
- - cloud-owner
- - cloud-region-id
- required:
- - service-type
- required:
- - global-customer-id
- - subscriber-name
- - subscriber-type
- required:
- - customer
+ type: object
+ properties:
+ customer:
+ type: object
+ properties:
+ global-customer-id:
+ type: string
+ subscriber-name:
+ type: string
+ subscriber-type:
+ type: string
+ service-subscriptions:
+ type: array
+ items:
+ type: object
+ properties:
+ service-type:
+ type: string
+ tenants:
+ type: array
+ items:
+ type: object
+ properities:
+ tenant-id:
+ type: string
+ cloud-owner:
+ type: string
+ cloud-region-id:
+ type: string
+ required:
+ - tenant-id
+ - cloud-owner
+ - cloud-region-id
+ required:
+ - service-type
+ required:
+ - global-customer-id
+ - subscriber-name
+ - subscriber-type
+ required:
+ - customer
vendors:
type: array
items:
- - type: object
- properties:
- vendor:
- type: object
- properties:
- name:
- type: string
- required:
- - name
- required:
- - vendor
+ type: object
+ properties:
+ vendor:
+ type: object
+ properties:
+ name:
+ type: string
+ required:
+ - name
+ required:
+ - vendor
vsps:
type: array
items:
- - type: object
+ type: object
+ properties:
+ vsp:
+ type: object
+ properties:
+ name:
+ type: string
+ vendor:
+ type: string
+ package:
+ type: string
+ required:
+ - name
+ - vendor
+ - package
+ required:
+ - vsp
+ services:
+ type: array
+ items:
+ type: object
+ properties:
+ service:
+ type: object
+ properties:
+ name:
+ type: string
+ resources:
+ type: array
+ items:
+ type: object
+ properties:
+ name:
+ type: string
+ type:
+ type: string
+ properties: # Adding a prop to a component is senseless.
+ type: array
+ items:
+ type: object
+ properties:
+ name:
+ type: string
+ value:
+ type:
+ - string
+ - number
+ - boolean
+ required:
+ - name
+ - value
+ required:
+ - name
+ - type
+ properties: &props
+ type: array
+ items:
+ type: object
+ properties:
+ name:
+ type: string
+ type:
+ type: string
+ value:
+ type:
+ - string
+ - number
+ - boolean
+ anyOf:
+ - required:
+ - name
+ - type
+ - required:
+ - name
+ - value
+ inputs: *props
+ required:
+ - name
+ required:
+ - service
+ pnfs:
+ type: array
+ items:
+ type: object
properties:
- vsp:
+ pnf:
type: object
properties:
name:
type: string
vendor:
type: string
- package:
+ vsp:
type: string
+ deployment_artifact:
+ type: object
+ properties:
+ artifact_type:
+ type: string
+ artifact_name:
+ type: string
+ artifact_label:
+ type: string
+ artifact_file_name:
+ type: string
+ required:
+ - artifact_type
+ - artifact_name
+ - artifact_label
+ - artifact_file_name
+ properties: *props
+ inputs: *props
required:
- name
- - vendor
- - package
required:
- - vsp
- services:
- type: array
- items:
- - type: object
+ - pnf
+ vnfs:
+ type: array
+ items:
+ type: object
properties:
- service:
+ vnf:
type: object
properties:
name:
type: string
- resources:
- type: array
- items:
- - type: object
- properties:
- name:
- type: string
- type:
- type: string
- required:
- - name
- - type
- properties:
- type: array
- items:
- - type: object
- properties:
- name:
- type: string
- type:
- type: string
- value:
- type: string
- required:
- - name
- - type
+ vsp:
+ type: string
+ deployment_artifact:
+ type: object
+ properties:
+ artifact_type:
+ type: string
+ artifact_name:
+ type: string
+ artifact_label:
+ type: string
+ artifact_file_name:
+ type: string
+ required:
+ - artifact_type
+ - artifact_name
+ - artifact_label
+ - artifact_file_name
+ properties: *props
+ inputs: *props
required:
- name
required:
- - service
- pnfs:
+ - vnf
+ service-instances:
type: array
items:
- - type: object
- properties:
- pnf:
- type: object
- properties:
- name:
- type: string
- vendor:
- type: string
- vsp:
- type: string
- deployment_artifact:
+ type: object
+ properties:
+ service-instance:
+ type: object
+ properties:
+ service_instance_name:
+ type: string
+ service_name:
+ type: string
+ cloud_region:
+ type: string
+ customer_id:
+ type: string
+ owning_entity:
+ type: string
+ project:
+ type: string
+ platform:
+ type: string
+ line_of_business:
+ type: string
+ cloud_region_id:
+ type: string
+ cloud_owner:
+ type: string
+ timeout:
+ type: number
+ minimum: 1
+ maximum: 99999
+ aai_service:
+ type: string
+ service_subscription_type:
+ type: string
+ instantiation_parameters:
+ type: array
+ items:
type: object
properties:
- artifact_type:
+ vnf_name:
type: string
- artifact_name:
+ sec_group:
type: string
- artifact_label:
+ public_net_id:
type: string
- artifact_file_name:
+ onap_private_net_id:
type: string
- required:
- - artifact_type
- - artifact_name
- - artifact_label
- - artifact_file_name
- properties:
- type: array
- items:
- - type: object
- properties:
- name:
- type: string
- type:
- type: string
- value:
- type: string
- required:
- - name
- - type
- required:
- - name
- required:
- - pnf
- vnfs:
- type: array
- items:
- - type: object
- properties:
- vnf:
- type: object
- properties:
- name:
- type: string
- vsp:
- type: string
- deployment_artifact:
- type: object
- properties:
- artifact_type:
+ onap_private_subnet_id:
type: string
- artifact_name:
+ image_name:
type: string
- artifact_label:
+ flavor_name:
type: string
- artifact_file_name:
+ install_script_version:
type: string
- required:
- - artifact_type
- - artifact_name
- - artifact_label
- - artifact_file_name
- properties:
- type: array
- items:
- - type: object
- properties:
- name:
- type: string
- type:
- type: string
- value:
- type: string
- required:
- - name
- - type
- required:
- - name
- required:
- - vnf
- service-instances:
- type: array
- items:
- - type: object
- properties:
- service-instance:
- type: object
- properties:
- service_instance_name:
- type: string
- service_name:
- type: string
- cloud_region:
- type: string
- customer_id:
- type: string
- owning_entity:
- type: string
- project:
- type: string
- platform:
- type: string
- line_of_business:
- type: string
- cloud_region_id:
- type: string
- cloud_owner:
- type: string
- timeout:
- type: number
- minimum: 1
- maximum: 99999
- aai_service:
- type: string
- service_subscription_type:
- type: string
- instantiation_parameters:
- type: array
- items:
- - type: object
- properties:
- vnf_name:
- type: string
- sec_group:
- type: string
- public_net_id:
- type: string
- onap_private_net_id:
- type: string
- onap_private_subnet_id:
- type: string
- image_name:
- type: string
- flavor_name:
- type: string
- install_script_version:
- type: string
- demo_artifacts_version:
- type: string
- cloud_env:
- type: string
- aic-cloud-region:
- type: string
- pub_key:
- type: string
- required:
- - service_instance_name
- - service_name
- - cloud_region
- - customer_id
- - owning_entity
- - project
- - platform
- - line_of_business
- - cloud_region_id
- - cloud_owner
- - instantiation_parameters
+ demo_artifacts_version:
+ type: string
+ cloud_env:
+ type: string
+ aic-cloud-region:
+ type: string
+ pub_key:
+ type: string
+ required:
+ - service_instance_name
+ - service_name
+ - cloud_region
+ - customer_id
+ - owning_entity
+ - project
+ - platform
+ - line_of_business
+ - cloud_region_id
+ - cloud_owner
owning-entities:
type: array
items:
- - type: object
- properities:
- owning-entity:
- type: object
- properties:
- name:
- type: string
- required:
- - name
- required:
- - owning-entity
+ type: object
+ properities:
+ owning-entity:
+ type: object
+ properties:
+ name:
+ type: string
+ required:
+ - name
+ required:
+ - owning-entity
projects:
type: array
items:
- - type: object
- properties:
- project:
- type: object
- properities:
- name:
- type: string
- required:
- - name
- required:
- - project
+ type: object
+ properties:
+ project:
+ type: object
+ properities:
+ name:
+ type: string
+ required:
+ - name
+ required:
+ - project
platforms:
type: array
items:
- - type: object
- properities:
- platform:
- type: object
- properities:
- name:
- type: string
- required:
- - name
- required:
- - platform
+ type: object
+ properities:
+ platform:
+ type: object
+ properities:
+ name:
+ type: string
+ required:
+ - name
+ required:
+ - platform
lines-of-business:
type: array
items:
- - type: object
- properties:
- line-of-business:
- type: object
- properities:
- name:
- type: string
- required:
- - name
- required:
- - line-of-business
+ type: object
+ properties:
+ line-of-business:
+ type: object
+ properities:
+ name:
+ type: string
+ required:
+ - name
+ required:
+ - line-of-business
msb-k8s-definitions:
type: array
items:
- type: object
- properties:
- name:
- type: string
- version:
- type: string
- chart-name:
- type: string
- description:
- type: string
- artifact:
- type: string
- profiles:
- type: array
- items:
- - type: object
- properties:
- name:
- type: string
- namespace:
- type: string
- k8s-version:
- type: string
- artifact:
- type: string
- required:
- - name
- - namespace
- - k8s-version
- - artifact
- required:
- - name
- - version
- - artifact
+ type: object
+ properties:
+ name:
+ type: string
+ version:
+ type: string
+ chart-name:
+ type: string
+ description:
+ type: string
+ artifact:
+ type: string
+ profiles:
+ type: array
+ items:
+ - type: object
+ properties:
+ name:
+ type: string
+ namespace:
+ type: string
+ k8s-version:
+ type: string
+ artifact:
+ type: string
+ required:
+ - name
+ - namespace
+ - k8s-version
+ - artifact
+ required:
+ - name
+ - version
+ - artifact
diff --git a/onap_data_provider/schemas/infra_1_1.schema b/onap_data_provider/schemas/infra_1_1.schema
index 124a00e..7175ec5 100644
--- a/onap_data_provider/schemas/infra_1_1.schema
+++ b/onap_data_provider/schemas/infra_1_1.schema
@@ -22,521 +22,516 @@ properties:
complexes:
type: array
items:
- - type: object
- properties:
- complex:
- type: object
- properties:
- physical-location-id:
- type: string
- complex-name:
- type: string
- data-center-code:
- type: string
- identity-url:
- type: string
- physical-location-type:
- type: string
- street1:
- type: string
- street2:
- type: string
- city:
- type: string
- state:
- type: string
- postal-code:
- type: string
- country:
- type: string
- region:
- type: string
- latitude:
- type: string
- longitude:
- type: string
- elevation:
- type: string
- lata:
- type: string
- required:
- - physical-location-id
- required:
- - complex
+ type: object
+ properties:
+ complex:
+ type: object
+ properties:
+ physical-location-id:
+ type: string
+ complex-name:
+ type: string
+ data-center-code:
+ type: string
+ identity-url:
+ type: string
+ physical-location-type:
+ type: string
+ street1:
+ type: string
+ street2:
+ type: string
+ city:
+ type: string
+ state:
+ type: string
+ postal-code:
+ type: string
+ country:
+ type: string
+ region:
+ type: string
+ latitude:
+ type: string
+ longitude:
+ type: string
+ elevation:
+ type: string
+ lata:
+ type: string
+ required:
+ - physical-location-id
+ required:
+ - complex
cloud-regions:
type: array
items:
- - type: object
- properties:
- cloud-region:
- type: object
- properties:
- cloud-owner:
- type: string
- cloud-region-id:
- type: string
- orchestration-disabled:
- type: boolean
- in-maint:
- type: boolean
- cloud-type:
- type: string
- kube-config:
- type: string
- tenants:
- type: array
- items:
- - type: object
- properties:
- tenant-id:
- type: string
- tenant-name:
- type: string
- tenant-context:
- type: string
- required:
- - tenant-id
- - tenant-name
- esr-system-infos:
- type: array
- items:
- - type: object
- properties:
- esr-system-info-id:
- type: string
- user-name:
- type: string
- password:
- type: string
- system-type:
- type: string
- service-url:
- type: string
- cloud-domain:
- type: string
- default-tenant:
- type: string
- required:
- - esr-system-info-id
- - user-name
- - password
- - system-type
- - service-url
- - cloud-domain
- complex:
+ type: object
+ properties:
+ cloud-region:
+ type: object
+ properties:
+ cloud-owner:
+ type: string
+ cloud-region-id:
+ type: string
+ orchestration-disabled:
+ type: boolean
+ in-maint:
+ type: boolean
+ tenants:
+ type: array
+ items:
type: object
properties:
- physical-location-id:
+ tenant-id:
+ type: string
+ tenant-name:
+ type: string
+ tenant-context:
type: string
required:
- - physical-location-id
- availability-zones:
- type: array
- items:
- - type: object
- properties:
- availability-zone-name:
- type: string
- hypervisor-type:
- type: string
- required:
- - availability-zone-name
- - hypervisor-type
- required:
- - cloud-owner
- - cloud-region-id
- - orchestration-disabled
- - in-maint
- required:
- - cloud-region
+ - tenant-id
+ - tenant-name
+ esr-system-infos:
+ type: array
+ items:
+ type: object
+ properties:
+ esr-system-info-id:
+ type: string
+ user-name:
+ type: string
+ password:
+ type: string
+ system-type:
+ type: string
+ service-url:
+ type: string
+ cloud-domain:
+ type: string
+ default-tenant:
+ type: string
+ required:
+ - esr-system-info-id
+ - user-name
+ - password
+ - system-type
+ - service-url
+ - cloud-domain
+ complex:
+ type: object
+ properties:
+ physical-location-id:
+ type: string
+ required:
+ - physical-location-id
+ availability-zones:
+ type: array
+ items:
+ type: object
+ properties:
+ availability-zone-name:
+ type: string
+ hypervisor-type:
+ type: string
+ required:
+ - availability-zone-name
+ - hypervisor-type
+ required:
+ - cloud-owner
+ - cloud-region-id
+ - orchestration-disabled
+ - in-maint
+ required:
+ - cloud-region
customers:
type: array
items:
- - type: object
- properties:
- customer:
- type: object
- properties:
- global-customer-id:
- type: string
- subscriber-name:
- type: string
- subscriber-type:
- type: string
- service-subscriptions:
- type: array
- items:
- - type: object
- properties:
- service-type:
- type: string
- tenants:
- type: array
- items:
- - type: object
- properities:
- tenant-id:
- type: string
- cloud-owner:
- type: string
- cloud-region-id:
- type: string
- required:
- - tenant-id
- - cloud-owner
- - cloud-region-id
- required:
- - service-type
- required:
- - global-customer-id
- - subscriber-name
- - subscriber-type
- required:
- - customer
+ type: object
+ properties:
+ customer:
+ type: object
+ properties:
+ global-customer-id:
+ type: string
+ subscriber-name:
+ type: string
+ subscriber-type:
+ type: string
+ service-subscriptions:
+ type: array
+ items:
+ type: object
+ properties:
+ service-type:
+ type: string
+ tenants:
+ type: array
+ items:
+ type: object
+ properities:
+ tenant-id:
+ type: string
+ cloud-owner:
+ type: string
+ cloud-region-id:
+ type: string
+ required:
+ - tenant-id
+ - cloud-owner
+ - cloud-region-id
+ required:
+ - service-type
+ required:
+ - global-customer-id
+ - subscriber-name
+ - subscriber-type
+ required:
+ - customer
vendors:
type: array
items:
- - type: object
- properties:
- vendor:
- type: object
- properties:
- name:
- type: string
- required:
- - name
- required:
- - vendor
+ type: object
+ properties:
+ vendor:
+ type: object
+ properties:
+ name:
+ type: string
+ required:
+ - name
+ required:
+ - vendor
vsps:
type: array
items:
- - type: object
+ type: object
+ properties:
+ vsp:
+ type: object
+ properties:
+ name:
+ type: string
+ vendor:
+ type: string
+ package:
+ type: string
+ required:
+ - name
+ - vendor
+ - package
+ required:
+ - vsp
+ services:
+ type: array
+ items:
+ type: object
+ properties:
+ service:
+ type: object
+ properties:
+ name:
+ type: string
+ resources:
+ type: array
+ items:
+ type: object
+ properties:
+ name:
+ type: string
+ type:
+ type: string
+ properties: # Adding a prop to a component is senseless.
+ type: array
+ items:
+ type: object
+ properties:
+ name:
+ type: string
+ value:
+ type:
+ - string
+ - number
+ - boolean
+ required:
+ - name
+ - value
+ required:
+ - name
+ - type
+ properties: &props
+ type: array
+ items:
+ type: object
+ properties:
+ name:
+ type: string
+ type:
+ type: string
+ value:
+ type:
+ - string
+ - number
+ - boolean
+ anyOf:
+ - required:
+ - name
+ - type
+ - required:
+ - name
+ - value
+ inputs: *props
+ required:
+ - name
+ required:
+ - service
+ pnfs:
+ type: array
+ items:
+ type: object
properties:
- vsp:
+ pnf:
type: object
properties:
name:
type: string
vendor:
type: string
- package:
+ vsp:
+ type: string
+ category:
type: string
+ subcategory:
+ type: string
+ vendor:
+ type: string
+ deployment_artifact:
+ type: object
+ properties:
+ artifact_type:
+ type: string
+ artifact_name:
+ type: string
+ artifact_label:
+ type: string
+ artifact_file_name:
+ type: string
+ required:
+ - artifact_type
+ - artifact_name
+ - artifact_label
+ - artifact_file_name
+ properties: *props
+ inputs: *props
required:
- name
- - vendor
- - package
required:
- - vsp
- services:
- type: array
- items:
- - type: object
+ - pnf
+ vnfs:
+ type: array
+ items:
+ type: object
properties:
- service:
+ vnf:
type: object
properties:
name:
type: string
- resources:
- type: array
- items:
- - type: object
- properties:
- name:
- type: string
- type:
- type: string
- required:
- - name
- - type
- properties:
- type: array
- items:
- - type: object
- properties:
- name:
- type: string
- type:
- type: string
- value:
- type: string
- required:
- - name
- - type
+ vsp:
+ type: string
+ category:
+ type: string
+ subcategory:
+ type: string
+ vendor:
+ type: string
+ deployment_artifact:
+ type: object
+ properties:
+ artifact_type:
+ type: string
+ artifact_name:
+ type: string
+ artifact_label:
+ type: string
+ artifact_file_name:
+ type: string
+ required:
+ - artifact_type
+ - artifact_name
+ - artifact_label
+ - artifact_file_name
+ properties: *props
+ inputs: *props
required:
- name
required:
- - service
- pnfs:
+ - vnf
+ service-instances:
type: array
items:
- - type: object
- properties:
- pnf:
- type: object
- properties:
- name:
- type: string
- vendor:
- type: string
- vsp:
- type: string
- category:
- type: string
- subcategory:
- type: string
- vendor:
- type: string
- deployment_artifact:
+ type: object
+ properties:
+ service-instance:
+ type: object
+ properties:
+ service_instance_name:
+ type: string
+ service_name:
+ type: string
+ cloud_region:
+ type: string
+ customer_id:
+ type: string
+ owning_entity:
+ type: string
+ project:
+ type: string
+ platform:
+ type: string
+ line_of_business:
+ type: string
+ cloud_region_id:
+ type: string
+ cloud_owner:
+ type: string
+ timeout:
+ type: number
+ minimum: 1
+ maximum: 99999
+ aai_service:
+ type: string
+ service_subscription_type:
+ type: string
+ instantiation_parameters:
+ type: array
+ items:
type: object
properties:
- artifact_type:
+ vnf_name:
type: string
- artifact_name:
+ sec_group:
type: string
- artifact_label:
+ public_net_id:
type: string
- artifact_file_name:
+ onap_private_net_id:
type: string
- required:
- - artifact_type
- - artifact_name
- - artifact_label
- - artifact_file_name
- properties:
- type: array
- items:
- - type: object
- properties:
- name:
- type: string
- type:
- type: string
- value:
- type: string
- required:
- - name
- - type
- required:
- - name
- required:
- - pnf
- vnfs:
- type: array
- items:
- - type: object
- properties:
- vnf:
- type: object
- properties:
- name:
- type: string
- vsp:
- type: string
- category:
- type: string
- subcategory:
- type: string
- vendor:
- type: string
- deployment_artifact:
- type: object
- properties:
- artifact_type:
+ onap_private_subnet_id:
type: string
- artifact_name:
+ image_name:
type: string
- artifact_label:
+ flavor_name:
type: string
- artifact_file_name:
+ install_script_version:
type: string
- required:
- - artifact_type
- - artifact_name
- - artifact_label
- - artifact_file_name
- properties:
- type: array
- items:
- - type: object
- properties:
- name:
- type: string
- type:
- type: string
- value:
- type: string
- required:
- - name
- - type
- required:
- - name
- required:
- - vnf
- service-instances:
- type: array
- items:
- - type: object
- properties:
- service-instance:
- type: object
- properties:
- service_instance_name:
- type: string
- service_name:
- type: string
- cloud_region:
- type: string
- customer_id:
- type: string
- owning_entity:
- type: string
- project:
- type: string
- platform:
- type: string
- line_of_business:
- type: string
- cloud_region_id:
- type: string
- cloud_owner:
- type: string
- timeout:
- type: number
- minimum: 1
- maximum: 99999
- aai_service:
- type: string
- service_subscription_type:
- type: string
- instantiation_parameters:
- type: array
- items:
- - type: object
- properties:
- vnf_name:
- type: string
- sec_group:
- type: string
- public_net_id:
- type: string
- onap_private_net_id:
- type: string
- onap_private_subnet_id:
- type: string
- image_name:
- type: string
- flavor_name:
- type: string
- install_script_version:
- type: string
- demo_artifacts_version:
- type: string
- cloud_env:
- type: string
- aic-cloud-region:
- type: string
- pub_key:
- type: string
- required:
- - service_instance_name
- - service_name
- - customer_id
- - owning_entity
- - project
- - platform
- - line_of_business
- - aai_service
+ demo_artifacts_version:
+ type: string
+ cloud_env:
+ type: string
+ aic-cloud-region:
+ type: string
+ pub_key:
+ type: string
+ required:
+ - service_instance_name
+ - service_name
+ - customer_id
+ - owning_entity
+ - project
+ - platform
+ - line_of_business
+ - aai_service
owning-entities:
type: array
items:
- - type: object
- properities:
- owning-entity:
- type: object
- properties:
- name:
- type: string
- required:
- - name
- required:
- - owning-entity
+ type: object
+ properities:
+ owning-entity:
+ type: object
+ properties:
+ name:
+ type: string
+ required:
+ - name
+ required:
+ - owning-entity
projects:
type: array
items:
- - type: object
- properties:
- project:
- type: object
- properities:
- name:
- type: string
- required:
- - name
- required:
- - project
+ type: object
+ properties:
+ project:
+ type: object
+ properities:
+ name:
+ type: string
+ required:
+ - name
+ required:
+ - project
platforms:
type: array
items:
- - type: object
- properities:
- platform:
- type: object
- properities:
- name:
- type: string
- required:
- - name
- required:
- - platform
+ type: object
+ properities:
+ platform:
+ type: object
+ properities:
+ name:
+ type: string
+ required:
+ - name
+ required:
+ - platform
lines-of-business:
type: array
items:
- - type: object
- properties:
- line-of-business:
- type: object
- properities:
- name:
- type: string
- required:
- - name
- required:
- - line-of-business
+ type: object
+ properties:
+ line-of-business:
+ type: object
+ properities:
+ name:
+ type: string
+ required:
+ - name
+ required:
+ - line-of-business
msb-k8s-definitions:
type: array
items:
- type: object
- properties:
- name:
- type: string
- version:
- type: string
- chart-name:
- type: string
- description:
- type: string
- artifact:
- type: string
- profiles:
- type: array
- items:
- - type: object
- properties:
- name:
- type: string
- namespace:
- type: string
- k8s-version:
- type: string
- artifact:
- type: string
- required:
- - name
- - namespace
- - k8s-version
- - artifact
- required:
- - name
- - version
- - artifact
+ type: object
+ properties:
+ name:
+ type: string
+ version:
+ type: string
+ chart-name:
+ type: string
+ description:
+ type: string
+ artifact:
+ type: string
+ profiles:
+ type: array
+ items:
+ - type: object
+ properties:
+ name:
+ type: string
+ namespace:
+ type: string
+ k8s-version:
+ type: string
+ artifact:
+ type: string
+ required:
+ - name
+ - namespace
+ - k8s-version
+ - artifact
+ required:
+ - name
+ - version
+ - artifact
diff --git a/tests/test_service_resource.py b/tests/test_service_resource.py
index f664676..5a18f54 100644
--- a/tests/test_service_resource.py
+++ b/tests/test_service_resource.py
@@ -6,6 +6,14 @@ from onap_data_provider.resources.service_resource import ServiceResource
SERVICE_RESOURCE_DATA = {
"name": "test",
+ "inputs": [
+ {"name": "itest", "type": "string", "value": "itest"},
+ {"name": "itest1", "type": "boolean"},
+ ],
+ "properties": [
+ {"name": "test", "type": "string", "value": "test"},
+ {"name": "test1", "type": "boolean"},
+ ],
}
diff --git a/tests/test_validator.py b/tests/test_validator.py
index ad291a9..f0c7273 100644
--- a/tests/test_validator.py
+++ b/tests/test_validator.py
@@ -82,6 +82,27 @@ def test_validator_vsps():
validator.validate(VersionsEnum.V1_0, input_data)
+def test_validator_vnf():
+ validator = Validator()
+ input_data = {
+ "vnfs": [
+ {
+ "vnf": {
+ "name": "test",
+ "vsp": "testvsp",
+ "inputs": [
+ {"name": "itest", "type": "string", "value": "itest"},
+ {"name": "itest1", "type": "boolean"},
+ {"name": "itest2", "value": True},
+ ],
+ }
+ }
+ ]
+ }
+ validator.validate(VersionsEnum.V1_0, input_data)
+ validator.validate(VersionsEnum.V1_1, input_data)
+
+
def test_validator_service():
validator = Validator()
input_data = {
@@ -91,11 +112,15 @@ def test_validator_service():
"name": "test",
"resources": [
{"name": "test", "type": "test"},
- {"name": "test1", "type": "test2"},
+ {
+ "name": "test1",
+ "type": "test2",
+ "properties": [{"name": "test0", "value": "test1"}],
+ },
],
"properties": [
- {"name": "test", "type": "test", "value": "test"},
- {"name": "test1", "type": "test1"},
+ {"name": "test", "type": "string", "value": "test"},
+ {"name": "test1", "type": "boolean"},
],
}
}