Example #1
0
 def __init__(self, events=None):
     connection_string = config.get_ovn_sb_connection()
     helper = idlutils.get_schema_helper(connection_string, self.SCHEMA)
     tables = ('Chassis', 'Port_Binding', 'Datapath_Binding')
     for table in tables:
         helper.register_table(table)
     super(MetadataAgentOvnSbIdl, self).__init__(None, connection_string,
                                                 helper)
     if events:
         self.notify_handler.watch_events(events)
Example #2
0
 def __init__(self, events=None):
     connection_string = config.get_ovn_sb_connection()
     helper = self._get_ovsdb_helper(connection_string)
     tables = ('Chassis', 'Encap', 'Port_Binding', 'Datapath_Binding',
               'SB_Global')
     for table in tables:
         helper.register_table(table)
     super(MetadataAgentOvnSbIdl, self).__init__(None, connection_string,
                                                 helper)
     if events:
         self.notify_handler.watch_events(events)
Example #3
0
def get_connection(db_class, trigger=None):
    # The trigger is the start() method of the NeutronWorker class
    if trigger and trigger.im_class == ovsdb_monitor.OvnWorker:
        cls = ovsdb_monitor.OvnConnection
    else:
        cls = connection.Connection

    if db_class == OvsdbNbOvnIdl:
        return cls(cfg.get_ovn_nb_connection(),
                   cfg.get_ovn_ovsdb_timeout(), 'OVN_Northbound')
    elif db_class == OvsdbSbOvnIdl:
        return cls(cfg.get_ovn_sb_connection(),
                   cfg.get_ovn_ovsdb_timeout(), 'OVN_Southbound')
Example #4
0
def get_connection(db_class, trigger=None):
    # The trigger is the start() method of the NeutronWorker class
    if trigger and trigger.im_class == ovsdb_monitor.OvnWorker:
        cls = ovsdb_monitor.OvnConnection
    else:
        cls = connection.Connection

    if db_class == OvsdbNbOvnIdl:
        return cls(cfg.get_ovn_nb_connection(), cfg.get_ovn_ovsdb_timeout(),
                   'OVN_Northbound')
    elif db_class == OvsdbSbOvnIdl:
        return cls(cfg.get_ovn_sb_connection(), cfg.get_ovn_ovsdb_timeout(),
                   'OVN_Southbound')
Example #5
0
def get_connection(db_class, trigger=None, driver=None):
    # The trigger is the start() method of the worker class
    if db_class == OvsdbNbOvnIdl:
        args = (cfg.get_ovn_nb_connection(), 'OVN_Northbound')
        cls = ovsdb_monitor.OvnNbIdl
    elif db_class == OvsdbSbOvnIdl:
        args = (cfg.get_ovn_sb_connection(), 'OVN_Southbound')
        cls = ovsdb_monitor.OvnSbIdl

    if trigger and utils.get_method_class(trigger) == ovsdb_monitor.OvnWorker:
        idl_ = cls.from_server(*args, driver=driver)
    else:
        if db_class == OvsdbSbOvnIdl:
            idl_ = ovsdb_monitor.BaseOvnSbIdl.from_server(*args)
        else:
            idl_ = ovsdb_monitor.BaseOvnIdl.from_server(*args)
    return connection.Connection(idl_, timeout=cfg.get_ovn_ovsdb_timeout())
Example #6
0
def get_connection(db_class, trigger=None, driver=None, binding_events=False):
    if db_class == OvsdbNbOvnIdl:
        args = (cfg.get_ovn_nb_connection(), 'OVN_Northbound')
    elif db_class == OvsdbSbOvnIdl:
        args = (cfg.get_ovn_sb_connection(), 'OVN_Southbound')

    if binding_events:
        if db_class == OvsdbNbOvnIdl:
            idl_ = ovsdb_monitor.OvnNbIdl.from_server(*args, driver=driver)
        else:
            idl_ = ovsdb_monitor.OvnSbIdl.from_server(*args, driver=driver)
    else:
        if db_class == OvsdbNbOvnIdl:
            idl_ = ovsdb_monitor.BaseOvnIdl.from_server(*args)
        else:
            idl_ = ovsdb_monitor.BaseOvnSbIdl.from_server(*args)

    return connection.Connection(idl_, timeout=cfg.get_ovn_ovsdb_timeout())
Example #7
0
def get_connection(db_class, trigger=None, leader_info=None):
    # The trigger is the start() method of the NeutronWorker class
    if trigger and trigger.im_class == ovsdb_monitor.OvnWorker:
        cls = ovsdb_monitor.OvnConnection
    else:
        cls = connection.Connection

    Stream.ssl_set_private_key_file(cfg.get_ovn_ovsdb_private_key_file())
    Stream.ssl_set_certificate_file(cfg.get_ovn_ovsdb_certificate_file())
    Stream.ssl_set_ca_cert_file(cfg.get_ovn_ovsdb_ca_cert_file())

    if db_class == OvsdbNbOvnIdl:
        if leader_info is None:
            leader_info = cfg.get_ovn_nb_connection()
        return cls(leader_info, cfg.get_ovn_ovsdb_timeout(), 'OVN_Northbound')
    elif db_class == OvsdbSbOvnIdl:
        return cls(cfg.get_ovn_sb_connection(), cfg.get_ovn_ovsdb_timeout(),
                   'OVN_Southbound')