OF_conn = odl_conn.ODL_conn( of_url="http://" + str(config_dic["of_controller_ip"]) + ":" + str(config_dic["of_controller_port"]), of_test=of_test_mode, of_dpid=config_dic["of_controller_dpid"], of_user=of_user, of_password=of_password, ) else: print "ERROR. The Openflow controller specified in the configuration file is not valid. Only valid options " "for OFC are 'floodlight' and 'opendaylight'" exit() # create openflow thread thread = oft.openflow_thread( OF_conn, of_test=of_test_mode, db=db_of, db_lock=db_lock, pmp_with_same_vlan=config_dic["of_controller_nets_with_same_vlan"], ) r, c = thread.OF_connector.obtain_port_correspondence() if r < 0: print "Error getting openflow information", c exit() thread.start() config_dic["of_thread"] = thread # precreate interfaces; [bridge:<host_bridge_name>, VLAN used at Host, uuid of network camping in this bridge, speed in Gbit/s config_dic["bridge_nets"] = [] for bridge, vlan_speed in config_dic["bridge_ifaces"].items(): # skip 'development_bridge' if config_dic["mode"] == "development" and config_dic["development_bridge"] == bridge:
file.close(module_info[0]) exit(-1) except (IOError, ImportError) as e: if module_info and module_info[0]: file.close(module_info[0]) logger.error( "Cannot open openflow controller module '%s'; %s: %s; revise 'of_controller' field of configuration file.", module, type(e).__name__, str(e)) exit(-1) #create openflow thread thread = oft.openflow_thread( OF_conn, of_test=of_test_mode, db=db_of, db_lock=db_lock, pmp_with_same_vlan=config_dic['of_controller_nets_with_same_vlan'], debug=config_dic['log_level_of']) r, c = thread.OF_connector.obtain_port_correspondence() if r < 0: logger.error("Cannot get openflow information %s", c) exit() thread.start() config_dic['of_thread'] = thread #precreate interfaces; [bridge:<host_bridge_name>, VLAN used at Host, uuid of network camping in this bridge, speed in Gbit/s config_dic['bridge_nets'] = [] for bridge, vlan_speed in config_dic["bridge_ifaces"].items(): #skip 'development_bridge' if config_dic['mode'] == 'development' and config_dic[
print "!! Warning, openvimd in TEST mode '%s'" % config_dic['mode'] print '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!' config_dic['version'] = __version__ #Connect to database db_http = create_database_connection(config_dic) db_of = create_database_connection(config_dic) db_lock= threading.Lock() config_dic['db'] = db_of config_dic['db_lock'] = db_lock #create openflow thread of_test_mode = False if config_dic['mode']=='normal' else True thread = oft.openflow_thread(of_url = "http://"+str(config_dic['of_controller_ip']) + ":"+ str(config_dic['of_controller_port']), of_test=of_test_mode, of_dpid=config_dic['of_controller_dpid'], db=db_of, db_lock=db_lock, pmp_with_same_vlan=config_dic['of_controller_nets_with_same_vlan']) r,c = thread.get_of_controller_info() if r<c: print "Error getting openflow information", c exit() thread.start() config_dic['of_thread'] = thread #precreate interfaces; [bridge:<host_bridge_name>, VLAN used at Host, uuid of network camping in this bridge, speed in Gbit/s config_dic['bridge_nets']=[] for bridge,vlan_speed in config_dic["bridge_ifaces"].items(): config_dic['bridge_nets'].append( [bridge, vlan_speed[0], vlan_speed[1], None] ) del config_dic["bridge_ifaces"]
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 openflow thread of_test_mode = False if config_dic['mode']=='normal' else True thread = oft.openflow_thread(of_url = "http://"+str(config_dic['of_controller_ip']) + ":"+ str(config_dic['of_controller_port']), of_test=of_test_mode, of_dpid=config_dic['of_controller_dpid'], db=db_of, db_lock=db_lock, pmp_with_same_vlan=config_dic['of_controller_nets_with_same_vlan']) r,c = thread.get_of_controller_info() if r<0: print "Error getting openflow information", c exit() thread.start() config_dic['of_thread'] = thread #precreate interfaces; [bridge:<host_bridge_name>, VLAN used at Host, uuid of network camping in this bridge, speed in Gbit/s config_dic['bridge_nets']=[] for bridge,vlan_speed in config_dic["bridge_ifaces"].items(): #skip 'development_bridge' if config_dic['mode'] == 'development' and config_dic['development_bridge'] == bridge: continue
OF_conn = OF_conn.OF_conn(temp_dict) except Exception as e: logger.error("Cannot open the Openflow controller '%s': %s", type(e).__name__, str(e)) if module_info and module_info[0]: file.close(module_info[0]) exit(-1) except (IOError, ImportError) as e: if module_info and module_info[0]: file.close(module_info[0]) logger.error("Cannot open openflow controller module '%s'; %s: %s; revise 'of_controller' field of configuration file.", module, type(e).__name__, str(e)) exit(-1) #create openflow thread thread = oft.openflow_thread(OF_conn, of_test=of_test_mode, db=db_of, db_lock=db_lock, pmp_with_same_vlan=config_dic['of_controller_nets_with_same_vlan'], debug=config_dic['log_level_of']) r,c = thread.OF_connector.obtain_port_correspondence() if r<0: logger.error("Cannot get openflow information %s", c) exit() thread.start() config_dic['of_thread'] = thread #create dhcp_server thread host_test_mode = True if config_dic['mode']=='test' or config_dic['mode']=="OF only" else False dhcp_params = config_dic.get("dhcp_server") if dhcp_params: thread = dt.dhcp_thread(dhcp_params=dhcp_params, test=host_test_mode, dhcp_nets=config_dic["dhcp_nets"], db=db_of, db_lock=db_lock, debug=config_dic['log_level_of']) thread.start() config_dic['dhcp_thread'] = thread