2 ~~ ============LICENSE_START=======================================================
4 ~~ ================================================================================
5 ~~ Copyright (C) 2017 ONAP
6 ~~ ================================================================================
7 ~~ Licensed under the Apache License, Version 2.0 (the "License");
8 ~~ you may not use this file except in compliance with the License.
9 ~~ You may obtain a copy of the License at
11 ~~ http://www.apache.org/licenses/LICENSE-2.0
13 ~~ Unless required by applicable law or agreed to in writing, software
14 ~~ distributed under the License is distributed on an "AS IS" BASIS,
15 ~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 ~~ See the License for the specific language governing permissions and
17 ~~ limitations under the License.
18 ~~ ============LICENSE_END=========================================================
22 Service Logic Interpreter
31 The following built-in node types are currently supported:
35 * {{{Block node}<<block>>}}
37 * {{{Call node}<<call>>}}
39 * {{{For node}<<for>>}}
41 * {{{Return node}<<return>>}}
43 * {{{Set node}<<set>>}}
45 * {{{Switch node}<<switch>>}}
49 * {{{Configure node}<<configure>>}}
53 * {{{Execute node}<<execute>>}}
57 * {{{Record node}<<record>>}}
61 * {{{Delete node}<<delete>>}}
63 * {{{Exists node}<<exists>>}}
65 * {{{Get-resource node}<<get-resource>>}}
67 * {{{Is-available node}<<is-available>>}}
69 * {{{Notify node}<<notify>>}}
71 * {{{Release node}<<release>>}}
73 * {{{Reserve node}<<reserve>>}}
75 * {{{Save node}<<save>>}}
77 * {{{Update node}<<update>>}}
86 A <<block>> node is used to executes a set of nodes.
90 *--------------*--------------------------------------------+
91 | <<atomic>> | if <true>, then if a node returns failure, subsequent nodes will not be executed and nodes already executed will be backed out.
92 *--------------*--------------------------------------------+
106 <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
107 <parameter name="file" value="/tmp/sample_r1.log" />
108 <parameter name="field1" value="__TIMESTAMP__"/>
109 <parameter name="field2" value="RESERVED"/>
110 <parameter name="field3" value="$asePort.uni_circuit_id"/>
112 <return status="success">
113 <parameter name="uni-circuit-id" value="$asePort.uni_circuit_id" />
124 A <<call>> node is used to call another graph
128 *--------------*-------+
129 | <<module>> | Module of directed graph to call. If unset, defaults to that of calling graph
130 *--------------*-------+
131 | <<rpc>> | rpc of directed graph to call.
132 *--------------*-------+
133 | <<version>> | version of graph to call, If unset, uses active version.
134 *--------------*-------+
135 | <<mode>> | mode (sync/async) of graph to call. If unset, defaults to that of calling graph.
136 *--------------*-------+
146 *----------*---------+
147 | <<success>> | Sub graph returned success
148 *----------*---------+
149 | <<not-found>> | Graph not found
150 *----------*---------+
151 | <<failure>> | Subgraph returned success
152 *----------*---------+
157 +-------------------+
158 <call rpc="svc-topology-reserve" mode="sync" />
159 +-------------------+
165 A <<for>> node provides a fixed iteration looping mechanism, similar to the Java for loop
169 *--------------*-------+
170 | <<index>> | index variable
171 *--------------*-------+
172 | <<start>> | initial value
173 *--------------*-------+
174 | <<end>> | maximum value
175 *--------------*-------+
184 Not applicable. The <<status>> node has no outcomes.
188 +-------------------+
189 <for index="i" start="0" end="`$service-data.universal-cpe-ft.l2-switch-interfaces_length`">
190 <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
191 <parameter name="logger" value="message-log"/>
192 <parameter name="level" value="info"/>
193 <parameter name="field1" value="`'current l2-switch-interface name is ' + $service-data.universal-cpe-ft.l2-switch-interfaces[$i].name`"/>
196 +-------------------+
202 A <<return>> node is used to return a status to the invoking MD-SAL application
206 *--------------*-------+
207 | <<status>> | Status value to return (<success> or <failure>)
208 *--------------*-------+
213 The following optional parameters may be passed to convey more
214 detailed status information.
216 *------------*-----------+
217 | <<error-code>> | A brief, usually numeric, code indicating the error condition
218 *------------*-----------+
219 | <<error-message>> | A more detailed error message
220 *------------*-----------+
224 Not applicable. The <<status>> node has no outcomes.
228 +-------------------+
229 <return status="failure">
230 <parameter name="error-code" value="1542" />
231 <parameter name="error-message" value="Activation failure" />
233 +-------------------+
239 A <<set>> node is used to set one or more values in the execution context
243 *--------------*-------+
244 | <<only-if-unset>> | If true the set node will only execute if the current value of the target is null
245 *--------------*-------+
249 Values to be set are passed as parameters
253 Not applicable. The <<set>> node has no outcomes.
257 +-------------------+
259 <parameter name="vlan" value="$network.provider-segmentation-id" />
261 +-------------------+
267 A <<switch>> node is used to make a decision based on its <<test>> attribute.
271 *--------------*-------+
272 | <<test>> | Condition to test
273 *--------------*-------+
283 Depends on the <<test>> condition
287 +-------------------+
288 <switch test="$uni-cir-units">
289 <outcome value="Mbps">
290 <reserve plugin="org.onap.ccsdk.sli.adaptors.samplesvc.SampleServiceResource"
292 key="resource-emt-clli == $edge-device-clli and speed >= $uni-cir-value"
295 <outcome value="success">
296 <return status="success">
297 <parameter name="uni-circuit-id" value="$asePort.uni_circuit_id" />
300 <outcome value="Other">
301 <return status="failure">
302 <parameter name="error-code" value="1010" />
303 <parameter name="error-message" value="No ports found that match criteria" />
308 <outcome value="Gbps">
309 <reserve plugin="org.onap.ccsdk.sli.adaptors.samplesvc.SampleServiceResource"
311 key="resource-emt-clli == $edge-device-clli and speed >= $uni-cir-value*1000"
314 <outcome value="success">
315 <return status="success">
316 <parameter name="uni-circuit-id" value="$asePort.uni_circuit_id" />
319 <outcome value="Other">
320 <return status="failure">
321 <parameter name="error-code" value="1010" />
322 <parameter name="error-message" value="No ports found that match criteria" />
328 +-------------------+
336 A <<configure>> node is used to configure a device.
340 *--------------*-------+
341 | <<adaptor>> | Fully qualified Java class of resource adaptor to be used
342 *--------------*-------+
343 | <<activate>> | Activate device/interface, for devices that support a separate activation step.
344 *--------------*-------+
345 | <<key>> | SQL-like string specifying criteria for item to configure
346 *--------------*-------+
350 Specific to device adaptor.
354 *-----------*-------+
355 | <<success>> | Device successfully configured
356 *-----------*-------+
357 | <<not-found>> | Element to be configured does not exist.
358 *-----------*--------+
359 | <<not-ready>> | Element is not in a state where it can be configured/activated
360 *-----------*-------+
361 | <<already-active>> | Attempt to activate element that is already active
362 *-----------*-------+
363 | <<failure>> | Configure failed for some other reason
364 *-----------*-------+
368 +-------------------+
369 <configure adaptor="org.onap.ccsdk.sli.adaptors.emt.EmtAdaptor"
370 key="$uni-circuit-id" activate="true">
371 <parameter name="circuit.id" value="$uni-circuit-id" />
372 <parameter name="subscriber.name" value="$subscriber-name" />
373 <parameter name="emt.clli" value="$edge-device-clli" />
374 <parameter name="port.tagging" value="$port-tagging" />
375 <parameter name="port.mediaSpeed" value="$media-speed" />
376 <parameter name="location.state" value="$uni-location-state" />
377 <parameter name="location.city" value="$uni-location-city" />
378 <parameter name="cosCategory" value="$cos-category" />
379 <parameter name="gosProfile" value="$gos-profile" />
380 <parameter name="lldp" value="$asePort.resource-lldp" />
381 <parameter name="mtu" value="$asePort.resource-mtu" />
382 <outcome value="success">
384 <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
385 <parameter name="file" value="/tmp/sample_r1.log" />
386 <parameter name="field1" value="__TIMESTAMP__"/>
387 <parameter name="field2" value="ACTIVE"/>
388 <parameter name="field3" value="$uni-circuit-id"/>
390 <return status="success">
391 <parameter name="edge-device-clli" value="$asePort.resource-emt-clli" />
395 <outcome value="already-active">
396 <return status="failure">
397 <parameter name="error-code" value="1590" />
398 <parameter name="error-message" value="Port already active" />
401 <outcome value="Other">
402 <return status="failure">
403 <parameter name="error-code" value="1542" />
404 <parameter name="error-message" value="Activation failure" />
408 +-------------------+
410 * Java Plugin Support
416 An <<execute>> node is used to execute Java code supplied as a plugin
420 *--------------*-------+
421 | <<plugin>> | Fully qualified Java class of plugin to be used
422 *--------------*-------+
423 | <<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)
424 *--------------*-------+
428 Specific to plugin / method
432 *-----------*-------+
433 | <<success>> | Device successfully configured
434 *-----------*-------+
435 | <<not-found>> | Plugin class could not be loaded
436 *-----------*--------+
437 | <<unsupported-method>> | Named method taking (Map, SvcLogicContext) could not be found
438 *-----------*-------+
439 | <<failure>> | Configure failed for some other reason
440 *-----------*-------+
444 +-------------------+
445 <execute plugin="org.onap.ccsdk.sli.plugins.HelloWorld"
447 <parameter name="message" value="Hello, world!" />
448 <outcome value="success">
449 <return status="success"/>
451 <outcome value="not-found">
452 <return status="failure">
453 <parameter name="error-code" value="1590" />
454 <parameter name="error-message" value="Could not locate plugin" />
457 <outcome value="Other">
458 <return status="failure">
459 <parameter name="error-code" value="1542" />
460 <parameter name="error-message" value="Internal error" />
464 +-------------------+
472 A <<record>> node is used to record an event. For example, this might be used
473 to log provisioning events.
477 *--------------*-------+
478 | <<plugin>> | Fully qualified Java class to handle recording.
479 *--------------*-------+
484 Parameters will depend on the plugin being used. For the FileRecorder class,
485 the parameters are as follows
487 *------------*-----------+
488 | <<file>> | The file to which the record should be written
489 *------------*-----------+
490 | <<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
491 *------------*-----------+
496 *----------*---------+
497 | <<success>> | Record successfully written
498 *----------*---------+
499 | <<failure>> | Record could not be successfully written
500 *----------*---------+
504 +-------------------+
505 <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
506 <parameter name="file" value="/tmp/sample_r1.log" />
507 <parameter name="field1" value="__TIMESTAMP__"/>
508 <parameter name="field2" value="ACTIVE"/>
509 <parameter name="field3" value="$uni-circuit-id"/>
511 +-------------------+
513 * Resource Management
519 A <<delete>> node is used to delete a resource from the local resource inventory.
523 *--------------*-------+
524 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
525 *--------------*-------+
526 | <<resource>> | Type of resource to delete
527 *--------------*-------+
528 | <<key>> | SQL-like string specifying key to delete
529 *--------------*-------+
537 *-----------*-------+
538 | <<success>> | Resource specified deleted successfully.
539 *-----------*-------+
540 | <failure>> | Resource specified was not deleted
541 *-----------*-------+
545 +-------------------+
546 <delete plugin="org.onap.ccsdk.sli.adaptors.samplesvc.SampleServiceResource"
548 key="uni_circuit_id == $uni-circuit-id">
549 <outcome value="true">
550 <return status="success"/>
552 <outcome value="false">
553 <return status="failure"/>
556 +-------------------+
563 An <<exists>> node is used to determine whether a particular
564 instance of a resource exists. For example, this might be
565 used to test whether a particular switch CLLI is provisioned.
569 *--------------*-------+
570 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
571 *--------------*-------+
572 | <<resource>> | Type of resource to check
573 *--------------*-------+
574 | <<key>> | SQL-like string specifying key to check for
575 *--------------*-------+
583 *-----------*-------+
584 | <<true>> | Resource specified exists.
585 *-----------*-------+
586 | <<false>> | Resource specified is unknown
587 *-----------*-------+
591 +-------------------+
592 <exists plugin="org.onap.ccsdk.sli.adaptors.samplesvc.SampleServiceResource"
594 key="uni_circuit_id == $uni-circuit-id">
595 <outcome value="true">
596 <return status="success"/>
598 <outcome value="false">
599 <return status="failure"/>
602 +-------------------+
608 A <<get-resource>> node is used to retrieve information about a
609 particular resource and make it available to other nodes in the
610 service logic tree. For example, this might be used to
611 retrieve information about a particular uni-port.
615 *--------------*-------+
616 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
617 *--------------*-------+
618 | <<resource>> | Type of resource to retrieve
619 *--------------*-------+
620 | <<key>> | SQL-like string specifying criteria for retrieval
621 *--------------*-------+
622 | <<pfx>> | Prefix to add to context variable names set for data retrieved
623 *--------------*-------+
624 | <<select>> | String to specify, if key matches multiple entries, which entry should take precedence
625 *--------------*-------+
626 | <<order-by>> | Prefix to add to context variable names set for data retrieved
627 *--------------*-------+
636 *-----------*-------+
637 | <<success>> | Resource successfully retrieved
638 *-----------*-------+
639 | <<not-found>> | Resource referenced does not exist
640 *-----------*-------+
641 | <<failure>> | Resource retrieve failed for some other reason
642 *-----------*-------+
646 +-------------------+
647 <get-resource plugin="org.onap.ccsdk.sli.adaptors.samplesvc.SampleServiceResource"
649 key="uni_circuit_id == $uni-circuit-id"
651 <outcome value="success">
652 <return status="success"/>
654 <outcome value="not-found">
655 <return status="failure"/>
657 <outcome value="failure">
658 <return status="failure"/>
661 +-------------------+
667 An <<is-available>> node is used to determine whether a particular
668 type of resource is available. For example, this might be used to
669 test whether any ports are available for assignment on a particular switch.
673 *--------------*-------+
674 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
675 *--------------*-------+
676 | <<resource>> | Type of resource to check
677 *--------------*-------+
678 | <<key>> | SQL-like string specifying key to check for
679 *--------------*-------+
680 | <<pfx>> | Prefix to add to context variable names set for data retrieved
681 *--------------*-------+
689 *-----------*-------+
690 | <<true>> | Resource requested is available
691 *-----------*-------+
692 | <<false>> | Resource requested is not available
693 *-----------*-------+
697 +-------------------+
698 <is-available plugin="org.onap.ccsdk.sli.adaptors.samplesvc.SampleServiceResource"
700 key="resource-emt-clli == $edge-device-clli and speed >= $uni-cir-value">
701 <outcome value="true">
702 <return status="success"/>
704 <outcome value="false">
705 <return status="failure"/>
708 +-------------------+
714 A <<notify>> node is used to inform an external application (e.g. A&AI) that a resource was
719 *--------------*-------+
720 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
721 *--------------*-------+
722 | <<resource>> | Identifies resource that was updated
723 *--------------*-------+
724 | <<action>> | Action that triggered notification to be sent (ADD/UPDATE/DELETE)
725 *--------------*-------+
733 *-----------*-------+
734 | <<success>> | Notification was successful
735 *-----------*-------+
736 | <<failure>> | Notification failed is not available
737 *-----------*-------+
741 +-------------------+
742 <notify plugin="org.onap.ccsdk.sli.adaptors.samplesvc.SampleServiceResource"
745 <outcome value="success">
746 <return status="success"/>
748 <outcome value="Other">
749 <return status="failure"/>
752 +-------------------+
758 A <<release>> node is used to mark a resource as no longer in use, and thus
759 available for assignment.
763 *--------------*-------+
764 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
765 *--------------*-------+
766 | <<resource>> | Type of resource to release
767 *--------------*-------+
768 | <<key>> | SQL-like string specifying key to check of resource to release
769 *--------------*-------+
777 *-----------*-------+
778 | <<success>> | Resource successfully released
779 *-----------*-------+
780 | <<not-found>> | Resource referenced does not exist
781 *-----------*-------+
782 | <<failure>> | Resource release failed for some other reason
783 *-----------*-------+
787 +-------------------+
788 <release plugin="org.onap.ccsdk.sli.adaptors.SampleServiceResource"
790 key="uni_circuit_id == $uni-circuit-id">
791 <outcome value="success">
792 <return status="success"/>
794 <outcome value="not-found">
795 <return status="failure"/>
797 <outcome value="failure">
798 <return status="failure"/>
801 +-------------------+
808 A <<reserve>> node is used to reserve a particular
809 type of resource.. For example, this might be used to
810 reserve a port on a particular switch.
814 *--------------*-------+
815 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
816 *--------------*-------+
817 | <<resource>> | Type of resource to reserve
818 *--------------*-------+
819 | <<key>> | SQL-like string specifying criteria for reservation
820 *--------------*-------+
821 | <<select>> | String to specify, if <<key>> matches multiple entries, which entry should take precedence
822 *--------------*-------+
830 *-----------*-------+
831 | <<success>> | Resource requested was successfully reserved
832 *-----------*-------+
833 | <<failure>> | Resource requested was not successfully reserved
834 *-----------*-------+
838 +-------------------+
839 <reserve plugin="org.onap.ccsdk.sli.adaptors.samplesvc.SampleServiceResource"
841 key="resource-emt-clli == $edge-device-clli and speed >= $uni-cir-value"
843 <outcome value="success">
844 <return status="success"/>
846 <outcome value="failure">
847 <return status="failure"/>
850 +-------------------+
856 A <<save>> node is used to save information about a
857 particular resource to persistent storage. For example, this might be used to
858 save information about a particular uni-port.
862 *--------------*-------+
863 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
864 *--------------*-------+
865 | <<resource>> | Type of resource to save
866 *--------------*-------+
867 | <<key>> | SQL-like string specifying criteria for retrieval
868 *--------------*-------+
869 | <<force>> | If "true", save resource even if this resource is already stored in persistent storage
870 *--------------*-------+
871 | <<pfx>> | Prefix to be prepended to variable names, when attributes are set in SvcLogicContext
872 *--------------*-------+
876 Values to save (columns) are specified as parameters, with each name
877 corresponding to a column name and each value corresponding to the
882 *-----------*-------+
883 | <<success>> | Resource successfully saved
884 *-----------*-------+
885 | <<failure>> | Resource save failed
886 *-----------*-------+
890 +-------------------+
891 <save plugin="`$sample-resource-plugin`" resource="vnf"
892 key="vnf-name = $requests.vnf.vnf-name" force="true"
894 <parameter name="vnf-name"
895 value="`$requests.cust-country-code + $requests.cust-id + $requests.cust-city + $requests.cust-state + '001VCE'`" />
896 <parameter name="vnf-type" value="vce" />
897 <parameter name="orchestration-status" value="pending-create" />
898 <parameter name="heat-stack-id" value="`$requests.heat-stack-id`" />
899 <parameter name="mso-catalog-key" value="`$requests.mso-catalog-key`" />
900 <parameter name="oam-ipv4-address" value="`$vce-ipv4-oam-addr.ipv4-addr`" />
902 +-------------------+
908 An <<update>> node is used to update information about a
909 particular resource to persistent storage.
913 *--------------*-------+
914 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
915 *--------------*-------+
916 | <<resource>> | Type of resource to update
917 *--------------*-------+
918 | <<key>> | SQL-like string specifying criteria for retrieval
919 *--------------*-------+
920 | <<pfx>> | Prefix to be prepended to variable names, when attributes are set in SvcLogicContext
921 *--------------*-------+
925 Values to save (columns) are specified as parameters, with each name
926 corresponding to a column name and each value corresponding to the
931 *-----------*-------+
932 | <<success>> | Resource successfully saved
933 *-----------*-------+
934 | <<failure>> | Resource save failed
935 *-----------*-------+
939 +-------------------+
940 <update plugin="`$sample-resource-plugin`" resource="vnf"
941 key="vnf-name = $requests.vnf.vnf-name"
943 <parameter name="vnf-name"
944 value="`$requests.cust-country-code + $requests.cust-id + $requests.cust-city + $requests.cust-state + '001VCE'`" />
945 <parameter name="vnf-type" value="vce" />
946 <parameter name="orchestration-status" value="pending-create" />
947 <parameter name="heat-stack-id" value="`$requests.heat-stack-id`" />
948 <parameter name="mso-catalog-key" value="`$requests.mso-catalog-key`" />
949 <parameter name="oam-ipv4-address" value="`$vce-ipv4-oam-addr.ipv4-addr`" />
951 +-------------------+