PaloAltoNetworks / PaloAltoNetworks/pan-os-python

Can't seem to be able to select a vsys as a rule target

Open
#273 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
400
Forks
199
PR merge metrics
No merged PRs in 30d

Description

Describe the bug

It seems to be impossible to select a vsys as a rule target when creating a new rule, maybe related to #199

Steps to reproduce

from panos import panorama, policies

p = panorama.Panorama(IP, USER, PASSWORD)
devices_groups = p.refresh_devices()
device_group = next(d for d in devices_groups if d.name == REQUIRED_DEVICE_GROUP)
pre_rulebase = policies.PreRulebase()
device_group.add(pre_rulebase)
new_rule = panorama.policies.SecurityRule(target=['001801005535/vsys2'],
                                          source=['1.1.1.1'],
                                          destination=['2.2.2.2'],
                                          service=['http'],
                                          action='allow',
                                          name='new rule 1')
pre_rulebase.add(new_rule)
new_rule.create()
p.commit(sync=True)

Results in

panos.errors.PanDeviceXapiError:  new rule 1 -> target -> devices -> 001801005535/vsys2 '001801005535/vsys2' is invalid
new rule 1 -> target -> devices is invalid

Environment

panos 1.0.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the panorama.policies.SecurityRule entry point and reproduce the failure using the provided vsys target example. Trace how the target value is validated during new-rule creation, then verify that a valid vsys target is accepted without the PanDeviceXapiError and add or run a regression test if the project provides one.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.