diff --git a/panos_upgrade_assurance/firewall_proxy.py b/panos_upgrade_assurance/firewall_proxy.py
index 24fea21..483cd57 100644
--- a/panos_upgrade_assurance/firewall_proxy.py
+++ b/panos_upgrade_assurance/firewall_proxy.py
@@ -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]:
diff --git a/tests/test_firewall_proxy.py b/tests/test_firewall_proxy.py
index 4b5c4aa..0bd51a4 100644
--- a/tests/test_firewall_proxy.py
+++ b/tests/test_firewall_proxy.py
@@ -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 = """
+
+
+
+ """
+ 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 = """