How to use the pybatfish.question.bfq.ipOwners function in pybatfish

To help you get started, we’ve selected a few pybatfish examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github networkop / arista-network-ci / tests / batfish / leaf-3.py View on Github external
def test_dataplane(isFailed, fromNode, checkMultipath=True):
    ips = bfq.ipOwners().answer().frame()
    loopbacks = ips[(ips['Interface'] == 'Loopback0') & (ips['Active'])]

    localIP = loopbacks[loopbacks['Node'] == fromNode]['IP'][0]
    leaves = set(loopbacks[loopbacks['Node'].str.contains('leaf')]['IP'])
    leaves.remove(localIP)
    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: