2 from __future__ import absolute_import
6 from ryu.services.protocols.bgp.bgpspeaker import RF_VPN_V4
7 from ryu.services.protocols.bgp.bgpspeaker import RF_VPN_V6
8 from ryu.services.protocols.bgp.bgpspeaker import RF_L2_EVPN
9 from ryu.services.protocols.bgp.bgpspeaker import RF_VPNV4_FLOWSPEC
10 from ryu.services.protocols.bgp.bgpspeaker import RF_VPNV6_FLOWSPEC
11 from ryu.services.protocols.bgp.bgpspeaker import RF_L2VPN_FLOWSPEC
12 from ryu.services.protocols.bgp.bgpspeaker import EVPN_MAX_ET
13 from ryu.services.protocols.bgp.bgpspeaker import ESI_TYPE_LACP
14 from ryu.services.protocols.bgp.bgpspeaker import ESI_TYPE_MAC_BASED
15 from ryu.services.protocols.bgp.bgpspeaker import EVPN_ETH_AUTO_DISCOVERY
16 from ryu.services.protocols.bgp.bgpspeaker import EVPN_MAC_IP_ADV_ROUTE
17 from ryu.services.protocols.bgp.bgpspeaker import TUNNEL_TYPE_VXLAN
18 from ryu.services.protocols.bgp.bgpspeaker import EVPN_MULTICAST_ETAG_ROUTE
19 from ryu.services.protocols.bgp.bgpspeaker import EVPN_ETH_SEGMENT
20 from ryu.services.protocols.bgp.bgpspeaker import EVPN_IP_PREFIX_ROUTE
21 from ryu.services.protocols.bgp.bgpspeaker import FLOWSPEC_FAMILY_IPV4
22 from ryu.services.protocols.bgp.bgpspeaker import FLOWSPEC_FAMILY_IPV6
23 from ryu.services.protocols.bgp.bgpspeaker import FLOWSPEC_FAMILY_VPNV4
24 from ryu.services.protocols.bgp.bgpspeaker import FLOWSPEC_FAMILY_VPNV6
25 from ryu.services.protocols.bgp.bgpspeaker import FLOWSPEC_FAMILY_L2VPN
26 from ryu.services.protocols.bgp.bgpspeaker import FLOWSPEC_TA_SAMPLE
27 from ryu.services.protocols.bgp.bgpspeaker import FLOWSPEC_TA_TERMINAL
28 from ryu.services.protocols.bgp.bgpspeaker import FLOWSPEC_VLAN_POP
29 from ryu.services.protocols.bgp.bgpspeaker import FLOWSPEC_VLAN_PUSH
30 from ryu.services.protocols.bgp.bgpspeaker import FLOWSPEC_VLAN_SWAP
31 from ryu.services.protocols.bgp.bgpspeaker import FLOWSPEC_VLAN_RW_INNER
32 from ryu.services.protocols.bgp.bgpspeaker import FLOWSPEC_VLAN_RW_OUTER
33 from ryu.services.protocols.bgp.bgpspeaker import FLOWSPEC_TPID_TI
34 from ryu.services.protocols.bgp.bgpspeaker import FLOWSPEC_TPID_TO
35 from ryu.services.protocols.bgp.bgpspeaker import REDUNDANCY_MODE_SINGLE_ACTIVE
37 # =============================================================================
39 # =============================================================================
42 # AS number for this BGP instance.
46 'router_id': '172.17.0.1',
48 # Default local preference
51 # List of TCP listen host addresses.
52 'bgp_server_hosts': ['0.0.0.0', '::'],
54 # List of BGP neighbors.
55 # The parameters for each neighbor are the same as the arguments of
56 # BGPSpeaker.neighbor_add() method.
59 'address': '172.17.0.2',
67 'address': '172.17.0.3',
72 'address': '172.17.0.4',
74 'enable_ipv4fs': True,
75 'enable_ipv6fs': True,
76 'enable_vpnv4fs': True,
77 'enable_vpnv6fs': True,
78 'enable_l2vpnfs': True,
82 # List of BGP VRF tables.
83 # The parameters for each VRF table are the same as the arguments of
84 # BGPSpeaker.vrf_add() method.
86 # Example of VRF for IPv4
88 'route_dist': '65001:100',
89 'import_rts': ['65001:100'],
90 'export_rts': ['65001:100'],
91 'route_family': RF_VPN_V4,
93 # Example of VRF for IPv6
95 'route_dist': '65001:150',
96 'import_rts': ['65001:150'],
97 'export_rts': ['65001:150'],
98 'route_family': RF_VPN_V6,
100 # Example of VRF for EVPN
102 'route_dist': '65001:200',
103 'import_rts': ['65001:200'],
104 'export_rts': ['65001:200'],
105 'route_family': RF_L2_EVPN,
107 # Example of VRF for IPv4 FlowSpec
109 'route_dist': '65001:250',
110 'import_rts': ['65001:250'],
111 'export_rts': ['65001:250'],
112 'route_family': RF_VPNV4_FLOWSPEC,
114 # Example of VRF for IPv6 FlowSpec
116 'route_dist': '65001:300',
117 'import_rts': ['65001:300'],
118 'export_rts': ['65001:300'],
119 'route_family': RF_VPNV6_FLOWSPEC,
121 # Example of VRF for L2VPN FlowSpec
123 'route_dist': '65001:350',
124 'import_rts': ['65001:350'],
125 'export_rts': ['65001:350'],
126 'route_family': RF_L2VPN_FLOWSPEC,
130 # List of BGP routes.
131 # The parameters for each route are the same as the arguments of
132 # the following methods:
133 # - BGPSpeaker.prefix_add()
134 # - BGPSpeaker.evpn_prefix_add()
135 # - BGPSpeaker.flowspec_prefix_add()
137 # Example of IPv4 prefix
139 'prefix': '10.10.1.0/24',
141 # Example of VPNv4 prefix
143 'prefix': '10.20.1.0/24',
144 'next_hop': '172.17.0.1',
145 'route_dist': '65001:100',
147 # Example of IPv6 prefix
149 'prefix': '2001:db8:1::/64',
151 # Example of VPNv6 prefix
153 'prefix': '2001:db8:2::/64',
154 'next_hop': '172.17.0.1',
155 'route_dist': '65001:150',
157 # Example of EVPN prefix
159 'route_type': EVPN_ETH_AUTO_DISCOVERY,
160 'route_dist': '65001:200',
162 'type': ESI_TYPE_LACP,
163 'mac_addr': 'aa:bb:cc:dd:ee:ff',
166 'ethernet_tag_id': EVPN_MAX_ET,
167 'redundancy_mode': REDUNDANCY_MODE_SINGLE_ACTIVE,
170 'route_type': EVPN_MAC_IP_ADV_ROUTE,
171 'route_dist': '65001:200',
173 'ethernet_tag_id': 0,
174 'tunnel_type': TUNNEL_TYPE_VXLAN,
176 'mac_addr': 'aa:bb:cc:dd:ee:ff',
177 'ip_addr': '10.30.1.1',
178 'next_hop': '172.17.0.1',
181 'route_type': EVPN_MULTICAST_ETAG_ROUTE,
182 'route_dist': '65001:200',
184 'ethernet_tag_id': 0,
185 'ip_addr': '10.40.1.1',
188 'route_type': EVPN_ETH_SEGMENT,
189 'route_dist': '65001:200',
191 'type': ESI_TYPE_MAC_BASED,
192 'mac_addr': 'aa:bb:cc:dd:ee:ff',
195 'ip_addr': '172.17.0.1',
198 'route_type': EVPN_IP_PREFIX_ROUTE,
199 'route_dist': '65001:200',
201 'ethernet_tag_id': 0,
202 'ip_prefix': '10.50.1.0/24',
203 'gw_ip_addr': '172.16.0.1',
205 # Example of Flow Specification IPv4 prefix
207 'flowspec_family': FLOWSPEC_FAMILY_IPV4,
209 'dst_prefix': '10.60.1.0/24',
210 'src_prefix': '172.17.0.0/24',
213 'dst_port': '>9000 & <9050',
214 'src_port': '>=8500 & <=9000',
217 'tcp_flags': 'SYN+ACK & !=URGENT',
220 'fragment': 'LF | ==FF',
228 'action': FLOWSPEC_TA_SAMPLE | FLOWSPEC_TA_TERMINAL,
232 'local_administrator': 100,
239 # Example of Flow Specification VPNv4 prefix
241 'flowspec_family': FLOWSPEC_FAMILY_VPNV4,
242 'route_dist': '65001:250',
244 'dst_prefix': '10.70.1.0/24',
245 'src_prefix': '172.18.0.0/24',
248 'dst_port': '>9000 & <9050',
249 'src_port': '>=8500 & <=9000',
252 'tcp_flags': 'SYN+ACK & !=URGENT',
255 'fragment': 'LF | ==FF',
263 'action': FLOWSPEC_TA_SAMPLE | FLOWSPEC_TA_TERMINAL,
267 'local_administrator': 100,
274 # Example of Flow Specification IPv6 prefix
276 'flowspec_family': FLOWSPEC_FAMILY_IPV6,
278 'dst_prefix': '2001::1/128/32',
279 'src_prefix': '3001::2/128',
282 'dst_port': '>9000 & <9050',
283 'src_port': '>=8500 & <=9000',
286 'tcp_flags': 'SYN+ACK & !=URGENT',
289 'fragment': 'LF | ==FF',
298 'action': FLOWSPEC_TA_SAMPLE | FLOWSPEC_TA_TERMINAL,
302 'local_administrator': 100,
309 # Example of Flow Specification VPNv6 prefix
311 'flowspec_family': FLOWSPEC_FAMILY_VPNV6,
312 'route_dist': '65001:300',
314 'dst_prefix': '2001::1/128/32',
315 'src_prefix': '3001::2/128',
318 'dst_port': '>9000 & <9050',
319 'src_port': '>=8500 & <=9000',
322 'tcp_flags': 'SYN+ACK & !=URGENT',
325 'fragment': 'LF | ==FF',
334 'action': FLOWSPEC_TA_SAMPLE | FLOWSPEC_TA_TERMINAL,
338 'local_administrator': 100,
345 # Example of Flow Specification L2VPN prefix
347 'flowspec_family': FLOWSPEC_FAMILY_L2VPN,
348 'route_dist': '65001:350',
350 'ether_type': 0x0800,
351 'src_mac': '12:34:56:78:90:AB',
352 'dst_mac': 'BE:EF:C0:FF:EE:DD',
359 'inner_vlan_id': '<3000',
360 'inner_vlan_cos': '<=5',
368 'action': FLOWSPEC_TA_SAMPLE | FLOWSPEC_TA_TERMINAL,
372 'local_administrator': 100,
378 'actions_1': FLOWSPEC_VLAN_POP | FLOWSPEC_VLAN_PUSH,
381 'actions_2': FLOWSPEC_VLAN_SWAP,
386 'actions': FLOWSPEC_TPID_TI | FLOWSPEC_TPID_TO,
396 # =============================================================================
397 # SSH server configuration.
398 # =============================================================================
401 'ssh_host': 'localhost',
402 # 'ssh_host_key': '/etc/ssh_host_rsa_key',
403 # 'ssh_username': 'ryu',
404 # 'ssh_password': 'ryu',
408 # =============================================================================
409 # Logging configuration.
410 # =============================================================================
413 # We use python logging package for logging.
415 'disable_existing_loggers': False,
419 'format': '%(levelname)s %(asctime)s %(module)s ' +
420 '[%(process)d %(thread)d] %(message)s'
423 'format': '%(levelname)s %(asctime)s %(module)s %(lineno)s ' +
427 'format': '%(message)s'
432 # Outputs log to console.
435 'class': 'logging.StreamHandler',
436 'formatter': 'simple'
440 'class': 'logging.StreamHandler',
443 # Rotates log file when its size reaches 10MB.
446 'class': 'logging.handlers.RotatingFileHandler',
447 'filename': os.path.join('.', 'bgpspeaker.log'),
448 'maxBytes': '10000000',
449 'formatter': 'verbose'
453 'class': 'logging.handlers.RotatingFileHandler',
454 'filename': os.path.join('.', 'statistics_bgps.log'),
455 'maxBytes': '10000000',
460 # Fine-grained control of logging per instance.
463 'handlers': ['console', 'log_file'],
468 'handlers': ['stats_file', 'console_stats'],
471 'formatter': 'stats',
477 'handlers': ['console', 'log_file'],