Exemplo n.º 1
0
 def setUp(self):
     super(TestOvsdbIdl, self).setUp()
     self.api = impl_idl.OvsdbIdl(self.connection)
     self.brname = utils.get_rand_device_name()
     # Destroying the bridge cleans up most things created by tests
     cleanup_cmd = self.api.del_br(self.brname)
     self.addCleanup(cleanup_cmd.execute)
Exemplo n.º 2
0
 def start(self):
     connection_string = config.cfg.CONF.ovs.ovsdb_connection
     helper = idlutils.get_schema_helper(connection_string, 'Open_vSwitch')
     tables = ('Open_vSwitch', 'Bridge', 'Port', 'Interface')
     for table in tables:
         helper.register_table(table)
     ovs_idl = idl.Idl(connection_string, helper)
     conn = connection.Connection(
         ovs_idl, timeout=config.cfg.CONF.ovs.ovsdb_connection_timeout)
     return idl_ovs.OvsdbIdl(conn)
Exemplo n.º 3
0
 def setUp(self):
     super(ImplIdlTestCase, self).setUp()
     self.api = impl_idl.OvsdbIdl(self.connection)
     self.brname = utils.get_rand_device_name()
     # Make sure exceptions pass through by calling do_post_commit directly
     mock.patch.object(
         impl_idl.OvsVsctlTransaction,
         "post_commit",
         side_effect=impl_idl.OvsVsctlTransaction.do_post_commit,
         autospec=True).start()
Exemplo n.º 4
0
 def start(self, connection_string):
     helper = idlutils.get_schema_helper(connection_string,
                                         'Open_vSwitch')
     tables = ('Open_vSwitch', 'Bridge', 'Port', 'Interface')
     for table in tables:
         helper.register_table(table)
     ovs_idl = idl.Idl(connection_string, helper)
     ovs_idl._session.reconnect.set_probe_interval(60000)
     conn = connection.Connection(
         ovs_idl, timeout=180)
     self.idl_ovs = idl_ovs.OvsdbIdl(conn)
Exemplo n.º 5
0
def get_idl_singleton():
    global _idl

    conn = cfg.CONF.net_ansible_openvswitch.ovsdb_connection
    schema = "Open_vSwitch"

    if _idl is None:
        _connection = connection.Connection(idl=idl_factory(conn, schema),
                                            timeout=10)
        _idl = impl_idl.OvsdbIdl(_connection)

    return _idl
Exemplo n.º 6
0
    def setUp(self):
        self.bridges = [
            {'name': utils.get_rand_device_name(),
             'datapath_type': 'fake1'},
            {'name': utils.get_rand_device_name(),
             'datapath_type': 'fake1'},
            {'name': utils.get_rand_device_name(),
             'datapath_type': 'fake2'}
        ]

        super(TestBackendDb, self).setUp()
        self.api = impl_idl.OvsdbIdl(self.connection)
        for bridge in self.bridges:
            self.useFixture(fixtures.BridgeFixture(bridge['name']))
            for col, val in bridge.items():
                if col == 'name':
                    continue
                self.api.db_set(
                    'Bridge', bridge['name'], (col, val)).execute(
                        check_error=True)
Exemplo n.º 7
0
 def test_init_session(self):
     conn = mock.MagicMock()
     impl_idl.OvsdbIdl(conn, start=False)
     conn.start_connection.assert_not_called()
Exemplo n.º 8
0
 def test_nested_txns(self):
     conn = mock.MagicMock()
     api = impl_idl.OvsdbIdl(conn, nested_transactions=False)
     self.assertFalse(api._nested_txns)