diff options
author | Timoney, Dan (dt5972) <dt5972@att.com> | 2018-03-24 19:11:10 -0400 |
---|---|---|
committer | Timoney, Dan (dt5972) <dt5972@att.com> | 2018-03-27 14:58:43 -0400 |
commit | a0ab49e6c1ea41af18656d6e9efb3377051f2528 (patch) | |
tree | dc935417ffa4aac764aef2f1978c1ceecd68bd55 /sli/common/src/test/resources | |
parent | 5e0f12e215d579b2adff145a8527cc6a225d8db9 (diff) |
Add unit tests for sli
Added unit tests for ccsdk/sli/core/sli
Change-Id: I0d2408c43b9e56a78f3e01e87985aedb6cad5953
Issue-ID: CCSDK-213
Signed-off-by: Timoney, Dan (dt5972) <dt5972@att.com>
Diffstat (limited to 'sli/common/src/test/resources')
7 files changed, 266 insertions, 3 deletions
diff --git a/sli/common/src/test/resources/dblib.properties b/sli/common/src/test/resources/dblib.properties new file mode 100755 index 00000000..f08dce7a --- /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/graphs/sliapi/graph.versions b/sli/common/src/test/resources/graphs/sliapi/graph.versions new file mode 100644 index 00000000..d72920a4 --- /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 00000000..d512f546 --- /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 00000000..58a420f9 --- /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/parser-good.tests b/sli/common/src/test/resources/parser-good.tests index 06543126..4147fdb6 100755 --- a/sli/common/src/test/resources/parser-good.tests +++ b/sli/common/src/test/resources/parser-good.tests @@ -1,2 +1,3 @@ ReleasePortSvcLogic_v101.xml neutron_logic_v10.xml +l3sdn_logic_v10.xml diff --git a/sli/common/src/test/resources/svclogic.properties b/sli/common/src/test/resources/svclogic.properties index 33d7ae6e..426960f7 100644 --- a/sli/common/src/test/resources/svclogic.properties +++ b/sli/common/src/test/resources/svclogic.properties @@ -20,7 +20,8 @@ ### org.onap.ccsdk.sli.dbtype = jdbc -org.onap.ccsdk.sli.jdbc.url = jdbc:mysql://localhost:3306/test -org.onap.ccsdk.sli.jdbc.database = test +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 = test123 +org.onap.ccsdk.sli.jdbc.password = test diff --git a/sli/common/src/test/resources/svclogic.xsd b/sli/common/src/test/resources/svclogic.xsd index a63758f7..2704de88 100755 --- a/sli/common/src/test/resources/svclogic.xsd +++ b/sli/common/src/test/resources/svclogic.xsd @@ -30,6 +30,7 @@ <xsd:element ref="call" />
<xsd:element ref="notify" />
<xsd:element ref="break" />
+ <xsd:element ref="while" />
</xsd:choice>
</xsd:group>
@@ -320,4 +321,14 @@ <xsd:complexType />
</xsd:element>
+ <xsd:element name="while">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:group ref="node" minOccurs="0" maxOccurs="unbounded" />
+ </xsd:sequence>
+ <xsd:attribute name="test" use="required" type="xsd:string" />
+ <xsd:attribute name="do" use="optional" type="xsd:boolean" />
+ </xsd:complexType>
+ </xsd:element>
+
</xsd:schema>
|