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.openecomp.sdnc.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="$network.num-segments">
192 <parameter name="$vlanlist" value="eval($vlanlist+','+$network.segment[i].provider-segmentation-id)"/>
195 +-------------------+
201 A <<return>> node is used to return a status to the invoking MD-SAL application
205 *--------------*-------+
206 | <<status>> | Status value to return (<success> or <failure>)
207 *--------------*-------+
212 The following optional parameters may be passed to convey more
213 detailed status information.
215 *------------*-----------+
216 | <<error-code>> | A brief, usually numeric, code indicating the error condition
217 *------------*-----------+
218 | <<error-message>> | A more detailed error message
219 *------------*-----------+
223 Not applicable. The <<status>> node has no outcomes.
227 +-------------------+
228 <return status="failure">
229 <parameter name="error-code" value="1542" />
230 <parameter name="error-message" value="Activation failure" />
232 +-------------------+
238 A <<set>> node is used to set one or more values in the execution context
242 *--------------*-------+
243 | <<only-if-unset>> | If true the set node will only execute if the current value of the target is null
244 *--------------*-------+
248 Values to be set are passed as parameters
252 Not applicable. The <<set>> node has no outcomes.
256 +-------------------+
258 <parameter name="vlan" value="$network.provider-segmentation-id" />
260 +-------------------+
266 A <<switch>> node is used to make a decision based on its <<test>> attribute.
270 *--------------*-------+
271 | <<test>> | Condition to test
272 *--------------*-------+
282 Depends on the <<test>> condition
286 +-------------------+
287 <switch test="$uni-cir-units">
288 <outcome value="Mbps">
289 <reserve plugin="org.openecomp.sdnc.sli.resource.samplesvc.SampleServiceResource"
291 key="resource-emt-clli == $edge-device-clli and speed >= $uni-cir-value"
294 <outcome value="success">
295 <return status="success">
296 <parameter name="uni-circuit-id" value="$asePort.uni_circuit_id" />
299 <outcome value="Other">
300 <return status="failure">
301 <parameter name="error-code" value="1010" />
302 <parameter name="error-message" value="No ports found that match criteria" />
307 <outcome value="Gbps">
308 <reserve plugin="org.openecomp.sdnc.sli.resource.samplesvc.SampleServiceResource"
310 key="resource-emt-clli == $edge-device-clli and speed >= $uni-cir-value*1000"
313 <outcome value="success">
314 <return status="success">
315 <parameter name="uni-circuit-id" value="$asePort.uni_circuit_id" />
318 <outcome value="Other">
319 <return status="failure">
320 <parameter name="error-code" value="1010" />
321 <parameter name="error-message" value="No ports found that match criteria" />
327 +-------------------+
335 A <<configure>> node is used to configure a device.
339 *--------------*-------+
340 | <<adaptor>> | Fully qualified Java class of resource adaptor to be used
341 *--------------*-------+
342 | <<activate>> | Activate device/interface, for devices that support a separate activation step.
343 *--------------*-------+
344 | <<key>> | SQL-like string specifying criteria for item to configure
345 *--------------*-------+
349 Specific to device adaptor.
353 *-----------*-------+
354 | <<success>> | Device successfully configured
355 *-----------*-------+
356 | <<not-found>> | Element to be configured does not exist.
357 *-----------*--------+
358 | <<not-ready>> | Element is not in a state where it can be configured/activated
359 *-----------*-------+
360 | <<already-active>> | Attempt to activate element that is already active
361 *-----------*-------+
362 | <<failure>> | Configure failed for some other reason
363 *-----------*-------+
367 +-------------------+
368 <configure adaptor="org.openecomp.sdnc.sli.adaptor.emt.EmtAdaptor"
369 key="$uni-circuit-id" activate="true">
370 <parameter name="circuit.id" value="$uni-circuit-id" />
371 <parameter name="subscriber.name" value="$subscriber-name" />
372 <parameter name="emt.clli" value="$edge-device-clli" />
373 <parameter name="port.tagging" value="$port-tagging" />
374 <parameter name="port.mediaSpeed" value="$media-speed" />
375 <parameter name="location.state" value="$uni-location-state" />
376 <parameter name="location.city" value="$uni-location-city" />
377 <parameter name="cosCategory" value="$cos-category" />
378 <parameter name="gosProfile" value="$gos-profile" />
379 <parameter name="lldp" value="$asePort.resource-lldp" />
380 <parameter name="mtu" value="$asePort.resource-mtu" />
381 <outcome value="success">
383 <record plugin="org.openecomp.sdnc.sli.recording.FileRecorder">
384 <parameter name="file" value="/tmp/sample_r1.log" />
385 <parameter name="field1" value="__TIMESTAMP__"/>
386 <parameter name="field2" value="ACTIVE"/>
387 <parameter name="field3" value="$uni-circuit-id"/>
389 <return status="success">
390 <parameter name="edge-device-clli" value="$asePort.resource-emt-clli" />
394 <outcome value="already-active">
395 <return status="failure">
396 <parameter name="error-code" value="1590" />
397 <parameter name="error-message" value="Port already active" />
400 <outcome value="Other">
401 <return status="failure">
402 <parameter name="error-code" value="1542" />
403 <parameter name="error-message" value="Activation failure" />
407 +-------------------+
409 * Java Plugin Support
415 An <<execute>> node is used to execute Java code supplied as a plugin
419 *--------------*-------+
420 | <<plugin>> | Fully qualified Java class of plugin to be used
421 *--------------*-------+
422 | <<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)
423 *--------------*-------+
427 Specific to plugin / method
431 *-----------*-------+
432 | <<success>> | Device successfully configured
433 *-----------*-------+
434 | <<not-found>> | Plugin class could not be loaded
435 *-----------*--------+
436 | <<unsupported-method>> | Named method taking (Map, SvcLogicContext) could not be found
437 *-----------*-------+
438 | <<failure>> | Configure failed for some other reason
439 *-----------*-------+
443 +-------------------+
444 <execute plugin="org.openecomp.sdnc.sli.plugin.HelloWorld"
446 <parameter name="message" value="Hello, world!" />
447 <outcome value="success">
448 <return status="success"/>
450 <outcome value="not-found">
451 <return status="failure">
452 <parameter name="error-code" value="1590" />
453 <parameter name="error-message" value="Could not locate plugin" />
456 <outcome value="Other">
457 <return status="failure">
458 <parameter name="error-code" value="1542" />
459 <parameter name="error-message" value="Internal error" />
463 +-------------------+
471 A <<record>> node is used to record an event. For example, this might be used
472 to log provisioning events.
476 *--------------*-------+
477 | <<plugin>> | Fully qualified Java class to handle recording.
478 *--------------*-------+
483 Parameters will depend on the plugin being used. For the FileRecorder class,
484 the parameters are as follows
486 *------------*-----------+
487 | <<file>> | The file to which the record should be written
488 *------------*-----------+
489 | <<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
490 *------------*-----------+
495 *----------*---------+
496 | <<success>> | Record successfully written
497 *----------*---------+
498 | <<failure>> | Record could not be successfully written
499 *----------*---------+
503 +-------------------+
504 <record plugin="org.openecomp.sdnc.sli.recording.FileRecorder">
505 <parameter name="file" value="/tmp/sample_r1.log" />
506 <parameter name="field1" value="__TIMESTAMP__"/>
507 <parameter name="field2" value="ACTIVE"/>
508 <parameter name="field3" value="$uni-circuit-id"/>
510 +-------------------+
512 * Resource Management
518 A <<delete>> node is used to delete a resource from the local resource inventory.
522 *--------------*-------+
523 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
524 *--------------*-------+
525 | <<resource>> | Type of resource to delete
526 *--------------*-------+
527 | <<key>> | SQL-like string specifying key to delete
528 *--------------*-------+
536 *-----------*-------+
537 | <<success>> | Resource specified deleted successfully.
538 *-----------*-------+
539 | <failure>> | Resource specified was not deleted
540 *-----------*-------+
544 +-------------------+
545 <delete plugin="org.openecomp.sdnc.sli.resource.samplesvc.SampleServiceResource"
547 key="uni_circuit_id == $uni-circuit-id">
548 <outcome value="true">
549 <return status="success"/>
551 <outcome value="false">
552 <return status="failure"/>
555 +-------------------+
562 An <<exists>> node is used to determine whether a particular
563 instance of a resource exists. For example, this might be
564 used to test whether a particular switch CLLI is provisioned.
568 *--------------*-------+
569 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
570 *--------------*-------+
571 | <<resource>> | Type of resource to check
572 *--------------*-------+
573 | <<key>> | SQL-like string specifying key to check for
574 *--------------*-------+
582 *-----------*-------+
583 | <<true>> | Resource specified exists.
584 *-----------*-------+
585 | <<false>> | Resource specified is unknown
586 *-----------*-------+
590 +-------------------+
591 <exists plugin="org.openecomp.sdnc.sli.resource.samplesvc.SampleServiceResource"
593 key="uni_circuit_id == $uni-circuit-id">
594 <outcome value="true">
595 <return status="success"/>
597 <outcome value="false">
598 <return status="failure"/>
601 +-------------------+
607 A <<get-resource>> node is used to retrieve information about a
608 particular resource and make it available to other nodes in the
609 service logic tree. For example, this might be used to
610 retrieve information about a particular uni-port.
614 *--------------*-------+
615 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
616 *--------------*-------+
617 | <<resource>> | Type of resource to retrieve
618 *--------------*-------+
619 | <<key>> | SQL-like string specifying criteria for retrieval
620 *--------------*-------+
621 | <<pfx>> | Prefix to add to context variable names set for data retrieved
622 *--------------*-------+
623 | <<select>> | String to specify, if key matches multiple entries, which entry should take precedence
624 *--------------*-------+
625 | <<order-by>> | Prefix to add to context variable names set for data retrieved
626 *--------------*-------+
635 *-----------*-------+
636 | <<success>> | Resource successfully retrieved
637 *-----------*-------+
638 | <<not-found>> | Resource referenced does not exist
639 *-----------*-------+
640 | <<failure>> | Resource retrieve failed for some other reason
641 *-----------*-------+
645 +-------------------+
646 <get-resource plugin="org.openecomp.sdnc.sli.resource.samplesvc.SampleServiceResource"
648 key="uni_circuit_id == $uni-circuit-id"
650 <outcome value="success">
651 <return status="success"/>
653 <outcome value="not-found">
654 <return status="failure"/>
656 <outcome value="failure">
657 <return status="failure"/>
660 +-------------------+
666 An <<is-available>> node is used to determine whether a particular
667 type of resource is available. For example, this might be used to
668 test whether any ports are available for assignment on a particular switch.
672 *--------------*-------+
673 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
674 *--------------*-------+
675 | <<resource>> | Type of resource to check
676 *--------------*-------+
677 | <<key>> | SQL-like string specifying key to check for
678 *--------------*-------+
679 | <<pfx>> | Prefix to add to context variable names set for data retrieved
680 *--------------*-------+
688 *-----------*-------+
689 | <<true>> | Resource requested is available
690 *-----------*-------+
691 | <<false>> | Resource requested is not available
692 *-----------*-------+
696 +-------------------+
697 <is-available plugin="org.openecomp.sdnc.sli.resource.samplesvc.SampleServiceResource"
699 key="resource-emt-clli == $edge-device-clli and speed >= $uni-cir-value">
700 <outcome value="true">
701 <return status="success"/>
703 <outcome value="false">
704 <return status="failure"/>
707 +-------------------+
713 A <<notify>> node is used to inform an external application (e.g. A&AI) that a resource was
718 *--------------*-------+
719 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
720 *--------------*-------+
721 | <<resource>> | Identifies resource that was updated
722 *--------------*-------+
723 | <<action>> | Action that triggered notification to be sent (ADD/UPDATE/DELETE)
724 *--------------*-------+
732 *-----------*-------+
733 | <<success>> | Notification was successful
734 *-----------*-------+
735 | <<failure>> | Notification failed is not available
736 *-----------*-------+
740 +-------------------+
741 <notify plugin="org.openecomp.sdnc.sli.resource.samplesvc.SampleServiceResource"
744 <outcome value="success">
745 <return status="success"/>
747 <outcome value="Other">
748 <return status="failure"/>
751 +-------------------+
757 A <<release>> node is used to mark a resource as no longer in use, and thus
758 available for assignment.
762 *--------------*-------+
763 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
764 *--------------*-------+
765 | <<resource>> | Type of resource to release
766 *--------------*-------+
767 | <<key>> | SQL-like string specifying key to check of resource to release
768 *--------------*-------+
776 *-----------*-------+
777 | <<success>> | Resource successfully released
778 *-----------*-------+
779 | <<not-found>> | Resource referenced does not exist
780 *-----------*-------+
781 | <<failure>> | Resource release failed for some other reason
782 *-----------*-------+
786 +-------------------+
787 <release plugin="org.openecomp.sdnc.sli.resource.samplesvc.SampleServiceResource"
789 key="uni_circuit_id == $uni-circuit-id">
790 <outcome value="success">
791 <return status="success"/>
793 <outcome value="not-found">
794 <return status="failure"/>
796 <outcome value="failure">
797 <return status="failure"/>
800 +-------------------+
807 A <<reserve>> node is used to reserve a particular
808 type of resource.. For example, this might be used to
809 reserve a port on a particular switch.
813 *--------------*-------+
814 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
815 *--------------*-------+
816 | <<resource>> | Type of resource to reserve
817 *--------------*-------+
818 | <<key>> | SQL-like string specifying criteria for reservation
819 *--------------*-------+
820 | <<select>> | String to specify, if <<key>> matches multiple entries, which entry should take precedence
821 *--------------*-------+
829 *-----------*-------+
830 | <<success>> | Resource requested was successfully reserved
831 *-----------*-------+
832 | <<failure>> | Resource requested was not successfully reserved
833 *-----------*-------+
837 +-------------------+
838 <reserve plugin="org.openecomp.sdnc.sli.resource.samplesvc.SampleServiceResource"
840 key="resource-emt-clli == $edge-device-clli and speed >= $uni-cir-value"
842 <outcome value="success">
843 <return status="success"/>
845 <outcome value="failure">
846 <return status="failure"/>
849 +-------------------+
855 A <<save>> node is used to save information about a
856 particular resource to persistent storage. For example, this might be used to
857 save information about a particular uni-port.
861 *--------------*-------+
862 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
863 *--------------*-------+
864 | <<resource>> | Type of resource to save
865 *--------------*-------+
866 | <<key>> | SQL-like string specifying criteria for retrieval
867 *--------------*-------+
868 | <<force>> | If "true", save resource even if this resource is already stored in persistent storage
869 *--------------*-------+
870 | <<pfx>> | Prefix to be prepended to variable names, when attributes are set in SvcLogicContext
871 *--------------*-------+
875 Values to save (columns) are specified as parameters, with each name
876 corresponding to a column name and each value corresponding to the
881 *-----------*-------+
882 | <<success>> | Resource successfully saved
883 *-----------*-------+
884 | <<failure>> | Resource save failed
885 *-----------*-------+
889 +-------------------+
890 <save plugin="`$sample-resource-plugin`" resource="vnf"
891 key="vnf-name = $requests.vnf.vnf-name" force="true"
893 <parameter name="vnf-name"
894 value="`$requests.cust-country-code + $requests.cust-id + $requests.cust-city + $requests.cust-state + '001VCE'`" />
895 <parameter name="vnf-type" value="vce" />
896 <parameter name="orchestration-status" value="pending-create" />
897 <parameter name="heat-stack-id" value="`$requests.heat-stack-id`" />
898 <parameter name="mso-catalog-key" value="`$requests.mso-catalog-key`" />
899 <parameter name="oam-ipv4-address" value="`$vce-ipv4-oam-addr.ipv4-addr`" />
901 +-------------------+
907 An <<update>> node is used to update information about a
908 particular resource to persistent storage.
912 *--------------*-------+
913 | <<plugin>> | Fully qualified Java class of resource adaptor to be used
914 *--------------*-------+
915 | <<resource>> | Type of resource to update
916 *--------------*-------+
917 | <<key>> | SQL-like string specifying criteria for retrieval
918 *--------------*-------+
919 | <<pfx>> | Prefix to be prepended to variable names, when attributes are set in SvcLogicContext
920 *--------------*-------+
924 Values to save (columns) are specified as parameters, with each name
925 corresponding to a column name and each value corresponding to the
930 *-----------*-------+
931 | <<success>> | Resource successfully saved
932 *-----------*-------+
933 | <<failure>> | Resource save failed
934 *-----------*-------+
938 +-------------------+
939 <update plugin="`$sample-resource-plugin`" resource="vnf"
940 key="vnf-name = $requests.vnf.vnf-name"
942 <parameter name="vnf-name"
943 value="`$requests.cust-country-code + $requests.cust-id + $requests.cust-city + $requests.cust-state + '001VCE'`" />
944 <parameter name="vnf-type" value="vce" />
945 <parameter name="orchestration-status" value="pending-create" />
946 <parameter name="heat-stack-id" value="`$requests.heat-stack-id`" />
947 <parameter name="mso-catalog-key" value="`$requests.mso-catalog-key`" />
948 <parameter name="oam-ipv4-address" value="`$vce-ipv4-oam-addr.ipv4-addr`" />
950 +-------------------+