summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authormaxime <37832743+mlk-89@users.noreply.github.com>2024-11-18 20:37:36 +0100
committerGitHub <noreply@github.com>2024-11-18 21:37:36 +0200
commit67cda0147ab54136ef0604427c5a01a7f4b21986 (patch)
tree4d78ab585fcf90f2dfd6315294969199aef9ed33 /tests
parent37ba454f746ab6c4b05fef520ced523e2ad032cb (diff)
downloadvyos.vyos-67cda0147ab54136ef0604427c5a01a7f4b21986.tar.gz
vyos.vyos-67cda0147ab54136ef0604427c5a01a7f4b21986.zip
Add feature for bonding/vlan interface in the firewall_interfaces (#246)
* - Add feature for bonding interface in the firewall_interfaces - Add feature for vlan interface in the firewall_interfaces * fix a bug when invoking replaced in the module firewall_rules. * - Add feature for bonding interface in the firewall_interfaces - Add feature for vlan interface in the firewall_interfaces * test: add tests * fix: support for interface types * docs: fixed for 1.4 deprecation --------- Co-authored-by: Maxime.L <maxime@nfrance.com> Co-authored-by: Gaige B. Paulsen <gaige@cluetrust.com> Co-authored-by: Gaige B Paulsen <gaige@cluetrust.net>
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/modules/network/vyos/test_vyos_firewall_interfaces.py65
1 files changed, 65 insertions, 0 deletions
diff --git a/tests/unit/modules/network/vyos/test_vyos_firewall_interfaces.py b/tests/unit/modules/network/vyos/test_vyos_firewall_interfaces.py
index 3034d58..f921c50 100644
--- a/tests/unit/modules/network/vyos/test_vyos_firewall_interfaces.py
+++ b/tests/unit/modules/network/vyos/test_vyos_firewall_interfaces.py
@@ -388,3 +388,68 @@ class TestVyosFirewallInterfacesModule(TestVyosModule):
),
)
self.execute_module(changed=False, commands=[])
+
+ def test_vyos_firewall_rule_set_02_replaced(self):
+ set_module_args(
+ dict(
+ config=[
+ dict(
+ name="eth0.100",
+ access_rules=[
+ dict(
+ afi="ipv4",
+ rules=[dict(name="INBOUND", direction="in")],
+ ),
+ dict(
+ afi="ipv6",
+ rules=[dict(name="V6-LOCAL", direction="local")],
+ ),
+ ],
+ ),
+ dict(
+ name="bond2",
+ access_rules=[
+ dict(
+ afi="ipv4",
+ rules=[dict(name="LOCAL", direction="local")],
+ ),
+ dict(
+ afi="ipv6",
+ rules=[dict(name="V6-LOCAL", direction="local")],
+ ),
+ ],
+ ),
+ dict(
+ name="wg4",
+ access_rules=[
+ dict(
+ afi="ipv4",
+ rules=[dict(name="LOCAL", direction="local")],
+ ),
+ dict(
+ afi="ipv6",
+ rules=[dict(name="V6-LOCAL", direction="local")],
+ ),
+ ],
+ ),
+ ],
+ state="replaced",
+ ),
+ )
+ commands = [
+ 'delete interfaces ethernet eth0 firewall in name',
+ 'delete interfaces ethernet eth0 firewall local name',
+ 'delete interfaces ethernet eth0 firewall out name',
+ 'delete interfaces ethernet eth0 firewall local ipv6-name',
+ 'delete interfaces ethernet eth2 firewall in name',
+ 'delete interfaces ethernet eth2 firewall local name',
+ 'delete interfaces ethernet eth2 firewall out name',
+ 'delete interfaces ethernet eth2 firewall local ipv6-name',
+ "set interfaces ethernet eth0 vif 100 firewall in name 'INBOUND'",
+ "set interfaces ethernet eth0 vif 100 firewall local ipv6-name 'V6-LOCAL'",
+ "set interfaces bonding bond2 firewall local name 'LOCAL'",
+ "set interfaces bonding bond2 firewall local ipv6-name 'V6-LOCAL'",
+ "set interfaces wireguard wg4 firewall local name 'LOCAL'",
+ "set interfaces wireguard wg4 firewall local ipv6-name 'V6-LOCAL'"
+ ]
+ self.execute_module(changed=True, commands=commands)