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

Feature/interfaces assignments #85

Merged
merged 82 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
f0b35b5
first draft of converge file
KiLLuuuhh Mar 28, 2024
7cac28c
first draft of the molecule file
KiLLuuuhh Mar 28, 2024
88685fc
fixed typo
KiLLuuuhh Mar 28, 2024
bf6f8aa
fixed module naming
KiLLuuuhh Mar 28, 2024
8d32d12
first draft of the utils
KiLLuuuhh Mar 28, 2024
a4a824d
added first draft of plugins/module_utils/interfaces_assignments_util…
KiLLuuuhh Mar 28, 2024
7cd0f94
added first draft of plugins/modules/interfaces_assignments.py
KiLLuuuhh Mar 28, 2024
e31c4e8
added first draft of plugins/module_utils/module_index.py
KiLLuuuhh Mar 28, 2024
130b4fe
added missing function
KiLLuuuhh Apr 2, 2024
9023a38
updated interfaces_assignments.py
KiLLuuuhh Apr 2, 2024
f266597
updated converge.yml
KiLLuuuhh Apr 2, 2024
9082607
finished tests
KiLLuuuhh Apr 2, 2024
4277118
updated converge.yml
KiLLuuuhh Apr 2, 2024
53d3345
updated interfaces_assignments_utils.py
KiLLuuuhh Apr 2, 2024
effdea5
added verify file
KiLLuuuhh Apr 2, 2024
6d8ae53
updated module_index
KiLLuuuhh Apr 2, 2024
10218c5
updated interfaces_assignments
KiLLuuuhh Apr 2, 2024
b40488d
removed old file
KiLLuuuhh Apr 2, 2024
c58cb11
updated tests
KiLLuuuhh Apr 2, 2024
6722a07
updated typo in tests
KiLLuuuhh Apr 2, 2024
3697016
updated tests
KiLLuuuhh Apr 2, 2024
7568cf2
added docstring to Interface_assignment class
KiLLuuuhh Apr 2, 2024
d5ccf02
added docstring to Interface_assignment functions
KiLLuuuhh Apr 2, 2024
ae25b75
added class- and docstring to class InterfacesSet
KiLLuuuhh Apr 2, 2024
bc4493b
updated linter errors
KiLLuuuhh Apr 3, 2024
81354d0
updated linter errors
KiLLuuuhh Apr 3, 2024
f6ed043
updated linter errors
KiLLuuuhh Apr 3, 2024
55efd94
some more linter erros
KiLLuuuhh Apr 3, 2024
f28b936
fixed typo
KiLLuuuhh Apr 3, 2024
9d22657
excluded tests from linter
KiLLuuuhh Apr 3, 2024
b3c893b
some linter changes + comparision fixed
KiLLuuuhh Apr 4, 2024
3d7d8fe
added full config as test xml
KiLLuuuhh Apr 4, 2024
14d89ce
fixed RETURN
KiLLuuuhh Apr 4, 2024
bceae7a
fixed RETURN
KiLLuuuhh Apr 4, 2024
4e439c6
some more linter errors
KiLLuuuhh Apr 4, 2024
7b0c7b9
sanity error fix
KiLLuuuhh Apr 4, 2024
554dd7f
XML Utility: elements_equal (#86)
DonGiovanni83 Apr 10, 2024
f4be6da
initial version of the system_settings_logging module (#61)
rekup Apr 15, 2024
9a0a397
updated linter errors
KiLLuuuhh Apr 3, 2024
f5fd4a7
XML Utility: elements_equal (#86)
DonGiovanni83 Apr 10, 2024
8221673
updated module_index
KiLLuuuhh Apr 2, 2024
7f9681b
initial version of the system_settings_logging module (#61)
rekup Apr 15, 2024
54b27bc
updated module_index
KiLLuuuhh Apr 17, 2024
3a2bdfc
added pylint: disable=duplicate-code
KiLLuuuhh Apr 17, 2024
3f973e7
updated converge tests
KiLLuuuhh Apr 17, 2024
d5deaf6
updated unit tests
KiLLuuuhh Apr 17, 2024
80ef4ee
changed error message
KiLLuuuhh Apr 17, 2024
c5396ca
added fail_json exceptions
KiLLuuuhh Apr 17, 2024
b498820
updated utils, so that local interfaces can be queried and created lo…
KiLLuuuhh Apr 17, 2024
df5223b
updated module_index
KiLLuuuhh Apr 17, 2024
897627a
updated test contexts
KiLLuuuhh Apr 17, 2024
5c8ad8d
refactored some code for the linter
KiLLuuuhh Apr 17, 2024
175f6d6
fixed list error
KiLLuuuhh Apr 17, 2024
e404333
black
KiLLuuuhh Apr 17, 2024
33f3d0e
added some tests
KiLLuuuhh Apr 17, 2024
440f323
added new error
KiLLuuuhh Apr 17, 2024
6aad142
fixed typing issue
KiLLuuuhh Apr 17, 2024
e0b131d
fixed doc issue
KiLLuuuhh Apr 17, 2024
97a40bc
added fully qualified collection names
KiLLuuuhh Apr 18, 2024
20f61fa
removed OPNSenseInterfaceNotFoundError
KiLLuuuhh Apr 19, 2024
d2dd989
applied DonGiovannis suggestions
KiLLuuuhh Apr 19, 2024
18a1b43
removed InterfaceNotFound error since it is not used
KiLLuuuhh Apr 20, 2024
0bbd616
restructured get_interfaces method to not rely on removed interfaces_…
KiLLuuuhh Apr 20, 2024
65357ce
removed unused entries
KiLLuuuhh Apr 20, 2024
fdbc875
removed unused interfaces_list entry
KiLLuuuhh Apr 20, 2024
e2b0f6f
some more module_index updates
KiLLuuuhh Apr 20, 2024
12f888a
Update plugins/modules/interfaces_assignments.py
KiLLuuuhh Apr 20, 2024
a22c5d4
Update plugins/module_utils/interfaces_assignments_utils.py
KiLLuuuhh Apr 20, 2024
f4b4e16
Update plugins/module_utils/module_index.py
KiLLuuuhh Apr 20, 2024
10bb7be
Update plugins/module_utils/module_index.py
KiLLuuuhh Apr 20, 2024
4d62477
Update plugins/module_utils/module_index.py
KiLLuuuhh Apr 20, 2024
9ca3dcb
Update plugins/module_utils/module_index.py
KiLLuuuhh Apr 20, 2024
975f542
updated error texts
KiLLuuuhh Apr 20, 2024
1c61e5a
applied DonGiovanni suggestions
KiLLuuuhh Apr 20, 2024
cee0d6d
refactored code
KiLLuuuhh Apr 20, 2024
2439940
reimplements configure_params
KiLLuuuhh Apr 20, 2024
60bd9ab
final adjustments
KiLLuuuhh Apr 20, 2024
e1b528b
finalized module_index
KiLLuuuhh Apr 20, 2024
47a746e
updated get_interfaces so that it uses the newly created run_command …
KiLLuuuhh Apr 22, 2024
b7a942b
updated tests
KiLLuuuhh Apr 22, 2024
8de206e
black plugins/module_utils/interfaces_assignments_utils.py
KiLLuuuhh Apr 22, 2024
253cd91
restructed module_index
KiLLuuuhh Apr 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions molecule/interfaces_assignments/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
- name: converge
hosts: all
become: true
tasks:
- name: Test interface lan, device em1 description update
puzzle.opnsense.interfaces_assignments:
identifier: "lan"
device: "em1"
description: "LAN1"

- name: Test interface wan, device update from em2 to em3
puzzle.opnsense.interfaces_assignments:
identifier: "wan"
device: "em3"
description: "wan_interface"
register: device_already_assigned_result
ignore_errors: yes

- name: "Verify that the device update failed since the device is already assigned"
ansible.builtin.assert:
that:
- device_already_assigned_result is failed
fail_msg: "This device is already assigned, please unassign this device first"
success_msg: "This device is already assigned, please unassign this device first"

- name: Test unknown identifier to used device description update
puzzle.opnsense.interfaces_assignments:
identifier: "unknown_identifier"
device: "em1"
description: "unknown_identifier"
register: unknown_identifier_result
ignore_errors: yes

- name: "Verify that the device update failed since the device is already assigned"
ansible.builtin.assert:
that:
- unknown_identifier_result is failed
fail_msg: "This device is already assigned, please unassign this device first"
success_msg: "This device is already assigned, please unassign this device first"

- name: Test interface lan, unknown_device update
puzzle.opnsense.interfaces_assignments:
identifier: "lan"
device: "unknown_device"
register: unknown_device_result
ignore_errors: yes

- name: "Verify that the device update failed due to non-existing device"
ansible.builtin.assert:
that:
- unknown_device_result is failed
fail_msg: "Interface update should fail due to non-existing device"
success_msg: "Interface update failed as expected due to non-existing device"
67 changes: 67 additions & 0 deletions molecule/interfaces_assignments/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
scenario:
name: interfaces_assignments
test_sequence:
# - dependency not relevant uless we have requirements
- destroy
- syntax
- create
- converge
- idempotence
- verify
- destroy

driver:
name: vagrant
parallel: true

platforms:
- name: "22.7"
hostname: false
box: puzzle/opnsense
box_version: "22.7"
memory: 1024
cpus: 2
instance_raw_config_args:
- 'vm.guest = :freebsd'
- 'ssh.sudo_command = "%c"'
- 'ssh.shell = "/bin/sh"'
- name: "23.1"
box: puzzle/opnsense
hostname: false
box_version: "23.1"
memory: 1024
cpus: 2
instance_raw_config_args:
- 'vm.guest = :freebsd'
- 'ssh.sudo_command = "%c"'
- 'ssh.shell = "/bin/sh"'
- name: "23.7"
box: puzzle/opnsense
hostname: false
box_version: "23.7"
memory: 1024
cpus: 2
instance_raw_config_args:
- 'vm.guest = :freebsd'
- 'ssh.sudo_command = "%c"'
- 'ssh.shell = "/bin/sh"'
- name: "24.1"
box: puzzle/opnsense
hostname: false
box_version: "24.1"
memory: 1024
cpus: 2
instance_raw_config_args:
- 'vm.guest = :freebsd'
- 'ssh.sudo_command = "%c"'
- 'ssh.shell = "/bin/sh"'

provisioner:
name: ansible
env:
ANSIBLE_VERBOSITY: 3
verifier:
name: ansible
options:
become: true
6 changes: 6 additions & 0 deletions molecule/interfaces_assignments/verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- name: Verify connectivity to server
hosts: all
tasks:
- name: Ping the server
ansible.builtin.ping:
Loading