No project description provided
Project description
README
This repository contains a wrapper around Panorama/PaloAlto API.
It also provides a cli tool panorama_api
CLI
This package also provide a CLI tool for some operations:
- Generating an API Key
- Upgrading a group of devices
- Generating a boilerplate configuration file for the upgrades
pip install nagra_panorama_api
panorama_api --help
Why the need for this library ?
For simple resource retrieval, the existing API is enough, but:
- The libraries available are not practical for it, the manual management of urls is easier
- For more complex operation, this does not suits well
The official python SDK of PaloAltoNetworks itself relies on a third party wrapper for their API.
This library takes a more popular approach when wrapping the API, making it easier to use. It also provides types' wrappers to simplify their usage or utility functions to re-structure the data we receive. It provides a client for the REST API and for the XML API
- A simple client for the API
- Tool to manage the xml configuration
Library Usage Example
client = XMLApi(HOST, API_KEY)
tree = client.get_tree()
# Find your object using its name (may not be unique)
my_object = config.find_by_name("my_object_name")[0]
print(my_object) # /address/entry[@name='my_object_name']
# Find the references to it (0 or multiple results are possible)
ref = my_object.get_references()[0]
print(ref) # /post-rulebase/security/rules/entry[@uuid='...']/destination/member
# We must not delete the <member> tag, but we can delete its parent
client.delete(ref.parent.xpath)
# Now we must commit the changes
client.commit_changes()
# We can also revert it
# client.revert_changes()
The library currently doesn't provide helper tools to know how to edit the configuration. Theses changes must be done manually
TODO
-
Provide wrapper classes for the resources.
nat = NatPolicy(...) tree.insert(nat) # or nat.insertInto(tree) client.create(nat.insert_xpath, nat.xml)
-
Mix Rest API and XML API ?
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for nagra_panorama_api-0.1.18.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 557ab9cba833145fac8d7e10da9bc21ccdc2ff2b4e22b566627dbd989ed8e68a |
|
MD5 | 9bfa9a94fb67f238bd11af67666eab0f |
|
BLAKE2b-256 | 103f18a476ebc4477afeaf1dbceddc5e9ecf49319e2d3010d15cd028014612a3 |
Hashes for nagra_panorama_api-0.1.18-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cbed5bd4c3141877feee4ed52c02b5c9448aef32d9c65ade3d28ba535c2f4df5 |
|
MD5 | 35cf1ce899637a633723d6155dc8457c |
|
BLAKE2b-256 | b5df1bac9bf0ce13eb5d9df0e5f913b93e6fb13119a022cb8b54c3f3f75ce06d |