# print nsr_object
if descriptor_type == 'nsd':
result_graph = parser.nsd_to_graph(descriptor_updated)
+ if descriptor_type == 'vnfd':
+ descriptor_result = client.vnfd_get(user.get_token(), descriptor_id)
+ util = OsmUtil()
+ payload = request.POST.dict()
+ if element_type == 'graph_params':
+ descriptor_updated = util.update_graph_params('vnfd', descriptor_result, json.loads(payload['update']))
+ else:
+ descriptor_updated = util.update_node('vnfd', descriptor_result, element_type, json.loads(payload['old']), json.loads(payload['update']))
+ result = client.vnfd_update(user.get_token(), descriptor_id, descriptor_updated)
+ if result['error'] == True:
+ return __response_handler(request, result['data'], url=None,
+ status=result['data']['status'] if 'status' in result['data'] else 500)
+ else:
+ parser = OsmParser()
+ if descriptor_type == 'vnfd':
+ result_graph = parser.vnfd_to_graph(descriptor_updated)
return __response_handler(request, result_graph, url=None, status=200)
if str(v['member-vnf-index']) == str(old['member-vnf-index']) and str(v['vnfd-id-ref']) == str(
old['vnfd-id-ref']):
print 'update here'
+ elif descriptor_type == 'vnfd':
+ if 'vnfd-catalog' in descriptor:
+ vnfd = descriptor['vnfd-catalog']['vnfd'][0]
+ elif 'vnfd:vnfd-catalog' in descriptor:
+ vnfd = descriptor['vnfd:vnfd-catalog']['vnfd'][0]
+
+ if node_type == 'vnf_vl':
+ for k, v in enumerate(vnfd['internal-vld']):
+ if v['id'] == old['id']:
+ vnfd['internal-vld'][k].update(updated)
+ if node_type == 'cp':
+ for k, v in enumerate(vnfd['connection-point']):
+ if v['name'] == old['name']:
+ vnfd['connection-point'][k].update(updated)
+ if node_type == 'vdu':
+ for k, v in enumerate(vnfd['vdu']):
+ if v['name'] == old['name']:
+ vnfd['vdu'][k].update(updated)
return descriptor
elif 'nsd:nsd-catalog' in descriptor:
nsd = descriptor['nsd:nsd-catalog']['nsd'][0]
nsd.update(updated)
+ elif descriptor_type == 'vnfd':
+ if 'vnfd-catalog' in descriptor:
+ vnfd = descriptor['vnfd-catalog']['vnfd'][0]
+ elif 'vnfd:vnfd-catalog' in descriptor:
+ vnfd = descriptor['vnfd:vnfd-catalog']['vnfd'][0]
+ vnfd.update(updated)
return descriptor
' data-toggle="tooltip" data-placement="top" title="Clone"\n' +
' onclick="javascript:clonePackage(\''+ descriptor_type +'\', \''+row["_id"]+'\')">\n' +
' <i class="fa fa-clone"></i></button>\n';
- if(descriptor_type == "nsd")
+ //if(descriptor_type == "nsd")
result += '<button type="button" class="btn btn-default" data-container="body"\n' +
' data-toggle="tooltip" data-placement="top" title="Show Graph"\n' +
' onclick="location.href=\'/projects/descriptors/composer?type='+descriptor_type+'&id='+row["_id"] +'\'"\n' +
* @returns {boolean}
*/
GraphEditor.prototype.addLink = function (link) {
- console.log("addLink" + JSON.stringify(link));
+
if (link.source && link.target) {
this.force.stop();
this.cleanAll();
vduDetails(element.info.osm);
break;
case 'int_cp':
+ intcpDetails(element.info.osm);
+ break;
case 'cp':
cpDetails(element.info.osm);
break;
side.append(vdur_template)
}
+function intcpDetails(cp) {
+ var side = $('#side_form');
+ var cp_template = getMainSection('Int. Connection Point');
+
+ cp_template += getChildrenTable(cp, true);
+ side.empty();
+ side.append(cp_template);
+}
+
function cpDetails(cp) {
var side = $('#side_form');
var cp_template = getMainSectionWithSubmitButton('Connection Point');