onapsdk.clamp package

Submodules

onapsdk.clamp.clamp_element module

Clamp module.

class onapsdk.clamp.clamp_element.Clamp

Bases: onapsdk.onap_service.OnapService

Mother Class of all CLAMP elements.

classmethod base_url()

Give back the base url of Clamp.

Return type

str

classmethod check_loop_template(service)

Return loop template name if exists.

Parameters

service (Service) – the distributed sdc service with tca blueprint artifact

Raises

ResourceNotFound – Template not found.

Return type

str

Returns

if required template exists in CLAMP or not

classmethod check_policies(policy_name, req_policies=30)

Ensure that a policy is stored in CLAMP.

Parameters
  • policy_name (str) – policy acronym

  • req_policies (int) – number of required policies in CLAMP

Return type

bool

Returns

if required policy exists in CLAMP or not

headers: Dict[str, str] = {'Accept': 'application/json', 'Authorization': 'Basic ZGVtb0BwZW9wbGUub3NhYWYub3JnOmRlbW8xMjM0NTYh', 'Content-Type': 'application/json', 'X-ECOMP-InstanceID': 'onapsdk'}
name: str = 'CLAMP'

onapsdk.clamp.loop_instance module

Control Loop module.

class onapsdk.clamp.loop_instance.LoopInstance(template, name, details)

Bases: onapsdk.clamp.clamp_element.Clamp

Control Loop instantiation class.

act_on_loop_policy(func)

Act on loop’s policy.

Parameters

func (function) – function of action to be done (submit, stop, restart)

Returns

failed or done

Return type

action state

add_drools_conf()

Add drools configuration.

Return type

dict

add_frequency_limiter(limit=1)

Add frequency limiter config.

Return type

None

add_minmax_config()

Add MinMax operational policy config.

Return type

None

add_op_policy_config(func, **kwargs)

Add operational policy configuration.

Add operation policy configuration using payload data.

Parameters

func (function) – policy configuration function in (add_drools_conf, add_minmax_config, add_frequency_limiter)

Return type

None

add_operational_policy(policy_type, policy_version)

Add operational policy to the loop instance.

Parameters
  • policy_type (str) – the full policy model type

  • policy_version (str) – policy version

Raises

ParameterError – Corrupt response or a key in a dictionary not found. It will also be raised when the response contains more operational policies than there are currently.

Return type

None

create()

Create instance and load loop details.

Return type

None

delete()

Delete the loop instance.

Return type

None

deploy_microservice_to_dcae()

Execute the deploy operation on the loop instance.

Return type

bool

Returns

loop deploy on DCAE status (True, False)

property details

Return and lazy load the details.

Return type

dict

extract_operational_policy_name(policy_type)

Return operational policy name for a closed loop and a given policy.

Parameters

policy_type (str) – the policy acronym.

Raises

ParameterError – Couldn’t load the operational policy name.

Return type

str

Returns

Operational policy name in the loop details after adding a policy.

property loop_schema

Return and lazy load the details schema.

Return type

dict

Returns

schema to be respected to accede to loop details

operational_policies = ''
refresh_status()

Reshresh loop status.

Return type

None

remove_operational_policy(policy_type, policy_version)

Remove operational policy from the loop instance.

Parameters
  • policy_type (str) – the full policy model type

  • policy_version (str) – policy version

Return type

None

restart()

Redeploy policies to policy engine.

stop()

Undeploy Policies from policy engine.

submit()

Submit policies to policy engine.

undeploy_microservice_from_dcae()

Stop the deploy operation.

Return type

None

update_microservice_policy()

Update microservice policy configuration.

Update microservice policy configuration using payload data.

Return type

None

validate_details()

Validate Loop Instance details.

Return type

bool

Returns

schema validation status (True, False)

Module contents

ONAP SDK CLAMP package.