1 # Copyright (C) 2016 Nippon Telegraph and Telephone Corporation.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
17 Defines data types and models required specifically for VRF (for EVPN)
18 support. Represents data structures for VRF not VPN/global.
23 from ryu.lib.packet.bgp import RF_L2_EVPN
24 from ryu.lib.packet.bgp import EvpnNLRI
26 from ryu.services.protocols.bgp.info_base.evpn import EvpnPath
27 from ryu.services.protocols.bgp.info_base.vrf import VrfDest
28 from ryu.services.protocols.bgp.info_base.vrf import VrfNlriImportMap
29 from ryu.services.protocols.bgp.info_base.vrf import VrfPath
30 from ryu.services.protocols.bgp.info_base.vrf import VrfTable
32 LOG = logging.getLogger('bgpspeaker.info_base.vrfevpn')
35 class VrfEvpnPath(VrfPath):
36 """Represents a way of reaching an EVPN destination with a VPN."""
37 ROUTE_FAMILY = RF_L2_EVPN
38 VPN_PATH_CLASS = EvpnPath
39 VPN_NLRI_CLASS = EvpnNLRI
42 class VrfEvpnDest(VrfDest):
43 """Destination for EVPN VRFs."""
44 ROUTE_FAMILY = RF_L2_EVPN
47 class VrfEvpnTable(VrfTable):
48 """Virtual Routing and Forwarding information base for EVPN."""
49 ROUTE_FAMILY = RF_L2_EVPN
50 VPN_ROUTE_FAMILY = RF_L2_EVPN
52 VRF_PATH_CLASS = VrfEvpnPath
53 VRF_DEST_CLASS = VrfEvpnDest
56 class VrfEvpnNlriImportMap(VrfNlriImportMap):
57 VRF_PATH_CLASS = VrfEvpnPath