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 IPv6)
18 support. Represents data structures for VRF not VPN/global.
19 (Inside VRF you have IPv4 prefixes and inside VPN you have VPNv6 prefixes)
24 from ryu.lib.packet.bgp import RF_IPv6_UC
25 from ryu.lib.packet.bgp import RF_IPv6_VPN
26 from ryu.lib.packet.bgp import IP6AddrPrefix
27 from ryu.lib.packet.bgp import LabelledVPNIP6AddrPrefix
29 from ryu.services.protocols.bgp.info_base.vpnv6 import Vpnv6Path
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.vrf6')
38 class Vrf6Path(VrfPath):
39 """Represents a way of reaching an IP destination with a VPN."""
40 ROUTE_FAMILY = RF_IPv6_UC
41 VPN_PATH_CLASS = Vpnv6Path
42 VPN_NLRI_CLASS = LabelledVPNIP6AddrPrefix
45 class Vrf6Dest(VrfDest):
46 """Destination for IPv6 VRFs."""
47 ROUTE_FAMILY = RF_IPv6_UC
50 class Vrf6Table(VrfTable):
51 """Virtual Routing and Forwarding information base for IPv6."""
52 ROUTE_FAMILY = RF_IPv6_UC
53 VPN_ROUTE_FAMILY = RF_IPv6_VPN
54 NLRI_CLASS = IP6AddrPrefix
55 VRF_PATH_CLASS = Vrf6Path
56 VRF_DEST_CLASS = Vrf6Dest
59 class Vrf6NlriImportMap(VrfNlriImportMap):
60 VRF_PATH_CLASS = Vrf6Path
61 NLRI_CLASS = IP6AddrPrefix