diff options
13 files changed, 531 insertions, 133 deletions
diff --git a/dblib/provider/pom.xml b/dblib/provider/pom.xml index d0dc72933..730919de0 100755 --- a/dblib/provider/pom.xml +++ b/dblib/provider/pom.xml @@ -21,6 +21,12 @@ <version>${junit.version}</version> <scope>test</scope> </dependency> + <dependency> + <groupId>ch.vorburger.mariaDB4j</groupId> + <artifactId>mariaDB4j</artifactId> + <version>2.2.3</version> + <scope>test</scope> + </dependency> <dependency> <groupId>equinoxSDK381</groupId> <artifactId>org.eclipse.osgi</artifactId> diff --git a/dblib/provider/src/test/java/org/onap/ccsdk/sli/core/dblib/TestDBResourceManager.java b/dblib/provider/src/test/java/org/onap/ccsdk/sli/core/dblib/TestDBResourceManager.java new file mode 100644 index 000000000..dca07921b --- /dev/null +++ b/dblib/provider/src/test/java/org/onap/ccsdk/sli/core/dblib/TestDBResourceManager.java @@ -0,0 +1,55 @@ +package org.onap.ccsdk.sli.core.dblib; + +import static org.junit.Assert.*; + +import java.io.InputStream; +import java.net.URL; +import java.util.Properties; + +import org.junit.Before; +import org.junit.Test; + +import ch.vorburger.mariadb4j.DB; +import ch.vorburger.mariadb4j.DBConfigurationBuilder; + +public class TestDBResourceManager { + + DbLibService dblibSvc; + + @Before + public void setUp() throws Exception { + URL propUrl = getClass().getResource("/dblib.properties"); + + InputStream propStr = getClass().getResourceAsStream("/dblib.properties"); + + Properties props = new Properties(); + + props.load(propStr); + + + // 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")); + + + dblibSvc = new DBResourceManager(props); + + dblibSvc.writeData("CREATE TABLE DBLIB_TEST (name varchar(20));", null, null); + dblibSvc.getData("SELECT * FROM DBLIB_TEST", null, null); + + } + + @Test + public void test() { + + + } + +} diff --git a/dblib/provider/src/test/resources/dblib.properties b/dblib/provider/src/test/resources/dblib.properties new file mode 100644 index 000000000..9506ac8d1 --- /dev/null +++ b/dblib/provider/src/test/resources/dblib.properties @@ -0,0 +1,38 @@ +### +# ============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========================================================= +### + +# dblib.properrties +org.onap.ccsdk.sli.dbtype=jdbc + +org.onap.ccsdk.sli.jdbc.hosts=sdnctldb01 +org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://dbhost:3306/sdnctl +org.onap.ccsdk.sli.jdbc.driver=org.mariadb.jdbc.Driver +org.onap.ccsdk.sli.jdbc.database=sdnctl +org.onap.ccsdk.sli.jdbc.user=sdnctl +org.onap.ccsdk.sli.jdbc.password=gamma +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 +org.onap.dblib.connection.recovery=false + diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicVariableTerm.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicVariableTerm.java index b089d60e3..4edf3ecbe 100644 --- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicVariableTerm.java +++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicVariableTerm.java @@ -47,10 +47,10 @@ public class SvcLogicVariableTerm extends SvcLogicExpression { } } - + @Override public String toString() { - String retval = ""; + String retval; if (numOperands() > 0) { diff --git a/sli/model/pom.xml b/sli/model/pom.xml new file mode 100755 index 000000000..18b56f46b --- /dev/null +++ b/sli/model/pom.xml @@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>sli</artifactId> + <groupId>org.onap.ccsdk.sli.core</groupId> + <version>0.1.2-SNAPSHOT</version> + </parent> + <artifactId>sli-model</artifactId> + <packaging>bundle</packaging> + <name>SLI - Model</name> + <build> + + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Import-Package>*</Import-Package> + </instructions> + </configuration> + </plugin> + <plugin> + <groupId>org.opendaylight.yangtools</groupId> + <artifactId>yang-maven-plugin</artifactId> + <version>${odl.yangtools.yang.maven.plugin.version}</version> + <dependencies> + <dependency> + <groupId>org.opendaylight.mdsal</groupId> + <artifactId>maven-sal-api-gen-plugin</artifactId> + <version>${odl.sal.api.gen.plugin.version}</version> + <type>jar</type> + </dependency> + </dependencies> + <executions> + <execution> + <goals> + <goal>generate-sources</goal> + </goals> + <configuration> + <yangFilesRootDir>${yang.file.directory}</yangFilesRootDir> + <codeGenerators> + <generator> + <!-- + <codeGeneratorClass>org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass> + --> + <codeGeneratorClass>org.opendaylight.mdsal.binding.maven.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass> + <outputBaseDir>${salGeneratorPath}</outputBaseDir> + </generator> + </codeGenerators> + <inspectDependencies>true</inspectDependencies> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>org.opendaylight.mdsal</groupId> + <artifactId>yang-binding</artifactId> + <version>${odl.mdsal.yang.binding.version}</version> + </dependency> + <dependency> + <groupId>org.opendaylight.yangtools</groupId> + <artifactId>yang-common</artifactId> + <version>${odl.yangtools.version}</version> + </dependency> + <dependency> + <groupId>org.opendaylight.mdsal.model</groupId> + <artifactId>ietf-inet-types</artifactId> + <version>${odl.ietf-inet-types.version}</version> + </dependency> + <dependency> + <groupId>org.opendaylight.mdsal.model</groupId> + <artifactId>ietf-yang-types</artifactId> + <version>${odl.ietf-yang-types.version}</version> + </dependency> + </dependencies> +</project> diff --git a/sli/model/src/main/yang/sliapi.yang b/sli/model/src/main/yang/sliapi.yang new file mode 100755 index 000000000..5d91ba2d5 --- /dev/null +++ b/sli/model/src/main/yang/sliapi.yang @@ -0,0 +1,117 @@ +module SLI-API { + + yang-version 1; + + namespace "org:onap:ccsdk:sli:core:sliapi"; + + prefix sample; + + import ietf-inet-types { prefix "inet"; revision-date 2010-09-24; } + + organization "ONAP"; + + contact + "Dan Timoney"; + + description + "Defines API to service logic interpreter"; + + revision "2016-11-10" { + description + "REST API to Service Logic Interpreter"; + } + + grouping parameter-setting { + description + "Parameter setting"; + + leaf parameter-name { + type string; + description "Parameter name"; + } + + leaf int-value { + type int32; + } + leaf string-value { + type string; + } + leaf boolean-value { + type boolean; + } + leaf ipaddress-value { + type inet:ip-address; + } + leaf ipprefix-value { + type inet:ip-prefix; + } + } + + grouping response-fields { + leaf response-code { + type string; + } + leaf ack-final-indicator { + type string; + } + leaf response-message { + type string; + } + leaf context-memory-json { + type string; + } + } + + container test-results { + description "Test results"; + + list test-result { + key "test-identifier"; + + leaf test-identifier { + type string; + } + + leaf-list results { + type string; + } + } + } + + rpc execute-graph { + description " Method to add a new parameter."; + input { + + leaf module-name { + type string; + } + + leaf rpc-name { + type string; + } + + leaf mode { + type enumeration { + enum sync; + enum async; + } + } + + list sli-parameter { + key "parameter-name"; + uses parameter-setting; + } + } + + output { + uses response-fields; + } + } + + rpc healthcheck { + output { + uses response-fields; + } + } + +} diff --git a/sli/pom.xml b/sli/pom.xml index 7257e9ee4..de882159d 100755 --- a/sli/pom.xml +++ b/sli/pom.xml @@ -2,64 +2,65 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - <parent> - <groupId>org.onap.ccsdk.sli.core</groupId> - <artifactId>ccsdk-sli-core</artifactId> - <version>0.1.2-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - <packaging>pom</packaging> - <groupId>org.onap.ccsdk.sli.core</groupId> - <artifactId>sli</artifactId> + <parent> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>ccsdk-sli-core</artifactId> + <version>0.1.2-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + <packaging>pom</packaging> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli</artifactId> - <dependencyManagement> + <dependencyManagement> - <dependencies> - <dependency> - <groupId>org.onap.ccsdk.sli.core</groupId> - <artifactId>sli-features</artifactId> - <classifier>features</classifier> - <type>xml</type> - <version>${project.version}</version> - </dependency> + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-features</artifactId> + <classifier>features</classifier> + <type>xml</type> + <version>${project.version}</version> + </dependency> - <dependency> - <groupId>org.onap.ccsdk.sli.core</groupId> - <artifactId>sli-common</artifactId> - <version>${project.version}</version> - </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-common</artifactId> + <version>${project.version}</version> + </dependency> - <dependency> - <groupId>org.onap.ccsdk.sli.core</groupId> - <artifactId>sli-provider</artifactId> - <version>${project.version}</version> - </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-provider</artifactId> + <version>${project.version}</version> + </dependency> - <dependency> - <groupId>org.onap.ccsdk.sli.core</groupId> - <artifactId>sli-recording</artifactId> - <version>${project.version}</version> - </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-recording</artifactId> + <version>${project.version}</version> + </dependency> - </dependencies> + </dependencies> - </dependencyManagement> + </dependencyManagement> - <name>Service Logic Interpreter</name> - <description>The Service Logic Interpreter (SLI) allows service planners to design the flow of logic within the SDN controller in an XML format, without a need for custom Java code. </description> + <name>Service Logic Interpreter</name> + <description>The Service Logic Interpreter (SLI) allows service planners to design the flow of logic within the SDN controller in an XML format, without a need for custom Java code. </description> - <modules> - <module>common</module> - <module>provider</module> - <module>recording</module> - <module>features</module> - <module>installer</module> - </modules> - <organization> - <name>ONAP</name> - </organization> - <version>0.1.2-SNAPSHOT</version> + <modules> + <module>model</module> + <module>common</module> + <module>provider</module> + <module>recording</module> + <module>features</module> + <module>installer</module> + </modules> + <organization> + <name>ONAP</name> + </organization> + <version>0.1.2-SNAPSHOT</version> </project> diff --git a/sli/provider/pom.xml b/sli/provider/pom.xml index 51db628c7..7514c74e4 100755 --- a/sli/provider/pom.xml +++ b/sli/provider/pom.xml @@ -28,6 +28,12 @@ </dependency> <dependency> <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-model</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> <artifactId>sli-common</artifactId> <version>${project.version}</version> <scope>compile</scope> diff --git a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTest.java b/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTest.java index 3e8c57b01..c00da68c5 100644 --- a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTest.java +++ b/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTest.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. @@ -21,13 +21,32 @@ package org.onap.ccsdk.sli.core.sli.provider; +import java.io.File; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Properties; + +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput.Mode; +import org.onap.ccsdk.sli.core.sli.SvcLogicGraph; +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.IpAddressBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import junit.framework.TestCase; -public class MdsalHelperTest extends TestCase { - public static final String pathToSdnPropertiesFile = "./src/test/resources/l3sdn.properties"; +public class MdsalHelperTest extends TestCase { + private static final Logger LOG = LoggerFactory + .getLogger(MdsalHelperTest.class); + public static final String pathToSdnPropertiesFile = "src/test/resources/l3sdn.properties"; public void testSdnProperties() { + MdsalHelperTesterUtil.loadProperties(pathToSdnPropertiesFile); assertEquals("synccomplete", MdsalHelperTesterUtil.mapEnumeratedValue("request-status", "synccomplete")); assertEquals("asynccomplete", MdsalHelperTesterUtil.mapEnumeratedValue("request-status", "asynccomplete")); @@ -40,4 +59,77 @@ public class MdsalHelperTest extends TestCase { assertNotSame("synccomplete", MdsalHelperTesterUtil.mapEnumeratedValue("request-status", "Synccomplete")); } + public void testToProperties() { + + ExecuteGraphInputBuilder execBuilder = new ExecuteGraphInputBuilder(); + SliParameterBuilder parmBuilder = new SliParameterBuilder(); + List<SliParameter> params = new LinkedList<SliParameter>(); + + parmBuilder.setParameterName("boolean-parm"); + parmBuilder.setBooleanValue(Boolean.TRUE); + params.add(parmBuilder.build()); + + parmBuilder.setParameterName("int-parm"); + parmBuilder.setBooleanValue(null); + parmBuilder.setIntValue(1); + params.add(parmBuilder.build()); + + parmBuilder.setParameterName("str-parm"); + parmBuilder.setIntValue(null); + parmBuilder.setStringValue("hello"); + params.add(parmBuilder.build()); + + parmBuilder.setParameterName("ipaddress4-parm"); + parmBuilder.setStringValue(null); + parmBuilder.setIpaddressValue(IpAddressBuilder.getDefaultInstance("127.0.0.1")); + params.add(parmBuilder.build()); + + parmBuilder.setParameterName("ipaddress6-parm"); + parmBuilder.setIpaddressValue(IpAddressBuilder.getDefaultInstance("ef::1")); + params.add(parmBuilder.build()); + + + execBuilder.setMode(Mode.Sync); + execBuilder.setModuleName("my-module"); + execBuilder.setRpcName("do-it-now"); + execBuilder.setSliParameter(params); + + + Properties props = new Properties(); + + MdsalHelperTesterUtil.toProperties(props, execBuilder); + + LOG.info("Converted to properties"); + for (Map.Entry<Object, Object> e : props.entrySet()) { + LOG.info(e.getKey().toString() + " = "+e.getValue().toString()); + + } + + + } + + public void testToBuilder() { + + Properties props = new Properties(); + + props.setProperty("execute-graph-input.mode", "Sync"); + props.setProperty("execute-graph-input.module", "my-module"); + props.setProperty("execute-graph-input.rpc", "do-it-now"); + props.setProperty("execute-graph-input.sli-parameter[0].parameter-name", "bool-parm"); + props.setProperty("execute-graph-input.sli-parameter[0].boolean-value", "true"); + props.setProperty("execute-graph-input,sli-parameter[1].parameter-name", "int-param"); + props.setProperty("execute-graph-input.sli-parameter[1].int-value", "1"); + props.setProperty("execute-graph-input.sli-parameter[2].parameter-name", "str-param"); + props.setProperty("execute-graph-input.sli-parameter[2].str-value", "hello"); + props.setProperty("execute-graph-input.sli-parameter[3].parameter-name", "ipv4address-param"); + props.setProperty("execute-graph-input.sli-parameter[3].ipaddress-value", "127.0.0.1"); + props.setProperty("execute-graph-input.sli-parameter[4].parameter-name", "ipv6address-param"); + props.setProperty("execute-graph-input.sli-parameter[4].ipaddress-value", "ef::1"); + ExecuteGraphInputBuilder execBuilder = new ExecuteGraphInputBuilder(); + + MdsalHelperTesterUtil.toBuilder(props, execBuilder); + + + + } } diff --git a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/TestMdsalHelperUtils.java b/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/TestMdsalHelperUtils.java deleted file mode 100644 index dca6b54c6..000000000 --- a/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/TestMdsalHelperUtils.java +++ /dev/null @@ -1,79 +0,0 @@ -/*- - * ============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========================================================= - */ - -package org.onap.ccsdk.sli.core.sli.provider; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; - -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; -import org.junit.Test; -import org.onap.ccsdk.sli.core.sli.SvcLogicContext; -import org.onap.ccsdk.sli.core.sli.SvcLogicException; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.part.rev170921.L3vpnSvcBuilder; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.part.rev170921.SvcId; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.part.rev170921.l3vpn.svc.VpnServicesBuilder; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.part.rev170921.l3vpn.svc.vpn.services.VpnSvc; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.part.rev170921.l3vpn.svc.vpn.services.VpnSvcBuilder; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.part.rev170921.l3vpn.svc.vpn.services.VpnSvcKey; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class TestMdsalHelperUtils { - - private static final Logger log = LoggerFactory.getLogger(TestMdsalHelperUtils.class); - - @Test - public void testL3vpnSvcToBuilder() throws SvcLogicException { - SvcLogicContext ctx = new SvcLogicContext(); - ctx.setAttribute("l3vpn-svc.vpn-services.vpn-svc[0].vpn-id", "1"); - - L3vpnSvcBuilder svcBuilder = new L3vpnSvcBuilder(); - - MdsalHelper.toBuilder(ctx.toProperties(), "", svcBuilder); - - assertThat(svcBuilder.getVpnServices().getVpnSvc().get(0).getKey().getVpnId().getValue(), is("1")); - log.info(svcBuilder.toString()); - } - - @Test - public void testL3vpnSvcToProperties() throws SvcLogicException { - VpnSvcBuilder vpnSvcBuilder = new VpnSvcBuilder(); - vpnSvcBuilder.setKey(new VpnSvcKey(new SvcId("1"))); - List<VpnSvc> vpnSvcList = new ArrayList<>(); - vpnSvcList.add(vpnSvcBuilder.build()); - VpnServicesBuilder vpnServicesBuilder = new VpnServicesBuilder(); - vpnServicesBuilder.setVpnSvc(vpnSvcList); - L3vpnSvcBuilder l3vpnSvcBuilder = new L3vpnSvcBuilder(); - l3vpnSvcBuilder.setVpnServices(vpnServicesBuilder.build()); - - Properties properties = new Properties(); - - MdsalHelper.toProperties(properties, "", l3vpnSvcBuilder.build()); - - assertThat(properties.getProperty("l3vpn-svc.vpn-services.vpn-svc[0].vpn-id"), is("1")); - log.info(properties.toString()); - } - - // TODO add more detailed testcases. -} diff --git a/sli/provider/src/test/resources/l3sdn.properties b/sli/provider/src/test/resources/l3sdn.properties new file mode 100644 index 000000000..6f40ebca0 --- /dev/null +++ b/sli/provider/src/test/resources/l3sdn.properties @@ -0,0 +1,66 @@ +# yang conversion properties +# used to convert Enum back to the original yang value +yang.request-status.Synccomplete=synccomplete +yang.request-status.Asynccomplete=asynccomplete +yang.request-status.Notifycomplete=notifycomplete +yang.rpc-name.ServiceConfigurationOperation=service-configuration-operation +yang.rpc-name.SvcTopologyOperation=svc-topology-operation +yang.rpc-name.ServiceConfigurationNotification=service-configuration-notification +yang.rpc-action.Reserve=reserve +yang.rpc-action.Activate=activate +yang.rpc-action.Assign=assign +yang.rpc-action.Turnup=turnup +yang.rpc-action.Delete=delete +yang.rpc-action.Changereserve=changereserve +yang.rpc-action.Changeactivate=changeactivate +yang.rpc-action.Changedelete=changedelete +yang.rpc-action.Changeassign=changeassign +yang.svc-vnf-type.Vce=vce +yang.vnf-type.Vce=vce +yang.vnf-status.PendingCreate=pending-create +yang.vnf-status.Created=created +yang.vnf-status.Active=active +yang.vnf-status.PendingDelete=pending-delete +yang.connection-type.Customer=customer +yang.connection-type.Internet=internet +yang.net-status.PendingCreate=pending-create +yang.net-status.Created=created +yang.net-status.Active=active +yang.net-status.PendingDelete=pending-delete +yang.svc-action.Reserve=reserve +yang.svc-action.Activate=activate +yang.svc-action.Assign=assign +yang.svc-action.Turnup=turnup +yang.svc-action.Delete=delete +yang.svc-action.Changereserve=changereserve +yang.svc-action.Changeactivate=changeactivate +yang.svc-action.Changedelete=changedelete +yang.svc-action.Changeassign=changeassign +yang.service-type.SDNETHERNETINTERNET=SDN-ETHERNET-INTERNET +yang.internet-evc-speed-value._2=2 +yang.internet-evc-speed-value._4=4 +yang.internet-evc-speed-value._5=5 +yang.internet-evc-speed-value._8=8 +yang.internet-evc-speed-value._10=10 +yang.internet-evc-speed-value._20=20 +yang.internet-evc-speed-value._50=50 +yang.internet-evc-speed-value._100=100 +yang.internet-evc-speed-value._150=150 +yang.internet-evc-speed-value._250=250 +yang.internet-evc-speed-value._400=400 +yang.internet-evc-speed-value._500=500 +yang.internet-evc-speed-value._600=600 +yang.internet-evc-speed-value._1000=1000 +yang.ip-version.Ds=ds +yang.ip-version.V6=v6 +yang.routing-protocol.None=none +yang.routing-protocol.Bgp=bgp +yang.routing-protocol.Ospf=ospf +yang.routing-protocol.Igrp=igrp +yang.routing-protocol.Eigrp=eigrp +yang.routing-protocol.Rip=rip +yang.routing-protocol.IsIs=is-is +yang.vr-designation.Primary=primary +yang.feature-type.FIREWALLLITE=FIREWALL-LITE +yang.equipment-role.VPLSPE=VPLS-PE +yang.interface-role.CUSTOMERUPLINK=CUSTOMER-UPLINK diff --git a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java index 323758681..d24ae809a 100644 --- a/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java +++ b/sliPluginUtils/provider/src/main/java/org/onap/ccsdk/sli/core/slipluginutils/SliPluginUtils.java @@ -651,6 +651,7 @@ public class SliPluginUtils implements SvcLogicJavaPlugin { return 0; } + @Override public boolean equals(Object object) { if (this == object) { return true; @@ -676,6 +677,7 @@ public class SliPluginUtils implements SvcLogicJavaPlugin { return true; } + @Override public int hashCode() { int result = super.hashCode(); result = 31 * result + (child_elements != null ? child_elements.hashCode() : 0); diff --git a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtilsTest.java b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtilsTest.java index 96c6ae4ac..4fc8d1866 100644 --- a/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtilsTest.java +++ b/sliPluginUtils/provider/src/test/java/org/onap/ccsdk/sli/core/slipluginutils/SliStringUtilsTest.java @@ -91,6 +91,18 @@ public class SliStringUtilsTest { } @Test + public final void testSubString() throws SvcLogicException { + param.put("string","splitatgivenindex"); + param.put("begin-index","0"); + param.put("end-index","5"); + param.put("result","result"); + + stringUtils.substring(param, ctx); + + assertEquals("split", ctx.getAttribute("result")); + } + + @Test public final void testQuotedOrNull() throws SvcLogicException { //param.put("nullString",null); assertEquals("NULL",SliStringUtils.quotedOrNULL(null)); |