Skip to content

Commit

Permalink
Add config support for host private subnet
Browse files Browse the repository at this point in the history
  • Loading branch information
Joji Mekkatt committed Feb 7, 2017
1 parent 7bceb00 commit 69402bc
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
6 changes: 4 additions & 2 deletions client/contivModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ var GlobalSummaryView = React.createClass({
<ModalTrigger modal={<GlobalModalView global={ global }/>}>
<tr key={ global.key } className="info">


</tr>
</ModalTrigger>
);
Expand All @@ -390,7 +390,7 @@ var GlobalSummaryView = React.createClass({
<thead>
<tr>


</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -418,6 +418,8 @@ var GlobalModalView = React.createClass({

<Input type='text' label='Network infrastructure type' ref='networkInfraType' defaultValue={obj.networkInfraType} placeholder='Network infrastructure type' />

<Input type='text' label='Private Subnet used by host bridge' ref='pvtSubnet' defaultValue={obj.pvtSubnet} placeholder='Private Subnet used by host bridge' />

<Input type='text' label='Allowed vlan range' ref='vlans' defaultValue={obj.vlans} placeholder='Allowed vlan range' />

<Input type='text' label='Allwed vxlan range' ref='vxlans' defaultValue={obj.vxlans} placeholder='Allwed vxlan range' />
Expand Down
1 change: 1 addition & 0 deletions client/contivModelClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions client/contivModelClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
Expand Down
6 changes: 6 additions & 0 deletions contivModel.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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")
Expand Down
9 changes: 8 additions & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit 69402bc

Please sign in to comment.