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 | |
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')
4 files changed, 184 insertions, 0 deletions
diff --git a/sdnr/northbound/oofpcipoc/model/src/main/yang/oofpcipoc-api.yang b/sdnr/northbound/oofpcipoc/model/src/main/yang/oofpcipoc-api.yang index 706a8b5dd..a6880909e 100644 --- a/sdnr/northbound/oofpcipoc/model/src/main/yang/oofpcipoc-api.yang +++ b/sdnr/northbound/oofpcipoc/model/src/main/yang/oofpcipoc-api.yang @@ -94,4 +94,14 @@ module oofpcipoc-api { } } + rpc handle-nbrlist-change-notif { + description + "Handle nbrlist-change-notification: update configDB & publish DMAAP message"; + input { + uses oofpcipoc:handle-nbrlist-change-notif-request; + } + output { + uses oofpcipoc:oofpcipoc-rpc-response; + } + } } diff --git a/sdnr/northbound/oofpcipoc/model/src/main/yang/oofpcipoc.yang b/sdnr/northbound/oofpcipoc/model/src/main/yang/oofpcipoc.yang index 98978c342..2a7a260b6 100644 --- a/sdnr/northbound/oofpcipoc/model/src/main/yang/oofpcipoc.yang +++ b/sdnr/northbound/oofpcipoc/model/src/main/yang/oofpcipoc.yang @@ -34,6 +34,11 @@ module oofpcipoc { ""; } + typedef payload { + type string ; + description "The payload can be any valid JSON string value. Json escape characters need to be added when required to include an inner json within the payload to make it a valid json string value"; + } + grouping configuration-phy-cell-id-request { leaf fap-service-number-of-entries { @@ -143,9 +148,57 @@ module oofpcipoc { length "0..52"; } } + leaf pnf-name { + type string { + length "0..256"; + } + description + "PNF name "; + } } } + grouping handle-nbrlist-change-notif-request { + + description + "Input payload for handle-nbrlist-change-notif RPC for this POC"; + + leaf fap-service-number-of-entries-changed { + type uint64; + description + "Number of cells for which neighbor list has changed"; + } + list fap-service { + key "alias"; + leaf alias { + type string { + length "1..64"; + } + } + leaf cid { + type string { + length "0..52"; + } + } + uses x-0005b9-lte-g; + leaf lte-cell-number-of-entries { + type uint64; + description + "Number of cells in a neighbor list that was changed"; + } + list lte-ran-neighbor-list-in-use-lte-cell-changed { + key "plmnid cid"; + uses lte-ran-neighbor-list-in-use-lte-cell-g; + description + "Changed/Modified List of cells in a neighbor list for this fap service"; + } + } + leaf payload { + type payload; + mandatory true; + } + } + grouping oofpcipoc-rpc-response { leaf response-code { type string; @@ -383,6 +436,7 @@ module oofpcipoc { length "0..52"; } } + uses x-0005b9-lte-g; leaf lte-cell-number-of-entries { type uint64; description 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); + } } |