代码之家  ›  专栏  ›  技术社区  ›  juanan martinez

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

  •  0
  • juanan martinez  · 技术社区  · 8 年前

    我试图使用以下URL将此流推送到ODL Nytrogen发行版的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

    ..本机构:

    <?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>
    

    剩下的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时出错了。

    2 回复  |  直到 8 年前
        1
  •  0
  •   jamo    8 年前
        2
  •  0
  •   nephilim_boy    8 年前

    您必须在postman上将请求正文上下文类型设置为application/xml