How to resolve the issue with BGP Peering with Opendaylight

178 Views Asked by At

I`m building a BGP peering between Cisco router (BGP RR-Client) and OpenDaylight (BGP-RR), (ODL - Oxygen release) using the following REST/XML configuration and Postman API call. Cisco router, as well as ODL are in the same AS (BGP AS 65500), but not in the same IP address space. Proper IGP routing (OSPF) has been configured and both are mutual reachable over IPv4.

Here is the API call with the XML schema I`m using for ODL configuration:

PUT: http://localhost:8181/restconf/data/openconfig-network-instance:network-instances/network-instance=global-bgp/protocols

<protocols xmlns="http://openconfig.net/yang/network-instance">
   <protocol>
      <name>bgp-rr</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>172.16.10.3</router-id>
               <as>65500</as>
            </config>
            <afi-safis>
               <afi-safi>
                  <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
                  </afi-safi>
               </afi-safis>
            </global>
            <neighbors>
               <neighbor>
                  <neighbor-address>1.1.1.1</neighbor-address>
                  <route-reflector>
                     <config>
                        <route-reflector-client>true</route-reflector-client>
                     </config>
                  </route-reflector>
                  <timers>
                     <config>
                        <hold-time>180</hold-time>
                        <connect-retry>5</connect-retry>
                     </config>
                  </timers>
                  <transport>
                     <config>
                        <remote-port>179</remote-port>
                        <passive-mode>false</passive-mode>
                     </config>
                  </transport>
               </neighbor>
            </neighbors>
         </bgp>
      <protocol>
   </protocols>

However, the problem is that I get an error 400 Bad Request with the empty response body, but when pointing on the error code (in Postman), I see bad syntax message. I tried to simplify my API call with the BGP peering only, but always get the same error. I checked the XML code via XML validator and everything looks good (code is valid). On Cisco router, BGP state is in CONNECT state, and I see that TCP state is SYN-SENT. Socket error is Connection Refused (by remote peer). This is understandable, because Cisco router tries to connect to OpenDaylight, but as the BGP peering has not been successfully applied, there`s no BGP speaker in OpenDaylight yet.

I assume that the issue could be the HTML request (PUT), but as I`m beginner in ODL and REST/XML, I have no idea what the correct syntax is.

Can someone help me to identify it and how to solve it? Thank you. Peter

1

There are 1 best solutions below

0
On

I solved some issues mentioned here above in my REST request by splitting the REST call into two separate parts - and , both using PUT call request (instead of POST). By applying this change, I got successful responses on the request, i.e. 200 OK and 201 Created, respectively.

Here below the two (2) separated REST API calls with XML inputs:

PUT: http://localhost:8181/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols
    
    <protocols xmlns="http://openconfig.net/yang/network-instance">
       <protocol>
          <name>bgp-rr</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>172.16.10.3</router-id>
                      <as>65500</as>
                   </config>
                   <apply-policy>
                      <config>
                         <default-export-policy>ACCEPT-ROUTE</default-export-policy>
                         <default-import-policy>ACCEPT-ROUTE</default-import-policy>
                         <import-policy>default-odl-import-policy</import-policy>
                         <export-policy>default-odl-export-policy</export-policy>
                      </config>
                   </apply-policy>
                   <afi-safis>
                      <afi-safi>
                         <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
                      </afi-safi>
                      <afi-safi>
                         <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L2VPN-EVPN</afi-safi-name>
                      </afi-safi>
                   </afi-safis>
                </global>
             </bgp>
       </protocol>
    </protocols>
    
RESULT: 200 OK
    
PUT: http://localhost:8181/restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/bgp-rr/bgp/neighbors
    
    <neighbors xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
       <neighbor>
          <neighbor-address>1.1.1.1</neighbor-address>
          <config>
             <peer-type>INTERNAL</peer-type>
             <description>Cisco1</description>
             <send-community>EXTENDED</send-community>
          </config>
          <afi-safis>
             <afi-safi>
                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
                   <config>
                      <enabled>true</enabled>
                   </config>
             </afi-safi>
             <afi-safi>
                <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:L2VPN-EVPN</afi-safi-name>
                   <config>
                      <enabled>true</enabled>
                   </config>
             </afi-safi>
          </afi-safis>
          <route-reflector>
             <config>
                <route-reflector-client>true</route-reflector-client>
             </config>
          </route-reflector>
          <timers>
             <config>
                <hold-time>180</hold-time>
                <keepalive-interval>60</keepalive-interval>
                <connect-retry>5</connect-retry>
             </config>
          </timers>
          <transport>
             <config>
                <remote-port>179</remote-port>
                <passive-mode>false</passive-mode>
             </config>
          </transport>
       </neighbor>
    </neighbors>
    
    
RESULT: 201 Created

However, the issue with establishing BGP peering with Cisco router remains same, unchanged. I still see TCP SYN-SENT status on a Cisco router, while the BGP peering is in CONNECT state. When doing "tcpdump" on an Ethernet interface facing to the ODL instance, I see TCP handshake communication with the TCP flag [R.] (Connection Reset) coming from the ODL. I have no idea why ODL refuses the TCP session with a Cisco router. No ACLs configured there. I see no log information about BGP in the ODL. I re-installed the "odl-bgpcep-bgp" feature, with no change.

Any idea, please? Thank you. Peter