Fix /NetworkDriver.CreateEndpoint validation

In Interface properties, Address and AddressIPv6 are coming as empty
strings from libnetwork and that is breaking current validation logic.
Logic is added to accept empty string also for mac and ipv4 address.

Change-Id: Ib32bee76c6add1c5af616b7d74b346eef906fa8b
Closes-Bug: #1507508
This commit is contained in:
Vikas Choudhary 2015-10-19 17:33:43 +05:30
parent 15b3cfa3d9
commit 81a89f2bc2
1 changed files with 6 additions and 3 deletions

View File

@ -29,14 +29,16 @@ COMMONS = {
u'example': {}
},
u'mac': {
u'pattern': (u'^((?:[0-9a-f]{2}:){5}[0-9a-f]{2}|'
u'pattern': (u'^$|'
u'^((?:[0-9a-f]{2}:){5}[0-9a-f]{2}|'
u'(?:[0-9A-F]{2}:){5}[0-9A-F]{2})$'),
u'type': u'string',
u'description': u'A MAC address.',
u'example': u'aa:bb:cc:dd:ee:ff'
},
u'cidrv6': {
u'pattern': (u'^(('
u'pattern': (u'^$|'
u'^(('
u'([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|'
u'([0-9a-fA-F]{1,4}:){1,7}:|'
u'([0-9a-fA-F]{1,4}:){1,6}\:[0-9a-fA-F]{1,4}|'
@ -85,7 +87,8 @@ COMMONS = {
}
},
u'cidr': {
u'pattern': (u'^((25[0-5]|2[0-4][0-9]|1?[0-9]?[0-9])\\.){3}'
u'pattern': (u'^$|'
u'^((25[0-5]|2[0-4][0-9]|1?[0-9]?[0-9])\\.){3}'
u'(25[0-5]|2[0-4][0-9]|1?[0-9]?[0-9])'
u'/(3[0-2]|((1|2)?[0-9]))$'),
u'type': u'string',