Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table Of Contents

Table of Contents
maxLevel4

Schema

You can think of the JSON as Directed Graph source code and the XML as compiled code. The XML must conform to the schema at https://gerrit.onap.org/r/gitweb?p=ccsdk/sli/core.git;a=blob;f=sli/common/src/main/resources/svclogic.xsd;hb=refs/heads/master. The XML schema reveals what nodes are supported and which attributes are appropriate for each node. This page explains each node in plain English with accompanying code snippets as an alternative to reading the schema file itself.

Supported node types 

The following built-in node types are currently supported: Table of ContentsmaxLevel4


Flow Control

Block node

Description

block node is used to executes a set of nodes.

...

atomicif true, then if a node returns failure, subsequent nodes will not be executed and nodes already executed will be backed out. If unset it is treated as false.
Parameters

None

Outcomes

None

...

Code Block
<block>
  <record plugin="org.openecomp.sdnc.sli.recording.FileRecorder">
    <parameter name="file" value="/tmp/gamma_r1.log" />
    <parameter name="field1" value="__TIMESTAMP__"/>
    <parameter name="field2" value="RESERVED"/>
    <parameter name="field3" value="$asePort.uni_circuit_id"/>
  </record>
  <return status="success">
    <parameter name="uni-circuit-id" value="$asePort.uni_circuit_id" />
  </return>
</block>circuit_id" />
  </return>
</block>

Break node

Description

A break node is used to break out of a for or while loop.

Attributes

None

Parameters

None

Outcomes

None

Example
Code Block
<break/>

Call node

Description

call node is used to call another graph

Attributes
moduleModule of directed graph to call. If unset, defaults to that of calling graph
rpcrpc of directed graph to call.
versionversion of graph to call, If unset, uses active version.
modemode (sync/async) of graph to call. If unset, defaults to that of calling graph.
Parameters

Not applicable

Outcomes

...

successSub graph returned success
not-foundGraph not found
failureSubgraph returned success
Example

...

not found
failureSubgraph returned success
Example
Code Block
<call rpc="svc-topology-reserve" mode="sync" />

Exit node

Description

An exit node is used to exit a graph without further execution

Attributes

None

Parameters

Not applicable

Outcomes

None

Example
Code Block
<exit/>

For node

Description

for node provides a fixed iteration looping mechanism, similar to the Java for loop

Attributes
atomicif true, then if a node returns failure, subsequent nodes will not be executed and nodes already executed will be backed out. If unset it is treated as true.
indexindex variable
startinitial value
endmaximum value
silentFailureOptional boolean, when true for loops will not throw an exception for a null or invalid index. If unset it is treated as false.
Parameters

Not applicable.

Outcomes

Not applicable. The status node has no outcomes.

Example
Info
<for index="i" start="0" end="$network.num-segments">
  <set>
    <parameter name="$vlanlist" value="eval($vlanlist+','+$network.segment[i].provider-segmentation-id)"/>
  </set>
</for>

Return node

Description

return node is used to return a status to the invoking MD-SAL applicationstatus to the invoking MD-SAL application. The return node does not prevent the execution of subsequent nodes. The status set by the return node is tested by atomic for and block nodes.

Attributes
statusStatus value to return (success or failure)
Parameters

The following optional parameters may be passed to convey more detailed status information.

error-codeA brief, usually numeric, code indicating the error condition
error-messageA more detailed error message
Outcomes

Not applicable. The status node has no outcomes.

Example
Info
<return status="failure">
  <parameter name="error-code" value="1542" />
  <parameter name="error-message" value="Activation failure" />
</return>

Set node

Description

set node is used to set one or more values in the execution context

Attributes
only-if-unsetIf true the set node will only execute if the current value of the target is null
Parameters

Values to be set are passed as parameters

Outcomes

Not applicable. The set node has no outcomes.

Example
Code Block
<set>
  <parameter name="vlan" value="$network.provider-segmentation-id" />
</set>

Switch node

Description

switch node is used to make a decision based on its test attribute.

Attributes
testCondition to test
Parameters

None

Outcomes

Depends on the test condition

Example
Code Block
<switch test="$uni-cir-units">
  <outcome value="Mbps">
    <reserve plugin="org.openecomp.sdnc.sli.resource.gamma.GammaResource"
                         resource="ase-port"
                         key="resource-emt-clli == $edge-device-clli and speed >= $uni-cir-value"
                         pfx="asePort">

      <outcome value="success">
            <return status="success">
                  <parameter name="uni-circuit-id" value="$asePort.uni_circuit_id" />
                </return>
      </outcome>
      <outcome value="Other">
        <return status="failure">
          <parameter name="error-code" value="1010" />
          <parameter name="error-message" value="No ports found that match criteria" />
        </return>
      </outcome>
    </reserve>
  </outcome>
  <outcome value="Gbps">
    <reserve plugin="org.openecomp.sdnc.sli.resource.gamma.GammaResource"
                         resource="ase-port"
                         key="resource-emt-clli == $edge-device-clli and speed >= $uni-cir-value*1000"
                         pfx="asePort">

      <outcome value="success">
            <return status="success">
                  <parameter name="uni-circuit-id" value="$asePort.uni_circuit_id" />
                </return>
      </outcome>
      <outcome value="Other">
        <return status="failure">
          <parameter name="error-code" value="1010" />
          <parameter name="error-message" value="No ports found that match criteria" />
        </return>
      </outcome>
    

...

</reserve>
  </outcome>    
</switch>

While node

Description

A while node is used to create a while loop

Attributes
testCondition to test
doOptional boolean, when true the loop executes once regardless of the test condition
Parameters

None

Outcomes

Depends on the test condition

Example
Code Block

Device Management

Configure node

Description

configure node is used to configure a device.

Attributes
adaptorFully qualified Java class of resource adaptor to be used
activateActivate device/interface, for devices that support a separate activation step.
keySQL-like string specifying criteria for item to configure
Parameters

Specific to device adaptor.

Outcomes
successDevice successfully configured
not-foundElement to be configured does not exist.
not-readyElement is not in a state where it can be configured/activated
already-activeAttempt to activate element that is already active
failureConfigure failed for some other reason
Example
Code Block
<configure adaptor="org.openecomp.sdnc.sli.adaptor.emt.EmtAdaptor"
           key="$uni-circuit-id" activate="true">
  <parameter name="circuit.id" value="$uni-circuit-id" />
  <parameter name="subscriber.name" value="$subscriber-name" />
  <parameter name="emt.clli" value="$edge-device-clli" />
  <parameter name="port.tagging" value="$port-tagging" />
  <parameter name="port.mediaSpeed" value="$media-speed" />
  <parameter name="location.state" value="$uni-location-state" />
  <parameter name="location.city" value="$uni-location-city" />
  <parameter name="cosCategory" value="$cos-category" />
  <parameter name="gosProfile" value="$gos-profile" />
  <parameter name="lldp" value="$asePort.resource-lldp" />
  <parameter name="mtu" value="$asePort.resource-mtu" />
  <outcome value="success">
    <block>
      <record plugin="org.openecomp.sdnc.sli.recording.FileRecorder">
        <parameter name="file" value="/tmp/gamma_r1.log" />
        <parameter name="field1" value="__TIMESTAMP__"/>
        <parameter name="field2" value="ACTIVE"/>
        <parameter name="field3" value="$uni-circuit-id"/>
      </record>
      <return status="success">
        <parameter name="edge-device-clli" value="$asePort.resource-emt-clli" />
      </return>
    </block>
  </outcome>
  <outcome value="already-active">
    <return status="failure">
      <parameter name="error-code" value="1590" />
      <parameter name="error-message" value="Port already active" />
    </return>
  </outcome>
  <outcome value="Other">
    <return status="failure">
      <parameter name="error-code" value="1542" />
      <parameter name="error-message" value="Activation failure" />
    </return>
  </outcome>
</configure>

Java Plugin Support

Execute node

Description

An execute node is used to execute Java code supplied as a plugin

Attributes

*** Parameters

pluginFully qualified Java class of plugin to be used
methodName of method in the plugin class to execute. Method must return void, and take 2 arguments: a Map (for parameters) and a SvcLogicContext (to allow plugin read/write access to context memory)
emitsOutcomeOptional boolean value, when true the plugin must return a String which should represent an outcome

Specific to plugin / method

Outcomes
successDevice successfully configured
not-foundPlugin class could not be loaded
unsupported-methodNamed method taking (Map, SvcLogicContext) could not be found
failureConfigure failed for some other reason
Example
Code Block
<execute plugin="org.openecomp.sdnc.sli.plugin.HelloWorld"
           method="log">
  <parameter name="message" value="Hello, world!" />
  <outcome value="success">
      <return status="success"/>
  </outcome>
  <outcome value="not-found">
    <return status="failure">
      <parameter name="error-code" value="1590" />
      <parameter name="error-message" value="Could not locate plugin" />
    </return>
  </outcome>
  <outcome value="Other">
    <return status="failure">
      <parameter name="error-code" value="1542" />
      <parameter name="error-message" value="Internal error" />
    </return>
  </outcome>
</execute>

Recording

Record node

Description

record node is used to record an event. For example, this might be used to log provisioning events.

Attributes
pluginFully qualified Java class to handle recording.
Parameters

Parameters will depend on the plugin being used. For the FileRecorder class, the parameters are as follows

fileThe file to which the record should be written
field1First field to write. There will be field parameters for each field to write, from field1 through fieldN. A special value __TIMESTAMP__ may be assigned to a field to insert the current timestamp
Outcomes
successRecord successfully written
failureRecord could not be successfully written
Example
Code Block
<record plugin="org.openecomp.sdnc.sli.recording.FileRecorder">
  <parameter name="file" value="/tmp/gamma_r1.log" />
  <parameter name="field1" value="__TIMESTAMP__"/>
  <parameter name="field2" value="ACTIVE"/>
  <parameter name="field3" value="$uni-circuit-id"/>
</record>

Resource Management

Delete node

Description

delete node is used to delete a resource from the local resource inventory.

Attributes
pluginFully qualified Java class of resource adaptor to be used
resourceType of resource to delete
keySQL-like string specifying key to delete
Parameters

None

Outcomes
successResource specified deleted successfully.
failure>Resource specified was not deleted
Example
Code Block
<delete plugin="org.openecomp.sdnc.sli.resource.gamma.GammaResource"
        resource="ase-port"
        key="uni_circuit_id == $uni-circuit-id">
  <outcome value="true">
    <return status="success"/>
  </outcome>
  <outcome value="false">
    <return status="failure"/>
  </outcome>
</delete>

Exists node

Description

An exists node is used to determine whether a particular instance of a resource exists. For example, this might be used to test whether a particular switch CLLI is provisioned.

Attributes
pluginFully qualified Java class of resource adaptor to be used
resourceType of resource to check
keySQL-like string specifying key to check for
Parameters

None

Outcomes
trueResource specified exists.
falseResource specified is unknown
Example
Code Block
<exists plugin="org.openecomp.sdnc.sli.resource.gamma.GammaResource"
        resource="ase-port"
        key="uni_circuit_id == $uni-circuit-id">
  <outcome value="true">
    <return status="success"/>
  </outcome>
  <outcome value="false">
    <return status="failure"/>
  </outcome>
</exists>

Get-resource node

Description

get-resource node is used to retrieve information about a particular resource and make it available to other nodes in the service logic tree. For example, this might be used to retrieve information about a particular uni-port.

Attributes
pluginFully qualified Java class of resource adaptor to be used
resourceType of resource to retrieve
keySQL-like string specifying criteria for retrieval
pfxPrefix to add to context variable names set for data retrieved
selectString to specify, if key matches multiple entries, which entry should take precedence
order-byPrefix to add to context variable names set for data retrieved
Parameters

None

Outcomes
successResource successfully retrieved
not-foundResource referenced does not exist
failureResource retrieve failed for some other reason
Example
Code Block
<get-resource plugin="org.openecomp.sdnc.sli.resource.gamma.GammaResource"
              resource="ase-port"
              key="uni_circuit_id == $uni-circuit-id"
              pfx="current-port">
  <outcome value="success">
    <return status="success"/>
  </outcome>
  <outcome value="not-found">
    <return status="failure"/>
  </outcome>
  <outcome value="failure">
    <return status="failure"/>
  </outcome>
</get-resource>

Is-available node

Description

An is-available node is used to determine whether a particular type of resource is available. For example, this might be used to test whether any ports are available for assignment on a particular switch.

Attributes
pluginFully qualified Java class of resource adaptor to be used
resourceType of resource to check
keySQL-like string specifying key to check for
pfxPrefix to add to context variable names set for data retrieved
Parameters

None

Outcomes
trueResource requested is available
falseResource requested is not available
Example
Code Block
<is-available plugin="org.openecomp.sdnc.sli.resource.gamma.GammaResource"
              resource="ase-port"
              key="resource-emt-clli == $edge-device-clli and speed >= $uni-cir-value">
  <outcome value="true">
    <return status="success"/>
  </outcome>
  <outcome value="false">
    <return status="failure"/>
  </outcome>
</is-available>

Notify node

Description

notify node is used to inform an external application (e.g. A&AI) that a resource was updated.

Attributes
pluginFully qualified Java class of resource adaptor to be used
resourceIdentifies resource that was updated
actionAction that triggered notification to be sent (ADD/UPDATE/DELETE)
Parameters

None

Outcomes
successNotification was successful
failureNotification failed is not available
Example
Code Block
<notify plugin="org.openecomp.sdnc.sli.resource.gamma.GammaResource"
              resource="ase-port"
              action="ADD">
  <outcome value="success">
    <return status="success"/>
  </outcome>
  <outcome value="Other">
    <return status="failure"/>
  </outcome>
</notify>

Release node

Description

release node is used to mark a resource as no longer in use, and thus available for assignment.

Attributes
pluginFully qualified Java class of resource adaptor to be used
resourceType of resource to release
keySQL-like string specifying key to check of resource to release
Parameters

None

Outcomes
successResource successfully released
not-foundResource referenced does not exist
failureResource release failed for some other reason
Example
Code Block
<release plugin="org.openecomp.sdnc.sli.resource.gamma.GammaResource"
         resource="ase-port"
         key="uni_circuit_id == $uni-circuit-id">
  <outcome value="success">
    <return status="success"/>
  </outcome>
  <outcome value="not-found">
    <return status="failure"/>
  </outcome>
  <outcome value="failure">
    <return status="failure"/>
  </outcome>
</release>

Reserve node

Description

reserve node is used to reserve a particular type of resource.. For example, this might be used to reserve a port on a particular switch.

Attributes
pluginFully qualified Java class of resource adaptor to be used
resourceType of resource to reserve
keySQL-like string specifying criteria for reservation
selectString to specify, if key matches multiple entries, which entry should take precedence
Parameters

None

Outcomes
successResource requested was successfully reserved
failureResource requested was not successfully reserved
Example
Code Block
<reserve plugin="org.openecomp.sdnc.sli.resource.gamma.GammaResource"
         resource="ase-port"
         key="resource-emt-clli == $edge-device-clli and speed >= $uni-cir-value"
         select="min(speed)">
  <outcome value="success">
    <return status="success"/>
  </outcome>
  <outcome value="failure">
    <return status="failure"/>
  </outcome>
</reserve>

Save node

Description

save node is used to save information about a particular resource to persistent storage. For example, this might be used to save information about a particular uni-port.

Attributes
pluginFully qualified Java class of resource adaptor to be used
resourceType of resource to save
keySQL-like string specifying criteria for retrieval
forceIf "true", save resource even if this resource is already stored in persistent storage
pfxPrefix to be prepended to variable names, when attributes are set in SvcLogicContext
Parameters

Values to save (columns) are specified as parameters, with each name corresponding to a column name and each value corresponding to the value to set.

Outcomes
successResource successfully saved
failureResource save failed
Example
Code Block
<save plugin="`$gamma-resource-plugin`" resource="vnf"
        key="vnf-name = $requests.vnf.vnf-name" force="true"
        pfx="requests.vnf">
        <parameter name="vnf-name"
                value="`$requests.cust-country-code + $requests.cust-id + $requests.cust-city + $requests.cust-state + '001VCE'`" />
        <parameter name="vnf-type" value="vce" />
        <parameter name="orchestration-status" value="pending-create" />
        <parameter name="heat-stack-id" value="`$requests.heat-stack-id`" />
        <parameter name="mso-catalog-key" value="`$requests.mso-catalog-key`" />
        <parameter name="availability-zone"
                value="`$aic-availability-zone.availability-zone`" />
        <parameter name="aic-site-id" value="`$requests.vnf.aic-site-id`" />
        <parameter name="oam-ipv4-address" value="`$vce-ipv4-oam-addr.ipv4-addr`" />
</save>

Update node

Description

An update node is used to update information about a particular resource to persistent storage.

Attributes
pluginFully qualified Java class of resource adaptor to be used
resourceType of resource to update
keySQL-like string specifying criteria for retrieval
pfxPrefix to be prepended to variable names, when attributes are set in SvcLogicContext
Parameters

Values to save (columns) are specified as parameters, with each name corresponding to a column name and each value corresponding to the value to set.

Outcomes
successResource successfully saved
failureResource save failed
Example
Code Block
<update plugin="`$gamma-resource-plugin`" resource="vnf"
        key="vnf-name = $requests.vnf.vnf-name"
        pfx="requests.vnf">
        <parameter name="vnf-name"
                value="`$requests.cust-country-code + $requests.cust-id + $requests.cust-city + $requests.cust-state + '001VCE'`" />
        <parameter name="vnf-type" value="vce" />
        <parameter name="orchestration-status" value="pending-create" />
        <parameter name="heat-stack-id" value="`$requests.heat-stack-id`" />
        <parameter name="mso-catalog-key" value="`$requests.mso-catalog-key`" />
        <parameter name="availability-zone"
                value="`$aic-availability-zone.availability-zone`" />
        <parameter name="aic-site-id" value="`$requests.vnf.aic-site-id`" />
        <parameter name="oam-ipv4-address" value="`$vce-ipv4-oam-addr.ipv4-addr`" />
</update>

...