Hi all,

Is anyone working on BGP auto RD support, which in turn needs support  
for the "IP address" RD notation:
   <IP address>:<ID e.g. VNI>
instead of <ASN-2>:<ID>
Or have I overlooked something in the code which already enables these  
features ?
If not I'll have a go at implementing this.

I tried the following:

vni = 655370
loopback_IP = "10.1.1.1"
evpn_route_dist='{}:{}'.format(loopback_IP, vni)
speaker.vrf_add(
     route_dist=evpn_route_dist,
     route_family=RF_L2_EVPN,
     import_rts=[evpn_route_dist],
     export_rts=[evpn_route_dist]
)

Traceback (most recent call last):
   File  
"/usr/local/lib/python2.7/dist-packages/ryu/services/protocols/bgp/api/base.py",
 line 205, in  
call
     return call(**kwargs)
   File  
"/usr/local/lib/python2.7/dist-packages/ryu/services/protocols/bgp/api/base.py",
 line 173, in  
wrapped_fun
     return func(*req_values, **opt_items)
   File  
"/usr/local/lib/python2.7/dist-packages/ryu/services/protocols/bgp/api/prefix.py",
 line 308, in  
add_evpn_local
     route_type=route_type, **kwargs)
   File  
"/usr/local/lib/python2.7/dist-packages/ryu/services/protocols/bgp/core_managers/table_manager.py",
 line 576, in  
update_vrf_table
     pmsi_tunnel_type=pmsi_tunnel_type)
   File  
"/usr/local/lib/python2.7/dist-packages/ryu/services/protocols/bgp/info_base/vrf.py",
 line 274, in  
insert_vrf_path
     as_number=int(as_num),
ValueError: invalid literal for int() with base 10: '10.1.1.1'

Traceback (most recent call last):
   File "./bgp-ryu.py", line 198, in <module>
     bgp_speaker = myBGP()
   File "./bgp-ryu.py", line 51, in __init__
     self.start_BGP()
   File "./bgp-ryu.py", line 164, in start_BGP
     next_hop=loopback_IPv4,
   File  
"/usr/local/lib/python2.7/dist-packages/ryu/services/protocols/bgp/bgpspeaker.py",
 line 671, in  
evpn_prefix_add
     call(func_name, **kwargs)
   File  
"/usr/local/lib/python2.7/dist-packages/ryu/services/protocols/bgp/api/base.py",
 line 211, in  
call
     raise ApiException(desc=str(e))
ryu.services.protocols.bgp.api.base.ApiException: 500.1 - invalid  
literal for int() with base 10: '10.1.1.1'


Or converting the IP address to int (like an 4-byte ASN):

vni = 655370
loopback_IP = "10.1.1.1"
IPv4_as_int = int(ipaddress.IPv4Address(unicode(loopback_IP)))
evpn_route_dist='{}:{}'.format(IPv4_as_int, vni)
speaker.vrf_add(
     route_dist=evpn_route_dist,
     route_family=RF_L2_EVPN,
     import_rts=[evpn_route_dist],
     export_rts=[evpn_route_dist]
)

File "/usr/local/lib/python2.7/dist-packages/ryu/lib/packet/bgp.py",  
line 193, in serialize_value
     return struct.pack(self._VALUE_PACK_STR, *args)
error: 'H' format requires 0 <= number <= 65535


https://tools.ietf.org/html/draft-ietf-l2vpn-evpn-11#section-7.9
"It is RECOMMENDED to use the Type 1 RD [RFC4364].  The value field
  comprises an IP address of the PE (typically, the loopback address)
  followed by a number unique to the PE.  This number may be generated by the
  PE.  Or in the Unique VLAN EVPN case, the low order 12 bits may be the 12
  bit VLAN ID, with the remaining high order 4 bits set to 0"
Also: https://tools.ietf.org/html/rfc4364#section-4.2

Although the RFC's mention "Type 1 RD" limited to 12 bit VLAN ID's,  
RD's can actually be composed of 2-byte ASN, 4-byte ASN plus VXLAN  
VNI's.

Working support for auto generated RD/RT is implemented by various  
vendors, e.g. :

Cumulus "Enable EVPN with Automatic RDs and RTs":
   router bgp 65000
     address-family evpn
     neighbor swp1 activate
     advertise-vni

Juniper
   vrf-target {
     community;
     auto
     import community-name;
     export community-name;
   }

Cisco (NX-OS):
   evpn
     vni <VNI> l2
       rd auto
       route-target import auto
       route-target export auto


Regards,
Albert


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to