batfish / pybatfish

Python client for Batfish: https://github.com/batfish/batfish
Apache License 2.0
208 stars 51 forks source link

Cloud network example - multiple Instances #886

Closed pomint closed 1 year ago

pomint commented 1 year ago

Hi, Can you provide a example for cloud network with multiple instances with both public and private in a subnet? The example provided in the notebook only shows an instance in the subnet, making it confusing on how the infromation should be written when setting up the script to analyse the network. Thanks

ratulm commented 1 year ago

The example network used in the notebook has multiple instances. See https://github.com/batfish/pybatfish/blob/master/jupyter_notebooks/networks/hybrid-cloud/aws_configs/us-west-2/Reservations.json.

What exactly is unclear?

pomint commented 1 year ago

So, I have the following network: Instances A, B and C have only private IP Instances D, E and F have both Private and public IPs

how should i put the instances in the following lines:

hosts = {}
hosts["east2_private"] = "i-04cd3db5124a05ee6"
hosts["east2_public"] = "i-01602d9efaed4409a"

public_ips = {}
public_ips["east2_public"] = "13.59.144.125" # of i-01602d9efaed4409a

This part here doesn't seem like it can take in muliple instances

ans = bf.q.traceroute(startLocation=hosts["east2_private"],
                     headers=HeaderConstraints(dstIps=hosts["east2_public"],
                                               applications="ssh")).answer()
show_first_trace(ans.frame())
ratulm commented 1 year ago

If you follow the documentation for traceroute and what the type of startLocation is, you will end up here: https://pybatfish.readthedocs.io/en/latest/specifiers.html#location-specifier. You'll see that startLocation is a location-specifier and one of the things that it can take is a list of starting points. Similarly other parameters take multiple inputs as well.

I am closing this issue. If you still have questions, please use Slack, a better medium for such questions. https://join.slack.com/t/batfish-org/shared_invite/enQtMzA0Nzg2OTAzNzQ1LTcyYzY3M2Q0NWUyYTRhYjdlM2IzYzRhZGU1NWFlNGU2MzlhNDY3OTJmMDIyMjQzYmRlNjhkMTRjNWIwNTUwNTQ