From: lombardofr Date: Sun, 25 Nov 2018 20:46:36 +0000 (+0100) Subject: bug fix vnfd composer; minor ui fix X-Git-Tag: v5.0.0~7 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=5b56a292d9d897b3a67b2e3ebe980ae2566a6186;p=osm%2FLW-UI.git bug fix vnfd composer; minor ui fix Change-Id: I3f7cbc4949ddf9265bd1b1eb19aa3d51aefb8c42 Signed-off-by: lombardofr --- diff --git a/descriptorhandler/template/modal/modal_keyboard_info_base.html b/descriptorhandler/template/modal/modal_keyboard_info_base.html index 2be28a9..8f0fa42 100644 --- a/descriptorhandler/template/modal/modal_keyboard_info_base.html +++ b/descriptorhandler/template/modal/modal_keyboard_info_base.html @@ -15,7 +15,7 @@

Create edge: Select the first vertex by clicking on it. Shift + left-click on another vertex (different than the selected one).

  • -

    Delete Delete selected nodes or link.

    +

    Delete edge: Select the vertex by clicking on it. right-click + Delete

  • diff --git a/lib/osm/osm_util.py b/lib/osm/osm_util.py index 49be9df..8cf6a4e 100644 --- a/lib/osm/osm_util.py +++ b/lib/osm/osm_util.py @@ -38,21 +38,24 @@ class OsmUtil(): 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 @@ -137,6 +140,8 @@ class OsmUtil(): 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": "", @@ -150,12 +155,16 @@ class OsmUtil(): "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, @@ -222,3 +231,19 @@ class OsmUtil(): 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 diff --git a/static/TopologyComposer/css/composer.css b/static/TopologyComposer/css/composer.css index 12be9e7..119d2ea 100644 --- a/static/TopologyComposer/css/composer.css +++ b/static/TopologyComposer/css/composer.css @@ -1,3 +1,8 @@ +line { + stroke: rgb(212, 212, 212); + stroke-width: 1px; + shape-rendering: crispEdges; +} .node_path { opacity: 1; @@ -148,6 +153,7 @@ -moz-user-select: none; -ms-user-select: none; user-select: none; + background-color: whitesmoke; } #palette > .node:first-child { diff --git a/static/TopologyComposer/js/graph_editor.js b/static/TopologyComposer/js/graph_editor.js index d8abcc8..2d9218b 100755 --- a/static/TopologyComposer/js/graph_editor.js +++ b/static/TopologyComposer/js/graph_editor.js @@ -137,11 +137,11 @@ TCD3.GraphEditor = (function () { //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 () {