Add the schema name as a parameter to the OVSDB IDL connection.
That way other users can use this with other schemas
Change-Id: I55ab5ae4f3f937d236eee773f9717b5090c18557
Closes-Bug: #
1441180
class OvsdbIdl(api.API):
ovsdb_connection = connection.Connection(cfg.CONF.OVS.ovsdb_connection,
- cfg.CONF.ovs_vsctl_timeout)
+ cfg.CONF.ovs_vsctl_timeout,
+ 'Open_vSwitch')
def __init__(self, context):
super(OvsdbIdl, self).__init__(context)
class Connection(object):
- def __init__(self, connection, timeout):
+ def __init__(self, connection, timeout, schema_name):
self.idl = None
self.connection = connection
self.timeout = timeout
self.txns = TransactionQueue(1)
self.lock = threading.Lock()
+ self.schema_name = schema_name
def start(self):
with self.lock:
if self.idl is not None:
return
- helper = idlutils.get_schema_helper(self.connection)
+ helper = idlutils.get_schema_helper(self.connection,
+ self.schema_name)
helper.register_all()
self.idl = idl.Idl(self.connection, helper)
idlutils.wait_for_change(self.idl, self.timeout)
self.tb = tb
-def get_schema_helper(connection):
+def get_schema_helper(connection, schema_name):
err, strm = stream.Stream.open_block(
stream.Stream.open(connection))
if err:
raise Exception("Could not connect to %s" % (
connection,))
rpc = jsonrpc.Connection(strm)
- req = jsonrpc.Message.create_request('get_schema', ['Open_vSwitch'])
+ req = jsonrpc.Message.create_request('get_schema', [schema_name])
err, resp = rpc.transact_block(req)
rpc.close()
if err: