OpenDayLight provides a plugin for BGP which features:
This is a short tutorial to build a BGP-LS tunnel communication.
feature:install odl-bgpcep-bgp
curl -u "admin:admin" -X GET http://192.168.103.144:8181/restconf/operational/network-topology:network-topology/
{"network-topology":{"topology":[{"topology-id":"example-ipv4-topology","server-provided":true,"topology-types": {"odl-bgp-topology-types:bgp-ipv4-reachability-topology":{}}},{"topology-id":"flow:1"},{"topology-id":"example- ipv6-topology","server-provided":true,"topology-types":{"odl-bgp-topology-types:bgp-ipv6-reachability-topology": {}}},{"topology-id":"example-linkstate-topology","server-provided":true,"topology-types":{"odl-bgp-topology- types:bgp-linkstate-topology":{}}}]}}
netstat -lapute | grep 1790
telnet <peer-ip-address> <bgp-port>
<config xmlns="http://openconfig.net/yang/bgp"> <router-id>192.168.103.144</router-id> <as>64514</as> </config>
curl -u "admin:admin" -H "Content-Type: text/xml" -d @bgp-rib.xml -X PUT http://192.168.103.144:8181/restconf/config/openconfig-bgp:bgp/global/config
curl -u "admin:admin" -X GET http://192.168.103.144:8181/restconf/config/openconfig-bgp:bgp/global/config
curl -u "admin:admin" -X GET http://192.168.103.144:8181/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols | python -m json.tool
<protocol xmlns="http://openconfig.net/yang/network-instance"> <name>bgp-example</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>192.168.103.144</router-id> <as>64514</as> </config> <afi-safis> <afi-safi> <afi-safi-name>LINKSTATE</afi-safi-name> </afi-safi> </afi-safis> </global> </bgp> </protocol>
curl -u "admin:admin" -X POST -H "Content-Type: text/xml" -d @bgp-config.xml http://192.168.103.144:8181/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols
curl -u "admin:admin" -X GET http://192.168.103.144:8181/restconf/operational/bgp-rib:bgp-rib/rib/bgp-example | python -m json.tool
“BGP uses TCP as its transport protocol, by default listens on port 179. OpenDaylight BGP plugin is configured to listen on port 1790, due to privileged ports restriction for non-root users. One of the workarounds is to use port redirection. In case other port is desired to be used instead, we can reconfigure it.” [1]
<bgp-peer-acceptor-config xmlns="urn:opendaylight:params:xml:ns:yang:odl-bgp-peer-acceptor-config"> <config-name>default</config-name> <binding-address>192.168.103.144</binding-address> <binding-port>179</binding-port> </bgp-peer-acceptor-config>
curl -u "admin:admin" -d @bgp-port.xml -X PUT http://192.168.103.144:8181/restconf/config/odl-bgp-peer-acceptor-config:bgp-peer-acceptor-config/default
It does not work. Please refer to the following
Edit 41-bgp-example.xml file
<module> <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:bgp:rib:impl">prefix:bgp-peer-acceptor</type> <name>bgp-peer-server</name> <binding-address>0.0.0.0</binding-address> <binding-port>1790</binding-port> </module>
<neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions"> <neighbor-address>192.168.103.143</neighbor-address> <afi-safis> <afi-safi> <afi-safi-name>LINKSTATE</afi-safi-name> </afi-safi> <afi-safi> <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name> <receive>false</receive> <send-max>0</send-max> <!-- Npath again for this peer --> </afi-safi> </afi-safis> <timers> <config> <hold-time>90</hold-time> <connect-retry>10</connect-retry> </config> </timers> <transport> <config> <remote-port>179</remote-port> <passive-mode>false</passive-mode> </config> </transport> <config> <peer-type>EXTERNAL</peer-type> <peer-as>64513</peer-as> </config> </neighbor>
curl -u "admin:admin" -X POST -H "Content-Type: text/xml" -d @bgp-peer.xml http://192.168.103.144:8181/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/bgp-example/bgp/neighbors
Check peer configuration :
curl -u "admin:admin" -X GET http://192.168.103.144:8181/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/bgp-example/bgp/neighbors | python -m json.tool