The PAN-OS SDK for Python is a package to help interact with Palo Alto Networks devices (including physical and virtualized Next-generation Firewalls and Panorama). The pan-os-python SDK is object oriented and mimics the traditional interaction with the device via the GUI or CLI/API.
Assuming my response is held in respRHC:
respRHC.attrib should return { 'status': 'success', 'code': '19'}
respRHC.keys() should return ['status', 'code']
respRHC.attrib['code'] should return '19'
pan_obj.xapi.status_code should return '19'
Current behavior
Only 'status' is returned and in my use case, the status is always 'success' even if I provide a rule name that does not exist. However, the code does change to indicate the rule does not exist.
Possible solution
It appears that xapi is setup to capture the code but for some reason, it is not in my use case. I'm no code ninja so I can't figure out why. Hence the bug.
Steps to reproduce
cURL (and same for GUI):
> curl -k -X GET "https://<panorama>>/api/?type=config&action=get&xpath=/config/devices/entry\[@name='localhost.localdomain'\]/device-group/entry\[@name='MyDeviceGroup'\]/pre-rulebase/security/rules/entry\[@name='MyRuleName'\]&key=<api_key>>"
I was intending to look at the code to determine if a non-existent rule name was used which returns a 'code': '7' rather than '19'. In both cases, the 'status' returns 'success' so it is of no use.
Your Environment
Version used:
pan-os-python 1.0.0 and 1.0.2
Environment name and version (e.g. Chrome 59, node.js 5.4, python 3.7.3):
Python 3.8.3
IDLE 3.8.3
VS Code 1.50.1
Panorama PAN-OS 8.1.15
Operating System and version (desktop or mobile):
Microsoft Windows [Version 10.0.17763.1457]
Describe the bug
When pulling the rule hit count, the response attribute 'code' is not returned. Using 'op' with cmd=' '
Expected behavior
cURL response is as follows:
Assuming my response is held in respRHC: respRHC.attrib should return { 'status': 'success', 'code': '19'} respRHC.keys() should return ['status', 'code'] respRHC.attrib['code'] should return '19' pan_obj.xapi.status_code should return '19'
Current behavior
Only 'status' is returned and in my use case, the status is always 'success' even if I provide a rule name that does not exist. However, the code does change to indicate the rule does not exist.
Possible solution
It appears that xapi is setup to capture the code but for some reason, it is not in my use case. I'm no code ninja so I can't figure out why. Hence the bug.
Steps to reproduce
cURL (and same for GUI):
IDLE (Python 3.8.3 Shell):
Screenshots
Context
I was intending to look at the code to determine if a non-existent rule name was used which returns a 'code': '7' rather than '19'. In both cases, the 'status' returns 'success' so it is of no use.
Your Environment
Version used: pan-os-python 1.0.0 and 1.0.2
Environment name and version (e.g. Chrome 59, node.js 5.4, python 3.7.3): Python 3.8.3 IDLE 3.8.3 VS Code 1.50.1 Panorama PAN-OS 8.1.15
Operating System and version (desktop or mobile): Microsoft Windows [Version 10.0.17763.1457]
Link to your project: n/a