您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 公司方案 > Floodlight架构图-发布-v1.0
程序入口Main.mainFloodlightModuleLoader.loadModulesFromConfig()返回moduleContextrestApi=moduleContext.getServiceImpl(IRestApiService.class)controller=moduleContext.getServiceImpl(IFloodlightProviderService.class)getsettings解析启动参数获取配置信息getmoduleListfrommoduleFileparseArgumentconfigMods.addAll(Arrays.asList(moduleList.split(,)))loadModulesFromList(configMods,prop)startupModules(moduleSet)initModules(moduleSet)findAllModules()serviceLoader.load()实例化所有配置文件中的IFloodlightModule实现类将moduleSet赋值给floodlightModuleContext的成员变量遍历所有实例,初始化serviceMap,moduleServiceMap,moduleNameMapserviceMap=newHashMapClass?extendsIFloodlightService,CollectionIFloodlightModule();moduleServiceMap=newHashMapIFloodlightModule,CollectionClass?extendsIFloodlightService();moduleNameMap=newHashMapString,IFloodlightModule();拷贝modulelist到module队列遍历队列module=moduleNameMap.get(moduleName)基于名称获取模块实例addModule(moduleMap,moduleSet,module);更新moduleMap和moduleSetCollectionIFloodlightModulemoduleSet=newArrayListIFloodlightModule();MapClass?extendsIFloodlightService,IFloodlightModulemoduleMap=newHashMapClass?extendsIFloodlightService,IFloodlightModule();deps=module.getModuleDependencies();遍历deps判断moduleMap中是否存在相应的依赖模块floodlightModuleContext.setModuleSet(moduleSet)restApi.run()returnfloodlightModuleContextsettings.getModuleFile()parseConfigParameters(prop)获取配置文件中的各模块的配置信息遍历所有模块,更新floodlightModuleContext的serviceMap遍历所有模块,执行module.init(floodlightModuleContext)遍历所有模块,执行m.startUp(floodlightModuleContext)待补充ServerBootstrapbootstrap=createServerBootStrap();newServerBootstrap(newNioServerSocketChannelFactory(Executors.newCachedThreadPool(),Executors.newCachedThreadPool()));controller.run()sa=newInetSocketAddress(openFlowHost,openFlowPort)ChannelPipelineFactorypfact=newOpenflowPipelineFactory(this,null)bootstrap.setPipelineFactory(pfact)bootstrap.bind(sa)监听6633mainloop无限循环初始化相关变量this.controller=controllerIUpdateupdate=updates.take()从updates中获取updategetPipeline中设置pipeline的各种handler,包括controller.getChannelHandler(state)此处需要了解netty的通信过程,才能理解这里的代码update.dispach()Iupdate接口有三个实现类,分别是SwitchUpdate、HARoleUpdate、HAControllerNodeIPUpdate这个类才是OpenFlow协议处理的核心!!!messageReceivedprocessOFMessagehandleMessagelistener.receive(sw,m,bc);Listener就是注册监听ofmessage消息的其它各个模块
本文标题:Floodlight架构图-发布-v1.0
链接地址:https://www.777doc.com/doc-5962633 .html