Skip to content

Commit

Permalink
fix: Failing snapshots of FWs with no BGP peers (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
acelebanski authored Apr 15, 2024
1 parent 76b2880 commit 035aa99
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions panos_upgrade_assurance/firewall_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,10 @@ def get_bgp_peers(self) -> dict:
response = self.op_parser(cmd="show routing protocol bgp peer")

result = {}

if response is None:
return result

if "entry" in response:
bgp_peers = response["entry"]
for peer in bgp_peers if isinstance(bgp_peers, list) else [bgp_peers]:
Expand Down
11 changes: 11 additions & 0 deletions tests/test_firewall_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,17 @@ def test_get_bgp_peers(self, fw_proxy_mock):
}
}

def test_get_bgp_peers_no_peers(self, fw_proxy_mock):
xml_text = """
<response status="success">
<result/>
</response>
"""
raw_response = ET.fromstring(xml_text)
fw_proxy_mock.op.return_value = raw_response

assert fw_proxy_mock.get_bgp_peers() == {}

def test_get_arp_table(self, fw_proxy_mock):
xml_text = """
<response status="success">
Expand Down

0 comments on commit 035aa99

Please sign in to comment.