OpenDaylight: Configuring ODL and XR BGP using

4
SHARE

Both OpenDaylight (as of Beryllium) and Cisco IOS XR (as of 6.x) now support the OpenConfig YANG models (for BGP both ODL and XR support the 2015-10-09 revision).

 

In this post I will show how to create a BGP session from ODL to XR using the OpenConfig YANG models.  ODL will be configured using RESTCONF.  XR will be configured using RESTCONF to ODL and NETCONF from ODL to XR (but equally you could use NETCONF, or for some platforms RESTCONF, direct to XR).

 

Note that this should all work perfectly if you’re using XR 6.2 and ODL Boron.

 

However if you are using an older version of XR then you will be unable to create BGP configuration from scratch or to add the first neighbor (re-configuring BGP and/or adding subsequent neighbors will be fine however).  This is due to an issue with XR automatically deleting non-presence containers (valid for the running config, but not for the candidate datastore – hence now fixed in the candidate datastore in XR 6.2 and above).

 

Likewise if you are using ODL Carbon, and if you use separate directories for XR and ODL’s models (by using the schema-cache-directory parameter when mounting XR) then ODL will be unable to access XR’s openconfig-bgp model.  This is because Carbon is stricter in enforcing the YANG 1.0 / YANG 1.1 difference around “require-instance” statements within leafrefs.   ODL’s own copy of [email protected] is modified to work around this issue (and another issue with leafref).  You can work around this by getting a copy of [email protected], modifying the yang-version statement to be “1.1” instead of “1”, and then putting this in the XR cache directory before mounting XR (or by using ODL’s modified version!).

 

First off ODL needs to be running the odl-bgpcep-bgp, odl-netconf-all, odl-restconf-all and odl-netconf-connector-all features.

 

XR then needs to be configured as a NETCONF server.  So you’ll need to have configured:

ssh server v2

ssh server netconf vrf default

netconf-yang agent ssh

 

(and you’ll need to have done “crypto key generate rsa” from the admin mode)

 

You’ll also have to have mounted XR from ODL using NETCONF (see other blog posts for that).

 

In the below I’ll assume that ODL is running on the localhost and that XR has been mounted as “XR”.

 

So – let’s configure ODL.

 

do a RESTCONF PUT to:

 

http://localhost:8181/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/protocols/protocol/openconfig-policy-types:BGP/example-bgp-rib/bgp/global

 

with a body of e.g.:

{

“bgp-openconfig-extensions:global”: {

“afi-safis”: {

“afi-safi”: [

{

“afi-safi-name”: “openconfig-bgp-types:IPV4-UNICAST”

},

{

“afi-safi-name”: “openconfig-bgp-types:IPV6-UNICAST”

}

]

},

“config”: {

“as”: 65504,

“router-id”: “10.195.94.43”

}

}

}

 

the full list of supported AFI/SAFI names (as of ODL Boron) is:

1) openconfig-bgp-types:IPV4-UNICAST

2) openconfig-bgp-types:IPV6-UNICAST

3) openconfig-bgp-types:IPV4-LABELLED-UNICAST

4) openconfig-bgp-types:IPV6-LABELLED-UNICAST

5) openconfig-bgp-types:L3VPN-IPV4-UNICAST

6) openconfig-bgp-types:L3VPN-IPV6-UNICAST

7) openconfig-bgp-types:L2VPN-EVPN

8) bgp-openconfig-extensions:LINKSTATE

9) bgp-openconfig-extensions:IPV4-FLOW

10) bgp-openconfig-extensions:IPV6-FLOW

11) bgp-openconfig-extensions:IPV4-L3VPN-FLOW

12) bgp-openconfig-extensions:IPV6-L3VPN-FLOW

 

so now the RIB is set up.

 

next step is to add a peer:

 

do a RESTCONF POST to:

 

http://localhost:8181/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/protocols/protocol/openconfig-policy-types:BGP/example-bgp-rib/bgp-openconfig-extensions:bgp/neighbors

 

with a body of e.g:

 

{

“bgp-openconfig-extensions:neighbor”: [

{

“neighbor-address”: “10.195.94.68”,

“timers”: {

“config”: {

“connect-retry”: 10,

“keepalive-interval”: 30,

“hold-time”: 180,

“minimum-advertisement-interval”: 30

}

},

“afi-safis”: {

“afi-safi”: [

{

“afi-safi-name”: “openconfig-bgp-types:IPV4-UNICAST”

},

{

“afi-safi-name”: “openconfig-bgp-types:IPV6-UNICAST”

}

]

},

“route-reflector”: {

“config”: {

“route-reflector-client”: false

}

},

“transport”: {

“config”: {

“remote-port”: 179,

“mtu-discovery”: false,

“passive-mode”: false

}

},

“config”: {

“send-community”: “NONE”,

“peer-as”: 65504,

“route-flap-damping”: false,

“peer-type”: “INTERNAL”

}

}

]

}

 

If you need to advertise routes from ODL to XR you’ll also want to set up the application peer.  For this you can do a POST to the same URL above (http://localhost:8181/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/protocols/protocol/openconfig-policy-types:BGP/example-bgp-rib/bgp-openconfig-extensions:bgp/neighbors) with a body of e.g:

 

{

“bgp-openconfig-extensions:neighbor”: [

{

“neighbor-address”: “10.195.94.40”,

“config”: {

“peer-group”: “application-peers”

}

}

]

}

 

So now we’re ready to configure XR.

 

First thing is to check that ODL has mounted XR correctly.   Verify that openconfig-bgp is listed as an available capability under:

 

http://localhost:8181/restconf/operational/network-topology:network-topology/topology/topology-netconf/node/XR/available-capabilities

 

(note my comment above re ODL Carbon)

 

Now let’s configure the BGP process on XR.  So do a POST to:

 

http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/XR/yang-ext:mount/openconfig-bgp:bgp/global

 

with a body of e.g.:

 

{

“global”: {

“config”: {

“as”: 65504,

“router-id”: “10.195.94.67”

},

“afi-safis”: {

“afi-safi”: [

{

“afi-safi-name”: “openconfig-bgp-types:ipv4-unicast”

},

{

“afi-safi-name”: “openconfig-bgp-types:ipv6-unicast”

}

]

}

}

}

 

(note my comment above re older version of XR).

 

So now we can add ODL as a peer on XR.

 

Now do a POST to:

 

http://localhost:8181/restconf/config/network-topology:network-topology/topology/topology-netconf/node/XR/yang-ext:mount/openconfig-bgp:bgp/neighbors

with a body of e.g:

{

“neighbor”: [

{

“neighbor-address”: “10.195.94.43”,

“config”: {

“peer-as”: 65504,

“neighbor-address”: “10.195.94.43”

},

“afi-safis”: {

“afi-safi”: [

{

“afi-safi-name”: “openconfig-bgp-types:ipv4-unicast”,

“config”: {

“enabled”: true,

“afi-safi-name”: “openconfig-bgp-types:ipv4-unicast”

}

},

{

“afi-safi-name”: “openconfig-bgp-types:ipv6-unicast”,

“config”: {

“enabled”: true,

“afi-safi-name”: “openconfig-bgp-types:ipv6-unicast”

}

}

]

}

}

]

}

 

(again note my comment above re older versions of XR)

 

at this point BGP ought to come up…

 

 << This article was originally published on blog here. >>