Skip to content

Commit

Permalink
Closes-Bug: #1581698
Browse files Browse the repository at this point in the history
1. Added filter_svc_instance in get-virtual-machine-details API to filter out
 instance-ips for those service_instance_ip is set as true
2. While changing the port tuple name, corrected the port tuple entry
 association
3. Removed duplicate API definition from port api file.

Conflicts:
	webroot/config/networking/port/api/portsconfig.api.js

Change-Id: Ib558094349fc0864fd20746fbf4e25afe94c99fe
(cherry picked from commit d656156)
  • Loading branch information
biswajit-mandal committed Jun 2, 2016
1 parent c67dc40 commit 0730647
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 13 deletions.
30 changes: 23 additions & 7 deletions webroot/config/networking/port/api/portsconfig.api.js
Expand Up @@ -2606,7 +2606,7 @@ function getVMIAndInstIPDetails (req, res, appData)
});
}

function getVMIDetailsCB (vmiURL, appData, res, err)
function getVMIDetailsCB (vmiURL, filterSvcInstIP, appData, res, err)
{
var vmiToIpMap = {};
var dataObjArr = [];
Expand Down Expand Up @@ -2663,8 +2663,15 @@ function getVMIDetailsCB (vmiURL, appData, res, err)
if (null == vmiToIpMap[vmiRef[0]['uuid']]) {
vmiToIpMap[vmiRef[0]['uuid']] = [];
}
vmiToIpMap[vmiRef[0]['uuid']].push(
instIpData[i]['instance-ip']['instance_ip_address']);
var isSvcInstIP =
commonUtils.getValueByJsonPath(instIpData[i],
'instance-ip;service_instance_ip',
false);
if ((false == filterSvcInstIP) ||
((true == filterSvcInstIP) && (false == isSvcInstIP))) {
vmiToIpMap[vmiRef[0]['uuid']].push(
instIpData[i]['instance-ip']['instance_ip_address']);
}
}
for (i = 0; i < vmiCnt; i++) {
if (null !=
Expand Down Expand Up @@ -2701,6 +2708,17 @@ function getVMIDetails (req, res, appData)
var projFQN = req.param('proj_fqn');
var vnFqn = req.param('vn_fqn');
var vnFqns = req.param('vn_fqns');
var filterSvcInstIP = req.param('filter_svc_inst_ip');
switch (filterSvcInstIP) {
case 'true':
case true:
filterSvcInstIP = true;
break;
case 'false':
case false:
default:
filterSvcInstIP = false;
}
var dataObjArr = [];
var vmiURL =
'/virtual-machine-interfaces?detail=true&fields=' +
Expand Down Expand Up @@ -2741,14 +2759,12 @@ function getVMIDetails (req, res, appData)
uuidList.push(results[i]['uuid']);
}
vmiURL += '&' + urlId + '=' + uuidList.join(',');
getVMIDetailsCB(vmiURL, appData, res);
getVMIDetailsCB(vmiURL, filterSvcInstIP, appData, res);
}
);
return;
}


getVMIDetailsCB(vmiURL, appData, res);
getVMIDetailsCB(vmiURL, filterSvcInstIP, appData, res);
}

function deleteAllPorts (req, res, appData)
Expand Down
11 changes: 7 additions & 4 deletions webroot/config/services/instances/ui/js/models/svcInstModel.js
Expand Up @@ -883,7 +883,11 @@ define([
portTuples = newPortTuples;
return;
},
setPortTupleName: function(model, portTupleEntry) {
setPortTupleName: function(model) {
if (null == model) {
return;
}
var portTupleEntry = model.newPortTupleEntry;
var intfTypes = portTupleEntry.intfTypes();
var ctIntfType = model.get('interfaceType');
var intfIdx = intfTypes.indexOf(ctIntfType);
Expand Down Expand Up @@ -1081,10 +1085,9 @@ define([
var portTupleIntfsCollLen = portTupleIntfsColl.length;
for (var i = 0; i < portTupleIntfsCollLen; i++) {
var model = portTupleIntfsColl.models[i]['attributes'].model();
self.newPortTupleEntry = newPortTupleEntry;
model.newPortTupleEntry = newPortTupleEntry;
model.on('change:interface', function(model, newValue) {
self.setPortTupleName(model,
self.newPortTupleEntry);
self.setPortTupleName(model);
});
}
portTupleCollection.add([newPortTupleEntry]);
Expand Down
Expand Up @@ -132,7 +132,8 @@ define([
ajaxConfigs[1] =
$.ajax({
url:
'/api/tenants/config/get-virtual-machine-details?vn_fqns='
'/api/tenants/config/get-virtual-machine-details?' +
'filter_svc_inst_ip=true&vn_fqns='
+ setVNList.join('::'),
type: 'GET',
timeout: 60000,
Expand Down Expand Up @@ -216,7 +217,8 @@ define([
}
var ajaxConfig = {
url :
'/api/tenants/config/get-virtual-machine-details?vn_fqn=' + newValue,
'/api/tenants/config/get-virtual-machine-details?' +
'filter_svc_inst_ip=true&vn_fqn=' + newValue,
type : 'GET',
timeout : 30000
};
Expand Down

0 comments on commit 0730647

Please sign in to comment.