diff options
author | Sandeep Shah <sandeep.shah2@techmahindra.com> | 2019-06-13 07:28:11 -0500 |
---|---|---|
committer | Sandeep Shah <sandeep.shah2@techmahindra.com> | 2019-06-13 07:28:11 -0500 |
commit | 095dd963db05e7e19810e0f3b32cc9f3a7704de1 (patch) | |
tree | cb253d8c1f14a7134aeca087c1c486594826e018 /sdnr/northbound/oofpcipoc/provider | |
parent | 47fc603b864b52a70157515f29ec741dd9192f3a (diff) |
YANG Model and Provider Code Updates SDNR OOFPCIPOC
Additional leaf nodes for Netconf notification for neigbor
list change, RPC to handle notification, and corresponding
updates to provider code
Issue-ID: CCSDK-1375
Signed-off-by: SandeepLinux <sandeeplinux1068@gmail.com>
Change-Id: I3d092ca9bdb42ce90bc5f69f0035ce806de997a6
Diffstat (limited to 'sdnr/northbound/oofpcipoc/provider')
2 files changed, 120 insertions, 0 deletions
diff --git a/sdnr/northbound/oofpcipoc/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/oofpcipoc/OofpcipocClient.java b/sdnr/northbound/oofpcipoc/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/oofpcipoc/OofpcipocClient.java index eca01d990..b79465888 100644 --- a/sdnr/northbound/oofpcipoc/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/oofpcipoc/OofpcipocClient.java +++ b/sdnr/northbound/oofpcipoc/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/oofpcipoc/OofpcipocClient.java @@ -31,6 +31,7 @@ import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev190308.ConfigurationPhyCel import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev190308.AddNeighborOutputBuilder; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev190308.DeleteNeighborOutputBuilder; import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev190308.GenericNeighborConfigurationOutputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev190308.HandleNbrlistChangeNotifOutputBuilder; import org.slf4j.Logger; @@ -304,4 +305,55 @@ public Properties execute(String module, String rpc, String version, String mode return respProps; } + +// handleNbrlistChangeNotif + public Properties execute(String module, String rpc, String version, String mode, HandleNbrlistChangeNotifOutputBuilder serviceData) + throws SvcLogicException { + + Properties parms = new Properties(); + + return execute(module,rpc,version, mode,serviceData,parms); + } + + public Properties execute(String module, String rpc, String version, String mode, HandleNbrlistChangeNotifOutputBuilder serviceData, Properties parms) + throws SvcLogicException { + Properties localProp; + localProp = MdsalHelper.toProperties(parms, serviceData); + + if (LOG.isDebugEnabled()) + { + LOG.debug("Parameters passed to SLI"); + + for (Object key : localProp.keySet()) { + String parmName = (String) key; + String parmValue = localProp.getProperty(parmName); + + LOG.debug(parmName+" = "+parmValue); + + } + } + + Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp); + + if (LOG.isDebugEnabled()) + { + LOG.debug("Parameters returned by SLI"); + + for (Object key : respProps.keySet()) { + String parmName = (String) key; + String parmValue = respProps.getProperty(parmName); + + LOG.debug(parmName+" = "+parmValue); + + } + } + if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) { + return respProps; + } + + MdsalHelper.toBuilder(respProps, serviceData); + + return respProps; + } + } diff --git a/sdnr/northbound/oofpcipoc/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/oofpcipoc/OofpcipocProvider.java b/sdnr/northbound/oofpcipoc/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/oofpcipoc/OofpcipocProvider.java index f52a72d10..bfb9b04f2 100644 --- a/sdnr/northbound/oofpcipoc/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/oofpcipoc/OofpcipocProvider.java +++ b/sdnr/northbound/oofpcipoc/provider/src/main/java/org/onap/ccsdk/features/sdnr/northbound/oofpcipoc/OofpcipocProvider.java @@ -441,5 +441,73 @@ public class OofpcipocProvider implements AutoCloseable, OofpcipocApiService { return Futures.immediateFuture(rpcResult); } + // RPC handle-nbrlist-change-notif + @Override + public ListenableFuture<RpcResult<HandleNbrlistChangeNotifOutput>> handleNbrlistChangeNotif( + HandleNbrlistChangeNotifInput input) { + final String svcOperation = "handle-nbrlist-change-notif"; + + Properties parms = new Properties(); + HandleNbrlistChangeNotifOutputBuilder serviceDataBuilder = new HandleNbrlistChangeNotifOutputBuilder(); + + LOG.info( "Reached RPC handle-nbrlist-change-notif"); + + LOG.info( svcOperation +" called." ); + + if(input == null ) { + LOG.debug("exiting " +svcOperation+ " because of invalid input"); + serviceDataBuilder.setResponseCode("Input is null"); + RpcResult<HandleNbrlistChangeNotifOutput> rpcResult = + RpcResultBuilder.<HandleNbrlistChangeNotifOutput> status(true).withResult(serviceDataBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + // add input to parms + LOG.info("Adding INPUT data for "+svcOperation+" input: " + input); + HandleNbrlistChangeNotifInputBuilder inputBuilder = new HandleNbrlistChangeNotifInputBuilder(input); + MdsalHelper.toProperties(parms, inputBuilder.build()); + + // Call SLI sync method + try + { + if (OofpcipocClient.hasGraph("Oofpcipoc", svcOperation , null, "sync")) + { + LOG.info( "OofpcipocClient has a Directed Graph for '" + svcOperation + "'"); + try + { + OofpcipocClient.execute("Oofpcipoc", svcOperation, null, "sync", serviceDataBuilder, parms); + } + catch (Exception e) + { + LOG.error("Caught exception executing service logic for "+ svcOperation, e); + serviceDataBuilder.setResponseCode("500"); + } + } else { + LOG.error("No service logic active for Oofpcipoc: '" + svcOperation + "'"); + serviceDataBuilder.setResponseCode("503"); + } + } + catch (Exception e) + { + LOG.error("Caught exception looking for service logic", e); + serviceDataBuilder.setResponseCode("500"); + } + + String errorCode = serviceDataBuilder.getResponseCode(); + + if (!("0".equals(errorCode) || "200".equals(errorCode))) { + LOG.error("Returned FAILED for "+svcOperation+" error code: '" + errorCode + "'"); + } else { + LOG.info("Returned SUCCESS for "+svcOperation+" "); + serviceDataBuilder.setResponseCode("Welcome OOF POC. Number of FAP services changed = " + input.getFapServiceNumberOfEntriesChanged()); + } + + RpcResult<HandleNbrlistChangeNotifOutput> rpcResult = + RpcResultBuilder.<HandleNbrlistChangeNotifOutput> status(true).withResult(serviceDataBuilder.build()).build(); + + LOG.info("Successful exit from handle-nbrlist-change-notif "); + + return Futures.immediateFuture(rpcResult); + } } |