improved ns topology
Change-Id: I6eb1ee664cf52a86b8b723b52c5c6490998a0e63
Signed-off-by: lombardofr <lombardo@everyup.it>
diff --git a/static/src/instancehandler/instance_create.js b/static/src/instancehandler/instance_create.js
index 0bf1dbc..47cba12 100644
--- a/static/src/instancehandler/instance_create.js
+++ b/static/src/instancehandler/instance_create.js
@@ -14,7 +14,6 @@
limitations under the License.
*/
-
function openModalCreateNS(args) {
// load vim account list
select2_groups = $('#vimAccountId').select2({
@@ -63,7 +62,7 @@
}
});
- if(args.descriptor_id){
+ if (args.descriptor_id) {
// Set the value, creating a new option if necessary
if ($('#nsdId').find("option[value='" + args.descriptor_id + "']").length) {
$('#nsdId').val(args.descriptor_id).trigger('change');
diff --git a/static/src/instancehandler/instance_topology_view.js b/static/src/instancehandler/instance_topology_view.js
index 1193b18..99bb986 100644
--- a/static/src/instancehandler/instance_topology_view.js
+++ b/static/src/instancehandler/instance_topology_view.js
@@ -1,6 +1,44 @@
+/*
+ Copyright 2018 EveryUP srl
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
//GraphEditor instance
var graph_editor = new TCD3.ModelGraphEditor();
+var layer_map = {
+ 'nsr': {
+ 'id': 'NS instance id',
+ 'nsdId': 'NSD id',
+ 'name-ref': 'NSD name',
+ 'operational-status': 'Operational status',
+ 'config-status': 'Config status',
+ 'detailed-status': 'Detailed status',
+ 'create-time': 'Creation date',
+ 'instantiate_params' :'Instantiation parameters'
+ },
+ 'vnfr': {
+ 'id': 'VNF instance id',
+ 'vnfd-id': 'NSD id',
+ 'vnfd-ref': 'NSD name',
+ 'member-vnf-index': 'Constituent VNF in the NS',
+ 'ip-address': 'Mgmt IP address',
+ 'vim-account-id': 'VIM id',
+ 'create-time': 'Creation date'
+ }
+};
+
var type_view = {
"nsr": ["vnfr", "ns_vl"],
"vnfr": ["vdur", "cp", "vnf_vl"]
@@ -41,7 +79,6 @@
});
-
function handleForce(el) {
graph_editor.handleForce((el.getAttribute('aria-pressed') === "true"));
}
@@ -119,6 +156,7 @@
}
}
+
function layerDetails(filters) {
var side = $('#side');
var graph_parameters = graph_editor.getGraphParams();
@@ -126,12 +164,35 @@
if(graph_parameters['view'] && filters.link.view.length >0 && filters.link.view[0]){
if(filters.link.view[0] === 'nsr') {
layer_template = getMainSection('NS View');
- layer_template += getChildrenTable(graph_parameters['view']['nsr']);
+ layer_template+= '<table class="children">';
+ for (var key in layer_map['nsr']) {
+ if ( graph_parameters['view']['nsr'][key] ) {
+ var field_value = graph_parameters['view']['nsr'][key];
+ if(key === 'create-time'){
+ field_value = moment.unix(field_value).toISOString();
+ }
+ layer_template += '<tr><td>' + layer_map['nsr'][key] + '</td><td>' + field_value + '</td></tr>';
+ }
+ }
+ layer_template += '</table>';
+ //layer_template += getChildrenTable(graph_parameters['view']['nsr']);
}
else if(filters.link.view[0] === 'vnfr') {
layer_template = getMainSection('VNF View');
var vnfr_id = filters.link.group[0];
- layer_template += getChildrenTable(graph_parameters['view']['vnfr'][vnfr_id]);
+
+ layer_template+= '<table class="children">';
+ var vnfr_data = graph_parameters['view']['vnfr'][vnfr_id];
+ for (var key in layer_map['vnfr']) {
+ if ( vnfr_data[key] ) {
+ var field_value = vnfr_data[key];
+ if(key === 'create-time'){
+ field_value = moment.unix(field_value).toISOString();
+ }
+ layer_template += '<tr><td>' + layer_map['vnfr'][key] + '</td><td>' + field_value + '</td></tr>';
+ }
+ }
+ layer_template += '</table>';
}
}
@@ -159,10 +220,10 @@
}
var map = {
- 'ip-address': 'IP', 'vnfd-id': 'Vnfd Id', 'vnfd-ref': 'Vnfd Ref', 'vim-account-id': 'Vim Id',
+ 'ip-address': 'IP', 'vnfd-id': 'Vnfd Id', 'vnfd-ref': 'Vnfd Ref', 'vim-account-id': 'VIM Id',
'member-vnf-index-ref': 'Member index', 'created-time': 'Created', 'id': 'Id', 'mgmt-network': 'Mgmt network',
'name': 'Name', 'type': 'Type', 'vim-network-name': 'Vim network name', 'connection-point-id': 'Cp Id',
- 'vdu-id-ref': 'Vdu Id', 'nsr-id-ref': 'Nsr Id'
+ 'vdu-id-ref': 'Vdu Id', 'nsr-id-ref': 'Nsr Id', 'vim-id': 'VIM id'
};
function vnfrDetails(vnfr) {