restconf: what is the correct api call for configuring a BGP peer
restconf: what is the correct api call for configuring a BGP peer
I am trying to bring up a BGP session (linkstate family, if it matters).
Following this guide https://github.com/opendaylight/docs/blob/master/docs/user-guide/bgpcep-guide/bgp/bgp-user-guide-linkstate-family.rst
When I am making a request using
as URL /restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols
and as body
/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>
It seems that the family was added to the BGP speaker, I am checking this with
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}}, ...
Question #1
I do not know though how to check and where should I expect to see the local IP address (10.20.14.1 in the above example) that is used for this BGP session. What would be the HTTP GET request for that ?
Next, when I am trying to configure the BGP peer using
as URL /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
and as body
/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>
I get the following error:
{'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"'}]}}
Question #2
Could you please help me and advise on the correct HTTP call to configure a BGP peer ?
PS. I am running OpenDaylight Oxygen-SR2
UPDATE: I found out that RESTCONF API Explorer is of help, still browsing through it..
1 Answer
1
taking advantage of https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL:Restconf_API_Explorer
the answer to question #1 is: http://127.0.0.1:8181/restconf/config/openconfig-network-instance:network-instances
http://127.0.0.1:8181/restconf/config/openconfig-network-instance:network-instances
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.