backing up
[vsorcdistro/.git] / ryu / build / lib.linux-armv7l-2.7 / ryu / services / protocols / bgp / info_base / vrf4.py
1 # Copyright (C) 2014 Nippon Telegraph and Telephone Corporation.
2 #
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
6 #
7 #    http://www.apache.org/licenses/LICENSE-2.0
8 #
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
12 # implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 """
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)
20 """
21
22 import logging
23
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
28
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
34
35 LOG = logging.getLogger('bgpspeaker.info_base.vrf4')
36
37
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
43
44
45 class Vrf4Dest(VrfDest):
46     ROUTE_FAMILY = RF_IPv4_UC
47
48
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
56
57
58 class Vrf4NlriImportMap(VrfNlriImportMap):
59     VRF_PATH_CLASS = Vrf4Path
60     NLRI_CLASS = IPAddrPrefix