restconf:什么是配置BGP对等方的正确api调用

时间:2018-07-07 14:51:15

标签: opendaylight

我正在尝试建立BGP会话(linkstate系列,如果有关系的话)。 遵循本指南https://github.com/opendaylight/docs/blob/master/docs/user-guide/bgpcep-guide/bgp/bgp-user-guide-linkstate-family.rst

当我使用发出请求时 作为网址/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols 并作为身体

<protocol xmlns="http://openconfig.net/yang/network-instance">
    <name>nl-ams02c-ispbgp01</name>
    <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier>
    <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
        <global>
            <config>
                <router-id>10.20.14.1</router-id>
                <as>xxx</as>
            </config>
            <afi-safis>
                <afi-safi>
                    <afi-safi-name>LINKSTATE</afi-safi-name>
                </afi-safi>
            </afi-safis>
        </global>
    </bgp>
</protocol>

该家族似乎已添加到BGP发言者中,我正在通过

进行检查
In [5]: url = "/restconf/operational/bgp-rib:bgp-rib"

In [6]: requests.get('http://{}:{}{}'.format(odl['api']['ipaddr'],odl['api']['port'],url), auth=auth).json()
Out[6]: 
{'bgp-rib': {'rib': [{'id': 'nl-ams02c-ispbgp01',
    'loc-rib': {'tables': [{'afi': 'bgp-linkstate:linkstate-address-family',
       'safi': 'bgp-linkstate:linkstate-subsequent-address-family',
       'bgp-linkstate:linkstate-routes': {},
       'attributes': {'uptodate': True}}, ...

问题#1 我不知道如何检查以及在哪里可以看到用于此BGP会话的本地IP地址(在上例中为10.20.14.1)。对此的HTTP GET请求是什么?

接下来,当我尝试使用以下命令配置BGP对等方时 作为网址/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/nl-ams02c-ispbgp01/bgp/neighbors 并作为身体

<neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
    <neighbor-address>10.20.14.0</neighbor-address>
    <afi-safis>
        <afi-safi>
            <afi-safi-name>LINKSTATE</afi-safi-name>
        </afi-safi>
    </afi-safis>
</neighbor>

我收到以下错误:

{'errors': {'error': [{'error-type': 'protocol',
    'error-tag': 'malformed-message',
    'error-message': 'Error parsing input: Child "protocol" was not found in parent schema node "(urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions?revision=2017-12-07)neighbors"',
    'error-info': 'Child "protocol" was not found in parent schema node "(urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions?revision=2017-12-07)neighbors"'}]}}

问题#2 您能否帮助我,并提供有关配置BGP对等方的正确HTTP调用的建议?

PS。我正在运行OpenDaylight Oxygen-SR2

更新:我发现RESTCONF API Explorer很有帮助,仍在浏览中。

1 个答案:

答案 0 :(得分:0)

利用https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL:Restconf_API_Explorer

问题#1的答案是:http://127.0.0.1:8181/restconf/config/openconfig-network-instance:network-instances

问题2仍未得到解答:)

相关问题