Skip to content

Commit

Permalink
chore: Trigger a new release (#562)
Browse files Browse the repository at this point in the history
  • Loading branch information
acelebanski authored Apr 17, 2024
2 parents 8898abd + 8e6e250 commit 468dd8f
Show file tree
Hide file tree
Showing 10 changed files with 296 additions and 14 deletions.
12 changes: 10 additions & 2 deletions plugins/modules/panos_active_in_ha.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
requirements:
- pan-python can be obtained from PyPI U(https://pypi.python.org/pypi/pan-python)
- pandevice can be obtained from PyPI U(https://pypi.python.org/pypi/pandevice)
- pan-os-upgrade-assurance can be obtained from PyPI U(https://pypi.org/project/panos-upgrade-assurance)
- panos-upgrade-assurance can be obtained from PyPI U(https://pypi.org/project/panos-upgrade-assurance)
notes:
- Panorama is not supported.
- Check mode is not supported.
Expand All @@ -53,6 +53,12 @@
node's current state in an HA pair. Can be useful when working with partially upgraded nodes. Use with caution.
type: bool
default: false
ignore_non_functional:
description:
- Use with caution, when set to `True` will ignore if device state is `non-functional` on one of the nodes. Helpful
when verifying a state of a partially upgraded HA pair with vmseries plugin version mismatch.
type: bool
default: false
# """

EXAMPLES = """
Expand Down Expand Up @@ -112,6 +118,7 @@ def main():
argument_spec=dict(
force_fail=dict(type="bool", default=False),
skip_config_sync=dict(type="bool", default=False),
ignore_non_functional=dict(type="bool", default=False),
),
panorama_error="This is a firewall only module",
)
Expand All @@ -123,7 +130,8 @@ def main():
firewall = FirewallProxy(firewall=helper.get_pandevice_parent(module))

is_active = CheckFirewall(firewall).check_is_ha_active(
skip_config_sync=module.params["skip_config_sync"]
skip_config_sync=module.params["skip_config_sync"],
ignore_non_functional=module.params["ignore_non_functional"],
)

if module.params["force_fail"]:
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/panos_custom_url_category.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
options:
name:
description:
- Name of the tag.
- Name of the url category.
type: str
description:
description:
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/panos_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ def populate_facts(self):
}
)

self.facts.update({"virtual-systems": virtual_systems})
self.facts.update({"virtual_systems": virtual_systems})


class Config(Factbase):
Expand Down
39 changes: 36 additions & 3 deletions plugins/modules/panos_l2_subinterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
description:
- Name of the interface to configure.
type: str
parent_interface:
description:
- Name of the parent interface
type: str
tag:
description:
- Tag (vlan id) for the interface
Expand Down Expand Up @@ -103,8 +107,31 @@

class Helper(ConnectionHelper):
def initial_handling(self, module):
if "." not in module.params["name"]:
module.fail_json(msg='interface name does not have "." in it')
# Sanity check.
name_set = True if module.params["name"] is not None else False
parent_set = True if module.params["parent_interface"] is not None else False

if module.params["state"] == "gathered" and not parent_set:
module.fail_json(
msg="'parent_interface' is required when state is 'gathered'."
)

if name_set:
if "." not in module.params["name"]:
module.fail_json(
msg="Subinterface name does not have '.' in it: {0}".format(
module.params["name"]
)
)
if (
parent_set
and module.params["parent_interface"] not in module.params["name"]
):
module.fail_json(
msg="Parent and subinterface names do not match: {0} - {1}".format(
module.params["parent_interface"], module.params["name"]
)
)

if module.params["state"] not in ("present", "replaced"):
return
Expand All @@ -113,7 +140,10 @@ def initial_handling(self, module):
module.params["vsys"] = "vsys1"

def parent_handling(self, parent, module):
iname = module.params["name"].split(".")[0]
if module.params["parent_interface"] is not None:
iname = module.params["parent_interface"]
else:
iname = module.params["name"].split(".")[0]

if iname.startswith("ae"):
eth = to_sdk_cls("network", "AggregateInterface")(iname)
Expand Down Expand Up @@ -147,6 +177,9 @@ def main():
netflow_profile=dict(sdk_param="netflow_profile_l2"),
comment=dict(),
),
extra_params=dict(
parent_interface=dict(type="str"),
),
)

module = AnsibleModule(
Expand Down
39 changes: 35 additions & 4 deletions plugins/modules/panos_l3_subinterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
description:
- Name of the interface to configure.
type: str
parent_interface:
description:
- Name of the parent interface
type: str
tag:
description:
- Tag (vlan id) for the interface
Expand Down Expand Up @@ -151,8 +155,30 @@
class Helper(ConnectionHelper):
def initial_handling(self, module):
# Sanity check.
if "." not in module.params["name"]:
module.fail_json(msg='Interface name does not have "." in it')
name_set = True if module.params["name"] is not None else False
parent_set = True if module.params["parent_interface"] is not None else False

if module.params["state"] == "gathered" and not parent_set:
module.fail_json(
msg="'parent_interface' is required when state is 'gathered'."
)

if name_set:
if "." not in module.params["name"]:
module.fail_json(
msg="Subinterface name does not have '.' in it: {0}".format(
module.params["name"]
)
)
if (
parent_set
and module.params["parent_interface"] not in module.params["name"]
):
module.fail_json(
msg="Parent and subinterface names do not match: {0} - {1}".format(
module.params["parent_interface"], module.params["name"]
)
)

if module.params["state"] not in ("present", "replaced"):
return
Expand All @@ -161,9 +187,11 @@ def initial_handling(self, module):
module.params["vsys"] = "vsys1"

def parent_handling(self, parent, module):
iname = module.params["name"].split(".")[0]
if module.params["parent_interface"] is not None:
iname = module.params["parent_interface"]
else:
iname = module.params["name"].split(".")[0]

eth = None
if iname.startswith("ae"):
eth = to_sdk_cls("network", "AggregateInterface")(iname)
else:
Expand Down Expand Up @@ -215,6 +243,9 @@ def main():
),
dhcp_default_route_metric=dict(type="int"),
),
extra_params=dict(
parent_interface=dict(type="str"),
),
)

module = AnsibleModule(
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/panos_readiness_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
requirements:
- pan-python can be obtained from PyPI U(https://pypi.python.org/pypi/pan-python)
- pandevice can be obtained from PyPI U(https://pypi.python.org/pypi/pandevice)
- pan-os-upgrade-assurance can be obtained from PyPI U(https://pypi.org/project/panos-upgrade-assurance)
- panos-upgrade-assurance can be obtained from PyPI U(https://pypi.org/project/panos-upgrade-assurance)
notes:
- Panorama is not supported.
- Check mode is not supported.
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/panos_snapshot_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
requirements:
- pan-python can be obtained from PyPI U(https://pypi.python.org/pypi/pan-python)
- pandevice can be obtained from PyPI U(https://pypi.python.org/pypi/pandevice)
- pan-os-upgrade-assurance can be obtained from PyPI U(https://pypi.python.org/pypi/pan-os-upgrade-assurance)
- panos-upgrade-assurance can be obtained from PyPI U(https://pypi.python.org/pypi/panos-upgrade-assurance)
notes:
- This is an offline module, no device connection is made.
- Check mode is not supported.
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/panos_state_snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
requirements:
- pan-python can be obtained from PyPI U(https://pypi.python.org/pypi/pan-python)
- pandevice can be obtained from PyPI U(https://pypi.python.org/pypi/pandevice)
- pan-os-upgrade-assurance can be obtained from PyPI U(https://pypi.python.org/pypi/pan-os-upgrade-assurance)
- panos-upgrade-assurance can be obtained from PyPI U(https://pypi.python.org/pypi/panos-upgrade-assurance)
notes:
- Panorama is not supported.
- Check mode is not supported.
Expand Down
105 changes: 105 additions & 0 deletions tests/integration/firewall/test_panos_l2_subinterface.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
---
- name: test_panos_l2_subinterface - Create
paloaltonetworks.panos.panos_l2_subinterface:
provider: '{{ device }}'
name: 'ethernet1/1.1'
tag: 2
register: result

- name: test_panos_l2_subinterface - Assert create was successful
assert:
that:
- result is success
- result is changed

- name: test_panos_l2_subinterface - Create (idempotence)
paloaltonetworks.panos.panos_l2_subinterface:
provider: '{{ device }}'
name: 'ethernet1/1.1'
tag: 2
register: result

- name: test_panos_l2_subinterface - Assert create (idempotence) was successful
assert:
that:
- result is success
- result is not changed

- name: test_panos_l2_subinterface - Modify
paloaltonetworks.panos.panos_l2_subinterface:
provider: '{{ device }}'
name: 'ethernet1/1.1'
tag: 1
register: result

- name: test_panos_l2_subinterface - Assert modify was successful
assert:
that:
- result is success
- result is changed

- name: test_panos_l2_subinterface - Gather all
paloaltonetworks.panos.panos_l2_subinterface:
provider: '{{ device }}'
parent_interface: 'ethernet1/1'
state: 'gathered'
gathered_filter: '*'
register: result

- name: test_panos_l2_subinterface - Assert gather all returned result
assert:
that:
- result is success
- "{{ result.gathered | length == 1 }}"

- name: test_panos_l2_subinterface - Gather by parameter with one match
paloaltonetworks.panos.panos_l2_subinterface:
provider: '{{ device }}'
parent_interface: 'ethernet1/1'
state: 'gathered'
gathered_filter: 'name ends-with 1'
register: result

- name: test_panos_l2_subinterface - Assert gather by parameter with one match returned result
assert:
that:
- result is success
- "{{ result.gathered | length == 1 }}"

- name: test_panos_l2_subinterface - Gather by parameter with no match
paloaltonetworks.panos.panos_l2_subinterface:
provider: '{{ device }}'
parent_interface: 'ethernet1/1'
state: 'gathered'
gathered_filter: 'name ends-with 2'
register: result

- name: test_panos_l2_subinterface - Assert gather by parameter with no match returned result
assert:
that:
- result is success
- "{{ result.gathered | length == 0 }}"

- name: test_panos_l2_subinterface - Delete
paloaltonetworks.panos.panos_l2_subinterface:
provider: '{{ device }}'
name: 'ethernet1/1.1'
tag: 2
state: 'absent'
register: result

- name: test_panos_l2_subinterface - Assert delete was successful
assert:
that:
- result is success
- result is changed

- name: test_panos_l2_subinterface - Make sure changes commit cleanly
paloaltonetworks.panos.panos_commit_firewall:
provider: '{{ device }}'
register: result

- name: test_panos_l2_subinterface - Assert commit was successful
assert:
that:
- result is success
Loading

0 comments on commit 468dd8f

Please sign in to comment.