diff options
author | Luji7 <lu.ji3@zte.com.cn> | 2017-10-24 15:17:11 +0800 |
---|---|---|
committer | Luji7 <lu.ji3@zte.com.cn> | 2017-10-24 15:17:19 +0800 |
commit | eccd508e64bc3004bc2f1d963feaa3ae88e4e663 (patch) | |
tree | 0369c3918e0928cb2b5d6b9644624a50700bd9f3 | |
parent | 24ce28e83cb4faf805a88f0cb4c98a73ed633a57 (diff) |
modify request body for creating service.
Change-Id: I80597fa628b1b0b834957caba320f55d8014db47
Issue-id: USECASEUI-53
Signed-off-by: Luji7 <lu.ji3@zte.com.cn>
-rw-r--r-- | usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/ServiceTemplateService.js | 98 | ||||
-rw-r--r-- | usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/lcmController.js | 3 |
2 files changed, 49 insertions, 52 deletions
diff --git a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/ServiceTemplateService.js b/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/ServiceTemplateService.js index 908113a2..4f18a547 100644 --- a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/ServiceTemplateService.js +++ b/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/ServiceTemplateService.js @@ -145,66 +145,60 @@ }, createService: function (customer, serviceType, service, template) { - - function translateInputs(t, customer,serviceType, c, isE2E) { - var reqParas = { - subscriptionServiceType: serviceType.id - }; - var vfLocations = []; - c[t.name].parameters.forEach(function (parameter) { - if(parameter.type === 'vf_location') { - var loc = {}; - loc[parameter.name] = parameter.value.value; - vfLocations.push(loc); - } else if(parameter.type === 'sdn_controller') { - if(parameter.value === undefined || parameter.value === null) { - reqParas[parameter.name] = ''; - } else { - reqParas[parameter.name] = parameter.value.value; - } - } else { - reqParas[parameter.name] = parameter.value; - } - }); - if(t.type === 'VF') { - reqParas.vnfProfileId = vfLocations; - } - var nestedSegments = t.nestedTemplates.map(function (nestedTemplate) { - return translateInputs(nestedTemplate,customer,serviceType, c, false); - }); - var request = {}; - if(isE2E) { - request.domainHost = 'localhost'; - } - request.nodeTemplateName = t.name+':'+t.version; - request.nodeType = 'service'; - request['GLOBALSUBSCIBERID'] = customer.id; - request['SUBSCIBERNAME'] = customer.name; - request.requestParameters = reqParas; - request.segments = nestedSegments; - return request; - } - - var cache = {}; - cache[template.name] = { - parameters: service.parameters - }; + var reqPara = []; service.segments.forEach(function (segment) { - cache[segment.nodeTemplateName] = { - parameters: segment.parameters - } + var reqParas = {}; + var vfLocations = []; + segment.parameters.forEach(function (parameter) { + if(parameter.type === 'vf_location') { + // name is uuid for vf_location + var loc = { + vnfProfileId: parameter.name, + locationConstraints : { + vimId: parameter.value.value + } + }; + vfLocations.push(loc); + } else if(parameter.type === 'sdn_controller') { + if(parameter.value === undefined || parameter.value === null) { + reqParas[parameter.name] = ''; + } else { + reqParas[parameter.name] = parameter.value.value; + } + } else { + reqParas[parameter.name] = parameter.value; + } + }); + + var para = { + resourceName: segment.nodeTemplateName, + resourceDefId: segment.invariantUUID, + resourceId: segment.uuid, + nsParameters: { + locationConstraints: vfLocations, + additionalParamForNs: reqParas + } + }; + reqPara.push(para); }); - console.log('cache ----'); - console.log(cache); - var reqPara = translateInputs(template,customer, serviceType, cache, true); + var templateName = template.name; + if( template.version !== undefined && template.version !== null && template.version !== '' ) { + templateName = templateName + ":" + template.version; + } var requestBody = { service: { name: service.serviceName, description: service.serviceDescription, serviceDefId: template.invariantUUID, templateId: template.uuid, // uuid ?? - parameters: reqPara + parameters: { + globalSubscriberId: customer.id, + subscriberName: customer.name, + serviceType: serviceType, + templateName: templateName, + resources: reqPara + } } }; @@ -269,7 +263,7 @@ console.log(vims); var requestBody = { csarId: onboardPackage.uuid - } + }; if(onboardPackage.type === 'NS') { return $http({ url: url+'/ns-packages', diff --git a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/lcmController.js b/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/lcmController.js index 498f93e0..95ee1ada 100644 --- a/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/lcmController.js +++ b/usecaseui-lcm/src/main/webapp/app/uui/fusion/scripts/controller/lcmController.js @@ -139,6 +139,9 @@ app.controller('lcmCtrl', ['$scope', '$uibModal', '$log', '$http', '$timeout', ' }); return { nodeTemplateName: nestedTemplate.name, + invariantUUID: nestedTemplate.invariantUUID, + uuid: nestedTemplate.uuid, + type: nestedTemplate.type, parameters: nestedParas }; }); |