Beispiel #1
0
        if r[0]<0:
            print "Error DATABASE is not a VIM one or it is a '0.0' version. Try to upgrade to version '%s' with './database_utils/migrate_vim_db.sh'" % database_version
            exit(-1)
        elif r[1]!=database_version:
            print "Error DATABASE wrong version '%s'. Try to upgrade/downgrade to version '%s' with './database_utils/migrate_vim_db.sh'" % (r[1], database_version) 
            exit(-1)
        db_of = create_database_connection(config_dic)
        db_lock= threading.Lock()
        config_dic['db'] = db_of
        config_dic['db_lock'] = db_lock

        # create connector to the openflow controller
        of_test_mode = False if config_dic['mode']=='normal' or config_dic['mode']=="OF only" else True

        if of_test_mode:
            OF_conn = oft.of_test_connector()
        elif config_dic['of_controller']=='floodlight':
            OF_conn = fl_conn.FL_conn(of_ip = config_dic['of_controller_ip'],
                                      of_port = config_dic['of_controller_port'], 
                                      of_dpid=config_dic['of_controller_dpid'])
        elif config_dic['of_controller']=='opendaylight':
            of_user = config_dic.get('of_user')
            of_password = config_dic.get('of_password')
            if of_user is None or of_password is None:
                print 'ERROR. When using OpenDayLight as Openflow Controller is compulsory to specify in the ' \
                      'configuration file the of_user and the of_password'
                exit()

            OF_conn = odl_conn.ODL_conn(of_ip = config_dic['of_controller_ip'],
                                        of_port = config_dic['of_controller_port'],
                                        of_dpid=config_dic['of_controller_dpid'],
Beispiel #2
0
        elif r[1] != database_version:
            logger.error(
                "DATABASE wrong version '%s'. Try to upgrade/downgrade to version '%s' with './database_utils/migrate_vim_db.sh'",
                r[1], database_version)
            exit(-1)
        db_of = create_database_connection(config_dic)
        db_lock = threading.Lock()
        config_dic['db'] = db_of
        config_dic['db_lock'] = db_lock

        # create connector to the openflow controller
        of_test_mode = False if config_dic['mode'] == 'normal' or config_dic[
            'mode'] == "OF only" else True

        if of_test_mode:
            OF_conn = oft.of_test_connector(
                {"of_debug": config_dic['log_level_of']})
        else:
            #load other parameters starting by of_ from config dict in a temporal dict
            temp_dict = {
                "of_ip": config_dic['of_controller_ip'],
                "of_port": config_dic['of_controller_port'],
                "of_dpid": config_dic['of_controller_dpid'],
                "of_debug": config_dic['log_level_of']
            }
            for k, v in config_dic.iteritems():
                if type(k) is str and k[
                        0:3] == "of_" and k[0:13] != "of_controller":
                    temp_dict[k] = v
            if config_dic['of_controller'] == 'opendaylight':
                module = "ODL"
            elif "of_controller_module" in config_dic:
Beispiel #3
0
        if config_dic.get("dhcp_server"):
            for net in config_dic["dhcp_server"].get("nets", () ):
                r,nets = db_of.get_table(SELECT=('uuid',), FROM='nets',WHERE={'name': net})
                if r>0:
                    config_dic['dhcp_nets'].append(nets[0]['uuid'])
    
    # get host list from data base before starting threads
        r,hosts = db_of.get_table(SELECT=('name','ip_name','user','uuid'), FROM='hosts', WHERE={'status':'ok'})
        if r<0:
            logger.error("Cannot get hosts from database %s", hosts)
            exit(-1)
    # create connector to the openflow controller
        of_test_mode = False if config_dic['mode']=='normal' or config_dic['mode']=="OF only" else True

        if of_test_mode:
            OF_conn = oft.of_test_connector({"of_debug": config_dic['log_level_of']} )
        else:
            #load other parameters starting by of_ from config dict in a temporal dict
            temp_dict={ "of_ip":  config_dic['of_controller_ip'],
                        "of_port": config_dic['of_controller_port'], 
                        "of_dpid": config_dic['of_controller_dpid'],
                        "of_debug":   config_dic['log_level_of']
                }
            for k,v in config_dic.iteritems():
                if type(k) is str and k[0:3]=="of_" and k[0:13] != "of_controller":
                    temp_dict[k]=v
            if config_dic['of_controller']=='opendaylight':
                module = "ODL"
            elif "of_controller_module" in config_dic:
                module = config_dic["of_controller_module"]
            else: