diff options
Diffstat (limited to 'sli/common/src/test/resources')
-rw-r--r-- | sli/common/src/test/resources/EvcActivateSvcLogic_v100.xml | 70 | ||||
-rw-r--r-- | sli/common/src/test/resources/EvcPortSvcLogic_v100.xml | 263 | ||||
-rw-r--r-- | sli/common/src/test/resources/ReleasePortSvcLogic_v101.xml | 89 | ||||
-rw-r--r-- | sli/common/src/test/resources/bad_neutron_logic_v11.xml | 61 | ||||
-rwxr-xr-x | sli/common/src/test/resources/expression.tests | 19 | ||||
-rw-r--r-- | sli/common/src/test/resources/mergetest.xml | 54 | ||||
-rw-r--r-- | sli/common/src/test/resources/neutron_logic_v10.xml | 56 | ||||
-rw-r--r-- | sli/common/src/test/resources/nonsense.xml | 24 | ||||
-rwxr-xr-x | sli/common/src/test/resources/parser-bad.tests | 3 | ||||
-rwxr-xr-x | sli/common/src/test/resources/parser-good.tests | 2 | ||||
-rw-r--r-- | sli/common/src/test/resources/simplelogger.properties | 24 | ||||
-rw-r--r-- | sli/common/src/test/resources/svclogic.properties | 26 | ||||
-rw-r--r-- | sli/common/src/test/resources/svclogic.sh | 32 | ||||
-rwxr-xr-x | sli/common/src/test/resources/svclogic.xsd | 323 |
14 files changed, 1046 insertions, 0 deletions
diff --git a/sli/common/src/test/resources/EvcActivateSvcLogic_v100.xml b/sli/common/src/test/resources/EvcActivateSvcLogic_v100.xml new file mode 100644 index 000000000..097078a8a --- /dev/null +++ b/sli/common/src/test/resources/EvcActivateSvcLogic_v100.xml @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + + +<service-logic xmlns="http://www.openecomp.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.openecomp.org/sdnc/svclogic ./svclogic.xsd" + module="ase" version="1.0.0"> + + + <method rpc="ase-evc-activation" mode="sync"> + <configure adaptor="org.openecomp.sdnc.sli.adaptor.emt.EmtAdaptor" + key="$evc-name" activate="true"> + <parameter name="circuit.name" value="$evc-name" /> + <parameter name="topology" value="$topology" /> + <parameter name="leg1.uniCircuitId" value="$evc-leg[0].evc-access-name" /> + <parameter name="leg2.uniCircuitId" value="$evc-leg[1].evc-access-name" /> + <outcome value="success"> + <return status="success" /> + </outcome> + <outcome value="already-active"> + <return status="failure"> + <parameter name="error-code" value="1590" /> + <parameter name="error-message" value="`Circuit 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> + </method> + + <method rpc="ase-evc-disconnect-request" mode="sync"> + <configure adaptor="org.openecomp.sdnc.sli.adaptor.emt.EmtAdaptor" + key="$evc-name" activate="false"> + <outcome value="success"> + <return status="success" /> + </outcome> + + <outcome value="Other"> + <return status="failure"> + <parameter name="error-code" value="1542" /> + <parameter name="error-message" value="De-activation failure" /> + </return> + </outcome> + </configure> + </method> + + +</service-logic> diff --git a/sli/common/src/test/resources/EvcPortSvcLogic_v100.xml b/sli/common/src/test/resources/EvcPortSvcLogic_v100.xml new file mode 100644 index 000000000..080844205 --- /dev/null +++ b/sli/common/src/test/resources/EvcPortSvcLogic_v100.xml @@ -0,0 +1,263 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + + +<service-logic xmlns="http://www.openecomp.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.openecomp.org/sdnc/svclogic ./svclogic.xsd" + module="ase" version="1.0.0"> + + <!-- Reserve a port. Returns uni-circuit-id of reserved ase-port --> + <method rpc="ase-port-reserve" mode="sync"> + <switch test="$uni-cir-units"> + <outcome value="Mbps"> + <reserve plugin="org.openecomp.sdnc.sli.resource.sample.SampleResource" + resource="ase-port" + key="resource-emt-clli == $edge-device-clli and speed >= $uni-cir-value" + pfx="asePort"> + + + <outcome value="success"> + <block> + <record plugin="org.openecomp.sdnc.sli.recording.FileRecorder"> + <parameter name="file" value="/tmp/sample_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> + + </outcome> + + <outcome value="not-found"> + <return status="failure"> + <parameter name="error-code" value="1010" /> + <parameter name="error-message" value="No ports found that match criteria" /> + </return> + </outcome> + + <outcome value="Other"> + <return status="failure"> + <parameter name="error-code" value="1010" /> + <parameter name="error-message" + value="Error encountered trying to reserve port" /> + </return> + </outcome> + + </reserve> + </outcome> + <outcome value="Gbps"> + <reserve plugin="org.openecomp.sdnc.sli.resource.sample.SampleResource" + resource="ase-port" + key="resource-emt-clli == $edge-device-clli and speed >= 1000 * $uni-cir-value" + pfx="asePort"> + + + <outcome value="success"> + <block> + <record plugin="org.openecomp.sdnc.sli.recording.FileRecorder"> + <parameter name="file" value="/tmp/sample_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> + </outcome> + + <outcome value="not-found"> + <return status="failure"> + <parameter name="error-code" value="1010" /> + <parameter name="error-message" value="No ports found that match criteria" /> + </return> + </outcome> + <outcome value=""> + <return status="failure"> + <parameter name="error-code" value="1012" /> + <parameter name="error-message" + value="Error encountered trying to reserve port" /> + </return> + </outcome> + <outcome value="Other"> + <return status="failure"> + <parameter name="error-code" value="1010" /> + <parameter name="error-message" + value="Error encountered trying to reserve port" /> + </return> + </outcome> + </reserve> + </outcome> + </switch> + </method> + + <!-- One step provisioning/activation command. Allocates a local resource, + then configures it on device --> + <method rpc="ase-port-activate-request" mode="sync"> + + <allocate plugin="org.openecomp.sdnc.sli.resource.sample.SampleResource" + resource="ase-port" key="uni-circuit-id == $uni-circuit-id" pfx="asePort"> + + <outcome value="success"> + <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/sample_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> + </outcome> + + <outcome value="not-found"> + + <return status="failure"> + <parameter name="error-code" value="1220" /> + <parameter name="error-message" value="Circuit not found" /> + </return> + + </outcome> + + <outcome value="Other"> + <return status="failure"> + <parameter name="error-code" value="1230" /> + <parameter name="error-message" value="Error occurred trying to find circuit" /> + </return> + </outcome> + </allocate> + </method> + + + + <!-- Change provisioning w/o activation --> + <method rpc="ase-change-port-prov-request" mode="sync"> + <allocate plugin="org.openecomp.sdnc.sli.resource.sample.SampleResource" + resource="ase-port" key="uni-circuit-id == $uni-circuit-id" pfx="asePort"> + + <outcome value="success"> + <return status="success"> + <parameter name="edge-device-clli" value="$asePort.resource-emt-clli" /> + </return> + </outcome> + + <outcome value="not-found"> + <return status="failure"> + <parameter name="error-code" value="1220" /> + <parameter name="error-message" value="Circuit not found" /> + </return> + </outcome> + + <outcome value="Other"> + <return status="failure"> + <parameter name="error-code" value="1230" /> + <parameter name="error-message" value="Error occurred trying to find circuit" /> + </return> + </outcome> + </allocate> + </method> + + + + + <!-- Release port --> + + <method rpc="ase-release-port-request" mode="sync"> + <exists plugin="org.openecomp.sdnc.sli.resource.sample.SampleResource" + resource="ase-evc" key="uni-circuit-id == $uni-circuit-id"> + + <outcome value="true"> + <return status="failure"> + <parameter name="error-code" value="1130" /> + <parameter name="error-message" + value="Cannot release port - used in existing EVC" /> + </return> + </outcome> + <outcome value="false"> + <release plugin="org.openecomp.sdnc.sli.resource.sample.SampleResource" + resource="ase-port" key="uni-circuit-id == $uni-circuit-id"> + <outcome value="success"> + <block> + <record plugin="org.openecomp.sdnc.sli.recording.FileRecorder"> + <parameter name="file" value="/tmp/sample_r1.log" /> + <parameter name="field1" value="__TIMESTAMP__"/> + <parameter name="field2" value="RELEASED"/> + <parameter name="field3" value="$uni-circuit-id"/> + </record> + <return status="success"/> + </block> + </outcome> + + <outcome value="not-found"> + <return status="failure"> + <parameter name="error-code" value="1110" /> + <parameter name="error-message" value="No port found for this uni-circuit-id" /> + </return> + </outcome> + + <outcome value="Other"> + <return status="failure"> + <parameter name="error-code" value="1130" /> + <parameter name="error-message" + value="Error encountered trying to release port" /> + </return> + </outcome> + </release> + </outcome> + </exists> + </method> + +</service-logic> + diff --git a/sli/common/src/test/resources/ReleasePortSvcLogic_v101.xml b/sli/common/src/test/resources/ReleasePortSvcLogic_v101.xml new file mode 100644 index 000000000..5a835b7be --- /dev/null +++ b/sli/common/src/test/resources/ReleasePortSvcLogic_v101.xml @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + + +<service-logic xmlns="http://www.openecomp.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.openecomp.org/sdnc/svclogic ./svclogic.xsd" + module="ase" version="1.0.1"> + + <!-- Updated release port logic : deactivate the released port on the EMT --> + <method rpc="ase-release-port-request" mode="sync"> + <exists plugin="org.openecomp.sdnc.sli.resource.sample.SampleResource" + resource="ase-evc" key="uni-circuit-id == $uni-circuit-id"> + + <outcome value="true"> + <return status="failure"> + <parameter name="error-code" value="1130" /> + <parameter name="error-message" + value="Cannot release port - used in existing EVC" /> + </return> + </outcome> + <outcome value="false"> + <release plugin="org.openecomp.sdnc.sli.resource.sample.SampleResource" + resource="ase-port" key="uni-circuit-id == $uni-circuit-id"> + <outcome value="success"> + <configure adaptor="org.openecomp.sdnc.sli.adaptor.emt.EmtAdaptor" + key="$uni-circuit-id" activate="false"> + + <outcome value="success"> + <block> + <record plugin="org.openecomp.sdnc.sli.recording.FileRecorder"> + <parameter name="file" value="/tmp/sample_r1.log" /> + <parameter name="field1" value="__TIMESTAMP__" /> + <parameter name="field2" value="RELEASED" /> + <parameter name="field3" value="$uni-circuit-id" /> + </record> + <return status="success"> + <parameter name="uni-circuit-id" value="$asePort.uni_circuit_id" /> + </return> + </block> + </outcome> + <outcome value="Other"> + <return status="failure"> + <parameter name="error-code" value="1130" /> + <parameter name="error-message" + value="Error encountered trying to de-activate port" /> + </return> + </outcome> + </configure> + </outcome> + + <outcome value="not-found"> + <return status="failure"> + <parameter name="error-code" value="1110" /> + <parameter name="error-message" value="No port found for this uni-circuit-id" /> + </return> + </outcome> + + <outcome value="Other"> + <return status="failure"> + <parameter name="error-code" value="1130" /> + <parameter name="error-message" + value="Error encountered trying to release port" /> + </return> + </outcome> + </release> + </outcome> + </exists> + </method> + +</service-logic> + diff --git a/sli/common/src/test/resources/bad_neutron_logic_v11.xml b/sli/common/src/test/resources/bad_neutron_logic_v11.xml new file mode 100644 index 000000000..4e1e8d9b4 --- /dev/null +++ b/sli/common/src/test/resources/bad_neutron_logic_v11.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + + +<service-logic xmlns="http://www.openecomp.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.openecomp.org/sdnc/svclogic ./svclogic.xsd" + module="neutron" version="1.0.0"> + + <method rpc="canCreateNetwork" mode="sync"> + <switch test="true"> + <return status="success"> + <parameter name="error-code" value="200" /> + </return> + </switch> + </method> + + <method rpc="networkCreated" mode="sync"> + <switch test="`(length($network.segment[0].provider-physical-network) >= 5) and (substr($network.segment[0].provider-physical-network,0,5) == 'dvspg')`"> + <outcome value="true"> + <block> + <set> + <parameter name="vlanlist" value="`$network.segment[0].provider-segmentation-id`"/> + </set> + <for index="i" start="1" end="`$network.num-segments`"> + <set> + <parameter name="vlanlist" value="`$vlanlist+','+$network.segment[$i].provider-segmentation-id`"/> + </set> + </for> + + <switch test="true"> + <return status="success"/> + </switch> + </block> + </outcome> + <outcome value="Other"> + <return status="success"> + <parameter name="error-code" value="200"/> + </return> + </outcome> + </switch> + </method> + +</service-logic> diff --git a/sli/common/src/test/resources/expression.tests b/sli/common/src/test/resources/expression.tests new file mode 100755 index 000000000..c352e9b08 --- /dev/null +++ b/sli/common/src/test/resources/expression.tests @@ -0,0 +1,19 @@ +$uni-circuit-id +$asePort +length($uni-circuit-id) > 0 +$asePort.uni-circuit-id +$uni-cir-units * 1000 * 100 / 100 +$uni-cir-units / 1000 +$uni-cir-units - 100 +$uni-cir-units + 100 +(value * 3 - $arg1 > 0) and (length($uni-circuit-id) == 0) +'pg-'+$network.name +$network.segment[0].provider-physical-network +length($network_segment[0].provider-physical-network) >= 5 +substr($network_segment[0].provider-physical-network,0,5) == 'dvspg' +length($network_segment[0].provider-physical-network) >= 5 and substr($network_segment[0].provider-physical-network,0,5) == 'dvspg' +(length($network_segment[0].provider-physical-network) >= 5) and (substr($network_segment[0].provider-physical-network,0,5) == 'dvspg') +4-2-2 +1+1 +1 +1+2*3-4 diff --git a/sli/common/src/test/resources/mergetest.xml b/sli/common/src/test/resources/mergetest.xml new file mode 100644 index 000000000..12e083c79 --- /dev/null +++ b/sli/common/src/test/resources/mergetest.xml @@ -0,0 +1,54 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<multicast-parameters xmlns="org.openecomp.sdnc:test"> + <vpn-v4-multicast-enabled>Y</vpn-v4-multicast-enabled> + <v4-multicast> + <v4-pim-ssm-default-range>Y</v4-pim-ssm-default-range> + <v4-data-mdt>11.11.11.11</v4-data-mdt> + <v4-data-mdt-wildcard-mask>2.2.2.2</v4-data-mdt-wildcard-mask> + <max-routes-limit>100</max-routes-limit> + <v4-default-mdt>1.1.1.1</v4-default-mdt> + <v4-pim-sm-static-override>N</v4-pim-sm-static-override> + <v4-pim-ssm-groups> + <v4-pim-ssm-group-address>4.4.4.4</v4-pim-ssm-group-address> + </v4-pim-ssm-groups> + <v4-pim-ssm-groups> + <v4-pim-ssm-group-address>3.3.3.3</v4-pim-ssm-group-address> + </v4-pim-ssm-groups> + <v4-static-rp-triplet> + <rp-address>8.8.8.8</rp-address> + <c-groups> + <c-group-address-prefix>10.10.10.10</c-group-address-prefix> + </c-groups> + <c-groups> + <c-group-address-prefix>9.9.9.9</c-group-address-prefix> + </c-groups> + </v4-static-rp-triplet> + <v4-static-rp-triplet> + <rp-address>7.7.7.7</rp-address> + <c-groups> + <c-group-address-prefix>6.6.6.6</c-group-address-prefix> + </c-groups> + <c-groups> + <c-group-address-prefix>5.5.5.5</c-group-address-prefix> + </c-groups> + </v4-static-rp-triplet> + </v4-multicast> +</multicast-parameters> diff --git a/sli/common/src/test/resources/neutron_logic_v10.xml b/sli/common/src/test/resources/neutron_logic_v10.xml new file mode 100644 index 000000000..9cd331279 --- /dev/null +++ b/sli/common/src/test/resources/neutron_logic_v10.xml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + + +<service-logic xmlns="http://www.openecomp.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.openecomp.org/sdnc/svclogic ./svclogic.xsd" + module="neutron" version="1.0.0"> + + <method rpc="canCreateNetwork" mode="sync"> + <return status="success"> + <parameter name="error-code" value="200" /> + </return> + </method> + + <method rpc="networkCreated" mode="sync"> + <switch test="`(length($network.segment[0].provider-physical-network) >= 5) and (substr($network.segment[0].provider-physical-network,0,5) == 'dvspg')`"> + <outcome value="true"> + <block> + <set> + <parameter name="vlanlist" value="`$network.segment[0].provider-segmentation-id`"/> + </set> + <for index="i" start="1" end="`$network.num-segments`"> + <set> + <parameter name="vlanlist" value="`$vlanlist+','+$network.segment[$i].provider-segmentation-id`"/> + </set> + </for> + + </block> + </outcome> + <outcome value="Other"> + <return status="success"> + <parameter name="error-code" value="200"/> + </return> + </outcome> + </switch> + </method> + +</service-logic> diff --git a/sli/common/src/test/resources/nonsense.xml b/sli/common/src/test/resources/nonsense.xml new file mode 100644 index 000000000..61220825e --- /dev/null +++ b/sli/common/src/test/resources/nonsense.xml @@ -0,0 +1,24 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<non> +<sense>Hello world</sense> +</non> diff --git a/sli/common/src/test/resources/parser-bad.tests b/sli/common/src/test/resources/parser-bad.tests new file mode 100755 index 000000000..82913afc2 --- /dev/null +++ b/sli/common/src/test/resources/parser-bad.tests @@ -0,0 +1,3 @@ +bad_neutron_logic_v11.xml +EvcActivateSvcLogic_v100.xml +nonsense.xml
\ No newline at end of file diff --git a/sli/common/src/test/resources/parser-good.tests b/sli/common/src/test/resources/parser-good.tests new file mode 100755 index 000000000..06543126f --- /dev/null +++ b/sli/common/src/test/resources/parser-good.tests @@ -0,0 +1,2 @@ +ReleasePortSvcLogic_v101.xml +neutron_logic_v10.xml diff --git a/sli/common/src/test/resources/simplelogger.properties b/sli/common/src/test/resources/simplelogger.properties new file mode 100644 index 000000000..6f70984c9 --- /dev/null +++ b/sli/common/src/test/resources/simplelogger.properties @@ -0,0 +1,24 @@ +### +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +### + +org.slf4j.simpleLogger.defaultLogLevel=info +org.slf4j.simplelogger.log.org.openecomp.sdnc.sli.SvcLogicContext=debug +org.slf4j.simplelogger.log.SvcLogicContext=debug diff --git a/sli/common/src/test/resources/svclogic.properties b/sli/common/src/test/resources/svclogic.properties new file mode 100644 index 000000000..fa33146e5 --- /dev/null +++ b/sli/common/src/test/resources/svclogic.properties @@ -0,0 +1,26 @@ +### +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +### + +org.openecomp.sdnc.sli.dbtype = jdbc +org.openecomp.sdnc.sli.jdbc.url = jdbc:mysql://localhost:3306/sdnctl +org.openecomp.sdnc.sli.jdbc.database = sdnctl +org.openecomp.sdnc.sli.jdbc.user = sdnctl +org.openecomp.sdnc.sli.jdbc.password = gamma diff --git a/sli/common/src/test/resources/svclogic.sh b/sli/common/src/test/resources/svclogic.sh new file mode 100644 index 000000000..09f0637d5 --- /dev/null +++ b/sli/common/src/test/resources/svclogic.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +### +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +### + +MYSQL_JDBC_DRIVER=${MYSQL_JDBC_DRIVER:-/home/ubuntu/mysql-connector-java-5.1.38.1.jar} +SLI_COMMON_TARGETDIR=${SLI_COMMON_TARGETDIR:-/home/ubuntu/opendaylight/plugins} +#SLI_COMMON_TARGETDIR=${SLI_COMMON_TARGETDIR:-/home/ubuntu/git/sdnctl/sli/common/target} +SLI_VERSION=${SLI_VERSION:-1.1.0-SNAPSHOT} +SLI_COMMON_JAR=${SLI_COMMON_JAR:=${SLI_COMMON_TARGETDIR}/sli-common-${SLI_VERSION}.jar} + +echo SLI_COMMON_JAR is $SLI_COMMON_JAR + +java -cp ${CLASSPATH}:${MYSQL_JDBC_DRIVER}:${SLI_COMMON_JAR} org.openecomp.sdnc.sli.SvcLogicParser $* diff --git a/sli/common/src/test/resources/svclogic.xsd b/sli/common/src/test/resources/svclogic.xsd new file mode 100755 index 000000000..074308915 --- /dev/null +++ b/sli/common/src/test/resources/svclogic.xsd @@ -0,0 +1,323 @@ +<?xml version = "1.0" encoding = "UTF-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.openecomp.org/sdnc/svclogic" xmlns="http://www.openecomp.org/sdnc/svclogic">
+
+ <xsd:simpleType name="modeType">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="sync" />
+ <xsd:enumeration value="async" />
+ </xsd:restriction>
+ </xsd:simpleType>
+
+ <xsd:group name="node">
+ <xsd:choice>
+ <xsd:element ref="block" />
+ <xsd:element ref="is-available" />
+ <xsd:element ref="exists" />
+ <xsd:element ref="reserve" />
+ <xsd:element ref="release" />
+ <xsd:element ref="allocate" />
+ <xsd:element ref="get-resource" />
+ <xsd:element ref="configure" />
+ <xsd:element ref="return" />
+ <xsd:element ref="switch" />
+ <xsd:element ref="record" />
+ <xsd:element ref="save" />
+ <xsd:element ref="for" />
+ <xsd:element ref="set" />
+ <xsd:element ref="execute" />
+ <xsd:element ref="delete" />
+ <xsd:element ref="update" />
+ <xsd:element ref="call" />
+ <xsd:element ref="notify" />
+ <xsd:element ref="break" />
+ </xsd:choice>
+ </xsd:group>
+
+ <xsd:element name="service-logic">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="method" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="module" use="required" type="xsd:string" />
+ <xsd:attribute name="version" use="required" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="method">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:group ref="node" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="rpc" use="required" type="xsd:string" />
+ <xsd:attribute name="mode" use="optional" type="modeType" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="block">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:group ref="node" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="atomic" use="optional" type="xsd:boolean" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="is-available">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="pfx" use="optional" type="xsd:string" />
+ <xsd:attribute name="plugin" use="required" type="xsd:string" />
+ <xsd:attribute name="resource" use="required" type="xsd:string" />
+ <xsd:attribute name="key" use="optional" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="exists">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="pfx" use="optional" type="xsd:string" />
+ <xsd:attribute name="plugin" use="required" type="xsd:string" />
+ <xsd:attribute name="resource" use="required" type="xsd:string" />
+ <xsd:attribute name="key" use="required" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="outcome">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:group ref="node" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="ref" use="optional" type="xsd:string" />
+ <xsd:attribute name="value" use="required" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="reserve">
+ <xsd:complexType>
+ <xsd:sequence>
+ <!-- This node does not actually read from parameters -->
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="plugin" use="required" type="xsd:string" />
+ <xsd:attribute name="resource" use="required" type="xsd:string" />
+ <xsd:attribute name="key" use="optional" type="xsd:string" />
+ <xsd:attribute name="select" use="optional" type="xsd:string" />
+ <xsd:attribute name="pfx" use="optional" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="release">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="plugin" use="required" type="xsd:string" />
+ <xsd:attribute name="resource" use="required" type="xsd:string" />
+ <xsd:attribute name="key" use="optional" type="xsd:string" />
+ <xsd:attribute name="pfx" use="optional" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="record">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="plugin" use="required" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="allocate">
+ <xsd:complexType>
+ <xsd:sequence>
+ <!-- This node does not actually read from parameters -->
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="plugin" use="required" type="xsd:string" />
+ <xsd:attribute name="resource" use="required" type="xsd:string" />
+ <xsd:attribute name="key" use="required" type="xsd:string" />
+ <xsd:attribute name="pfx" use="required" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="get-resource">
+ <xsd:complexType>
+ <xsd:sequence>
+ <!-- This node does not actually read from parameters -->
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="plugin" use="required" type="xsd:string" />
+ <xsd:attribute name="resource" use="required" type="xsd:string" />
+ <xsd:attribute name="key" use="optional" type="xsd:string" />
+ <xsd:attribute name="local-only" use="optional" type="xsd:boolean" />
+ <xsd:attribute name="order-by" use="optional" type="xsd:string" />
+ <xsd:attribute name="pfx" use="optional" type="xsd:string" />
+ <!-- force is retired and does not do anything -->
+ <xsd:attribute name="force" use="optional" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="configure">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="adaptor" use="required" type="xsd:string" />
+ <xsd:attribute name="key" use="required" type="xsd:string" />
+ <xsd:attribute name="activate" use="optional" type="xsd:boolean" />
+ </xsd:complexType>
+ </xsd:element>
+
+
+ <xsd:element name="parameter">
+ <xsd:complexType>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="value" use="required" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+
+
+ <xsd:element name="return">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="status" use="optional" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="switch">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="test" use="required" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="save">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="plugin" use="required" type="xsd:string" />
+ <xsd:attribute name="resource" use="required" type="xsd:string" />
+ <xsd:attribute name="key" use="optional" type="xsd:string" />
+ <xsd:attribute name="force" use="optional" type="xsd:boolean" />
+ <xsd:attribute name="local-only" use="optional" type="xsd:boolean" />
+ <xsd:attribute name="pfx" use="optional" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="delete">
+ <xsd:complexType>
+ <xsd:sequence>
+ <!-- This node does not actually read from parameters -->
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="plugin" use="required" type="xsd:string" />
+ <xsd:attribute name="resource" use="required" type="xsd:string" />
+ <xsd:attribute name="key" use="optional" type="xsd:string" />
+ <!-- force is retired and does not do anything -->
+ <xsd:attribute name="force" use="optional" type="xsd:string" />
+ <!-- local-only is retired and does not do anything -->
+ <xsd:attribute name="local-only" use="optional" type="xsd:string" />
+ <!-- pfx is retired and does not do anything -->
+ <xsd:attribute name="pfx" use="optional" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="for">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:group ref="node" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="atomic" use="optional" type="xsd:boolean" />
+ <xsd:attribute name="index" use="required" type="xsd:string" />
+ <xsd:attribute name="start" use="required" type="xsd:string" />
+ <xsd:attribute name="end" use="required" type="xsd:string" />
+ <xsd:attribute name="silentFailure" use="optional" type="xsd:boolean" default="false" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="set">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="only-if-unset" use="optional"
+ type="xsd:boolean" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="execute">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="plugin" use="required" type="xsd:string" />
+ <xsd:attribute name="method" use="required" type="xsd:string" />
+ <xsd:attribute name="emitsOutcome" use="optional" type="xsd:boolean" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="update">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="plugin" use="required" type="xsd:string" />
+ <xsd:attribute name="resource" use="required" type="xsd:string" />
+ <xsd:attribute name="key" use="optional" type="xsd:string" />
+ <xsd:attribute name="force" use="optional" type="xsd:boolean" />
+ <xsd:attribute name="local-only" use="optional" type="xsd:boolean" />
+ <xsd:attribute name="pfx" use="optional" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="call">
+ <xsd:complexType>
+ <xsd:sequence>
+ <!-- This node does not actually read from parameters -->
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="module" use="optional" type="xsd:string" />
+ <xsd:attribute name="rpc" use="required" type="xsd:string" />
+ <xsd:attribute name="version" use="optional" type="xsd:string" />
+ <xsd:attribute name="mode" use="required" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="notify">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="plugin" use="optional" type="xsd:string" />
+ <xsd:attribute name="resource" use="optional" type="xsd:string" />
+ <xsd:attribute name="action" use="required" type="xsd:string" />
+ <xsd:attribute name="key" use="optional" type="xsd:string" />
+ <!-- force is retired and does not do anything -->
+ <xsd:attribute name="force" use="optional" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+
+ <xsd:element name="break">
+ <xsd:complexType />
+ </xsd:element>
+
+</xsd:schema>
|