Skip to content

Commit 731af51

Browse files
abhishaleman
authored andcommitted
fwd_mode (#35)
1 parent 19aff69 commit 731af51

5 files changed

+24
-3
lines changed

client/contivModel.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ var GlobalSummaryView = React.createClass({
313313
<ModalTrigger modal={<GlobalModalView global={ global }/>}>
314314
<tr key={ global.key } className="info">
315315

316-
316+
317317
</tr>
318318
</ModalTrigger>
319319
);
@@ -325,7 +325,7 @@ var GlobalSummaryView = React.createClass({
325325
<thead>
326326
<tr>
327327

328-
328+
329329
</tr>
330330
</thead>
331331
<tbody>
@@ -345,6 +345,8 @@ var GlobalModalView = React.createClass({
345345
<div className='modal-body' style={ {margin: '5%',} }>
346346

347347

348+
<Input type='text' label='Forwarding Mode' ref='fwdMode' defaultValue={obj.fwdMode} placeholder='Forwarding Mode' />
349+
348350
<Input type='text' label='name of this block(must be 'global')' ref='name' defaultValue={obj.name} placeholder='name of this block(must be 'global')' />
349351

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

client/contivModelClient.go

+1
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ type Global struct {
266266
// every object has a key
267267
Key string `json:"key,omitempty"`
268268

269+
FwdMode string `json:"fwdMode,omitempty"` // Forwarding Mode
269270
Name string `json:"name,omitempty"` // name of this block(must be 'global')
270271
NetworkInfraType string `json:"networkInfraType,omitempty"` // Network infrastructure type
271272
Vlans string `json:"vlans,omitempty"` // Allowed vlan range

client/contivModelClient.py

+1
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ def createGlobal(self, obj):
245245
postUrl = self.baseUrl + '/api/v1/globals/' + obj.name + '/'
246246

247247
jdata = json.dumps({
248+
"fwdMode": obj.fwdMode,
248249
"name": obj.name,
249250
"networkInfraType": obj.networkInfraType,
250251
"vlans": obj.vlans,

contivModel.go

+10
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ type Global struct {
140140
// every object has a key
141141
Key string `json:"key,omitempty"`
142142

143+
FwdMode string `json:"fwdMode,omitempty"` // Forwarding Mode
143144
Name string `json:"name,omitempty"` // name of this block(must be 'global')
144145
NetworkInfraType string `json:"networkInfraType,omitempty"` // Network infrastructure type
145146
Vlans string `json:"vlans,omitempty"` // Allowed vlan range
@@ -2273,6 +2274,15 @@ func ValidateGlobal(obj *Global) error {
22732274

22742275
// Validate each field
22752276

2277+
if len(obj.FwdMode) > 64 {
2278+
return errors.New("fwdMode string too long")
2279+
}
2280+
2281+
fwdModeMatch := regexp.MustCompile("^(bridge|routing)?$")
2282+
if fwdModeMatch.MatchString(obj.FwdMode) == false {
2283+
return errors.New("fwdMode string invalid format")
2284+
}
2285+
22762286
if len(obj.Name) > 64 {
22772287
return errors.New("name string too long")
22782288
}

global.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,14 @@
3030
"type": "string",
3131
"title": "Allwed vxlan range",
3232
"format": "^([0-9]{1,8}?-[0-9]{1,8}?)$"
33-
}
33+
},
34+
"fwdMode": {
35+
"type": "string",
36+
"title": "Forwarding Mode",
37+
"length": 64,
38+
"format": "^(bridge|routing)?$",
39+
"ShowSummary": true
40+
}
3441
},
3542
"operProperties": {
3643
"numNetworks": {

0 commit comments

Comments
 (0)