Skip to content

Commit 73fe9d8

Browse files
authored
Merge pull request #65 from gkvijay/compose
Adding tag field for docker network workflow
2 parents d321a4c + 48db6a3 commit 73fe9d8

File tree

8 files changed

+593
-481
lines changed

8 files changed

+593
-481
lines changed

client/contivModel.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ var EndpointGroupSummaryView = React.createClass({
252252
<ModalTrigger modal={<EndpointGroupModalView endpointGroup={ endpointGroup }/>}>
253253
<tr key={ endpointGroup.key } className="info">
254254

255-
255+
256256
</tr>
257257
</ModalTrigger>
258258
);
@@ -264,7 +264,7 @@ var EndpointGroupSummaryView = React.createClass({
264264
<thead>
265265
<tr>
266266

267-
267+
268268
</tr>
269269
</thead>
270270
<tbody>
@@ -284,6 +284,8 @@ var EndpointGroupModalView = React.createClass({
284284
<div className='modal-body' style={ {margin: '5%',} }>
285285

286286

287+
<Input type='text' label='Configured Group Tag' ref='cfgdTag' defaultValue={obj.cfgdTag} placeholder='Configured Group Tag' />
288+
287289
<Input type='text' label='External contracts' ref='extContractsGrps' defaultValue={obj.extContractsGrps} placeholder='External contracts' />
288290

289291
<Input type='text' label='Group name' ref='groupName' defaultValue={obj.groupName} placeholder='Group name' />
@@ -510,7 +512,7 @@ var NetworkSummaryView = React.createClass({
510512
<ModalTrigger modal={<NetworkModalView network={ network }/>}>
511513
<tr key={ network.key } className="info">
512514

513-
515+
514516
</tr>
515517
</ModalTrigger>
516518
);
@@ -522,7 +524,7 @@ var NetworkSummaryView = React.createClass({
522524
<thead>
523525
<tr>
524526

525-
527+
526528
</tr>
527529
</thead>
528530
<tbody>
@@ -542,6 +544,8 @@ var NetworkModalView = React.createClass({
542544
<div className='modal-body' style={ {margin: '5%',} }>
543545

544546

547+
<Input type='text' label='Configured Network Tag' ref='cfgdTag' defaultValue={obj.cfgdTag} placeholder='Configured Network Tag' />
548+
545549
<Input type='text' label='Encapsulation' ref='encap' defaultValue={obj.encap} placeholder='Encapsulation' />
546550

547551
<Input type='text' label='Gateway' ref='gateway' defaultValue={obj.gateway} placeholder='Gateway' />

client/contivModelClient.go

+4
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ type EndpointGroup struct {
317317
// every object has a key
318318
Key string `json:"key,omitempty"`
319319

320+
CfgdTag string `json:"cfgdTag,omitempty"` // Configured Group Tag
320321
ExtContractsGrps []string `json:"extContractsGrps,omitempty"`
321322
GroupName string `json:"groupName,omitempty"` // Group name
322323
IpPool string `json:"ipPool,omitempty"` // IP-pool
@@ -352,6 +353,7 @@ type EndpointGroupOper struct {
352353
AvailableIPAddresses string `json:"availableIPAddresses,omitempty"` // Available IP addresses
353354
Endpoints []EndpointOper `json:"endpoints,omitempty"`
354355
ExternalPktTag int `json:"externalPktTag,omitempty"` // external packet tag
356+
GroupTag string `json:"groupTag,omitempty"` // Derived EndpointGroup Tag
355357
NumEndpoints int `json:"numEndpoints,omitempty"` // number of endpoints
356358
PktTag int `json:"pktTag,omitempty"` // internal packet tag
357359

@@ -457,6 +459,7 @@ type Network struct {
457459
// every object has a key
458460
Key string `json:"key,omitempty"`
459461

462+
CfgdTag string `json:"cfgdTag,omitempty"` // Configured Network Tag
460463
Encap string `json:"encap,omitempty"` // Encapsulation
461464
Gateway string `json:"gateway,omitempty"` // Gateway
462465
Ipv6Gateway string `json:"ipv6Gateway,omitempty"` // IPv6Gateway
@@ -491,6 +494,7 @@ type NetworkOper struct {
491494
AvailableIPAddresses string `json:"availableIPAddresses,omitempty"` // Available IP addresses
492495
Endpoints []EndpointOper `json:"endpoints,omitempty"`
493496
ExternalPktTag int `json:"externalPktTag,omitempty"` // external packet tag
497+
NetworkTag string `json:"networkTag,omitempty"` // Derived Network Tag
494498
NumEndpoints int `json:"numEndpoints,omitempty"` // external packet tag
495499
PktTag int `json:"pktTag,omitempty"` // internal packet tag
496500

client/contivModelClient.py

+2
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ def createEndpointGroup(self, obj):
227227
postUrl = self.baseUrl + '/api/v1/endpointGroups/' + obj.tenantName + ":" + obj.groupName + '/'
228228

229229
jdata = json.dumps({
230+
"cfgdTag": obj.cfgdTag,
230231
"extContractsGrps": obj.extContractsGrps,
231232
"groupName": obj.groupName,
232233
"ipPool": obj.ipPool,
@@ -406,6 +407,7 @@ def createNetwork(self, obj):
406407
postUrl = self.baseUrl + '/api/v1/networks/' + obj.tenantName + ":" + obj.networkName + '/'
407408

408409
jdata = json.dumps({
410+
"cfgdTag": obj.cfgdTag,
409411
"encap": obj.encap,
410412
"gateway": obj.gateway,
411413
"ipv6Gateway": obj.ipv6Gateway,

contivModel.go

+22
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ type EndpointGroup struct {
121121
// every object has a key
122122
Key string `json:"key,omitempty"`
123123

124+
CfgdTag string `json:"cfgdTag,omitempty"` // Configured Group Tag
124125
ExtContractsGrps []string `json:"extContractsGrps,omitempty"`
125126
GroupName string `json:"groupName,omitempty"` // Group name
126127
IpPool string `json:"ipPool,omitempty"` // IP-pool
@@ -159,6 +160,7 @@ type EndpointGroupOper struct {
159160
AvailableIPAddresses string `json:"availableIPAddresses,omitempty"` // Available IP addresses
160161
Endpoints []EndpointOper `json:"endpoints,omitempty"`
161162
ExternalPktTag int `json:"externalPktTag,omitempty"` // external packet tag
163+
GroupTag string `json:"groupTag,omitempty"` // Derived EndpointGroup Tag
162164
NumEndpoints int `json:"numEndpoints,omitempty"` // number of endpoints
163165
PktTag int `json:"pktTag,omitempty"` // internal packet tag
164166

@@ -252,6 +254,7 @@ type Network struct {
252254
// every object has a key
253255
Key string `json:"key,omitempty"`
254256

257+
CfgdTag string `json:"cfgdTag,omitempty"` // Configured Network Tag
255258
Encap string `json:"encap,omitempty"` // Encapsulation
256259
Gateway string `json:"gateway,omitempty"` // Gateway
257260
Ipv6Gateway string `json:"ipv6Gateway,omitempty"` // IPv6Gateway
@@ -285,6 +288,7 @@ type NetworkOper struct {
285288
AvailableIPAddresses string `json:"availableIPAddresses,omitempty"` // Available IP addresses
286289
Endpoints []EndpointOper `json:"endpoints,omitempty"`
287290
ExternalPktTag int `json:"externalPktTag,omitempty"` // external packet tag
291+
NetworkTag string `json:"networkTag,omitempty"` // Derived Network Tag
288292
NumEndpoints int `json:"numEndpoints,omitempty"` // external packet tag
289293
PktTag int `json:"pktTag,omitempty"` // internal packet tag
290294

@@ -2429,6 +2433,15 @@ func ValidateEndpointGroup(obj *EndpointGroup) error {
24292433

24302434
// Validate each field
24312435

2436+
if len(obj.CfgdTag) > 128 {
2437+
return errors.New("cfgdTag string too long")
2438+
}
2439+
2440+
cfgdTagMatch := regexp.MustCompile("^((([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9]))?$")
2441+
if cfgdTagMatch.MatchString(obj.CfgdTag) == false {
2442+
return errors.New("cfgdTag string invalid format")
2443+
}
2444+
24322445
if len(obj.GroupName) > 64 {
24332446
return errors.New("groupName string too long")
24342447
}
@@ -3765,6 +3778,15 @@ func ValidateNetwork(obj *Network) error {
37653778

37663779
// Validate each field
37673780

3781+
if len(obj.CfgdTag) > 128 {
3782+
return errors.New("cfgdTag string too long")
3783+
}
3784+
3785+
cfgdTagMatch := regexp.MustCompile("^((([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9]))?$")
3786+
if cfgdTagMatch.MatchString(obj.CfgdTag) == false {
3787+
return errors.New("cfgdTag string invalid format")
3788+
}
3789+
37683790
encapMatch := regexp.MustCompile("^(vlan|vxlan)$")
37693791
if encapMatch.MatchString(obj.Encap) == false {
37703792
return errors.New("encap string invalid format")

endpointGroup.json

+11-1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@
5353
"Title": "Network profile name",
5454
"Length": 64,
5555
"ShowSummary": true
56+
},
57+
"cfgdTag": {
58+
"type": "string",
59+
"Title": "Configured Group Tag",
60+
"Length": 128,
61+
"format": "^((([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9]))?$",
62+
"ShowSummary": true
5663
}
5764
},
5865
"operProperties": {
@@ -80,8 +87,11 @@
8087
"availableIPAddresses": {
8188
"type": "string",
8289
"title": "Available IP addresses"
90+
},
91+
"groupTag": {
92+
"type": "string",
93+
"title": "Derived EndpointGroup Tag"
8394
}
84-
8595
},
8696
"link-sets": {
8797
"services": {

network.json

+10
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@
6262
"format": "^(((([0-9]|[a-f]|[A-F]){1,4})((\\\\:([0-9]|[a-f]|[A-F]){1,4}){7}))|(((([0-9]|[a-f]|[A-F]){1,4}\\\\:){0,6}|\\\\:)((\\\\:([0-9]|[a-f]|[A-F]){1,4}){0,6}|\\\\:)))?$",
6363
"title": "IPv6Gateway",
6464
"showSummary": true
65+
},
66+
"cfgdTag": {
67+
"type": "string",
68+
"title": "Configured Network Tag",
69+
"length": 128,
70+
"format": "^((([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\\\-]*[a-zA-Z0-9])\\\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\\\-]*[A-Za-z0-9]))?$"
6571
}
6672
},
6773
"operProperties": {
@@ -93,6 +99,10 @@
9399
"type": "array",
94100
"items": "endpoint",
95101
"title": "endpoints in the network"
102+
},
103+
"networkTag": {
104+
"type": "string",
105+
"title": "Derived Network Tag"
96106
}
97107
},
98108
"link-sets": {

0 commit comments

Comments
 (0)