@@ -1143,8 +1143,10 @@ def test_zone_with_vrf(self):
11431143 self .cli_set (['vrf' , 'name' , 'VRF-1' , 'table' , '101' ])
11441144 self .cli_set (['vrf' , 'name' , 'VRF-2' , 'table' , '102' ])
11451145 self .cli_set (['interfaces' , 'ethernet' , 'eth0' , 'vrf' , 'VRF-1' ])
1146- self .cli_set (['interfaces' , 'vti' , 'vti1' , 'vrf' , 'VRF-2' ])
1146+ self .cli_set (['interfaces' , 'vti' , 'vti1' , 'vrf' , 'VRF-1' ])
1147+ self .cli_set (['interfaces' , 'vti' , 'vti2' , 'vrf' , 'VRF-2' ])
11471148
1149+ # commit the config
11481150 self .cli_commit ()
11491151
11501152 nftables_search = [
@@ -1155,8 +1157,10 @@ def test_zone_with_vrf(self):
11551157 ['chain VYOS_ZONE_FORWARD' ],
11561158 ['type filter hook forward priority filter + 1' ],
11571159 ['oifname { "eth1", "eth2" }' , 'counter packets' , 'jump VZONE_ZONE1' ],
1160+ ['oifname { "eth0", "vti1" }' , 'counter packets' , 'jump VZONE_ZONE1' ],
11581161 ['oifname "VRF-1"' , 'counter packets' , 'jump VZONE_ZONE1' ],
11591162 ['oifname "vtun66"' , 'counter packets' , 'jump VZONE_ZONE2' ],
1163+ ['oifname "vti2"' , 'counter packets' , 'jump VZONE_ZONE2' ],
11601164 ['oifname "VRF-2"' , 'counter packets' , 'jump VZONE_ZONE2' ],
11611165 ['chain VYOS_ZONE_LOCAL' ],
11621166 ['type filter hook input priority filter + 1' ],
@@ -1190,8 +1194,10 @@ def test_zone_with_vrf(self):
11901194 ['chain VYOS_ZONE_FORWARD' ],
11911195 ['type filter hook forward priority filter + 1' ],
11921196 ['oifname { "eth1", "eth2" }' , 'counter packets' , 'jump VZONE_ZONE1' ],
1197+ ['oifname { "eth0", "vti1" }' , 'counter packets' , 'jump VZONE_ZONE1' ],
11931198 ['oifname "VRF-1"' , 'counter packets' , 'jump VZONE_ZONE1' ],
11941199 ['oifname "vtun66"' , 'counter packets' , 'jump VZONE_ZONE2' ],
1200+ ['oifname "vti2"' , 'counter packets' , 'jump VZONE_ZONE2' ],
11951201 ['oifname "VRF-2"' , 'counter packets' , 'jump VZONE_ZONE2' ],
11961202 ['chain VYOS_ZONE_LOCAL' ],
11971203 ['type filter hook input priority filter + 1' ],
@@ -1203,6 +1209,7 @@ def test_zone_with_vrf(self):
12031209 ['counter packets' , 'drop' , 'comment "zone_LOCAL default-action drop"' ],
12041210 ['chain VZONE_LOCAL_OUT' ],
12051211 ['oifname "vtun66"' , 'counter packets' , 'jump NAME6_LOCAL_to_ZONE2_v6' ],
1212+ ['oifname "vti2"' , 'counter packets' , 'jump NAME6_LOCAL_to_ZONE2_v6' ],
12061213 ['oifname "VRF-2"' , 'counter packets' , 'jump NAME6_LOCAL_to_ZONE2_v6' ],
12071214 ['counter packets' , 'drop' , 'comment "zone_LOCAL default-action drop"' ],
12081215 ['chain VZONE_ZONE1' ],
@@ -1218,6 +1225,23 @@ def test_zone_with_vrf(self):
12181225 self .verify_nftables (nftables_search , 'ip vyos_filter' )
12191226 self .verify_nftables (nftables_search_v6 , 'ip6 vyos_filter' )
12201227
1228+ # change memberships in vrf
1229+ self .cli_set (['interfaces' , 'vti' , 'vti1' , 'vrf' , 'VRF-2' ])
1230+ self .cli_commit ()
1231+
1232+ # make som verifications to ensure the interface swapped vrf
1233+ nftables_search = [
1234+ ['oifname "eth0"' , 'counter packets' , 'jump VZONE_ZONE1' ],
1235+ ['oifname { "vti1", "vti2" }' , 'counter packets' , 'jump VZONE_ZONE2' ],
1236+ ]
1237+
1238+ nftables_search_v6 = [
1239+ ['oifname "eth0"' , 'counter packets' , 'jump VZONE_ZONE1' ],
1240+ ['oifname { "vti1", "vti2" }' , 'counter packets' , 'jump VZONE_ZONE2' ],
1241+ ]
1242+ self .verify_nftables (nftables_search , 'ip vyos_filter' )
1243+ self .verify_nftables (nftables_search_v6 , 'ip6 vyos_filter' )
1244+
12211245 def test_zone_without_member (self ):
12221246 self .cli_set (['firewall' , 'zone' , 'wan' , 'default-action' , 'drop' ])
12231247 error_message = 'Zone "wan" has no interfaces and is not the local zone'
0 commit comments