Permalink
Browse files

[schema] Validate interface ipv4 address format #42

  • Loading branch information...
nemesisdesign committed Apr 3, 2016
1 parent ef8c296 commit 2f23cfd28aa1a010cbccf27299831a895fd71ecf
Showing with 22 additions and 0 deletions.
  1. +22 −0 tests/openwrt/test_formats.py
@@ -15,3 +15,25 @@ def test_general_hostname(self):
o.config['general']['hostname'] = 'valid'
o.validate()
def test_interface_ipv4(self):
o = OpenWrt({
"interfaces": [
{
"name": "eth0",
"type": "ethernet",
"addresses": [
{
"family": "ipv4",
"proto": "static",
"address": "10.0.0.1",
"mask": 28
}
]
}
]
})
o.validate()
# invalid ipv4
o.config['interfaces'][0]['addresses'][0]['address'] = '127_0_0_1'
with self.assertRaises(ValidationError):
o.validate()

0 comments on commit 2f23cfd

Please sign in to comment.