From 69402bc75cf3d7e632967ce7b539a5bc0880343f Mon Sep 17 00:00:00 2001 From: Joji Mekkatt Date: Mon, 6 Feb 2017 17:20:06 -0800 Subject: [PATCH] Add config support for host private subnet --- client/contivModel.js | 6 ++++-- client/contivModelClient.go | 1 + client/contivModelClient.py | 1 + contivModel.go | 6 ++++++ global.json | 9 ++++++++- 5 files changed, 20 insertions(+), 3 deletions(-) diff --git a/client/contivModel.js b/client/contivModel.js index 8b047ded3..e830cd458 100644 --- a/client/contivModel.js +++ b/client/contivModel.js @@ -378,7 +378,7 @@ var GlobalSummaryView = React.createClass({ }> - + ); @@ -390,7 +390,7 @@ var GlobalSummaryView = React.createClass({ - + @@ -418,6 +418,8 @@ var GlobalModalView = React.createClass({ + + diff --git a/client/contivModelClient.go b/client/contivModelClient.go index 2d5567548..41ef5a65b 100644 --- a/client/contivModelClient.go +++ b/client/contivModelClient.go @@ -393,6 +393,7 @@ type Global struct { FwdMode string `json:"fwdMode,omitempty"` // Forwarding Mode Name string `json:"name,omitempty"` // name of this block(must be 'global') NetworkInfraType string `json:"networkInfraType,omitempty"` // Network infrastructure type + PvtSubnet string `json:"pvtSubnet,omitempty"` // Private Subnet used by host bridge Vlans string `json:"vlans,omitempty"` // Allowed vlan range Vxlans string `json:"vxlans,omitempty"` // Allwed vxlan range diff --git a/client/contivModelClient.py b/client/contivModelClient.py index 20d1c869b..0804f4ca8 100644 --- a/client/contivModelClient.py +++ b/client/contivModelClient.py @@ -319,6 +319,7 @@ def createGlobal(self, obj): "fwdMode": obj.fwdMode, "name": obj.name, "networkInfraType": obj.networkInfraType, + "pvtSubnet": obj.pvtSubnet, "vlans": obj.vlans, "vxlans": obj.vxlans, }) diff --git a/contivModel.go b/contivModel.go index 3d28a97fe..d4c7bfeab 100644 --- a/contivModel.go +++ b/contivModel.go @@ -195,6 +195,7 @@ type Global struct { FwdMode string `json:"fwdMode,omitempty"` // Forwarding Mode Name string `json:"name,omitempty"` // name of this block(must be 'global') NetworkInfraType string `json:"networkInfraType,omitempty"` // Network infrastructure type + PvtSubnet string `json:"pvtSubnet,omitempty"` // Private Subnet used by host bridge Vlans string `json:"vlans,omitempty"` // Allowed vlan range Vxlans string `json:"vxlans,omitempty"` // Allwed vxlan range @@ -3112,6 +3113,11 @@ func ValidateGlobal(obj *Global) error { return errors.New("networkInfraType string invalid format") } + pvtSubnetMatch := regexp.MustCompile("^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3})/16$") + if pvtSubnetMatch.MatchString(obj.PvtSubnet) == false { + return errors.New("pvtSubnet string invalid format") + } + vlansMatch := regexp.MustCompile("^([0-9]{1,4}?-[0-9]{1,4}?)$") if vlansMatch.MatchString(obj.Vlans) == false { return errors.New("vlans string invalid format") diff --git a/global.json b/global.json index 9acad5af9..e3d175652 100644 --- a/global.json +++ b/global.json @@ -44,7 +44,14 @@ "length": 64, "format": "^(proxy|flood)?$", "ShowSummary": true - } + }, + "pvtSubnet": { + "type": "string", + "format": "^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3})/16$", + "title": "Private Subnet used by host bridge", + "showSummary": true + } + }, "operProperties": { "numNetworks": {