diff options
Diffstat (limited to 'usecaseui-lcm')
-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 }; }); |