Example #1
0
def cleanup_bridges():
    ovsdb = create()
    bridges = ovsdb.list_bridge_info().execute(timeout=5)
    with ovsdb.transaction() as t:
        t.timeout = 5
        for bridge in bridges:
            if bridge in TEST_BRIDGES:
                t.add(ovsdb.del_br(bridge['name']))
Example #2
0
def cleanup_bridges():
    ovsdb = create()
    bridges = ovsdb.list_bridge_info().execute(timeout=5)
    with ovsdb.transaction() as t:
        t.timeout = 5
        for bridge in bridges:
            if bridge in TEST_BRIDGES:
                t.add(ovsdb.del_br(bridge['name']))
Example #3
0
    def teardown(self):
        ovsdb = create()
        bridges = ovsdb.list_bridge_info().execute()

        with ovsdb.transaction() as t:
            for bridge in bridges:
                if bridge in TEST_BRIDGES:
                    t.add(ovsdb.del_br(bridge['name']))

        if not self.ovs_init_state_is_up:
            cmd.exec_sync([OVS_CTL, 'stop'])
Example #4
0
    def teardown(self):
        ovsdb = create()
        bridges = ovsdb.list_bridge_info().execute()

        with ovsdb.transaction() as t:
            for bridge in bridges:
                if bridge in TEST_BRIDGES:
                    t.add(ovsdb.del_br(bridge['name']))

        if not self.ovs_init_state_is_up:
            execCmd([OVS_CTL, 'stop'])
Example #5
0
    def _assert_acquired_ifaces_post_switch_setup(self, _ovs_info, nets2add,
                                                  expected_ifaces):

        ovsdb = driver.create(driver.Drivers.VSCTL)

        with mock.patch('vdsm.network.ovs.driver.vsctl.Transaction.commit',
                        return_value=None), \
            mock.patch('vdsm.network.ovs.switch.link.get_link',
                       return_value={'address': '01:23:45:67:89:ab'}):

            setup = switch.NetsAdditionSetup(ovsdb, _ovs_info)
            with setup.add(nets2add):
                pass

            self.assertEqual(setup.acquired_ifaces, expected_ifaces)
Example #6
0
    def test_execute_a_transaction(self):
        ovsdb = create()
        cmd_add_br = ovsdb.add_br(TEST_BRIDGE)
        cmd_list_bridge_info = ovsdb.list_bridge_info()
        t = ovsdb.transaction()
        t.add(cmd_add_br)
        t.add(cmd_list_bridge_info)
        t.commit()

        self.assertEqual(1, len(cmd_list_bridge_info.result))
        bridge_name = cmd_list_bridge_info.result[0]['name']
        self.assertIn(TEST_BRIDGE, bridge_name)

        cmd_del_br = ovsdb.del_br(TEST_BRIDGE)
        with ovsdb.transaction() as trans:
            trans.add(cmd_del_br)
            trans.add(cmd_list_bridge_info)

        self.assertEqual([], cmd_list_bridge_info.result)
Example #7
0
    def test_execute_a_transaction(self):
        ovsdb = create()
        cmd_add_br = ovsdb.add_br(TEST_BRIDGE)
        cmd_list_bridge_info = ovsdb.list_bridge_info()
        t = ovsdb.transaction()
        t.add(cmd_add_br)
        t.add(cmd_list_bridge_info)
        t.commit()

        self.assertEqual(1, len(cmd_list_bridge_info.result))
        bridge_name = cmd_list_bridge_info.result[0]['name']
        self.assertIn(TEST_BRIDGE, bridge_name)

        cmd_del_br = ovsdb.del_br(TEST_BRIDGE)
        with ovsdb.transaction() as trans:
            trans.add(cmd_del_br)
            trans.add(cmd_list_bridge_info)

        self.assertEqual([], cmd_list_bridge_info.result)
Example #8
0
 def setUp(self):
     self.ovs_service = OvsService()
     self.ovs_service.setup()
     self.ovsdb = create()
Example #9
0
 def setUp(self):
     self.ovsdb = create()
Example #10
0
 def test_instantiate_vsctl_implementation(self):
     self.assertIsNotNone(create(OvsDrivers.VSCTL))
Example #11
0
    def setUp(self):
        self.ovs_service = OvsService()
        self.ovs_service.setup()

        self.ovsdb = create()
        self.ovsdb.add_br(TEST_BRIDGE).execute()
Example #12
0
 def test_instantiate_vsctl_implementation(self):
     self.assertIsNotNone(create(OvsDrivers.VSCTL))
Example #13
0
    def test_execute_a_single_command(self):
        ovsdb = create()
        out = ovsdb.list_bridge_info().execute()

        # No bridges defined
        self.assertEqual([], out)
Example #14
0
 def setUp(self):
     self.ovsdb = create()
     self.ovsdb.add_br(TEST_BRIDGE).execute()
Example #15
0
 def setUp(self):
     self.ovsdb = create()
Example #16
0
    def test_execute_a_single_command(self):
        ovsdb = create()
        out = ovsdb.list_bridge_info().execute()

        # No bridges defined
        self.assertEqual([], out)
Example #17
0
 def test_instantiate_vsctl_implementation(self):
     self.assertIsNotNone(create('vsctl'))
Example #18
0
 def setUp(self):
     self.ovsdb = create()
     self.ovsdb.add_br(TEST_BRIDGE).execute()
Example #19
0
    def setUp(self):
        self.ovs_service = OvsService()
        self.ovs_service.setup()

        self.ovsdb = create()
        self.ovsdb.add_br(TEST_BRIDGE).execute()
Example #20
0
 def test_instantiate_vsctl_implementation(self):
     self.assertIsNotNone(create('vsctl'))