Renato Botelho do Couto | ead1e53 | 2019-10-31 13:31:07 -0500 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 2 | |
| 3 | import unittest |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 4 | |
Dave Wallace | 8800f73 | 2023-08-31 00:47:44 -0400 | [diff] [blame] | 5 | from framework import VppTestCase |
| 6 | from asfframework import VppTestRunner |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 7 | from vpp_ip_route import VppIpRoute, VppRoutePath |
Neale Ranns | 93cc3ee | 2018-10-10 07:22:51 -0700 | [diff] [blame] | 8 | from vpp_l2 import L2_PORT_TYPE, BRIDGE_FLAGS |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 9 | |
| 10 | from scapy.packet import Raw |
| 11 | from scapy.layers.l2 import Ether |
| 12 | from scapy.layers.inet import IP, UDP |
| 13 | |
Paul Vinciguerra | 4271c97 | 2019-05-14 13:25:49 -0400 | [diff] [blame] | 14 | NUM_PKTS = 67 |
| 15 | |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 16 | |
| 17 | class TestL2Flood(VppTestCase): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 18 | """L2-flood""" |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 19 | |
Paul Vinciguerra | 7f9b7f9 | 2019-03-12 19:23:27 -0700 | [diff] [blame] | 20 | @classmethod |
| 21 | def setUpClass(cls): |
| 22 | super(TestL2Flood, cls).setUpClass() |
| 23 | |
| 24 | @classmethod |
| 25 | def tearDownClass(cls): |
| 26 | super(TestL2Flood, cls).tearDownClass() |
| 27 | |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 28 | def setUp(self): |
| 29 | super(TestL2Flood, self).setUp() |
| 30 | |
| 31 | # 12 l2 interface and one l3 |
| 32 | self.create_pg_interfaces(range(13)) |
Neale Ranns | 192b13f | 2019-03-15 02:16:20 -0700 | [diff] [blame] | 33 | self.create_bvi_interfaces(1) |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 34 | |
| 35 | for i in self.pg_interfaces: |
| 36 | i.admin_up() |
Neale Ranns | 192b13f | 2019-03-15 02:16:20 -0700 | [diff] [blame] | 37 | for i in self.bvi_interfaces: |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 38 | i.admin_up() |
| 39 | |
| 40 | self.pg12.config_ip4() |
| 41 | self.pg12.resolve_arp() |
Neale Ranns | 192b13f | 2019-03-15 02:16:20 -0700 | [diff] [blame] | 42 | self.bvi0.config_ip4() |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 43 | |
| 44 | def tearDown(self): |
| 45 | self.pg12.unconfig_ip4() |
Neale Ranns | 192b13f | 2019-03-15 02:16:20 -0700 | [diff] [blame] | 46 | self.bvi0.unconfig_ip4() |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 47 | |
| 48 | for i in self.pg_interfaces: |
| 49 | i.admin_down() |
Neale Ranns | 192b13f | 2019-03-15 02:16:20 -0700 | [diff] [blame] | 50 | for i in self.bvi_interfaces: |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 51 | i.admin_down() |
| 52 | super(TestL2Flood, self).tearDown() |
| 53 | |
| 54 | def test_flood(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 55 | """L2 Flood Tests""" |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 56 | |
| 57 | # |
| 58 | # Create a single bridge Domain |
| 59 | # |
Laszlo Kiraly | 0f8f435 | 2022-09-16 13:20:07 +0200 | [diff] [blame] | 60 | self.vapi.bridge_domain_add_del_v2( |
| 61 | bd_id=1, is_add=1, flood=1, uu_flood=1, forward=1, learn=1 |
| 62 | ) |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 63 | |
| 64 | # |
| 65 | # add each interface to the BD. 3 interfaces per split horizon group |
| 66 | # |
| 67 | for i in self.pg_interfaces[0:4]: |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 68 | self.vapi.sw_interface_set_l2_bridge( |
| 69 | rx_sw_if_index=i.sw_if_index, bd_id=1, shg=0 |
| 70 | ) |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 71 | for i in self.pg_interfaces[4:8]: |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 72 | self.vapi.sw_interface_set_l2_bridge( |
| 73 | rx_sw_if_index=i.sw_if_index, bd_id=1, shg=1 |
| 74 | ) |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 75 | for i in self.pg_interfaces[8:12]: |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 76 | self.vapi.sw_interface_set_l2_bridge( |
| 77 | rx_sw_if_index=i.sw_if_index, bd_id=1, shg=2 |
| 78 | ) |
Neale Ranns | 192b13f | 2019-03-15 02:16:20 -0700 | [diff] [blame] | 79 | for i in self.bvi_interfaces: |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 80 | self.vapi.sw_interface_set_l2_bridge( |
| 81 | rx_sw_if_index=i.sw_if_index, bd_id=1, shg=2, port_type=L2_PORT_TYPE.BVI |
| 82 | ) |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 83 | |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 84 | p = ( |
| 85 | Ether(dst="ff:ff:ff:ff:ff:ff", src="00:00:de:ad:be:ef") |
| 86 | / IP(src="10.10.10.10", dst="1.1.1.1") |
| 87 | / UDP(sport=1234, dport=1234) |
| 88 | / Raw(b"\xa5" * 100) |
| 89 | ) |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 90 | |
| 91 | # |
| 92 | # input on pg0 expect copies on pg1->11 |
| 93 | # this is in SHG=0 so its flooded to all, expect the pg0 since that's |
| 94 | # the ingress link |
| 95 | # |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 96 | self.pg0.add_stream(p * NUM_PKTS) |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 97 | self.pg_enable_capture(self.pg_interfaces) |
| 98 | self.pg_start() |
| 99 | |
| 100 | for i in self.pg_interfaces[1:12]: |
Paul Vinciguerra | 4271c97 | 2019-05-14 13:25:49 -0400 | [diff] [blame] | 101 | rx0 = i.get_capture(NUM_PKTS, timeout=1) |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 102 | |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 103 | # |
| 104 | # input on pg4 (SHG=1) expect copies on pg0->3 (SHG=0) |
| 105 | # and pg8->11 (SHG=2) |
| 106 | # |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 107 | self.pg4.add_stream(p * NUM_PKTS) |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 108 | self.pg_enable_capture(self.pg_interfaces) |
| 109 | self.pg_start() |
| 110 | |
| 111 | for i in self.pg_interfaces[:4]: |
Paul Vinciguerra | 4271c97 | 2019-05-14 13:25:49 -0400 | [diff] [blame] | 112 | rx0 = i.get_capture(NUM_PKTS, timeout=1) |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 113 | for i in self.pg_interfaces[8:12]: |
Paul Vinciguerra | 4271c97 | 2019-05-14 13:25:49 -0400 | [diff] [blame] | 114 | rx0 = i.get_capture(NUM_PKTS, timeout=1) |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 115 | for i in self.pg_interfaces[4:8]: |
| 116 | i.assert_nothing_captured(remark="Different SH group") |
| 117 | |
| 118 | # |
| 119 | # An IP route so the packet that hits the BVI is sent out of pg12 |
| 120 | # |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 121 | ip_route = VppIpRoute( |
| 122 | self, |
| 123 | "1.1.1.1", |
| 124 | 32, |
| 125 | [VppRoutePath(self.pg12.remote_ip4, self.pg12.sw_if_index)], |
| 126 | ) |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 127 | ip_route.add_vpp_config() |
| 128 | |
| 129 | self.logger.info(self.vapi.cli("sh bridge 1 detail")) |
| 130 | |
| 131 | # |
| 132 | # input on pg0 expect copies on pg1->12 |
| 133 | # this is in SHG=0 so its flooded to all, expect the pg0 since that's |
| 134 | # the ingress link |
| 135 | # |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 136 | self.pg0.add_stream(p * NUM_PKTS) |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 137 | self.pg_enable_capture(self.pg_interfaces) |
| 138 | self.pg_start() |
| 139 | |
| 140 | for i in self.pg_interfaces[1:]: |
Paul Vinciguerra | 4271c97 | 2019-05-14 13:25:49 -0400 | [diff] [blame] | 141 | rx0 = i.get_capture(NUM_PKTS, timeout=1) |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 142 | |
| 143 | # |
| 144 | # input on pg4 (SHG=1) expect copies on pg0->3 (SHG=0) |
| 145 | # and pg8->12 (SHG=2) |
| 146 | # |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 147 | self.pg4.add_stream(p * NUM_PKTS) |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 148 | self.pg_enable_capture(self.pg_interfaces) |
| 149 | self.pg_start() |
| 150 | |
| 151 | for i in self.pg_interfaces[:4]: |
Paul Vinciguerra | 4271c97 | 2019-05-14 13:25:49 -0400 | [diff] [blame] | 152 | rx0 = i.get_capture(NUM_PKTS, timeout=1) |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 153 | for i in self.pg_interfaces[8:13]: |
Paul Vinciguerra | 4271c97 | 2019-05-14 13:25:49 -0400 | [diff] [blame] | 154 | rx0 = i.get_capture(NUM_PKTS, timeout=1) |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 155 | for i in self.pg_interfaces[4:8]: |
| 156 | i.assert_nothing_captured(remark="Different SH group") |
| 157 | |
| 158 | # |
| 159 | # cleanup |
| 160 | # |
| 161 | for i in self.pg_interfaces[:12]: |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 162 | self.vapi.sw_interface_set_l2_bridge( |
| 163 | rx_sw_if_index=i.sw_if_index, bd_id=1, enable=0 |
| 164 | ) |
Neale Ranns | 192b13f | 2019-03-15 02:16:20 -0700 | [diff] [blame] | 165 | for i in self.bvi_interfaces: |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 166 | self.vapi.sw_interface_set_l2_bridge( |
| 167 | rx_sw_if_index=i.sw_if_index, |
| 168 | bd_id=1, |
| 169 | shg=2, |
| 170 | port_type=L2_PORT_TYPE.BVI, |
| 171 | enable=0, |
| 172 | ) |
Neale Ranns | b474380 | 2018-09-05 09:13:57 -0700 | [diff] [blame] | 173 | |
Laszlo Kiraly | 0f8f435 | 2022-09-16 13:20:07 +0200 | [diff] [blame] | 174 | self.vapi.bridge_domain_add_del_v2(bd_id=1, is_add=0) |
Neale Ranns | b474380 | 2018-09-05 09:13:57 -0700 | [diff] [blame] | 175 | |
Neale Ranns | b9fa29d | 2018-10-02 07:27:02 -0700 | [diff] [blame] | 176 | def test_flood_one(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 177 | """L2 no-Flood Test""" |
Neale Ranns | b9fa29d | 2018-10-02 07:27:02 -0700 | [diff] [blame] | 178 | |
| 179 | # |
| 180 | # Create a single bridge Domain |
| 181 | # |
Laszlo Kiraly | 0f8f435 | 2022-09-16 13:20:07 +0200 | [diff] [blame] | 182 | self.vapi.bridge_domain_add_del_v2( |
| 183 | bd_id=1, is_add=1, flood=1, uu_flood=1, forward=1, learn=1 |
| 184 | ) |
Neale Ranns | b9fa29d | 2018-10-02 07:27:02 -0700 | [diff] [blame] | 185 | |
| 186 | # |
| 187 | # add 2 interfaces to the BD. this means a flood goes to only |
| 188 | # one member |
| 189 | # |
| 190 | for i in self.pg_interfaces[:2]: |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 191 | self.vapi.sw_interface_set_l2_bridge( |
| 192 | rx_sw_if_index=i.sw_if_index, bd_id=1, shg=0 |
| 193 | ) |
Neale Ranns | b9fa29d | 2018-10-02 07:27:02 -0700 | [diff] [blame] | 194 | |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 195 | p = ( |
| 196 | Ether(dst="ff:ff:ff:ff:ff:ff", src="00:00:de:ad:be:ef") |
| 197 | / IP(src="10.10.10.10", dst="1.1.1.1") |
| 198 | / UDP(sport=1234, dport=1234) |
| 199 | / Raw(b"\xa5" * 100) |
| 200 | ) |
Neale Ranns | b9fa29d | 2018-10-02 07:27:02 -0700 | [diff] [blame] | 201 | |
| 202 | # |
| 203 | # input on pg0 expect copies on pg1 |
| 204 | # |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 205 | self.send_and_expect(self.pg0, p * NUM_PKTS, self.pg1) |
Neale Ranns | b9fa29d | 2018-10-02 07:27:02 -0700 | [diff] [blame] | 206 | |
| 207 | # |
| 208 | # cleanup |
| 209 | # |
| 210 | for i in self.pg_interfaces[:2]: |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 211 | self.vapi.sw_interface_set_l2_bridge( |
| 212 | rx_sw_if_index=i.sw_if_index, bd_id=1, enable=0 |
| 213 | ) |
Laszlo Kiraly | 0f8f435 | 2022-09-16 13:20:07 +0200 | [diff] [blame] | 214 | self.vapi.bridge_domain_add_del_v2(bd_id=1, is_add=0) |
Neale Ranns | b9fa29d | 2018-10-02 07:27:02 -0700 | [diff] [blame] | 215 | |
Neale Ranns | b474380 | 2018-09-05 09:13:57 -0700 | [diff] [blame] | 216 | def test_uu_fwd(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 217 | """UU Flood""" |
Neale Ranns | b474380 | 2018-09-05 09:13:57 -0700 | [diff] [blame] | 218 | |
| 219 | # |
| 220 | # Create a single bridge Domain |
| 221 | # |
Laszlo Kiraly | 0f8f435 | 2022-09-16 13:20:07 +0200 | [diff] [blame] | 222 | self.vapi.bridge_domain_add_del_v2( |
| 223 | bd_id=1, is_add=1, uu_flood=1, flood=1, forward=1, learn=1 |
| 224 | ) |
Neale Ranns | b474380 | 2018-09-05 09:13:57 -0700 | [diff] [blame] | 225 | |
| 226 | # |
| 227 | # add each interface to the BD. 3 interfaces per split horizon group |
| 228 | # |
| 229 | for i in self.pg_interfaces[0:4]: |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 230 | self.vapi.sw_interface_set_l2_bridge( |
| 231 | rx_sw_if_index=i.sw_if_index, bd_id=1, shg=0 |
| 232 | ) |
Neale Ranns | b474380 | 2018-09-05 09:13:57 -0700 | [diff] [blame] | 233 | |
| 234 | # |
Paul Vinciguerra | 8feeaff | 2019-03-27 11:25:48 -0700 | [diff] [blame] | 235 | # an unknown unicast and broadcast packets |
Neale Ranns | b474380 | 2018-09-05 09:13:57 -0700 | [diff] [blame] | 236 | # |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 237 | p_uu = ( |
| 238 | Ether(dst="00:00:00:c1:5c:00", src="00:00:de:ad:be:ef") |
| 239 | / IP(src="10.10.10.10", dst="1.1.1.1") |
| 240 | / UDP(sport=1234, dport=1234) |
| 241 | / Raw(b"\xa5" * 100) |
| 242 | ) |
| 243 | p_bm = ( |
| 244 | Ether(dst="ff:ff:ff:ff:ff:ff", src="00:00:de:ad:be:ef") |
| 245 | / IP(src="10.10.10.10", dst="1.1.1.1") |
| 246 | / UDP(sport=1234, dport=1234) |
| 247 | / Raw(b"\xa5" * 100) |
| 248 | ) |
Neale Ranns | b474380 | 2018-09-05 09:13:57 -0700 | [diff] [blame] | 249 | |
| 250 | # |
| 251 | # input on pg0, expected copies on pg1->4 |
| 252 | # |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 253 | self.pg0.add_stream(p_uu * NUM_PKTS) |
Neale Ranns | b474380 | 2018-09-05 09:13:57 -0700 | [diff] [blame] | 254 | self.pg_enable_capture(self.pg_interfaces) |
| 255 | self.pg_start() |
| 256 | |
| 257 | for i in self.pg_interfaces[1:4]: |
Paul Vinciguerra | 4271c97 | 2019-05-14 13:25:49 -0400 | [diff] [blame] | 258 | rx0 = i.get_capture(NUM_PKTS, timeout=1) |
Neale Ranns | b474380 | 2018-09-05 09:13:57 -0700 | [diff] [blame] | 259 | |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 260 | self.pg0.add_stream(p_bm * NUM_PKTS) |
Neale Ranns | d29cc88 | 2018-10-10 15:55:01 +0000 | [diff] [blame] | 261 | self.pg_enable_capture(self.pg_interfaces) |
| 262 | self.pg_start() |
| 263 | |
| 264 | for i in self.pg_interfaces[1:4]: |
Paul Vinciguerra | 4271c97 | 2019-05-14 13:25:49 -0400 | [diff] [blame] | 265 | rx0 = i.get_capture(NUM_PKTS, timeout=1) |
Neale Ranns | d29cc88 | 2018-10-10 15:55:01 +0000 | [diff] [blame] | 266 | |
Neale Ranns | b474380 | 2018-09-05 09:13:57 -0700 | [diff] [blame] | 267 | # |
| 268 | # use pg8 as the uu-fwd interface |
| 269 | # |
Ole Troan | a5b2eec | 2019-03-11 19:23:25 +0100 | [diff] [blame] | 270 | self.vapi.sw_interface_set_l2_bridge( |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 271 | rx_sw_if_index=self.pg8.sw_if_index, |
| 272 | bd_id=1, |
| 273 | shg=0, |
| 274 | port_type=L2_PORT_TYPE.UU_FWD, |
| 275 | ) |
Neale Ranns | b474380 | 2018-09-05 09:13:57 -0700 | [diff] [blame] | 276 | |
| 277 | # |
| 278 | # expect the UU packet on the uu-fwd interface and not be flooded |
| 279 | # |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 280 | self.pg0.add_stream(p_uu * NUM_PKTS) |
Neale Ranns | b474380 | 2018-09-05 09:13:57 -0700 | [diff] [blame] | 281 | self.pg_enable_capture(self.pg_interfaces) |
| 282 | self.pg_start() |
| 283 | |
Paul Vinciguerra | 4271c97 | 2019-05-14 13:25:49 -0400 | [diff] [blame] | 284 | rx0 = self.pg8.get_capture(NUM_PKTS, timeout=1) |
Neale Ranns | b474380 | 2018-09-05 09:13:57 -0700 | [diff] [blame] | 285 | |
| 286 | for i in self.pg_interfaces[0:4]: |
| 287 | i.assert_nothing_captured(remark="UU not flooded") |
| 288 | |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 289 | self.pg0.add_stream(p_bm * NUM_PKTS) |
Neale Ranns | d29cc88 | 2018-10-10 15:55:01 +0000 | [diff] [blame] | 290 | self.pg_enable_capture(self.pg_interfaces) |
| 291 | self.pg_start() |
| 292 | |
| 293 | for i in self.pg_interfaces[1:4]: |
Paul Vinciguerra | 4271c97 | 2019-05-14 13:25:49 -0400 | [diff] [blame] | 294 | rx0 = i.get_capture(NUM_PKTS, timeout=1) |
Neale Ranns | d29cc88 | 2018-10-10 15:55:01 +0000 | [diff] [blame] | 295 | |
Neale Ranns | b474380 | 2018-09-05 09:13:57 -0700 | [diff] [blame] | 296 | # |
| 297 | # remove the uu-fwd interface and expect UU to be flooded again |
| 298 | # |
Ole Troan | a5b2eec | 2019-03-11 19:23:25 +0100 | [diff] [blame] | 299 | self.vapi.sw_interface_set_l2_bridge( |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 300 | rx_sw_if_index=self.pg8.sw_if_index, |
| 301 | bd_id=1, |
| 302 | shg=0, |
| 303 | port_type=L2_PORT_TYPE.UU_FWD, |
| 304 | enable=0, |
| 305 | ) |
Neale Ranns | b474380 | 2018-09-05 09:13:57 -0700 | [diff] [blame] | 306 | |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 307 | self.pg0.add_stream(p_uu * NUM_PKTS) |
Neale Ranns | b474380 | 2018-09-05 09:13:57 -0700 | [diff] [blame] | 308 | self.pg_enable_capture(self.pg_interfaces) |
| 309 | self.pg_start() |
| 310 | |
| 311 | for i in self.pg_interfaces[1:4]: |
Paul Vinciguerra | 4271c97 | 2019-05-14 13:25:49 -0400 | [diff] [blame] | 312 | rx0 = i.get_capture(NUM_PKTS, timeout=1) |
Neale Ranns | b474380 | 2018-09-05 09:13:57 -0700 | [diff] [blame] | 313 | |
| 314 | # |
| 315 | # change the BD config to not support UU-flood |
| 316 | # |
Ole Troan | a5b2eec | 2019-03-11 19:23:25 +0100 | [diff] [blame] | 317 | self.vapi.bridge_flags(bd_id=1, is_set=0, flags=BRIDGE_FLAGS.UU_FLOOD) |
Neale Ranns | b474380 | 2018-09-05 09:13:57 -0700 | [diff] [blame] | 318 | |
| 319 | self.send_and_assert_no_replies(self.pg0, p_uu) |
| 320 | |
| 321 | # |
| 322 | # re-add the uu-fwd interface |
| 323 | # |
Ole Troan | a5b2eec | 2019-03-11 19:23:25 +0100 | [diff] [blame] | 324 | self.vapi.sw_interface_set_l2_bridge( |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 325 | rx_sw_if_index=self.pg8.sw_if_index, |
| 326 | bd_id=1, |
| 327 | shg=0, |
| 328 | port_type=L2_PORT_TYPE.UU_FWD, |
| 329 | ) |
Neale Ranns | b474380 | 2018-09-05 09:13:57 -0700 | [diff] [blame] | 330 | self.logger.info(self.vapi.cli("sh bridge 1 detail")) |
| 331 | |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 332 | self.pg0.add_stream(p_uu * NUM_PKTS) |
Neale Ranns | b474380 | 2018-09-05 09:13:57 -0700 | [diff] [blame] | 333 | self.pg_enable_capture(self.pg_interfaces) |
| 334 | self.pg_start() |
| 335 | |
Paul Vinciguerra | 4271c97 | 2019-05-14 13:25:49 -0400 | [diff] [blame] | 336 | rx0 = self.pg8.get_capture(NUM_PKTS, timeout=1) |
Neale Ranns | b474380 | 2018-09-05 09:13:57 -0700 | [diff] [blame] | 337 | |
| 338 | for i in self.pg_interfaces[0:4]: |
| 339 | i.assert_nothing_captured(remark="UU not flooded") |
| 340 | |
| 341 | # |
| 342 | # remove the uu-fwd interface |
| 343 | # |
Ole Troan | a5b2eec | 2019-03-11 19:23:25 +0100 | [diff] [blame] | 344 | self.vapi.sw_interface_set_l2_bridge( |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 345 | rx_sw_if_index=self.pg8.sw_if_index, |
| 346 | bd_id=1, |
| 347 | shg=0, |
| 348 | port_type=L2_PORT_TYPE.UU_FWD, |
| 349 | enable=0, |
| 350 | ) |
Neale Ranns | b474380 | 2018-09-05 09:13:57 -0700 | [diff] [blame] | 351 | self.send_and_assert_no_replies(self.pg0, p_uu) |
| 352 | |
| 353 | # |
| 354 | # cleanup |
| 355 | # |
| 356 | for i in self.pg_interfaces[:4]: |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 357 | self.vapi.sw_interface_set_l2_bridge( |
| 358 | rx_sw_if_index=i.sw_if_index, bd_id=1, enable=0 |
| 359 | ) |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 360 | |
Laszlo Kiraly | 0f8f435 | 2022-09-16 13:20:07 +0200 | [diff] [blame] | 361 | self.vapi.bridge_domain_add_del_v2(bd_id=1, is_add=0) |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 362 | |
| 363 | |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 364 | if __name__ == "__main__": |
Neale Ranns | 055b231 | 2018-07-20 01:16:04 -0700 | [diff] [blame] | 365 | unittest.main(testRunner=VppTestRunner) |