Skip to content

Commit cd0fec3

Browse files
abhishaleman
authored andcommitted
fixing minor issues (#21)
1 parent 118772e commit cd0fec3

6 files changed

+21
-21
lines changed

client/contivModel.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ var ServiceLBModalView = React.createClass({
730730

731731
<Input type='text' label='Service ip' ref='ipAddress' defaultValue={obj.ipAddress} placeholder='Service ip' />
732732

733-
<Input type='text' label='Service network name' ref='network' defaultValue={obj.network} placeholder='Service network name' />
733+
<Input type='text' label='Service network name' ref='networkName' defaultValue={obj.networkName} placeholder='Service network name' />
734734

735735
<Input type='text' label='service provider port' ref='ports' defaultValue={obj.ports} placeholder='service provider port' />
736736

client/contivModelClient.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,8 @@ type ServiceLB struct {
356356
// every object has a key
357357
Key string `json:"key,omitempty"`
358358

359-
IpAddress string `json:"ipAddress,omitempty"` // Service ip
360-
Network string `json:"network,omitempty"` // Service network name
359+
IpAddress string `json:"ipAddress,omitempty"` // Service ip
360+
NetworkName string `json:"networkName,omitempty"` // Service network name
361361
Ports []string `json:"ports,omitempty"`
362362
Selectors []string `json:"selectors,omitempty"`
363363
ServiceName string `json:"serviceName,omitempty"` // service name
@@ -1028,7 +1028,7 @@ func (c *ContivClient) ServiceInstanceDelete(tenantName string, appName string,
10281028
// ServiceLBPost posts the serviceLB object
10291029
func (c *ContivClient) ServiceLBPost(obj *ServiceLB) error {
10301030
// build key and URL
1031-
keyStr := obj.ServiceName + ":" + obj.TenantName
1031+
keyStr := obj.TenantName + ":" + obj.ServiceName
10321032
url := c.baseURL + "/api/serviceLBs/" + keyStr + "/"
10331033

10341034
// http post the object
@@ -1058,9 +1058,9 @@ func (c *ContivClient) ServiceLBList() (*[]*ServiceLB, error) {
10581058
}
10591059

10601060
// ServiceLBGet gets the serviceLB object
1061-
func (c *ContivClient) ServiceLBGet(serviceName string, tenantName string) (*ServiceLB, error) {
1061+
func (c *ContivClient) ServiceLBGet(tenantName string, serviceName string) (*ServiceLB, error) {
10621062
// build key and URL
1063-
keyStr := serviceName + ":" + tenantName
1063+
keyStr := tenantName + ":" + serviceName
10641064
url := c.baseURL + "/api/serviceLBs/" + keyStr + "/"
10651065

10661066
// http get the object
@@ -1075,9 +1075,9 @@ func (c *ContivClient) ServiceLBGet(serviceName string, tenantName string) (*Ser
10751075
}
10761076

10771077
// ServiceLBDelete deletes the serviceLB object
1078-
func (c *ContivClient) ServiceLBDelete(serviceName string, tenantName string) error {
1078+
func (c *ContivClient) ServiceLBDelete(tenantName string, serviceName string) error {
10791079
// build key and URL
1080-
keyStr := serviceName + ":" + tenantName
1080+
keyStr := tenantName + ":" + serviceName
10811081
url := c.baseURL + "/api/serviceLBs/" + keyStr + "/"
10821082

10831083
// http get the object

client/contivModelClient.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -404,11 +404,11 @@ def listServiceInstance(self):
404404
return json.loads(retData)
405405
# Create serviceLB
406406
def createServiceLB(self, obj):
407-
postUrl = self.baseUrl + '/api/serviceLBs/' + obj.serviceName + ":" + obj.tenantName + '/'
407+
postUrl = self.baseUrl + '/api/serviceLBs/' + obj.tenantName + ":" + obj.serviceName + '/'
408408

409409
jdata = json.dumps({
410410
"ipAddress": obj.ipAddress,
411-
"network": obj.network,
411+
"networkName": obj.networkName,
412412
"ports": obj.ports,
413413
"selectors": obj.selectors,
414414
"serviceName": obj.serviceName,
@@ -422,9 +422,9 @@ def createServiceLB(self, obj):
422422
errorExit("ServiceLB create failure")
423423

424424
# Delete serviceLB
425-
def deleteServiceLB(self, serviceName, tenantName):
425+
def deleteServiceLB(self, tenantName, serviceName):
426426
# Delete ServiceLB
427-
deleteUrl = self.baseUrl + '/api/serviceLBs/' + serviceName + ":" + tenantName + '/'
427+
deleteUrl = self.baseUrl + '/api/serviceLBs/' + tenantName + ":" + serviceName + '/'
428428
response = httpDelete(deleteUrl)
429429

430430
if response == "Error":

contivModel.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ type ServiceLB struct {
225225
// every object has a key
226226
Key string `json:"key,omitempty"`
227227

228-
IpAddress string `json:"ipAddress,omitempty"` // Service ip
229-
Network string `json:"network,omitempty"` // Service network name
228+
IpAddress string `json:"ipAddress,omitempty"` // Service ip
229+
NetworkName string `json:"networkName,omitempty"` // Service network name
230230
Ports []string `json:"ports,omitempty"`
231231
Selectors []string `json:"selectors,omitempty"`
232232
ServiceName string `json:"serviceName,omitempty"` // service name
@@ -1922,7 +1922,7 @@ func ValidateNetwork(obj *Network) error {
19221922
return errors.New("ipv6Gateway string invalid format")
19231923
}
19241924

1925-
ipv6SubnetMatch := regexp.MustCompile("^((((([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}|\\:)))/(1[0-2][0-7]|[1-9][0-9]|[1-9]))$")
1925+
ipv6SubnetMatch := regexp.MustCompile("^((((([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}|\\:)))/(1[0-2][0-7]|[1-9][0-9]|[1-9]))?$")
19261926
if ipv6SubnetMatch.MatchString(obj.Ipv6Subnet) == false {
19271927
return errors.New("ipv6Subnet string invalid format")
19281928
}
@@ -3195,7 +3195,7 @@ func restoreServiceLB() error {
31953195
// Validate a serviceLB object
31963196
func ValidateServiceLB(obj *ServiceLB) error {
31973197
// Validate key is correct
3198-
keyStr := obj.ServiceName + ":" + obj.TenantName
3198+
keyStr := obj.TenantName + ":" + obj.ServiceName
31993199
if obj.Key != keyStr {
32003200
log.Errorf("Expecting ServiceLB Key: %s. Got: %s", keyStr, obj.Key)
32013201
return errors.New("Invalid Key")
@@ -3207,8 +3207,8 @@ func ValidateServiceLB(obj *ServiceLB) error {
32073207
return errors.New("ipAddress string too long")
32083208
}
32093209

3210-
if len(obj.Network) > 64 {
3211-
return errors.New("network string too long")
3210+
if len(obj.NetworkName) > 64 {
3211+
return errors.New("networkName string too long")
32123212
}
32133213

32143214
if len(obj.ServiceName) > 256 {

network.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
},
5050
"ipv6Subnet": {
5151
"type": "string",
52-
"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}|\\\\:)))/(1[0-2][0-7]|[1-9][0-9]|[1-9]))$",
52+
"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}|\\\\:)))/(1[0-2][0-7]|[1-9][0-9]|[1-9]))?$",
5353
"title": "IPv6Subnet",
5454
"showSummary": true
5555
},

servicelb.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
{
55
"name": "serviceLB",
66
"type": "object",
7-
"key": ["serviceName","tenantName"],
7+
"key": ["tenantName","serviceName"],
88
"properties": {
99
"serviceName": {
1010
"type": "string",
@@ -17,7 +17,7 @@
1717
"length": 64
1818
},
1919

20-
"network": {
20+
"networkName": {
2121
"type": "string",
2222
"title": "Service network name",
2323
"length": 64

0 commit comments

Comments
 (0)