You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

OMNeT运行多SDN控制器出现OPEN_ACTIVE命令报错如何解决?

OMNeT SDN多控制器OPEN_ACTIVE运行时错误排查与解决方案

错误根因说明

你遇到的Error processing command OPEN_ACTIVE:remote address and port must be specified报错,核心原因是修改OFA_switch.cc后,交换机主动连接控制器的逻辑没有适配你当前的多域控制器层级结构:原代码默认寻址顶层controller模块,你当前环境的controller是各域下的子模块,交换机无法读取到有效的控制器地址、端口参数,导致发起连接时参数为空触发报错。

排查步骤

  • 核对OFA_switch.cc中你取消注释的上半段代码逻辑,确认原代码是否硬编码了读取顶层controller模块的路径,没有适配域内子模块的层级结构
  • 检查omnetpp.ini配置,确认是否给每个交换机配置了对应域控制器的完整模块路径参数,是否存在参数遗漏、路径错误的问题
  • 核对OFA_switch的NED定义,确认是否保留了string controller的可配置参数声明,没有被误删除导致配置无法传递到代码逻辑
  • 检查各域controller子模块的配置,确认address、openflowPort参数都已正确赋值,没有留空

修复方案

  1. 修改OFA_switch.cc中控制器寻址逻辑,将硬编码的顶层模块寻址替换为从参数读取路径的动态寻址,参考修改代码:
// 替换原有顶层控制器查找代码段
cModule* ctrlModule = getModuleByPath(par("controller").stringValue());
if (!ctrlModule) {
    error("Cannot find controller at path: %s", par("controller").stringValue());
}
// 读取控制器的地址与监听端口
const char* ctrlAddress = ctrlModule->par("address").stringValue();
int ctrlPort = ctrlModule->par("openflowPort").intValue();
// 后续用上面两个参数填充OPEN_ACTIVE命令的配置
  1. 在omnetpp.ini中按域批量配置交换机对应的控制器路径,示例配置如下:
# 域1交换机绑定域1内的controller子模块
**.domain1.switch*.controller = ".domain1.controller"
# 域2交换机绑定域2内的controller子模块
**.domain2.switch*.controller = ".domain2.controller"
# 所有controller子模块配置本地地址与默认OpenFlow端口
**.controller.address = "127.0.0.1"
**.controller.openflowPort = 6633
  1. 重新编译项目后运行即可消除该报错。

内容的提问来源于stack exchange,提问作者Amthal

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.24 23:45:04