summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2021-01-29 17:42:42 +0000
committerDan Timoney <dtimoney@att.com>2021-01-29 17:42:42 +0000
commit0e4e58bf061df695341ac250beb97a978cefdaf7 (patch)
tree06539b81ae2f3bbeddd3f7f30199cdd200a8480c
parentce4e5f9a00d2677495240ad367b9bfc4b74752d0 (diff)
Revert "migrate sli to alu-SR1"
This reverts commit ce4e5f9a00d2677495240ad367b9bfc4b74752d0. Reason for revert: ODL upgrade changes need to be backed out until issues in ccsdk/features are resolved. Change-Id: I168e2519e37f3eee61609d0da890c14db49ec49e
-rwxr-xr-x.gitignore1
-rwxr-xr-xadaptors/aai-service/provider/src/main/resources/OSGI-INF/blueprint/aaiservice-blueprint.xml39
-rwxr-xr-xadaptors/mdsal-resource/provider/src/main/resources/OSGI-INF/blueprint/mdsal-resource-blueprint.xml49
-rw-r--r--adaptors/netbox-client/provider/src/main/resources/OSGI-INF/blueprint/netbox-client.xml37
-rwxr-xr-xadaptors/resource-assignment/provider/src/main/resources/OSGI-INF/blueprint/resource-assignment-blueprint.xml33
-rwxr-xr-xadaptors/resource-assignment/provider/src/main/resources/OSGI-INF/blueprint/resource-assignment.xml129
-rwxr-xr-xadaptors/saltstack-adapter/saltstack-adapter-provider/src/main/resources/OSGI-INF/blueprint/saltstack-adapter-blueprint.xml42
-rwxr-xr-xadaptors/sql-resource/provider/src/main/resources/OSGI-INF/blueprint/sql-resource-blueprint.xml41
-rwxr-xr-xcore/dblib/provider/src/main/resources/OSGI-INF/blueprint/dblib-blueprint.xml18
-rw-r--r--core/features/ccsdk-dblib/pom.xml1
-rw-r--r--core/features/ccsdk-sli/pom.xml2
-rw-r--r--core/sli/provider-base/pom.xml3
-rwxr-xr-xcore/sli/provider/pom.xml21
-rwxr-xr-xcore/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java89
-rw-r--r--core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/PrintYangToProp.java1355
-rw-r--r--core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicClassResolver.java21
-rw-r--r--core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicService.java9
-rwxr-xr-xcore/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java2
-rw-r--r--core/sli/provider/src/main/resources/OSGI-INF/blueprint/sli-blueprint.xml36
-rwxr-xr-xcore/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTest.java3
-rw-r--r--core/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTesterUtil.java7
-rw-r--r--core/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/PrintYangToPropTest.java64
-rw-r--r--core/sliPluginUtils/provider/src/main/resources/OSGI-INF/blueprint/slipluginutils-blueprint.xml13
-rw-r--r--core/sliapi/model/swagger/src/main/json/sliapi.json2
-rw-r--r--core/sliapi/model/swagger/src/main/yaml/sliapi.yaml18
-rwxr-xr-xcore/sliapi/provider/pom.xml70
-rw-r--r--core/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/SliapiProvider.java148
-rw-r--r--core/sliapi/provider/src/main/resources/OSGI-INF/blueprint/sliapi-blueprint.xml28
-rw-r--r--core/sliapi/provider/src/main/resources/org/opendaylight/blueprint/sliapi-blueprint.xml9
-rw-r--r--core/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java45
-rwxr-xr-xnorthbound/asdcApi/provider/pom.xml20
-rw-r--r--northbound/asdcApi/provider/src/main/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiProvider.java49
-rw-r--r--northbound/asdcApi/provider/src/main/resources/OSGI-INF/blueprint/asdc-blueprint.xml32
-rw-r--r--northbound/asdcApi/provider/src/main/resources/org/opendaylight/blueprint/asdc-blueprint.xml9
-rw-r--r--northbound/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/TestAsdcApiApi.java203
-rwxr-xr-xnorthbound/daexim-offsite-backup/provider/pom.xml32
-rwxr-xr-xnorthbound/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProvider.java34
-rwxr-xr-xnorthbound/daexim-offsite-backup/provider/src/main/resources/OSGI-INF/blueprint/DaeximOffsiteBackup.xml20
-rwxr-xr-xnorthbound/daexim-offsite-backup/provider/src/main/resources/org/opendaylight/blueprint/DaeximOffsiteBackup.xml6
-rw-r--r--northbound/daexim-offsite-backup/provider/src/test/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProviderTest.java21
-rwxr-xr-xnorthbound/dataChange/provider/pom.xml34
-rw-r--r--northbound/dataChange/provider/src/main/java/org/onap/ccsdk/sli/northbound/DataChangeProvider.java26
-rw-r--r--northbound/dataChange/provider/src/main/resources/OSGI-INF/blueprint/datachange-blueprint.xml32
-rw-r--r--northbound/dataChange/provider/src/main/resources/org/opendaylight/blueprint/datachange-blueprint.xml9
-rw-r--r--northbound/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/DataChangeClientTest.java109
-rw-r--r--northbound/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/TestDataChange.java122
-rwxr-xr-xnorthbound/lcm/provider/pom.xml19
-rw-r--r--northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java34
-rw-r--r--northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmSliClient.java3
-rw-r--r--northbound/lcm/provider/src/main/resources/OSGI-INF/blueprint/lcm-blueprint.xml34
-rw-r--r--northbound/lcm/provider/src/main/resources/org/opendaylight/blueprint/lcm-blueprint.xml9
-rw-r--r--northbound/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmProvider.java111
-rw-r--r--northbound/ueb-listener/src/test/resources/incoming/src_test_resources_csars_service-NfodService-csar.csarbin0 -> 38938 bytes
-rw-r--r--plugins/features/ccsdk-restconf-client/pom.xml7
-rwxr-xr-xplugins/grToolkit/provider/pom.xml33
-rwxr-xr-xplugins/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProvider.java34
-rw-r--r--plugins/grToolkit/provider/src/main/resources/org/opendaylight/blueprint/GrToolkit.xml9
-rw-r--r--plugins/grToolkit/provider/src/test/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProviderTest.java68
-rwxr-xr-xplugins/properties-node/provider/src/main/resources/OSGI-INF/blueprint/properties-node-blueprint.xml16
-rwxr-xr-xplugins/restapi-call-node/provider/pom.xml7
-rwxr-xr-xplugins/restapi-call-node/provider/src/main/resources/OSGI-INF/blueprint/restapi-call-node-blueprint.xml16
-rwxr-xr-xplugins/restconf-client/provider/pom.xml13
-rw-r--r--plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiCallNode.java80
-rw-r--r--plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiUtils.java18
-rw-r--r--plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DfSerializerUtil.java42
-rw-r--r--plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeSerializer.java26
-rw-r--r--plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeUtils.java37
-rwxr-xr-xplugins/restconf-client/provider/src/main/resources/OSGI-INF/blueprint/restconf-client-blueprint.xml51
-rw-r--r--plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/PropertiesSerializerTest.java14
-rwxr-xr-xplugins/sshapi-call-node/provider/src/main/resources/OSGI-INF/blueprint/sshapi-call-node-blueprint.xml16
70 files changed, 2921 insertions, 869 deletions
diff --git a/.gitignore b/.gitignore
index dca6a7b4f..e3a6ff64b 100755
--- a/.gitignore
+++ b/.gitignore
@@ -22,7 +22,6 @@ MANIFEST.MF
**/yang-gen-sal
*.interp
core/sli/model/src/main/java
-**/provider/FileToZip*
## Misc Ignores (OS specific etc) ##
bin/
diff --git a/adaptors/aai-service/provider/src/main/resources/OSGI-INF/blueprint/aaiservice-blueprint.xml b/adaptors/aai-service/provider/src/main/resources/OSGI-INF/blueprint/aaiservice-blueprint.xml
new file mode 100755
index 000000000..970936610
--- /dev/null
+++ b/adaptors/aai-service/provider/src/main/resources/OSGI-INF/blueprint/aaiservice-blueprint.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ openECOMP : SDN-C
+ ================================================================================
+ Copyright (C) 2017 - 2018 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=========================================================
+ -->
+
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <bean id="provider" class="org.onap.ccsdk.sli.adaptors.aai.AAIServiceProvider" />
+
+ <bean id="aaiService" class="org.onap.ccsdk.sli.adaptors.aai.AAIService">
+ <argument ref="provider" />
+ </bean>
+ <service ref="aaiService">
+ <interfaces>
+ <value>org.onap.ccsdk.sli.adaptors.aai.AAIService</value>
+ <value>org.onap.ccsdk.sli.adaptors.aai.AAIClient</value>
+ </interfaces>
+ </service>
+
+</blueprint>
diff --git a/adaptors/mdsal-resource/provider/src/main/resources/OSGI-INF/blueprint/mdsal-resource-blueprint.xml b/adaptors/mdsal-resource/provider/src/main/resources/OSGI-INF/blueprint/mdsal-resource-blueprint.xml
new file mode 100755
index 000000000..9c691263c
--- /dev/null
+++ b/adaptors/mdsal-resource/provider/src/main/resources/OSGI-INF/blueprint/mdsal-resource-blueprint.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ openECOMP : SDN-C
+ ================================================================================
+ Copyright (C) 2017 - 2018 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=========================================================
+ -->
+
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <bean id="propProvider" class="org.onap.ccsdk.sli.adaptors.resource.mdsal.MdsalResourcePropertiesProviderImpl" />
+
+
+ <bean id="configResourceInstance" class="org.onap.ccsdk.sli.adaptors.resource.mdsal.ConfigResource">
+ <argument ref="propProvider"/>
+ </bean>
+
+ <bean id="operResourceInstance" class="org.onap.ccsdk.sli.adaptors.resource.mdsal.OperationalResource">
+ <argument ref="propProvider"/>
+ </bean>
+
+ <service ref="configResourceInstance">
+ <interfaces>
+ <value>org.onap.ccsdk.sli.adaptors.resource.mdsal.ConfigResource</value>
+ </interfaces>
+ </service>
+
+ <service ref="operResourceInstance">
+ <interfaces>
+ <value>org.onap.ccsdk.sli.adaptors.resource.mdsal.OperationalResource</value>
+ </interfaces>
+ </service>
+</blueprint>
diff --git a/adaptors/netbox-client/provider/src/main/resources/OSGI-INF/blueprint/netbox-client.xml b/adaptors/netbox-client/provider/src/main/resources/OSGI-INF/blueprint/netbox-client.xml
new file mode 100644
index 000000000..b667dcba5
--- /dev/null
+++ b/adaptors/netbox-client/provider/src/main/resources/OSGI-INF/blueprint/netbox-client.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2018 AT&T, Bell Canada
+
+ 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.
+ -->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <reference id="dbLibService"
+ interface="org.onap.ccsdk.sli.core.dblib.DbLibService"/>
+
+ <bean id="netboxProperty" class="org.onap.ccsdk.sli.adaptors.netbox.property.NetboxProperties"/>
+ <bean id="httpClient" class="org.onap.ccsdk.sli.adaptors.netbox.impl.NetboxHttpClient" destroy-method="close">
+ <argument ref="netboxProperty"/>
+ </bean>
+
+ <bean id="netboxClient" class="org.onap.ccsdk.sli.adaptors.netbox.impl.NetboxClientImpl">
+ <argument ref="httpClient"/>
+ <argument ref="dbLibService"/>
+ </bean>
+
+ <service ref="netboxClient"
+ interface="org.onap.ccsdk.sli.adaptors.netbox.api.NetboxClient"
+ odl:type="default"/>
+
+</blueprint>
diff --git a/adaptors/resource-assignment/provider/src/main/resources/OSGI-INF/blueprint/resource-assignment-blueprint.xml b/adaptors/resource-assignment/provider/src/main/resources/OSGI-INF/blueprint/resource-assignment-blueprint.xml
new file mode 100755
index 000000000..77c316d2a
--- /dev/null
+++ b/adaptors/resource-assignment/provider/src/main/resources/OSGI-INF/blueprint/resource-assignment-blueprint.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ openECOMP : SDN-C
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights
+ reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <reference id="dblib.dataSource" interface="javax.sql.DataSource" filter="(objectClass=org.onap.ccsdk.sli.core.dblib.DbLibService)"/>
+
+ <service ref="resourceAllocator" interface="org.onap.ccsdk.sli.adaptors.ra.ResourceAllocator"/>
+
+ <service ref="resourceLockNode" interface="org.onap.ccsdk.sli.adaptors.ra.ResourceLockNode"/>
+
+</blueprint>
diff --git a/adaptors/resource-assignment/provider/src/main/resources/OSGI-INF/blueprint/resource-assignment.xml b/adaptors/resource-assignment/provider/src/main/resources/OSGI-INF/blueprint/resource-assignment.xml
new file mode 100755
index 000000000..7fcc70c54
--- /dev/null
+++ b/adaptors/resource-assignment/provider/src/main/resources/OSGI-INF/blueprint/resource-assignment.xml
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ openECOMP : SDN-C
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights
+ reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <!-- JDBC setup -->
+
+ <bean id="rm.dataSource" class="org.onap.ccsdk.sli.adaptors.util.db.DataSourceWrap">
+ <property name="dataSource" ref="dblib.dataSource" />
+ </bean>
+
+ <bean id="lock.dataSource" class="org.onap.ccsdk.sli.adaptors.util.db.CachedDataSourceWrap">
+ <property name="dataSource" ref="rm.dataSource" />
+ </bean>
+
+ <bean id="rm.jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
+ <property name="dataSource" ref="rm.dataSource" />
+ </bean>
+
+ <bean id="lock.jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
+ <property name="dataSource" ref="lock.dataSource" />
+ </bean>
+
+ <!-- Resource Lock Configuration -->
+
+ <bean id="resourceLockDao" class="org.onap.ccsdk.sli.adaptors.lock.dao.ResourceLockDaoImpl">
+ <property name="jdbcTemplate" ref="lock.jdbcTemplate" />
+ </bean>
+
+ <bean id="lockHelper" class="org.onap.ccsdk.sli.adaptors.lock.comp.LockHelperImpl">
+ <property name="resourceLockDao" ref="resourceLockDao" />
+ <property name="retryCount" value="10" />
+ <property name="lockWait" value="5" /> <!-- Seconds -->
+ </bean>
+
+ <!-- RM Configuration -->
+
+ <bean id="resourceJdbcDao" class="org.onap.ccsdk.sli.adaptors.rm.dao.jdbc.ResourceJdbcDaoImpl">
+ <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
+ </bean>
+
+ <bean id="allocationItemJdbcDao" class="org.onap.ccsdk.sli.adaptors.rm.dao.jdbc.AllocationItemJdbcDaoImpl">
+ <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
+ </bean>
+
+ <bean id="resourceLoadJdbcDao" class="org.onap.ccsdk.sli.adaptors.rm.dao.jdbc.ResourceLoadJdbcDaoImpl">
+ <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
+ </bean>
+
+ <bean id="resourceDao" class="org.onap.ccsdk.sli.adaptors.rm.dao.jdbc.ResourceDaoImpl">
+ <property name="resourceJdbcDao" ref="resourceJdbcDao" />
+ <property name="allocationItemJdbcDao" ref="allocationItemJdbcDao" />
+ <property name="resourceLoadJdbcDao" ref="resourceLoadJdbcDao" />
+ </bean>
+
+ <bean id="resourceManager" class="org.onap.ccsdk.sli.adaptors.rm.comp.ResourceManagerImpl">
+ <property name="lockHelper" ref="lockHelper" />
+ <property name="resourceDao" ref="resourceDao" />
+ <property name="lockTimeout" value="600" /> <!-- Seconds -->
+ </bean>
+
+ <!-- Rule DAO Configuration -->
+
+ <bean id="resourceRuleDao" class="org.onap.ccsdk.sli.adaptors.ra.rule.dao.ResourceRuleDaoImpl">
+ <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
+ </bean>
+
+ <bean id="rangeRuleDao" class="org.onap.ccsdk.sli.adaptors.ra.rule.dao.RangeRuleDaoImpl">
+ <property name="jdbcTemplate" ref="rm.jdbcTemplate" />
+ </bean>
+
+ <!-- ResourceAllocator Configuration -->
+
+ <bean id="resourceAllocator" class="org.onap.ccsdk.sli.adaptors.ra.ResourceAllocator">
+ <property name="resourceManager" ref="resourceManager" />
+ <property name="endPointAllocator" ref="endPointAllocator" />
+ <property name="speedUtil" ref="speedUtil" />
+ </bean>
+
+ <bean id="resourceLockNode" class="org.onap.ccsdk.sli.adaptors.ra.ResourceLockNode">
+ <property name="lockHelper" ref="lockHelper" />
+ </bean>
+
+ <bean id="speedUtil" class="org.onap.ccsdk.sli.adaptors.util.speed.SpeedUtil" />
+
+ <!-- EndPointAllocator Configuration -->
+
+ <bean id="endPointAllocator" class="org.onap.ccsdk.sli.adaptors.ra.comp.EndPointAllocatorImpl">
+ <property name="resourceManager" ref="resourceManager" />
+ <property name="allocationRuleMap">
+ <map>
+ <entry key="DEFAULT">
+ <list>
+ <ref component-id="dbAllocationRule" />
+ </list>
+ </entry>
+ </map>
+ </property>
+ </bean>
+
+ <!-- Resource Allocation Rule Configuration -->
+
+ <bean id="dbAllocationRule" class="org.onap.ccsdk.sli.adaptors.ra.alloc.DbAllocationRule">
+ <property name="resourceRuleDao" ref="resourceRuleDao" />
+ <property name="rangeRuleDao" ref="rangeRuleDao" />
+ </bean>
+
+</blueprint>
diff --git a/adaptors/saltstack-adapter/saltstack-adapter-provider/src/main/resources/OSGI-INF/blueprint/saltstack-adapter-blueprint.xml b/adaptors/saltstack-adapter/saltstack-adapter-provider/src/main/resources/OSGI-INF/blueprint/saltstack-adapter-blueprint.xml
new file mode 100755
index 000000000..e360f8184
--- /dev/null
+++ b/adaptors/saltstack-adapter/saltstack-adapter-provider/src/main/resources/OSGI-INF/blueprint/saltstack-adapter-blueprint.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : CCSDK
+ ================================================================================
+ Copyright (C) 2017 - 2018 Samsung Electronics. 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=========================================================
+ -->
+
+<blueprint xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <bean id="propProvider"
+ class="org.onap.ccsdk.sli.adaptors.saltstack.impl.SaltstackAdapterPropertiesProviderImpl"/>
+
+ <bean id="saltstackAdapterInstance"
+ class="org.onap.ccsdk.sli.adaptors.saltstack.impl.SaltstackAdapterImpl">
+ <argument ref="propProvider"/>
+ </bean>
+
+ <service ref="saltstackAdapterInstance">
+ <interfaces>
+ <value>org.onap.ccsdk.sli.adaptors.saltstack.SaltstackAdapter
+ </value>
+ </interfaces>
+ </service>
+
+</blueprint>
diff --git a/adaptors/sql-resource/provider/src/main/resources/OSGI-INF/blueprint/sql-resource-blueprint.xml b/adaptors/sql-resource/provider/src/main/resources/OSGI-INF/blueprint/sql-resource-blueprint.xml
new file mode 100755
index 000000000..5e8d33946
--- /dev/null
+++ b/adaptors/sql-resource/provider/src/main/resources/OSGI-INF/blueprint/sql-resource-blueprint.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ openECOMP : SDN-C
+ ================================================================================
+ Copyright (C) 2017 - 2018 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=========================================================
+ -->
+
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <bean id="propProvider" class="org.onap.ccsdk.sli.adaptors.resource.sql.SqlResourcePropertiesProviderImpl" />
+ <reference id="dblibService" interface="org.onap.ccsdk.sli.core.dblib.DbLibService" />
+
+ <bean id="sqlResourceInstance" class="org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource">
+ <argument ref="propProvider"/>
+ <argument ref="dblibService"/>
+ </bean>
+
+ <service ref="sqlResourceInstance">
+ <interfaces>
+ <value>org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource</value>
+ </interfaces>
+ </service>
+
+</blueprint>
diff --git a/core/dblib/provider/src/main/resources/OSGI-INF/blueprint/dblib-blueprint.xml b/core/dblib/provider/src/main/resources/OSGI-INF/blueprint/dblib-blueprint.xml
new file mode 100755
index 000000000..f1d5166db
--- /dev/null
+++ b/core/dblib/provider/src/main/resources/OSGI-INF/blueprint/dblib-blueprint.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <bean id="provider" class="org.onap.ccsdk.sli.core.dblib.DBLIBResourceProvider" />
+
+ <bean id="dbResourceManager" class="org.onap.ccsdk.sli.core.dblib.DBResourceManager">
+ <argument ref="provider" />
+ </bean>
+ <service ref="dbResourceManager">
+ <interfaces>
+ <value>javax.sql.DataSource</value>
+ <value>org.onap.ccsdk.sli.core.dblib.DbLibService</value>
+ </interfaces>
+ </service>
+
+</blueprint> \ No newline at end of file
diff --git a/core/features/ccsdk-dblib/pom.xml b/core/features/ccsdk-dblib/pom.xml
index 96fe28bc0..f1164017a 100644
--- a/core/features/ccsdk-dblib/pom.xml
+++ b/core/features/ccsdk-dblib/pom.xml
@@ -31,7 +31,6 @@
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
- <version>9.0.30</version>
</dependency>
<dependency>
<groupId>org.onap.ccsdk.sli.core</groupId>
diff --git a/core/features/ccsdk-sli/pom.xml b/core/features/ccsdk-sli/pom.xml
index c6e913c37..c6fcfc808 100644
--- a/core/features/ccsdk-sli/pom.xml
+++ b/core/features/ccsdk-sli/pom.xml
@@ -22,7 +22,7 @@
<artifactId>sli-common</artifactId>
<version>${project.version}</version>
</dependency>
-
+
<dependency>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>sli-provider</artifactId>
diff --git a/core/sli/provider-base/pom.xml b/core/sli/provider-base/pom.xml
index fce5db9dc..fac9a7796 100644
--- a/core/sli/provider-base/pom.xml
+++ b/core/sli/provider-base/pom.xml
@@ -12,8 +12,7 @@
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>sli-provider-base</artifactId>
<version>1.2.0-SNAPSHOT</version>
- <packaging>bundle</packaging>
-
+
<name>ccsdk-sli-core :: sli :: ${project.artifactId}</name>
<properties>
diff --git a/core/sli/provider/pom.xml b/core/sli/provider/pom.xml
index d45b2e0f4..1fde267e8 100755
--- a/core/sli/provider/pom.xml
+++ b/core/sli/provider/pom.xml
@@ -58,14 +58,15 @@
<artifactId>commons-lang</artifactId>
<scope>compile</scope>
</dependency>
+
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId> org.opendaylight.mdsal</groupId>
- <artifactId>mdsal-binding-api</artifactId>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
@@ -80,19 +81,11 @@
<optional>true</optional>
</dependency>
<dependency>
- <groupId>org.opendaylight.mdsal</groupId>
- <artifactId>mdsal-dom-api</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.mdsal</groupId>
- <artifactId>yang-binding</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.google.code.findbugs</groupId>
- <artifactId>annotations</artifactId>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-core-api</artifactId>
+ <scope>provided</scope>
</dependency>
+ <!-- Testing Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
diff --git a/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java b/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
index 94e1425cb..d3ab6c33a 100755
--- a/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
+++ b/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
@@ -32,11 +32,8 @@ import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Enumeration;
import java.util.LinkedList;
import java.util.List;
-import java.util.Map;
import java.util.Properties;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
@@ -46,15 +43,9 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.RouteDistinguisher;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.RouteDistinguisherBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.RouteDistinguisher;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.RouteDistinguisherBuilder;
import org.opendaylight.yangtools.yang.binding.Identifier;
-import org.opendaylight.yangtools.yang.binding.ScalarTypeObject;
-import org.opendaylight.yangtools.yang.binding.TypeObject;
-import org.opendaylight.yangtools.yang.common.Uint16;
-import org.opendaylight.yangtools.yang.common.Uint32;
-import org.opendaylight.yangtools.yang.common.Uint64;
-import org.opendaylight.yangtools.yang.common.Uint8;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -65,11 +56,11 @@ public class MdsalHelper {
private static final String IP_ADDRESS="IpAddress";
private static final String IPV4_ADDRESS="Ipv4Address";
private static final String IPV6_ADDRESS="Ipv6Address";
-
+
private static final String IP_PREFIX="IpPrefix";
private static final String SETTING_PROPERTY="Setting property ";
private static final String BUILDER="-builder";
-
+
@Deprecated
public static void setProperties(Properties input) {
setYangMappingProperties(input);
@@ -139,7 +130,7 @@ public class MdsalHelper {
}
String simpleTypeName = fromObj.getClass().getTypeName();
simpleTypeName = simpleTypeName.substring(simpleTypeName.lastIndexOf(".") + 1);
-
+
if (classHasSpecialHandling(simpleTypeName)) {
try {
@@ -154,14 +145,10 @@ public class MdsalHelper {
if (IP_ADDRESS.equals(simpleTypeName) || IP_PREFIX.equals(simpleTypeName)
|| IPV4_ADDRESS.equals(simpleTypeName) || IPV6_ADDRESS.equals(simpleTypeName)) {
propVal = (String) retValue;
- }
- else if(implementsInterface( fromObj.getClass(), ScalarTypeObject.class)) {
- propVal = String.valueOf(((ScalarTypeObject)fromObj).getValue());
- }
- else if ("Dscp".equals(simpleTypeName)) {
+ } else if ("Dscp".equals(simpleTypeName)) {
propVal = String.valueOf((short) retValue);
} else if ("PortNumber".equals(simpleTypeName)) {
- propVal = String.valueOf(retValue);
+ propVal = String.valueOf((Integer) retValue);
}
LOG.debug(SETTING_PROPERTY + pfx + " to " + propVal);
props.setProperty(pfx, propVal);
@@ -178,7 +165,7 @@ public class MdsalHelper {
}
props.setProperty(pfx + "_length", Integer.toString(fromList.size()));
- } else if (isYangGenerated(fromClass)) {
+ } else if (isYangGenerated(fromClass)) {
// Class is yang generated.
String propNamePfx = null;
@@ -291,7 +278,7 @@ public class MdsalHelper {
}
} else if (returnType.equals(Class.class)) {
- } else if (List.class.isAssignableFrom(returnType) || Map.class.isAssignableFrom(returnType)) {
+ } else if (List.class.isAssignableFrom(returnType)) {
// This getter method returns a list.
try {
@@ -299,19 +286,15 @@ public class MdsalHelper {
if (!isAccessible) {
m.setAccessible(true);
}
- Object retList = Map.class.isAssignableFrom(returnType)?new ArrayList(((Map) m.invoke(fromObj)).values()):m.invoke(fromObj);
- //due duplicated getters with Map and List(deprecated) stop if already mapped
- if(!hasAlreadyKeys(props,propNamePfx + "." + fieldName)) {
-
- if (!isAccessible) {
- m.setAccessible(isAccessible);
- }
- // Figure out what type of elements are stored in
- // this array.
- Type paramType = m.getGenericReturnType();
- Type elementType = ((ParameterizedType) paramType).getActualTypeArguments()[Map.class.isAssignableFrom(returnType)?1:0];
- toProperties(props, propNamePfx + "." + fieldName, retList, (Class) elementType, useLegacyEnumerationMapping);
+ Object retList = m.invoke(fromObj);
+ if (!isAccessible) {
+ m.setAccessible(isAccessible);
}
+ // Figure out what type of elements are stored in
+ // this array.
+ Type paramType = m.getGenericReturnType();
+ Type elementType = ((ParameterizedType) paramType).getActualTypeArguments()[0];
+ toProperties(props, propNamePfx + "." + fieldName, retList, (Class) elementType, useLegacyEnumerationMapping);
} catch (Exception e) {
LOG.error("Caught exception trying to convert List returned by " + fromClass.getName() + "."
+ m.getName() + "() to Properties entry", e);
@@ -360,7 +343,7 @@ public class MdsalHelper {
// End of method loop. If there was only one getter, named
// "getValue", then
// set value identified by "prefix" to that one value.
- if ((numGetters == 1) && ("getValue".equals(lastGetterName)) || isYangScalarType(fromObj)) {// || isYangTypeObject(fromObj)) {
+ if ((numGetters == 1) && ("getValue".equals(lastGetterName))) {
props.setProperty(propNamePfx, propVal);
}
} else {
@@ -385,26 +368,6 @@ public class MdsalHelper {
return (props);
}
- private static boolean hasAlreadyKeys(Properties props, String key) {
- Enumeration<Object> keys = props.keys();
- while(keys.hasMoreElements()) {
- if(String.valueOf(keys.nextElement()).startsWith(key)) {
- return true;
- }
- }
- return false;
- }
-
- private static boolean implementsInterface(Class<?> clazz, Class<?> ifClass) {
-// Class<?>[] ifs = clazz.getInterfaces();
-// for (Class<?> iff : ifs) {
-// if (iff.equals(ifClass)) {
-// return true;
-// }
-// }
- return ifClass.isAssignableFrom(clazz);
- }
-
public static Object toBuilder(Properties props, Object toObj) {
return (toBuilder(props, "", toObj));
@@ -646,7 +609,7 @@ public class MdsalHelper {
if (IPV4_ADDRESS.equals(simpleName) || IPV6_ADDRESS.equals(simpleName)
|| IP_ADDRESS.equals(simpleName)) {
-
+
if ((paramValue != null) && (paramValue.length() > 0)) {
try {
@@ -1001,7 +964,7 @@ public class MdsalHelper {
}
return false;
}
-
+
private static String getStringValueMethod(String simpleName){
if (IP_ADDRESS.equals(simpleName) || IP_PREFIX.equals(simpleName)) {
return("stringValue");
@@ -1104,18 +1067,6 @@ public class MdsalHelper {
return false;
}
- private static boolean isYangScalarType(Object o) {
- if (!implementsInterface(o.getClass(), ScalarTypeObject.class)) {
- return false;
- }
- Object value = ((ScalarTypeObject) o).getValue();
- Class valueCls = value.getClass();
- return valueCls.isAssignableFrom(Uint64.class) || valueCls.isAssignableFrom(Uint32.class)
- || valueCls.isAssignableFrom(Uint16.class) || valueCls.isAssignableFrom(Uint8.class)|| valueCls.isAssignableFrom(String.class);
- }
- private static boolean isYangTypeObject(Object o) {
- return implementsInterface(o.getClass(),TypeObject.class);
- }
public static boolean isIpPrefix(Class c) {
if (c == null) {
diff --git a/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/PrintYangToProp.java b/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/PrintYangToProp.java
new file mode 100644
index 000000000..992ed64d4
--- /dev/null
+++ b/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/PrintYangToProp.java
@@ -0,0 +1,1355 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : CCSDK
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
+ * 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 java.io.PrintStream;
+import java.io.FileDescriptor;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Properties;
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.io.*;
+import org.opendaylight.yangtools.yang.binding.Identifier;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefixBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import com.google.common.base.Strings;
+
+
+public class PrintYangToProp {
+
+ private static final Logger LOG = LoggerFactory.getLogger(PrintYangToProp.class);
+ public static final String PROPERTIES_FILE="";
+ private static Properties properties;
+ private static final String BUILDER="-builder";
+ private static final String IMPL="-impl";
+ private static final String TO_PROPERTIES_STRING="() to Properties entry";
+ private static final String CAUGHT_EXCEPTION_MSG="Caught exception trying to convert value returned by ";
+ public static Properties prop = new Properties();
+ public static ArrayList<String> propList = new ArrayList<>();
+
+
+ public static Properties toProperties(Properties props, Object fromObj) {
+ Class fromClass = null;
+
+ if (fromObj != null)
+ {
+ fromClass = fromObj.getClass();
+ }
+ return (toProperties(props, "", fromObj, fromClass));
+ }
+
+ public static Properties toProperties(Properties props, String pfx, Object fromObj)
+ {
+ Class fromClass = null;
+
+ if (fromObj != null)
+ {
+ fromClass = fromObj.getClass();
+ }
+
+ return(toProperties(props, pfx, fromObj, fromClass));
+ }
+
+ public static Properties toProperties(Properties props, String pfx,
+ Object fromObj, Class fromClass) {
+
+ if (fromObj == null) {
+ return (props);
+ }
+
+
+ String simpleName = fromClass.getSimpleName();
+
+ if (fromObj instanceof List) {
+
+
+ List fromList = (List) fromObj;
+
+ for (int i = 0; i < fromList.size(); i++) {
+ toProperties(props, pfx + "[" + i + "]", fromList.get(i), fromClass);
+ }
+ props.setProperty(pfx + "_length", "" + fromList.size());
+
+ } else if (isYangGenerated(fromClass)) {
+
+ String propNamePfx = null;
+
+ // If called from a list (so prefix ends in ']'), don't
+ // add class name again
+ if (pfx.endsWith("]")) {
+ propNamePfx = pfx;
+ } else {
+ if ((pfx != null) && (pfx.length() > 0)) {
+ propNamePfx = pfx ;
+ } else {
+ propNamePfx = toLowerHyphen(fromClass.getSimpleName());
+ }
+
+ if (propNamePfx.endsWith(BUILDER)) {
+ propNamePfx = propNamePfx.substring(0, propNamePfx.length()
+ - BUILDER.length());
+ }
+
+ if (propNamePfx.endsWith(IMPL)) {
+ propNamePfx = propNamePfx.substring(0, propNamePfx.length()
+ - IMPL.length());
+ }
+ }
+
+ // Iterate through getter methods to figure out values we need to
+ // save from
+
+ for (Method m : fromClass.getMethods()) {
+
+ if (isGetter(m)) {
+
+ Class returnType = m.getReturnType();
+ String fieldName = toLowerHyphen(m.getName().substring(3));
+ if(m != null && m.getName().matches("^is[A-Z].*")){
+ fieldName = toLowerHyphen(m.getName().substring(2));
+ }
+
+ if(Strings.isNullOrEmpty(fieldName)) fieldName = fieldName.substring(0, 1).toLowerCase()+ fieldName.substring(1);
+
+
+ // Is the return type a yang generated class?
+ if (isYangGenerated(returnType)) {
+
+ // Is it an enum?
+ if (returnType.isEnum()) {
+ // Return type is a typedef. Save its value.
+ try {
+ boolean isAccessible = m.isAccessible();
+ if (!isAccessible) {
+ m.setAccessible(true);
+ }
+
+ Object retValue = m.invoke(fromObj);
+
+ if (!isAccessible) {
+ m.setAccessible(isAccessible);
+ }
+ if (retValue != null) {
+ String propName = propNamePfx + "."
+ + fieldName;
+ String propVal = retValue.toString();
+ String yangProp = "yang." + fieldName + "." + propVal;
+ if ( properties.containsKey(yangProp)) {
+ propVal = properties.getProperty(yangProp);
+ }
+ props.setProperty(propName, propVal);
+ }
+ } catch (Exception e) {
+ LOG.error(
+ "Caught exception trying to convert Yang-generated enum returned by "
+ + fromClass.getName() + "."
+ + m.getName()
+ + TO_PROPERTIES_STRING, e);
+ }
+ } else if (isIpv4Address(returnType)) {
+ // Save its value
+ try {
+ String propName = propNamePfx + "." + fieldName;
+ boolean isAccessible = m.isAccessible();
+ if (!isAccessible) {
+ m.setAccessible(true);
+ }
+ Ipv4Address retValue = (Ipv4Address) m.invoke(fromObj);
+ if (!isAccessible) {
+ m.setAccessible(isAccessible);
+ }
+
+ if (retValue != null) {
+ String propVal = retValue.getValue();
+
+ props.setProperty(propName, propVal);
+
+ }
+ } catch (Exception e) {
+ LOG.error(
+ CAUGHT_EXCEPTION_MSG
+ + fromClass.getName() + "."
+ + m.getName()
+ + TO_PROPERTIES_STRING, e);
+ }
+ } else if (isIpv6Address(returnType)) {
+ // Save its value
+ try {
+ String propName = propNamePfx + "." + fieldName;
+ boolean isAccessible = m.isAccessible();
+ if (!isAccessible) {
+ m.setAccessible(true);
+ }
+ Ipv6Address retValue = (Ipv6Address) m.invoke(fromObj);
+ if (!isAccessible) {
+ m.setAccessible(isAccessible);
+ }
+
+ if (retValue != null) {
+ String propVal = retValue.getValue();
+
+ props.setProperty(propName, propVal);
+
+ }
+ } catch (Exception e) {
+ LOG.error(
+ CAUGHT_EXCEPTION_MSG
+ + fromClass.getName() + "."
+ + m.getName()
+ + TO_PROPERTIES_STRING, e);
+ }
+ } else if (isIpv4Prefix(returnType)) {
+
+ // Save its value
+ try {
+ String propName = propNamePfx + "." + fieldName;
+ boolean isAccessible = m.isAccessible();
+ if (!isAccessible) {
+ m.setAccessible(true);
+ }
+ Ipv4Prefix retValue = (Ipv4Prefix) m.invoke(fromObj);
+ if (!isAccessible) {
+ m.setAccessible(isAccessible);
+ }
+
+ if (retValue != null) {
+ String propVal = retValue.getValue();
+
+ props.setProperty(propName, propVal);
+
+ }
+ } catch (Exception e) {
+ LOG.error(
+ CAUGHT_EXCEPTION_MSG
+ + fromClass.getName() + "."
+ + m.getName()
+ + TO_PROPERTIES_STRING, e);
+ }
+ } else if (isIpv6Prefix(returnType)) {
+ //System.out.println("isIpv6Prefix");
+ // Save its value
+ try {
+ String propName = propNamePfx + "." + fieldName;
+ boolean isAccessible = m.isAccessible();
+ if (!isAccessible) {
+ m.setAccessible(true);
+ }
+ Ipv6Prefix retValue = (Ipv6Prefix) m.invoke(fromObj);
+ if (!isAccessible) {
+ m.setAccessible(isAccessible);
+ }
+
+ if (retValue != null) {
+ String propVal = retValue.getValue().toString();
+ //LOG.debug("Setting property " + propName
+ // + " to " + propVal);
+ props.setProperty(propName, propVal);
+
+ }
+ } catch (Exception e) {
+ LOG.error(
+ CAUGHT_EXCEPTION_MSG
+ + fromClass.getName() + "."
+ + m.getName()
+ + TO_PROPERTIES_STRING, e);
+ }
+ } else {
+ try {
+ boolean isAccessible = m.isAccessible();
+ if (!isAccessible) {
+ m.setAccessible(true);
+ }
+ Object retValue = m.invoke(fromObj);
+ if (!isAccessible) {
+ m.setAccessible(isAccessible);
+ }
+ if (retValue != null) {
+ toProperties(props, propNamePfx + "." + fieldName, retValue, returnType);
+ }
+ } catch (Exception e) {
+ LOG.error(
+ "Caught exception trying to convert Yang-generated class returned by"
+ + fromClass.getName() + "."
+ + m.getName()
+ + TO_PROPERTIES_STRING, e);
+ }
+ }
+ } else if (returnType.equals(Class.class)) {
+
+ //LOG.debug(m.getName()
+ // + " returns a Class object - not interested");
+
+ } else if (List.class.isAssignableFrom(returnType)) {
+
+ // This getter method returns a list.
+ try {
+ boolean isAccessible = m.isAccessible();
+ if (!isAccessible) {
+ m.setAccessible(true);
+ }
+ Object retList = m.invoke(fromObj);
+ if (!isAccessible) {
+ m.setAccessible(isAccessible);
+ }
+ // Figure out what type of elements are stored in this array.
+ Type paramType = m.getGenericReturnType();
+ Type elementType = ((ParameterizedType) paramType)
+ .getActualTypeArguments()[0];
+ toProperties(props, propNamePfx + "." + fieldName,
+ retList, (Class)elementType);
+ } catch (Exception e) {
+ LOG.error(
+ "Caught exception trying to convert List returned by "
+ + fromClass.getName() + "."
+ + m.getName()
+ + TO_PROPERTIES_STRING, e);
+ }
+
+ } else {
+
+ // Method returns something that is not a List and not
+ // yang-generated.
+ // Save its value
+ try {
+ String propName = propNamePfx + "." + fieldName;
+ boolean isAccessible = m.isAccessible();
+ if (!isAccessible) {
+ m.setAccessible(true);
+ }
+ Object propValObj = m.invoke(fromObj);
+ if (!isAccessible) {
+ m.setAccessible(isAccessible);
+ }
+
+ if (propValObj != null) {
+ String propVal = propValObj.toString();
+ //LOG.debug("Setting property " + propName
+ // + " to " + propVal);
+ props.setProperty(propName, propVal);
+
+ }
+ } catch (Exception e) {
+ LOG.error(
+ CAUGHT_EXCEPTION_MSG
+ + fromClass.getName() + "."
+ + m.getName()
+ + TO_PROPERTIES_STRING, e);
+ }
+ }
+
+ }
+ }
+
+ } else {
+ // Class is not yang generated and not a list
+ // Do nothing.
+
+ }
+
+ return (props);
+ }
+
+ public static Object toBuilder(Properties props, Object toObj) {
+
+ return (toBuilder(props, "", toObj));
+ }
+
+ public static List toList(Properties props, String pfx, List toObj,
+ Class elemType) {
+
+ int maxIdx = -1;
+ boolean foundValue = false;
+
+ //LOG.debug("Saving properties to List<" + elemType.getName()
+ // + "> from " + pfx);
+
+ // Figure out array size
+ for (Object pNameObj : props.keySet()) {
+ String key = (String) pNameObj;
+
+ if (key.startsWith(pfx + "[")) {
+ String idxStr = key.substring(pfx.length() + 1);
+ int endloc = idxStr.indexOf("]");
+ if (endloc != -1) {
+ idxStr = idxStr.substring(0, endloc);
+ }
+
+ try {
+ int curIdx = Integer.parseInt(idxStr);
+ if (curIdx > maxIdx) {
+ maxIdx = curIdx;
+ }
+ } catch (Exception e) {
+ LOG.error("Illegal subscript in property " + key);
+ }
+
+ }
+ }
+
+ //LOG.debug(pfx + " has max index of " + maxIdx);
+ for (int i = 0; i <= maxIdx; i++) {
+
+ String curBase = pfx + "[" + i + "]";
+
+ if (isYangGenerated(elemType)) {
+ String builderName = elemType.getName() + "Builder";
+ try {
+ Class builderClass = Class.forName(builderName);
+ Object builderObj = builderClass.newInstance();
+ Method buildMethod = builderClass.getMethod("build");
+ builderObj = toBuilder(props, curBase, builderObj, true);
+ if (builderObj != null) {
+ //LOG.debug("Calling " + builderObj.getClass().getName()
+ // + "." + buildMethod.getName() + "()");
+ Object builtObj = buildMethod.invoke(builderObj);
+ toObj.add(builtObj);
+ foundValue = true;
+ }
+
+ } catch (ClassNotFoundException e) {
+ LOG.warn("Could not find builder class " + builderName, e);
+ } catch (Exception e) {
+ LOG.error("Caught exception trying to populate list from "
+ + pfx);
+ }
+ }
+
+ }
+
+ if (foundValue) {
+ return (toObj);
+ } else {
+ return (null);
+ }
+
+ }
+
+ public static Object toBuilder(Properties props, String pfx, Object toObj) {
+ return(toBuilder(props, pfx, toObj, false));
+ }
+
+ public static Object toBuilder(Properties props, String pfx, Object toObj, boolean preservePfx) {
+ Class toClass = toObj.getClass();
+ boolean foundValue = false;
+
+ //LOG.debug("Saving properties to " + toClass.getName() + " class from "
+ // + pfx);
+
+ Ipv4Address addr;
+
+ if (isYangGenerated(toClass)) {
+ // Class is yang generated.
+ //LOG.debug(toClass.getName() + " is a Yang-generated class");
+
+ String propNamePfx = null;
+ if (preservePfx) {
+ propNamePfx = pfx;
+ } else {
+
+ if ((pfx != null) && (pfx.length() > 0)) {
+ propNamePfx = pfx + "."
+ + toLowerHyphen(toClass.getSimpleName());
+ } else {
+ propNamePfx = toLowerHyphen(toClass.getSimpleName());
+ }
+
+ if (propNamePfx.endsWith(BUILDER)) {
+ propNamePfx = propNamePfx.substring(0, propNamePfx.length()
+ - BUILDER.length());
+ }
+
+ if (propNamePfx.endsWith(IMPL)) {
+ propNamePfx = propNamePfx.substring(0, propNamePfx.length()
+ - IMPL.length());
+ }
+ }
+
+ if (toObj instanceof Identifier) {
+ //LOG.debug(toClass.getName() + " is a Key - skipping");
+ return (toObj);
+ }
+
+ // Iterate through getter methods to figure out values we need to
+ // set
+
+ for (Method m : toClass.getMethods()) {
+ // LOG.debug("Is " + m.getName() + " method a setter?");
+ if (isSetter(m)) {
+ // LOG.debug(m.getName() + " is a setter");
+ Class paramTypes[] = m.getParameterTypes();
+ Class paramClass = paramTypes[0];
+
+ String fieldName = toLowerHyphen(m.getName().substring(3));
+ fieldName = fieldName.substring(0, 1).toLowerCase()
+ + fieldName.substring(1);
+
+ String propName = propNamePfx + "." + fieldName;
+
+ String paramValue = props.getProperty(propName);
+ if (paramValue == null) {
+ //LOG.debug(propName + " is unset");
+ } else {
+ //LOG.debug(propName + " = " + paramValue);
+ }
+
+ // Is the return type a yang generated class?
+ if (isYangGenerated(paramClass)) {
+ // Is it an enum?
+ if (paramClass.isEnum()) {
+
+ //LOG.debug(m.getName() + " expects an Enum");
+ // Param type is a typedef.
+ if (paramValue != null) {
+ Object paramObj = null;
+
+ try {
+ paramObj = Enum.valueOf(paramClass,
+ toUpperCamelCase(paramValue));
+ } catch (Exception e) {
+ LOG.error(
+ "Caught exception trying to convert field "
+ + propName + " to enum "
+ + paramClass.getName(), e);
+ }
+
+ try {
+ boolean isAccessible = m.isAccessible();
+ if (!isAccessible) {
+ m.setAccessible(true);
+ }
+
+ //LOG.debug("Calling "
+ // + toObj.getClass().getName() + "."
+ // + m.getName() + "(" + paramValue
+ // + ")");
+ m.invoke(toObj, paramObj);
+
+ if (!isAccessible) {
+ m.setAccessible(isAccessible);
+ }
+ foundValue = true;
+
+ } catch (Exception e) {
+ LOG.error(
+ "Caught exception trying to create Yang-generated enum expected by"
+ + toClass.getName()
+ + "."
+ + m.getName()
+ + "() from Properties entry",
+ e);
+ }
+ }
+ } else {
+
+ String simpleName = paramClass.getSimpleName();
+ LOG.info("simpleName:" + simpleName);
+
+ if ("Ipv4Address".equals(simpleName)
+ || "Ipv6Address".equals(simpleName) || "Ipv4Prefix".equals(simpleName) || "Ipv6Prefix".equals(simpleName)) {
+
+ if (paramValue != null) {
+ if("Ipv4Address".equals(simpleName) || "Ipv6Address".equals(simpleName)){
+ try {
+ IpAddress ipAddr = IpAddressBuilder
+ .getDefaultInstance(paramValue);
+
+
+ if ("Ipv4Address".equals(simpleName))
+ {
+ m.invoke(toObj, ipAddr.getIpv4Address());
+ }
+ else
+ {
+ m.invoke(toObj, ipAddr.getIpv6Address());
+
+ }
+ foundValue = true;
+ } catch (Exception e) {
+ LOG.error(
+ "Caught exception calling "
+ + toClass.getName() + "."
+ + m.getName() + "("
+ + paramValue + ")", e);
+
+ }
+ }else if("Ipv4Prefix".equals(simpleName)|| "Ipv6Prefix".equals(simpleName)){
+ try {
+ IpPrefix ipPrefix = IpPrefixBuilder
+ .getDefaultInstance(paramValue);
+
+
+ if ("Ipv4Prefix".equals(simpleName))
+ {
+ m.invoke(toObj, ipPrefix.getIpv4Prefix());
+ }
+ else
+ {
+ m.invoke(toObj, ipPrefix.getIpv6Prefix());
+
+ }
+ foundValue = true;
+ } catch (Exception e) {
+ LOG.error(
+ "Caught exception calling "
+ + toClass.getName() + "."
+ + m.getName() + "("
+ + paramValue + ")", e);
+
+ }
+ }
+ }
+
+ } else {
+ // setter expects a yang-generated class. Need
+ // to
+ // create a builder to set it.
+
+ String builderName = paramClass.getName()
+ + "Builder";
+ Class builderClass = null;
+ Object builderObj = null;
+ Object paramObj = null;
+
+ //LOG.debug(m.getName()
+ // + " expects a yang-generated class - looking for builder "
+ // + builderName);
+ try {
+ builderClass = Class.forName(builderName);
+ builderObj = builderClass.newInstance();
+ paramObj = toBuilder(props, propNamePfx,
+ builderObj);
+ } catch (ClassNotFoundException e) {
+ Object constObj = null;
+ try {
+ // See if I can find a constructor I can
+ // use
+ Constructor[] constructors = paramClass
+ .getConstructors();
+ // Is there a String constructor?
+ for (Constructor c : constructors) {
+ Class[] cParms = c
+ .getParameterTypes();
+ if ((cParms != null)
+ && (cParms.length == 1)) {
+ if (String.class
+ .isAssignableFrom(cParms[0])) {
+ constObj = c
+ .newInstance(paramValue);
+ }
+ }
+ }
+
+ if (constObj == null) {
+ // Is there a Long constructor?
+ for (Constructor c : constructors) {
+ Class[] cParms = c
+ .getParameterTypes();
+ if ((cParms != null)
+ && (cParms.length == 1)) {
+ if (Long.class
+ .isAssignableFrom(cParms[0])) {
+ constObj = c
+ .newInstance(Long
+ .parseLong(paramValue));
+ }
+ }
+ }
+
+ }
+
+ if (constObj != null) {
+ try {
+ m.invoke(toObj, constObj);
+ foundValue = true;
+ } catch (Exception e2) {
+ LOG.error(
+ "Caught exception trying to call "
+ + m.getName(),
+ e2);
+ }
+ }
+ } catch (Exception e1) {
+ LOG.warn(
+ "Could not find a suitable constructor for "
+ + paramClass.getName(),
+ e1);
+ }
+
+ if (paramObj == null) {
+ LOG.warn("Could not find builder class "
+ + builderName
+ + " and could not find a String or Long constructor - trying just to set passing paramValue");
+
+ }
+
+ } catch (Exception e) {
+ LOG.error(
+ "Caught exception trying to create builder "
+ + builderName, e);
+ }
+
+ if (paramObj != null) {
+
+ try {
+
+ Method buildMethod = builderClass
+ .getMethod("build");
+ //LOG.debug("Calling "
+ // + paramObj.getClass().getName()
+ // + "." + buildMethod.getName()
+ // + "()");
+ Object builtObj = buildMethod
+ .invoke(paramObj);
+
+ boolean isAccessible = m.isAccessible();
+ if (!isAccessible) {
+ m.setAccessible(true);
+ }
+
+ //LOG.debug("Calling "
+ // + toObj.getClass().getName()
+ // + "." + m.getName() + "()");
+ m.invoke(toObj, builtObj);
+ if (!isAccessible) {
+ m.setAccessible(isAccessible);
+ }
+ foundValue = true;
+
+ } catch (Exception e) {
+ LOG.error(
+ "Caught exception trying to set Yang-generated class expected by"
+ + toClass.getName()
+ + "."
+ + m.getName()
+ + "() from Properties entry",
+ e);
+ }
+ } else {
+ try {
+ boolean isAccessible = m.isAccessible();
+ if (!isAccessible) {
+ m.setAccessible(true);
+ }
+ //LOG.debug("Calling "
+ // + toObj.getClass().getName()
+ // + "." + m.getName() + "("
+ // + paramValue + ")");
+ m.invoke(toObj, paramValue);
+ if (!isAccessible) {
+ m.setAccessible(isAccessible);
+ }
+ foundValue = true;
+
+ } catch (Exception e) {
+ LOG.error(
+ "Caught exception trying to convert value returned by"
+ + toClass.getName()
+ + "."
+ + m.getName()
+ + TO_PROPERTIES_STRING,
+ e);
+ }
+ }
+ }
+ }
+ }else {
+
+ // Setter's argument is not a yang-generated class. See
+ // if it is a List.
+
+ if (List.class.isAssignableFrom(paramClass)) {
+
+ //LOG.debug("Parameter class " + paramClass.getName()
+ // + " is a List");
+
+ // Figure out what type of args are in List and pass
+ // that to toList().
+
+ Type paramType = m.getGenericParameterTypes()[0];
+ Type elementType = ((ParameterizedType) paramType)
+ .getActualTypeArguments()[0];
+ Object paramObj = new LinkedList();
+ try {
+ paramObj = toList(props, propName,
+ (List) paramObj, (Class) elementType);
+ } catch (Exception e) {
+ LOG.error("Caught exception trying to create list expected as argument to "
+ + toClass.getName() + "." + m.getName());
+ }
+
+ if (paramObj != null) {
+ try {
+ boolean isAccessible = m.isAccessible();
+ if (!isAccessible) {
+ m.setAccessible(true);
+ }
+ //LOG.debug("Calling "
+ // + toObj.getClass().getName() + "."
+ // + m.getName() + "(" + paramValue
+ // + ")");
+ m.invoke(toObj, paramObj);
+ if (!isAccessible) {
+ m.setAccessible(isAccessible);
+ }
+ foundValue = true;
+
+ } catch (Exception e) {
+ LOG.error(
+ "Caught exception trying to convert List returned by"
+ + toClass.getName() + "."
+ + m.getName()
+ + TO_PROPERTIES_STRING,
+ e);
+ }
+ }
+ } else {
+
+ // Setter expects something that is not a List and
+ // not yang-generated. Just pass the parameter value
+
+ //LOG.debug("Parameter class "
+ // + paramClass.getName()
+ // + " is not a yang-generated class or a List");
+
+ if (paramValue != null) {
+
+ Object constObj = null;
+
+ try {
+ // See if I can find a constructor I can use
+ Constructor[] constructors = paramClass
+ .getConstructors();
+ // Is there a String constructor?
+ for (Constructor c : constructors) {
+ Class[] cParms = c.getParameterTypes();
+ if ((cParms != null)
+ && (cParms.length == 1)) {
+ if (String.class
+ .isAssignableFrom(cParms[0])) {
+ constObj = c
+ .newInstance(paramValue);
+ }
+ }
+ }
+
+ if (constObj == null) {
+ // Is there a Long constructor?
+ for (Constructor c : constructors) {
+ Class[] cParms = c
+ .getParameterTypes();
+ if ((cParms != null)
+ && (cParms.length == 1)) {
+ if (Long.class
+ .isAssignableFrom(cParms[0])) {
+ constObj = c
+ .newInstance(Long
+ .parseLong(paramValue));
+ }
+ }
+ }
+
+ }
+
+ if (constObj != null) {
+ try {
+ //LOG.debug("Calling "
+ // + toObj.getClass()
+ // .getName() + "."
+ // + m.getName() + "("
+ // + constObj + ")");
+ m.invoke(toObj, constObj);
+ foundValue = true;
+ } catch (Exception e2) {
+ LOG.error(
+ "Caught exception trying to call "
+ + m.getName(), e2);
+ }
+ } else {
+ try {
+ boolean isAccessible = m
+ .isAccessible();
+ if (!isAccessible) {
+ m.setAccessible(true);
+ }
+ //LOG.debug("Calling "
+ // + toObj.getClass()
+ // .getName() + "."
+ // + m.getName() + "("
+ // + paramValue + ")");
+ m.invoke(toObj, paramValue);
+ if (!isAccessible) {
+ m.setAccessible(isAccessible);
+ }
+ foundValue = true;
+
+ } catch (Exception e) {
+ LOG.error(
+ "Caught exception trying to convert value returned by"
+ + toClass.getName()
+ + "."
+ + m.getName()
+ + TO_PROPERTIES_STRING,
+ e);
+ }
+ }
+ } catch (Exception e1) {
+ LOG.warn(
+ "Could not find a suitable constructor for "
+ + paramClass.getName(), e1);
+ }
+
+ /*
+ * try { boolean isAccessible =
+ * m.isAccessible(); if (!isAccessible) {
+ * m.setAccessible(true); } LOG.debug("Calling "
+ * + toObj.getClass().getName() + "." +
+ * m.getName() + "(" + paramValue + ")");
+ * m.invoke(toObj, paramValue); if
+ * (!isAccessible) {
+ * m.setAccessible(isAccessible); } foundValue =
+ * true;
+ *
+ * } catch (Exception e) { LOG.error(
+ * "Caught exception trying to convert value returned by"
+ * + toClass.getName() + "." + m.getName() +
+ * "() to Properties entry", e); }
+ */
+ }
+ }
+ }
+ } // End of section handling "setter" method
+ } // End of loop through Methods
+ } // End of section handling yang-generated class
+
+ if (foundValue) {
+ return (toObj);
+ } else {
+ return (null);
+ }
+ }
+
+ public static Properties getProperties(PrintStream pstr, String pfx,
+ Class toClass) {
+ boolean foundValue = false;
+
+ //LOG.debug("Analyzing " + toClass.getName() + " class : pfx " + pfx);
+
+ if (isYangGenerated(toClass)
+ && (!Identifier.class.isAssignableFrom(toClass))) {
+ // Class is yang generated.
+ //LOG.debug(toClass.getName() + " is a Yang-generated class");
+
+ if (toClass.getName().endsWith("Key")) {
+ if (Identifier.class.isAssignableFrom(toClass)) {
+ //LOG.debug(Identifier.class.getName()
+ // + " is assignable from " + toClass.getName());
+ } else {
+
+ //LOG.debug(Identifier.class.getName()
+ // + " is NOT assignable from " + toClass.getName());
+ }
+ }
+
+ String propNamePfx = null;
+ if (pfx.endsWith("]")) {
+ propNamePfx = pfx;
+ }else if(pfx.indexOf(".CLASS_FOUND") != -1){
+ pfx = pfx.replace(".CLASS_FOUND","");
+ propNamePfx = pfx + "."
+ + toLowerHyphen(toClass.getSimpleName());
+ } else {
+
+ if ((pfx != null) && (pfx.length() > 0)) {
+ propNamePfx = pfx + "."
+ + toLowerHyphen(toClass.getSimpleName());
+ } else {
+ propNamePfx = toLowerHyphen(toClass.getSimpleName());
+ }
+
+ if (propNamePfx.endsWith(BUILDER)) {
+ propNamePfx = propNamePfx.substring(0, propNamePfx.length()
+ - BUILDER.length());
+ }
+
+ if (propNamePfx.endsWith(IMPL)) {
+ propNamePfx = propNamePfx.substring(0, propNamePfx.length()
+ - IMPL.length());
+ }
+ }
+
+ // Iterate through getter methods to figure out values we need to
+ // set
+
+ for (Method m : toClass.getMethods()) {
+ //LOG.debug("Is " + m.getName() + " method a getter?");
+ if (isGetter(m)) {
+ // LOG.debug(m.getName() + " is a getter");
+ Class returnClass = m.getReturnType();
+
+ String fieldName = toLowerHyphen(m.getName().substring(3));
+ if(m != null && m.getName().matches("^is[A-Z].*")){
+ fieldName = toLowerHyphen(m.getName().substring(2));
+ }
+ fieldName = fieldName.substring(0, 1).toLowerCase()
+ + fieldName.substring(1);
+
+ String propName = propNamePfx + "." + fieldName;
+ //System.out.println("****" + propName);
+
+ // Is the return type a yang generated class?
+ if (isYangGenerated(returnClass)) {
+ // Is it an enum?
+ if (returnClass.isEnum()) {
+
+ //LOG.debug(m.getName() + " is an Enum");
+ //pstr.print("\n" + propName);
+ //pstr.print("\n" + propName + ":Enum:" + Arrays.asList(returnClass.getEnumConstants()) + "\n");
+ pstr.print("\"" + propName + ":Enum:" + Arrays.asList(returnClass.getEnumConstants()) + "\",");
+ prop.setProperty(propName,"");
+ propList.add(propName);
+
+ } else {
+
+ String simpleName = returnClass.getSimpleName();
+ //System.out.println("simpleName:" + simpleName);
+
+ if ("Ipv4Address".equals(simpleName) || "Ipv6Address".equals(simpleName) || "IpAddress".equals(simpleName) || "Ipv4Prefix".equals(simpleName) || "Ipv6Prefix".equals(simpleName) || "IpPrefix".equals(simpleName)) {
+ //LOG.debug(m.getName()+" is an "+simpleName);
+ //pstr.print("\n" + propName);
+ //pstr.print("\n" + propName + ":" + simpleName + "\n");
+ pstr.print("\"" + propName + ":" + simpleName + "\",");
+ prop.setProperty(propName,"");
+ propList.add(propName);
+ } else {
+ boolean isString = false;
+ boolean isNumber = false;
+ boolean isBoolean = false;
+ boolean isIdentifier = false;
+ //System.out.println("simpleName:" + simpleName);
+ //System.out.println("propName:" + propName);
+ for(Method mthd : returnClass.getMethods()){
+ String methodName = mthd.getName();
+ //System.out.println("methodName:" + methodName);
+ if(methodName.equals("getValue")){
+ Class retType = mthd.getReturnType();
+ //System.out.println("retType:" + retType);
+ isString = String.class.isAssignableFrom(retType);
+ isNumber = Number.class.isAssignableFrom(retType);
+ isBoolean = Boolean.class.isAssignableFrom(retType);
+ isIdentifier = Identifier.class.isAssignableFrom(retType);
+ //System.out.println("isString:" + isString);
+ //System.out.println("isNumber:" + isNumber);
+ //System.out.println("isNumber:" + isNumber);
+ break;
+ }
+ }
+
+ if(isString){
+ pstr.print("\"" + propName + ":String\",");
+ prop.setProperty(propName,"");
+ propList.add(propName);
+ }else if(isNumber){
+ pstr.print("\"" + propName + ":Number\",");
+ prop.setProperty(propName,"");
+ propList.add(propName);
+ }else if(isBoolean){
+ pstr.print("\"" + propName + ":Boolean\",");
+ prop.setProperty(propName,"");
+ propList.add(propName);
+ }else if(isIdentifier){
+ //System.out.println("isIdentifier");
+ //isIdentifer so skipping
+ continue;
+ }else{
+ /*
+ System.out.println("fieldName:" + fieldName);
+ System.out.println("simpleName:" + simpleName);
+ System.out.println("returnClass:" + returnClass);
+ System.out.println("pstr:" + pstr);
+ System.out.println("propNamePfx:" + propNamePfx);
+ */
+ getProperties(pstr, propNamePfx + ".CLASS_FOUND", returnClass);
+ }
+ }
+
+ }
+ } else {
+
+ // Setter's argument is not a yang-generated class. See
+ // if it is a List.
+
+ if (List.class.isAssignableFrom(returnClass)) {
+
+ //LOG.debug("Parameter class "
+ // + returnClass.getName() + " is a List");
+
+ // Figure out what type of args are in List and pass
+ // that to toList().
+
+ Type returnType = m.getGenericReturnType();
+ Type elementType = ((ParameterizedType) returnType)
+ .getActualTypeArguments()[0];
+ Class elementClass = (Class) elementType;
+ //LOG.debug("Calling printPropertyList on list type ("
+ //+ elementClass.getName()
+ // + "), pfx is ("
+ // + pfx
+ // + "), toClass is ("
+ // + toClass.getName() + ")");
+ //System.out.println("List propNamePfx:" + propNamePfx+ "." + toLowerHyphen(elementClass.getSimpleName()) + "[]");
+ if(String.class.isAssignableFrom(elementClass)){
+ pstr.print("\"" + propName + ":[String,String,...]\",");
+ prop.setProperty(propName,"");
+ propList.add(propName);
+ }else if(Number.class.isAssignableFrom(elementClass)){
+ pstr.print("\"" + propName + ":[Number,Number,...]\",");
+ prop.setProperty(propName,"");
+ propList.add(propName);
+ }else if(Boolean.class.isAssignableFrom(elementClass)){
+ pstr.print("\"" + propName + ":[Boolean,Boolean,...]\",");
+ prop.setProperty(propName,"");
+ propList.add(propName);
+ }else if(Identifier.class.isAssignableFrom(elementClass)){
+ continue;
+ }else{
+ getProperties(
+ pstr,
+ propNamePfx
+ + "."
+ + toLowerHyphen(elementClass
+ .getSimpleName()) + "[]",
+ elementClass);
+ }
+
+ } else if (!returnClass.equals(Class.class)) {
+
+ // Setter expects something that is not a List and
+ // not yang-generated. Just pass the parameter value
+
+ //LOG.debug("Parameter class "
+ // + returnClass.getName()
+ // + " is not a yang-generated class or a List");
+
+ //pstr.print("\n" + propName);
+ String className=returnClass.getName();
+ int nClassNameIndex = className.lastIndexOf('.');
+ String nClassName = className;
+ if(nClassNameIndex != -1){
+ nClassName=className.substring(nClassNameIndex+1);
+ }
+ boolean isString = String.class.isAssignableFrom(returnClass);
+ boolean isNumber = Number.class.isAssignableFrom(returnClass);
+ boolean isBoolean = Boolean.class.isAssignableFrom(returnClass);
+ //pstr.print("\n" + propName +":" + nClassName +"\n");
+ boolean isIdentifier = Identifier.class.isAssignableFrom(returnClass);
+ if(!isIdentifier && !nClassName.equals("[C")){
+ if(isNumber){
+ pstr.print("\"" + propName +":Number\",");
+ }else if(isBoolean){
+ pstr.print("\"" + propName +":Boolean\",");
+ }else{
+ if(nClassName.equals("[B")){
+ pstr.print("\"" + propName +":Binary\",");
+ }else{
+ pstr.print("\"" + propName +":" + nClassName +"\",");
+ }
+ }
+ prop.setProperty(propName,"");
+ propList.add(propName);
+ }
+
+ }
+ }
+ } // End of section handling "setter" method
+ } // End of loop through Methods
+ } // End of section handling yang-generated class
+
+ return prop;
+ }
+
+ public static boolean isYangGenerated(Class c) {
+ if (c == null) {
+ return (false);
+ } else {
+ //System.out.println(c.getName());
+ return (c.getName().startsWith("org.opendaylight.yang.gen."));
+ }
+ }
+
+ public static boolean isIpv4Address(Class c) {
+
+ if (c == null ) {
+ return (false);
+ }
+ String simpleName = c.getSimpleName();
+ return ("Ipv4Address".equals(simpleName)) ;
+ }
+
+ public static boolean isIpv6Address(Class c) {
+
+ if (c == null ) {
+ return (false);
+ }
+ String simpleName = c.getSimpleName();
+ return ("Ipv6Address".equals(simpleName)) ;
+ }
+ public static boolean isIpv4Prefix(Class c) {
+
+ if (c == null ) {
+ return (false);
+ }
+ String simpleName = c.getSimpleName();
+ //System.out.println("simpleName:" + simpleName);
+ return ("Ipv4Prefix".equals(simpleName)) ;
+ }
+
+ public static boolean isIpv6Prefix(Class c) {
+
+ if (c == null ) {
+ return (false);
+ }
+ String simpleName = c.getSimpleName();
+ //System.out.println("simpleName:" + simpleName);
+ return ("Ipv6Prefix".equals(simpleName)) ;
+ }
+
+ public static String toLowerHyphen(String inStr) {
+ if (inStr == null) {
+ return (null);
+ }
+
+ String str = inStr.substring(0, 1).toLowerCase();
+ if (inStr.length() > 1) {
+ str = str + inStr.substring(1);
+ }
+
+ String regex = "([a-z0-9A-Z])(?=[A-Z])";
+ String replacement = "$1-";
+
+ String retval = str.replaceAll(regex, replacement).toLowerCase();
+
+ //LOG.debug("Converting " + inStr + " => " + str + " => " + retval);
+ return (retval);
+ }
+
+ public static String toUpperCamelCase(String inStr) {
+ if (inStr == null) {
+ return (null);
+ }
+
+ String[] terms = inStr.split("-");
+ StringBuffer sbuff = new StringBuffer();
+ // Check if string begins with a digit
+ if (Character.isDigit(inStr.charAt(0))) {
+ sbuff.append('_');
+ }
+ for (String term : terms) {
+ sbuff.append(term.substring(0, 1).toUpperCase());
+ if (term.length() > 1) {
+ sbuff.append(term.substring(1));
+ }
+ }
+ return (sbuff.toString());
+
+ }
+
+ public static boolean isGetter(Method m) {
+ //System.out.println(m);
+ if (m == null) {
+ return (false);
+ }
+
+ if (Modifier.isPublic(m.getModifiers())
+ && (m.getParameterTypes().length == 0)) {
+ if ((m.getName().matches("^is[A-Z].*") || m.getName().matches("^get[A-Z].*"))
+ && m.getReturnType().equals(Boolean.class)) {
+ return (true);
+ }
+ if (m.getName().matches("^get[A-Z].*")
+ && !m.getReturnType().equals(void.class)) {
+ return (true);
+ }
+
+ }
+
+ return (false);
+ }
+
+ public static boolean isSetter(Method m) {
+ if (m == null) {
+ return (false);
+ }
+
+ if (Modifier.isPublic(m.getModifiers())
+ && (m.getParameterTypes().length == 1)) {
+ if (m.getName().matches("^set[A-Z].*")) {
+ Class[] paramTypes = m.getParameterTypes();
+ if (paramTypes[0].isAssignableFrom(Identifier.class)
+ || Identifier.class.isAssignableFrom(paramTypes[0])) {
+ return (false);
+ } else {
+ return (true);
+ }
+ }
+
+ }
+
+ return (false);
+ }
+
+ public static void main(String[] args){
+
+ try(PrintStream ps = new PrintStream(new FileOutputStream(FileDescriptor.out))){
+ PrintYangToProp printYangToProp = new PrintYangToProp();
+ String className = args[0];
+ //ClassLoader classLoader = PrintYangToProp.class.getClassLoader();
+ //Class aClass = classLoader.loadClass(className);
+ Class cl = Class.forName(className);
+ //printPropertyList(ps,"",cl);
+ //JsonObject jsonObj = Json.createObjectBuilder().build();
+ Properties p = getProperties(ps,"",cl);
+ //System.out.println(p);
+
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+
+
+}
diff --git a/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicClassResolver.java b/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicClassResolver.java
index 82670375f..08e957f1d 100644
--- a/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicClassResolver.java
+++ b/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicClassResolver.java
@@ -1,24 +1,3 @@
-/*-
- * ============LICENSE_START=======================================================
- * onap
- * ================================================================================
- * Copyright (C) 2016 - 2017 ONAP
- * Modifications Copyright (C) 2018 IBM.
- * ================================================================================
- * 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 java.util.HashMap;
diff --git a/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicService.java b/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicService.java
index 630c29018..a23594ee3 100644
--- a/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicService.java
+++ b/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicService.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.
@@ -22,16 +22,15 @@
package org.onap.ccsdk.sli.core.sli.provider;
import java.util.Properties;
+
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicServiceBase;
-import org.opendaylight.mdsal.dom.api.DOMDataBroker;
-
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
public interface SvcLogicService extends SvcLogicServiceBase {
String NAME = "org.onap.ccsdk.sli.core.sli.provider.SvcLogicService";
- @Override
@Deprecated
Properties execute(String module, String rpc, String version, String mode, Properties parms) throws SvcLogicException;
diff --git a/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java b/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java
index 35a299323..92c2aa49a 100755
--- a/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java
+++ b/core/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java
@@ -33,7 +33,7 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory;
import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicPropertiesProvider;
import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicResolver;
import org.onap.ccsdk.sli.core.sli.provider.base.SvcLogicServiceImplBase;
-import org.opendaylight.mdsal.dom.api.DOMDataBroker;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/core/sli/provider/src/main/resources/OSGI-INF/blueprint/sli-blueprint.xml b/core/sli/provider/src/main/resources/OSGI-INF/blueprint/sli-blueprint.xml
new file mode 100644
index 000000000..fb3ab9a03
--- /dev/null
+++ b/core/sli/provider/src/main/resources/OSGI-INF/blueprint/sli-blueprint.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <bean id="propProvider" class="org.onap.ccsdk.sli.core.sli.provider.SvcLogicPropertiesProviderImpl" />
+ <reference id="dblibService" interface="org.onap.ccsdk.sli.core.dblib.DbLibService" />
+ <bean id="svcLogicClassResolver" class="org.onap.ccsdk.sli.core.sli.provider.SvcLogicClassResolver" />
+
+ <bean id="svcLogicService" class="org.onap.ccsdk.sli.core.sli.provider.SvcLogicServiceImpl">
+ <argument ref="propProvider" />
+ <argument ref="dblibService" />
+ <argument ref="svcLogicClassResolver" />
+ </bean>
+
+ <service ref="svcLogicService">
+ <interfaces>
+ <value>org.onap.ccsdk.sli.core.sli.provider.SvcLogicService</value>
+ </interfaces>
+ </service>
+
+ <bean id="fileRecorder" class="org.onap.ccsdk.sli.core.sli.recording.FileRecorder" />
+ <!-- Implementation name was chosen over interface name due to the fact that this Service
+ was previously registered using the implementation name rather than the interface name.
+ To ensure backwards compatibility with abstractions polling the Service Registry for the
+ fileRecorder, the implementation name was chosen here. -->
+ <service ref="fileRecorder" interface="org.onap.ccsdk.sli.core.sli.recording.FileRecorder" />
+
+ <bean id="slf4jRecorder" class="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder" />
+ <!-- Implementation name was chosen over interface name due to the fact that this Service
+ was previously registered using the implementation name rather than the interface name.
+ To ensure backwards compatibility with abstractions polling the Service Registry for the
+ slf4jRecorder, the implementation name was chosen here. -->
+ <service ref="slf4jRecorder" interface="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder" />
+
+</blueprint>
diff --git a/core/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTest.java b/core/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTest.java
index 9d2ae2385..93d9931d0 100755
--- a/core/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTest.java
+++ b/core/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTest.java
@@ -72,7 +72,6 @@ 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);
@@ -157,7 +156,7 @@ public class MdsalHelperTest extends TestCase {
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].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");
diff --git a/core/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTesterUtil.java b/core/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTesterUtil.java
index 0e1ae5e83..2167b8101 100644
--- a/core/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTesterUtil.java
+++ b/core/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelperTesterUtil.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,14 @@
package org.onap.ccsdk.sli.core.sli.provider;
+import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class MdsalHelperTesterUtil extends MdsalHelper {
private static final Logger LOG = LoggerFactory.getLogger(MdsalHelperTesterUtil.class);
-
+
//Normally static init of classes goes here for some weird classloader thing
static {
String str = "Hello World!";
diff --git a/core/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/PrintYangToPropTest.java b/core/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/PrintYangToPropTest.java
index 10bbbd91a..50b7926a0 100644
--- a/core/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/PrintYangToPropTest.java
+++ b/core/sli/provider/src/test/java/org/onap/ccsdk/sli/core/sli/provider/PrintYangToPropTest.java
@@ -26,7 +26,9 @@ import java.util.Enumeration;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
+
import org.junit.Test;
+import org.onap.ccsdk.sli.core.sli.provider.PrintYangToProp;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput.Mode;
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.TestResultsBuilder;
@@ -60,31 +62,31 @@ public class PrintYangToPropTest {
List<SliParameter> pList = new LinkedList<>();
SliParameterBuilder pBuilder = new SliParameterBuilder();
- pBuilder.setParameterName("string-param");
- pBuilder.setStringValue("hi");
- pList.add(pBuilder.build());
- pBuilder.setParameterName("int-param");
- pBuilder.setIntValue(1);
- pBuilder.setStringValue(null);
- pList.add(pBuilder.build());
- pBuilder.setParameterName("bool-param");
- 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-value2");
- 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());
+ pBuilder.setParameterName("string-param");
+ pBuilder.setStringValue("hi");
+ pList.add(pBuilder.build());
+ pBuilder.setParameterName("int-param");
+ pBuilder.setIntValue(1);
+ pBuilder.setStringValue(null);
+ pList.add(pBuilder.build());
+ pBuilder.setParameterName("bool-param");
+ 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());
@@ -92,7 +94,7 @@ public class PrintYangToPropTest {
// Generate properties
- props = MdsalHelper.toProperties(props, egBuilder);
+ props = PrintYangToProp.toProperties(props, egBuilder);
Enumeration propNames = props.propertyNames();
@@ -102,11 +104,11 @@ public class PrintYangToPropTest {
}
// Generate builder from properties just generated
- MdsalHelper.toBuilder(props, pBuilder);
-
+ PrintYangToProp.toBuilder(props, pBuilder);
+
}
-
+
@Test
public void testWithList() {
TestResultsBuilder resultsBuilder = new TestResultsBuilder();
@@ -123,7 +125,7 @@ public class PrintYangToPropTest {
// Generate properties
Properties props = new Properties();
- props = MdsalHelper.toProperties(props, resultsBuilder);
+ props = PrintYangToProp.toProperties(props, resultsBuilder);
Enumeration propNames = props.propertyNames();
@@ -133,7 +135,7 @@ public class PrintYangToPropTest {
}
// Generate builder from properties just generated
- MdsalHelper.toBuilder(props, resultsBuilder);
+ PrintYangToProp.toBuilder(props, resultsBuilder);
}
diff --git a/core/sliPluginUtils/provider/src/main/resources/OSGI-INF/blueprint/slipluginutils-blueprint.xml b/core/sliPluginUtils/provider/src/main/resources/OSGI-INF/blueprint/slipluginutils-blueprint.xml
new file mode 100644
index 000000000..534b92c93
--- /dev/null
+++ b/core/sliPluginUtils/provider/src/main/resources/OSGI-INF/blueprint/slipluginutils-blueprint.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <bean id="sliPluginUtils" class="org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils" />
+ <service ref="sliPluginUtils"
+ interface="org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils" />
+
+ <bean id="sliStringUtils" class="org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils" />
+ <service ref="sliStringUtils"
+ interface="org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils" />
+</blueprint>
diff --git a/core/sliapi/model/swagger/src/main/json/sliapi.json b/core/sliapi/model/swagger/src/main/json/sliapi.json
index 3848cb551..9133f3379 100644
--- a/core/sliapi/model/swagger/src/main/json/sliapi.json
+++ b/core/sliapi/model/swagger/src/main/json/sliapi.json
@@ -1 +1 @@
-{"swagger":"2.0","info":{"description":"This module contains a collection of generally useful derived\nYANG data types for Internet addresses and related things.\n\nCopyright (c) 2013 IETF Trust and the persons identified as\nauthors of the code. All rights reserved.\n\nRedistribution and use in source and binary forms, with or\nwithout modification, is permitted pursuant to, and subject\nto the license terms contained in, the Simplified BSD License\nset forth in Section 4.c of the IETF Trust's Legal Provisions\nRelating to IETF Documents\n(http://trustee.ietf.org/license-info).\n\nThis version of this YANG module is part of RFC 6991; see\nthe RFC itself for full legal notices.,Defines API to service logic interpreter,This module contains a collection of generally useful derived\nYANG data types.\n\nCopyright (c) 2013 IETF Trust and the persons identified as\nauthors of the code. All rights reserved.\n\nRedistribution and use in source and binary forms, with or\nwithout modification, is permitted pursuant to, and subject\nto the license terms contained in, the Simplified BSD License\nset forth in Section 4.c of the IETF Trust's Legal Provisions\nRelating to IETF Documents\n(http://trustee.ietf.org/license-info).\n\nThis version of this YANG module is part of RFC 6991; see\nthe RFC itself for full legal notices.","version":"1.2.0-SNAPSHOT","title":"ietf-inet-types,SLI-API,ietf-yang-types API"},"consumes":["application/json","application/xml"],"produces":["application/json","application/xml"],"paths":{"/config/SLI-API:test-results/":{"get":{"tags":["SLI-API"],"description":"returns sli.api.TestResults","parameters":[],"responses":{"400":{"description":"Internal error"},"200":{"description":"sli.api.TestResults","responseSchema":{"originalRef":"#/definitions/sli.api.TestResults","$ref":"#/definitions/sli.api.TestResults"},"schema":{"originalRef":"#/definitions/sli.api.TestResults","$ref":"#/definitions/sli.api.TestResults"}}}},"post":{"tags":["SLI-API"],"description":"creates sli.api.TestResults","parameters":[{"in":"body","name":"sli.api.TestResults.body-param","description":"sli.api.TestResults to be added to list","required":false,"schema":{"originalRef":"#/definitions/sli.api.TestResults","$ref":"#/definitions/sli.api.TestResults"}}],"responses":{"400":{"description":"Internal error"},"201":{"description":"Object created"},"409":{"description":"Object already exists"}}},"put":{"tags":["SLI-API"],"description":"creates or updates sli.api.TestResults","parameters":[{"in":"body","name":"sli.api.TestResults.body-param","description":"sli.api.TestResults to be added or updated","required":false,"schema":{"originalRef":"#/definitions/sli.api.TestResults","$ref":"#/definitions/sli.api.TestResults"}}],"responses":{"400":{"description":"Internal error"},"201":{"description":"Object created"},"204":{"description":"Object modified"}}},"delete":{"tags":["SLI-API"],"description":"removes sli.api.TestResults","parameters":[],"responses":{"400":{"description":"Internal error"},"204":{"description":"Object deleted"}}}},"/config/SLI-API:test-results/SLI-API:test-result/":{"post":{"description":"creates sli.api.testresults.TestResult","parameters":[{"in":"body","name":"sli.api.testresults.TestResult.body-param","description":"sli.api.testresults.TestResult to be added to list","required":false,"schema":{"originalRef":"#/definitions/sli.api.testresults.TestResult","$ref":"#/definitions/sli.api.testresults.TestResult"}}],"responses":{"400":{"description":"Internal error"},"201":{"description":"Object created"},"409":{"description":"Object already exists"}}}},"/config/SLI-API:test-results/SLI-API:test-result/{test-identifier}/":{"get":{"tags":["SLI-API"],"description":"returns sli.api.testresults.TestResult","parameters":[{"name":"test-identifier","in":"path","description":"Id of test-result","required":true,"type":"string"}],"responses":{"400":{"description":"Internal error"},"200":{"description":"sli.api.testresults.TestResult","responseSchema":{"originalRef":"#/definitions/sli.api.testresults.TestResult","$ref":"#/definitions/sli.api.testresults.TestResult"},"schema":{"originalRef":"#/definitions/sli.api.testresults.TestResult","$ref":"#/definitions/sli.api.testresults.TestResult"}}}},"post":{"tags":["SLI-API"],"description":"creates sli.api.testresults.TestResult","parameters":[{"name":"test-identifier","in":"path","description":"Id of test-result","required":true,"type":"string"},{"in":"body","name":"sli.api.testresults.TestResult.body-param","description":"sli.api.testresults.TestResult to be added to list","required":false,"schema":{"originalRef":"#/definitions/sli.api.testresults.TestResult","$ref":"#/definitions/sli.api.testresults.TestResult"}}],"responses":{"400":{"description":"Internal error"},"201":{"description":"Object created"},"409":{"description":"Object already exists"}}},"put":{"tags":["SLI-API"],"description":"creates or updates sli.api.testresults.TestResult","parameters":[{"name":"test-identifier","in":"path","description":"Id of test-result","required":true,"type":"string"},{"in":"body","name":"sli.api.testresults.TestResult.body-param","description":"sli.api.testresults.TestResult to be added or updated","required":false,"schema":{"originalRef":"#/definitions/sli.api.testresults.TestResult","$ref":"#/definitions/sli.api.testresults.TestResult"}}],"responses":{"400":{"description":"Internal error"},"201":{"description":"Object created"},"204":{"description":"Object modified"}}},"delete":{"tags":["SLI-API"],"description":"removes sli.api.testresults.TestResult","parameters":[{"name":"test-identifier","in":"path","description":"Id of test-result","required":true,"type":"string"}],"responses":{"400":{"description":"Internal error"},"204":{"description":"Object deleted"}}}},"/operational/SLI-API:test-results/":{"get":{"tags":["SLI-API"],"description":"returns sli.api.TestResults","parameters":[],"responses":{"400":{"description":"Internal error"},"200":{"description":"sli.api.TestResults","responseSchema":{"originalRef":"#/definitions/sli.api.TestResults","$ref":"#/definitions/sli.api.TestResults"},"schema":{"originalRef":"#/definitions/sli.api.TestResults","$ref":"#/definitions/sli.api.TestResults"}}}}},"/operational/SLI-API:test-results/SLI-API:test-result/{test-identifier}/":{"get":{"tags":["SLI-API"],"description":"returns sli.api.testresults.TestResult","parameters":[{"name":"test-identifier","in":"path","description":"Id of test-result","required":true,"type":"string"}],"responses":{"400":{"description":"Internal error"},"200":{"description":"sli.api.testresults.TestResult","responseSchema":{"originalRef":"#/definitions/sli.api.testresults.TestResult","$ref":"#/definitions/sli.api.testresults.TestResult"},"schema":{"originalRef":"#/definitions/sli.api.testresults.TestResult","$ref":"#/definitions/sli.api.testresults.TestResult"}}}}},"/operations/SLI-API:execute-graph/":{"post":{"tags":["SLI-API"],"parameters":[{"in":"body","name":"sli.api.executegraph.Input.body-param","required":false,"schema":{"properties":{"input":{"originalRef":"#/definitions/sli.api.executegraph.Input","$ref":"#/definitions/sli.api.executegraph.Input"}}}}],"responses":{"400":{"description":"Internal error"},"200":{"description":"Correct response","responseSchema":{"originalRef":"#/definitions/sli.api.ExecuteGraph","$ref":"#/definitions/sli.api.ExecuteGraph"},"schema":{"originalRef":"#/definitions/sli.api.ExecuteGraph","$ref":"#/definitions/sli.api.ExecuteGraph"}},"201":{"description":"No response"}}}},"/operations/SLI-API:healthcheck/":{"post":{"tags":["SLI-API"],"parameters":[],"responses":{"400":{"description":"Internal error"},"200":{"description":"Correct response","responseSchema":{"originalRef":"#/definitions/sli.api.Healthcheck","$ref":"#/definitions/sli.api.Healthcheck"},"schema":{"originalRef":"#/definitions/sli.api.Healthcheck","$ref":"#/definitions/sli.api.Healthcheck"}},"201":{"description":"No response"}}}},"/operations/SLI-API:vlbcheck/":{"post":{"tags":["SLI-API"],"parameters":[],"responses":{"400":{"description":"Internal error"},"200":{"description":"Correct response","responseSchema":{"originalRef":"#/definitions/sli.api.Vlbcheck","$ref":"#/definitions/sli.api.Vlbcheck"},"schema":{"originalRef":"#/definitions/sli.api.Vlbcheck","$ref":"#/definitions/sli.api.Vlbcheck"}},"201":{"description":"No response"}}}}},"definitions":{"sli.api.ExecuteGraph":{"type":"object","properties":{"output":{"originalRef":"#/definitions/sli.api.ResponseFields","$ref":"#/definitions/sli.api.ResponseFields"}}},"sli.api.Healthcheck":{"type":"object","properties":{"output":{"originalRef":"#/definitions/sli.api.ResponseFields","$ref":"#/definitions/sli.api.ResponseFields"}}},"sli.api.ModeEnumeration":{"type":"string","enum":["sync","async"]},"sli.api.ParameterSetting":{"type":"object","properties":{"string-value":{"type":"string"},"boolean-value":{"type":"boolean"},"parameter-name":{"type":"string","description":"Parameter name"},"int-value":{"type":"integer","format":"int32"}}},"sli.api.ResponseFields":{"type":"object","properties":{"response-code":{"type":"string"},"response-message":{"type":"string"},"context-memory-json":{"type":"string"},"ack-final-indicator":{"type":"string"}}},"sli.api.TestResults":{"type":"object","properties":{"test-result":{"type":"array","items":{"originalRef":"#/definitions/sli.api.testresults.TestResult","$ref":"#/definitions/sli.api.testresults.TestResult"}}}},"sli.api.Vlbcheck":{"type":"object","properties":{"output":{"originalRef":"#/definitions/sli.api.ResponseFields","$ref":"#/definitions/sli.api.ResponseFields"}}},"sli.api.executegraph.Input":{"type":"object","properties":{"mode":{"originalRef":"#/definitions/sli.api.ModeEnumeration","$ref":"#/definitions/sli.api.ModeEnumeration"},"module-name":{"type":"string"},"sli-parameter":{"type":"array","items":{"originalRef":"#/definitions/sli.api.ParameterSetting","$ref":"#/definitions/sli.api.ParameterSetting"}},"rpc-name":{"type":"string"}}},"sli.api.testresults.TestResult":{"type":"object","properties":{"results":{"type":"array","items":{"type":"string"}},"test-identifier":{"type":"string"}}}}} \ No newline at end of file
+{"swagger":"2.0","info":{"description":"Defines API to service logic interpreter,This module contains a collection of generally useful derived\nYANG data types.\n\nCopyright (c) 2013 IETF Trust and the persons identified as\nauthors of the code. All rights reserved.\n\nRedistribution and use in source and binary forms, with or\nwithout modification, is permitted pursuant to, and subject\nto the license terms contained in, the Simplified BSD License\nset forth in Section 4.c of the IETF Trust's Legal Provisions\nRelating to IETF Documents\n(http://trustee.ietf.org/license-info).\n\nThis version of this YANG module is part of RFC 6991; see\nthe RFC itself for full legal notices.,This module contains a collection of generally useful derived\nYANG data types for Internet addresses and related things.\n\nCopyright (c) 2013 IETF Trust and the persons identified as\nauthors of the code. All rights reserved.\n\nRedistribution and use in source and binary forms, with or\nwithout modification, is permitted pursuant to, and subject\nto the license terms contained in, the Simplified BSD License\nset forth in Section 4.c of the IETF Trust's Legal Provisions\nRelating to IETF Documents\n(http://trustee.ietf.org/license-info).\n\nThis version of this YANG module is part of RFC 6991; see\nthe RFC itself for full legal notices.","version":"1.2.0-SNAPSHOT","title":"SLI-API,ietf-yang-types,ietf-inet-types API"},"consumes":["application/json","application/xml"],"produces":["application/json","application/xml"],"paths":{"/config/SLI-API:test-results/":{"get":{"tags":["SLI-API"],"description":"returns sli.api.TestResults","parameters":[],"responses":{"400":{"description":"Internal error"},"200":{"description":"sli.api.TestResults","responseSchema":{"originalRef":"#/definitions/sli.api.TestResults","$ref":"#/definitions/sli.api.TestResults"},"schema":{"originalRef":"#/definitions/sli.api.TestResults","$ref":"#/definitions/sli.api.TestResults"}}}},"post":{"tags":["SLI-API"],"description":"creates sli.api.TestResults","parameters":[{"in":"body","name":"sli.api.TestResults.body-param","description":"sli.api.TestResults to be added to list","required":false,"schema":{"originalRef":"#/definitions/sli.api.TestResults","$ref":"#/definitions/sli.api.TestResults"}}],"responses":{"400":{"description":"Internal error"},"201":{"description":"Object created"},"409":{"description":"Object already exists"}}},"put":{"tags":["SLI-API"],"description":"creates or updates sli.api.TestResults","parameters":[{"in":"body","name":"sli.api.TestResults.body-param","description":"sli.api.TestResults to be added or updated","required":false,"schema":{"originalRef":"#/definitions/sli.api.TestResults","$ref":"#/definitions/sli.api.TestResults"}}],"responses":{"400":{"description":"Internal error"},"201":{"description":"Object created"},"204":{"description":"Object modified"}}},"delete":{"tags":["SLI-API"],"description":"removes sli.api.TestResults","parameters":[],"responses":{"400":{"description":"Internal error"},"204":{"description":"Object deleted"}}}},"/config/SLI-API:test-results/SLI-API:test-result/":{"post":{"description":"creates sli.api.testresults.TestResult","parameters":[{"in":"body","name":"sli.api.testresults.TestResult.body-param","description":"sli.api.testresults.TestResult to be added to list","required":false,"schema":{"originalRef":"#/definitions/sli.api.testresults.TestResult","$ref":"#/definitions/sli.api.testresults.TestResult"}}],"responses":{"400":{"description":"Internal error"},"201":{"description":"Object created"},"409":{"description":"Object already exists"}}}},"/config/SLI-API:test-results/SLI-API:test-result/{test-identifier}/":{"get":{"tags":["SLI-API"],"description":"returns sli.api.testresults.TestResult","parameters":[{"name":"test-identifier","in":"path","description":"Id of test-result","required":true,"type":"string"}],"responses":{"400":{"description":"Internal error"},"200":{"description":"sli.api.testresults.TestResult","responseSchema":{"originalRef":"#/definitions/sli.api.testresults.TestResult","$ref":"#/definitions/sli.api.testresults.TestResult"},"schema":{"originalRef":"#/definitions/sli.api.testresults.TestResult","$ref":"#/definitions/sli.api.testresults.TestResult"}}}},"post":{"tags":["SLI-API"],"description":"creates sli.api.testresults.TestResult","parameters":[{"name":"test-identifier","in":"path","description":"Id of test-result","required":true,"type":"string"},{"in":"body","name":"sli.api.testresults.TestResult.body-param","description":"sli.api.testresults.TestResult to be added to list","required":false,"schema":{"originalRef":"#/definitions/sli.api.testresults.TestResult","$ref":"#/definitions/sli.api.testresults.TestResult"}}],"responses":{"400":{"description":"Internal error"},"201":{"description":"Object created"},"409":{"description":"Object already exists"}}},"put":{"tags":["SLI-API"],"description":"creates or updates sli.api.testresults.TestResult","parameters":[{"name":"test-identifier","in":"path","description":"Id of test-result","required":true,"type":"string"},{"in":"body","name":"sli.api.testresults.TestResult.body-param","description":"sli.api.testresults.TestResult to be added or updated","required":false,"schema":{"originalRef":"#/definitions/sli.api.testresults.TestResult","$ref":"#/definitions/sli.api.testresults.TestResult"}}],"responses":{"400":{"description":"Internal error"},"201":{"description":"Object created"},"204":{"description":"Object modified"}}},"delete":{"tags":["SLI-API"],"description":"removes sli.api.testresults.TestResult","parameters":[{"name":"test-identifier","in":"path","description":"Id of test-result","required":true,"type":"string"}],"responses":{"400":{"description":"Internal error"},"204":{"description":"Object deleted"}}}},"/operational/SLI-API:test-results/":{"get":{"tags":["SLI-API"],"description":"returns sli.api.TestResults","parameters":[],"responses":{"400":{"description":"Internal error"},"200":{"description":"sli.api.TestResults","responseSchema":{"originalRef":"#/definitions/sli.api.TestResults","$ref":"#/definitions/sli.api.TestResults"},"schema":{"originalRef":"#/definitions/sli.api.TestResults","$ref":"#/definitions/sli.api.TestResults"}}}}},"/operational/SLI-API:test-results/SLI-API:test-result/{test-identifier}/":{"get":{"tags":["SLI-API"],"description":"returns sli.api.testresults.TestResult","parameters":[{"name":"test-identifier","in":"path","description":"Id of test-result","required":true,"type":"string"}],"responses":{"400":{"description":"Internal error"},"200":{"description":"sli.api.testresults.TestResult","responseSchema":{"originalRef":"#/definitions/sli.api.testresults.TestResult","$ref":"#/definitions/sli.api.testresults.TestResult"},"schema":{"originalRef":"#/definitions/sli.api.testresults.TestResult","$ref":"#/definitions/sli.api.testresults.TestResult"}}}}},"/operations/SLI-API:execute-graph/":{"post":{"tags":["SLI-API"],"parameters":[{"in":"body","name":"sli.api.executegraph.Input.body-param","required":false,"schema":{"properties":{"input":{"originalRef":"#/definitions/sli.api.executegraph.Input","$ref":"#/definitions/sli.api.executegraph.Input"}}}}],"responses":{"400":{"description":"Internal error"},"200":{"description":"Correct response","responseSchema":{"originalRef":"#/definitions/sli.api.ExecuteGraph","$ref":"#/definitions/sli.api.ExecuteGraph"},"schema":{"originalRef":"#/definitions/sli.api.ExecuteGraph","$ref":"#/definitions/sli.api.ExecuteGraph"}},"201":{"description":"No response"}}}},"/operations/SLI-API:healthcheck/":{"post":{"tags":["SLI-API"],"parameters":[],"responses":{"400":{"description":"Internal error"},"200":{"description":"Correct response","responseSchema":{"originalRef":"#/definitions/sli.api.Healthcheck","$ref":"#/definitions/sli.api.Healthcheck"},"schema":{"originalRef":"#/definitions/sli.api.Healthcheck","$ref":"#/definitions/sli.api.Healthcheck"}},"201":{"description":"No response"}}}},"/operations/SLI-API:vlbcheck/":{"post":{"tags":["SLI-API"],"parameters":[],"responses":{"400":{"description":"Internal error"},"200":{"description":"Correct response","responseSchema":{"originalRef":"#/definitions/sli.api.Vlbcheck","$ref":"#/definitions/sli.api.Vlbcheck"},"schema":{"originalRef":"#/definitions/sli.api.Vlbcheck","$ref":"#/definitions/sli.api.Vlbcheck"}},"201":{"description":"No response"}}}}},"definitions":{"sli.api.ExecuteGraph":{"type":"object","properties":{"output":{"originalRef":"#/definitions/sli.api.ResponseFields","$ref":"#/definitions/sli.api.ResponseFields"}}},"sli.api.Healthcheck":{"type":"object","properties":{"output":{"originalRef":"#/definitions/sli.api.ResponseFields","$ref":"#/definitions/sli.api.ResponseFields"}}},"sli.api.ModeEnumeration":{"type":"string","enum":["sync","async"]},"sli.api.ParameterSetting":{"type":"object","properties":{"string-value":{"type":"string"},"boolean-value":{"type":"boolean"},"parameter-name":{"type":"string","description":"Parameter name"},"int-value":{"type":"integer","format":"int32"}}},"sli.api.ResponseFields":{"type":"object","properties":{"response-code":{"type":"string"},"response-message":{"type":"string"},"context-memory-json":{"type":"string"},"ack-final-indicator":{"type":"string"}}},"sli.api.TestResults":{"type":"object","properties":{"test-result":{"type":"array","items":{"originalRef":"#/definitions/sli.api.testresults.TestResult","$ref":"#/definitions/sli.api.testresults.TestResult"}}}},"sli.api.Vlbcheck":{"type":"object","properties":{"output":{"originalRef":"#/definitions/sli.api.ResponseFields","$ref":"#/definitions/sli.api.ResponseFields"}}},"sli.api.executegraph.Input":{"type":"object","properties":{"mode":{"originalRef":"#/definitions/sli.api.ModeEnumeration","$ref":"#/definitions/sli.api.ModeEnumeration"},"module-name":{"type":"string"},"sli-parameter":{"type":"array","items":{"originalRef":"#/definitions/sli.api.ParameterSetting","$ref":"#/definitions/sli.api.ParameterSetting"}},"rpc-name":{"type":"string"}}},"sli.api.testresults.TestResult":{"type":"object","properties":{"results":{"type":"array","items":{"type":"string"}},"test-identifier":{"type":"string"}}}}} \ No newline at end of file
diff --git a/core/sliapi/model/swagger/src/main/yaml/sliapi.yaml b/core/sliapi/model/swagger/src/main/yaml/sliapi.yaml
index b97b1325a..15da98dfd 100644
--- a/core/sliapi/model/swagger/src/main/yaml/sliapi.yaml
+++ b/core/sliapi/model/swagger/src/main/yaml/sliapi.yaml
@@ -1,25 +1,25 @@
---
swagger: "2.0"
info:
- description: "This module contains a collection of generally useful derived\nYANG\
- \ data types for Internet addresses and related things.\n\nCopyright (c) 2013\
- \ IETF Trust and the persons identified as\nauthors of the code. All rights reserved.\n\
- \nRedistribution and use in source and binary forms, with or\nwithout modification,\
+ description: "Defines API to service logic interpreter,This module contains a collection\
+ \ of generally useful derived\nYANG data types.\n\nCopyright (c) 2013 IETF Trust\
+ \ and the persons identified as\nauthors of the code. All rights reserved.\n\n\
+ Redistribution and use in source and binary forms, with or\nwithout modification,\
\ is permitted pursuant to, and subject\nto the license terms contained in, the\
\ Simplified BSD License\nset forth in Section 4.c of the IETF Trust's Legal Provisions\n\
Relating to IETF Documents\n(http://trustee.ietf.org/license-info).\n\nThis version\
\ of this YANG module is part of RFC 6991; see\nthe RFC itself for full legal\
- \ notices.,Defines API to service logic interpreter,This module contains a collection\
- \ of generally useful derived\nYANG data types.\n\nCopyright (c) 2013 IETF Trust\
- \ and the persons identified as\nauthors of the code. All rights reserved.\n\n\
- Redistribution and use in source and binary forms, with or\nwithout modification,\
+ \ notices.,This module contains a collection of generally useful derived\nYANG\
+ \ data types for Internet addresses and related things.\n\nCopyright (c) 2013\
+ \ IETF Trust and the persons identified as\nauthors of the code. All rights reserved.\n\
+ \nRedistribution and use in source and binary forms, with or\nwithout modification,\
\ is permitted pursuant to, and subject\nto the license terms contained in, the\
\ Simplified BSD License\nset forth in Section 4.c of the IETF Trust's Legal Provisions\n\
Relating to IETF Documents\n(http://trustee.ietf.org/license-info).\n\nThis version\
\ of this YANG module is part of RFC 6991; see\nthe RFC itself for full legal\
\ notices."
version: "1.2.0-SNAPSHOT"
- title: "ietf-inet-types,SLI-API,ietf-yang-types API"
+ title: "SLI-API,ietf-yang-types,ietf-inet-types API"
consumes:
- "application/json"
- "application/xml"
diff --git a/core/sliapi/provider/pom.xml b/core/sliapi/provider/pom.xml
index 5bccec9b6..b9d1c9a67 100755
--- a/core/sliapi/provider/pom.xml
+++ b/core/sliapi/provider/pom.xml
@@ -17,54 +17,58 @@
<name>ccsdk-sli-core :: sliapi :: ${project.artifactId}</name>
<dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>dblib-provider</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>dblib-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
<dependencies>
<dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sliapi-model-yang</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>mdsal-binding-api</artifactId>
- <scope>provided</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-broker-impl</artifactId>
+ </dependency>
+
<dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>mdsal-binding-dom-adapter</artifactId>
- <scope>provided</scope>
</dependency>
+
<dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>yang-binding</artifactId>
- <scope>provided</scope>
</dependency>
+
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-common-util</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.yangtools</groupId>
- <artifactId>yang-data-impl</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
<dependency>
<groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>sliapi-model-yang</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>sli-common</artifactId>
<version>${project.version}</version>
</dependency>
@@ -78,17 +82,27 @@
<artifactId>sli-provider-base</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-core-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-data-impl</artifactId>
+ </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
+
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
+
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
diff --git a/core/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/SliapiProvider.java b/core/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/SliapiProvider.java
index a00131efb..449fc3822 100644
--- a/core/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/SliapiProvider.java
+++ b/core/sliapi/provider/src/main/java/org/onap/ccsdk/sli/core/sliapi/SliapiProvider.java
@@ -21,8 +21,6 @@
package org.onap.ccsdk.sli.core.sliapi;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
@@ -30,14 +28,19 @@ import java.io.IOException;
import java.util.Enumeration;
import java.util.LinkedList;
import java.util.Properties;
-import java.util.concurrent.ExecutionException;
+
import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService;
-import org.opendaylight.mdsal.binding.api.NotificationPublishService;
-import org.opendaylight.mdsal.binding.api.RpcProviderService;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
-import org.opendaylight.mdsal.common.api.OptimisticLockFailedException;
-import org.opendaylight.mdsal.dom.api.DOMDataBroker;
-import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.controller.md.sal.binding.impl.AbstractForwardedDataBroker;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.OptimisticLockFailedException;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput.Mode;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInputBuilder;
@@ -47,13 +50,14 @@ import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.Hea
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.HealthcheckOutputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.SLIAPIService;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.TestResults;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.VlbcheckInput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.VlbcheckOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.VlbcheckOutputBuilder;
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.test.results.TestResult;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.test.results.TestResultBuilder;
-import org.opendaylight.yangtools.concepts.ObjectRegistration;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
@@ -74,6 +78,9 @@ import org.osgi.framework.ServiceReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+
/**
* Defines a base implementation for your provider. This class extends from a
* helper class which provides storage for the most commonly used components of
@@ -85,17 +92,17 @@ import org.slf4j.LoggerFactory;
* src/main/java in this project (created only once during first compilation):
*
* <pre>
- *
+ *
* &#64;Override
* public java.lang.AutoCloseable createInstance() {
- *
+ *
* final SliapiProvider provider = new SliapiProvider();
* provider.setDataBroker(getDataBrokerDependency());
* provider.setNotificationService(getNotificationServiceDependency());
* provider.setRpcRegistry(getRpcRegistryDependency());
* provider.initialize();
* return new AutoCloseable() {
- *
+ *
* &#64;Override
* public void close() throws Exception {
* // TODO: CLOSE ANY REGISTRATION OBJECTS CREATED USING ABOVE
@@ -105,7 +112,7 @@ import org.slf4j.LoggerFactory;
* }
* };
* }
- *
+ *
* </pre>
*/
public class SliapiProvider implements AutoCloseable, SLIAPIService {
@@ -113,14 +120,14 @@ public class SliapiProvider implements AutoCloseable, SLIAPIService {
private static final Logger LOG = LoggerFactory.getLogger(SliapiProvider.class);
private static final String appName = "slitester";
- //protected DataBroker dataBroker;
+ protected DataBroker dataBroker;
protected DOMDataBroker domDataBroker;
protected NotificationPublishService notificationService;
- protected RpcProviderService rpcRegistry;
+ protected RpcProviderRegistry rpcRegistry;
private SvcLogicService svcLogic;
- protected ObjectRegistration<SLIAPIService> rpcRegistration;
+ protected BindingAwareBroker.RpcRegistration<SLIAPIService> rpcRegistration;
private static String SLIAPI_NAMESPACE = "org:onap:ccsdk:sli:core:sliapi";
private static String SLIAPI_REVISION = "2016-11-10";
@@ -141,26 +148,25 @@ public class SliapiProvider implements AutoCloseable, SLIAPIService {
RESULTS_QNAME = QName.create(TEST_RESULT_QNAME, "results");
}
- public SliapiProvider(DOMDataBroker dataBroker, NotificationPublishService notificationPublishService,
- RpcProviderService rpcProviderRegistry) {
+ public SliapiProvider(DataBroker dataBroker, NotificationPublishService notificationPublishService,
+ RpcProviderRegistry rpcProviderRegistry) {
this(dataBroker, notificationPublishService, rpcProviderRegistry, findSvcLogicService());
}
- public SliapiProvider(DOMDataBroker dataBroker, NotificationPublishService notificationPublishService,
- RpcProviderService rpcProviderRegistry, SvcLogicService svcLogic) {
+ public SliapiProvider(DataBroker dataBroker, NotificationPublishService notificationPublishService,
+ RpcProviderRegistry rpcProviderRegistry, SvcLogicService svcLogic) {
this.LOG.info("Creating provider for " + appName);
- //this.dataBroker = dataBroker;
+ this.dataBroker = dataBroker;
this.notificationService = notificationPublishService;
this.rpcRegistry = rpcProviderRegistry;
this.svcLogic = svcLogic;
- this.domDataBroker = dataBroker;
initialize();
}
public void initialize() {
LOG.info("Initializing provider for " + appName);
// initialization code goes here.
- rpcRegistration = rpcRegistry.registerRpcImplementation(SLIAPIService.class, this);
+ rpcRegistration = rpcRegistry.addRpcImplementation(SLIAPIService.class, this);
sdncStatusFile = System.getenv(SDNC_STATUS_FILE);
LOG.info("SDNC STATUS FILE = " + sdncStatusFile);
@@ -180,9 +186,11 @@ public class SliapiProvider implements AutoCloseable, SLIAPIService {
LOG.info("Successfully closed provider for " + appName);
}
- public void setDataBroker(DOMDataBroker dataBroker) {
- domDataBroker = dataBroker;
-
+ public void setDataBroker(DataBroker dataBroker) {
+ this.dataBroker = dataBroker;
+ if (dataBroker instanceof AbstractForwardedDataBroker) {
+ domDataBroker = ((AbstractForwardedDataBroker) dataBroker).getDelegate();
+ }
if (LOG.isDebugEnabled()) {
LOG.debug("DataBroker set to " + (dataBroker == null ? "null" : NON_NULL) + ".");
}
@@ -195,7 +203,7 @@ public class SliapiProvider implements AutoCloseable, SLIAPIService {
}
}
- public void setRpcRegistry(RpcProviderService rpcRegistry) {
+ public void setRpcRegistry(RpcProviderRegistry rpcRegistry) {
this.rpcRegistry = rpcRegistry;
if (LOG.isDebugEnabled()) {
LOG.debug("RpcRegistry set to " + (rpcRegistry == null ? "null" : NON_NULL) + ".");
@@ -254,7 +262,7 @@ public class SliapiProvider implements AutoCloseable, SLIAPIService {
Properties parms = new Properties();
// Pass properties using names from sli-parameters
- for (SliParameter sliParm : input.getSliParameter().values()) {
+ for (SliParameter sliParm : input.getSliParameter()) {
String propValue = "";
@@ -446,8 +454,7 @@ public class SliapiProvider implements AutoCloseable, SLIAPIService {
return (Futures.immediateFuture(rpcResult));
}
- @Override
- public ListenableFuture<RpcResult<VlbcheckOutput>> vlbcheck(VlbcheckInput vlbInput) {
+ public ListenableFuture<RpcResult<VlbcheckOutput>> vlbcheck(VlbcheckInput vlbInput) {
RpcResult<VlbcheckOutput> rpcResult = null;
SvcLogicService svcLogic = getSvcLogicService();
@@ -571,12 +578,12 @@ public class SliapiProvider implements AutoCloseable, SLIAPIService {
YangInstanceIdentifier testResultsPid = YangInstanceIdentifier.builder().node(TEST_RESULTS_QNAME)
.node(QName.create(TEST_RESULTS_QNAME, "test-result")).build();
YangInstanceIdentifier testResultPid = testResultsPid
- .node(NodeIdentifierWithPredicates.of(TEST_RESULT_QNAME, resultNode.getIdentifier().asMap()));
+ .node(new NodeIdentifierWithPredicates(TEST_RESULT_QNAME, resultNode.getIdentifier().getKeyValues()));
int tries = 2;
while (true) {
try {
- DOMDataTreeWriteTransaction wtx = domDataBroker.newWriteOnlyTransaction();
+ DOMDataWriteTransaction wtx = domDataBroker.newWriteOnlyTransaction();
if (merge) {
LOG.info("Merging test identifier " + entry.getTestIdentifier());
wtx.merge(storeType, testResultPid, resultNode);
@@ -584,10 +591,10 @@ public class SliapiProvider implements AutoCloseable, SLIAPIService {
LOG.info("Putting test identifier " + entry.getTestIdentifier());
wtx.put(storeType, testResultPid, resultNode);
}
- wtx.commit().get();
+ wtx.submit().checkedGet();
LOG.trace("Update DataStore succeeded");
break;
- } catch (final InterruptedException | ExecutionException e) {
+ } catch (final TransactionCommitFailedException e) {
if (e instanceof OptimisticLockFailedException) {
if (--tries <= 0) {
LOG.trace("Got OptimisticLockFailedException on last try - failing ");
@@ -603,40 +610,40 @@ public class SliapiProvider implements AutoCloseable, SLIAPIService {
}
-// private void SaveTestResult(final TestResult entry, boolean merge, LogicalDatastoreType storeType)
-// throws IllegalStateException {
-// // Each entry will be identifiable by a unique key, we have to create that
-// // identifier
-//
-// InstanceIdentifier.InstanceIdentifierBuilder<TestResult> testResultIdBuilder = InstanceIdentifier
-// .<TestResults>builder(TestResults.class).child(TestResult.class, entry.key());
-// InstanceIdentifier<TestResult> path = testResultIdBuilder.build();
-// int tries = 2;
-// while (true) {
-// try {
-// WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
-// if (merge) {
-// tx.merge(storeType, path, entry);
-// } else {
-// tx.put(storeType, path, entry);
-// }
-// tx.submit().checkedGet();
-// LOG.trace("Update DataStore succeeded");
-// break;
-// } catch (final TransactionCommitFailedException e) {
-// if (e instanceof OptimisticLockFailedException) {
-// if (--tries <= 0) {
-// LOG.trace("Got OptimisticLockFailedException on last try - failing ");
-// throw new IllegalStateException(e);
-// }
-// LOG.trace("Got OptimisticLockFailedException - trying again ");
-// } else {
-// LOG.trace("Update DataStore failed");
-// throw new IllegalStateException(e);
-// }
-// }
-// }
-// }
+ private void SaveTestResult(final TestResult entry, boolean merge, LogicalDatastoreType storeType)
+ throws IllegalStateException {
+ // Each entry will be identifiable by a unique key, we have to create that
+ // identifier
+
+ InstanceIdentifier.InstanceIdentifierBuilder<TestResult> testResultIdBuilder = InstanceIdentifier
+ .<TestResults>builder(TestResults.class).child(TestResult.class, entry.key());
+ InstanceIdentifier<TestResult> path = testResultIdBuilder.build();
+ int tries = 2;
+ while (true) {
+ try {
+ WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
+ if (merge) {
+ tx.merge(storeType, path, entry);
+ } else {
+ tx.put(storeType, path, entry);
+ }
+ tx.submit().checkedGet();
+ LOG.trace("Update DataStore succeeded");
+ break;
+ } catch (final TransactionCommitFailedException e) {
+ if (e instanceof OptimisticLockFailedException) {
+ if (--tries <= 0) {
+ LOG.trace("Got OptimisticLockFailedException on last try - failing ");
+ throw new IllegalStateException(e);
+ }
+ LOG.trace("Got OptimisticLockFailedException - trying again ");
+ } else {
+ LOG.trace("Update DataStore failed");
+ throw new IllegalStateException(e);
+ }
+ }
+ }
+ }
private MapEntryNode toMapEntryNode(TestResult testResult) {
@@ -657,8 +664,7 @@ public class SliapiProvider implements AutoCloseable, SLIAPIService {
// Construct test result ContainerNode with 2 children - test-identifier leaf
// and results leaf-set
MapEntryNode testResultNode = ImmutableNodes.mapEntryBuilder()
-
- .withNodeIdentifier(NodeIdentifierWithPredicates.of(TEST_RESULT_QNAME, TEST_ID_QNAME,
+ .withNodeIdentifier(new NodeIdentifierWithPredicates(TEST_RESULT_QNAME, TEST_ID_QNAME,
testResult.getTestIdentifier()))
.withChild(ImmutableNodes.leafNode(TEST_ID_QNAME, testResult.getTestIdentifier()))
.withChild(resultsNode).build();
diff --git a/core/sliapi/provider/src/main/resources/OSGI-INF/blueprint/sliapi-blueprint.xml b/core/sliapi/provider/src/main/resources/OSGI-INF/blueprint/sliapi-blueprint.xml
new file mode 100644
index 000000000..875027e63
--- /dev/null
+++ b/core/sliapi/provider/src/main/resources/OSGI-INF/blueprint/sliapi-blueprint.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <reference id="svcLogicService"
+ interface="org.onap.ccsdk.sli.core.sli.provider.SvcLogicService" />
+
+
+ <reference id="dataBroker"
+ interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+ odl:type="default" />
+
+ <reference id="notificationService"
+ interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService"
+ odl:type="default" />
+
+ <reference id="rpcRegistry"
+ interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
+ odl:type="default" />
+
+ <bean id="provider" class="org.onap.ccsdk.sli.core.sliapi.SliapiProvider">
+ <argument ref="dataBroker" />
+ <argument ref="notificationService" />
+ <argument ref="rpcRegistry" />
+
+ </bean>
+</blueprint> \ No newline at end of file
diff --git a/core/sliapi/provider/src/main/resources/org/opendaylight/blueprint/sliapi-blueprint.xml b/core/sliapi/provider/src/main/resources/org/opendaylight/blueprint/sliapi-blueprint.xml
index 8ec666d53..875027e63 100644
--- a/core/sliapi/provider/src/main/resources/org/opendaylight/blueprint/sliapi-blueprint.xml
+++ b/core/sliapi/provider/src/main/resources/org/opendaylight/blueprint/sliapi-blueprint.xml
@@ -8,13 +8,16 @@
<reference id="dataBroker"
- interface="org.opendaylight.mdsal.dom.api.DOMDataBroker" />
+ interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+ odl:type="default" />
<reference id="notificationService"
- interface="org.opendaylight.mdsal.binding.api.NotificationPublishService" />
+ interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService"
+ odl:type="default" />
<reference id="rpcRegistry"
- interface="org.opendaylight.mdsal.binding.api.RpcProviderService" />
+ interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
+ odl:type="default" />
<bean id="provider" class="org.onap.ccsdk.sli.core.sliapi.SliapiProvider">
<argument ref="dataBroker" />
diff --git a/core/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java b/core/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java
index b731423c5..f48cf783b 100644
--- a/core/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java
+++ b/core/sliapi/provider/src/test/java/org/onap/ccsdk/sli/core/sliapi/TestSliapiProvider.java
@@ -1,30 +1,15 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : CCSDK
- * ================================================================================
- * Copyright (C) 2018 IBM. 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.sliapi;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+
import java.io.InputStream;
import java.net.URL;
import java.util.HashMap;
@@ -62,9 +47,10 @@ import org.onap.ccsdk.sli.core.sli.provider.base.SetNodeExecutor;
import org.onap.ccsdk.sli.core.sli.provider.base.SwitchNodeExecutor;
import org.onap.ccsdk.sli.core.sli.provider.base.UpdateNodeExecutor;
import org.onap.ccsdk.sli.core.sli.provider.base.WhileNodeExecutor;
-import org.opendaylight.mdsal.binding.api.NotificationPublishService;
-import org.opendaylight.mdsal.binding.api.RpcProviderService;
-import org.opendaylight.mdsal.dom.api.DOMDataBroker;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.ExecuteGraphInput;
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.HealthcheckInput;
@@ -72,7 +58,6 @@ import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.SLI
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.core.sliapi.rev161110.VlbcheckInput;
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.yangtools.concepts.ObjectRegistration;
/**
* @author dt5972
@@ -114,12 +99,12 @@ public class TestSliapiProvider {
*/
@Before
public void setUp() throws Exception {
- DOMDataBroker dataBroker = mock(DOMDataBroker.class);
+ DataBroker dataBroker = mock(DataBroker.class);
NotificationPublishService notifyService = mock(NotificationPublishService.class);
- RpcProviderService rpcRegistry = mock(RpcProviderService.class);
- ObjectRegistration<SLIAPIService> rpcRegistration = mock(
- ObjectRegistration.class);
- when(rpcRegistry.registerRpcImplementation(any(Class.class), any(SLIAPIService.class))).thenReturn(rpcRegistration);
+ RpcProviderRegistry rpcRegistry = mock(RpcProviderRegistry.class);
+ BindingAwareBroker.RpcRegistration<SLIAPIService> rpcRegistration = (BindingAwareBroker.RpcRegistration<SLIAPIService>) mock(
+ BindingAwareBroker.RpcRegistration.class);
+ when(rpcRegistry.addRpcImplementation(any(Class.class), any(SLIAPIService.class))).thenReturn(rpcRegistration);
// Load svclogic.properties and get a SvcLogicStore
InputStream propStr = TestSliapiProvider.class.getResourceAsStream("/svclogic.properties");
@@ -187,8 +172,8 @@ public class TestSliapiProvider {
pList.add(pBuilder.build());
inputBuilder.setSliParameter(pList);
provider.executeGraph(inputBuilder.build());
-
-
+
+
// Invalid test - graph does not exist
inputBuilder.setMode(ExecuteGraphInput.Mode.Sync);
inputBuilder.setModuleName("sli");
@@ -208,7 +193,7 @@ public class TestSliapiProvider {
pList.add(pBuilder.build());
inputBuilder.setSliParameter(pList);
provider.executeGraph(inputBuilder.build());
-
+
assertTrue(provider.vlbcheck(mock(VlbcheckInput.class)) instanceof Future<?>);
}
diff --git a/northbound/asdcApi/provider/pom.xml b/northbound/asdcApi/provider/pom.xml
index a7ced7ad2..19e5660f7 100755
--- a/northbound/asdcApi/provider/pom.xml
+++ b/northbound/asdcApi/provider/pom.xml
@@ -35,8 +35,8 @@
</dependency>
<dependency>
- <groupId>org.opendaylight.mdsal</groupId>
- <artifactId>mdsal-binding-api</artifactId>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-api</artifactId>
</dependency>
<dependency>
@@ -54,18 +54,24 @@
</dependency>
<dependency>
- <groupId>org.opendaylight.mdsal</groupId>
- <artifactId>mdsal-binding-test-model</artifactId>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-test-model</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.opendaylight.mdsal</groupId>
- <artifactId>mdsal-binding-dom-adapter</artifactId>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-broker-impl</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-broker-impl</artifactId>
+ <type>test-jar</type>
+ <classifier>tests</classifier>
<scope>test</scope>
</dependency>
-
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
diff --git a/northbound/asdcApi/provider/src/main/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiProvider.java b/northbound/asdcApi/provider/src/main/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiProvider.java
index d8cf963b5..1a79f8c41 100644
--- a/northbound/asdcApi/provider/src/main/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiProvider.java
+++ b/northbound/asdcApi/provider/src/main/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiProvider.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,22 +21,19 @@
package org.onap.ccsdk.sli.northbound.asdcapi;
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.FluentFuture;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
import java.util.Properties;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.NotificationPublishService;
-import org.opendaylight.mdsal.binding.api.ReadTransaction;
-import org.opendaylight.mdsal.binding.api.RpcProviderService;
-import org.opendaylight.mdsal.binding.api.WriteTransaction;
-import org.opendaylight.mdsal.common.api.CommitInfo;
-import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.yang.gen.v1.http.xmlns.onap.org.asdc.license.model._1._0.rev160427.vf.license.model.grouping.VfLicenseModel;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.ASDCAPIService;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.Artifacts;
@@ -52,13 +49,17 @@ import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.artifacts.ArtifactB
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.artifacts.ArtifactKey;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.vf.license.model.versions.VfLicenseModelVersion;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.vf.license.model.versions.VfLicenseModelVersionBuilder;
-import org.opendaylight.yangtools.concepts.ObjectRegistration;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+
/**
* Defines a base implementation for your provider. This class extends from a helper class
* which provides storage for the most commonly used components of the MD-SAL. Additionally the
@@ -103,14 +104,14 @@ public class AsdcApiProvider implements AutoCloseable, ASDCAPIService {
private final ExecutorService executor;
protected DataBroker dataBroker;
protected NotificationPublishService notificationService;
- protected RpcProviderService rpcRegistry;
+ protected RpcProviderRegistry rpcRegistry;
private final AsdcApiSliClient asdcApiSliClient;
- protected ObjectRegistration<ASDCAPIService> rpcRegistration;
+ protected BindingAwareBroker.RpcRegistration<ASDCAPIService> rpcRegistration;
public AsdcApiProvider(final DataBroker dataBroker,
final NotificationPublishService notificationPublishService,
- final RpcProviderService rpcProviderRegistry,
+ final RpcProviderRegistry rpcProviderRegistry,
final AsdcApiSliClient asdcApiSliClient) {
LOG.info("Creating provider for {}", APPLICATION_NAME);
@@ -129,7 +130,7 @@ public class AsdcApiProvider implements AutoCloseable, ASDCAPIService {
if (rpcRegistration == null) {
if (rpcRegistry != null) {
- rpcRegistration = rpcRegistry.registerRpcImplementation(
+ rpcRegistration = rpcRegistry.addRpcImplementation(
ASDCAPIService.class, this);
LOG.info("Initialization complete for {}", APPLICATION_NAME);
} else {
@@ -151,7 +152,7 @@ public class AsdcApiProvider implements AutoCloseable, ASDCAPIService {
try {
- FluentFuture<? extends @NonNull CommitInfo> checkedFuture = t.commit();
+ CheckedFuture<Void, TransactionCommitFailedException> checkedFuture = t.submit();
checkedFuture.get();
LOG.info("Create Containers succeeded!: ");
@@ -179,7 +180,7 @@ public class AsdcApiProvider implements AutoCloseable, ASDCAPIService {
InstanceIdentifier.<Artifacts>builder(Artifacts.class)
.child(Artifact.class, new ArtifactKey(aName, aVersion)).build();
Optional<Artifact> data = null;
- try(ReadTransaction readTx = dataBroker.newReadOnlyTransaction()) {
+ try(ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction()) {
data = (Optional<Artifact>) readTx.read(LogicalDatastoreType.CONFIGURATION, artifactInstanceId).get();
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught Exception reading MD-SAL for ["+aName+","+ aVersion+"] " ,e);
@@ -210,7 +211,7 @@ public class AsdcApiProvider implements AutoCloseable, ASDCAPIService {
tx.merge(LogicalDatastoreType.CONFIGURATION, path,
artifact);
- tx.commit().get();
+ tx.submit().checkedGet();
} catch (Exception e) {
LOG.error("Caught exception trying to add artifact entry", e);
}
@@ -244,7 +245,7 @@ public class AsdcApiProvider implements AutoCloseable, ASDCAPIService {
WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
tx.merge(LogicalDatastoreType.CONFIGURATION, path,
version);
- tx.commit().get();
+ tx.submit().checkedGet();
} catch (Exception e) {
LOG.error(
"Caught exception trying to save entry to MD-SAL",
@@ -271,7 +272,7 @@ public class AsdcApiProvider implements AutoCloseable, ASDCAPIService {
tx.merge(LogicalDatastoreType.CONFIGURATION, path,
version);
- tx.commit().get();
+ tx.submit().checkedGet();
} catch (Exception e) {
LOG.error(
"Caught exception trying to save entry to MD-SAL",
diff --git a/northbound/asdcApi/provider/src/main/resources/OSGI-INF/blueprint/asdc-blueprint.xml b/northbound/asdcApi/provider/src/main/resources/OSGI-INF/blueprint/asdc-blueprint.xml
new file mode 100644
index 000000000..9ad08d3db
--- /dev/null
+++ b/northbound/asdcApi/provider/src/main/resources/OSGI-INF/blueprint/asdc-blueprint.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <reference id="svcLogicService"
+ interface="org.onap.ccsdk.sli.core.sli.provider.SvcLogicService" />
+
+ <bean id="client" class="org.onap.ccsdk.sli.northbound.asdcapi.AsdcApiSliClient">
+ <argument ref="svcLogicService" />
+ </bean>
+
+ <reference id="dataBroker"
+ interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+ odl:type="default" />
+
+ <reference id="notificationService"
+ interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService"
+ odl:type="default" />
+
+ <reference id="rpcRegistry"
+ interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
+ odl:type="default" />
+
+ <bean id="provider" class="org.onap.ccsdk.sli.northbound.asdcapi.AsdcApiProvider">
+ <argument ref="dataBroker" />
+ <argument ref="notificationService" />
+ <argument ref="rpcRegistry" />
+ <argument ref="client" />
+ </bean>
+
+</blueprint> \ No newline at end of file
diff --git a/northbound/asdcApi/provider/src/main/resources/org/opendaylight/blueprint/asdc-blueprint.xml b/northbound/asdcApi/provider/src/main/resources/org/opendaylight/blueprint/asdc-blueprint.xml
index 68925b115..9ad08d3db 100644
--- a/northbound/asdcApi/provider/src/main/resources/org/opendaylight/blueprint/asdc-blueprint.xml
+++ b/northbound/asdcApi/provider/src/main/resources/org/opendaylight/blueprint/asdc-blueprint.xml
@@ -11,13 +11,16 @@
</bean>
<reference id="dataBroker"
- interface="org.opendaylight.mdsal.binding.api.DataBroker" />
+ interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+ odl:type="default" />
<reference id="notificationService"
- interface="org.opendaylight.mdsal.binding.api.NotificationPublishService" />
+ interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService"
+ odl:type="default" />
<reference id="rpcRegistry"
- interface="org.opendaylight.mdsal.binding.api.RpcProviderService" />
+ interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
+ odl:type="default" />
<bean id="provider" class="org.onap.ccsdk.sli.northbound.asdcapi.AsdcApiProvider">
<argument ref="dataBroker" />
diff --git a/northbound/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/TestAsdcApiApi.java b/northbound/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/TestAsdcApiApi.java
index 15ed92776..1f266365c 100644
--- a/northbound/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/TestAsdcApiApi.java
+++ b/northbound/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/TestAsdcApiApi.java
@@ -21,95 +21,116 @@
package org.onap.ccsdk.sli.northbound.asdcapi;
-public class TestAsdcApiApi {//extends AbstractConcurrentDataBrokerTest {
-
-// private AsdcApiProvider asdcApiProvider;
-// private static final Logger LOG = LoggerFactory.getLogger(AsdcApiProvider.class);
-//
-// @Before
-// public void setUp() throws Exception {
-// if (null == asdcApiProvider) {
-// DataBroker dataBroker = getDataBroker();
-// NotificationPublishService mockNotification = mock(NotificationPublishService.class);
-// RpcProviderService mockRpcRegistry = mock(RpcProviderService.class);
-// AsdcApiSliClient mockSliClient = mock(AsdcApiSliClient.class);
-// Properties respProps = new Properties();
-// respProps.setProperty("error-code", "200");
-// respProps.setProperty("error-message", "Success");
-//
-// when(mockSliClient.hasGraph("ASDC-API", "vf-license-model-update" , null, "sync")).thenReturn(true);
-// when(mockSliClient.execute("ASDC-API", "vf-license-model-update", null, "sync", respProps)).thenReturn(respProps);
-//
-// asdcApiProvider = new AsdcApiProvider(dataBroker, mockNotification, mockRpcRegistry, mockSliClient);
-// }
-// }
-//
-// //Testcase should return error 503 when No service logic active for ASDC-API.
-// @Test
-// public void testVfLicenseModelUpdate() {
-//
-// VfLicenseModelUpdateInputBuilder inputBuilder = new VfLicenseModelUpdateInputBuilder();
-//
-// inputBuilder.setArtifactName("abc");
-// inputBuilder.setArtifactVersion("1");
-//
-// // TODO: currently initialize SvcLogicServiceClient is failing, need to fix
-// java.util.concurrent.Future<RpcResult<VfLicenseModelUpdateOutput>> future = asdcApiProvider
-// .vfLicenseModelUpdate(inputBuilder.build());
-// RpcResult<VfLicenseModelUpdateOutput> rpcResult = null;
-// try {
-// rpcResult = future.get();
-// } catch (Exception e) {
-// fail("Error : " + e);
-// }
-// LOG.info("result: {}", rpcResult);
-// assertEquals("200", rpcResult.getResult().getAsdcApiResponseCode());
-// }
-//
-// //Input parameter validation
-// @Test
-// public void testVfLicenseModelUpdateInputValidation() {
-//
-// VfLicenseModelUpdateInputBuilder inputBuilder = new VfLicenseModelUpdateInputBuilder();
-//
-// inputBuilder.setArtifactName("abc");
-// inputBuilder.setArtifactVersion("1");
-//
-// java.util.concurrent.Future<RpcResult<VfLicenseModelUpdateOutput>> future = asdcApiProvider
-// .vfLicenseModelUpdate(null);
-// assertNull(future);
-// }
-//
-// @Test
-// public void testVfLicenseModelUpdateValidation1() {
-//
-// VfLicenseModelUpdateInputBuilder inputBuilder = new VfLicenseModelUpdateInputBuilder();
-//
-// inputBuilder.setArtifactName("license1");
-// inputBuilder.setArtifactVersion("version1");
-//
-// VfLicenseModelBuilder vfLicenseModelBuilder = new VfLicenseModelBuilder();
-// vfLicenseModelBuilder.setVfId("123");
-// vfLicenseModelBuilder.setVendorName("acme");
-// inputBuilder.setVfLicenseModel(vfLicenseModelBuilder.build());
-//
-//
-// java.util.concurrent.Future<RpcResult<VfLicenseModelUpdateOutput>> future = asdcApiProvider
-// .vfLicenseModelUpdate(inputBuilder.build());
-// RpcResult<VfLicenseModelUpdateOutput> rpcResult = null;
-// try {
-// rpcResult = future.get();
-// } catch (Exception e) {
-// fail("Error : " + e);
-// }
-// }
-//
-//
-//
-//
-// @Test
-// public void testAddArtifactVersion() {
-// asdcApiProvider.addArtifactVersion("artifact1",
-// "version1");
-// }
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.yang.gen.v1.http.xmlns.onap.org.asdc.license.model._1._0.rev160427.vf.license.model.grouping.VfLicenseModelBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.VfLicenseModelUpdateInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.VfLicenseModelUpdateOutput;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Properties;
+
+public class TestAsdcApiApi extends AbstractConcurrentDataBrokerTest {
+
+ private AsdcApiProvider asdcApiProvider;
+ private static final Logger LOG = LoggerFactory.getLogger(AsdcApiProvider.class);
+
+ @Before
+ public void setUp() throws Exception {
+ if (null == asdcApiProvider) {
+ DataBroker dataBroker = getDataBroker();
+ NotificationPublishService mockNotification = mock(NotificationPublishService.class);
+ RpcProviderRegistry mockRpcRegistry = mock(RpcProviderRegistry.class);
+ AsdcApiSliClient mockSliClient = mock(AsdcApiSliClient.class);
+ Properties respProps = new Properties();
+ respProps.setProperty("error-code", "200");
+ respProps.setProperty("error-message", "Success");
+
+ when(mockSliClient.hasGraph("ASDC-API", "vf-license-model-update" , null, "sync")).thenReturn(true);
+ when(mockSliClient.execute("ASDC-API", "vf-license-model-update", null, "sync", respProps)).thenReturn(respProps);
+
+ asdcApiProvider = new AsdcApiProvider(dataBroker, mockNotification, mockRpcRegistry, mockSliClient);
+ }
+ }
+
+ //Testcase should return error 503 when No service logic active for ASDC-API.
+ @Test
+ public void testVfLicenseModelUpdate() {
+
+ VfLicenseModelUpdateInputBuilder inputBuilder = new VfLicenseModelUpdateInputBuilder();
+
+ inputBuilder.setArtifactName("abc");
+ inputBuilder.setArtifactVersion("1");
+
+ // TODO: currently initialize SvcLogicServiceClient is failing, need to fix
+ java.util.concurrent.Future<RpcResult<VfLicenseModelUpdateOutput>> future = asdcApiProvider
+ .vfLicenseModelUpdate(inputBuilder.build());
+ RpcResult<VfLicenseModelUpdateOutput> rpcResult = null;
+ try {
+ rpcResult = future.get();
+ } catch (Exception e) {
+ fail("Error : " + e);
+ }
+ LOG.info("result: {}", rpcResult);
+ assertEquals("200", rpcResult.getResult().getAsdcApiResponseCode());
+ }
+
+ //Input parameter validation
+ @Test
+ public void testVfLicenseModelUpdateInputValidation() {
+
+ VfLicenseModelUpdateInputBuilder inputBuilder = new VfLicenseModelUpdateInputBuilder();
+
+ inputBuilder.setArtifactName("abc");
+ inputBuilder.setArtifactVersion("1");
+
+ java.util.concurrent.Future<RpcResult<VfLicenseModelUpdateOutput>> future = asdcApiProvider
+ .vfLicenseModelUpdate(null);
+ assertNull(future);
+ }
+
+ @Test
+ public void testVfLicenseModelUpdateValidation1() {
+
+ VfLicenseModelUpdateInputBuilder inputBuilder = new VfLicenseModelUpdateInputBuilder();
+
+ inputBuilder.setArtifactName("license1");
+ inputBuilder.setArtifactVersion("version1");
+
+ VfLicenseModelBuilder vfLicenseModelBuilder = new VfLicenseModelBuilder();
+ vfLicenseModelBuilder.setVfId("123");
+ vfLicenseModelBuilder.setVendorName("acme");
+ inputBuilder.setVfLicenseModel(vfLicenseModelBuilder.build());
+
+
+ java.util.concurrent.Future<RpcResult<VfLicenseModelUpdateOutput>> future = asdcApiProvider
+ .vfLicenseModelUpdate(inputBuilder.build());
+ RpcResult<VfLicenseModelUpdateOutput> rpcResult = null;
+ try {
+ rpcResult = future.get();
+ } catch (Exception e) {
+ fail("Error : " + e);
+ }
+ }
+
+
+
+
+ @Test
+ public void testAddArtifactVersion() {
+ asdcApiProvider.addArtifactVersion("artifact1",
+ "version1");
+ }
}
diff --git a/northbound/daexim-offsite-backup/provider/pom.xml b/northbound/daexim-offsite-backup/provider/pom.xml
index 9db8934f6..c7b7d1c86 100755
--- a/northbound/daexim-offsite-backup/provider/pom.xml
+++ b/northbound/daexim-offsite-backup/provider/pom.xml
@@ -23,30 +23,30 @@
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.opendaylight.mdsal</groupId>
- <artifactId>mdsal-binding-api</artifactId>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-api</artifactId>
</dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-common-util</artifactId>
</dependency>
<dependency>
- <groupId>org.opendaylight.mdsal</groupId>
- <artifactId>mdsal-binding-test-model</artifactId>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-test-model</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-broker-impl</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-broker-impl</artifactId>
+ <type>test-jar</type>
+ <classifier>tests</classifier>
<scope>test</scope>
</dependency>
-<!-- <dependency> -->
-<!-- <groupId>org.opendaylight.controller</groupId> -->
-<!-- <artifactId>sal-binding-broker-impl</artifactId> -->
-<!-- <scope>test</scope> -->
-<!-- </dependency> -->
-<!-- <dependency> -->
-<!-- <groupId>org.opendaylight.controller</groupId> -->
-<!-- <artifactId>sal-binding-broker-impl</artifactId> -->
-<!-- <type>test-jar</type> -->
-<!-- <classifier>tests</classifier> -->
-<!-- <scope>test</scope> -->
-<!-- </dependency> -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
diff --git a/northbound/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProvider.java b/northbound/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProvider.java
index 7ee2a91d7..09c8f92f4 100755
--- a/northbound/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProvider.java
+++ b/northbound/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProvider.java
@@ -21,9 +21,6 @@
package org.onap.ccsdk.sli.northbound.daeximoffsitebackup;
-import com.google.common.util.concurrent.FluentFuture;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -47,22 +44,27 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
import javax.annotation.Nonnull;
-import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.DataTreeChangeListener;
-import org.opendaylight.mdsal.binding.api.RpcProviderService;
-import org.opendaylight.mdsal.binding.api.WriteTransaction;
-import org.opendaylight.mdsal.common.api.CommitInfo;
+
+import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
+import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.BackupDataInput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.BackupDataOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.BackupDataOutputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.DaeximOffsiteBackupService;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.RetrieveDataInput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.RetrieveDataOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.RetrieveDataOutputBuilder;
-import org.opendaylight.yangtools.concepts.ObjectRegistration;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.RetrieveDataInput;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -84,11 +86,11 @@ public class DaeximOffsiteBackupProvider implements AutoCloseable, DaeximOffsite
private final ExecutorService executor;
private Properties properties;
private DataBroker dataBroker;
- private RpcProviderService rpcRegistry;
- private ObjectRegistration<DaeximOffsiteBackupService> rpcRegistration;
+ private RpcProviderRegistry rpcRegistry;
+ private BindingAwareBroker.RpcRegistration<DaeximOffsiteBackupService> rpcRegistration;
public DaeximOffsiteBackupProvider(DataBroker dataBroker,
- RpcProviderService rpcProviderRegistry) {
+ RpcProviderRegistry rpcProviderRegistry) {
LOG.info("Creating provider for " + appName);
this.executor = Executors.newFixedThreadPool(1);
this.dataBroker = dataBroker;
@@ -105,7 +107,7 @@ public class DaeximOffsiteBackupProvider implements AutoCloseable, DaeximOffsite
} catch (Exception e) {
LOG.error("Caught Exception while trying to load properties file", e);
}
- rpcRegistration = rpcRegistry.registerRpcImplementation(DaeximOffsiteBackupService.class, this);
+ rpcRegistration = rpcRegistry.addRpcImplementation(DaeximOffsiteBackupService.class, this);
LOG.info("Initialization complete for " + appName);
}
@@ -171,7 +173,7 @@ public class DaeximOffsiteBackupProvider implements AutoCloseable, DaeximOffsite
private void createContainers() {
final WriteTransaction t = dataBroker.newReadWriteTransaction();
try {
- FluentFuture<? extends @NonNull CommitInfo> checkedFuture = t.commit();
+ CheckedFuture<Void, TransactionCommitFailedException> checkedFuture = t.submit();
checkedFuture.get();
LOG.info("Create Containers succeeded!: ");
} catch (InterruptedException | ExecutionException e) {
diff --git a/northbound/daexim-offsite-backup/provider/src/main/resources/OSGI-INF/blueprint/DaeximOffsiteBackup.xml b/northbound/daexim-offsite-backup/provider/src/main/resources/OSGI-INF/blueprint/DaeximOffsiteBackup.xml
new file mode 100755
index 000000000..8e2101ad3
--- /dev/null
+++ b/northbound/daexim-offsite-backup/provider/src/main/resources/OSGI-INF/blueprint/DaeximOffsiteBackup.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <reference id="dataBroker"
+ interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+ odl:type="default" />
+
+ <reference id="rpcRegistry"
+ interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
+ odl:type="default" />
+
+ <bean id="provider" class="org.onap.ccsdk.sli.northbound.daeximoffsitebackup.DaeximOffsiteBackupProvider">
+ <argument ref="dataBroker" />
+ <argument ref="rpcRegistry" />
+ </bean>
+
+ <odl:rpc-implementation ref="provider"/>
+</blueprint>
diff --git a/northbound/daexim-offsite-backup/provider/src/main/resources/org/opendaylight/blueprint/DaeximOffsiteBackup.xml b/northbound/daexim-offsite-backup/provider/src/main/resources/org/opendaylight/blueprint/DaeximOffsiteBackup.xml
index 6118f28c3..8e2101ad3 100755
--- a/northbound/daexim-offsite-backup/provider/src/main/resources/org/opendaylight/blueprint/DaeximOffsiteBackup.xml
+++ b/northbound/daexim-offsite-backup/provider/src/main/resources/org/opendaylight/blueprint/DaeximOffsiteBackup.xml
@@ -4,10 +4,12 @@
odl:use-default-for-reference-types="true">
<reference id="dataBroker"
- interface="org.opendaylight.controller.md.sal.binding.api.DataBroker" />
+ interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+ odl:type="default" />
<reference id="rpcRegistry"
- interface="org.opendaylight.mdsal.binding.api.RpcProviderService" />
+ interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
+ odl:type="default" />
<bean id="provider" class="org.onap.ccsdk.sli.northbound.daeximoffsitebackup.DaeximOffsiteBackupProvider">
<argument ref="dataBroker" />
diff --git a/northbound/daexim-offsite-backup/provider/src/test/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProviderTest.java b/northbound/daexim-offsite-backup/provider/src/test/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProviderTest.java
index 03fe37513..0f0cee288 100644
--- a/northbound/daexim-offsite-backup/provider/src/test/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProviderTest.java
+++ b/northbound/daexim-offsite-backup/provider/src/test/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProviderTest.java
@@ -26,7 +26,7 @@ import static org.junit.Assert.fail;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import com.google.common.util.concurrent.FluentFuture;
+import com.google.common.util.concurrent.CheckedFuture;
import java.io.File;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
@@ -38,9 +38,10 @@ import java.util.concurrent.ExecutionException;
import org.eclipse.jdt.annotation.Nullable;
import org.junit.Before;
import org.junit.Test;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.ReadWriteTransaction;
-import org.opendaylight.mdsal.binding.api.RpcProviderService;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.DaeximOffsiteBackupService;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.RetrieveDataInput;
import org.opendaylight.yangtools.yang.binding.Augmentation;
@@ -48,8 +49,8 @@ import org.opendaylight.yangtools.yang.binding.Augmentation;
public class DaeximOffsiteBackupProviderTest {
public DataBroker dataBroker;
public ReadWriteTransaction writeTransaction;
- public FluentFuture checkedFuture;
- public RpcProviderService rpcRegistry;
+ public CheckedFuture<Void, TransactionCommitFailedException> checkedFuture;
+ public RpcProviderRegistry rpcRegistry;
public DaeximOffsiteBackupProvider provider;
public Properties resProps;
@@ -60,16 +61,16 @@ public class DaeximOffsiteBackupProviderTest {
resProps.put("error-message", "Success");
dataBroker = mock(DataBroker.class);
writeTransaction = mock(ReadWriteTransaction.class);
- checkedFuture = mock(FluentFuture.class);
- rpcRegistry = mock(RpcProviderService.class);
- when(rpcRegistry.registerRpcImplementation(any(), any(DaeximOffsiteBackupService.class))).thenReturn(null);
+ checkedFuture = mock(CheckedFuture.class);
+ rpcRegistry = mock(RpcProviderRegistry.class);
+ when(rpcRegistry.addRoutedRpcImplementation(any(), any(DaeximOffsiteBackupService.class))).thenReturn(null);
try {
when(checkedFuture.get()).thenReturn(null);
}
catch(InterruptedException | ExecutionException e) {
e.printStackTrace();
}
- when(writeTransaction.commit()).thenReturn(checkedFuture);
+ when(writeTransaction.submit()).thenReturn(checkedFuture);
when(dataBroker.newReadWriteTransaction()).thenReturn(writeTransaction);
provider = new DaeximOffsiteBackupProvider(dataBroker, rpcRegistry);
diff --git a/northbound/dataChange/provider/pom.xml b/northbound/dataChange/provider/pom.xml
index 03f46e68b..10f6f001a 100755
--- a/northbound/dataChange/provider/pom.xml
+++ b/northbound/dataChange/provider/pom.xml
@@ -35,8 +35,8 @@
</dependency>
<dependency>
- <groupId>org.opendaylight.mdsal</groupId>
- <artifactId>mdsal-binding-api</artifactId>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-api</artifactId>
</dependency>
<dependency>
<groupId>org.onap.ccsdk.sli.core</groupId>
@@ -48,28 +48,24 @@
</dependency>
<dependency>
- <groupId>org.opendaylight.mdsal</groupId>
- <artifactId>mdsal-binding-test-model</artifactId>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-test-model</artifactId>
<scope>test</scope>
</dependency>
+
+
<dependency>
- <groupId>org.opendaylight.mdsal</groupId>
- <artifactId>mdsal-dom-api</artifactId>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-broker-impl</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-broker-impl</artifactId>
+ <type>test-jar</type>
+ <classifier>tests</classifier>
<scope>test</scope>
</dependency>
-
-<!-- <dependency> -->
-<!-- <groupId>org.opendaylight.controller</groupId> -->
-<!-- <artifactId>sal-binding-broker-impl</artifactId> -->
-<!-- <scope>test</scope> -->
-<!-- </dependency> -->
-<!-- <dependency> -->
-<!-- <groupId>org.opendaylight.controller</groupId> -->
-<!-- <artifactId>sal-binding-broker-impl</artifactId> -->
-<!-- <type>test-jar</type> -->
-<!-- <classifier>tests</classifier> -->
-<!-- <scope>test</scope> -->
-<!-- </dependency> -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
diff --git a/northbound/dataChange/provider/src/main/java/org/onap/ccsdk/sli/northbound/DataChangeProvider.java b/northbound/dataChange/provider/src/main/java/org/onap/ccsdk/sli/northbound/DataChangeProvider.java
index cf4b07a70..3301ca8e0 100644
--- a/northbound/dataChange/provider/src/main/java/org/onap/ccsdk/sli/northbound/DataChangeProvider.java
+++ b/northbound/dataChange/provider/src/main/java/org/onap/ccsdk/sli/northbound/DataChangeProvider.java
@@ -9,9 +9,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.
@@ -22,26 +22,28 @@
package org.onap.ccsdk.sli.northbound;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
import java.util.Properties;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+
import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.NotificationPublishService;
-import org.opendaylight.mdsal.binding.api.RpcProviderService;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationInput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationOutputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeService;
-import org.opendaylight.yangtools.concepts.ObjectRegistration;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+
/**
* Defines a base implementation for your provider. This class extends from a helper class
* which provides storage for the most commonly used components of the MD-SAL. Additionally the
@@ -58,14 +60,14 @@ public class DataChangeProvider implements AutoCloseable, DataChangeService {
protected DataBroker dataBroker;
protected NotificationPublishService notificationService;
- protected RpcProviderService rpcRegistry;
- protected ObjectRegistration<DataChangeService> rpcRegistration;
+ protected RpcProviderRegistry rpcRegistry;
+ protected BindingAwareBroker.RpcRegistration<DataChangeService> rpcRegistration;
private final DataChangeClient dataChangeClient;
public DataChangeProvider(final DataBroker dataBroker,
final NotificationPublishService notificationPublishService,
- final RpcProviderService rpcProviderRegistry,
+ final RpcProviderRegistry rpcProviderRegistry,
final DataChangeClient dataChangeClient) {
this.LOG.info( "Creating provider for {}", APPLICATION_NAME);
@@ -79,7 +81,7 @@ public class DataChangeProvider implements AutoCloseable, DataChangeService {
public void initialize(){
LOG.info( "Initializing provider for {}", APPLICATION_NAME);
- rpcRegistration = rpcRegistry.registerRpcImplementation(DataChangeService.class, this);
+ rpcRegistration = rpcRegistry.addRpcImplementation(DataChangeService.class, this);
LOG.info( "Initialization complete for {}", APPLICATION_NAME);
}
diff --git a/northbound/dataChange/provider/src/main/resources/OSGI-INF/blueprint/datachange-blueprint.xml b/northbound/dataChange/provider/src/main/resources/OSGI-INF/blueprint/datachange-blueprint.xml
new file mode 100644
index 000000000..5a38c81f1
--- /dev/null
+++ b/northbound/dataChange/provider/src/main/resources/OSGI-INF/blueprint/datachange-blueprint.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <reference id="svcLogicService"
+ interface="org.onap.ccsdk.sli.core.sli.provider.SvcLogicService" />
+
+ <bean id="client" class="org.onap.ccsdk.sli.northbound.DataChangeClient">
+ <argument ref="svcLogicService" />
+ </bean>
+
+ <reference id="dataBroker"
+ interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+ odl:type="default" />
+
+ <reference id="notificationService"
+ interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService"
+ odl:type="default" />
+
+ <reference id="rpcRegistry"
+ interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
+ odl:type="default" />
+
+ <bean id="provider" class="org.onap.ccsdk.sli.northbound.DataChangeProvider">
+ <argument ref="dataBroker" />
+ <argument ref="notificationService" />
+ <argument ref="rpcRegistry" />
+ <argument ref="client" />
+ </bean>
+
+</blueprint> \ No newline at end of file
diff --git a/northbound/dataChange/provider/src/main/resources/org/opendaylight/blueprint/datachange-blueprint.xml b/northbound/dataChange/provider/src/main/resources/org/opendaylight/blueprint/datachange-blueprint.xml
index 7bc0076dd..5a38c81f1 100644
--- a/northbound/dataChange/provider/src/main/resources/org/opendaylight/blueprint/datachange-blueprint.xml
+++ b/northbound/dataChange/provider/src/main/resources/org/opendaylight/blueprint/datachange-blueprint.xml
@@ -11,13 +11,16 @@
</bean>
<reference id="dataBroker"
- interface="org.opendaylight.mdsal.binding.api.DataBroker" />
+ interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+ odl:type="default" />
<reference id="notificationService"
- interface="org.opendaylight.mdsal.binding.api.NotificationPublishService" />
+ interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService"
+ odl:type="default" />
<reference id="rpcRegistry"
- interface="org.opendaylight.mdsal.binding.api.RpcProviderService" />
+ interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
+ odl:type="default" />
<bean id="provider" class="org.onap.ccsdk.sli.northbound.DataChangeProvider">
<argument ref="dataBroker" />
diff --git a/northbound/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/DataChangeClientTest.java b/northbound/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/DataChangeClientTest.java
index 88a7f5bf0..9ba6c8742 100644
--- a/northbound/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/DataChangeClientTest.java
+++ b/northbound/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/DataChangeClientTest.java
@@ -1,55 +1,56 @@
-package org.onap.sdnc.northbound.dataChange;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import java.util.Properties;
-import org.junit.Before;
-import org.junit.Test;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService;
-import org.onap.ccsdk.sli.northbound.DataChangeClient;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationOutputBuilder;
-
-public class DataChangeClientTest {
-
- SvcLogicService mockSvcLogicService;
- String module = "test-module";
- String rpc = "test-rpc";
- String version = "test-version";
- String mode = "test-mode";
- Properties localProp = new Properties();
-
- @Before
- public void setUp() throws Exception {
- mockSvcLogicService = mock(SvcLogicService.class);
- when(mockSvcLogicService.hasGraph(module, rpc, version, mode)).thenReturn(true);
- }
-
- @Test
- public void testDataChangeClientConstructor() {
- DataChangeClient dataChangeClient = new DataChangeClient(mockSvcLogicService);
- assertNotNull(dataChangeClient);
- }
-
- @Test
- public void testHasGraph() throws SvcLogicException {
- DataChangeClient dataChangeClient = new DataChangeClient(mockSvcLogicService);
- boolean result = dataChangeClient.hasGraph(module, rpc, version, mode);
- assertTrue(result);
- }
-
- @Test
- public void testExecuteSvcLogicStatusFailure() throws SvcLogicException {
- DataChangeNotificationOutputBuilder serviceData = mock(DataChangeNotificationOutputBuilder.class);
- Properties parms = mock(Properties.class);
- SvcLogicService svcLogicService = mock(SvcLogicService.class);
- Properties properties = new Properties();
- properties.setProperty("SvcLogic.status", "failure");
- when(svcLogicService.execute(module, rpc, version, mode, properties)).thenReturn(properties);
- DataChangeClient sliClient = new DataChangeClient(svcLogicService);
- Properties prop = sliClient.execute(module, rpc, version, mode, serviceData, properties);
- assertTrue(prop != null);
- }
+package org.onap.sdnc.northbound.dataChange;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.*;
+
+import java.util.Properties;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.ccsdk.sli.core.sli.SvcLogicException;
+import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper;
+import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService;
+import org.onap.ccsdk.sli.northbound.DataChangeClient;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationOutputBuilder;
+
+public class DataChangeClientTest {
+
+ SvcLogicService mockSvcLogicService;
+ String module = "test-module";
+ String rpc = "test-rpc";
+ String version = "test-version";
+ String mode = "test-mode";
+ Properties localProp = new Properties();
+
+ @Before
+ public void setUp() throws Exception {
+ mockSvcLogicService = mock(SvcLogicService.class);
+ when(mockSvcLogicService.hasGraph(module, rpc, version, mode)).thenReturn(true);
+ }
+
+ @Test
+ public void testDataChangeClientConstructor() {
+ DataChangeClient dataChangeClient = new DataChangeClient(mockSvcLogicService);
+ assertNotNull(dataChangeClient);
+ }
+
+ @Test
+ public void testHasGraph() throws SvcLogicException {
+ DataChangeClient dataChangeClient = new DataChangeClient(mockSvcLogicService);
+ boolean result = dataChangeClient.hasGraph(module, rpc, version, mode);
+ assertTrue(result);
+ }
+
+ @Test
+ public void testExecuteSvcLogicStatusFailure() throws SvcLogicException {
+ DataChangeNotificationOutputBuilder serviceData = mock(DataChangeNotificationOutputBuilder.class);
+ Properties parms = mock(Properties.class);
+ SvcLogicService svcLogicService = mock(SvcLogicService.class);
+ Properties properties = new Properties();
+ properties.setProperty("SvcLogic.status", "failure");
+ when(svcLogicService.execute(module, rpc, version, mode, properties)).thenReturn(properties);
+ DataChangeClient sliClient = new DataChangeClient(svcLogicService);
+ Properties prop = sliClient.execute(module, rpc, version, mode, serviceData, properties);
+ assertTrue(prop != null);
+ }
} \ No newline at end of file
diff --git a/northbound/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/TestDataChange.java b/northbound/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/TestDataChange.java
index ad2e85498..f9c39b703 100644
--- a/northbound/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/TestDataChange.java
+++ b/northbound/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/TestDataChange.java
@@ -21,57 +21,75 @@
package org.onap.sdnc.northbound.dataChange;
-public class TestDataChange {//extends AbstractConcurrentDataBrokerTest {
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.ccsdk.sli.northbound.DataChangeProvider;
+import org.onap.ccsdk.sli.northbound.DataChangeClient;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationInput;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationOutput;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-// private DataChangeProvider dataChangeProvider;
-// private static final Logger LOG = LoggerFactory.getLogger(DataChangeProvider.class);
-//
-// @Before
-// public void setUp() throws Exception {
-// if (null == dataChangeProvider) {
-// DataBroker dataBroker = getDataBroker();
-// NotificationPublishService mockNotification = mock(NotificationPublishService.class);
-// RpcProviderService mockRpcRegistry = mock(RpcProviderService.class);
-// DataChangeClient mockSliClient = mock(DataChangeClient.class);
-// dataChangeProvider = new DataChangeProvider(dataBroker, mockNotification, mockRpcRegistry, mockSliClient);
-// }
-// }
-//
-// //Testcase should return error 503 when No service logic active for dataChange.
-// @Test
-// public void testDataChangeNotification() {
-//
-// DataChangeNotificationInputBuilder inputBuilder = new DataChangeNotificationInputBuilder();
-//
-// inputBuilder.setAaiEventId("1");
-//
-//
-// // TODO: currently initialize SvcLogicServiceClient is failing, need to fix
-// java.util.concurrent.Future<RpcResult<DataChangeNotificationOutput>> future = dataChangeProvider
-// .dataChangeNotification(inputBuilder.build());
-// RpcResult<DataChangeNotificationOutput> rpcResult = null;
-// try {
-// rpcResult = future.get();
-// } catch (Exception e) {
-// fail("Error : " + e);
-// }
-// LOG.info("result: {}", rpcResult);
-// assertEquals("503", rpcResult.getResult().getDataChangeResponseCode());
-// }
-//
-// //Input parameter validation
-// @Test
-// public void testDataChangeNotificationInputValidation() {
-//
-// java.util.concurrent.Future<RpcResult<DataChangeNotificationOutput>> future = dataChangeProvider
-// .dataChangeNotification(null);
-// RpcResult<DataChangeNotificationOutput> rpcResult = null;
-// try {
-// rpcResult = future.get();
-// } catch (Exception e) {
-// fail("Error : " + e);
-// }
-// LOG.info("result: {}", rpcResult);
-// assertEquals("403", rpcResult.getResult().getDataChangeResponseCode());
-// }
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.mock;
+
+public class TestDataChange extends AbstractConcurrentDataBrokerTest {
+
+ private DataChangeProvider dataChangeProvider;
+ private static final Logger LOG = LoggerFactory.getLogger(DataChangeProvider.class);
+
+ @Before
+ public void setUp() throws Exception {
+ if (null == dataChangeProvider) {
+ DataBroker dataBroker = getDataBroker();
+ NotificationPublishService mockNotification = mock(NotificationPublishService.class);
+ RpcProviderRegistry mockRpcRegistry = mock(RpcProviderRegistry.class);
+ DataChangeClient mockSliClient = mock(DataChangeClient.class);
+ dataChangeProvider = new DataChangeProvider(dataBroker, mockNotification, mockRpcRegistry, mockSliClient);
+ }
+ }
+
+ //Testcase should return error 503 when No service logic active for dataChange.
+ @Test
+ public void testDataChangeNotification() {
+
+ DataChangeNotificationInputBuilder inputBuilder = new DataChangeNotificationInputBuilder();
+
+ inputBuilder.setAaiEventId("1");
+
+
+ // TODO: currently initialize SvcLogicServiceClient is failing, need to fix
+ java.util.concurrent.Future<RpcResult<DataChangeNotificationOutput>> future = dataChangeProvider
+ .dataChangeNotification(inputBuilder.build());
+ RpcResult<DataChangeNotificationOutput> rpcResult = null;
+ try {
+ rpcResult = future.get();
+ } catch (Exception e) {
+ fail("Error : " + e);
+ }
+ LOG.info("result: {}", rpcResult);
+ assertEquals("503", rpcResult.getResult().getDataChangeResponseCode());
+ }
+
+ //Input parameter validation
+ @Test
+ public void testDataChangeNotificationInputValidation() {
+
+ java.util.concurrent.Future<RpcResult<DataChangeNotificationOutput>> future = dataChangeProvider
+ .dataChangeNotification(null);
+ RpcResult<DataChangeNotificationOutput> rpcResult = null;
+ try {
+ rpcResult = future.get();
+ } catch (Exception e) {
+ fail("Error : " + e);
+ }
+ LOG.info("result: {}", rpcResult);
+ assertEquals("403", rpcResult.getResult().getDataChangeResponseCode());
+ }
}
diff --git a/northbound/lcm/provider/pom.xml b/northbound/lcm/provider/pom.xml
index bd6f762d0..5c32d4501 100755
--- a/northbound/lcm/provider/pom.xml
+++ b/northbound/lcm/provider/pom.xml
@@ -35,18 +35,18 @@
</dependency>
<dependency>
- <groupId>org.opendaylight.mdsal</groupId>
- <artifactId>mdsal-binding-api</artifactId>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-api</artifactId>
</dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
- <artifactId>sal-common-util</artifactId>
- </dependency>
+ <artifactId>sal-binding-broker-impl</artifactId>
+ </dependency>
<dependency>
- <groupId>org.opendaylight.mdsal</groupId>
- <artifactId>mdsal-dom-api</artifactId>
- <scope>provided</scope>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-common-util</artifactId>
</dependency>
+
<dependency>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>sli-common</artifactId>
@@ -58,6 +58,11 @@
<dependency>
<groupId>org.onap.ccsdk.sli.core</groupId>
<artifactId>sli-provider-base</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-core-api</artifactId>
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
diff --git a/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java b/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java
index 4dd46d597..100496e39 100644
--- a/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java
+++ b/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java
@@ -21,26 +21,32 @@ package org.onap.ccsdk.sli.northbound;
* ============LICENSE_END=========================================================
*/
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Properties;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper;
-import org.opendaylight.mdsal.binding.api.NotificationPublishService;
-import org.opendaylight.mdsal.binding.api.RpcProviderService;
-import org.opendaylight.mdsal.dom.api.DOMDataBroker;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.controller.md.sal.binding.impl.AbstractForwardedDataBroker;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.*;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.common.header.CommonHeaderBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.status.StatusBuilder;
-import org.opendaylight.yangtools.concepts.ObjectRegistration;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+
+import org.onap.ccsdk.sli.northbound.LcmResponseCode.*;
+
/**
* Defines a base implementation for your provider. This class extends from a
* helper class which provides storage for the most commonly used components of
@@ -87,19 +93,23 @@ public class LcmProvider implements AutoCloseable, LCMService {
private static final String APPLICATION_NAME = "LCM";
private final ExecutorService executor;
+ protected DataBroker dataBroker;
protected DOMDataBroker domDataBroker;
protected NotificationPublishService notificationService;
- protected RpcProviderService rpcRegistry;
+ protected RpcProviderRegistry rpcRegistry;
private final LcmSliClient lcmSliClient;
- protected ObjectRegistration<LCMService> rpcRegistration;
+ protected BindingAwareBroker.RpcRegistration<LCMService> rpcRegistration;
- public LcmProvider(final DOMDataBroker dataBroker, final NotificationPublishService notificationPublishService,
- final RpcProviderService rpcProviderRegistry, final LcmSliClient lcmSliClient) {
+ public LcmProvider(final DataBroker dataBroker, final NotificationPublishService notificationPublishService,
+ final RpcProviderRegistry rpcProviderRegistry, final LcmSliClient lcmSliClient) {
LOG.info("Creating provider for {}", APPLICATION_NAME);
executor = Executors.newFixedThreadPool(1);
- domDataBroker = dataBroker;
+ this.dataBroker = dataBroker;
+ if (dataBroker instanceof AbstractForwardedDataBroker) {
+ domDataBroker = ((AbstractForwardedDataBroker) dataBroker).getDelegate();
+ }
notificationService = notificationPublishService;
rpcRegistry = rpcProviderRegistry;
this.lcmSliClient = lcmSliClient;
@@ -111,7 +121,7 @@ public class LcmProvider implements AutoCloseable, LCMService {
if (rpcRegistration == null) {
if (rpcRegistry != null) {
- rpcRegistration = rpcRegistry.registerRpcImplementation(LCMService.class, this);
+ rpcRegistration = rpcRegistry.addRpcImplementation(LCMService.class, this);
LOG.info("Initialization complete for {}", APPLICATION_NAME);
} else {
LOG.warn("Error initializing {} : rpcRegistry unset", APPLICATION_NAME);
diff --git a/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmSliClient.java b/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmSliClient.java
index 05bb43f82..54e53c776 100644
--- a/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmSliClient.java
+++ b/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmSliClient.java
@@ -24,9 +24,10 @@ package org.onap.ccsdk.sli.northbound;
import java.util.Properties;
+
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService;
-import org.opendaylight.mdsal.dom.api.DOMDataBroker;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/northbound/lcm/provider/src/main/resources/OSGI-INF/blueprint/lcm-blueprint.xml b/northbound/lcm/provider/src/main/resources/OSGI-INF/blueprint/lcm-blueprint.xml
new file mode 100644
index 000000000..5597d0801
--- /dev/null
+++ b/northbound/lcm/provider/src/main/resources/OSGI-INF/blueprint/lcm-blueprint.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <reference id="svcLogicService"
+ interface="org.onap.ccsdk.sli.core.sli.provider.SvcLogicService" />
+
+ <bean id="client" class="org.onap.ccsdk.sli.northbound.LcmSliClient">
+ <argument ref="svcLogicService" />
+ </bean>
+
+ <reference id="dataBroker"
+ interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+ odl:type="default" />
+
+ <reference id="notificationService"
+ interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService"
+ odl:type="default" />
+
+ <reference id="rpcRegistry"
+ interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
+ odl:type="default" />
+
+ <bean id="provider" class="org.onap.ccsdk.sli.northbound.LcmProvider">
+ <argument ref="dataBroker" />
+ <argument ref="notificationService" />
+ <argument ref="rpcRegistry" />
+ <argument ref="client" />
+ </bean>
+
+ <odl:rpc-implementation ref="provider"/>
+
+</blueprint> \ No newline at end of file
diff --git a/northbound/lcm/provider/src/main/resources/org/opendaylight/blueprint/lcm-blueprint.xml b/northbound/lcm/provider/src/main/resources/org/opendaylight/blueprint/lcm-blueprint.xml
index 7550c8b93..5597d0801 100644
--- a/northbound/lcm/provider/src/main/resources/org/opendaylight/blueprint/lcm-blueprint.xml
+++ b/northbound/lcm/provider/src/main/resources/org/opendaylight/blueprint/lcm-blueprint.xml
@@ -11,13 +11,16 @@
</bean>
<reference id="dataBroker"
- interface="org.opendaylight.mdsal.dom.api.DOMDataBroker" />
+ interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+ odl:type="default" />
<reference id="notificationService"
- interface="org.opendaylight.mdsal.binding.api.NotificationPublishService" />
+ interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService"
+ odl:type="default" />
<reference id="rpcRegistry"
- interface="org.opendaylight.mdsal.binding.api.RpcProviderService" />
+ interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
+ odl:type="default" />
<bean id="provider" class="org.onap.ccsdk.sli.northbound.LcmProvider">
<argument ref="dataBroker" />
diff --git a/northbound/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmProvider.java b/northbound/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmProvider.java
index 85325cb56..b73151e8d 100644
--- a/northbound/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmProvider.java
+++ b/northbound/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmProvider.java
@@ -2,9 +2,10 @@ package org.onap.ccsdk.sli.northbound;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
-import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+
import java.io.InputStream;
import java.net.URL;
import java.text.SimpleDateFormat;
@@ -20,14 +21,13 @@ import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory;
import org.onap.ccsdk.sli.core.sli.provider.SvcLogicClassResolver;
import org.onap.ccsdk.sli.core.sli.provider.SvcLogicPropertiesProviderImpl;
import org.onap.ccsdk.sli.core.sli.provider.SvcLogicServiceImpl;
-import org.opendaylight.mdsal.binding.api.NotificationPublishService;
-import org.opendaylight.mdsal.binding.api.RpcProviderService;
-import org.opendaylight.mdsal.dom.api.DOMDataBroker;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.Action;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ActionStatusInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ActionStatusOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ActivateNESwInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ActivateNESwOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.AttachVolumeInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.AttachVolumeOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.AuditInputBuilder;
@@ -52,8 +52,6 @@ import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DetachVolumeOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DistributeTrafficInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DistributeTrafficOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DownloadNESwInputBuilder;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DownloadNESwOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.EvacuateInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.EvacuateOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.HealthCheckInputBuilder;
@@ -108,10 +106,13 @@ import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UpgradePreCheckOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UpgradeSoftwareInputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UpgradeSoftwareOutput;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DownloadNESwInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DownloadNESwOutput;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ActivateNESwInputBuilder;
+import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ActivateNESwOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ZULU;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.action.identifiers.ActionIdentifiersBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.common.header.CommonHeaderBuilder;
-import org.opendaylight.yangtools.concepts.ObjectRegistration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -125,11 +126,11 @@ public class TestLcmProvider {
*/
@Before
public void setUp() throws Exception {
- DOMDataBroker dataBroker = mock(DOMDataBroker.class);
+ DataBroker dataBroker = mock(DataBroker.class);
NotificationPublishService notifyService = mock(NotificationPublishService.class);
- RpcProviderService rpcRegistry = mock(RpcProviderService.class);
- ObjectRegistration<LCMService> rpcRegistration = mock(ObjectRegistration.class);
- when(rpcRegistry.registerRpcImplementation(any(Class.class), any(LCMService.class))).thenReturn(rpcRegistration);
+ RpcProviderRegistry rpcRegistry = mock(RpcProviderRegistry.class);
+ BindingAwareBroker.RpcRegistration<LCMService> rpcRegistration = (BindingAwareBroker.RpcRegistration<LCMService>) mock(BindingAwareBroker.RpcRegistration.class);
+ when(rpcRegistry.addRpcImplementation(any(Class.class), any(LCMService.class))).thenReturn(rpcRegistration);
// Load svclogic.properties and get a SvcLogicStore
@@ -193,7 +194,7 @@ public class TestLcmProvider {
try {
CheckLockOutput results = provider.checkLock(builder.build()).get().getResult();
LOG.info("CheckLock returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("CheckLock threw exception");
@@ -228,7 +229,7 @@ public class TestLcmProvider {
try {
RebootOutput results = provider.reboot(builder.build()).get().getResult();
LOG.info("Reboot returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("Reboot threw exception");
@@ -263,7 +264,7 @@ public class TestLcmProvider {
try {
UpgradeBackupOutput results = provider.upgradeBackup(builder.build()).get().getResult();
LOG.info("UpgradeBackout returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("CheckLock threw exception");
@@ -297,7 +298,7 @@ public class TestLcmProvider {
try {
RollbackOutput results = provider.rollback(builder.build()).get().getResult();
LOG.info("Rollback returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("Rollback threw exception");
@@ -331,7 +332,7 @@ public class TestLcmProvider {
try {
SyncOutput results = provider.sync(builder.build()).get().getResult();
LOG.info("Sync returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("Sync threw exception");
@@ -364,7 +365,7 @@ public class TestLcmProvider {
try {
QueryOutput results = provider.query(builder.build()).get().getResult();
LOG.info("Query returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("Query threw exception");
@@ -398,7 +399,7 @@ public class TestLcmProvider {
try {
ConfigExportOutput results = provider.configExport(builder.build()).get().getResult();
LOG.info("ConfigExport returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("ConfigExport threw exception");
@@ -433,7 +434,7 @@ public class TestLcmProvider {
try {
StopApplicationOutput results = provider.stopApplication(builder.build()).get().getResult();
LOG.info("StopApplication returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("StopApplication threw exception");
@@ -467,7 +468,7 @@ public class TestLcmProvider {
try {
SoftwareUploadOutput results = provider.softwareUpload(builder.build()).get().getResult();
LOG.info("SoftwareUpload returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("SoftwareUpload threw exception");
@@ -501,7 +502,7 @@ public class TestLcmProvider {
try {
ResumeTrafficOutput results = provider.resumeTraffic(builder.build()).get().getResult();
LOG.info("ResumeTraffic returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("ResumeTraffic threw exception");
@@ -535,7 +536,7 @@ public class TestLcmProvider {
try {
DistributeTrafficOutput results = provider.distributeTraffic(builder.build()).get().getResult();
LOG.info("DistributeTraffic returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("DistributeTraffic threw exception");
@@ -569,7 +570,7 @@ public class TestLcmProvider {
try {
ConfigureOutput results = provider.configure(builder.build()).get().getResult();
LOG.info("Configure returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("Configure threw exception");
@@ -603,7 +604,7 @@ public class TestLcmProvider {
try {
ActionStatusOutput results = provider.actionStatus(builder.build()).get().getResult();
LOG.info("ActionStatus returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("ActionStatus threw exception");
@@ -637,7 +638,7 @@ public class TestLcmProvider {
try {
UpgradePreCheckOutput results = provider.upgradePreCheck(builder.build()).get().getResult();
LOG.info("UpgradePreCheck returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("UpgradePreCheck threw exception");
@@ -671,7 +672,7 @@ public class TestLcmProvider {
try {
LiveUpgradeOutput results = provider.liveUpgrade(builder.build()).get().getResult();
LOG.info("LiveUpgrade returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("LiveUpgrade threw exception");
@@ -705,7 +706,7 @@ public class TestLcmProvider {
try {
ConfigModifyOutput results = provider.configModify(builder.build()).get().getResult();
LOG.info("ConfigModify returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("ConfigModify threw exception");
@@ -739,7 +740,7 @@ public class TestLcmProvider {
try {
RestartOutput results = provider.restart(builder.build()).get().getResult();
LOG.info("Restart returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("Restart threw exception");
@@ -773,7 +774,7 @@ public class TestLcmProvider {
try {
HealthCheckOutput results = provider.healthCheck(builder.build()).get().getResult();
LOG.info("HealthCheck returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("HealthCheck threw exception");
@@ -807,7 +808,7 @@ public class TestLcmProvider {
try {
LockOutput results = provider.lock(builder.build()).get().getResult();
LOG.info("Lock returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("Lock threw exception");
@@ -841,7 +842,7 @@ public class TestLcmProvider {
try {
TerminateOutput results = provider.terminate(builder.build()).get().getResult();
LOG.info("Terminate returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("Terminate threw exception");
@@ -875,7 +876,7 @@ public class TestLcmProvider {
try {
AttachVolumeOutput results = provider.attachVolume(builder.build()).get().getResult();
LOG.info("AttachVolume returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("AttachVolume threw exception");
@@ -909,7 +910,7 @@ public class TestLcmProvider {
try {
MigrateOutput results = provider.migrate(builder.build()).get().getResult();
LOG.info("Migrate returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("Migrate threw exception");
@@ -943,7 +944,7 @@ public class TestLcmProvider {
try {
QuiesceTrafficOutput results = provider.quiesceTraffic(builder.build()).get().getResult();
LOG.info("QuiesceTraffic returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("QuiesceTraffic threw exception");
@@ -977,7 +978,7 @@ public class TestLcmProvider {
try {
ConfigRestoreOutput results = provider.configRestore(builder.build()).get().getResult();
LOG.info("ConfigRestore returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("ConfigRestore threw exception");
@@ -1011,7 +1012,7 @@ public class TestLcmProvider {
try {
UpgradeBackoutOutput results = provider.upgradeBackout(builder.build()).get().getResult();
LOG.info("UpgradeBackout returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("UpgradeBackout threw exception");
@@ -1045,7 +1046,7 @@ public class TestLcmProvider {
try {
EvacuateOutput results = provider.evacuate(builder.build()).get().getResult();
LOG.info("Evacuate returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("Evacuate threw exception");
@@ -1079,7 +1080,7 @@ public class TestLcmProvider {
try {
UnlockOutput results = provider.unlock(builder.build()).get().getResult();
LOG.info("Unlock returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("Unlock threw exception");
@@ -1112,7 +1113,7 @@ public class TestLcmProvider {
try {
ConfigBackupDeleteOutput results = provider.configBackupDelete(builder.build()).get().getResult();
LOG.info("ConfigBackupDelete returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("ConfigBackupDelete threw exception");
@@ -1146,7 +1147,7 @@ public class TestLcmProvider {
try {
UpgradeSoftwareOutput results = provider.upgradeSoftware(builder.build()).get().getResult();
LOG.info("UpgradeSoftware returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("UpgradeSoftware threw exception");
@@ -1181,7 +1182,7 @@ public class TestLcmProvider {
try {
DownloadNESwOutput results = provider.downloadNESw(builder.build()).get().getResult();
LOG.info("DownloadNESw returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("DownloadNESw threw exception");
@@ -1216,7 +1217,7 @@ public class TestLcmProvider {
try {
ActivateNESwOutput results = provider.activateNESw(builder.build()).get().getResult();
LOG.info("ActivateNESw returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("ActivateNESw threw exception");
@@ -1250,7 +1251,7 @@ public class TestLcmProvider {
try {
StopOutput results = provider.stop(builder.build()).get().getResult();
LOG.info("Stop returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("Stop threw exception");
@@ -1284,7 +1285,7 @@ public class TestLcmProvider {
try {
DetachVolumeOutput results = provider.detachVolume(builder.build()).get().getResult();
LOG.info("DetachVolume returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("DetachVolume threw exception");
@@ -1318,7 +1319,7 @@ public class TestLcmProvider {
try {
ConfigScaleOutOutput results = provider.configScaleOut(builder.build()).get().getResult();
LOG.info("ConfigScaleOut returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("ConfigScaleOut threw exception");
@@ -1352,7 +1353,7 @@ public class TestLcmProvider {
try {
UpgradePostCheckOutput results = provider.upgradePostCheck(builder.build()).get().getResult();
LOG.info("UpgradePostCheck returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("UpgradePostCheck threw exception");
@@ -1386,7 +1387,7 @@ public class TestLcmProvider {
try {
TestOutput results = provider.test(builder.build()).get().getResult();
LOG.info("Test returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("Test threw exception");
@@ -1420,7 +1421,7 @@ public class TestLcmProvider {
try {
StartApplicationOutput results = provider.startApplication(builder.build()).get().getResult();
LOG.info("StartApplication returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("StartApplication threw exception");
@@ -1454,7 +1455,7 @@ public class TestLcmProvider {
try {
ConfigBackupOutput results = provider.configBackup(builder.build()).get().getResult();
LOG.info("ConfigBackup returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("ConfigBackup threw exception");
@@ -1488,7 +1489,7 @@ public class TestLcmProvider {
try {
ConfigBackupOutput results = provider.configBackup(builder.build()).get().getResult();
LOG.info("ConfigBackup returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("ConfigBackup threw exception");
@@ -1522,7 +1523,7 @@ public class TestLcmProvider {
try {
AuditOutput results = provider.audit(builder.build()).get().getResult();
LOG.info("Audit returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("Audit threw exception");
@@ -1556,7 +1557,7 @@ public class TestLcmProvider {
try {
StartOutput results = provider.start(builder.build()).get().getResult();
LOG.info("Start returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("Start threw exception");
@@ -1590,7 +1591,7 @@ public class TestLcmProvider {
try {
SnapshotOutput results = provider.snapshot(builder.build()).get().getResult();
LOG.info("Snapshot returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage());
- assert(results.getStatus().getCode().intValue() == 400);
+ assert(results.getStatus().getCode() == 400);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Caught exception", e);
fail("Snapshot threw exception");
diff --git a/northbound/ueb-listener/src/test/resources/incoming/src_test_resources_csars_service-NfodService-csar.csar b/northbound/ueb-listener/src/test/resources/incoming/src_test_resources_csars_service-NfodService-csar.csar
new file mode 100644
index 000000000..329076a15
--- /dev/null
+++ b/northbound/ueb-listener/src/test/resources/incoming/src_test_resources_csars_service-NfodService-csar.csar
Binary files differ
diff --git a/plugins/features/ccsdk-restconf-client/pom.xml b/plugins/features/ccsdk-restconf-client/pom.xml
index cf1678eb8..bf4994b33 100644
--- a/plugins/features/ccsdk-restconf-client/pom.xml
+++ b/plugins/features/ccsdk-restconf-client/pom.xml
@@ -27,13 +27,6 @@
<groupId>${project.groupId}</groupId>
<artifactId>restconf-client-provider</artifactId>
<version>${project.version}</version>
- <exclusions>
- <!-- let the filter module start and manage the common code -->
- <exclusion>
- <groupId>org.onap.logging-analytics</groupId>
- <artifactId>logging-filter-base</artifactId>
- </exclusion>
- </exclusions>
</dependency>
</dependencies>
</project>
diff --git a/plugins/grToolkit/provider/pom.xml b/plugins/grToolkit/provider/pom.xml
index 5c77331c0..3bdecd54f 100755
--- a/plugins/grToolkit/provider/pom.xml
+++ b/plugins/grToolkit/provider/pom.xml
@@ -23,8 +23,8 @@
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.opendaylight.mdsal</groupId>
- <artifactId>mdsal-binding-api</artifactId>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-api</artifactId>
</dependency>
<dependency>
<groupId>org.onap.ccsdk.sli.core</groupId>
@@ -49,22 +49,22 @@
<artifactId>annotations</artifactId>
</dependency>
<dependency>
- <groupId>org.opendaylight.mdsal</groupId>
- <artifactId>mdsal-binding-test-model</artifactId>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-test-model</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-broker-impl</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-broker-impl</artifactId>
+ <type>test-jar</type>
+ <classifier>tests</classifier>
<scope>test</scope>
</dependency>
-<!-- <dependency> -->
-<!-- <groupId>org.opendaylight.controller</groupId> -->
-<!-- <artifactId>sal-binding-broker-impl</artifactId> -->
-<!-- <scope>test</scope> -->
-<!-- </dependency> -->
-<!-- <dependency> -->
-<!-- <groupId>org.opendaylight.controller</groupId> -->
-<!-- <artifactId>sal-binding-broker-impl</artifactId> -->
-<!-- <type>test-jar</type> -->
-<!-- <classifier>tests</classifier> -->
-<!-- <scope>test</scope> -->
-<!-- </dependency> -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@@ -100,7 +100,6 @@
<dependency>
<groupId>com.github.stefanbirkner</groupId>
<artifactId>system-rules</artifactId>
- <version>1.19.0</version>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/plugins/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProvider.java b/plugins/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProvider.java
index 5a8730bff..7a8b3deb0 100755
--- a/plugins/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProvider.java
+++ b/plugins/grToolkit/provider/src/main/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProvider.java
@@ -21,8 +21,6 @@
package org.onap.ccsdk.sli.plugins.grtoolkit;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
@@ -35,15 +33,18 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.annotation.Nonnull;
+
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.ListenableFuture;
+
import org.apache.commons.lang.StringUtils;
-import org.json.JSONArray;
-import org.json.JSONObject;
+
import org.onap.ccsdk.sli.core.dblib.DbLibService;
import org.onap.ccsdk.sli.plugins.grtoolkit.connection.ConnectionManager;
import org.onap.ccsdk.sli.plugins.grtoolkit.connection.ConnectionResponse;
@@ -59,11 +60,16 @@ import org.onap.ccsdk.sli.plugins.grtoolkit.resolver.HealthResolver;
import org.onap.ccsdk.sli.plugins.grtoolkit.resolver.SingleNodeHealthResolver;
import org.onap.ccsdk.sli.plugins.grtoolkit.resolver.SixNodeHealthResolver;
import org.onap.ccsdk.sli.plugins.grtoolkit.resolver.ThreeNodeHealthResolver;
+
+import org.json.JSONArray;
+import org.json.JSONObject;
+
import org.opendaylight.controller.cluster.datastore.DistributedDataStoreInterface;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.DataTreeChangeListener;
-import org.opendaylight.mdsal.binding.api.NotificationPublishService;
-import org.opendaylight.mdsal.binding.api.RpcProviderService;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.AdminHealthInput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.AdminHealthOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.AdminHealthOutputBuilder;
@@ -92,9 +98,9 @@ import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.SiteIdentifierOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.SiteIdentifierOutputBuilder;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.site.health.output.SitesBuilder;
-import org.opendaylight.yangtools.concepts.ObjectRegistration;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -127,8 +133,8 @@ public class GrToolkitProvider implements AutoCloseable, GrToolkitService, DataT
private final ExecutorService executor;
protected DataBroker dataBroker;
protected NotificationPublishService notificationService;
- protected RpcProviderService rpcRegistry;
- protected ObjectRegistration<GrToolkitService> rpcRegistration;
+ protected RpcProviderRegistry rpcRegistry;
+ protected BindingAwareBroker.RpcRegistration<GrToolkitService> rpcRegistration;
protected DbLibService dbLib;
private String member;
private ClusterActor self;
@@ -149,7 +155,7 @@ public class GrToolkitProvider implements AutoCloseable, GrToolkitService, DataT
*/
public GrToolkitProvider(DataBroker dataBroker,
NotificationPublishService notificationProviderService,
- RpcProviderService rpcProviderRegistry,
+ RpcProviderRegistry rpcProviderRegistry,
DistributedDataStoreInterface configDatastore,
DbLibService dbLibService) {
log.info("Creating provider for {}", APP_NAME);
@@ -171,7 +177,7 @@ public class GrToolkitProvider implements AutoCloseable, GrToolkitService, DataT
createContainers();
setProperties();
defineMembers();
- rpcRegistration = rpcRegistry.registerRpcImplementation(GrToolkitService.class, this);
+ rpcRegistration = rpcRegistry.addRpcImplementation(GrToolkitService.class, this);
log.info("Initialization complete for {}", APP_NAME);
}
diff --git a/plugins/grToolkit/provider/src/main/resources/org/opendaylight/blueprint/GrToolkit.xml b/plugins/grToolkit/provider/src/main/resources/org/opendaylight/blueprint/GrToolkit.xml
index 300c1cc75..5a4492c56 100644
--- a/plugins/grToolkit/provider/src/main/resources/org/opendaylight/blueprint/GrToolkit.xml
+++ b/plugins/grToolkit/provider/src/main/resources/org/opendaylight/blueprint/GrToolkit.xml
@@ -4,13 +4,16 @@
odl:use-default-for-reference-types="true">
<reference id="dataBroker"
- interface="org.opendaylight.controller.md.sal.binding.api.DataBroker" />
+ interface="org.opendaylight.controller.md.sal.binding.api.DataBroker"
+ odl:type="default" />
<reference id="notificationService"
- interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService" />
+ interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService"
+ odl:type="default" />
<reference id="rpcRegistry"
- interface="org.opendaylight.mdsal.binding.api.RpcProviderService" />
+ interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry"
+ odl:type="default" />
<reference id="dbLib"
interface="org.onap.ccsdk.sli.core.dblib.DbLibService" />
diff --git a/plugins/grToolkit/provider/src/test/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProviderTest.java b/plugins/grToolkit/provider/src/test/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProviderTest.java
index 6495c89cf..edd6d1b8d 100644
--- a/plugins/grToolkit/provider/src/test/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProviderTest.java
+++ b/plugins/grToolkit/provider/src/test/java/org/onap/ccsdk/sli/plugins/grtoolkit/GrToolkitProviderTest.java
@@ -20,42 +20,25 @@
*/
package org.onap.ccsdk.sli.plugins.grtoolkit;
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
+
import com.google.common.util.concurrent.ListenableFuture;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Properties;
-import java.util.concurrent.ExecutionException;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
+
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.contrib.java.lang.system.EnvironmentVariables;
+
import org.onap.ccsdk.sli.core.dblib.DBLibConnection;
import org.onap.ccsdk.sli.core.dblib.DbLibService;
import org.onap.ccsdk.sli.plugins.grtoolkit.data.ClusterActor;
+
import org.opendaylight.controller.cluster.access.concepts.MemberName;
import org.opendaylight.controller.cluster.datastore.DistributedDataStoreInterface;
import org.opendaylight.controller.cluster.datastore.utils.ActorUtils;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.NotificationPublishService;
-import org.opendaylight.mdsal.binding.api.RpcProviderService;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.AdminHealthOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.ClusterHealthOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.DatabaseHealthOutput;
@@ -66,15 +49,38 @@ import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.ResumeAkkaTrafficOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.SiteHealthOutput;
import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.SiteIdentifierOutput;
-import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.resume.akka.traffic.input.NodeInfoBuilder;
import org.opendaylight.yangtools.yang.common.RpcResult;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Properties;
+import java.util.concurrent.ExecutionException;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
public class GrToolkitProviderTest {
GrToolkitProvider provider;
GrToolkitProvider providerSpy;
DataBroker dataBroker;
NotificationPublishService notificationProviderService;
- RpcProviderService rpcProviderRegistry;
+ RpcProviderRegistry rpcProviderRegistry;
DistributedDataStoreInterface configDatastore;
DbLibService dbLibService;
DBLibConnection connection;
@@ -90,7 +96,7 @@ public class GrToolkitProviderTest {
environmentVariables.set("SDNC_CONFIG_DIR","src/test/resources");
dataBroker = mock(DataBroker.class);
notificationProviderService = mock(NotificationPublishService.class);
- rpcProviderRegistry = mock(RpcProviderService.class);
+ rpcProviderRegistry = mock(RpcProviderRegistry.class);
configDatastore = mock(DistributedDataStoreInterface.class);
dbLibService = mock(DbLibService.class);
connection = mock(DBLibConnection.class);
@@ -260,13 +266,11 @@ public class GrToolkitProviderTest {
@Test
public void haltTrafficTest() {
HaltAkkaTrafficInputBuilder builder = new HaltAkkaTrafficInputBuilder();
- builder.setNodeInfo(Arrays.asList(
- new org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.plugins.gr.toolkit.rev180926.halt.akka.traffic.
- input.NodeInfoBuilder().build()));
+ builder.setNodeInfo(new ArrayList<>());
ListenableFuture<RpcResult<HaltAkkaTrafficOutput>> result = provider.haltAkkaTraffic(builder.build());
try {
assertEquals("200", result.get().getResult().getStatus());
- } catch (InterruptedException | ExecutionException e) {
+ } catch(InterruptedException | ExecutionException e) {
fail();
}
}
@@ -274,7 +278,7 @@ public class GrToolkitProviderTest {
@Test
public void resumeTrafficTest() {
ResumeAkkaTrafficInputBuilder builder = new ResumeAkkaTrafficInputBuilder();
- builder.setNodeInfo(Arrays.asList(new NodeInfoBuilder().build()));
+ builder.setNodeInfo(new ArrayList<>());
ListenableFuture<RpcResult<ResumeAkkaTrafficOutput>> result = provider.resumeAkkaTraffic(builder.build());
try {
assertEquals("200", result.get().getResult().getStatus());
diff --git a/plugins/properties-node/provider/src/main/resources/OSGI-INF/blueprint/properties-node-blueprint.xml b/plugins/properties-node/provider/src/main/resources/OSGI-INF/blueprint/properties-node-blueprint.xml
new file mode 100755
index 000000000..6e1d48efd
--- /dev/null
+++ b/plugins/properties-node/provider/src/main/resources/OSGI-INF/blueprint/properties-node-blueprint.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <bean id="propNodeProvider" class="org.onap.ccsdk.sli.plugins.prop.PropertiesNode" />
+
+
+
+ <service ref="propNodeProvider">
+ <interfaces>
+ <value>org.onap.ccsdk.sli.plugins.prop.PropertiesNode</value>
+ </interfaces>
+ </service>
+
+</blueprint> \ No newline at end of file
diff --git a/plugins/restapi-call-node/provider/pom.xml b/plugins/restapi-call-node/provider/pom.xml
index 3b06d720f..a2ee45161 100755
--- a/plugins/restapi-call-node/provider/pom.xml
+++ b/plugins/restapi-call-node/provider/pom.xml
@@ -24,13 +24,6 @@
<type>pom</type>
<scope>import</scope>
</dependency>
- <dependency>
- <groupId>org.glassfish.jersey</groupId>
- <artifactId>jersey-bom</artifactId>
- <version>2.27</version>
- <scope>import</scope>
- <type>pom</type>
- </dependency>
</dependencies>
</dependencyManagement>
<dependencies>
diff --git a/plugins/restapi-call-node/provider/src/main/resources/OSGI-INF/blueprint/restapi-call-node-blueprint.xml b/plugins/restapi-call-node/provider/src/main/resources/OSGI-INF/blueprint/restapi-call-node-blueprint.xml
new file mode 100755
index 000000000..390bb0a35
--- /dev/null
+++ b/plugins/restapi-call-node/provider/src/main/resources/OSGI-INF/blueprint/restapi-call-node-blueprint.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <bean id="restapiCallNodeProvider" class="org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode" />
+
+
+
+ <service ref="restapiCallNodeProvider">
+ <interfaces>
+ <value>org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode</value>
+ </interfaces>
+ </service>
+
+</blueprint> \ No newline at end of file
diff --git a/plugins/restconf-client/provider/pom.xml b/plugins/restconf-client/provider/pom.xml
index 58aa4219b..dbe16754f 100755
--- a/plugins/restconf-client/provider/pom.xml
+++ b/plugins/restconf-client/provider/pom.xml
@@ -24,13 +24,6 @@
<type>pom</type>
<scope>import</scope>
</dependency>
- <dependency>
- <groupId>org.glassfish.jersey</groupId>
- <artifactId>jersey-bom</artifactId>
- <version>2.27</version>
- <scope>import</scope>
- <type>pom</type>
- </dependency>
</dependencies>
</dependencyManagement>
<dependencies>
@@ -38,7 +31,6 @@
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-sse</artifactId>
</dependency>
-
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
@@ -122,11 +114,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>org.glassfish.jersey.inject</groupId>
- <artifactId>jersey-hk2</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
diff --git a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiCallNode.java b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiCallNode.java
index 679ba57b7..620df282f 100644
--- a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiCallNode.java
+++ b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiCallNode.java
@@ -20,48 +20,23 @@
package org.onap.ccsdk.sli.plugins.restconfapicall;
-import static com.google.common.base.Strings.repeat;
-import static java.lang.String.format;
-import static java.lang.String.valueOf;
-import static org.apache.commons.lang3.StringUtils.join;
-import static org.onap.ccsdk.sli.plugins.restapicall.HttpMethod.DELETE;
-import static org.onap.ccsdk.sli.plugins.restapicall.HttpMethod.GET;
-import static org.onap.ccsdk.sli.plugins.restapicall.HttpMethod.PATCH;
-import static org.onap.ccsdk.sli.plugins.restapicall.HttpMethod.PUT;
-import static org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode.parseParam;
-import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.COLON;
-import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.COMMA;
-import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.HEADER;
-import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.HTTP_REQ;
-import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.HTTP_RES;
-import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.REQ_ERR;
-import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.RES_CODE;
-import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.RES_MSG;
-import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.RES_PRE;
-import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.getSchemaCtxFromDir;
-import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.getUpdatedXmlReq;
-import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.getYangParameters;
-import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.parseUrl;
-import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DfListenerFactory.instance;
-import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DfSerializerUtil.FORMAT_ERR;
-import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DfSerializerUtil.UTF_HEADER;
-import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DfSerializerUtil.XML_TREE_ERR;
-import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DfSerializerUtil.getXmlWriter;
-import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.MdsalPropertiesNodeUtils.getModuleNamespace;
-import static org.osgi.framework.FrameworkUtil.getBundle;
import com.google.gson.Gson;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.stream.JsonWriter;
+
+import javax.ws.rs.core.UriBuilder;
import java.io.StringWriter;
import java.io.Writer;
import java.net.SocketException;
import java.net.URI;
+import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
@@ -84,7 +59,6 @@ import org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.Namespace;
import org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.PropertiesNodeSerializer;
import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
import org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.api.SchemaNode;
import org.osgi.framework.BundleContext;
@@ -92,6 +66,44 @@ import org.osgi.framework.ServiceReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static com.google.common.base.Strings.repeat;
+import static java.lang.String.format;
+import static java.lang.String.valueOf;
+import static org.apache.commons.lang3.StringUtils.join;
+import static org.onap.ccsdk.sli.plugins.restapicall.HttpMethod.DELETE;
+import static org.onap.ccsdk.sli.plugins.restapicall.HttpMethod.GET;
+import static org.onap.ccsdk.sli.plugins.restapicall.HttpMethod.PATCH;
+import static org.onap.ccsdk.sli.plugins.restapicall.HttpMethod.PUT;
+import static org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode.parseParam;
+import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.ATTEMPTS_MSG;
+import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.COLON;
+import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.COMMA;
+import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.COMM_FAIL;
+import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.HEADER;
+import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.HTTP_REQ;
+import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.HTTP_RES;
+import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.MAX_RETRY_ERR;
+import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.NO_MORE_RETRY;
+import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.REQ_ERR;
+import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.REST_API_URL;
+import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.RES_CODE;
+import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.RES_MSG;
+import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.RES_PRE;
+import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.RETRY_COUNT;
+import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.RETRY_FAIL;
+import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.UPDATED_URL;
+import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.getSchemaCtxFromDir;
+import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.getUpdatedXmlReq;
+import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.getYangParameters;
+import static org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiUtils.parseUrl;
+import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DfListenerFactory.instance;
+import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DfSerializerUtil.FORMAT_ERR;
+import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DfSerializerUtil.UTF_HEADER;
+import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DfSerializerUtil.XML_TREE_ERR;
+import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.DfSerializerUtil.getXmlWriter;
+import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.MdsalPropertiesNodeUtils.getModuleNamespace;
+import static org.osgi.framework.FrameworkUtil.getBundle;
+
/**
* Representation of a plugin to enable RESTCONF based CRUD operations from DG.
*/
@@ -287,7 +299,7 @@ public class RestconfApiCallNode implements SvcLogicJavaPlugin {
private InstanceIdentifierContext<?> getInsIdCtx(YangParameters params,
String uri)
throws SvcLogicException {
- EffectiveModelContext context = getSchemaContext(params);
+ SchemaContext context = getSchemaContext(params);
return ParserIdentifier.toInstanceIdentifier(uri, context, null);
}
@@ -299,18 +311,18 @@ public class RestconfApiCallNode implements SvcLogicJavaPlugin {
* @return schema context
* @throws SvcLogicException when schema context fetching fails
*/
- private EffectiveModelContext getSchemaContext(YangParameters params)
+ private SchemaContext getSchemaContext(YangParameters params)
throws SvcLogicException {
if (params.dirPath != null) {
return getSchemaCtxFromDir(params.dirPath);
}
BundleContext bc = getBundle(SchemaContext.class).getBundleContext();
- EffectiveModelContext schemaContext = null;
+ SchemaContext schemaContext = null;
if (bc != null) {
ServiceReference reference = bc.getServiceReference(
SchemaContext.class);
if (reference != null) {
- schemaContext = (EffectiveModelContext) bc.getService(reference);
+ schemaContext = (SchemaContext) bc.getService(reference);
}
}
return schemaContext;
diff --git a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiUtils.java b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiUtils.java
index d22c3707a..1309102b3 100644
--- a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiUtils.java
+++ b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/restconfapicall/RestconfApiUtils.java
@@ -22,12 +22,6 @@
package org.onap.ccsdk.sli.plugins.restconfapicall;
-import static org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode.getParameters;
-import static org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode.parseParam;
-import static org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode.DEFAULT_MODE;
-import static org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource.forFile;
-import static org.opendaylight.yangtools.yang.parser.rfc7950.reactor.RFC7950Reactors.defaultReactor;
-import static org.opendaylight.yangtools.yang.parser.rfc7950.repo.YangStatementStreamSource.create;
import java.io.File;
import java.io.IOException;
import java.net.URI;
@@ -39,15 +33,23 @@ import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.plugins.restapicall.HttpMethod;
import org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.YangParameters;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
import org.opendaylight.yangtools.yang.parser.rfc7950.repo.YangStatementStreamSource;
import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
+import static org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode.getParameters;
+import static org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode.parseParam;
+import static org.opendaylight.yangtools.yang.model.repo.api.StatementParserMode.DEFAULT_MODE;
+import static org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource.forFile;
+import static org.opendaylight.yangtools.yang.parser.rfc7950.reactor.RFC7950Reactors.defaultReactor;
+import static org.opendaylight.yangtools.yang.parser.rfc7950.repo.YangStatementStreamSource.create;
+
/**
* Utilities for restconf api call node.
*/
@@ -188,7 +190,7 @@ public final class RestconfApiUtils {
* @return YANG schema context
* @throws SvcLogicException when YANG file reading fails
*/
- static EffectiveModelContext getSchemaCtxFromDir(String di)
+ static SchemaContext getSchemaCtxFromDir(String di)
throws SvcLogicException {
Path d = Paths.get(di);
File dir = d.toFile();
diff --git a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DfSerializerUtil.java b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DfSerializerUtil.java
index 14824f51e..707c29444 100644
--- a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DfSerializerUtil.java
+++ b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/dfserializer/DfSerializerUtil.java
@@ -20,25 +20,6 @@
package org.onap.ccsdk.sli.plugins.yangserializers.dfserializer;
-import static javax.xml.transform.OutputKeys.INDENT;
-import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.XmlNodeType.OBJECT_NODE;
-import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.XmlNodeType.TEXT_NODE;
-import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.MdsalPropertiesNodeUtils.getRevision;
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Iterator;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
import org.dom4j.Element;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.Namespace;
@@ -50,6 +31,27 @@ import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Iterator;
+
+import static javax.xml.transform.OutputKeys.INDENT;
+import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.XmlNodeType.OBJECT_NODE;
+import static org.onap.ccsdk.sli.plugins.yangserializers.dfserializer.XmlNodeType.TEXT_NODE;
+import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.MdsalPropertiesNodeUtils.getRevision;
+
/**
* Utilities for data format serializer.
*/
@@ -177,7 +179,7 @@ public final class DfSerializerUtil {
parentNs.revision());
}
- Iterator<? extends Module> it;
+ Iterator<Module> it;
Module mod;
if (mName != null) {
it = ctx.findModules(mName).iterator();
diff --git a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeSerializer.java b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeSerializer.java
index 8fd7a12bc..8a6e75668 100644
--- a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeSerializer.java
+++ b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeSerializer.java
@@ -20,6 +20,18 @@
package org.onap.ccsdk.sli.plugins.yangserializers.pnserializer;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.onap.ccsdk.sli.core.sli.SvcLogicException;
+import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaNode;
+import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.MdsalPropertiesNodeUtils.DOT_REGEX;
import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.MdsalPropertiesNodeUtils.SLASH;
import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.MdsalPropertiesNodeUtils.getChildSchemaNode;
@@ -37,21 +49,11 @@ import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.NodeType.M
import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.NodeType.MULTI_INSTANCE_NODE;
import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.NodeType.SINGLE_INSTANCE_LEAF_NODE;
import static org.onap.ccsdk.sli.plugins.yangserializers.pnserializer.NodeType.SINGLE_INSTANCE_NODE;
-import java.util.HashMap;
-import java.util.Map;
-import org.onap.ccsdk.sli.core.sli.SvcLogicException;
-import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.SchemaNode;
-import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* Representation of mdsal based properties node serializer implementation.
*/
-public class MdsalPropertiesNodeSerializer extends PropertiesNodeSerializer<SchemaNode, EffectiveModelContext> {
+public class MdsalPropertiesNodeSerializer extends PropertiesNodeSerializer<SchemaNode, SchemaContext> {
private static final Logger log = LoggerFactory.getLogger(
MdsalPropertiesNodeSerializer.class);
@@ -66,7 +68,7 @@ public class MdsalPropertiesNodeSerializer extends PropertiesNodeSerializer<Sche
* @param uri URL of the request
*/
public MdsalPropertiesNodeSerializer(SchemaNode schemaNode,
- EffectiveModelContext schemaCtx, String uri) {
+ SchemaContext schemaCtx, String uri) {
super(schemaNode, schemaCtx, uri);
}
diff --git a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeUtils.java b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeUtils.java
index 331f01cb7..e6fa064f5 100644
--- a/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeUtils.java
+++ b/plugins/restconf-client/provider/src/main/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/MdsalPropertiesNodeUtils.java
@@ -20,14 +20,11 @@
package org.onap.ccsdk.sli.plugins.yangserializers.pnserializer;
-import static com.google.common.base.Preconditions.checkArgument;
-import static java.lang.String.format;
-import static java.util.regex.Pattern.quote;
-import static org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier.toInstanceIdentifier;
import java.util.Collection;
import java.util.Deque;
import java.util.Iterator;
import java.util.Optional;
+
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
@@ -36,11 +33,10 @@ import org.opendaylight.yangtools.yang.common.Revision;
import org.opendaylight.yangtools.yang.data.impl.schema.SchemaUtils;
import org.opendaylight.yangtools.yang.data.util.ParserStreamUtils;
import org.opendaylight.yangtools.yang.data.util.codec.IdentityCodecUtil;
-import org.opendaylight.yangtools.yang.model.api.AnyxmlSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
import org.opendaylight.yangtools.yang.model.api.AugmentationSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
@@ -48,6 +44,11 @@ import org.opendaylight.yangtools.yang.model.api.SchemaNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static com.google.common.base.Preconditions.checkArgument;
+import static java.lang.String.format;
+import static java.util.regex.Pattern.quote;
+import static org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier.toInstanceIdentifier;
+
/**
* Represents utilities for properties node tree.
*/
@@ -261,12 +262,12 @@ public final class MdsalPropertiesNodeUtils {
* @return schema path holder
*/
public static SchemaPathHolder getProcessedPath(String uri,
- EffectiveModelContext context) {
+ SchemaContext context) {
String uri1 = uri.replaceAll(UNDERSCORE, COLON);
try {
InstanceIdentifierContext<?> id = toInstanceIdentifier(
- uri1, context, Optional.ofNullable(null));
+ uri1, context, null);
return new SchemaPathHolder(id, uri1);
} catch (IllegalArgumentException | RestconfDocumentedException
| NullPointerException e) {
@@ -288,7 +289,7 @@ public final class MdsalPropertiesNodeUtils {
* @return schema and path holder
*/
private static SchemaPathHolder processNodesAndAppendPath(String uri,
- EffectiveModelContext context) {
+ SchemaContext context) {
String actPath = "";
SchemaPathHolder id = new SchemaPathHolder(null, "");
@@ -329,7 +330,9 @@ public final class MdsalPropertiesNodeUtils {
* @param prefix prefix for the node in the path
* @return schema and path holder
*/
- private static SchemaPathHolder processIdentifier(String node, EffectiveModelContext context, String prefix) {
+ private static SchemaPathHolder processIdentifier(String node,
+ SchemaContext context,
+ String prefix) {
String[] values = node.split(UNDERSCORE);
String val = values[0];
@@ -375,7 +378,7 @@ public final class MdsalPropertiesNodeUtils {
* @param curSchema current schema
* @return namespace of the given node
*/
- static Namespace getNamespace(String childName, EffectiveModelContext ctx,
+ static Namespace getNamespace(String childName, SchemaContext ctx,
PropertiesNode parent, SchemaNode curSchema) {
Namespace parentNs = parent.namespace();
@@ -422,8 +425,8 @@ public final class MdsalPropertiesNodeUtils {
* @param ctx schema context
* @return namespace of the given node name
*/
- private static Namespace getNs(String modName, EffectiveModelContext ctx) {
- Iterator<? extends Module> it = ctx.findModules(modName).iterator();
+ private static Namespace getNs(String modName, SchemaContext ctx) {
+ Iterator<Module> it = ctx.findModules(modName).iterator();
if (it.hasNext()) {
Module m = it.next();
return new Namespace(modName, m.getQNameModule().getNamespace(),
@@ -485,7 +488,7 @@ public final class MdsalPropertiesNodeUtils {
public static NodeType getNodeType(int index, int length, String name,
SchemaNode schema) {
if (index == length-1) {
- if (schema instanceof AnyxmlSchemaNode) {
+ if (schema instanceof AnyXmlSchemaNode){
return NodeType.ANY_XML_NODE;
}
return (isListEntry(name) ? NodeType.MULTI_INSTANCE_LEAF_NODE :
@@ -514,7 +517,9 @@ public final class MdsalPropertiesNodeUtils {
* @return value namespace
* @throws SvcLogicException if identity/module could not be found
*/
- static Namespace getValueNamespace(String value, EffectiveModelContext ctx) throws SvcLogicException {
+ static Namespace getValueNamespace(String value,
+ SchemaContext ctx)
+ throws SvcLogicException {
String prefix = getPrefixFromValue(value);
if (prefix == null) {
return null;
@@ -523,7 +528,7 @@ public final class MdsalPropertiesNodeUtils {
IdentitySchemaNode id = IdentityCodecUtil.parseIdentity(value,
ctx,
prefixToModule -> {
- final Iterator<? extends Module> modules = ctx.findModules(prefix).iterator();
+ final Iterator<Module> modules = ctx.findModules(prefix).iterator();
checkArgument(modules.hasNext(), "Could not find " +
"module %s", prefix);
return modules.next().getQNameModule();
diff --git a/plugins/restconf-client/provider/src/main/resources/OSGI-INF/blueprint/restconf-client-blueprint.xml b/plugins/restconf-client/provider/src/main/resources/OSGI-INF/blueprint/restconf-client-blueprint.xml
new file mode 100755
index 000000000..45c335b13
--- /dev/null
+++ b/plugins/restconf-client/provider/src/main/resources/OSGI-INF/blueprint/restconf-client-blueprint.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * ============LICENSE_START=======================================================
+ * ONAP - CCSDK
+ * ================================================================================
+ * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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=========================================================
+ -->
+
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <reference xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
+ id="restapiCallNodeProvider"
+ interface="org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode"
+ ext:proxy-method="classes"/>
+
+ <bean id="restconfapiCallNodeProvider" class="org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiCallNode" >
+ <argument ref="restapiCallNodeProvider"/>
+ </bean>
+
+ <bean id="restconfDiscoveryNodeProvider" class="org.onap.ccsdk.sli.plugins.restconfdiscovery.RestconfDiscoveryNode" >
+ <argument ref="restconfapiCallNodeProvider"/>
+ </bean>
+
+ <service ref="restconfapiCallNodeProvider">
+ <interfaces>
+ <value>org.onap.ccsdk.sli.plugins.restconfapicall.RestconfApiCallNode</value>
+ </interfaces>
+ </service>
+
+ <service ref="restconfDiscoveryNodeProvider">
+ <interfaces>
+ <value>org.onap.ccsdk.sli.plugins.restconfdiscovery.RestconfDiscoveryNode</value>
+ </interfaces>
+ </service>
+
+</blueprint> \ No newline at end of file
diff --git a/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/PropertiesSerializerTest.java b/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/PropertiesSerializerTest.java
index 2bcd45e2b..c3a6b4ea8 100644
--- a/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/PropertiesSerializerTest.java
+++ b/plugins/restconf-client/provider/src/test/java/org/onap/ccsdk/sli/plugins/yangserializers/pnserializer/PropertiesSerializerTest.java
@@ -19,9 +19,6 @@
*/
package org.onap.ccsdk.sli.plugins.yangserializers.pnserializer;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
@@ -30,16 +27,21 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+
import org.junit.Before;
import org.junit.Test;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
import org.opendaylight.restconf.common.context.InstanceIdentifierContext;
import org.opendaylight.restconf.nb.rfc8040.utils.parser.ParserIdentifier;
-import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertTrue;
+
public final class PropertiesSerializerTest {
- private EffectiveModelContext context;
+ private SchemaContext context;
@Before
public void initialization() throws FileNotFoundException {
@@ -1123,7 +1125,7 @@ public final class PropertiesSerializerTest {
assertThat(l.valueNs().moduleNs().toString(), is("identity:list:second:ns:test:json:ser"));
}
- public static EffectiveModelContext compileYangFile() throws FileNotFoundException {
+ public static SchemaContext compileYangFile() throws FileNotFoundException {
String path = PropertiesSerializerTest.class.getResource("/yang").getPath();
File dir = new File(path);
String[] fileList = dir.list();
diff --git a/plugins/sshapi-call-node/provider/src/main/resources/OSGI-INF/blueprint/sshapi-call-node-blueprint.xml b/plugins/sshapi-call-node/provider/src/main/resources/OSGI-INF/blueprint/sshapi-call-node-blueprint.xml
new file mode 100755
index 000000000..7a5424329
--- /dev/null
+++ b/plugins/sshapi-call-node/provider/src/main/resources/OSGI-INF/blueprint/sshapi-call-node-blueprint.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <bean id="sshapiCallNodeProvider" class="org.onap.ccsdk.sli.plugins.sshapicall.SshApiCallNode" />
+
+
+
+ <service ref="sshapiCallNodeProvider">
+ <interfaces>
+ <value>org.onap.ccsdk.sli.plugins.sshapicall.SshApiCallNode</value>
+ </interfaces>
+ </service>
+
+</blueprint> \ No newline at end of file