batfish / batfish

Batfish is a network configuration analysis tool that can find bugs and guarantee the correctness of (planned or current) network configurations. It enables network engineers to rapidly and safely evolve their network, without fear of outages or security breaches.

Home Page:http://www.batfish.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

filtering with internet community

rsingha108 opened this issue · comments

Describe the bug and expected behavior
I am trying to test some route-maps using the "Analyzing Routing Policies" Notebook. If we use the internet community to filter a route, it doesn't match with the community 0:0 of the route. But other BGP implementations like FRR and Quagga recognize the well-known communities like internet (0:0) and filtering can be done based on it.

Runnable example

Configuration file in networks/route-analysis/configs/border3.cfg

!
hostname border3
!
ip community-list 100 permit internet
!
route-map Rmap permit 10
	match community 100
!
end

python code in notebooks/Analyzing Routing Policies

%run startup.py
from pybatfish.datamodel.route import BgpRouteConstraints
bf = Session(host="localhost")

# Initialize a network and snapshot
NETWORK_NAME = "example_network"
SNAPSHOT_NAME = "example_snapshot"

SNAPSHOT_PATH = "networks/route-analysis"

bf.set_network(NETWORK_NAME)
bf.init_snapshot(SNAPSHOT_PATH, name=SNAPSHOT_NAME, overwrite=True)

# Create an example route to use for testing
inRoute1 = BgpRoute(network="10.0.0.0/24", 
                    originatorIp="4.4.4.4", 
                    originType="egp", 
                    protocol="bgp",
                    communities=["0:0"])

# Test how our policy treats this route
result = bf.q.testRoutePolicies(policies="Rmap", 
                             direction="in", 
                             inputRoutes=[inRoute1]).answer().frame()
# Pretty print the result
show(result)

Additional context
The expected output is PERMIT but the output is DENY. Also if we use "internet" as a community in the route, the notebooks times out.

Hi @rsingha108 -- the example you gave it not exercising FRR, it's trying to be Cisco IOS. See the fileParseStatus question output in the attached notebook. Can you make sure this is being recognized as FRR (aka, Cumulus in Batfish) by the system? https://pybatfish.readthedocs.io/en/latest/formats.html#cumulus-configuration-files-recommended