Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fat flow / Mega flow is implemented in Port page.
Closes-bug#1521094 Zero value is allowed only to ICMP(Default Value) TCP, UDP and SCTP protocal's port value cannot have a zero Change-Id: Ia401cff8ce2bb54ec4e213dfb9883e598cca0b46 Closes-Bug: #1523768
- Loading branch information
1 parent
7dc7807
commit ead057f
Showing
5 changed files
with
225 additions
and
3 deletions.
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
webroot/config/networking/port/ui/js/models/fatFlowModel.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright (c) 2015 Juniper Networks, Inc. All rights reserved. | ||
*/ | ||
|
||
define([ | ||
'underscore', | ||
'contrail-model' | ||
], function (_, ContrailModel) { | ||
var fatFlowModel = ContrailModel.extend({ | ||
|
||
defaultConfig: { | ||
'protocol': 'tcp', | ||
'port':'' | ||
}, | ||
|
||
validateAttr: function (attributePath, validation, data) { | ||
var model = data.model().attributes.model(), | ||
attr = cowu.getAttributeFromPath(attributePath), | ||
errors = model.get(cowc.KEY_MODEL_ERRORS), | ||
attrErrorObj = {}, isValid; | ||
|
||
isValid = model.isValid(attributePath, validation); | ||
|
||
attrErrorObj[attr + cowc.ERROR_SUFFIX_ID] = | ||
(isValid == true) ? false : isValid; | ||
errors.set(attrErrorObj); | ||
}, | ||
|
||
|
||
validations: { | ||
fatFlowValidations: { | ||
'protocol': { | ||
required: true, | ||
msg: 'Select a protocol.' | ||
}, | ||
'port': function(value, attr, finalObj) { | ||
if(finalObj.protocol != "icmp") { | ||
if(value.trim() == "") { | ||
return "Enter valid port between 1 to 65535 for Fat Flow Record"; | ||
} | ||
if (!isNumber(value)) { | ||
return "Fat Flow Protocol's Port has to be a number"; | ||
} | ||
if (value % 1 != 0) { | ||
return "Fat Flow Protocol's Port has to be a number"; | ||
} | ||
if (Number(value) < 1 || Number(value) > 65535) { | ||
return "Enter valid port between 1 to 65535 for Fat Flow Record"; | ||
} | ||
} else { | ||
if(value.trim() != "0") { | ||
return "ICMP can have only 0"; | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
return fatFlowModel; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters