Vhost User interface states and events test
(self)
| 86 | self.assertFalse(vhost_if1.is_interface_config_in_dump(if_dump)) |
| 87 | |
| 88 | def test_vhost_interface_state(self): |
| 89 | """Vhost User interface states and events test""" |
| 90 | |
| 91 | self.vapi.want_interface_events() |
| 92 | |
| 93 | # clear outstanding events |
| 94 | # (like delete interface events from other tests) |
| 95 | self.vapi.collect_events() |
| 96 | |
| 97 | vhost_if = VppVhostInterface(self, sock_filename="/tmp/sock1") |
| 98 | |
| 99 | # create vhost interface |
| 100 | vhost_if.add_vpp_config() |
| 101 | self.sleep(0.1) |
| 102 | events = self.vapi.collect_events() |
| 103 | # creating interface does now create events |
| 104 | self.assert_equal(len(events), 1, "number of events") |
| 105 | |
| 106 | vhost_if.admin_up() |
| 107 | vhost_if.assert_interface_state(1, 0, expect_event=True) |
| 108 | |
| 109 | vhost_if.admin_down() |
| 110 | vhost_if.assert_interface_state(0, 0, expect_event=True) |
| 111 | |
| 112 | # delete vhost interface |
| 113 | vhost_if.remove_vpp_config() |
| 114 | event = self.vapi.wait_for_event(timeout=1) |
| 115 | self.assert_equal(event.sw_if_index, vhost_if.sw_if_index, "sw_if_index") |
| 116 | self.assert_equal(event.deleted, 1, "deleted flag") |
| 117 | |
| 118 | # verify there are no more events |
| 119 | events = self.vapi.collect_events() |
| 120 | self.assert_equal(len(events), 0, "number of events") |
| 121 | |
| 122 | def test_vhost_interface_custom_mac_addr(self): |
| 123 | """Vhost User interface custom mac address test""" |
nothing calls this directly
no test coverage detected