diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-01-31 17:05:17 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-02-11 14:41:08 +0900 |
commit | e13f46b2563cf7e6023dafe43fb2946711cdc049 (patch) | |
tree | 8b23c4612e7248e986caf8b8adf21a7afb686f0e | |
parent | 6e78aa3b9417b2888fa2cf5a095ac03e343cdfad (diff) |
BGPSpeaker: Advertise VNI on EVPN Multicast Ethernet-Tag
For the interoperability with other MP BGP EVPN VXLAN implementations
(e.g., Cisco NX-OS), this patch enables to advertise the VNI with the
PMSI Tunnel attribute on the Inclusive Multicast Ethernet Tag Route
messages.
Suggested-by: Albert Siersema <albert@mediacaster.nl>
Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/services/protocols/bgp/bgpspeaker.py | 16 | ||||
-rw-r--r-- | ryu/services/protocols/bgp/core_managers/table_manager.py | 5 | ||||
-rw-r--r-- | ryu/services/protocols/bgp/info_base/vrf.py | 3 |
3 files changed, 20 insertions, 4 deletions
diff --git a/ryu/services/protocols/bgp/bgpspeaker.py b/ryu/services/protocols/bgp/bgpspeaker.py index 6a0025c0..d82be624 100644 --- a/ryu/services/protocols/bgp/bgpspeaker.py +++ b/ryu/services/protocols/bgp/bgpspeaker.py @@ -581,18 +581,25 @@ class BGPSpeaker(object): ``vni`` specifies an Virtual Network Identifier for VXLAN or Virtual Subnet Identifier for NVGRE. - If tunnel_type is not 'vxlan' or 'nvgre', this field is ignored. + If tunnel_type is not TUNNEL_TYPE_VXLAN or TUNNEL_TYPE_NVGRE, + this field is ignored. ``next_hop`` specifies the next hop address for this prefix. ``tunnel_type`` specifies the data plane encapsulation type - to advertise. By the default, this encapsulation attribute is - not advertised. + to advertise. + By the default, this attribute is not advertised. + The supported encapsulation types are TUNNEL_TYPE_VXLAN and + TUNNEL_TYPE_NVGRE. ``pmsi_tunnel_type`` specifies the type of the PMSI tunnel attribute used to encode the multicast tunnel identifier. This field is advertised only if route_type is EVPN_MULTICAST_ETAG_ROUTE. + By the default, this attribute is not advertised. + The supported PMSI tunnel types are PMSI_TYPE_NO_TUNNEL_INFO and + PMSI_TYPE_INGRESS_REP. + This attribute can also carry vni if tunnel_type is specified. ``redundancy_mode`` specifies a redundancy mode type. The supported redundancy mode types are REDUNDANCY_MODE_ALL_ACTIVE @@ -638,6 +645,9 @@ class BGPSpeaker(object): EVPN_ETHERNET_TAG_ID: ethernet_tag_id, IP_ADDR: ip_addr, }) + # Set tunnel type specific arguments + if tunnel_type in [TUNNEL_TYPE_VXLAN, TUNNEL_TYPE_NVGRE]: + kwargs[EVPN_VNI] = vni # Set PMSI Tunnel Attribute arguments if pmsi_tunnel_type in [ PMSI_TYPE_NO_TUNNEL_INFO, diff --git a/ryu/services/protocols/bgp/core_managers/table_manager.py b/ryu/services/protocols/bgp/core_managers/table_manager.py index 0e084b82..5aa9454a 100644 --- a/ryu/services/protocols/bgp/core_managers/table_manager.py +++ b/ryu/services/protocols/bgp/core_managers/table_manager.py @@ -36,6 +36,7 @@ from ryu.lib.packet.bgp import EvpnEsi from ryu.lib.packet.bgp import EvpnArbitraryEsi from ryu.lib.packet.bgp import EvpnNLRI from ryu.lib.packet.bgp import EvpnMacIPAdvertisementNLRI +from ryu.lib.packet.bgp import EvpnInclusiveMulticastEthernetTagNLRI from ryu.lib.packet.bgp import IPAddrPrefix from ryu.lib.packet.bgp import IP6AddrPrefix @@ -543,6 +544,10 @@ class TableCoreManager(object): if route_type == EvpnMacIPAdvertisementNLRI.ROUTE_TYPE_NAME: # MPLS labels will be assigned automatically kwargs['mpls_labels'] = [] + if route_type == EvpnInclusiveMulticastEthernetTagNLRI.ROUTE_TYPE_NAME: + # Inclusive Multicast Ethernet Tag Route does not have "vni", + # omit "vni" from "kwargs" here. + vni = kwargs.pop('vni', None) subclass = EvpnNLRI._lookup_type_name(route_type) kwargs['route_dist'] = route_dist esi = kwargs.get('esi', None) diff --git a/ryu/services/protocols/bgp/info_base/vrf.py b/ryu/services/protocols/bgp/info_base/vrf.py index 4900e12c..dec6b198 100644 --- a/ryu/services/protocols/bgp/info_base/vrf.py +++ b/ryu/services/protocols/bgp/info_base/vrf.py @@ -319,7 +319,8 @@ class VrfTable(Table): pattrs[BGP_ATTR_TYEP_PMSI_TUNNEL_ATTRIBUTE] = \ BGPPathAttributePmsiTunnel(pmsi_flags=0, tunnel_type=pmsi_tunnel_type, - tunnel_id=tunnel_id) + tunnel_id=tunnel_id, + vni=kwargs.get('vni', None)) puid = self.VRF_PATH_CLASS.create_puid( vrf_conf.route_dist, nlri.prefix) |