From 68916981c0404b7ba7296d00f1862fcabd2ede57 Mon Sep 17 00:00:00 2001 From: Pérez Caparrós David Date: Fri, 14 Feb 2020 10:42:25 +0100 Subject: Fix CreateSDNCNetworkResource.updateResourceInput() for BBS use case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added AccessConnectivity and InternetProfile to the switch cases. OLT and EdgeInternetProfile are not in use anymore. The use of getMetadatum needs further investigation, service instance metadata is only populated by SDNC DG and it is not available at this stage. Issue-ID: SO-2611 Signed-off-by: Pérez Caparrós David Change-Id: Ia035dd9fb2aa33e361fe78b8a97d8148a106bbb2 --- .../scripts/CreateSDNCNetworkResource.groovy | 76 +++++++++------------- 1 file changed, 29 insertions(+), 47 deletions(-) (limited to 'bpmn/so-bpmn-infrastructure-common/src') diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index 4b3c1aa7b4..3da4161953 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -163,36 +163,20 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String serInput = jsonUtil.getJsonValue(resourceInputTmp, "requestsInputs") switch (modelName) { - case ~/[\w\s\W]*OLT[\w\s\W]*/ : + case ~/[\w\s\W]*OLT[\w\s\W]*/ : // for backward compatibilty only, this case will be deprecated + case ~/[\w\s\W]*AccessConnectivity[\w\s\W]*/ : // get the required properties and update in resource input def resourceInput = resourceInputObj.getResourceParameters() String incomingRequest = resourceInputObj.getRequestsInputs() String serviceParameters = JsonUtils.getJsonValue(incomingRequest, "service.parameters") String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs") - String cvlan - String svlan - String remoteId - - List metadatum = getMetaDatum(resourceInputObj.getGlobalSubscriberId(), - resourceInputObj.getServiceType(), - resourceInputObj.getServiceInstanceId()) - for(Metadatum datum: metadatum) { - if (datum.getMetaname().equalsIgnoreCase("cvlan")) { - cvlan = datum.getMetaval() - } - - if (datum.getMetaname().equalsIgnoreCase("svlan")) { - svlan = datum.getMetaval() - } - - if (datum.getMetaname().equalsIgnoreCase("remoteId")) { - remoteId = datum.getMetaval() - } - } - - logger.debug("cvlan: "+cvlan+" | svlan: "+svlan+" | remoteId: "+remoteId) - + String cvlan = jsonUtil.getJsonValue(serInput, + "service.parameters.requestInputs.cvlan") + String svlan = jsonUtil.getJsonValue(serInput, + "service.parameters.requestInputs.svlan") + String remoteId = jsonUtil.getJsonValue(serInput, + "service.parameters.requestInputs.edgeinternetprofile_ip_remote_id") String manufacturer = jsonUtil.getJsonValue(serInput, "service.parameters.requestInputs.ont_ont_manufacturer") String ontsn = jsonUtil.getJsonValue(serInput, @@ -209,7 +193,8 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { logger.debug("new resource Input :" + resourceInputObj.toString()) break - case ~/[\w\s\W]*EdgeInternetProfile[\w\s\W]*/ : + case ~/[\w\s\W]*EdgeInternetProfile[\w\s\W]*/ : // for backward compatibilty only, this case will be deprecated + case ~/[\w\s\W]*InternetProfile[\w\s\W]*/ : // get the required properties and update in resource input def resourceInput = resourceInputObj.getResourceParameters() String incomingRequest = resourceInputObj.getRequestsInputs() @@ -217,37 +202,34 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs") JSONObject inputParameters = new JSONObject(requestInputs) - String cvlan - String svlan - String remoteId + String cvlan = jsonUtil.getJsonValue(serInput, + "service.parameters.requestInputs.cvlan") + String svlan = jsonUtil.getJsonValue(serInput, + "service.parameters.requestInputs.svlan") String manufacturer = jsonUtil.getJsonValue(serInput, "service.parameters.requestInputs.ont_ont_manufacturer") - + String remoteId = jsonUtil.getJsonValue(serInput, + "service.parameters.requestInputs.edgeinternetprofile_ip_remote_id") String ontsn = jsonUtil.getJsonValue(serInput, "service.parameters.requestInputs.ont_ont_serial_num") - - List metadatum = getMetaDatum(resourceInputObj.getGlobalSubscriberId(), - resourceInputObj.getServiceType(), - resourceInputObj.getServiceInstanceId()) - for(Metadatum datum: metadatum) { - if (datum.getMetaname().equalsIgnoreCase("cvlan")) { - cvlan = datum.getMetaval() - } - - if (datum.getMetaname().equalsIgnoreCase("svlan")) { - svlan = datum.getMetaval() - } - - if (datum.getMetaname().equalsIgnoreCase("remoteId")) { - remoteId = datum.getMetaval() - } - } + String serviceType = jsonUtil.getJsonValue(serInput, + "service.parameters.requestInputs.edgeinternetprofile_ip_service_type") + String macAddr = jsonUtil.getJsonValue(serInput, + "service.parameters.requestInputs.edgeinternetprofile_ip_rg_mac_addr") + String upStream = jsonUtil.getJsonValue(serInput, + "service.parameters.requestInputs.edgeinternetprofile_ip_upstream_speed") + String downStream = jsonUtil.getJsonValue(serInput, + "service.parameters.requestInputs.edgeinternetprofile_ip_downstream_speed") String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.c_vlan", cvlan) uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.s_vlan", svlan) uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.manufacturer", manufacturer) - uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_access_id", remoteId) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_remote_id", remoteId) uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ont_sn", ontsn) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_service_type", serviceType) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_rg_mac_addr", macAddr) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_upstream_speed", upStream) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.ip_downstream_speed", downStream) logger.debug("old resource input:" + resourceInputObj.toString()) resourceInputObj.setResourceParameters(uResourceInput) execution.setVariable(Prefix + "resourceInput", resourceInputObj.toString()) -- cgit 1.2.3-korg