首页 文章

opendaylight:如何查看配置数据库

提问于
浏览
2

我正在使用OpenDaylight Carbon版本和openflow插件 . 我正在编写代码来安装流程 . 该流程将写入MDSAL并由Southbound插件选取并安装 . 我想看看交换机的配置数据库中有什么 . 我怎样才能做到这一点?谢谢 .

1 回答

  • 2

    使用MDSAL Openflow插件(以及整体的一般MDSAL使用),将流写入配置数据存储区(这实际上是您想要的意图)然后如果为这些流连接了交换机,则流将被写入切换到操作数据存储(存储结果的位置) .

    假设您正在使用OVS并将管理器和控制器设置为Opendaylight,您可以按如下方式查询配置和操作数据存储中的流:

    Get the OVS datapath ID: (查询中需要以下内容)

    curl -H "Content-Type: application/json" -X GET --user admin:admin http://localhost:8181/restconf/config/opendaylight-inventory:nodes/ | python -m json.tool | grep "openflow:"
    
                    "id": "openflow:156930464280132",
                            "id": "openflow:156930464280132:1",
                            "id": "openflow:156930464280132:LOCAL",
    

    Query the flows in the configuration data store:

    curl -H "Content-Type: application/json" -X GET --user admin:admin http://localhost:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:156930464280132 | python -m json.tool
    

    Query the flows in the operational data store:

    curl -H "Content-Type: application/json" -X GET --user admin:admin http://localhost:8181/restconf/operational/opendaylight-inventory:nodes/node/openflow:156930464280132 | python -m json.tool
    

    请注意,您可以使用URL更详细地获取特定表中的流,例如,执行此操作以获取表4流:

    curl -H "Content-Type: application/json" -X GET --user admin:admin http://localhost:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:156930464280132/table/4 | python -m json.tool
    

    另请注意,使用“python -m json.tool”格式化输出,因此它不是全部在一行上 . 它不是必须使用的 .

相关问题