onapsdk.sdc package

Submodules

onapsdk.sdc.category_management module

SDC category management module.

class onapsdk.sdc.category_management.BaseCategory(name)

Bases: onapsdk.sdc.SDC, abc.ABC

Base SDC category class.

It’s SDC admin resource, has no common properties with

SDC resourcer or elements, so SDC class can’t be it’s base class.

SDC_ADMIN_USER = 'demo'
abstract classmethod category_name()

Class category name.

Used for logs.

Returns

Category name

Return type

str

classmethod create(name)

Create category instance.

Checks if category with given name exists and if it already

exists just returns category with given name.

Returns

Created category instance

Return type

BaseCategory

classmethod get(name)

Get category with given name.

Raises

ResourceNotFound – Category with given name does not exist

Returns

BaseCategory instance

Return type

BaseCategory

classmethod get_all(**kwargs)

Get the categories list created in SDC.

Return type

List[SDC]

Returns

the list of the categories

classmethod headers()

Headers used for category management.

It uses SDC admin user.

Returns

Headers

Return type

Dict[str, str]

classmethod import_from_sdc(values)

Import category object from SDC.

Parameters

values (Dict[str, Any]) – dict to parse returned from SDC.

Return type

BaseCategory

class onapsdk.sdc.category_management.ResourceCategory(name)

Bases: onapsdk.sdc.category_management.BaseCategory

Resource category class.

classmethod category_name()

Resource category name.

Used for logging.

Returns

Resource category name

Return type

str

classmethod get(name, subcategory=None)

Get resource category with given name.

It returns resource category with all subcategories by default. You can

get resource category with only one subcategory if you provide it’s name as subcategory parameter.

Parameters
  • name (str) – Resource category name.

  • subcategory (str, optional) – Name of subcategory. Defaults to None.

Raises

ResourceNotFound – Subcategory with given name does not exist

Returns

BaseCategory instance

Return type

BaseCategory

class onapsdk.sdc.category_management.ServiceCategory(name)

Bases: onapsdk.sdc.category_management.BaseCategory

Service category class.

classmethod category_name()

Service category name.

Used for logging.

Returns

Service category name

Return type

str

onapsdk.sdc.component module

SDC Component module.

class onapsdk.sdc.component.Component(created_from_csar, actual_component_uid, unique_id, normalized_name, name, origin_type, customization_uuid, component_uid, component_version, tosca_component_name, component_name, group_instances, sdc_resource, parent_sdc_resource)

Bases: object

Component dataclass.

actual_component_uid: str
component_name: str
component_uid: str
component_version: str
classmethod create_from_api_response(api_response, sdc_resource, parent_sdc_resource)

Create component from api response.

Parameters
  • api_response (Dict[str, Any]) – component API response

  • sdc_resource (SdcResource) – component’s SDC resource

  • parent_sdc_resource (SdcResource) – component’s parent SDC resource

Returns

Component created using api_response and SDC resource

Return type

Component

created_from_csar: bool
customization_uuid: str
delete()

Delete component.

Return type

None

get_property(property_name)

Get component property by it’s name.

Parameters

property_name (str) – property name

Raises

ParameterError – Component has no property with given name

Returns

Component’s property object

Return type

ComponentProperty

group_instances: Optional[List[Dict[str, Any]]]
name: str
normalized_name: str
origin_type: str
parent_sdc_resource: SdcResource
property properties

Component properties.

In SDC it’s named as properties, but we uses “inputs” endpoint to fetch them.

Structure is also input’s like, but it’s a property.

Yields

ComponentProperty – Component property object

Return type

Iterator[ComponentProperty]

property properties_url

Url to get component’s properties.

Returns

Compoent’s properties url

Return type

str

property properties_value_url

Url to set component property value.

Returns

Url to set component property value

Return type

str

sdc_resource: SdcResource
set_property_value(property_obj, value)

Set property value.

Set given value to component property

Parameters
  • property_obj (ComponentProperty) – Component property object

  • value (Any) – Property value to set

Return type

None

tosca_component_name: str
unique_id: str

onapsdk.sdc.pnf module

Pnf module.

class onapsdk.sdc.pnf.Pnf(name=None, version=None, vendor=None, sdc_values=None, vsp=None, properties=None, inputs=None, category=None, subcategory=None)

Bases: onapsdk.sdc.sdc_resource.SdcResource

ONAP PNF Object used for SDC operations.

name

the name of the pnf. Defaults to “ONAP-test-PNF”.

Type

str

identifier

the unique ID of the pnf from SDC.

Type

str

status

the status of the pnf from SDC.

Type

str

version

the version ID of the vendor from SDC.

Type

str

uuid

the UUID of the PNF (which is different from identifier, don’t ask why…)

Type

str

unique_identifier

Yet Another ID, just to puzzle us…

Type

str

vendor

the vendor of the PNF

Type

optional

vsp

the vsp related to the PNF

Type

optional

create()

Create the PNF in SDC if not already existing.

Return type

None

onapsdk.sdc.properties module

Service properties module.

class onapsdk.sdc.properties.ComponentProperty(unique_id, property_type, name, component, _value=None)

Bases: object

Component property dataclass.

Component properties are inputs objects in SDC, but in logic

it’s a property.

component: Component
name: str
property_type: str
unique_id: str
property value

Property value getter.

Returns

Property value

Return type

Any

class onapsdk.sdc.properties.Input(unique_id, input_type, name, sdc_resource, _default_value=None)

Bases: object

Property input dataclass.

property default_value

Input default value.

Returns

Input default value

Return type

Any

input_type: str
name: str
sdc_resource: SdcResource
unique_id: str
class onapsdk.sdc.properties.NestedInput(sdc_resource, input_obj)

Bases: object

Dataclass used for nested input declaration.

input_obj: onapsdk.sdc.properties.Input
sdc_resource: SdcResource
class onapsdk.sdc.properties.Property(name, property_type, description=None, unique_id=None, parent_unique_id=None, sdc_resource=None, value=None, get_input_values=None)

Bases: object

Service property class.

property input

Property input.

Returns property Input object.

Returns None if property has no associated input.

Raises
  • ParameterError – Input has no associated SdcResource

  • ParameterError – Input for given property does not exits. It shouldn’t ever happen, but it’s possible if after you get property object someone delete input.

Returns

Property input object.

Return type

Input

property value

Value property.

Get property value.

Returns

Property value

Return type

Any

onapsdk.sdc.sdc_element module

SDC Element module.

class onapsdk.sdc.sdc_element.SdcElement(name=None)

Bases: onapsdk.sdc.SdcOnboardable, abc.ABC

Mother Class of all SDC elements.

ACTION_METHOD: str = 'PUT'
ACTION_TEMPLATE: str = 'sdc_element_action.json.j2'
abstract classmethod import_from_sdc(values)

Import SdcElement from SDC.

Parameters

values (Dict[str, Any]) – dict to parse returned from SDC.

Raises

NotImplementedError – this is an abstract method.

Return type

SdcElement

load()

Load Object information from SDC.

Return type

None

update_informations_from_sdc(details)

Update instance with details from SDC.

Parameters

details ([type]) – [description]

Return type

None

update_informations_from_sdc_creation(details)

Update instance with details from SDC after creation.

Parameters

details ([type]) – the details from SDC

Return type

None

onapsdk.sdc.sdc_resource module

SDC Element module.

class onapsdk.sdc.sdc_resource.SdcResource(name=None, version=None, sdc_values=None, properties=None, inputs=None, category=None, subcategory=None)

Bases: onapsdk.sdc.SdcOnboardable, abc.ABC

Mother Class of all SDC resources.

ACTION_METHOD: str = 'POST'
ACTION_TEMPLATE: str = 'sdc_resource_action.json.j2'
RESOURCE_PATH = 'resources'
add_deployment_artifact(artifact_type, artifact_label, artifact_name, artifact)

Add deployment artifact to resource.

Add deployment artifact to resource using payload data.

Parameters
  • artifact_type (str) – all SDC artifact types are supported (DCAE_*, HEAT_*, …)

  • artifact_name (str) – the artifact file name including its extension

  • artifact (str) – artifact file to upload

  • artifact_label (str) – Unique Identifier of the artifact within the VF / Service.

Raises

StatusError – Resource has not DRAFT status

property add_deployment_artifacts_url

Add deployment artifacts url.

Returns

Url used to add deployment artifacts

Return type

str

add_property(property_to_add)

Add property to resource.

Call SDC FE API to add property to resource.

Parameters

property_to_add (Property) – Property object to add to resource.

Raises

StatusError – Resource has not DRAFT status

Return type

None

property add_property_url

Add property url.

Returns

Url used to add property

Return type

str

add_resource(resource)

Add a Resource.

Parameters

resource (SdcResource) – the resource to add

Return type

None

property category

Sdc resource category.

Depends on the resource type returns ResourceCategory or ServiceCategory.

Returns

resource category

Return type

Uniton[ResourceCategory, ServiceCategory]

certify()

Certify SDC resource.

Return type

None

checkout()

Checkout SDC resource.

Return type

None

property components

Resource components.

Iterate resource components.

Yields

Component – Resource component object

Return type

Iterator[Component]

create()

Create resource.

Abstract method which should be implemented by subclasses and creates resource in SDC.

Raises

NotImplementedError – Method not implemented by subclasses.

Return type

None

declare_input(input_to_declare)

Declare input for given property or nested input object.

Call SDC FE API to declare input for given property.

Parameters

input_declaration (Union[Property, NestedInput]) – Property to declare input or NestedInput object

Raises

ParameterError – if the given property is not SDC resource property

Return type

None

declare_input_for_own_property(property_obj)

Declare input for resource’s property.

For each property input can be declared.

Parameters

property_obj (Property) – Property to declare input

Return type

None

declare_nested_input(nested_input)

Declare nested input for SDC resource.

Nested input is an input of one of the components.

Parameters

nested_input (NestedInput) – Nested input object

Return type

None

deep_load()

Deep load Object informations from SDC.

Return type

None

property deployment_artifacts_url

Deployment artifacts url.

Returns

SdcResource Deployment artifacts url

Return type

str

get_category_for_new_resource()

Get category for resource not created in SDC yet.

If no category values are provided default category is going to be used.

Returns

Category of the new resource

Return type

ResourceCategory

get_component(sdc_resource)

Get resource’s component.

Get component by SdcResource object.

Parameters

sdc_resource (SdcResource) – Component’s SdcResource

Raises

ResourceNotFound – Component with given SdcResource does not exist

Returns

Component object

Return type

Component

get_component_by_name(component_name)

Get resource’s component by it’s name.

Get component by name.

Parameters

component_name (str) – Component’s name

Raises

ResourceNotFound – Component with given name does not exist

Returns

Component object

Return type

Component

get_component_properties_url(component)

Url to get component’s properties.

This method is here because component can have different url when

it’s a component of another SDC resource type, eg. for service and for VF components have different urls.

Parameters

component (Component) – Component object to prepare url for

Returns

Component’s properties url

Return type

str

get_component_properties_value_set_url(component)

Url to set component property value.

This method is here because component can have different url when

it’s a component of another SDC resource type, eg. for service and for VF components have different urls.

Parameters

component (Component) – Component object to prepare url for

Returns

Component’s properties url

Return type

str

get_input(input_name)

Get input by it’s name.

Parameters

input_name (str) – Input name

Raises

ResourceNotFound – Resource doesn’t have input with given name

Returns

Found input object

Return type

Input

get_property(property_name)

Get resource property by it’s name.

Parameters

property_name (str) – property name

Raises

ResourceNotFound – Resource has no property with given name

Returns

Resource’s property object

Return type

Property

headers: Dict[str, str] = {'Accept': 'application/json', 'Authorization': 'Basic YWFpOktwOGJKNFNYc3pNMFdYbGhhazNlSGxjc2UyZ0F3ODR2YW9HR21KdlV5MlU=', 'Content-Type': 'application/json', 'USER_ID': 'cs0008', 'X-ECOMP-InstanceID': 'onapsdk'}
classmethod import_from_sdc(values)

Import SdcResource from SDC.

Parameters

values (Dict[str, Any]) – dict to parse returned from SDC.

Returns

the created resource

Return type

SdcResource

property inputs

SDC resource inputs.

Iterate resource inputs.

Yields

Iterator[Input] – Resource input

Return type

Iterator[Input]

is_own_property(property_to_check)

Check if given property is one of the resource’s properties.

Parameters

property_to_check (Property) – Property to check

Returns

True if resource has given property, False otherwise

Return type

bool

load()

Load Object information from SDC.

Return type

None

onboard()

Onboard resource in SDC.

Return type

None

property origin_type

Resource origin type.

Value needed for composition. It’s used for adding SDC resource

as an another SDC resource component.

Returns

SDC resource origin type

Return type

str

property properties

SDC resource properties.

Iterate resource properties.

Yields

Property – Resource property

Return type

Iterator[Property]

property properties_url

Properties url.

Returns

SdcResource properties url

Return type

str

property resource_inputs_url

Resource inputs url.

Method which returns url which point to resource inputs.

Returns

Resource inputs url

Return type

str

set_input_default_value(input_obj, default_value)

Set input default value.

Set given value as input default value

Parameters
  • input_obj (Input) – Input object

  • value (Any) – Default value to set

Return type

None

property set_input_default_value_url

Url to set input default value.

Returns

SDC API url used to set input default value

Return type

str

set_property_value(property_obj, value)

Set property value.

Set given value to resource property

Parameters
  • property_obj (Property) – Property object

  • value (Any) – Property value to set

Raises

ParameterError – if the given property is not the resource’s property

Return type

None

undo_checkout()

Undo Checkout SDC resource.

Return type

None

property unique_identifier

Return and lazy load the unique_identifier.

Return type

str

property unique_uuid

Return and lazy load the unique_uuid.

Return type

str

update_informations_from_sdc(details)

Update instance with details from SDC.

Parameters

details ([type]) – [description]

Return type

None

update_informations_from_sdc_creation(details)

Update instance with details from SDC after creation.

Parameters

details ([type]) – the details from SDC

Return type

None

onapsdk.sdc.service module

Service module.

class onapsdk.sdc.service.Network(name, node_template_type, model_name, model_version_id, model_invariant_id, model_version, model_customization_id, model_instance_name, component)

Bases: onapsdk.sdc.service.NodeTemplate

Network dataclass.

component: Component
model_customization_id: str
model_instance_name: str
model_invariant_id: str
model_name: str
model_version: str
model_version_id: str
name: str
node_template_type: str
class onapsdk.sdc.service.NodeTemplate(name, node_template_type, model_name, model_version_id, model_invariant_id, model_version, model_customization_id, model_instance_name, component)

Bases: object

Node template dataclass.

Base class for Vnf, Pnf and Network classes.

component: Component
model_customization_id: str
model_instance_name: str
model_invariant_id: str
model_name: str
model_version: str
model_version_id: str
name: str
node_template_type: str
property properties

Node template properties.

Returns

Node template properties iterator

Return type

Iterator[Property]

class onapsdk.sdc.service.Pnf(name, node_template_type, model_name, model_version_id, model_invariant_id, model_version, model_customization_id, model_instance_name, component)

Bases: onapsdk.sdc.service.NodeTemplate

Pnf dataclass.

component: Component
model_customization_id: str
model_instance_name: str
model_invariant_id: str
model_name: str
model_version: str
model_version_id: str
name: str
node_template_type: str
class onapsdk.sdc.service.Service(name=None, version=None, sdc_values=None, resources=None, properties=None, inputs=None, instantiation_type=None, category=None, role='', function='', service_type='')

Bases: onapsdk.sdc.sdc_resource.SdcResource

ONAP Service Object used for SDC operations.

name

the name of the service. Defaults to “ONAP-test-Service”.

Type

str

identifier

the unique ID of the service from SDC.

Type

str

status

the status of the service from SDC.

Type

str

version

the version ID of the service from SDC.

Type

str

uuid

the UUID of the Service (which is different from identifier, don’t ask why…)

Type

str

distribution_status

the status of distribution in the different ONAP parts.

Type

str

distribution_id

the ID of the distribution when service is distributed.

Type

str

distributed

True if the service is distributed

Type

bool

unique_identifier

Yet Another ID, just to puzzle us…

Type

str

SERVICE_PATH = 'services'
add_artifact_to_vf(vnf_name, artifact_type, artifact_name, artifact=None)

Add artifact to vf.

Add artifact to vf using payload data.

Raises

RequestError – file upload (POST request) for an artifact fails.

Parameters
  • vnf_name (str) – the vnf which we want to add the artifact

  • artifact_type (str) – all SDC artifact types are supported (DCAE_*, HEAT_*, …)

  • artifact_name (str) – the artifact file name including its extension

  • artifact (str) – binary data to upload

property add_deployment_artifacts_url

Add deployment artifacts url.

Returns

Url used to add deployment artifacts

Return type

str

approve()

Approve Service in SDC.

Return type

None

certify()

Certify Service in SDC.

Return type

None

checkin()

Checkin Service.

Return type

None

create()

Create the Service in SDC if not already existing.

Return type

None

create_node_template(node_template_type, component)

Create a node template type object.

The base of the all node template types objects (Vnf, Pnf, Network) is the same. The difference is only for the Vnf which can have vf modules associated with. Vf modules could have “vf_module_label” property with”base_template_dummy_ignore” value. These vf modules should be ignored/

Parameters
  • node_template_type (Type[NodeTemplate]) – Node template class type

  • component (Component) – Component on which base node template object should be created

Returns

Node template object created from component

Return type

NodeTemplate

declare_resources_and_properties()

Delcare resources and properties.

It declares also inputs.

Return type

None

property deployment_artifacts_url

Deployment artifacts url.

Returns

SdcResource Deployment artifacts url

Return type

str

distribute()

Apptove Service in SDC.

Return type

None

property distributed

Return and lazy load the distributed state.

Return type

bool

property distribution_id

Return and lazy load the distribution_id.

Return type

str

classmethod get_by_unique_uuid(unique_uuid)

Get the service model using unique uuid.

Returns

object with provided unique_uuid

Return type

Service

Raises

ResourceNotFound – No service with given unique_uuid exists

get_category_for_new_resource()

Get category for service not created in SDC yet.

If no category values are provided default category is going to be used.

Returns

Category of the new service

Return type

ServiceCategory

get_component_properties_url(component)

Url to get component’s properties.

This method is here because component can have different url when

it’s a component of another SDC resource type, eg. for service and for VF components have different urls. Also for VL origin type components properties url is different than for the other types.

Parameters

component (Component) – Component object to prepare url for

Returns

Component’s properties url

Return type

str

get_component_properties_value_set_url(component)

Url to set component property value.

This method is here because component can have different url when

it’s a component of another SDC resource type, eg. for service and for VF components have different urls. Also for VL origin type components properties url is different than for the other types.

Parameters

component (Component) – Component object to prepare url for

Returns

Component’s properties url

Return type

str

get_nf_unique_id(nf_name)

Get nf (network function) uniqueID.

Get nf uniqueID from service nf in sdc.

Parameters

nf_name (str) – the nf from which we extract the unique ID

Return type

str

Returns

the nf unique ID

Raises

ResourceNotFound – Couldn’t find NF by name.

get_tosca()

Get Service tosca files and save it.

Return type

None

property has_pnfs

Check if service has at least one PNF component.

Return type

bool

property has_vls

Check if service has at least one VL component.

Return type

bool

property has_vnfs

Check if service has at least one VF component.

Return type

bool

property instantiation_type

Service instantiation type.

One of ServiceInstantiationType enum value.

Returns

Service instantiation type

Return type

ServiceInstantiationType

load_metadata()

Load Metada of Service and retrieve informations.

Return type

None

property metadata_url

Metadata url.

Returns

Service metadata url

Return type

str

property networks

Service networks.

Load networks from service’s components generator.

Returns

Network objects generator

Return type

Iterator[Network]

onboard()

Onboard the Service in SDC.

Raises
Return type

None

property origin_type

Service origin type.

Value needed for composition. It’s used for adding SDC resource

as an another SDC resource component. For Service that value has to be set to “ServiceProxy”.

Returns

Service resource origin type

Return type

str

property pnfs

Service Pnfs.

Load PNFS from components generator.

Returns

Pnf objects generator

Return type

Iterator[Pnf]

property properties_url

Properties url.

Returns

SdcResource properties url

Return type

str

redistribute()

Apptove Service in SDC.

Return type

None

property resource_inputs_url

Service inputs url.

Returns

Service inputs url

Return type

str

property set_input_default_value_url

Url to set input default value.

Returns

SDC API url used to set input default value

Return type

str

start_certification()

Start Certification on Service.

Return type

None

submit()

Really submit the SDC Service.

Return type

None

property tosca_model

Service’s tosca model file.

Send request to get service TOSCA model,

Returns

TOSCA model file bytes

Return type

bytes

property tosca_template

Service tosca template file.

Get tosca template from service tosca model bytes.

Returns

Tosca template file

Return type

str

property vnfs

Service Vnfs.

Load VNFs from components generator. It creates a generator of the vf modules as well, but without

vf modules which has “vf_module_label” property value equal to “base_template_dummy_ignore”.

Returns

Vnf objects iterator

Return type

Iterator[Vnf]

class onapsdk.sdc.service.ServiceInstantiationType(value)

Bases: enum.Enum

Service instantiation type enum class.

Service can be instantiated using A-la-carte or Macro flow. It has to be determined during design time. That class stores these two values to set during initialization.

A_LA_CARTE = 'A-la-carte'
MACRO = 'Macro'
class onapsdk.sdc.service.VfModule(name, group_type, model_name, model_version_id, model_invariant_uuid, model_version, model_customization_id, properties)

Bases: object

VfModule dataclass.

group_type: str
model_customization_id: str
model_invariant_uuid: str
model_name: str
model_version: str
model_version_id: str
name: str
properties: Iterator[onapsdk.sdc.properties.Property]
class onapsdk.sdc.service.Vnf(name, node_template_type, model_name, model_version_id, model_invariant_id, model_version, model_customization_id, model_instance_name, component, vf_modules=<factory>)

Bases: onapsdk.sdc.service.NodeTemplate

Vnf dataclass.

vf_modules: List[onapsdk.sdc.service.VfModule]

onapsdk.sdc.vendor module

Vendor module.

class onapsdk.sdc.vendor.Vendor(name=None)

Bases: onapsdk.sdc.sdc_element.SdcElement

ONAP Vendor Object used for SDC operations.

name

the name of the vendor. Defaults to “Generic-Vendor”.

Type

str

identifier

the unique ID of the vendor from SDC.

Type

str

status

the status of the vendor from SDC.

Type

str

version

the version ID of the vendor from SDC.

Type

str

VENDOR_PATH = 'vendor-license-models'
create()

Create the vendor in SDC if not already existing.

Return type

None

headers: Dict[str, str] = {'Accept': 'application/json', 'Authorization': 'Basic YWFpOktwOGJKNFNYc3pNMFdYbGhhazNlSGxjc2UyZ0F3ODR2YW9HR21KdlV5MlU=', 'Content-Type': 'application/json', 'USER_ID': 'cs0008', 'X-ECOMP-InstanceID': 'onapsdk'}
classmethod import_from_sdc(values)

Import Vendor from SDC.

Parameters

values (Dict[str, Any]) – dict to parse returned from SDC.

Return type

Vendor

Returns

a Vsp instance with right values

onboard()

Onboard the vendor in SDC.

Return type

None

submit()

Submit the SDC vendor in order to enable it.

Return type

None

update_informations_from_sdc(details)

Update instance with details from SDC.

Parameters

details (Dict[str, Any]) – dict from SDC

Return type

None

onapsdk.sdc.vf module

Vf module.

class onapsdk.sdc.vf.Vf(name=None, version=None, sdc_values=None, vsp=None, properties=None, inputs=None, category=None, subcategory=None, vendor=None)

Bases: onapsdk.sdc.sdc_resource.SdcResource

ONAP Vf Object used for SDC operations.

name

the name of the vendor. Defaults to “Generic-Vendor”.

Type

str

identifier

the unique ID of the vendor from SDC.

Type

str

status

the status of the vendor from SDC.

Type

str

version

the version ID of the vendor from SDC.

Type

str

vsp

the Vsp used for VF creation

Type

Vsp

uuid

the UUID of the VF (which is different from identifier, don’t ask why…)

Type

str

unique_identifier

Yet Another ID, just to puzzle us…

Type

str

create()

Create the Vf in SDC if not already existing.

Raises

ParameterError – VSP is not provided during VF object initalization

Return type

None

declare_input(input_to_declare)

Declare input for given property, nested input or component property object.

Call SDC FE API to declare input for given property.

Parameters

input_declaration (Union[Property, NestedInput]) – Property or ComponentProperty to declare input or NestedInput object

Raises

ParameterError – if the given property is not SDC resource property

Return type

None

update_vsp(vsp)

Update Vsp.

Update VSP UUID and version for Vf object.

Parameters

vsp (Vsp) – Object to be used in Vf

Raises

ValidationError – Vf object request has invalid structure.

Return type

None

property vendor

Vendor related wth Vf.

If Vf is created vendor is get from it’s resource metadata. Otherwise it’s vendor provided by the user or the vendor from vsp. It’s possible that method returns None, but it won’t be possible then

to create that Vf resource.

Returns

Vendor object related with Vf

Return type

Optional[Vendor]

onapsdk.sdc.vl module

Vl module.

class onapsdk.sdc.vl.Vl(name, version=None, sdc_values=None)

Bases: onapsdk.sdc.sdc_resource.SdcResource

ONAP Vl Object used for SDC operations.

onapsdk.sdc.vsp module

VSP module.

class onapsdk.sdc.vsp.Vsp(name=None, package=None, vendor=None)

Bases: onapsdk.sdc.sdc_element.SdcElement

ONAP VSP Object used for SDC operations.

name

the name of the vsp. Defaults to “ONAP-test-VSP”.

Type

str

identifier

the unique ID of the VSP from SDC.

Type

str

status

the status of the VSP from SDC.

Type

str

version

the version ID of the VSP from SDC.

Type

str

csar_uuid

the CSAR ID of the VSP from SDC.

Type

str

vendor

The VSP Vendor

Type

Vendor

VSP_PATH = 'vendor-software-products'
commit()

Commit the SDC Vsp.

Return type

None

create()

Create the Vsp in SDC if not already existing.

Return type

None

create_csar()

Create the CSAR package in the SDC Vsp.

Return type

None

create_new_version()

Create new version of VSP.

Create a new major version of VSP so it would be possible to

update a package or do some changes in VSP.

Return type

None

property csar_uuid

Return and lazy load the CSAR UUID.

Return type

str

headers: Dict[str, str] = {'Accept': 'application/json', 'Authorization': 'Basic YWFpOktwOGJKNFNYc3pNMFdYbGhhazNlSGxjc2UyZ0F3ODR2YW9HR21KdlV5MlU=', 'Content-Type': 'application/json', 'USER_ID': 'cs0008', 'X-ECOMP-InstanceID': 'onapsdk'}
classmethod import_from_sdc(values)

Import Vsp from SDC.

Parameters

values (Dict[str, Any]) – dict to parse returned from SDC.

Return type

Vsp

Returns

a Vsp instance with right values

load_status()

Load Vsp status from SDC.

rules are following:

  • DRAFT: status == DRAFT and networkPackageName not present

  • UPLOADED: status == DRAFT and networkPackageName present and validationData not present

  • VALIDATED: status == DRAFT and networkPackageName present and validationData present and state.dirty = true

  • COMMITED: status == DRAFT and networkPackageName present and validationData present and state.dirty = false

  • CERTIFIED: status == CERTIFIED

status is found in sdc items state is found in sdc version from items networkPackageName and validationData is found in SDC vsp show

Return type

None

onboard()

Onboard the VSP in SDC.

Return type

None

property status

Return and load the status.

submit()

Submit the SDC Vsp in order to enable it.

Return type

None

update_package(package_to_upload)

Upload given zip file into SDC as artifacts for this Vsp.

Parameters

package_to_upload (file) – the zip file to upload

Return type

None

upload_package(package_to_upload)

Upload given zip file into SDC as artifacts for this Vsp.

Parameters

package_to_upload (file) – the zip file to upload

Return type

None

validate()

Validate the artifacts uploaded.

Return type

None

property vendor

Return and lazy load the vendor.

Return type

Vendor

Module contents

SDC Element module.

class onapsdk.sdc.SDC(name=None)

Bases: onapsdk.onap_service.OnapService, abc.ABC

Mother Class of all SDC elements.

base_back_url = 'https://sdc.api.be.simpledemo.onap.org:30204'
base_front_url = 'https://sdc.api.fe.simpledemo.onap.org:30207'
exists()

Check if object already exists in SDC and update infos.

Return type

bool

Returns

True if exists, False either

classmethod get_all(**kwargs)

Get the objects list created in SDC.

Return type

List[SDC]

Returns

the list of the objects

classmethod get_guis()

Retrieve the status of the SDC GUIs.

Only one GUI is referenced for SDC the SDC Front End

Return the list of GUIs

Return type

GuiItem

abstract classmethod import_from_sdc(values)

Import Sdc object from SDC.

Parameters

values (Dict[str, Any]) – dict to parse returned from SDC.

Raises

NotImplementedError – this is an abstract method.

Return type

SDC

server: str = 'SDC'
class onapsdk.sdc.SdcOnboardable(name=None)

Bases: onapsdk.sdc.SDC, abc.ABC

Base class for onboardable SDC resources (Vendors, Services, …).

ACTION_METHOD: str
ACTION_TEMPLATE: str
created()

Determine if SDC is created.

Return type

bool

property identifier

Return and lazy load the identifier.

Return type

str

abstract load()

Load Object information from SDC.

Raises

NotImplementedError – this is an abstract method.

Return type

None

abstract onboard()

Onboard resource.

Onboarding is a full stack of actions which needs to be done to

make SDC resource ready to use. It depends on the type of object but most of them needs to be created and submitted.

Return type

None

property status

Return and lazy load the status.

Return type

str

submit()

Submit the SDC object in order to enable it.

Return type

None

abstract update_informations_from_sdc(details)

Update instance with details from SDC.

Parameters

details ([type]) – [description]

Return type

None

abstract update_informations_from_sdc_creation(details)

Update instance with details from SDC after creation.

Parameters

details ([type]) – the details from SDC

Return type

None

property version

Return and lazy load the version.

Return type

str