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

add optional timeout for userid register() #377

Merged
merged 19 commits into from
Nov 17, 2021

Conversation

devsecfranklin
Copy link
Contributor

@devsecfranklin devsecfranklin commented Oct 22, 2021

Description

Ben Parker 2:39 PM

So this call should actaully support another argument https://pan-os-python.readthedocs.io/en/latest/module-userid.html#panos.userid.UserId.audit_registered_ip

the timeout like argument like https://pan-os-python.readthedocs.io/en/latest/module-userid.html#panos.userid.UserId.audit_registered_ip

Ben Parker 2:40 PM
Here is what the whole API call looks like

https://{{host}}/api?key={{key}}&type=user-id&cmd=<uid-message><version>2.0</version><type>update</type><payload><register><entry ip="{{tagged-ip}}"><tag><member timeout="60">{{tag}}</member></tag></entry></register></payload></uid-message>

Motivation and Context

Need update to XML API call

How Has This Been Tested?

New unit test cases included

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes if appropriate.
  • All new and existing tests passed.

@welcome-to-palo-alto-networks

🎉 Thanks for opening this pull request! We really appreciate contributors like you! 🙌

@bparker-sec
Copy link

Test the following commands on the FW and here was the resulting API from DEBUG mode.

my_fw.userid.batch_start()
my_fw.userid.register("1.1.1.1","tag123","120")
my_fw.userid.register("1.1.1.2","tag123","60")
my_fw.userid.register("1.1.1.3", "tag123")
my_fw.userid.register("2.2.2.2","tag456","60")
my_fw.userid.batch_end()

[2021/11/03 00:37:47] user=772142#####
XML Api Request
1.0updatetag123tag123tag123tag456 ]]>

[2021/11/03 00:37:48] user=77214######
XML Api Request End

panos/userid.py Outdated Show resolved Hide resolved
@devsecfranklin
Copy link
Contributor Author

devsecfranklin commented Nov 10, 2021

Update after testing with three scenarios:

  1. Test with a non-zero/valid timeout.
  2. Test with timeout set to 0.
  3. Test with no timeout value provided.
2021/11/10 11:11:12 vsys1 

1.2.3.4 timeout_1hour 3600 register XMLAPI xml-api 

2021/11/10 11:11:12 vsys1 

1.1.1.3 timeout_set_to_0 0 register XMLAPI xml-api 

2021/11/10 11:11:12 vsys1 

1.1.1.4 timeout_not_set 0 register XMLAPI xml-api 

Copy link
Collaborator

@shinmog shinmog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The various timeout params are just strings. So please change the docstrings to just be timeout (string):.

panos/userid.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@shinmog shinmog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CI is still complaining about the docs build also, which is weird...?

panos/userid.py Outdated Show resolved Hide resolved
panos/userid.py Outdated Show resolved Hide resolved
@devsecfranklin
Copy link
Contributor Author

There are two more instances where I see timeout/minutes but they are not from my change. Shall I update those as well? @shinmog

Copy link
Collaborator

@shinmog shinmog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@shinmog shinmog merged commit e5c3b64 into PaloAltoNetworks:develop Nov 17, 2021
@welcome-to-palo-alto-networks

🎉 Congrats on getting your first pull request merged! We here at Palo Alto Networks are so grateful! ❤️

github-actions bot pushed a commit that referenced this pull request Nov 17, 2021
## [1.6.0](v1.5.1...v1.6.0) (2021-11-17)

### Features

* Add `device.SslDecrypt` ([#375](#375)) ([1361f93](1361f93))
* Add device.CertificateProfileCaCertificate ([afd6b8b](afd6b8b))
* Add optional timeout for userid register() ([#377](#377)) ([e5c3b64](e5c3b64))
* Add policies.DecryptionRule ([#371](#371)) ([0a69264](0a69264))
* Adding device.CertificateProfile ([55159e9](55159e9))

### Bug Fixes

* Correct vartype of DecryptionRule.services ([e708dde](e708dde))
* DecryptionRule.decryption_type paths ([4897fc4](4897fc4))
@github-actions
Copy link

🎉 This PR is included in version 1.6.0 🎉

The release is available on PyPI and GitHub release

Posted by semantic-release bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants