1 # Copyright (C) 2014 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 IPv4)
18 support. Represents data structures for VRF not VPN/global.
19 (Inside VRF you have IPv4 prefixes and inside VPN you have VPNv4 prefixes)
24 from ryu.lib.packet.bgp import RF_IPv4_UC
25 from ryu.lib.packet.bgp import RF_IPv4_VPN
26 from ryu.lib.packet.bgp import IPAddrPrefix
27 from ryu.lib.packet.bgp import LabelledVPNIPAddrPrefix
29 from ryu.services.protocols.bgp.info_base.vpnv4 import Vpnv4Path
30 from ryu.services.protocols.bgp.info_base.vrf import VrfDest
31 from ryu.services.protocols.bgp.info_base.vrf import VrfNlriImportMap
32 from ryu.services.protocols.bgp.info_base.vrf import VrfPath
33 from ryu.services.protocols.bgp.info_base.vrf import VrfTable
35 LOG = logging.getLogger('bgpspeaker.info_base.vrf4')
38 class Vrf4Path(VrfPath):
39 """Represents a way of reaching an IP destination with a VPN."""
40 ROUTE_FAMILY = RF_IPv4_UC
41 VPN_PATH_CLASS = Vpnv4Path
42 VPN_NLRI_CLASS = LabelledVPNIPAddrPrefix
45 class Vrf4Dest(VrfDest):
46 ROUTE_FAMILY = RF_IPv4_UC
49 class Vrf4Table(VrfTable):
50 """Virtual Routing and Forwarding information base for IPv4."""
51 ROUTE_FAMILY = RF_IPv4_UC
52 VPN_ROUTE_FAMILY = RF_IPv4_VPN
53 NLRI_CLASS = IPAddrPrefix
54 VRF_PATH_CLASS = Vrf4Path
55 VRF_DEST_CLASS = Vrf4Dest
58 class Vrf4NlriImportMap(VrfNlriImportMap):
59 VRF_PATH_CLASS = Vrf4Path
60 NLRI_CLASS = IPAddrPrefix