Skip to content

Commit

Permalink
Merge "Related-Bug:#1455170 1)Search flows tab we gave the option to …
Browse files Browse the repository at this point in the history
…select the number of records,with maximum 5000 2)Removed the formatters and setting the formatted value in the datasource 3)Sorting the data based on the vrouter and other vrouter ips null or valid 4)Trace flow tab, instance flows limit set to 5000. Change-Id: Iebbceb56d86ce21898d3e6a307def3eda02289c5"
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed May 28, 2015
2 parents ddd620a + 228c5c6 commit c65e905
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 50 deletions.
102 changes: 57 additions & 45 deletions webroot/monitor/infra/underlay/ui/js/flow_queries.js
Expand Up @@ -41,50 +41,15 @@ fsQuery['fcColumnDisplay'] = [
];

frQuery['columnDisplay'] = [
{select:"other_vrouter_ip", display:{id:'other_vrouter_ip', field:'other_vrouter_ip', width:150, name:"Other Virtual Router", groupable:false,formatter:
function(r, c, v, cd, dc){
var ip = validateIPAddress(handleNull4Grid(dc['other_vrouter_ip'])) == true ? handleNull4Grid(dc['other_vrouter_ip']) : noDataStr,
retStr = '-';
if(ip != noDataStr) {
if(null !== underlayRenderer && typeof underlayRenderer === "object") {
var vRouterDetails = underlayRenderer.getView().getvRouterVMDetails(ip,'self_ip_list',VROUTER);
retStr = contrail.format('{0} ({1})',ifNull(vRouterDetails['name'],'-'), ip);
}
}
return retStr;
}
}
},
{select:"vrouter_ip", display:{id:'vrouter_ip', field:'vrouter_ip', width:150, name:"Virtual Router", groupable:false,formatter:
function(r, c, v, cd, dc){
var ip = validateIPAddress(handleNull4Grid(dc['vrouter_ip'])) == true ? handleNull4Grid(dc['vrouter_ip']) : noDataStr,
retStr = '-';
var vrouter = ifNull(dc['vrouter'],noDataStr);
if(ip != noDataStr || vrouter != noDataStr)
retStr = contrail.format('{0} ({1})',vrouter, ip);
return retStr;
}
}
},
{select:"other_vrouter_ip", display:{id:'formattedOtherVrouter', field:'formattedOtherVrouter', width:150, name:"Other Virtual Router", groupable:false}},
{select:"vrouter_ip", display:{id:'formattedVrouter', field:'formattedVrouter', width:150, name:"Virtual Router", groupable:false}},
{select:"protocol", display:{id:"protocol", field:"protocol", width:75, name:"Protocol", groupable:true, formatter: function(r, c, v, cd, dc){ return handleNull4Grid(getProtocolName(dc.protocol));}}},
{select:"sourcevn", display:{id:"sourcevn", field:"sourcevn", width:125, name:"Source VN", groupable:true, formatter:
function(r, c, v, cd, dc){
var vn = handleNull4Grid(dc.sourcevn);
return formatVN(vn);
}
}
},
{select:"sourcevn", display:{id:"formattedSrcVN", field:"formattedSrcVN", width:125, name:"Source VN", groupable:true}},
{select:"sourceip", display:{id:"sourceip", field:"sourceip", width:90, name:"Source IP", groupable:true, formatter: function(r, c, v, cd, dc){ return (
validateIPAddress(handleNull4Grid(dc['sourceip'])) == true ? handleNull4Grid(dc['sourceip']) : noDataStr)}}},
{select:"sport", display:{id:"sport", field:"sport", width:70, name:"Source Port", groupable:true, formatter: function(r, c, v, cd, dc){ return handleNull4Grid(dc.sport);}}},
{select:"direction_ing", display:{id:"direction_ing", field:"direction_ing", width:90, name:"Direction", groupable:true, formatter: function(r, c, v, cd, dc){ return handleNull4Grid(getDirName(dc.direction_ing));}}},
{select:"destvn", display:{id:"destvn", field:"destvn", width:125, name:"Destination VN", groupable:true, formatter:
function(r, c, v, cd, dc){
var vn = handleNull4Grid(dc.destvn);
return formatVN(vn);
}
}
},
{select:"destvn", display:{id:"formattedDestVN", field:"formattedDestVN", width:125, name:"Destination VN", groupable:true}},
{select:"destip", display:{id:"destip", field:"destip", width:90, name:"Destination IP", groupable:true, formatter: function(r, c, v, cd, dc){ return (validateIPAddress(handleNull4Grid(dc['destip'])) == true ? handleNull4Grid(dc['destip']) : noDataStr)}}},
{select:"dport", display:{id:"dport", field:"dport", width:70, name:"Destination Port", groupable:true, formatter: function(r, c, v, cd, dc){ return handleNull4Grid(dc.dport);}}},
{select:"agg-bytes", display:{id:'agg-bytes', field:'agg-bytes', width:120, name:"Bytes/Packets", groupable:false,formatter: function(r, c, v, cd, dc) {return contrail.format("{0}/{1}",formatBytes(dc['agg-bytes'],'-'),dc['agg-packets']);}}},
Expand Down Expand Up @@ -737,7 +702,7 @@ function runFRQuery() {
//validator = initValidateDate("fr"),
queryPrefix = 'fr',
options = getFRDefaultOptions(),
columnDisplay, selectArray, queryId;
columnDisplay, selectArray,limit = defaultUnderlayFlowLimit;
//if ($("#" + queryPrefix + "-query-form").valid()) {
//collapseWidget('#fr-query-widget');
collapseWidget('#fr-query-widget');
Expand All @@ -762,8 +727,14 @@ function runFRQuery() {
$("#"+queryPrefix+"-results").data('endTimeUTC', option['toTime']);
$("#"+queryPrefix+"-results").data('startTimeUTC',option['fromTime']);
}
reqQueryObj.select = "other_vrouter_ip,agg-bytes,agg-packets",
reqQueryObj.excludeInSelect = ['UuidKey', 'action', 'sg_rule_uuid', 'nw_ace_uuid','underlay_proto', 'underlay_source_port'],
var limitDropdown = $('#fr-limit').data('contrailDropdown');
var selected = limitDropdown.getSelectedData()[0];
if(selected != null && selected['text'] != null) {
limit = selected['text']
}
reqQueryObj.select = "other_vrouter_ip,agg-bytes,agg-packets";
reqQueryObj.excludeInSelect = ['UuidKey', 'action', 'sg_rule_uuid', 'nw_ace_uuid','underlay_proto', 'underlay_source_port'];
reqQueryObj.filters = "limit:"+limit;
reqQueryObj.engQueryStr = getEngQueryStr(reqQueryObj);
loadFlowResultsForUnderlay(options, reqQueryObj, columnDisplay);
//}
Expand Down Expand Up @@ -871,6 +842,10 @@ function loadFlowResultsForUnderlay(options, reqQueryObj, columnDisplay, fcGridD
type: 'error',
iconClasses: 'icon-warning',
text: 'Error in fetching details'
},timeout: {
type: 'timeout',
iconClasses: 'icon-warning',
text: 'Timeout in fetching details' //need to change the message to something like specify query
}
}
},
Expand Down Expand Up @@ -949,20 +924,57 @@ function loadFlowResultsForUnderlay(options, reqQueryObj, columnDisplay, fcGridD
gridObject = $("#"+options.elementId).data('contrailGrid');
$.ajax({
url:url+'?'+$.param(reqQueryObj),
timeout:1000 * 60 * 10,//10 mins
}).done(function(response){
if(reqQueryObj['startAt'] != null && underlayLastInteracted > reqQueryObj['startAt'])
return;
$("#" + options.elementId).find('.grid-header-icon-loading').hide();
dataView.setData(response['data']);
var computeNodes = getValueByJsonPath(globalObj,'topologyResponse;vRouterList',[]);
$.each(ifNull(response['data'],[]),function (idx,obj) {
var formattedVrouter,formattedOtherVrouter,formattedSrcVN,formattedDestVN;
var vRouterIp = validateIPAddress(handleNull4Grid(obj['vrouter_ip'])) == true ? handleNull4Grid(obj['vrouter_ip']) : noDataStr,
formattedVrouter = noDataStr;
var vrouter = ifNull(obj['vrouter'],noDataStr);
if(vRouterIp != noDataStr || vrouter != noDataStr)
formattedVrouter = contrail.format('{0} ({1})',vrouter, vRouterIp);
var othervRouterIp = validateIPAddress(handleNull4Grid(obj['other_vrouter_ip'])) == true ? handleNull4Grid(obj['other_vrouter_ip']) : noDataStr,
formattedOtherVrouter = noDataStr;
if(othervRouterIp != noDataStr) {
$.each(computeNodes,function(idx,obj){
var ipList = getValueByJsonPath(obj,'more_attributes;VrouterAgent;self_ip_list',[]);
if(ipList.indexOf(othervRouterIp) > -1)
formattedOtherVrouter = contrail.format('{0} ({1})',ifNull(obj['name'],noDataStr), othervRouterIp);
});
}
var formattedSrcVN = handleNull4Grid(obj['sourcevn']);
formattedSrcVN = formatVN(formattedSrcVN);
var formattedDestVN = handleNull4Grid(obj['destvn']);
formattedDestVN = formatVN(formattedSrcVN);
obj['formattedVrouter'] = formattedVrouter;
obj['formattedOtherVrouter'] = formattedOtherVrouter;
obj['formattedSrcVN'] = formattedSrcVN[0];
obj['formattedDestVN'] = formattedDestVN[0];
});
var sortedData = response['data'].sort(function(dataItem1,dataItem2){
if(dataItem1['vrouter_ip'] != null)
return -1;
else
return 1;
});
dataView.setData(sortedData);
if(response['data'].length == 0 && gridObject != null) {
gridObject.showGridMessage('empty');
}
}).fail(function(error){
}).fail(function(error,status){
if(reqQueryObj['startAt'] != null && underlayLastInteracted > reqQueryObj['startAt'])
return;
$("#" + options.elementId).find('.grid-header-icon-loading').hide();
if(gridObject != null) {
gridObject.showGridMessage('error');
if(status == 'timeout') {
gridObject.showGridMessage('timeout');
} else {
gridObject.showGridMessage('error');
}
}
});
$("#" + options.elementId).find('input.headerRowCheckbox').parent('span').remove();
Expand Down
17 changes: 13 additions & 4 deletions webroot/monitor/infra/underlay/ui/js/monitor_infra_underlay.js
Expand Up @@ -3,7 +3,6 @@
*
* Underlay Overlay Visualisation Page
*/

var underlayRenderer = new underlayRenderer();
var PROUTER_DBL_CLICK = 'config_net_vn';
var PROUTER = 'physical-router';
Expand All @@ -12,6 +11,7 @@ var VIRTUALMACHINE = 'virtual-machine';
var timeout;
var expanded = true;
var underlayLastInteracted;
var defaultUnderlayFlowLimit = 5000;
function underlayRenderer() {
this.load = function(obj) {
this.configTemplate = Handlebars.compile($("#visualization-template").html());
Expand Down Expand Up @@ -2061,6 +2061,14 @@ underlayView.prototype.renderFlowRecords = function() {
queries['fr'].queryViewModel.isCustomTRVisible(false);
ko.applyBindings(queries.fr.queryViewModel, document.getElementById('fr-query'));
whereClauseStr = this.updateWhereClause();
$("#fr-limit").contrailDropdown({
dataTextField:'text',
dataValueField:'value',
});
var limitDropdown = $("#fr-limit").data('contrailDropdown');
var dropdownData = [{value:500,text:'500'},{value:1000,text:'1000'},{value:2500,text:'2500'},{value:5000,text:'5000'}];
limitDropdown.setData(dropdownData);
$("#fr-limit").select2('val','5000');
}
}
/*
Expand Down Expand Up @@ -2462,10 +2470,11 @@ underlayView.prototype.renderTracePath = function(options) {
select: 'agg-bytes,agg-packets,vrouter_ip,other_vrouter_ip',
fromTimeUTC: 'now-300s',
toTimeUTC: 'now',
queryId: randomUUID(),
async: true,
table:'FlowRecordTable',
startAt: new Date().getTime(),
async: false,
table:'FlowRecordTable',
filters : "limit:"+defaultUnderlayFlowLimit

};
var vmData = instMap[name];
var intfData = getValueByJsonPath(vmData,'more_attributes;interface_list',[]);
Expand Down
6 changes: 6 additions & 0 deletions webroot/monitor/infra/underlay/ui/views/flow_queries.view
Expand Up @@ -542,6 +542,12 @@
<input id="fr-to-time" name="toTime" class="span12" value="" required/>
</div>
</div>
<div class="span1">
<label>Limit</label>
<div id="fr-limit" name="limit" class="span12">

</div>
</div>
</div>

<div class="row-fluid margin-0-0-5">
Expand Down
9 changes: 8 additions & 1 deletion webroot/reports/api/qe.api.js
Expand Up @@ -664,14 +664,18 @@ function parseStatsQuery(reqQuery)

function parseFRQuery(reqQuery)
{
var select, where, fromTimeUTC, toTimeUTC, frQuery, table, direction;
var select, where, fromTimeUTC, toTimeUTC, frQuery, table, direction,filters;
table = reqQuery['table'];
frQuery = getQueryJSON4Table(table);
fromTimeUTC = reqQuery['fromTimeUTC'];
toTimeUTC = reqQuery['toTimeUTC'];
select = reqQuery['select'];
where = reqQuery['where'];
filters = reqQuery['filters'];
direction = parseInt(reqQuery['direction']);
if(reqQuery['limit'] != null) {
frQuery['limit'] = reqQuery['limit'];
}
setMicroTimeRange(frQuery, fromTimeUTC, toTimeUTC);
if (select != "") {
parseSelect(frQuery, select);
Expand All @@ -680,6 +684,9 @@ function parseFRQuery(reqQuery)
if (direction >= 0) {
frQuery['dir'] = direction;
}
if(filters != null) {
parseFSFilter(frQuery, filters);
}
return frQuery;
};

Expand Down

0 comments on commit c65e905

Please sign in to comment.