diff options
author | Dan Timoney <dtimoney@att.com> | 2017-11-03 17:24:19 -0400 |
---|---|---|
committer | Dan Timoney <dtimoney@att.com> | 2017-11-03 17:47:25 -0400 |
commit | d4d2912f5b8c7f12176ff3304ebbb8f30059f402 (patch) | |
tree | 9de027b587426388c69156cff8c85a95e6246b21 /generic-resource-api/provider/src | |
parent | ce59c2c4496879cb99a9ecf38075096282fbdc11 (diff) |
Fix GENERIC-RESOURCE-API yang model
Add missing enum values and container to yang model
Also, BRG and tunnelxconn's service instance parent
is VNF-API, not GENERIC-RESOURCE-API, so do not
try to retrieve service data.
Change-Id: I12c977a7e621ce654d0d5d38f8ac8f3ad95487bd
Issue-ID: SDNC-166
Signed-off-by: Dan Timoney <dtimoney@att.com>
Diffstat (limited to 'generic-resource-api/provider/src')
2 files changed, 22 insertions, 42 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 a747df6f..1e45ee79 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 @@ -1615,7 +1615,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC } String siid = input.getServiceInformation().getServiceInstanceId(); - +/* // Get the service-instance service data from MD-SAL ServiceDataBuilder serviceDataBuilder = new ServiceDataBuilder(); getServiceData(siid, serviceDataBuilder); @@ -1634,7 +1634,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC RpcResult<TunnelxconnTopologyOperationOutput> rpcResult = RpcResultBuilder .<TunnelxconnTopologyOperationOutput>status(true).withResult(responseBuilder.build()).build(); return Futures.immediateFuture(rpcResult); - } + }*/ log.info("Adding INPUT data for {} [{}] input: {}", SVC_OPERATION, siid, input); TunnelxconnTopologyOperationInputBuilder inputBuilder = new TunnelxconnTopologyOperationInputBuilder(input); @@ -1656,7 +1656,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC if (svcLogicClient.hasGraph(appName, SVC_OPERATION, null, "sync")) { try { - respProps = svcLogicClient.execute(appName, SVC_OPERATION, null, "sync", serviceDataBuilder, parms); + respProps = svcLogicClient.execute(appName, SVC_OPERATION, null, "sync", parms); } catch (Exception e) { log.error("Caught exception executing service logic for {}", SVC_OPERATION, e); errorMessage = e.getMessage(); @@ -1696,24 +1696,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC // Got success from SLI try { - serviceData = serviceDataBuilder.build(); - log.info("Updating MD-SAL for {} [{}] ServiceData: {}", SVC_OPERATION, siid, serviceData); - // service object - ServiceBuilder serviceBuilder = new ServiceBuilder(); - serviceBuilder.setServiceData(serviceData); - serviceBuilder.setServiceInstanceId(siid); - serviceBuilder.setServiceStatus(serviceStatusBuilder.build()); - saveService(serviceBuilder.build(), false, LogicalDatastoreType.CONFIGURATION); - - if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null) { - // Only update operational tree on activate or delete - if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Unassign) - || input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate)) { - log.info("Updating OPERATIONAL tree."); - saveService(serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); - } - } TunnelxconnResponseInformationBuilder tunnelxconnResponseInformationBuilder = new TunnelxconnResponseInformationBuilder(); tunnelxconnResponseInformationBuilder.setInstanceId(allottedResourceId); @@ -1775,7 +1758,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC String siid = input.getServiceInformation().getServiceInstanceId(); - // Get the service-instance service data from MD-SAL +/* // Get the service-instance service data from MD-SAL ServiceDataBuilder serviceDataBuilder = new ServiceDataBuilder(); getServiceData(siid, serviceDataBuilder); @@ -1793,7 +1776,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC RpcResult<BrgTopologyOperationOutput> rpcResult = RpcResultBuilder.<BrgTopologyOperationOutput>status(true) .withResult(responseBuilder.build()).build(); return Futures.immediateFuture(rpcResult); - } + }*/ log.info("Adding INPUT data for {} [{}] input: {}", SVC_OPERATION, siid, input); BrgTopologyOperationInputBuilder inputBuilder = new BrgTopologyOperationInputBuilder(input); @@ -1815,7 +1798,7 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC if (svcLogicClient.hasGraph(appName, SVC_OPERATION, null, "sync")) { try { - respProps = svcLogicClient.execute(appName, SVC_OPERATION, null, "sync", serviceDataBuilder, parms); + respProps = svcLogicClient.execute(appName, SVC_OPERATION, null, "sync", parms); } catch (Exception e) { log.error("Caught exception executing service logic for {}", SVC_OPERATION, e); errorMessage = e.getMessage(); @@ -1855,24 +1838,6 @@ public class GenericResourceApiProvider implements AutoCloseable, GENERICRESOURC // Got success from SLI try { - serviceData = serviceDataBuilder.build(); - log.info("Updating MD-SAL for {} [{}] ServiceData: {}", SVC_OPERATION, siid, serviceData); - - // service object - ServiceBuilder serviceBuilder = new ServiceBuilder(); - serviceBuilder.setServiceData(serviceData); - serviceBuilder.setServiceInstanceId(siid); - serviceBuilder.setServiceStatus(serviceStatusBuilder.build()); - saveService(serviceBuilder.build(), false, LogicalDatastoreType.CONFIGURATION); - - if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null) { - // Only update operational tree on activate or delete - if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Unassign) - || input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate)) { - log.info("Updating OPERATIONAL tree."); - saveService(serviceBuilder.build(), false, LogicalDatastoreType.OPERATIONAL); - } - } BrgResponseInformationBuilder brgResponseInformationBuilder = new BrgResponseInformationBuilder(); brgResponseInformationBuilder.setInstanceId(allottedResourceId); diff --git a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiSvcLogicServiceClient.java b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiSvcLogicServiceClient.java index 8ba70dee..b000ed47 100644 --- a/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiSvcLogicServiceClient.java +++ b/generic-resource-api/provider/src/main/java/org/onap/sdnc/northbound/GenericResourceApiSvcLogicServiceClient.java @@ -1,5 +1,5 @@ /*- - * ============LICENSE_START======================================================= +z * ============LICENSE_START======================================================= * openECOMP : SDN-C * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights @@ -106,6 +106,21 @@ public class GenericResourceApiSvcLogicServiceClient { return respProps; } + public Properties execute(String module, String rpc, String version, String mode, Properties properties) + throws SvcLogicException { + + printPropsDebugLogs(properties, "Parameters passed to SLI"); + + Properties respProps = svcLogic.execute(module, rpc, version, mode, properties); + printPropsDebugLogs(respProps, "Parameters returned by SLI"); + if (respProps == null || FAILURE_RESULT.equalsIgnoreCase(respProps.getProperty(SVC_LOGIC_STATUS_KEY))) { + return (respProps); + } + + return respProps; + } + + private void printPropsDebugLogs(Properties properties, String msg) { if (!LOG.isDebugEnabled()) { return; |