Skip to content

Commit

Permalink
contivmodel changes w.r.t making bandwidth format flexible. (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
reshmagiliyal authored and shaleman committed Jul 20, 2016
1 parent cc05737 commit 8e88827
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion contivModel.go
Original file line number Diff line number Diff line change
Expand Up @@ -2570,7 +2570,7 @@ func ValidateNetprofile(obj *Netprofile) error {
return errors.New("bandwidth string too long")
}

bandwidthMatch := regexp.MustCompile("^((([1-9][0-9]*((k|K|m|M|g|G)(bps|BPS)))|(K|k|M|m|G|g)|(K|k|M|m|G|g)(b))|(([1-9][0-9]* ((k|K|m|M|g|G)(bps|BPS)))|(K|k|M|m|G|g)|(K|k|M|m|G|g)(b)))?$")
bandwidthMatch := regexp.MustCompile("^([1-9][0-9]* (([kmgKMG{1}]bps)|[kmgKMG{1}]|(kb|Kb|Gb|gb|Mb|mb)))?$|^([1-9][0-9]*(((k|m|g|K|G|M)bps)|(k|m|g|K|M|G)|(kb|Kb|Gb|gb|Mb|mb)))?$")
if bandwidthMatch.MatchString(obj.Bandwidth) == false {
return errors.New("bandwidth string invalid format")
}
Expand Down
2 changes: 1 addition & 1 deletion netProfile.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"bandwidth": {
"type": "string",
"length": 64,
"format": "^((([1-9][0-9]*((k|K|m|M|g|G)(bps|BPS)))|(K|k|M|m|G|g)|(K|k|M|m|G|g)(b))|(([1-9][0-9]* ((k|K|m|M|g|G)(bps|BPS)))|(K|k|M|m|G|g)|(K|k|M|m|G|g)(b)))?$",
"format": "^([1-9][0-9]* (([kmgKMG{1}]bps)|[kmgKMG{1}]|(kb|Kb|Gb|gb|Mb|mb)))?$|^([1-9][0-9]*(((k|m|g|K|G|M)bps)|(k|m|g|K|M|G)|(kb|Kb|Gb|gb|Mb|mb)))?$",
"title": "Allocated bandwidth",
"description": "Amount of allocated outbound bandwidth",
"ShowSummary": true
Expand Down

0 comments on commit 8e88827

Please sign in to comment.