Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PaloAlto - parsing error when using address object as routing peer or nexthop #8934

Open
hochkurz opened this issue Jan 23, 2024 · 1 comment
Labels
starter Issues suitable for brand new contributors

Comments

@hochkurz
Copy link

When using an address object as BGP peer-address (line 2 of the sample configuration) or static-route nexthop (line 4), batfish throws a parsing error.
This syntax is valid on a PaloAlto box running PAN-OS 10.2 version.

Runnable example

from pybatfish.client.session import Session
TXT = """
set deviceconfig system hostname FW1
set network virtual-router VR1 protocol bgp peer-group PG1 peer PEER peer-address ip PEER-OBJECT
set network virtual-router VR1 protocol bgp peer-group PG1 peer PEER peer-address ip 10.10.10.10
set network virtual-router VR1 routing-table ip static-route ROUTE-NAME nexthop ip-address PEER-OBJECT
set address PEER-OBJECT ip-netmask 10.10.10.10
"""

bf = Session()
bf.set_network("github-bug-report")
bf.init_snapshot_from_text(TXT)
# Verify that Batfish recognized the vendor format correctly
print(bf.q.fileParseStatus().answer())
# Insert command(s) below to demonstrate the problem
print(bf.q.initIssues().answer())
print(bf.q.parseWarning().answer())

When replacing the address object (PEER-OBJECT in the sample configuration) by its IP address the line is parsed without error (see line 3).
I also tried to raise the address object definition (line 5) before the routing configuration without success.

@dhalperi
Copy link
Member

dhalperi commented Jan 23, 2024

Thanks! This makes a lot of sense -- we have already added this support for Interface IP addresses, just never for static routes. The solution here is to port the logic from this PR: #5941 , specifically changing to use something like ip_address_or_reference for this property:

snil_ip
:
-    IP address = interface_address
+    IP address = interface_address_or_reference
;

Probably have to add a new parser data rule, since this one allows a prefix too.

This is a great starter task for a new Batfish contributor!

@dhalperi dhalperi added the starter Issues suitable for brand new contributors label Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
starter Issues suitable for brand new contributors
Projects
None yet
Development

No branches or pull requests

2 participants