1

我正在尝试使用 /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 查看网络拓扑,所以我认为我已连接到一切正常。

提前谢谢了。

4

2 回答 2

0

我在使用 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

也添加身份验证标头。

内容类型:应用程序/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>
于 2016-02-18T13:34:51.820 回答
0

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

{
    input: {...},
    output: {...}
}
于 2016-01-21T12:20:13.420 回答