backing up
[vsorcdistro/.git] / ryu / build / lib.linux-armv7l-2.7 / ryu / services / protocols / bgp / info_base / vpnv6fs.py
1 # Copyright (C) 2017 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
18  VPNv6 Flow Specification support.
19 """
20
21 import logging
22
23 from ryu.lib.packet.bgp import FlowSpecVPNv6NLRI
24 from ryu.lib.packet.bgp import RF_VPNv6_FLOWSPEC
25
26 from ryu.services.protocols.bgp.info_base.vpn import VpnDest
27 from ryu.services.protocols.bgp.info_base.vpn import VpnPath
28 from ryu.services.protocols.bgp.info_base.vpn import VpnTable
29
30 LOG = logging.getLogger('bgpspeaker.info_base.vpnv6fs')
31
32
33 class VPNv6FlowSpecDest(VpnDest):
34     """VPNv6 Flow Specification Destination
35
36     Store Flow Specification Paths.
37     """
38     ROUTE_FAMILY = RF_VPNv6_FLOWSPEC
39
40
41 class VPNv6FlowSpecTable(VpnTable):
42     """Global table to store VPNv6 Flow Specification routing information.
43
44     Uses `VPNv6FlowSpecDest` to store destination information for each known
45     Flow Specification paths.
46     """
47     ROUTE_FAMILY = RF_VPNv6_FLOWSPEC
48     VPN_DEST_CLASS = VPNv6FlowSpecDest
49
50
51 class VPNv6FlowSpecPath(VpnPath):
52     """Represents a way of reaching an VPNv6 Flow Specification destination."""
53     ROUTE_FAMILY = RF_VPNv6_FLOWSPEC
54     VRF_PATH_CLASS = None  # defined in init - anti cyclic import hack
55     NLRI_CLASS = FlowSpecVPNv6NLRI
56
57     def __init__(self, *args, **kwargs):
58         # Set dummy IP address.
59         kwargs['nexthop'] = '::'
60         super(VPNv6FlowSpecPath, self).__init__(*args, **kwargs)
61         from ryu.services.protocols.bgp.info_base.vrf6fs import (
62             Vrf6FlowSpecPath)
63         self.VRF_PATH_CLASS = Vrf6FlowSpecPath
64         # Because the IPv6 Flow Specification does not require nexthop,
65         # initialize with None.
66         self._nexthop = None