if node_type == 'vnf_vl':
vnfd['internal-vld'] = [item for item in vnfd['internal-vld'] if item['id'] != element_id]
if node_type == 'cp':
- vnfd['connection-point'] = [item for item in vnfd['connection-point'] if item['name'] != element_id]
- if node_type == 'vdu':
- # check
- vnfd['vdu'] = [item for item in vnfd['vdu'] if item['name'] != element_id]
- if node_type == 'int_cp':
-
+ vnfd['connection-point'] = [item for item in vnfd['connection-point'] if item['name'] != args['name']]
for vdu in vnfd['vdu']:
if 'interface' in vdu:
- vdu['interface'] = [item for item in vdu['interface'] if 'internal-connection-point-ref' not in item
- or ('internal-connection-point-ref'in item and item['internal-connection-point-ref'] != element_id)]
- if 'internal-connection-point' in vdu:
- vdu['internal-connection-point'] = [item for item in vdu['internal-connection-point'] if item['id'] != element_id]
-
-
-
+ vdu['interface'] = [item for item in vdu['interface'] if 'external-connection-point-ref' not in item
+ or ('external-connection-point-ref'in item and item['external-connection-point-ref'] != args['name'])]
+ if node_type == 'vdu':
+ vdus = []
+ for vdu in vnfd['vdu']:
+ if vdu['name'] != element_id:
+ vdus.append(vdu)
+ else:
+ for intcp in vdu['internal-connection-point']:
+ for intVld in vnfd['internal-vld']:
+ intVld['internal-connection-point'] = [item for item in intVld['internal-connection-point']
+ if item['id-ref'] != intcp['id']]
+ vnfd['vdu'] = vdus
+ if node_type == 'int_cp':
+ OsmUtil.remove_int_cp(element_id, vnfd)
return descriptor
@staticmethod
elif 'vnfd:vnfd-catalog' in descriptor:
vnfd = descriptor['vnfd:vnfd-catalog']['vnfd'][0]
if node_type == 'vdu':
+ if 'vdu' not in vnfd:
+ vnfd['vdu'] = []
vnfd['vdu'].append({
"count": "1",
"description": "",
"name": element_id
})
if node_type == 'cp':
+ if 'connection-point' not in vnfd:
+ vnfd['connection-point'] = []
vnfd['connection-point'].append({
"type": "VPORT",
"name": element_id
})
if node_type == 'vnf_vl':
+ if 'internal-vld' not in vnfd:
+ vnfd['internal-vld'] = []
vnfd['internal-vld'].append({
"short-name": element_id,
"name": element_id,
vnfd.update(updated)
return descriptor
+
+ @staticmethod
+ def remove_int_cp(element_id, vnfd):
+ for vdu in vnfd['vdu']:
+ if 'interface' in vdu:
+ vdu['interface'] = [item for item in vdu['interface'] if 'internal-connection-point-ref' not in item
+ or ('internal-connection-point-ref' in item and item[
+ 'internal-connection-point-ref'] != element_id)]
+ if 'internal-connection-point' in vdu:
+ vdu['internal-connection-point'] = [item for item in vdu['internal-connection-point'] if
+ item['id'] != element_id]
+ for intVld in vnfd['internal-vld']:
+ intVld['internal-connection-point'] = [item for item in intVld['internal-connection-point'] if
+ item['id-ref'] != element_id]
+
+ return vnfd
//d3.event.preventDefault();
if (self.lastKeyDown !== -1) return;
self.lastKeyDown = d3.event.keyCode;
- if (self.lastKeyDown === CANC_BUTTON && self._selected_node !== undefined) {
- self.removeNode(self._selected_node, null, showAlert);
- } else if (self.lastKeyDown === CANC_BUTTON && self._selected_link !== undefined) {
- self.removeLink(self._selected_link, null, showAlert);
- }
+ // if (self.lastKeyDown === CANC_BUTTON && self._selected_node !== undefined) {
+ // self.removeNode(self._selected_node, null, showAlert);
+ // } else if (self.lastKeyDown === CANC_BUTTON && self._selected_link !== undefined) {
+ // self.removeLink(self._selected_link, null, showAlert);
+ // }
})
.on('keyup', function () {