diff options
Diffstat (limited to 'sli/common/src/test/resources')
27 files changed, 1198 insertions, 0 deletions
diff --git a/sli/common/src/test/resources/2dArray.json b/sli/common/src/test/resources/2dArray.json new file mode 100644 index 000000000..2a94b46f4 --- /dev/null +++ b/sli/common/src/test/resources/2dArray.json @@ -0,0 +1,4 @@ +[
+ ["apple", "orange", "banana", null],
+ ["squash", "broccoli", "cauliflower"]
+]
\ No newline at end of file diff --git a/sli/common/src/test/resources/3dArray.json b/sli/common/src/test/resources/3dArray.json new file mode 100644 index 000000000..149955596 --- /dev/null +++ b/sli/common/src/test/resources/3dArray.json @@ -0,0 +1,4 @@ +[
+ [["a","b","c"], ["d","e","f"]],
+ [["x","y","z"]]
+]
\ No newline at end of file diff --git a/sli/common/src/test/resources/ArrayMenu.json b/sli/common/src/test/resources/ArrayMenu.json new file mode 100644 index 000000000..26a24f292 --- /dev/null +++ b/sli/common/src/test/resources/ArrayMenu.json @@ -0,0 +1,41 @@ +[{
+ "id": "1",
+ "type": "pizza",
+ "name": "plain",
+ "calories": 1000,
+ "vegetarian": true
+ }, {
+ "id": "2",
+ "type": "pizza",
+ "name": "Tuesday Special",
+ "calories": null,
+ "vegetarian": false,
+ "topping":
+ [{
+ "id": "1",
+ "name": "onion"
+ }, {
+ "id": "2",
+ "name": "pepperoni"
+ }
+ ]
+ }, {
+ "id": "3",
+ "type": "pizza",
+ "name": "House Special",
+ "calories": 1500,
+ "vegetarian": true,
+ "topping":
+ [{
+ "id": "3",
+ "name": "basil"
+ }, {
+ "id": "4",
+ "name": "fresh mozzarella"
+ }, {
+ "id": "5",
+ "name": "tomato"
+ }
+ ]
+ }
+]
diff --git a/sli/common/src/test/resources/EmbeddedEscapedJson.json b/sli/common/src/test/resources/EmbeddedEscapedJson.json new file mode 100644 index 000000000..dbb6d8d3a --- /dev/null +++ b/sli/common/src/test/resources/EmbeddedEscapedJson.json @@ -0,0 +1,16 @@ +{
+ "input": {
+ "parameters":
+ [{
+ "name": "escapedJsonObject",
+ "value": "[{\"id\":\"0.2.0.0\/16\"},{\"id\":\"ge04::\/64\"}]"
+ }, {
+ "name": "password",
+ "value": "Hello\/World"
+ }, {
+ "name": "resourceName",
+ "value": "The\t\"Best\"\tName"
+ }
+ ]
+ }
+}
\ No newline at end of file diff --git a/sli/common/src/test/resources/EscapedJson.json b/sli/common/src/test/resources/EscapedJson.json new file mode 100644 index 000000000..a7719e819 --- /dev/null +++ b/sli/common/src/test/resources/EscapedJson.json @@ -0,0 +1 @@ +{\"widget\":{\"debug\":false,\"window\":{\"title\":\"ONAP Widget\",\"name\":\"main_window\",\"width\":200,\"height\":300},\"image\":{\"src\":\"images\/moon.png\",\"name\":\"moon\",\"hOffset\":150,\"vOffset\":150,\"alignment\":\"center\"},\"text\":{\"data\":\"Click Me\",\"size\":21,\"style\":\"bold\",\"name\":\"text1\",\"hOffset\":350,\"vOffset\":200,\"alignment\":\"center\"}}}
\ No newline at end of file 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..708823efc --- /dev/null +++ b/sli/common/src/test/resources/EvcActivateSvcLogic_v100.xml @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + ONAP : CCSDK + ================================================================================ + 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.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module="ase" version="1.0.0"> + + + <method rpc="ase-evc-activation" mode="sync"> + <configure adaptor="org.onap.ccsdl.sli.adaptors.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.onap.ccsdk.sli.adaptors.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..9a1a14708 --- /dev/null +++ b/sli/common/src/test/resources/EvcPortSvcLogic_v100.xml @@ -0,0 +1,263 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + ONAP : CCSDK + ================================================================================ + 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.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.core.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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.core.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.onap.ccsdk.sli.adaptors.sample.SampleResource" + resource="ase-port" key="uni-circuit-id == $uni-circuit-id" pfx="asePort"> + + <outcome value="success"> + <configure adaptor="org.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.core.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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.sample.SampleResource" + resource="ase-port" key="uni-circuit-id == $uni-circuit-id"> + <outcome value="success"> + <block> + <record plugin="org.onap.ccsdk.sli.core.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/JsonObject.json b/sli/common/src/test/resources/JsonObject.json new file mode 100644 index 000000000..0578368f8 --- /dev/null +++ b/sli/common/src/test/resources/JsonObject.json @@ -0,0 +1,5 @@ +{
+ "aaa": "123",
+ "bbb": "xyz",
+ "c.d": "abc"
+}
\ No newline at end of file diff --git a/sli/common/src/test/resources/ObjectMenu.json b/sli/common/src/test/resources/ObjectMenu.json new file mode 100644 index 000000000..56f842d48 --- /dev/null +++ b/sli/common/src/test/resources/ObjectMenu.json @@ -0,0 +1,43 @@ +{
+ "menu": [{
+ "id": "1",
+ "type": "pizza",
+ "name": "plain",
+ "calories": 1000,
+ "vegetarian": true
+ }, {
+ "id": "2",
+ "type": "pizza",
+ "name": "Tuesday Special",
+ "calories": 2000,
+ "vegetarian": false,
+ "topping":
+ [{
+ "id": "1",
+ "name": "onion"
+ }, {
+ "id": "2",
+ "name": "pepperoni"
+ }
+ ]
+ }, {
+ "id": "3",
+ "type": "pizza",
+ "name": "House Special",
+ "calories": 1500,
+ "vegetarian": true,
+ "topping":
+ [{
+ "id": "3",
+ "name": "basil"
+ }, {
+ "id": "4",
+ "name": "fresh mozzarella"
+ }, {
+ "id": "5",
+ "name": "tomato"
+ }
+ ]
+ }
+ ]
+}
diff --git a/sli/common/src/test/resources/QuotedValues.json b/sli/common/src/test/resources/QuotedValues.json new file mode 100644 index 000000000..8bf91c66b --- /dev/null +++ b/sli/common/src/test/resources/QuotedValues.json @@ -0,0 +1,43 @@ +{
+ "menu": [{
+ "id": "1",
+ "type": "pizza",
+ "name": "plain",
+ "calories": "1000",
+ "vegetarian": true
+ }, {
+ "id": "2",
+ "type": "pizza",
+ "name": "Tuesday Special",
+ "calories": "2000",
+ "vegetarian": false,
+ "topping":
+ [{
+ "id": "1",
+ "name": "onion"
+ }, {
+ "id": "2",
+ "name": "pepperoni"
+ }
+ ]
+ }, {
+ "id": "3",
+ "type": "pizza",
+ "name": "House Special",
+ "calories": "1500",
+ "vegetarian": true,
+ "topping":
+ [{
+ "id": "3",
+ "name": "basil"
+ }, {
+ "id": "4",
+ "name": "fresh mozzarella"
+ }, {
+ "id": "5",
+ "name": "tomato"
+ }
+ ]
+ }
+ ]
+}
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..cee027f75 --- /dev/null +++ b/sli/common/src/test/resources/ReleasePortSvcLogic_v101.xml @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + ============LICENSE_START======================================================= + ONAP : CCSDK + ================================================================================ + 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.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.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.onap.ccsdk.sli.adaptors.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.onap.ccsdk.sli.adaptors.sample.SampleResource" + resource="ase-port" key="uni-circuit-id == $uni-circuit-id"> + <outcome value="success"> + <configure adaptor="org.onap.ccsdk.sli.adaptors.emt.EmtAdaptor" + key="$uni-circuit-id" activate="false"> + + <outcome value="success"> + <block> + <record plugin="org.onap.ccsdk.sli.core.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/Widget.json b/sli/common/src/test/resources/Widget.json new file mode 100644 index 000000000..6b90907ce --- /dev/null +++ b/sli/common/src/test/resources/Widget.json @@ -0,0 +1,27 @@ +{
+ "widget": {
+ "debug": false,
+ "window": {
+ "title": "ONAP Widget",
+ "name": "main_window",
+ "width": 200,
+ "height": 300
+ },
+ "image": {
+ "src": "images/moon.png",
+ "name": "moon",
+ "hOffset": 150,
+ "vOffset": 150,
+ "alignment": "center"
+ },
+ "text": {
+ "data": "Click Me",
+ "size": 21,
+ "style": "bold",
+ "name": "text1",
+ "hOffset": 350,
+ "vOffset": null,
+ "alignment": "center"
+ }
+ }
+}
\ No newline at end of file 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..e6ec8614b --- /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======================================================= + ONAP : CCSDK + ================================================================================ + 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.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.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/dblib.properties b/sli/common/src/test/resources/dblib.properties new file mode 100755 index 000000000..f08dce7a0 --- /dev/null +++ b/sli/common/src/test/resources/dblib.properties @@ -0,0 +1,14 @@ +org.onap.ccsdk.sli.dbtype=jdbc +org.onap.ccsdk.sli.jdbc.hosts=sdnctldb01,sdnctldb02 +org.onap.ccsdk.sli.jdbc.url=jdbc:derby:memory:test;create=true +org.onap.ccsdk.sli.jdbc.driver=org.apache.derby.jdbc.EmbeddedDriver +org.onap.ccsdk.sli.jdbc.database=test +org.onap.ccsdk.sli.jdbc.user=test +org.onap.ccsdk.sli.jdbc.password=test +org.onap.ccsdk.sli.jdbc.connection.name=sdnctldb01 + +org.onap.ccsdk.sli.jdbc.connection.timeout=50 +org.onap.ccsdk.sli.jdbc.request.timeout=100 +org.onap.ccsdk.sli.jdbc.limit.init=10 +org.onap.ccsdk.sli.jdbc.limit.min=10 +org.onap.ccsdk.sli.jdbc.limit.max=20 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/graphs/sliapi/graph.versions b/sli/common/src/test/resources/graphs/sliapi/graph.versions new file mode 100644 index 000000000..d72920a43 --- /dev/null +++ b/sli/common/src/test/resources/graphs/sliapi/graph.versions @@ -0,0 +1 @@ +sli healthcheck 1.0.0 sync diff --git a/sli/common/src/test/resources/graphs/sliapi/sli_healthcheck.xml b/sli/common/src/test/resources/graphs/sliapi/sli_healthcheck.xml new file mode 100644 index 000000000..d512f546f --- /dev/null +++ b/sli/common/src/test/resources/graphs/sliapi/sli_healthcheck.xml @@ -0,0 +1,27 @@ +<!-- + ============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.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" module='sli' version='1.0.0'><method rpc='healthcheck' mode='sync'> +<set> +<parameter name='error-code' value='200' /> +<parameter name='error-message' value='SDN-C is healthy'/> +<parameter name='ack-final' value='Y'/> +</set></method></service-logic> diff --git a/sli/common/src/test/resources/l3sdn_logic_v10.xml b/sli/common/src/test/resources/l3sdn_logic_v10.xml new file mode 100644 index 000000000..58a420f9e --- /dev/null +++ b/sli/common/src/test/resources/l3sdn_logic_v10.xml @@ -0,0 +1,208 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- ============LICENSE_START======================================================= + ONAP : CCSDK ================================================================================ + 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.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.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="switchTester" mode="sync"> + + <switch test="`$test-value`"> + <outcome value=""> + <return status="success"> + <parameter name="visited-outcome" value="empty string" /> + </return> + </outcome> + <outcome value="Other"> + <return status="success"> + <parameter name="visited-outcome" value="Other" /> + </return> + </outcome> + </switch> + + + </method> + + <method rpc="forRecordTester" mode="sync"> + <for index="i" start="0" end="1"> + <record plugin="org.onap.ccsdk.sli.core.sli.provider.DummyRecorder"> + <parameter name="level" value="INFO"/> + <parameter name="field1" value="`forRecordTester message $i`"/> + </record> + </for> + </method> + + <method rpc="whileNodeTester" mode="sync"> + <while test="`$test-value`"> + <break/> + </while> + + </method> + + <method rpc="resourceTester" mode="sync"> + <block> + <set> + <parameter name='resource-plugin' + value='org.onap.ccsdk.sli.core.sli.provider.DummyResource' /> + </set> + + <save plugin="`$resource-plugin`" resource="sample" key="sample-key == 'resourceTester.status'"> + <parameter name="sample-key" value="resourceTester.status"/> + <parameter name="sample-value" value="FAILED"/> + </save> + + <update plugin="`$resource-plugin`" resource="sample" key="sample-key == 'resourceTester.status'"> + <parameter name="sample-key" value="resourceTester.status"/> + <parameter name="sample-value" value="PASSED"/> + </update> + + <get-resource plugin="`$resource-plugin`" resource="sample" key="sample-key == 'resourceTester.status'" pfx="sample"/> + + <exists plugin="`$resource-plugin`" resource="sample" key="sample-key == 'resourceTester.status'"/> + + <is-available plugin="`$resource-plugin`" resource="sample" key="sample-key == 'resourceTester.status'"/> + + <reserve plugin="`$resource-plugin`" resource="sample" key="sample-key == 'resourceTester.status'"/> + + <release plugin="`$resource-plugin`" resource="sample" key="sample-key == 'resourceTester.status'"/> + + + <reserve plugin="`$resource-plugin`" resource="sample" key="sample-key == 'resourceTester.status'"/> + + <notify plugin="`$resource-plugin`" resource="sample" action="RESERVE"/> + + <delete plugin="`$resource-plugin`" resource="sample" key="sample-key == 'resourceTester.status'"/> + + + + </block> + </method> + + <method rpc="configureTester" mode="sync"> + <block> + <set> + <parameter name='configure-plugin' + value='org.onap.ccsdk.sli.core.sli.provider.DummyAdaptor' /> + </set> + <configure adaptor="`$configure-plugin`" key="dummy" activate="true"> + <parameter name="field1" value="1"/> + </configure> + <configure adaptor="`$configure-plugin`" key="SUCCESS" activate="true"> + <parameter name="field1" value="1"/> + </configure> + <configure adaptor="`$configure-plugin`" key="ALREADY_ACTIVE" activate="true"> + <parameter name="field1" value="1"/> + </configure> + <configure adaptor="`$configure-plugin`" key="NOT_FOUND" activate="true"> + <parameter name="field1" value="1"/> + </configure> + <configure adaptor="`$configure-plugin`" key="NOT_READY" activate="true"> + <parameter name="field1" value="1"/> + </configure> + <configure adaptor="`$configure-plugin`" key="FAILURE" activate="true"> + <parameter name="field1" value="1"/> + </configure> + <configure adaptor="`$configure-plugin`" key="dummy" activate="false"> + <parameter name="field1" value="1"/> + </configure> + <configure adaptor="`$configure-plugin`" key="SUCCESS" activate="false"> + <parameter name="field1" value="1"/> + </configure> + <configure adaptor="`$configure-plugin`" key="ALREADY_ACTIVE" activate="false"> + <parameter name="field1" value="1"/> + </configure> + <configure adaptor="`$configure-plugin`" key="NOT_FOUND" activate="false"> + <parameter name="field1" value="1"/> + </configure> + <configure adaptor="`$configure-plugin`" key="NOT_READY" activate="false"> + <parameter name="field1" value="1"/> + </configure> + <configure adaptor="`$configure-plugin`" key="FAILURE" activate="false"> + <parameter name="field1" value="1"/> + </configure> + + </block> + </method> + + + <method rpc="javaPluginTester" mode="sync"> + <block> + <set> + <parameter name='java-plugin' + value='org.onap.ccsdk.sli.core.sli.provider.VoidDummyPlugin' /> + </set> + <execute plugin="`$java-plugin`" method="dummy"/> + </block> + </method> + + <method rpc="allNodesTester" mode="sync"> + <block> + <set> + <parameter name='resource-plugin' + value='org.onap.ccsdk.sli.core.sli.provider.DummyResource' /> + <parameter name='configure-plugin' + value='org.onap.ccsdk.sli.core.sli.provider.DummyAdaptor' /> + <parameter name='java-plugin' + value='org.onap.ccsdk.sli.core.sli.provider.VoidDummyPlugin' /> + + </set> + + <call rpc="switchTester" mode="sync" /> + + <call rpc="forRecordTester" mode="sync"/> + + <call rpc="resourceTester" mode="sync"/> + + <call rpc="configureTester" mode="sync"/> + + <call rpc="javaPluginTester" mode="sync"/> + + <call rpc="whileNodeTester" mode="sync"/> + + </block> + </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="eval($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/log4j2.properties b/sli/common/src/test/resources/log4j2.properties new file mode 100644 index 000000000..3a5d8ef76 --- /dev/null +++ b/sli/common/src/test/resources/log4j2.properties @@ -0,0 +1,39 @@ +### +# ============LICENSE_START======================================================= +# ONAP : CCSDK +# ================================================================================ +# Copyright (C) 2020 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========================================================= +### + +status = error +name = PropertiesConfig + +filters = threshold + +filter.threshold.type = ThresholdFilter +filter.threshold.level = debug + +appenders = console + +appender.console.type = Console +appender.console.name = STDOUT +appender.console.layout.type = PatternLayout +appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n + +rootLogger.level = debug +rootLogger.appenderRefs = stdout +rootLogger.appenderRef.stdout.ref = STDOUT diff --git a/sli/common/src/test/resources/mergetest.xml b/sli/common/src/test/resources/mergetest.xml new file mode 100644 index 000000000..95c26da27 --- /dev/null +++ b/sli/common/src/test/resources/mergetest.xml @@ -0,0 +1,54 @@ +<!-- + ============LICENSE_START======================================================= + ONAP : CCSDK + ================================================================================ + 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.onap.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..74088036b --- /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======================================================= + ONAP : CCSDK + ================================================================================ + 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.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.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..c30c6bfc6 --- /dev/null +++ b/sli/common/src/test/resources/nonsense.xml @@ -0,0 +1,24 @@ +<!-- + ============LICENSE_START======================================================= + ONAP : CCSDK + ================================================================================ + 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..4147fdb62 --- /dev/null +++ b/sli/common/src/test/resources/parser-good.tests @@ -0,0 +1,3 @@ +ReleasePortSvcLogic_v101.xml +neutron_logic_v10.xml +l3sdn_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..73e4d3a99 --- /dev/null +++ b/sli/common/src/test/resources/simplelogger.properties @@ -0,0 +1,24 @@ +### +# ============LICENSE_START======================================================= +# ONAP : CCSDK +# ================================================================================ +# 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.onap.ccsdk.sli.core.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..426960f76 --- /dev/null +++ b/sli/common/src/test/resources/svclogic.properties @@ -0,0 +1,27 @@ +### +# ============LICENSE_START======================================================= +# ONAP : CCSDK +# ================================================================================ +# 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.onap.ccsdk.sli.dbtype = jdbc +org.onap.ccsdk.sli.jdbc.url=jdbc:derby:memory:sdnctl;create=true +org.onap.ccsdk.sli.jdbc.driver=org.apache.derby.jdbc.EmbeddedDriver +org.onap.ccsdk.sli.jdbc.database = sdnctl +org.onap.ccsdk.sli.jdbc.user = test +org.onap.ccsdk.sli.jdbc.password = test diff --git a/sli/common/src/test/resources/svclogic.sh b/sli/common/src/test/resources/svclogic.sh new file mode 100644 index 000000000..67977c3d9 --- /dev/null +++ b/sli/common/src/test/resources/svclogic.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +### +# ============LICENSE_START======================================================= +# ONAP : CCSDK +# ================================================================================ +# 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.onap.ccsdk.sli.core.sli.SvcLogicParser $* |