【问题标题】:How to add a simple flow rule via OpenDaylight DLUX using the /operations/sal-flow:add-flow api如何使用 /operations/sal-flow:add-flow api 通过 OpenDaylight DLUX 添加简单的流规则
【发布时间】:2015-10-23 20:58:56
【问题描述】:

我正在尝试使用 /operations/sal-flow:add-flow api 调用通过 Lithium 的 DLUX 添加一个简单的流规则,但只得到错误,请有人帮忙吗?

即使是某人添加的示例流程的预览也会有帮助吗?

我当前在预览框中显示的输入是:

http://localhost:8181/restconf/operations/sal-flow:add-flow

{
    "add-flow": {
        "input": {
            "match": {
                "ethernet-match": {
                    "ethernet-type": {
                        "type": "2048"
                    }
                },
                "ipv4-source": "10.0.0.1/32"
            },
            "instructions": {
                "instruction": [
                    {
                        "order": "0",
                        "apply-actions": {
                            "action": [
                                {
                                    "drop-action": {},
                                    "order": "0"
                                }
                            ]
                        }
                    }
                ]
            },
            "flow-name": "test",
            "table_id": "0"
        }
    }
}

当前的错误是:

“服务器错误:服务器遇到了意外情况,导致它无法完成请求。-:操作遇到意外错误,而”

Postman 中的相同请求给出了错误:

{
  "errors": {
    "error": [
      {
        "error-type": "protocol",
        "error-tag": "malformed-message",
        "error-message": "Error parsing input: Schema node with name add-flow wasn't found under (urn:opendaylight:flow:service?revision=2013-08-19)add-flow."
      }
    ]
  }
}

我见过使用 xml 的示例,但似乎没有任何效果。我可以通过 dlux 查看网络拓扑,所以我认为我已连接到一切正常。

非常感谢。

【问题讨论】:

    标签: lithium openflow opendaylight


    【解决方案1】:

    从输入数据中删除add-flow 和相应的括号。使用类似的东西

    {
        input: {...},
        output: {...}
    }
    

    【讨论】:

      【解决方案2】:

      我在使用 DLUX 时遇到了同样的问题。无论如何,我设法使用来自此链接https://wiki.opendaylight.org/view/OpenDaylight_OpenFlow_Plugin:End_to_End_Flows 的 XML POST 请求找到了解决方案。您可以使用 Chrome 上的 POSTMAN 应用程序发送请求。请求的正文应该是这样的:

      发布http://localhost:8080/restconf/operations/sal-flow:add-flow

      也添加身份验证标头。

      内容类型:application/xml

      接受:应用程序/xml

      主体:

      <?xml version="1.0" encoding="UTF-8" standalone="no"?>
      <input xmlns="urn:opendaylight:flow:service">
         <barrier>false</barrier>
         <node xmlns:inv="urn:opendaylight:inventory">/inv:nodes/inv:node[inv:id="openflow:1"]</node>
      
         <cookie>55</cookie>
         <flags>SEND_FLOW_REM</flags>
         <hard-timeout>0</hard-timeout>
         <idle-timeout>0</idle-timeout>
         <installHw>false</installHw>
         <match>
          <ethernet-match>
           <ethernet-type>
             <type>2048</type>
           </ethernet-type>
          </ethernet-match>
          <ipv4-destination>10.0.10.2/32</ipv4-destination>
         </match>
         <instructions>
          <instruction>
           <order>0</order>
           <apply-actions>
             <action>
               <output-action>
                 <output-node-connector>1</output-node-connector>
               </output-action>
               <order>0</order>
             </action>
           </apply-actions>
          </instruction>
         </instructions>
         <priority>0</priority>
         <strict>false</strict>
         <table_id>0</table_id>
      </input>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2015-05-21
        • 2015-12-31
        • 2023-03-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-09-17
        相关资源
        最近更新 更多