# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"([1-9]|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])(\.(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])){3}\/\d+"
test_str = ("LG \n\n\n"
"MegaFon Looking Glass - show bgp 10.249.0.0/16\n\n\n\n\n"
"Router: MSK-VRR-1 Moscow \n"
"Command: show route protocol bgp 10.249.0.0/16 table bgp.l3vpn.0 det | no-more \n\n\n\n"
"bgp.l3vpn.0: 228890 destinations, 628337 routes (227275 active, 0 holddown, 5064 hidden)\n"
"Restart Complete\n"
"83.149.11.41:100:10.249.50.224/29 (3 entries, 1 announced)\n"
" *BGP Preference: 169/-201\n"
" Route Distinguisher: 83.149.11.41:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68a78c\n"
" Next-hop reference count: 267\n"
" Source: 83.149.11.251\n"
" Protocol next hop: 83.149.11.41\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Active Ext ProtectionPath ProtectionCand>\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 2w2d 16:57:04 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.251+???\n"
" Announcement bits (1): 0-BGP_RT_Background \n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 83.149.11.251\n"
" BGP Preference: 170/-201\n"
" Route Distinguisher: 83.149.11.41:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68a78c\n"
" Next-hop reference count: 267\n"
" Source: 83.149.11.252\n"
" Protocol next hop: 83.149.11.41\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Route Preference\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 2w2d 16:57:04 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.252+???\n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 83.149.11.252\n"
" BGP Preference: 170/-201\n"
" Route Distinguisher: 83.149.11.41:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68a78c\n"
" Next-hop reference count: 267\n"
" Source: 10.222.253.245\n"
" Protocol next hop: 83.149.11.41\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <NotBest Int Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Not Best in its group - Interior > Exterior > Exterior via Interior\n"
" Local AS: 31133 Peer AS: 31133\n"
" Age: 2w2d 16:57:04 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_31133.10.222.253.245+???\n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 10.222.253.245\n\n"
"83.149.11.41:100:10.249.50.232/29 (3 entries, 1 announced)\n"
" *BGP Preference: 169/-201\n"
" Route Distinguisher: 83.149.11.41:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68a78c\n"
" Next-hop reference count: 267\n"
" Source: 83.149.11.251\n"
" Protocol next hop: 83.149.11.41\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Active Ext ProtectionPath ProtectionCand>\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 2w2d 16:57:04 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.251+???\n"
" Announcement bits (1): 0-BGP_RT_Background \n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 83.149.11.251\n"
" BGP Preference: 170/-201\n"
" Route Distinguisher: 83.149.11.41:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68a78c\n"
" Next-hop reference count: 267\n"
" Source: 83.149.11.252\n"
" Protocol next hop: 83.149.11.41\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Route Preference\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 2w2d 16:57:04 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.252+???\n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 83.149.11.252\n"
" BGP Preference: 170/-201\n"
" Route Distinguisher: 83.149.11.41:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68a78c\n"
" Next-hop reference count: 267\n"
" Source: 10.222.253.245\n"
" Protocol next hop: 83.149.11.41\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <NotBest Int Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Not Best in its group - Interior > Exterior > Exterior via Interior\n"
" Local AS: 31133 Peer AS: 31133\n"
" Age: 2w2d 16:57:04 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_31133.10.222.253.245+???\n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 10.222.253.245\n\n"
"83.149.11.41:100:10.249.50.248/29 (3 entries, 1 announced)\n"
" *BGP Preference: 169/-201\n"
" Route Distinguisher: 83.149.11.41:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68a78c\n"
" Next-hop reference count: 267\n"
" Source: 83.149.11.251\n"
" Protocol next hop: 83.149.11.41\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Active Ext ProtectionPath ProtectionCand>\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 2w2d 16:57:04 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.251+???\n"
" Announcement bits (1): 0-BGP_RT_Background \n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 83.149.11.251\n"
" BGP Preference: 170/-201\n"
" Route Distinguisher: 83.149.11.41:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68a78c\n"
" Next-hop reference count: 267\n"
" Source: 83.149.11.252\n"
" Protocol next hop: 83.149.11.41\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Route Preference\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 2w2d 16:57:04 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.252+???\n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 83.149.11.252\n"
" BGP Preference: 170/-201\n"
" Route Distinguisher: 83.149.11.41:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68a78c\n"
" Next-hop reference count: 267\n"
" Source: 10.222.253.245\n"
" Protocol next hop: 83.149.11.41\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <NotBest Int Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Not Best in its group - Interior > Exterior > Exterior via Interior\n"
" Local AS: 31133 Peer AS: 31133\n"
" Age: 2w2d 16:57:04 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_31133.10.222.253.245+???\n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 10.222.253.245\n\n"
"83.149.11.41:100:10.249.150.224/29 (3 entries, 1 announced)\n"
" *BGP Preference: 169/-201\n"
" Route Distinguisher: 83.149.11.41:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68a78c\n"
" Next-hop reference count: 267\n"
" Source: 83.149.11.251\n"
" Protocol next hop: 83.149.11.41\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Active Ext ProtectionPath ProtectionCand>\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 2w2d 16:57:04 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.251+???\n"
" Announcement bits (1): 0-BGP_RT_Background \n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 83.149.11.251\n"
" BGP Preference: 170/-201\n"
" Route Distinguisher: 83.149.11.41:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68a78c\n"
" Next-hop reference count: 267\n"
" Source: 83.149.11.252\n"
" Protocol next hop: 83.149.11.41\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Route Preference\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 2w2d 16:57:04 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.252+???\n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 83.149.11.252\n"
" BGP Preference: 170/-201\n"
" Route Distinguisher: 83.149.11.41:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68a78c\n"
" Next-hop reference count: 267\n"
" Source: 10.222.253.245\n"
" Protocol next hop: 83.149.11.41\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <NotBest Int Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Not Best in its group - Interior > Exterior > Exterior via Interior\n"
" Local AS: 31133 Peer AS: 31133\n"
" Age: 2w2d 16:57:04 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_31133.10.222.253.245+???\n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 10.222.253.245\n\n"
"83.149.11.41:100:10.249.150.232/29 (3 entries, 1 announced)\n"
" *BGP Preference: 169/-201\n"
" Route Distinguisher: 83.149.11.41:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68a78c\n"
" Next-hop reference count: 267\n"
" Source: 83.149.11.251\n"
" Protocol next hop: 83.149.11.41\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Active Ext ProtectionPath ProtectionCand>\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 2w2d 16:57:04 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.251+???\n"
" Announcement bits (1): 0-BGP_RT_Background \n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 83.149.11.251\n"
" BGP Preference: 170/-201\n"
" Route Distinguisher: 83.149.11.41:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68a78c\n"
" Next-hop reference count: 267\n"
" Source: 83.149.11.252\n"
" Protocol next hop: 83.149.11.41\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Route Preference\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 2w2d 16:57:04 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.252+???\n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 83.149.11.252\n"
" BGP Preference: 170/-201\n"
" Route Distinguisher: 83.149.11.41:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68a78c\n"
" Next-hop reference count: 267\n"
" Source: 10.222.253.245\n"
" Protocol next hop: 83.149.11.41\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <NotBest Int Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Not Best in its group - Interior > Exterior > Exterior via Interior\n"
" Local AS: 31133 Peer AS: 31133\n"
" Age: 2w2d 16:57:04 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_31133.10.222.253.245+???\n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 10.222.253.245\n\n"
"83.149.11.42:100:10.249.50.224/29 (3 entries, 1 announced)\n"
" *BGP Preference: 169/-201\n"
" Route Distinguisher: 83.149.11.42:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68ab1c\n"
" Next-hop reference count: 258\n"
" Source: 83.149.11.251\n"
" Protocol next hop: 83.149.11.42\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Active Ext ProtectionPath ProtectionCand>\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 2w2d 16:56:39 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.251+???\n"
" Announcement bits (1): 0-BGP_RT_Background \n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 83.149.11.251\n"
" BGP Preference: 170/-201\n"
" Route Distinguisher: 83.149.11.42:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68ab1c\n"
" Next-hop reference count: 258\n"
" Source: 83.149.11.252\n"
" Protocol next hop: 83.149.11.42\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Route Preference\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 2w2d 16:56:39 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.252+???\n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 83.149.11.252\n"
" BGP Preference: 170/-201\n"
" Route Distinguisher: 83.149.11.42:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68ab1c\n"
" Next-hop reference count: 258\n"
" Source: 10.222.253.245\n"
" Protocol next hop: 83.149.11.42\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <NotBest Int Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Not Best in its group - Interior > Exterior > Exterior via Interior\n"
" Local AS: 31133 Peer AS: 31133\n"
" Age: 2w2d 16:56:39 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_31133.10.222.253.245+???\n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 10.222.253.245\n\n"
"83.149.11.42:100:10.249.50.232/29 (3 entries, 1 announced)\n"
" *BGP Preference: 169/-201\n"
" Route Distinguisher: 83.149.11.42:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68ab1c\n"
" Next-hop reference count: 258\n"
" Source: 83.149.11.251\n"
" Protocol next hop: 83.149.11.42\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Active Ext ProtectionPath ProtectionCand>\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 2w2d 16:56:39 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.251+???\n"
" Announcement bits (1): 0-BGP_RT_Background \n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 83.149.11.251\n"
" BGP Preference: 170/-201\n"
" Route Distinguisher: 83.149.11.42:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68ab1c\n"
" Next-hop reference count: 258\n"
" Source: 83.149.11.252\n"
" Protocol next hop: 83.149.11.42\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Route Preference\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 2w2d 16:56:39 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.252+???\n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 83.149.11.252\n"
" BGP Preference: 170/-201\n"
" Route Distinguisher: 83.149.11.42:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68ab1c\n"
" Next-hop reference count: 258\n"
" Source: 10.222.253.245\n"
" Protocol next hop: 83.149.11.42\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <NotBest Int Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Not Best in its group - Interior > Exterior > Exterior via Interior\n"
" Local AS: 31133 Peer AS: 31133\n"
" Age: 2w2d 16:56:39 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_31133.10.222.253.245+???\n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 10.222.253.245\n\n"
"83.149.11.42:100:10.249.50.248/29 (3 entries, 1 announced)\n"
" *BGP Preference: 169/-201\n"
" Route Distinguisher: 83.149.11.42:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68ab1c\n"
" Next-hop reference count: 258\n"
" Source: 83.149.11.251\n"
" Protocol next hop: 83.149.11.42\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Active Ext ProtectionPath ProtectionCand>\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 2w2d 16:56:39 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.251+???\n"
" Announcement bits (1): 0-BGP_RT_Background \n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 83.149.11.251\n"
" BGP Preference: 170/-201\n"
" Route Distinguisher: 83.149.11.42:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68ab1c\n"
" Next-hop reference count: 258\n"
" Source: 83.149.11.252\n"
" Protocol next hop: 83.149.11.42\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Route Preference\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 2w2d 16:56:39 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.252+???\n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 83.149.11.252\n"
" BGP Preference: 170/-201\n"
" Route Distinguisher: 83.149.11.42:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68ab1c\n"
" Next-hop reference count: 258\n"
" Source: 10.222.253.245\n"
" Protocol next hop: 83.149.11.42\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <NotBest Int Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Not Best in its group - Interior > Exterior > Exterior via Interior\n"
" Local AS: 31133 Peer AS: 31133\n"
" Age: 2w2d 16:56:39 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_31133.10.222.253.245+???\n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 10.222.253.245\n\n"
"83.149.11.42:100:10.249.150.224/29 (3 entries, 1 announced)\n"
" *BGP Preference: 169/-201\n"
" Route Distinguisher: 83.149.11.42:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68ab1c\n"
" Next-hop reference count: 258\n"
" Source: 83.149.11.251\n"
" Protocol next hop: 83.149.11.42\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Active Ext ProtectionPath ProtectionCand>\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 2w2d 16:56:39 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.251+???\n"
" Announcement bits (1): 0-BGP_RT_Background \n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 83.149.11.251\n"
" BGP Preference: 170/-201\n"
" Route Distinguisher: 83.149.11.42:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68ab1c\n"
" Next-hop reference count: 258\n"
" Source: 83.149.11.252\n"
" Protocol next hop: 83.149.11.42\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Route Preference\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 2w2d 16:56:39 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.252+???\n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 83.149.11.252\n"
" BGP Preference: 170/-201\n"
" Route Distinguisher: 83.149.11.42:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68ab1c\n"
" Next-hop reference count: 258\n"
" Source: 10.222.253.245\n"
" Protocol next hop: 83.149.11.42\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <NotBest Int Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Not Best in its group - Interior > Exterior > Exterior via Interior\n"
" Local AS: 31133 Peer AS: 31133\n"
" Age: 2w2d 16:56:39 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_31133.10.222.253.245+???\n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 10.222.253.245\n\n"
"83.149.11.42:100:10.249.150.232/29 (3 entries, 1 announced)\n"
" *BGP Preference: 169/-201\n"
" Route Distinguisher: 83.149.11.42:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68ab1c\n"
" Next-hop reference count: 258\n"
" Source: 83.149.11.251\n"
" Protocol next hop: 83.149.11.42\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Active Ext ProtectionPath ProtectionCand>\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 2w2d 16:56:39 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.251+???\n"
" Announcement bits (1): 0-BGP_RT_Background \n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 83.149.11.251\n"
" BGP Preference: 170/-201\n"
" Route Distinguisher: 83.149.11.42:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68ab1c\n"
" Next-hop reference count: 258\n"
" Source: 83.149.11.252\n"
" Protocol next hop: 83.149.11.42\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Route Preference\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 2w2d 16:56:39 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.252+???\n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 83.149.11.252\n"
" BGP Preference: 170/-201\n"
" Route Distinguisher: 83.149.11.42:100\n"
" Next hop type: Indirect\n"
" Address: 0xa68ab1c\n"
" Next-hop reference count: 258\n"
" Source: 10.222.253.245\n"
" Protocol next hop: 83.149.11.42\n"
" Push 17\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <NotBest Int Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Not Best in its group - Interior > Exterior > Exterior via Interior\n"
" Local AS: 31133 Peer AS: 31133\n"
" Age: 2w2d 16:56:39 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_31133.10.222.253.245+???\n"
" AS path: 25159 ?\n"
" Communities: 31133:100 target:25159:25159 target:64690:100 target:64999:15 \n"
" Accepted\n"
" VPN Label: 17\n"
" Localpref: 200\n"
" Router ID: 10.222.253.245\n\n"
"83.149.11.65:1065:10.249.28.168/29 (3 entries, 1 announced)\n"
" *BGP Preference: 169/-201\n"
" Route Distinguisher: 83.149.11.65:1065\n"
" Next hop type: Indirect\n"
" Address: 0xa68bcec\n"
" Next-hop reference count: 3\n"
" Source: 83.149.11.251\n"
" Protocol next hop: 83.149.11.65\n"
" Push 27775\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Active Ext ProtectionPath ProtectionCand>\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 28w0d 0:58:33 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.251+???\n"
" Announcement bits (1): 0-BGP_RT_Background \n"
" AS path: 25159 ?\n"
" Communities: 25159:64666 31133:100 target:64999:1065 \n"
" Accepted\n"
" VPN Label: 27775\n"
" Localpref: 200\n"
" Router ID: 83.149.11.251\n"
" BGP Preference: 170/-201\n"
" Route Distinguisher: 83.149.11.65:1065\n"
" Next hop type: Indirect\n"
" Address: 0xa68bcec\n"
" Next-hop reference count: 3\n"
" Source: 83.149.11.252\n"
" Protocol next hop: 83.149.11.65\n"
" Push 27775\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Route Preference\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 28w0d 0:58:44 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.252+???\n"
" AS path: 25159 ?\n"
" Communities: 25159:64666 31133:100 target:64999:1065 \n"
" Accepted\n"
" VPN Label: 27775\n"
" Localpref: 200\n"
" Router ID: 83.149.11.252\n"
" BGP Preference: 170/-201\n"
" Route Distinguisher: 83.149.11.65:1065\n"
" Next hop type: Indirect\n"
" Address: 0xa68bcec\n"
" Next-hop reference count: 3\n"
" Source: 10.222.253.245\n"
" Protocol next hop: 83.149.11.65\n"
" Push 27775\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <NotBest Int Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Not Best in its group - Interior > Exterior > Exterior via Interior\n"
" Local AS: 31133 Peer AS: 31133\n"
" Age: 12w0d 2:17:42 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_31133.10.222.253.245+???\n"
" AS path: 25159 ?\n"
" Communities: 25159:64666 31133:100 target:64999:1065 \n"
" Accepted\n"
" VPN Label: 27775\n"
" Localpref: 200\n"
" Router ID: 10.222.253.245\n\n"
"83.149.11.66:1065:10.249.28.168/29 (3 entries, 1 announced)\n"
" *BGP Preference: 169/-201\n"
" Route Distinguisher: 83.149.11.66:1065\n"
" Next hop type: Indirect\n"
" Address: 0x9ed8860\n"
" Next-hop reference count: 3\n"
" Source: 83.149.11.251\n"
" Protocol next hop: 83.149.11.66\n"
" Push 27764\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Active Ext ProtectionPath ProtectionCand>\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 28w0d 0:58:34 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.251+???\n"
" Announcement bits (1): 0-BGP_RT_Background \n"
" AS path: 25159 ?\n"
" Communities: 25159:64666 31133:100 target:64999:1065 \n"
" Accepted\n"
" VPN Label: 27764\n"
" Localpref: 200\n"
" Router ID: 83.149.11.251\n"
" BGP Preference: 170/-201\n"
" Route Distinguisher: 83.149.11.66:1065\n"
" Next hop type: Indirect\n"
" Address: 0x9ed8860\n"
" Next-hop reference count: 3\n"
" Source: 83.149.11.252\n"
" Protocol next hop: 83.149.11.66\n"
" Push 27764\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Route Preference\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 28w0d 0:58:49 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.252+???\n"
" AS path: 25159 ?\n"
" Communities: 25159:64666 31133:100 target:64999:1065 \n"
" Accepted\n"
" VPN Label: 27764\n"
" Localpref: 200\n"
" Router ID: 83.149.11.252\n"
" BGP Preference: 170/-201\n"
" Route Distinguisher: 83.149.11.66:1065\n"
" Next hop type: Indirect\n"
" Address: 0x9ed8860\n"
" Next-hop reference count: 3\n"
" Source: 10.222.253.245\n"
" Protocol next hop: 83.149.11.66\n"
" Push 27764\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <NotBest Int Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Not Best in its group - Interior > Exterior > Exterior via Interior\n"
" Local AS: 31133 Peer AS: 31133\n"
" Age: 12w0d 2:17:42 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_31133.10.222.253.245+???\n"
" AS path: 25159 ?\n"
" Communities: 25159:64666 31133:100 target:64999:1065 \n"
" Accepted\n"
" VPN Label: 27764\n"
" Localpref: 200\n"
" Router ID: 10.222.253.245\n\n"
"83.149.11.101:1039:10.249.64.0/18 (3 entries, 1 announced)\n"
" *BGP Preference: 170/-101\n"
" Route Distinguisher: 83.149.11.101:1039\n"
" Next hop type: Indirect\n"
" Address: 0x10fb4d20\n"
" Next-hop reference count: 12\n"
" Source: 83.149.11.252\n"
" Protocol next hop: 83.149.11.101\n"
" Push 63\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Active Ext ProtectionPath ProtectionCand>\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 8w5d 3:07:17 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.252+???\n"
" Announcement bits (1): 0-BGP_RT_Background \n"
" AS path: 25159 64626 ?\n"
" Communities: 31133:100 target:64999:1039 \n"
" Accepted\n"
" VPN Label: 63\n"
" Localpref: 100\n"
" Router ID: 83.149.11.252\n"
" BGP Preference: 170/-101\n"
" Route Distinguisher: 83.149.11.101:1039\n"
" Next hop type: Indirect\n"
" Address: 0x10fb4d20\n"
" Next-hop reference count: 12\n"
" Source: 83.149.11.251\n"
" Protocol next hop: 83.149.11.101\n"
" Push 63\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <NotBest Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Not Best in its group - Active preferred\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 8w5d 3:07:17 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.251+???\n"
" AS path: 25159 64626 ?\n"
" Communities: 31133:100 target:64999:1039 \n"
" Accepted\n"
" VPN Label: 63\n"
" Localpref: 100\n"
" Router ID: 83.149.11.251\n"
" BGP Preference: 170/-101\n"
" Route Distinguisher: 83.149.11.101:1039\n"
" Next hop type: Indirect\n"
" Address: 0x10fb4d20\n"
" Next-hop reference count: 12\n"
" Source: 10.222.253.245\n"
" Protocol next hop: 83.149.11.101\n"
" Push 63\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <NotBest Int Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Not Best in its group - Interior > Exterior > Exterior via Interior\n"
" Local AS: 31133 Peer AS: 31133\n"
" Age: 8w5d 3:07:17 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_31133.10.222.253.245+???\n"
" AS path: 25159 64626 ?\n"
" Communities: 31133:100 target:64999:1039 \n"
" Accepted\n"
" VPN Label: 63\n"
" Localpref: 100\n"
" Router ID: 10.222.253.245\n\n"
"83.149.11.120:196:10.249.109.0/24 (3 entries, 1 announced)\n"
" *BGP Preference: 169/-201\n"
" Route Distinguisher: 83.149.11.120:196\n"
" Next hop type: Indirect\n"
" Address: 0x11399fd4\n"
" Next-hop reference count: 6\n"
" Source: 83.149.11.251\n"
" Protocol next hop: 83.149.11.120\n"
" Push 33\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Active Ext ProtectionPath ProtectionCand>\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 11w2d 1:53:58 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.251+???\n"
" Announcement bits (1): 0-BGP_RT_Background \n"
" AS path: 25159 I\n"
" Communities: 31133:100 target:64999:196 \n"
" Accepted\n"
" VPN Label: 33\n"
" Localpref: 200\n"
" Router ID: 83.149.11.251\n"
" BGP Preference: 170/-201\n"
" Route Distinguisher: 83.149.11.120:196\n"
" Next hop type: Indirect\n"
" Address: 0x11399fd4\n"
" Next-hop reference count: 6\n"
" Source: 83.149.11.252\n"
" Protocol next hop: 83.149.11.120\n"
" Push 33\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <Ext ProtectionPath ProtectionCand>\n"
" Inactive reason: Route Preference\n"
" Local AS: 31133 Peer AS: 25159\n"
" Age: 11w2d 1:53:58 Metric2: 1 \n"
" Validation State: unverified \n"
" Task: BGP_25159.83.149.11.252+???\n"
" AS path: 25159 I\n"
" Communities: 31133:100 target:64999:196 \n"
" Accepted\n"
" VPN Label: 33\n"
" Localpref: 200\n"
" Router ID: 83.149.11.252\n"
" BGP Preference: 170/-201\n"
" Route Distinguisher: 83.149.11.120:196\n"
" Next hop type: Indirect\n"
" Address: 0x11399fd4\n"
" Next-hop reference count: 6\n"
" Source: 10.222.253.245\n"
" Protocol next hop: 83.149.11.120\n"
" Push 33\n"
" Indirect next hop: 0x2 no-forward INH Session ID: 0x0\n"
" State: <NotBest Int Ext ProtectionPath ProtectionCand>\n\n\n\n\n\n\n"
"Disclaimer: All commands will be logged for possible later analysis and statistics. If you don't like this policy, please disconnect now! \n\n\n\n"
" Please email questions or comments to noc@megafon.ru. \n\n")
matches = re.finditer(regex, test_str)
for matchNum, match in enumerate(matches, start=1):
print ("Match {matchNum} was found at {start}-{end}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))
for groupNum in range(0, len(match.groups())):
groupNum = groupNum + 1
print ("Group {groupNum} found at {start}-{end}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum)))
# Note: for Python 2.7 compatibility, use ur"" to prefix the regex and u"" to prefix the test string and substitution.
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Python, please visit: https://docs.python.org/3/library/re.html