Skip to content

Commit

Permalink
New Feature Support - Route Tables, Export_flow_rate in vrouter config
Browse files Browse the repository at this point in the history
Change-Id: Ic9a75cf4e818d1caf1dca0f710fd4d41da1ad47b
Closes-bug: #1508053
  • Loading branch information
Balaji Kumar AS committed Oct 25, 2015
1 parent 32f2f39 commit fcc28bc
Show file tree
Hide file tree
Showing 14 changed files with 1,566 additions and 11 deletions.
5 changes: 5 additions & 0 deletions webroot/common/api/featureList.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@
<read-access>member</read-access>
<write-access>member</write-access>
</item>
<item>
<feature>routetablesconfig</feature>
<read-access>member</read-access>
<write-access>member</write-access>
</item>
<item>
<feature>vCenterVNconfig</feature>
</item>
Expand Down
8 changes: 7 additions & 1 deletion webroot/common/api/jsonDiff.helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var configJsonModifyObj = {
},
'optFields': ['virtual_network_properties',
'network_ipam_refs', 'network_policy_refs',
'route_table_refs',
'route_target_list', 'is_shared',
'router_external', 'id_perms:enable',
'flood_unknown_unicast' ],
Expand Down Expand Up @@ -45,6 +46,11 @@ var configJsonModifyObj = {
'mandateFields': ['fq_name', 'uuid', 'display_name',
'virtual_DNS_record_data']
},
'route-table': {
'isConfig': true,
'optFields': ['routes'],
'mandateFields': ['fq_name', 'uuid']
},
'service-instance': {
'isConfig': true,
'optFields': ['service_instance_properties'],
Expand All @@ -65,7 +71,7 @@ var configJsonModifyObj = {
},
'global-vrouter-config': {
'isConfig': true,
'optFields': ['forwarding_mode', 'vxlan_network_identifier_mode', 'encapsulation_priorities', 'linklocal_services'],
'optFields': ['forwarding_mode', 'vxlan_network_identifier_mode', 'encapsulation_priorities', 'linklocal_services', 'flow_export_rate'],
'mandateFields': ['fq_name', 'uuid', 'display_name']
},
'physical-topology': {
Expand Down
2 changes: 2 additions & 0 deletions webroot/config/bgp/api/admin.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ var rest = require(process.mainModule.exports["corePath"] + '/src/serverroot/com
polConfig = require('../../networkpolicies/api/policyconfig.api'),
sgConfig = require('../../securitygroup/api/securitygroupconfig.api'),
logicalRouterConfig = require('../../logicalrouters/api/logicalroutersconfig.api'),
routeTableConfig = require('../../routetables/api/routetablesconfig.api'),
portsConfig = require('../../ports/api/portsconfig.api'),
infConfig = require('../../physicaldevices/physicalinterfaces/api/physicalinterfacesconfig.api.js'),
ipamConfig = require('../../ipaddressmanagement/api/ipamconfig.api'),
Expand Down Expand Up @@ -1655,6 +1656,7 @@ var configCBList =
'network-policy': polConfig.readPolicys,
'security-group': sgConfig.readSecurityGroup,
'logical-router': logicalRouterConfig.readLogicalRouter,
'route-table': routeTableConfig.readRouteTable,
'virtual-machine-interface': portsConfig.readPorts,
'network-ipam': ipamConfig.readIpams,
'virtual-DNS': vdnsConfig.readVirtualDNSs,
Expand Down
32 changes: 31 additions & 1 deletion webroot/config/forwardingoptions/ui/js/global_options_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ function initComponents() {
ele = '-';
}
return ele;
} else if(dc.property === 'Flow Export Rate') {
if(null !== dc.value && typeof dc.value === "string" &&
dc.value.trim() !== "") {
return dc.value;
} else {
return "-";
}
} else {
return dc.value;
}
Expand Down Expand Up @@ -282,6 +289,7 @@ function initActions() {
}
}
var forwarding_mode = $("#ddForwardingMode").data("contrailDropdown").value();
var flowExportRate = $("#txtFlowExportRate").val()
if(null === configObj["global-vrouter-config"] ||
typeof configObj["global-vrouter-config"] === "undefined" ||
null === configObj["global-vrouter-config"]["uuid"] ||
Expand All @@ -307,6 +315,12 @@ function initActions() {
//Add forwarding_mode only for l2_l3, l2, l3.
globalVRouterConfig["global-vrouter-config"]["forwarding_mode"] = forwarding_mode;
}
if(null !== flowExportRate && typeof flowExportRate === "string" &&
flowExportRate.trim() !== "") {
globalVRouterConfig["global-vrouter-config"]["flow_export_rate"] = parseInt(flowExportRate);
} else {
globalVRouterConfig["global-vrouter-config"]["flow_export_rate"] = null;
}
fwdOptnURL = "/api/tenants/config/global-vrouter-config/" + gvrId + "/forwarding-options";
fwdOptnActionType = "PUT";
}
Expand Down Expand Up @@ -424,6 +438,7 @@ function setEditPopupData() {
$("#epTuples").append(epEntry);
}
$('#txtgasn').val(ggasn);
$("#txtFlowExportRate").val(actFlowExportRate);
if(isiBGPAutoMesh) {
$('#chk_ibgp_auto_mesh').attr('checked', 'checked');
} else {
Expand Down Expand Up @@ -456,7 +471,12 @@ function populateData(result) {
//Set default 'automatic' for VxLANIdentifierMode
actVxlan = vxLanIdentifierModeValues[0];
}

if(null !== gvrConfig["flow_export_rate"] &&
typeof gvrConfig["flow_export_rate"] !== "undefined") {
actFlowExportRate = gvrConfig["flow_export_rate"]+"";
} else {
actFlowExportRate = "";
}
if(null !== gvrConfig["forwarding_mode"] &&
typeof gvrConfig["forwarding_mode"] !== "undefined") {
orig_forwarding_mode = gvrConfig["forwarding_mode"];
Expand All @@ -482,6 +502,8 @@ function populateData(result) {
} else {
//Set default 'automatic' for VxLANIdentifierMode
actVxlan = vxLanIdentifierModeValues[0];
actFlowExportRate = "";
$("#txtFlowExportRate").val("")
//Add default MPLSoGRE even if nothing is configured. TBD
var epEntry = createEPEntry("MPLSoUDP", 0);
$("#epTuples").append(epEntry);
Expand All @@ -507,6 +529,7 @@ function populateData(result) {
}
gridDS.push({'property' : 'Global ASN', 'value' : ggasn});
gridDS.push({'property' : 'iBGP Auto Mesh', 'value' : isiBGPAutoMesh});
gridDS.push({'property' : 'Flow Export Rate', 'value' : actFlowExportRate});
gridDS.push({'property' : 'IP Fabric Subnets', 'value':ipFabricSubnets});
gridDS.push({'property' : 'Forwarding Mode', 'value': (null === orig_forwarding_mode || (typeof orig_forwarding_mode === "string" &&
orig_forwarding_mode.trim() === "" )) ? fwdModeMap["default"] : fwdModeMap[orig_forwarding_mode]});
Expand Down Expand Up @@ -782,6 +805,13 @@ function validate() {
var vxlanid = $('input:radio[name=vxlanMode]:checked').val();
var priorities = [];
var epTuples = $("#epTuples")[0].children;
var flowExportRate = $("#txtFlowExportRate").val();
if(null !== flowExportRate && typeof flowExportRate === "string" &&
isNumber(flowExportRate.trim()) === false) {
showInfoWindow("Flow Export Rate should be numeric.", "Invalid Input");
return false;
}

if (epTuples && epTuples.length > 0) {
var encapsulationLabels = ["MPLS Over GRE","MPLS Over UDP","VxLAN"];
var encapsulationValues = ["MPLSoGRE","MPLSoUDP","VXLAN"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,17 @@
</div>
</div>
</div>
<div class="control-group">
<label class="control-label">Flow Export Rate</label>
<div class="controls">
<div class="row-fluid">
<input id="txtFlowExportRate"
type="text" name="txtFlowExportRate"
class="span6">
</input>
</div>
</div>
</div>
<div class="rule-item-header margin-0-0-10 span6" style="margin-left:30px !important;width:66%">
<div class="row-fluid">
<div class="span10">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ function updateForwardingOptions (request, response, appData) {
gvrPutData["global-vrouter-config"]["vxlan_network_identifier_mode"];
gvrConfigData["global-vrouter-config"]["forwarding_mode"] =
gvrPutData["global-vrouter-config"]["forwarding_mode"];

gvrConfigData["global-vrouter-config"]["flow_export_rate"] =
gvrPutData["global-vrouter-config"]["flow_export_rate"];
gvrConfigData["global-vrouter-config"]["encapsulation_priorities"] = {};
gvrConfigData["global-vrouter-config"]["encapsulation_priorities"]["encapsulation"] =
gvrPutData["global-vrouter-config"]["encapsulation_priorities"]["encapsulation"];
Expand Down
40 changes: 40 additions & 0 deletions webroot/config/routetables/api/parseURL.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!--
Copyright (c) 2015 Juniper Networks, Inc. All rights reserved.
-->
<urlLists>
<require>
<define>parseURLReq</define>
<path>process.mainModule.exports["corePath"] + '/src/serverroot/common/parseURLRequire'</path>
</require>
<require>
<define>routetablesconfigapi</define>
<path>./routetablesconfig.api</path>
</require>
<!-- API / Feature definition for Route Tables configuration -->
<!-- 1. List Route Tables -
-->
<item>
<url>/api/tenants/config/list-route-tables</url>
<method>get</method>
<feature>routetablesconfig</feature>
<callback>routetablesconfigapi.listRouteTables</callback>
</item>
<item>
<url>/api/tenants/config/route-tables</url>
<method>post</method>
<feature>routetablesconfig</feature>
<callback>routetablesconfigapi.createRouteTable</callback>
</item>
<item>
<url>/api/tenants/config/route-table/:uuid</url>
<method>put</method>
<feature>routetablesconfig</feature>
<callback>routetablesconfigapi.updateRouteTable</callback>
</item>
<item>
<url>/api/tenants/config/route-table/:uuid</url>
<method>delete</method>
<feature>routetablesconfig</feature>
<callback>routetablesconfigapi.deleteRouteTable</callback>
</item>
</urlLists>

0 comments on commit fcc28bc

Please sign in to comment.