diff options
Diffstat (limited to 'sli/common/src')
15 files changed, 604 insertions, 25 deletions
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/MessageWriter.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/MessageWriter.java index c75873eb..0e39896e 100644 --- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/MessageWriter.java +++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/MessageWriter.java @@ -8,9 +8,9 @@ * 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. @@ -38,7 +38,7 @@ import org.osgi.framework.ServiceReference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - +@Deprecated public class MessageWriter { private static final Logger LOG = LoggerFactory.getLogger(MessageWriter.class); diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicDblibStore.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicDblibStore.java index ee3bcca5..864652b4 100644 --- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicDblibStore.java +++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicDblibStore.java @@ -66,6 +66,19 @@ public class SvcLogicDblibStore implements SvcLogicStore { this.dbSvc = dbsvc; } + public SvcLogicDblibStore(Properties props) { + try { + dbSvc = new DBResourceManager(props); + JavaSingleton.setInstance(dbSvc); + } catch (Exception e) { + LOG.warn("Caught exception trying to create DBResourceManager", e); + } + } + + public Connection getConnection() throws SQLException { + return(dbSvc.getConnection()); + } + @Override public void init(Properties props) throws ConfigurationException { diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicJdbcStore.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicJdbcStore.java index e2fbdf72..0e7d05a6 100644 --- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicJdbcStore.java +++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicJdbcStore.java @@ -38,7 +38,6 @@ import java.util.Properties; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - public class SvcLogicJdbcStore implements SvcLogicStore { private static final Logger LOG = LoggerFactory.getLogger(SvcLogicJdbcStore.class); diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicParser.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicParser.java index 3d9caffb..2804f620 100644 --- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicParser.java +++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicParser.java @@ -437,7 +437,7 @@ public class SvcLogicParser { } - + public static void load(String xmlfile, SvcLogicStore store) throws SvcLogicException { File xmlFile = new File(xmlfile); if (!xmlFile.canRead()) { @@ -531,7 +531,7 @@ public class SvcLogicParser { } - private static void activate(String module, String rpc, String version, String mode, SvcLogicStore store) { + public static void activate(String module, String rpc, String version, String mode, SvcLogicStore store) { String details = "(module:" + module + ", rpc:" + rpc + ", version:" + version + ", mode:" + mode + ")"; try { @@ -560,7 +560,7 @@ public class SvcLogicParser { System.exit(1); } - + protected SAXParser initParser() throws ParserConfigurationException, SAXException { URL xsdUrl = null; Schema schema = null; diff --git a/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/ITCaseSvcLogicParser.java b/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/ITCaseSvcLogicParser.java index 368d9f95..6ee18e92 100644 --- a/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/ITCaseSvcLogicParser.java +++ b/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/ITCaseSvcLogicParser.java @@ -32,11 +32,13 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; import java.util.Properties; -import ch.vorburger.mariadb4j.DB; -import ch.vorburger.mariadb4j.DBConfigurationBuilder; - import org.junit.After; import org.junit.AfterClass; import org.junit.Before; @@ -67,17 +69,9 @@ public class ITCaseSvcLogicParser { props.load(propStr); + store = SvcLogicStoreFactory.getSvcLogicStore(props); - // Start MariaDB4j database - DBConfigurationBuilder config = DBConfigurationBuilder.newBuilder(); - config.setPort(0); // 0 => autom. detect free port - DB db = DB.newEmbeddedDB(config.build()); - db.start(); - - - // Override jdbc URL and database name - props.setProperty("org.onap.ccsdk.sli.jdbc.database", "test"); - props.setProperty("org.onap.ccsdk.sli.jdbc.url", config.getURL("test")); + assertNotNull(store); } @@ -120,8 +114,123 @@ public class ITCaseSvcLogicParser { } try { - SvcLogicParser.validate(testCaseUrl.getPath(), store); + SvcLogicParser.load(testCaseUrl.getPath(), store); } catch (Exception e) { + + fail("Validation failure [" + e.getMessage() + "]"); + } + } + } + } catch (SvcLogicParserException e) { + fail("Parser error : " + e.getMessage()); + } catch (Exception e) { + LOG.error("", e); + fail("Caught exception processing test cases"); + } + } + + @Test + public void testDblibLoadValidXml() throws IOException, SQLException, ConfigurationException { + + URL propUrl = ITCaseSvcLogicParser.class.getResource("/dblib.properties"); + + InputStream propStr = ITCaseSvcLogicParser.class.getResourceAsStream("/dblib.properties"); + + Properties props = new Properties(); + + props.load(propStr); + + SvcLogicDblibStore dblibStore = new SvcLogicDblibStore(props); + + Connection dbConn = dblibStore.getConnection(); + + String dbName = props.getProperty("org.onap.ccsdk.sli.jdbc.database", "sdnctl"); + + DatabaseMetaData dbm; + + try { + dbm = dbConn.getMetaData(); + } catch (SQLException e) { + + throw new ConfigurationException("could not get databse metadata", e); + } + + // See if table SVC_LOGIC exists. If not, create it. + Statement stmt = null; + try { + + ResultSet tables = dbm.getTables(null, null, "SVC_LOGIC", null); + if (tables.next()) { + LOG.debug("SVC_LOGIC table already exists"); + } else { + String crTableCmd = "CREATE TABLE " + dbName + ".SVC_LOGIC (" + "module varchar(80) NOT NULL," + + "rpc varchar(80) NOT NULL," + "version varchar(40) NOT NULL," + "mode varchar(5) NOT NULL," + + "active varchar(1) NOT NULL," + "graph BLOB," + + "CONSTRAINT P_SVC_LOGIC PRIMARY KEY(module, rpc, version, mode))"; + + stmt = dbConn.createStatement(); + stmt.executeUpdate(crTableCmd); + } + } catch (Exception e) { + throw new ConfigurationException("could not create SVC_LOGIC table", e); + } finally { + if (stmt != null) { + try { + stmt.close(); + } catch (SQLException e) { + LOG.error("Statement close error ", e); + } + } + } + + // See if NODE_TYPES table exists and, if not, create it + stmt = null; + try { + + ResultSet tables = dbm.getTables(null, null, "NODE_TYPES", null); + if (tables.next()) { + LOG.debug("NODE_TYPES table already exists"); + } else { + String crTableCmd = "CREATE TABLE " + dbName + ".NODE_TYPES (" + "nodetype varchar(80) NOT NULL," + + "CONSTRAINT P_NODE_TYPES PRIMARY KEY(nodetype))"; + + stmt = dbConn.createStatement(); + + stmt.executeUpdate(crTableCmd); + } + } catch (Exception e) { + throw new ConfigurationException("could not create SVC_LOGIC table", e); + } finally { + if (stmt != null) { + try { + stmt.close(); + } catch (SQLException e) { + LOG.error("Statement close error ", e); + } + } + } + + try { + InputStream testStr = getClass().getResourceAsStream("/parser-good.tests"); + BufferedReader testsReader = new BufferedReader(new InputStreamReader(testStr)); + String testCaseFile = null; + while ((testCaseFile = testsReader.readLine()) != null) { + + testCaseFile = testCaseFile.trim(); + + if (testCaseFile.length() > 0) { + if (!testCaseFile.startsWith("/")) { + testCaseFile = "/" + testCaseFile; + } + URL testCaseUrl = getClass().getResource(testCaseFile); + if (testCaseUrl == null) { + fail("Could not resolve test case file " + testCaseFile); + } + + try { + SvcLogicParser.load(testCaseUrl.getPath(), dblibStore); + } catch (Exception e) { + fail("Validation failure [" + e.getMessage() + "]"); } } @@ -152,7 +261,7 @@ public class ITCaseSvcLogicParser { if (testCaseUrl == null) { fail("Could not resolve test case file " + testCaseFile); } - SvcLogicParser.load(testCaseUrl.getPath(), store); + SvcLogicParser.validate(testCaseUrl.getPath(), store); } } } diff --git a/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/PrintYangToPropTest.java b/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/PrintYangToPropTest.java index 21d3e59c..fb6eaf70 100644 --- a/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/PrintYangToPropTest.java +++ b/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/PrintYangToPropTest.java @@ -15,6 +15,9 @@ import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.Exe import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInputBuilder; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameter; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.execute.graph.input.SliParameterBuilder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddressBuilder; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefixBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -50,6 +53,22 @@ public class PrintYangToPropTest { pBuilder.setIntValue(null); pBuilder.setBooleanValue(true); pList.add(pBuilder.build()); + pBuilder.setParameterName("ipaddress-value1"); + pBuilder.setBooleanValue(null); + pBuilder.setIpaddressValue(IpAddressBuilder.getDefaultInstance("127.0.0.1")); + pList.add(pBuilder.build()); + pBuilder.setParameterName("ipaddress-value1"); + pBuilder.setIpaddressValue(IpAddressBuilder.getDefaultInstance("::1")); + pList.add(pBuilder.build()); + pBuilder.setParameterName("ipprefix-value1"); + pBuilder.setIpaddressValue(null); + pBuilder.setIpprefixValue(IpPrefixBuilder.getDefaultInstance("192.168.0.0/16")); + pList.add(pBuilder.build()); + pBuilder.setParameterName("ipprefix-value2"); + pBuilder.setIpprefixValue(IpPrefixBuilder.getDefaultInstance("2001:db8:3c4d::/48")); + pList.add(pBuilder.build()); + + egBuilder.setSliParameter(pList); @@ -64,6 +83,9 @@ public class PrintYangToPropTest { LOG.info("Property {} = {}", propName, props.getProperty(propName)); } + // Generate builder from properties just generated + PrintYangToProp.toBuilder(props, pBuilder); + } } diff --git a/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/TestMetricLogger.java b/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/TestMetricLogger.java new file mode 100644 index 00000000..31a419bb --- /dev/null +++ b/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/TestMetricLogger.java @@ -0,0 +1,135 @@ +package org.onap.ccsdk.sli.core.sli; + +import static org.junit.Assert.*; +import java.util.Date; +import org.junit.Before; +import org.junit.Test; + +public class TestMetricLogger { + + MetricLogger logger; + + @Before + public void setUp() throws Exception { + + logger = new MetricLogger(); + logger.resetContext(); + logger.logRequest("svcInstance1", "svcName", "svcPartner", "targetEntity", "targetServiceName", "targetVirtualEntity", "hello-world"); + logger.logResponse("200", "200", "SUCCESS"); + + } + + @Test + public final void testGetBeginTimestamp() { + logger.getBeginTimestamp(); + } + + @Test + public final void testGetEndTimestamp() { + logger.getEndTimestamp(); + } + + @Test + public final void testGetRequestID() { + logger.getRequestID(); + } + + @Test + public final void testGetServiceInstanceID() { + logger.getServiceInstanceID(); + } + + @Test + public final void testGetServiceName() { + logger.getServiceName(); + } + + @Test + public final void testGetPartnerName() { + logger.getPartnerName(); + } + + @Test + public final void testGetTargetEntity() { + logger.getTargetEntity(); + } + + @Test + public final void testGetTargetServiceName() { + logger.getTargetServiceName(); + } + + @Test + public final void testGetStatusCode() { + logger.getStatusCode(); + } + + @Test + public final void testGetResponseCode() { + logger.getResponseCode(); + } + + @Test + public final void testGetResponseDescription() { + logger.getResponseDescription(); + } + + @Test + public final void testGetInstanceUUID() { + logger.getInstanceUUID(); + } + + @Test + public final void testGetCategoryLogLevel() { + logger.getCategoryLogLevel(); + } + + @Test + public final void testGetSeverity() { + logger.getSeverity(); + } + + @Test + public final void testGetServerIpAddress() { + logger.getServerIpAddress(); + } + + @Test + public final void testGetElapsedTime() { + logger.getElapsedTime(); + } + + @Test + public final void testGetServer() { + logger.getServer(); + } + + @Test + public final void testGetClientIp() { + logger.getClientIp(); + } + + @Test + public final void testGetClassName() { + logger.getClassName(); + } + + @Test + public final void testGetTargetVirtualEntity() { + logger.getTargetVirtualEntity(); + } + + @Test + public final void testAsIso8601Date() { + logger.asIso8601(new Date()); + } + + @Test + public final void testAsIso8601Long() { + logger.asIso8601(System.currentTimeMillis()); + } + + + + +} diff --git a/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/TestSvcLogicLoader.java b/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/TestSvcLogicLoader.java new file mode 100644 index 00000000..8998382e --- /dev/null +++ b/sli/common/src/test/java/org/onap/ccsdk/sli/core/sli/TestSvcLogicLoader.java @@ -0,0 +1,38 @@ +package org.onap.ccsdk.sli.core.sli; + +import static org.junit.Assert.*; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.Properties; +import org.junit.Test; + +public class TestSvcLogicLoader { + + @Test + public void testLoadAndActivate() throws IOException, SvcLogicException { + URL propUrl = ITCaseSvcLogicParser.class.getResource("/svclogic.properties"); + + InputStream propStr = ITCaseSvcLogicParser.class.getResourceAsStream("/svclogic.properties"); + + Properties props = new Properties(); + + props.load(propStr); + + SvcLogicStore store = SvcLogicStoreFactory.getSvcLogicStore(props); + + URL graphUrl = TestSvcLogicLoader.class.getClassLoader().getResource("graphs"); + + if (graphUrl == null) { + fail("Cannot find graphs directory"); + } + + SvcLogicLoader loader = new SvcLogicLoader(graphUrl.getPath(), store); + loader.loadAndActivate(); + + + } + + + +} 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>
|