2 ~~ ============LICENSE_START=======================================================
4 ~~ ================================================================================
5 ~~ Copyright (C) 2017 AT&T Intellectual Property. All rights
7 ~~ ================================================================================
8 ~~ Licensed under the Apache License, Version 2.0 (the "License");
9 ~~ you may not use this file except in compliance with the License.
10 ~~ You may obtain a copy of the License at
12 ~~ http://www.apache.org/licenses/LICENSE-2.0
14 ~~ Unless required by applicable law or agreed to in writing, software
15 ~~ distributed under the License is distributed on an "AS IS" BASIS,
16 ~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 ~~ See the License for the specific language governing permissions and
18 ~~ limitations under the License.
19 ~~ ============LICENSE_END=========================================================
23 Service Logic Interpreter
32 The following built-in node types are currently supported:
36 * {{{Block node}<<block>>}}
38 * {{{Call node}<<call>>}}
40 * {{{For node}<<for>>}}
42 * {{{Return node}<<return>>}}
44 * {{{Set node}<<set>>}}
46 * {{{Switch node}<<switch>>}}
50 * {{{Configure node}<<configure>>}}
54 * {{{Execute node}<<execute>>}}
58 * {{{Record node}<<record>>}}
62 * {{{Delete node}<<delete>>}}
64 * {{{Exists node}<<exists>>}}
66 * {{{Get-resource node}<<get-resource>>}}
68 * {{{Is-available node}<<is-available>>}}
70 * {{{Notify node}<<notify>>}}
72 * {{{Release node}<<release>>}}
74 * {{{Reserve node}<<reserve>>}}
76 * {{{Save node}<<save>>}}
78 * {{{Update node}<<update>>}}
87 A <<block>> node is used to executes a set of nodes.
91 *--------------*--------------------------------------------+
92 | <<atomic>> | if <true>, then if a node returns failure, subsequent nodes will not be executed and nodes already executed will be backed out.
93 *--------------*--------------------------------------------+
107 <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
108 <parameter name="file" value="/tmp/sample_r1.log" />
109 <parameter name="field1" value="__TIMESTAMP__"/>
110 <parameter name="field2" value="RESERVED"/>
111 <parameter name="field3" value="$asePort.uni_circuit_id"/>
113 <return status="success">
114 <parameter name="uni-circuit-id" value="$asePort.uni_circuit_id" />
125 A <<call>> node is used to call another graph
129 *--------------*-------+
130 | <<module>> | Module of directed graph to call. If unset, defaults to that of calling graph
131 *--------------*-------+
132 | <<rpc>> | rpc of directed graph to call.
133 *--------------*-------+
134 | <<version>> | version of graph to call, If unset, uses active version.
135 *--------------*-------+
136 | <<mode>> | mode (sync/async) of graph to call. If unset, defaults to that of calling graph.
137 *--------------*-------+
147 *----------*---------+
148 | <<success>> | Sub graph returned success
149 *----------*---------+
150 | <<not-found>> | Graph not found
151 *----------*---------+
152 | <<failure>> | Subgraph returned success
153 *----------*---------+
158 +-------------------+
159 <call rpc="svc-topology-reserve" mode="sync" />
160 +-------------------+
166 A <<for>> node provides a fixed iteration looping mechanism, similar to the Java for loop
170 *--------------*-------+
171 | <<index>> | index variable
172 *--------------*-------+
173 | <<start>> | initial value
174 *--------------*-------+
175 | <<end>> | maximum value
176 *--------------*-------+
185 Not applicable. The <<status>> node has no outcomes.
189 +-------------------+
190 <for index="i" start="0" end="`$service-data.universal-cpe-ft.l2-switch-interfaces_length`">
191 <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
192 <parameter name="logger" value="message-log"/>
193 <parameter name="level" value="info"/>
194 <parameter name="field1" value="`'current l2-switch-interface name is ' + $service-data.universal-cpe-ft.l2-switch-interfaces[$i].name`"/>
197 +-------------------+
203 A <<return>> node is used to return a status to the invoking MD-SAL application
207 *--------------*-------+
208 | <<status>> | Status value to return (<success> or <failure>)
209 *--------------*-------+
214 The following optional parameters may be passed to convey more
215 detailed status information.
217 *------------*-----------+
218 | <<error-code>> | A brief, usually numeric, code indicating the error condition
219 *------------*-----------+
220 | <<error-message>> | A more detailed error message
221 *------------*-----------+
225 Not applicable. The <<status>> node has no outcomes.
229 +-------------------+
230 <return status="failure">
231 <parameter name="error-code" value="1542" />
232 <parameter name="error-message" value="Activation failure" />
234 +-------------------+
240 A <<set>> node is used to set one or more values in the execution context
244 *--------------*-------+
245 | <<only-if-unset>> | If true the set node will only execute if the current value of the target is null
246 *--------------*-------+
250 Values to be set are passed as parameters
254 Not applicable. The <<set>> node has no outcomes.
258 +-------------------+
260 <parameter name="vlan" value="$network.provider-segmentation-id" />
262 +-------------------+
268 A <<switch>> node is used to make a decision based on its <<test>> attribute.
272 *--------------*-------+
273 | <<test>> | Condition to test
274 *--------------*-------+
284 Depends on the <<test>> condition
288 +-------------------+
289 <switch test="$uni-cir-units">
290 <outcome value="Mbps">
291 <reserve plugin="org.onap.ccsdk.sli.adaptors.samplesvc.SampleServiceResource"
293 key="resource-emt-clli == $edge-device-clli and speed >= $uni-cir-value"
296 <outcome value="success">
297 <return status="success">
298 <parameter name="uni-circuit-id" value="$asePort.uni_circuit_id" />
301 <outcome value="Other">
302 <return status="failure">
303 <parameter name="error-code" value="1010" />
304 <parameter name="error-message" value="No ports found that match criteria" />
309 <outcome value="Gbps">
310 <reserve plugin="org.onap.ccsdk.sli.adaptors.samplesvc.SampleServiceResource"
312 key="resource-emt-clli == $edge-device-clli and speed >= $uni-cir-value*1000"
315 <outcome value="success">
316 <return status="success">
317 <parameter name="uni-circuit-id" value="$asePort.uni_circuit_id" />
320 <outcome value="Other">
321 <return status="failure">
322 <parameter name="error-code" value="1010" />
323 <parameter name="error-message" value="No ports found that match criteria" />
329 +-------------------+
337 A <<configure>> node is used to configure a device.
341 *--------------*-------+
342 | <<adaptor>> | Fully qualified Java class of resource adaptor to be used
343 *--------------*-------+
344 | <<activate>> | Activate device/interface, for devices that support a separate activation step.
345 *--------------*-------+
346 | <<key>> | SQL-like string specifying criteria for item to configure
347 *--------------*-------+
351 Specific to device adaptor.
355 *-----------*-------+
356 | <<success>> | Device successfully configured
357 *-----------*-------+
358 | <<not-found>> | Element to be configured does not exist.
359 *-----------*--------+
360 | <<not-ready>> | Element is not in a state where it can be configured/activated
361 *-----------*-------+
362 | <<already-active>> | Attempt to activate element that is already active
363 *-----------*-------+
364 | <<failure>> | Configure failed for some other reason
365 *-----------*-------+
369 +-------------------+
370 <configure adaptor="org.onap.ccsdk.sli.adaptors.emt.EmtAdaptor"
371 key="$uni-circuit-id" activate="true">
372 <parameter name="circuit.id" value="$uni-circuit-id" />
373 <parameter name="subscriber.name" value="$subscriber-name" />
374 <parameter name="emt.clli" value="$edge-device-clli" />
375 <parameter name="port.tagging" value="$port-tagging" />
376 <parameter name="port.mediaSpeed" value="$media-speed" />
377 <parameter name="location.state" value="$uni-location-state" />
378 <parameter name="location.city" value="$uni-location-city" />
379 <parameter name="cosCategory" value="$cos-category" />
380 <parameter name="gosProfile" value="$gos-profile" />
381 <parameter name="lldp" value="$asePort.resource-lldp" />
382 <parameter name="mtu" value="$asePort.resource-mtu" />
383 <outcome value="success">
385 <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
386 <parameter name="file" value="/tmp/sample_r1.log" />
387 <parameter name="field1" value="__TIMESTAMP__"/>
388 <parameter name="field2" value="ACTIVE"/>
389 <parameter name="field3" value="$uni-circuit-id"/>
391 <return status="success">
392 <parameter name="edge-device-clli" value="$asePort.resource-emt-clli" />
396 <outcome value="already-active">
397 <return status="failure">
398 <parameter name="error-code" value="1590" />
399 <parameter name="error-message" value="Port already active" />
402 <outcome value="Other">
403 <return status="failure">
404 <parameter name="error-code" value="1542" />
405 <parameter name="error-message" value="Activation failure" />
409 +-------------------+
411 * Java Plugin Support
417 An <<execute>> node is used to execute Java code supplied as a plugin
421 *--------------*-------+
422 | <<plugin>> | Fully qualified Java class of plugin to be used
423 *--------------*-------+
424 | <<method>> | Name 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)
425 *--------------*-------+
429 Specific to plugin / method
433 *-----------*-------+
434 | <<success>> | Device successfully configured
435 *-----------*-------+
436 | <<not-found>> | Plugin class could not be loaded
437 *-----------*--------+
438 | <<unsupported-method>> | Named method taking (Map, SvcLogicContext) could not be found
439 *-----------*-------+
440 | <<failure>> | Configure failed for some other reason
441 *-----------*-------+
445 +-------------------+
446 <execute plugin="org.onap.ccsdk.sli.plugins.HelloWorld"
448 <parameter name="message" value="Hello, world!" />
449 <outcome value="success">
450 <return status="success"/>
452 <outcome value="not-found">
453 <return status="failure">
454 <parameter name="error-code" value="1590" />
455 <parameter name="error-message" value="Could not locate plugin" />
458 <outcome value="Other">
459 <return status="failure">
460 <parameter name="error-code" value="1542" />
461 <parameter name="error-message" value="Internal error" />
465 +-------------------+
473 A <<record>> node is used to record an event. For example, this might be used
474 to log provisioning events.
478 *--------------*-------+
479 | <<plugin>> | Fully qualified Java class to handle recording.
480 *--------------*-------+
485 Parameters will depend on the plugin being used. For the FileRecorder class,
486 the parameters are as follows
488 *------------*-----------+
489 | <<file>> | The file to which the record should be written
490 *------------*-----------+
491 | <<field1>> | First 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
492 *------------*-----------+
497 *----------*---------+
498 | <<success>> | Record successfully written
499 *----------*---------+
500 | <<failure>> | Record could not be successfully written
501 *----------*---------+
505 +-------------------+
506 <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
507 <parameter name="file" value="/tmp/sample_r1.log" />
508 <parameter name="field1" value="__TIMESTAMP__"/>
509 <parameter name="field2" value="ACTIVE"/>
510 <parameter name="field3" value="$uni-circuit-id"/>
512 +-------------------+
514 * Resource Management
520 A <<delete>> node is used to delete a resource from the local resource inventory.
524 *--------------*-------+
525 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
526 *--------------*-------+
527 | <<resource>> | Type of resource to delete
528 *--------------*-------+
529 | <<key>> | SQL-like string specifying key to delete
530 *--------------*-------+
538 *-----------*-------+
539 | <<success>> | Resource specified deleted successfully.
540 *-----------*-------+
541 | <failure>> | Resource specified was not deleted
542 *-----------*-------+
546 +-------------------+
547 <delete plugin="org.onap.ccsdk.sli.adaptors.samplesvc.SampleServiceResource"
549 key="uni_circuit_id == $uni-circuit-id">
550 <outcome value="true">
551 <return status="success"/>
553 <outcome value="false">
554 <return status="failure"/>
557 +-------------------+
564 An <<exists>> node is used to determine whether a particular
565 instance of a resource exists. For example, this might be
566 used to test whether a particular switch CLLI is provisioned.
570 *--------------*-------+
571 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
572 *--------------*-------+
573 | <<resource>> | Type of resource to check
574 *--------------*-------+
575 | <<key>> | SQL-like string specifying key to check for
576 *--------------*-------+
584 *-----------*-------+
585 | <<true>> | Resource specified exists.
586 *-----------*-------+
587 | <<false>> | Resource specified is unknown
588 *-----------*-------+
592 +-------------------+
593 <exists plugin="org.onap.ccsdk.sli.adaptors.samplesvc.SampleServiceResource"
595 key="uni_circuit_id == $uni-circuit-id">
596 <outcome value="true">
597 <return status="success"/>
599 <outcome value="false">
600 <return status="failure"/>
603 +-------------------+
609 A <<get-resource>> node is used to retrieve information about a
610 particular resource and make it available to other nodes in the
611 service logic tree. For example, this might be used to
612 retrieve information about a particular uni-port.
616 *--------------*-------+
617 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
618 *--------------*-------+
619 | <<resource>> | Type of resource to retrieve
620 *--------------*-------+
621 | <<key>> | SQL-like string specifying criteria for retrieval
622 *--------------*-------+
623 | <<pfx>> | Prefix to add to context variable names set for data retrieved
624 *--------------*-------+
625 | <<select>> | String to specify, if key matches multiple entries, which entry should take precedence
626 *--------------*-------+
627 | <<order-by>> | Prefix to add to context variable names set for data retrieved
628 *--------------*-------+
637 *-----------*-------+
638 | <<success>> | Resource successfully retrieved
639 *-----------*-------+
640 | <<not-found>> | Resource referenced does not exist
641 *-----------*-------+
642 | <<failure>> | Resource retrieve failed for some other reason
643 *-----------*-------+
647 +-------------------+
648 <get-resource plugin="org.onap.ccsdk.sli.adaptors.samplesvc.SampleServiceResource"
650 key="uni_circuit_id == $uni-circuit-id"
652 <outcome value="success">
653 <return status="success"/>
655 <outcome value="not-found">
656 <return status="failure"/>
658 <outcome value="failure">
659 <return status="failure"/>
662 +-------------------+
668 An <<is-available>> node is used to determine whether a particular
669 type of resource is available. For example, this might be used to
670 test whether any ports are available for assignment on a particular switch.
674 *--------------*-------+
675 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
676 *--------------*-------+
677 | <<resource>> | Type of resource to check
678 *--------------*-------+
679 | <<key>> | SQL-like string specifying key to check for
680 *--------------*-------+
681 | <<pfx>> | Prefix to add to context variable names set for data retrieved
682 *--------------*-------+
690 *-----------*-------+
691 | <<true>> | Resource requested is available
692 *-----------*-------+
693 | <<false>> | Resource requested is not available
694 *-----------*-------+
698 +-------------------+
699 <is-available plugin="org.onap.ccsdk.sli.adaptors.samplesvc.SampleServiceResource"
701 key="resource-emt-clli == $edge-device-clli and speed >= $uni-cir-value">
702 <outcome value="true">
703 <return status="success"/>
705 <outcome value="false">
706 <return status="failure"/>
709 +-------------------+
715 A <<notify>> node is used to inform an external application (e.g. A&AI) that a resource was
720 *--------------*-------+
721 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
722 *--------------*-------+
723 | <<resource>> | Identifies resource that was updated
724 *--------------*-------+
725 | <<action>> | Action that triggered notification to be sent (ADD/UPDATE/DELETE)
726 *--------------*-------+
734 *-----------*-------+
735 | <<success>> | Notification was successful
736 *-----------*-------+
737 | <<failure>> | Notification failed is not available
738 *-----------*-------+
742 +-------------------+
743 <notify plugin="org.onap.ccsdk.sli.adaptors.samplesvc.SampleServiceResource"
746 <outcome value="success">
747 <return status="success"/>
749 <outcome value="Other">
750 <return status="failure"/>
753 +-------------------+
759 A <<release>> node is used to mark a resource as no longer in use, and thus
760 available for assignment.
764 *--------------*-------+
765 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
766 *--------------*-------+
767 | <<resource>> | Type of resource to release
768 *--------------*-------+
769 | <<key>> | SQL-like string specifying key to check of resource to release
770 *--------------*-------+
778 *-----------*-------+
779 | <<success>> | Resource successfully released
780 *-----------*-------+
781 | <<not-found>> | Resource referenced does not exist
782 *-----------*-------+
783 | <<failure>> | Resource release failed for some other reason
784 *-----------*-------+
788 +-------------------+
789 <release plugin="org.onap.ccsdk.sli.adaptors.SampleServiceResource"
791 key="uni_circuit_id == $uni-circuit-id">
792 <outcome value="success">
793 <return status="success"/>
795 <outcome value="not-found">
796 <return status="failure"/>
798 <outcome value="failure">
799 <return status="failure"/>
802 +-------------------+
809 A <<reserve>> node is used to reserve a particular
810 type of resource.. For example, this might be used to
811 reserve a port on a particular switch.
815 *--------------*-------+
816 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
817 *--------------*-------+
818 | <<resource>> | Type of resource to reserve
819 *--------------*-------+
820 | <<key>> | SQL-like string specifying criteria for reservation
821 *--------------*-------+
822 | <<select>> | String to specify, if <<key>> matches multiple entries, which entry should take precedence
823 *--------------*-------+
831 *-----------*-------+
832 | <<success>> | Resource requested was successfully reserved
833 *-----------*-------+
834 | <<failure>> | Resource requested was not successfully reserved
835 *-----------*-------+
839 +-------------------+
840 <reserve plugin="org.onap.ccsdk.sli.adaptors.samplesvc.SampleServiceResource"
842 key="resource-emt-clli == $edge-device-clli and speed >= $uni-cir-value"
844 <outcome value="success">
845 <return status="success"/>
847 <outcome value="failure">
848 <return status="failure"/>
851 +-------------------+
857 A <<save>> node is used to save information about a
858 particular resource to persistent storage. For example, this might be used to
859 save information about a particular uni-port.
863 *--------------*-------+
864 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
865 *--------------*-------+
866 | <<resource>> | Type of resource to save
867 *--------------*-------+
868 | <<key>> | SQL-like string specifying criteria for retrieval
869 *--------------*-------+
870 | <<force>> | If "true", save resource even if this resource is already stored in persistent storage
871 *--------------*-------+
872 | <<pfx>> | Prefix to be prepended to variable names, when attributes are set in SvcLogicContext
873 *--------------*-------+
877 Values to save (columns) are specified as parameters, with each name
878 corresponding to a column name and each value corresponding to the
883 *-----------*-------+
884 | <<success>> | Resource successfully saved
885 *-----------*-------+
886 | <<failure>> | Resource save failed
887 *-----------*-------+
891 +-------------------+
892 <save plugin="`$sample-resource-plugin`" resource="vnf"
893 key="vnf-name = $requests.vnf.vnf-name" force="true"
895 <parameter name="vnf-name"
896 value="`$requests.cust-country-code + $requests.cust-id + $requests.cust-city + $requests.cust-state + '001VCE'`" />
897 <parameter name="vnf-type" value="vce" />
898 <parameter name="orchestration-status" value="pending-create" />
899 <parameter name="heat-stack-id" value="`$requests.heat-stack-id`" />
900 <parameter name="mso-catalog-key" value="`$requests.mso-catalog-key`" />
901 <parameter name="oam-ipv4-address" value="`$vce-ipv4-oam-addr.ipv4-addr`" />
903 +-------------------+
909 An <<update>> node is used to update information about a
910 particular resource to persistent storage.
914 *--------------*-------+
915 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
916 *--------------*-------+
917 | <<resource>> | Type of resource to update
918 *--------------*-------+
919 | <<key>> | SQL-like string specifying criteria for retrieval
920 *--------------*-------+
921 | <<pfx>> | Prefix to be prepended to variable names, when attributes are set in SvcLogicContext
922 *--------------*-------+
926 Values to save (columns) are specified as parameters, with each name
927 corresponding to a column name and each value corresponding to the
932 *-----------*-------+
933 | <<success>> | Resource successfully saved
934 *-----------*-------+
935 | <<failure>> | Resource save failed
936 *-----------*-------+
940 +-------------------+
941 <update plugin="`$sample-resource-plugin`" resource="vnf"
942 key="vnf-name = $requests.vnf.vnf-name"
944 <parameter name="vnf-name"
945 value="`$requests.cust-country-code + $requests.cust-id + $requests.cust-city + $requests.cust-state + '001VCE'`" />
946 <parameter name="vnf-type" value="vce" />
947 <parameter name="orchestration-status" value="pending-create" />
948 <parameter name="heat-stack-id" value="`$requests.heat-stack-id`" />
949 <parameter name="mso-catalog-key" value="`$requests.mso-catalog-key`" />
950 <parameter name="oam-ipv4-address" value="`$vce-ipv4-oam-addr.ipv4-addr`" />
952 +-------------------+