Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
spines = set(loopbacks[loopbacks['Node'].str.contains('spine')]['IP'])
mpath = len(spines)
logging.info("Progress: Analyzing traceroute from Leaf-3 to Leaf-1 and Leaf-2")
# Set up the resulting data structure
troute = dict()
for leaf in leaves:
troute[leaf] = dict()
# Build headers for traceroute flows
for leaf in leaves:
troute[leaf]['header'] = header(srcIps=localIP,dstIps=leaf)
# Ask questions about traceroute
for leaf,data in troute.items():
troute[leaf]['trace'] = bfq.traceroute(startLocation=fromNode, headers=data['header']).answer()
# Get first flow disposition for traces
for leaf,data in troute.items():
troute[leaf]['result'] = data['trace'].get('answerElements')[0]['rows'][0]['Traces'][0]['disposition']
# Get traceroute paths to reach Leaf-1 and Leaf-2
for leaf,data in troute.items():
troute[leaf]['paths'] = data['trace'].get('answerElements')[0]['rows'][0]['Traces']
# Get traceroute hops to reach Leaf-1 and Leaf-2
for leaf,data in troute.items():
troute[leaf]['hops'] = data['trace'].get('answerElements')[0]['rows'][0]['Traces'][0].get('hops',[])
# Now let's check that the traceroute behaves as we expect
for leaf, data in troute.items():
if data['result'] != 'ACCEPTED':