使用 Postman 将流推送到 REST ODL API 时出错

Error pushing flow to REST ODL API with Postman

我正在尝试使用此 URL:

将此流程推送到 ODL 氮气分布的 REST API

http://192.168.21.144:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:1/flow-node-inventory:table/0/flow/100/instructions/instruction/3

..还有这个 body:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<flow xmlns="urn:opendaylight:flow:inventory">
<flow-name>push-mpls-action</flow-name>
<instructions>
    <instruction>
        <order>3</order>
        <apply-actions>
            <action>
                <push-mpls-action>
                    <ethernet-type>34887</ethernet-type>
                </push-mpls-action>
                <order>0</order>
            </action>
            <action>
                <set-field>
                    <protocol-match-fields>
                        <mpls-label>27</mpls-label>
                    </protocol-match-fields>
                </set-field>
                <order>1</order>
            </action>
            <action>
                <output-action>
                    <output-node-connector>2</output-node-connector>
                </output-action>
                <order>2</order>
            </action>
        </apply-actions>
    </instruction>
</instructions>
<strict>false</strict>
<id>100</id>
<match>
    <ethernet-match>
        <ethernet-type>
            <type>2048</type>
        </ethernet-type>
    </ethernet-match>
    <in-port>1</in-port>
    <ipv4-destination>10.0.0.1/32</ipv4-destination>
</match>
<idle-timeout>0</idle-timeout>
<cookie_mask>255</cookie_mask>
<cookie>401</cookie>
<priority>8</priority>
<hard-timeout>0</hard-timeout>
<installHw>false</installHw>
<table_id>0</table_id>
</flow>

REST API 给我这个:

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>Error 415 Unsupported Media Type</title>
</head>
<body>
    <h2>HTTP ERROR 415</h2>
    <p>Problem accessing /restconf/config/opendaylight-inventory:nodes/node/openflow:1. Reason:

        <pre>    Unsupported Media Type</pre>
    </p>
    <hr>
    <i>
        <small>Powered by Jetty://</small>
    </i>
    <hr/>
</body>
</html>

xml 来自 opendaylight 示例,所以我认为我在编写 URL 时做错了什么。

试试这个 URL:

http://192.168.21.144:8181/restconf/config/opendaylight-inventory:nodes/node/openflow:1/flow-node-inventory:table/0/flow/100

(基本上删除了 "instructions/instruction/3")

您必须在 postman

上将 Request Body 上下文类型设置为 application/xml