-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpath-show.py
More file actions
29 lines (26 loc) · 1.13 KB
/
Copy pathpath-show.py
File metadata and controls
29 lines (26 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#
# Show any paths that match those found in the "paths.csv" file
#
import csv
from api_fns import *
with open('paths.csv', mode='r') as csv_file:
csv_reader = csv.DictReader(csv_file)
for row in csv_reader:
# pp_json(row)
r1 = get_network_path(row['org_id'])
if r1.status_code == requests.codes.ok:
for network_path in r1.json():
if (network_path['sourceAppliance'] == row['source_mp']
and network_path['target'] == row['target']):
print('Match: org/src/targ {}/{}/{} -> id/name {}/{}'
.format(row['org_id'],
network_path['sourceAppliance'],
network_path['target'],
network_path['id'],
network_path['pathName']))
print(' Target located in: {}.'.format(
network_path['targetLocation']
['formattedAddress']))
# pp_json(network_path)
else:
print_err(r1)