backing up
[vsorcdistro/.git] / ryu / build / lib.linux-armv7l-2.7 / ryu / services / protocols / bgp / info_base / vrfevpn.py
1 # Copyright (C) 2016 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 EVPN)
18  support. Represents data structures for VRF not VPN/global.
19 """
20
21 import logging
22
23 from ryu.lib.packet.bgp import RF_L2_EVPN
24 from ryu.lib.packet.bgp import EvpnNLRI
25
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
31
32 LOG = logging.getLogger('bgpspeaker.info_base.vrfevpn')
33
34
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
40
41
42 class VrfEvpnDest(VrfDest):
43     """Destination for EVPN VRFs."""
44     ROUTE_FAMILY = RF_L2_EVPN
45
46
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
51     NLRI_CLASS = EvpnNLRI
52     VRF_PATH_CLASS = VrfEvpnPath
53     VRF_DEST_CLASS = VrfEvpnDest
54
55
56 class VrfEvpnNlriImportMap(VrfNlriImportMap):
57     VRF_PATH_CLASS = VrfEvpnPath
58     NLRI_CLASS = EvpnNLRI