Skip to content

Commit 60ec7d4

Browse files
Test that upper-layer protocol numbers are matched with meta l4proto
Signed-off-by: Brad House <bhouse@nexthop.ai>
1 parent 6fd0b1a commit 60ec7d4

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎systemvm/test/TestCsAclIpv6.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,18 @@ def test_protocol_number_rule_uses_meta_l4proto(self):
5858
egress = [r['rule'] for r in config.ipv6_acl if r.get('chain') == "eth3_egress_policy" and 'rule' in r]
5959
self.assertIn("ip6 daddr 2001:db8:1::/64 meta l4proto 50 accept", egress)
6060

61+
def test_upper_layer_protocol_numbers_use_meta_l4proto(self):
62+
config = FakeConfig()
63+
rules = [{"type": "protocol", "protocol": p, "cidr": "2001:db8::/64", "allowed": True} for p in (6, 17, 58, 132)]
64+
obj = {"device": "eth3", "nic_ip": "10.1.1.1", "nic_netmask": "24", "nic_ip6_cidr": "fd00:1::/64",
65+
"ingress_rules": rules, "egress_rules": []}
66+
acl = CsAcl.AclDevice(obj, config)
67+
acl.create()
68+
69+
ingress = [r['rule'] for r in config.ipv6_acl if r.get('chain') == "eth3_ingress_policy" and 'rule' in r]
70+
for p in (6, 17, 58, 132):
71+
self.assertIn("ip6 saddr 2001:db8::/64 meta l4proto %d accept" % p, ingress)
72+
6173
def test_extension_header_number_rule(self):
6274
config = FakeConfig()
6375
rules = [{"type": "protocol", "protocol": p, "cidr": "2001:db8::/64", "allowed": False} for p in (0, 43, 44, 60, 135)]

0 commit comments

Comments
 (0)