Bond hw interface link state test (when admin down)
(self)
| 367 | bond0.remove_vpp_config() |
| 368 | |
| 369 | def test_bond_link_when_admin_down(self): |
| 370 | """Bond hw interface link state test (when admin down)""" |
| 371 | |
| 372 | # for convenience |
| 373 | bond_modes = VppEnum.vl_api_bond_mode_t |
| 374 | intf_flags = VppEnum.vl_api_if_status_flags_t |
| 375 | |
| 376 | # create interface 1 (BondEthernet0) |
| 377 | self.logger.info("Create bond interface") |
| 378 | # use round-robin mode to avoid negotiation required by LACP |
| 379 | bond0 = VppBondInterface(self, mode=bond_modes.BOND_API_MODE_ROUND_ROBIN) |
| 380 | bond0.add_vpp_config() |
| 381 | |
| 382 | # initially admin state is down and link state is down |
| 383 | bond0.assert_interface_state(0, 0) |
| 384 | |
| 385 | # add an active member to bond |
| 386 | self.logger.info("bond add_member interface pg0 to BondEthernet0") |
| 387 | bond0.add_member_vpp_bond_interface( |
| 388 | sw_if_index=self.pg0.sw_if_index, is_passive=0, is_long_timeout=0 |
| 389 | ) |
| 390 | |
| 391 | # confirm link down regardless of active members because bond is admin down |
| 392 | bond0.assert_interface_state(0, 0) |
| 393 | |
| 394 | # set bond admin up. confirm link up because there are active members |
| 395 | self.logger.info("set interface BondEthernet0 admin up") |
| 396 | bond0.admin_up() |
| 397 | bond0.assert_interface_state( |
| 398 | intf_flags.IF_STATUS_API_FLAG_ADMIN_UP, |
| 399 | intf_flags.IF_STATUS_API_FLAG_LINK_UP, |
| 400 | ) |
| 401 | |
| 402 | # set bond admin down. confirm link down because bond is admin down |
| 403 | self.logger.info("set interface BondEthernet0 admin down") |
| 404 | bond0.admin_down() |
| 405 | bond0.assert_interface_state(0, 0) |
| 406 | |
| 407 | # set member admin down |
| 408 | self.logger.info("set interface pg0 admin down") |
| 409 | self.pg0.admin_down() |
| 410 | bond0.assert_interface_state(0, 0) |
| 411 | |
| 412 | # set bond admin up. confirm link down because no active members |
| 413 | self.logger.info("set interface BondEthernet0 admin up") |
| 414 | bond0.admin_up() |
| 415 | bond0.assert_interface_state(intf_flags.IF_STATUS_API_FLAG_ADMIN_UP, 0) |
| 416 | |
| 417 | # detach member |
| 418 | self.logger.info("detach interface pg0") |
| 419 | bond0.detach_vpp_bond_interface(sw_if_index=self.pg0.sw_if_index) |
| 420 | bond0.assert_interface_state(intf_flags.IF_STATUS_API_FLAG_ADMIN_UP, 0) |
| 421 | |
| 422 | # delete BondEthernet0 |
| 423 | self.logger.info("Deleting BondEthernet0") |
| 424 | bond0.remove_vpp_config() |
| 425 | |
| 426 |
nothing calls this directly
no test coverage detected