Skip to content

Commit

Permalink
fixing minor issues (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
abhi authored and shaleman committed May 13, 2016
1 parent 118772e commit cd0fec3
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion client/contivModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ var ServiceLBModalView = React.createClass({

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

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

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

Expand Down
14 changes: 7 additions & 7 deletions client/contivModelClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ type ServiceLB struct {
// every object has a key
Key string `json:"key,omitempty"`

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

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

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

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

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

// http get the object
Expand Down
8 changes: 4 additions & 4 deletions client/contivModelClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,11 +404,11 @@ def listServiceInstance(self):
return json.loads(retData)
# Create serviceLB
def createServiceLB(self, obj):
postUrl = self.baseUrl + '/api/serviceLBs/' + obj.serviceName + ":" + obj.tenantName + '/'
postUrl = self.baseUrl + '/api/serviceLBs/' + obj.tenantName + ":" + obj.serviceName + '/'

jdata = json.dumps({
"ipAddress": obj.ipAddress,
"network": obj.network,
"networkName": obj.networkName,
"ports": obj.ports,
"selectors": obj.selectors,
"serviceName": obj.serviceName,
Expand All @@ -422,9 +422,9 @@ def createServiceLB(self, obj):
errorExit("ServiceLB create failure")

# Delete serviceLB
def deleteServiceLB(self, serviceName, tenantName):
def deleteServiceLB(self, tenantName, serviceName):
# Delete ServiceLB
deleteUrl = self.baseUrl + '/api/serviceLBs/' + serviceName + ":" + tenantName + '/'
deleteUrl = self.baseUrl + '/api/serviceLBs/' + tenantName + ":" + serviceName + '/'
response = httpDelete(deleteUrl)

if response == "Error":
Expand Down
12 changes: 6 additions & 6 deletions contivModel.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ type ServiceLB struct {
// every object has a key
Key string `json:"key,omitempty"`

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

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]))$")
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]))?$")
if ipv6SubnetMatch.MatchString(obj.Ipv6Subnet) == false {
return errors.New("ipv6Subnet string invalid format")
}
Expand Down Expand Up @@ -3195,7 +3195,7 @@ func restoreServiceLB() error {
// Validate a serviceLB object
func ValidateServiceLB(obj *ServiceLB) error {
// Validate key is correct
keyStr := obj.ServiceName + ":" + obj.TenantName
keyStr := obj.TenantName + ":" + obj.ServiceName
if obj.Key != keyStr {
log.Errorf("Expecting ServiceLB Key: %s. Got: %s", keyStr, obj.Key)
return errors.New("Invalid Key")
Expand All @@ -3207,8 +3207,8 @@ func ValidateServiceLB(obj *ServiceLB) error {
return errors.New("ipAddress string too long")
}

if len(obj.Network) > 64 {
return errors.New("network string too long")
if len(obj.NetworkName) > 64 {
return errors.New("networkName string too long")
}

if len(obj.ServiceName) > 256 {
Expand Down
2 changes: 1 addition & 1 deletion network.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
},
"ipv6Subnet": {
"type": "string",
"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]))$",
"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]))?$",
"title": "IPv6Subnet",
"showSummary": true
},
Expand Down
4 changes: 2 additions & 2 deletions servicelb.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "serviceLB",
"type": "object",
"key": ["serviceName","tenantName"],
"key": ["tenantName","serviceName"],
"properties": {
"serviceName": {
"type": "string",
Expand All @@ -17,7 +17,7 @@
"length": 64
},

"network": {
"networkName": {
"type": "string",
"title": "Service network name",
"length": 64
Expand Down

0 comments on commit cd0fec3

Please sign in to comment.