Skip to content

Commit

Permalink
ip addr range fixes (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
shaleman committed Jun 30, 2016
1 parent de250b0 commit 508ec31
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions client/contivModelClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ type NetworkLinks struct {
type NetworkOper struct {
AllocatedAddressesCount int `json:"allocatedAddressesCount,omitempty"` // Vlan/Vxlan Tag
AllocatedIPAddresses string `json:"allocatedIPAddresses,omitempty"` // allocated IP addresses
AvailableIPAddresses string `json:"availableIPAddresses,omitempty"` // Available IP addresses
DnsServerIP string `json:"dnsServerIP,omitempty"` // dns IP for the network
Endpoints []EndpointOper `json:"endpoints,omitempty"`
ExternalPktTag int `json:"externalPktTag,omitempty"` // external packet tag
Expand Down
3 changes: 2 additions & 1 deletion contivModel.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ type NetworkLinks struct {
type NetworkOper struct {
AllocatedAddressesCount int `json:"allocatedAddressesCount,omitempty"` // Vlan/Vxlan Tag
AllocatedIPAddresses string `json:"allocatedIPAddresses,omitempty"` // allocated IP addresses
AvailableIPAddresses string `json:"availableIPAddresses,omitempty"` // Available IP addresses
DnsServerIP string `json:"dnsServerIP,omitempty"` // dns IP for the network
Endpoints []EndpointOper `json:"endpoints,omitempty"`
ExternalPktTag int `json:"externalPktTag,omitempty"` // external packet tag
Expand Down Expand Up @@ -2562,7 +2563,7 @@ func ValidateNetwork(obj *Network) error {
return errors.New("pktTag Value Out of bound")
}

subnetMatch := 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})(\\-(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9]))?/(3[0-1]|2[0-9]|1[0-9]|[1-9])$")
subnetMatch := 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})(\\-((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}))?/(3[0-1]|2[0-9]|1[0-9]|[1-9])$")
if subnetMatch.MatchString(obj.Subnet) == false {
return errors.New("subnet string invalid format")
}
Expand Down
6 changes: 5 additions & 1 deletion network.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
},
"subnet": {
"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})(\\\\-(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9]))?/(3[0-1]|2[0-9]|1[0-9]|[1-9])$",
"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})(\\\\-((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}))?/(3[0-1]|2[0-9]|1[0-9]|[1-9])$",
"title": "Subnet",
"showSummary": true
},
Expand Down Expand Up @@ -85,6 +85,10 @@
"type": "string",
"title": "allocated IP addresses"
},
"availableIPAddresses": {
"type": "string",
"title": "Available IP addresses"
},
"dnsServerIP": {
"type": "string",
"title": "dns IP for the network"
Expand Down

0 comments on commit 508ec31

Please sign in to comment.