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

update validation for Simplified Software Upgrade #599

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

mksbcisco
Copy link

@mksbcisco mksbcisco commented Feb 11, 2025

validate direct upgrades from 10.1.x or 10.2.x to 11.1.x version.

Description

As part of Simplified Software Upgrade feature (https://docs.paloaltonetworks.com/pan-os/10-2/pan-os-new-features/management-features/simplified-software-upgrade) where we can upgrade PAN-OS from ver 10.1.x/10.2.x directly to 11.1.x (provided we have base software 11.1.0 downloaded), same feature from Ansible can now be used

Motivation and Context

This problem solves indirect multi-path upgrade
i.e 10.1.8 -> 11.0.0 -> 11.1.0 -> 11.1.x version to be upgraded in a single path upgrade to 10.1.8 -> 11.1.x

Also, a reported bug #553

How Has This Been Tested?

I have tested the function using my use-case of current version as 10.1.12 and target version of 11.1.6
The actual PANOS has been tested for upgrade and the same was successful without any issue

def is_valid_sequence(current, target):
    current_major = int(current.split('.')[0])
    target_major = int(target.split('.')[0])
    current_minor = int(current.split('.')[1])
    target_minor = int(target.split('.')[1])
    # Patch version change (major and minor versions match)
    if (current_major == target_major) and (current_minor == target_minor):
        print(1)
        return True

    # Upgrade minor version (9.0.0 -> 9.1.0)
    elif (current_major == target_major) and (current_minor + 1 == target_minor):
        print(2)
        return True

    # Upgrade major version (9.1.0 -> 10.0.0)
    elif (current_major + 1 == target_major) and (target_minor == 0):
        print(3)
        return True

    elif ((current_major == 10) and (current_minor == 1 or current_minor == 2)) and (target_major == 11 and target_minor == 1):
          print(3.5)
          return True

    # Downgrade minor version (9.1.0 -> 9.0.0)
    elif (current_major == target_major) and (current_minor - 1 == target_minor):
        print(4)
        return True

    # Downgrade major version (10.0.3 -> 9.1.6)
    elif current_major - 1 == target_major:
        print(5)
        return True

    else:
        return False

print(is_valid_sequence('10.1.12', '11.1.6'))

Screenshots (if appropriate)

Screenshot 2025-02-10 at 22 04 36 Screenshot 2025-02-10 at 22 03 55

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.

validate direct upgrades from 10.1.x or 10.2.x to 11.1.x version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant