Ejemplo n.º 1
0
    def test_interface_monitor_filtering(self):
        br_1 = self.useFixture(net_helpers.OVSBridgeFixture()).bridge
        br_2 = self.useFixture(net_helpers.OVSBridgeFixture()).bridge

        mon_no_filter = ovsdb_monitor.SimpleInterfaceMonitor(
            respawn_interval=30,
            ovsdb_connection=cfg.CONF.OVS.ovsdb_connection)
        mon_no_filter.start(block=True)
        mon_br_1 = ovsdb_monitor.SimpleInterfaceMonitor(
            respawn_interval=30,
            ovsdb_connection=cfg.CONF.OVS.ovsdb_connection,
            bridge_names=[br_1.br_name],
            ovs=br_1)
        mon_br_1.start(block=True)
        mon_br_2 = ovsdb_monitor.SimpleInterfaceMonitor(
            respawn_interval=30,
            ovsdb_connection=cfg.CONF.OVS.ovsdb_connection,
            bridge_names=[br_2.br_name],
            ovs=br_1)
        mon_br_2.start(block=True)
        self.addCleanup(self._stop_monitors,
                        [mon_no_filter, mon_br_1, mon_br_2])

        p1 = self.useFixture(net_helpers.OVSPortFixture(br_1))
        p2 = self.useFixture(net_helpers.OVSPortFixture(br_2))

        ports_expected = {p1.port.name, p2.port.name}
        try:
            common_utils.wait_until_true(lambda: not self._check_port_events(
                mon_no_filter, ports_expected=ports_expected),
                                         timeout=5)
        except common_utils.WaitTimeout:
            self.fail('Interface monitor not filtered did not received an '
                      'event for ports %s' % ports_expected)

        self.assertIs(
            0,
            len(
                self._check_port_events(mon_br_1,
                                        ports_expected={p1.port.name},
                                        ports_not_expected={p2.port.name})))
        self.assertIs(
            0,
            len(
                self._check_port_events(mon_br_2,
                                        ports_expected={p2.port.name},
                                        ports_not_expected={p1.port.name})))
Ejemplo n.º 2
0
    def __init__(
            self,
            ovsdb_monitor_respawn_interval=constants.DEFAULT_OVSDBMON_RESPAWN):

        super(InterfacePollingMinimizer, self).__init__()
        self._monitor = ovsdb_monitor.SimpleInterfaceMonitor(
            respawn_interval=ovsdb_monitor_respawn_interval,
            ovsdb_connection=cfg.CONF.OVS.ovsdb_connection)
Ejemplo n.º 3
0
 def setUp(self):
     super(TestSimpleInterfaceMonitor, self).setUp()
     self.monitor = ovsdb_monitor.SimpleInterfaceMonitor()
    def setUp(self):
        super(TestSimpleInterfaceMonitor, self).setUp()

        self.monitor = ovsdb_monitor.SimpleInterfaceMonitor()
        self.addCleanup(self.monitor.stop)
        self.monitor.start(block=True, timeout=60)