summaryrefslogtreecommitdiffstats
path: root/generic-resource-api/provider/src
diff options
context:
space:
mode:
authorGaurav Agrawal <gaurav.agrawal@huawei.com>2017-09-07 19:30:58 +0530
committerGaurav Agrawal <gaurav.agrawal@huawei.com>2017-09-07 19:30:58 +0530
commit5a4c97563b86ce83f90d26479d386724165b95e6 (patch)
tree85a95b7f26b67fe059b5481a71cc5cfd76b5e773 /generic-resource-api/provider/src
parent56dafa72844163db3d2c47cc3e7345fd0ba07c1a (diff)
Replace deprecated APIs with newer one
Replace following deprecated API 1) NotificationProviderService replaced with NotificationPublishService 2) InstanceIdentifier<T> toInstance() replace with build() 3) setProperties replaced with setYangMappingProperties Change-Id: Id3e9f116cb825187bf65cc5ac9d6f49484ab0846 Issue-Id: SDNC-45 Signed-off-by: Gaurav Agrawal <gaurav.agrawal@huawei.com>
Diffstat (limited to 'generic-resource-api/provider/src')
-rw-r--r--generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java20
-rw-r--r--generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiUtil.java2
-rw-r--r--generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev170824/GENERICRESOURCEAPIProviderModule.java2
-rw-r--r--generic-resource-api/provider/src/main/resources/initial/generic-resource-api-provider.xml4
-rw-r--r--generic-resource-api/provider/src/main/yang/GENERIC-RESOURCE-API-provider-impl.yang8
5 files changed, 20 insertions, 16 deletions
diff --git a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java
index 702e4b87..54fb69ba 100644
--- a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java
+++ b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiProvider.java
@@ -11,13 +11,13 @@ import java.util.concurrent.Executors;
import java.util.concurrent.Future;
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.OptimisticLockFailedException;
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.NotificationProviderService;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ContrailRouteTopologyOperationInput;
import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.ContrailRouteTopologyOperationInputBuilder;
@@ -131,17 +131,17 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
private final ExecutorService executor;
protected DataBroker dataBroker;
- protected NotificationProviderService notificationService;
+ protected NotificationPublishService notificationService;
protected RpcProviderRegistry rpcRegistry;
protected BindingAwareBroker.RpcRegistration<GENERICRESOURCEAPIService> rpcRegistration;
public GenericResourceApiProvider(DataBroker dataBroker2,
- NotificationProviderService notificationProviderService,
+ NotificationPublishService notificationPublishService,
RpcProviderRegistry rpcProviderRegistry) {
this.log.info( "Creating provider for " + appName );
executor = Executors.newFixedThreadPool(1);
dataBroker = dataBroker2;
- notificationService = notificationProviderService;
+ notificationService = notificationPublishService;
rpcRegistry = rpcProviderRegistry;
initialize();
@@ -196,7 +196,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
}
public void setNotificationService(
- NotificationProviderService notificationService) {
+ NotificationPublishService notificationService) {
this.notificationService = notificationService;
if( log.isDebugEnabled() ){
log.debug( "Notification Service set to " + (notificationService==null?"null":"non-null") + "." );
@@ -308,7 +308,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
// See if any data exists yet for this siid, if so grab it.
InstanceIdentifier serviceInstanceIdentifier =
InstanceIdentifier.<Services>builder(Services.class)
- .child(Service.class, new ServiceKey(siid)).toInstance();
+ .child(Service.class, new ServiceKey(siid)).build();
ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction();
Optional<Service> data = null;
try {
@@ -351,7 +351,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
// See if any data exists yet for this name/type, if so grab it.
InstanceIdentifier preloadInstanceIdentifier =
InstanceIdentifier.<PreloadVnfs>builder(PreloadVnfs.class)
- .child(VnfPreloadList.class, new VnfPreloadListKey(preload_name, preload_type)).toInstance();
+ .child(VnfPreloadList.class, new VnfPreloadListKey(preload_name, preload_type)).build();
ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction();
Optional<VnfPreloadList> data = null;
try {
@@ -380,7 +380,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
InstanceIdentifier.InstanceIdentifierBuilder<Service> serviceBuilder =
InstanceIdentifier.<Services>builder(Services.class)
.child(Service.class, entry.getKey());
- InstanceIdentifier<Service> path = serviceBuilder.toInstance();
+ InstanceIdentifier<Service> path = serviceBuilder.build();
int tries = 2;
while(true) {
@@ -413,7 +413,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
// Each entry will be identifiable by a unique key, we have to create
// that identifier
InstanceIdentifier.InstanceIdentifierBuilder<Service> serviceListIdBuilder = InstanceIdentifier.<Services> builder(Services.class).child(Service.class, entry.getKey());
- InstanceIdentifier<Service> path = serviceListIdBuilder.toInstance();
+ InstanceIdentifier<Service> path = serviceListIdBuilder.build();
int tries = 2;
while (true) {
@@ -444,7 +444,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC
InstanceIdentifier.InstanceIdentifierBuilder<VnfPreloadList> vnfPreloadListBuilder =
InstanceIdentifier.<PreloadVnfs>builder(PreloadVnfs.class)
.child(VnfPreloadList.class, entry.getKey());
- InstanceIdentifier<VnfPreloadList> path = vnfPreloadListBuilder.toInstance();
+ InstanceIdentifier<VnfPreloadList> path = vnfPreloadListBuilder.build();
int tries = 2;
while(true) {
try {
diff --git a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiUtil.java b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiUtil.java
index 56a2fae7..5b534bbc 100644
--- a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiUtil.java
+++ b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiUtil.java
@@ -28,7 +28,7 @@ public class GenericResourceApiUtil extends MdsalHelper {
input = new FileInputStream(file);
properties.load(input);
LOG.info("Loaded properties from " + PROPERTIES_FILE );
- setProperties(properties);
+ setYangMappingProperties(properties);
} catch (Exception e) {
LOG.error("Failed to load properties " + PROPERTIES_FILE +"\n",e);
} finally {
diff --git a/generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev170824/GENERICRESOURCEAPIProviderModule.java b/generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev170824/GENERICRESOURCEAPIProviderModule.java
index 3510e25f..443891ba 100644
--- a/generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev170824/GENERICRESOURCEAPIProviderModule.java
+++ b/generic-resource-api/provider/src/main/java/org/opendaylight/yang/gen/v1/org/onap/sdnc/northbound/generic/resource/api/provider/impl/rev170824/GENERICRESOURCEAPIProviderModule.java
@@ -19,7 +19,7 @@ public class GENERICRESOURCEAPIProviderModule extends org.opendaylight.yang.gen.
@Override
public java.lang.AutoCloseable createInstance() {
final GenericResourceApiProvider provider = new GenericResourceApiProvider(getDataBrokerDependency()
- , getNotificationServiceDependency()
+ , getNotificationPublishAdapterDependency()
, getRpcRegistryDependency());
return new AutoCloseable() {
diff --git a/generic-resource-api/provider/src/main/resources/initial/generic-resource-api-provider.xml b/generic-resource-api/provider/src/main/resources/initial/generic-resource-api-provider.xml
index b11877fd..a9d3e639 100644
--- a/generic-resource-api/provider/src/main/resources/initial/generic-resource-api-provider.xml
+++ b/generic-resource-api/provider/src/main/resources/initial/generic-resource-api-provider.xml
@@ -29,8 +29,8 @@
</data-broker>
<notification-service>
- <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">
- binding:binding-notification-service
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding:impl">
+ binding:binding-new-notification-publish-service
</type>
<name>binding-notification-broker</name>
</notification-service>
diff --git a/generic-resource-api/provider/src/main/yang/GENERIC-RESOURCE-API-provider-impl.yang b/generic-resource-api/provider/src/main/yang/GENERIC-RESOURCE-API-provider-impl.yang
index fe8be7ff..b2ce7f21 100644
--- a/generic-resource-api/provider/src/main/yang/GENERIC-RESOURCE-API-provider-impl.yang
+++ b/generic-resource-api/provider/src/main/yang/GENERIC-RESOURCE-API-provider-impl.yang
@@ -6,6 +6,10 @@ module GENERIC-RESOURCE-API-provider-impl {
import config { prefix config; revision-date 2013-04-05; }
import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; }
+ import opendaylight-sal-binding-broker-impl {
+ prefix binding-impl;
+ revision-date 2013-10-28;
+ }
description
"This module contains the base YANG definitions for
@@ -39,11 +43,11 @@ module GENERIC-RESOURCE-API-provider-impl {
}
}
- container notification-service {
+ container notification-publish-adapter {
uses config:service-ref {
refine type {
mandatory true;
- config:required-identity mdsal:binding-notification-service;
+ config:required-identity binding-impl:binding-new-notification-publish-service;
}
}
}