Skip to content

Commit

Permalink
[OpenWrt] Added igmp_snooping property
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier committed Apr 1, 2016
1 parent 5d8e4c7 commit bfbf23d
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
15 changes: 15 additions & 0 deletions netjsonconfig/backends/openwrt/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,21 @@
{"$ref": "#/definitions/macfilter_wireless"},
]
},
"bridge_interface": {
"allOf": [
{
"properties": {
"igmp_snooping": {
"type": "boolean",
"title": "IGMP snooping",
"default": False,
"format": "checkbox",
"propertyOrder": 4,
}
}
}
]
},
"base_radio_settings": {
"required": ["driver"],
"properties": {
Expand Down
25 changes: 25 additions & 0 deletions tests/openwrt/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -1014,3 +1014,28 @@ def test_spanning_tree(self):
o.config['interfaces'][0]['stp'] = 'wrong'
with self.assertRaises(ValidationError):
o.validate()

def test_igmp(self):
o = OpenWrt({
"interfaces": [
{
"name": "br-lan",
"type": "bridge",
"igmp_snooping": True,
"bridge_members": ["eth0", "eth1"]
}
]
})
expected = self._tabs("""package network
config interface 'br_lan'
option ifname 'eth0 eth1'
option igmp_snooping '1'
option proto 'none'
option type 'bridge'
""")
self.assertEqual(o.render(), expected)
# try entering an invalid value
o.config['interfaces'][0]['igmp_snooping'] = 'wrong'
with self.assertRaises(ValidationError):
o.validate()

0 comments on commit bfbf23d

Please sign in to comment.