cdot65 / pan-os-upgrade

An efficient tool to execute configuration backups, network state snapshots, system readiness checks, and operating system upgrades of Palo Alto Networks firewalls and Panorama appliances.
https://cdot65.github.io/pan-os-upgrade/
Apache License 2.0
39 stars 7 forks source link

Implement support for user-defined "show" and "request" commands #129

Open cdot65 opened 4 months ago

cdot65 commented 4 months ago

Is your feature request related to a problem? Please describe. When upgrading PAN-OS on firewalls using the pan-os-upgrade utility, users may have specific requirements or custom checks they want to perform before and after the upgrade. These checks often involve running "show" and "request" commands to capture outputs from the devices. Currently, the utility has a predefined set of commands and models the response output using pedantic models. However, this approach does not provide the flexibility for users to pass their own ad-hoc commands and capture the outputs for their specific needs.

Describe the solution you'd like Enhance the pan-os-upgrade utility to support the ability for users to pass their own "show" and "request" commands and capture the outputs from the devices before and after an upgrade. The utility should:

  1. Modify the existing settings command or introduce a new configuration option to allow users to specify a list of custom "show" and "request" commands they want to execute.
  2. Parse the user-provided commands and validate their syntax to ensure they are valid PAN-OS commands.
  3. Before initiating the upgrade process, execute the user-defined "show" and "request" commands on the firewall and capture the outputs.
  4. Store the captured outputs in a structured format (e.g., JSON or XML) along with metadata such as the command, timestamp, and device information.
  5. Proceed with the normal upgrade process.
  6. After the upgrade is completed and the firewall is back online, execute the same set of user-defined commands again and capture the outputs.
  7. Store the post-upgrade outputs in a similar structured format as the pre-upgrade outputs.
  8. Provide a mechanism for users to easily retrieve and compare the pre-upgrade and post-upgrade outputs, either through a command-line interface or by generating a report.

Describe alternatives you've considered An alternative approach could be to allow users to provide a script or a set of commands in a separate file, which the utility would execute before and after the upgrade. However, this might require additional file handling and security considerations, and it may not integrate seamlessly with the existing configuration and settings management of the utility.

Additional context Here are a few additional points to consider:

By implementing this feature, the pan-os-upgrade utility will offer greater flexibility and customization options for users, allowing them to perform specific checks and capture relevant outputs before and after an upgrade. This will enable users to tailor the upgrade process to their unique requirements and gain deeper insights into the behavior and state of their firewalls during the upgrade cycle.