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

Test suites for inlinel2 and inlinel3 #6769

Merged
merged 42 commits into from
Jan 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
6e36cab
First draft
fdurand Dec 1, 2021
dd24b00
Added Client
fdurand Dec 3, 2021
b42a5b5
Added testlink tests
fdurand Dec 6, 2021
2d14922
Fixed api password
fdurand Dec 7, 2021
e6369c8
Teardown and started l2
fdurand Dec 7, 2021
2e05e03
Inline l2 tests
fdurand Dec 7, 2021
f269291
[Venom] Inline add Scenario
JeGoi Dec 7, 2021
95d0cea
[Venom] Inline add makefile
JeGoi Dec 7, 2021
5d6755c
[Venom] inline l3 change chmod on dhcp
JeGoi Dec 7, 2021
c5892f1
Teardown on test unline l2
fdurand Dec 7, 2021
0d8f8a4
Remove network config for inline l2
fdurand Dec 7, 2021
b483e3f
Fixed "Register device on the portal" test for l3
fdurand Dec 7, 2021
58de4b1
Removed duplicated tests
fdurand Dec 7, 2021
3c3d9e2
[Venon] Add configurator
JeGoi Dec 7, 2021
4a02f83
[Venom] Add inline for el8
JeGoi Dec 7, 2021
a27615b
Fixed l3 teardown
fdurand Dec 7, 2021
1e30357
Set eth0 as snat interface
fdurand Dec 7, 2021
7765f47
[Venom] Inline test: add inline l3 and inline2
JeGoi Dec 8, 2021
def1303
[Venom] Inline test: Add install qemu-kvm for el8
JeGoi Dec 8, 2021
3ae853a
Removed duplicated step
fdurand Dec 8, 2021
6bbde03
[Venom] Inline test: add inline in ci
JeGoi Dec 8, 2021
76d354d
Added TESTSUITE.md for l2 and l3
fdurand Dec 14, 2021
c03c3e6
Added network diagram for inline l3 test
fdurand Dec 14, 2021
c885581
Renamed all the test cases
fdurand Dec 15, 2021
ede5a47
Updated Diagram
fdurand Dec 15, 2021
db6e40b
Added Diagram.png for inline l2
fdurand Dec 15, 2021
b86f12f
Renamed files
fdurand Dec 15, 2021
d24fc4a
Enabled netflow
fdurand Dec 15, 2021
3070031
Fixes tests
fdurand Dec 16, 2021
3e507c1
update get_login_token variable
nqb Dec 23, 2021
a168f54
run inline tests as part of unit_tests scenario
nqb Dec 23, 2021
4b7249a
[Venom] Inline: Add variables for l3, Create symlink from qemu-kvm to…
JeGoi Dec 23, 2021
a527f40
[Venom] Unit tests: change inline position
JeGoi Dec 31, 2021
63dd16d
[Venom] inline l2 and l3 add variables
JeGoi Dec 31, 2021
c9870ae
[Venom] Inline l2 l3: add variables
JeGoi Jan 5, 2022
6a56d11
Create a dedicated scenario to avoid issue with Perl unit tests
nqb Jan 5, 2022
b059f80
[Venom] Inline add warning for hard coded variables
JeGoi Jan 5, 2022
8782438
[Venom] inline l2 change variable name for l2
JeGoi Jan 5, 2022
9642491
[Venom] Inline: remove inline for release test only
JeGoi Jan 5, 2022
984c367
[Venom] Inline: add back the symlink for EL8 remove by #62c1500537ecd…
JeGoi Jan 5, 2022
b3d565d
use dedicated configurator test suite
nqb Jan 6, 2022
0cfebe0
cleanup before merge
nqb Jan 6, 2022
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
16 changes: 16 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,22 @@ captive_portal_deb11:
- .test_script_job
- .test_devel_branches_and_maintenance_rules

inline_deb11:
variables:
VAGRANT_PF_DOTFILE_PATH: /var/local/gitlab-runner/vagrant/vagrant-${CI_COMMIT_TAG}
extends:
- .test_job
- .test_script_job
- .test_devel_branches_and_maintenance_rules

inline_el8:
variables:
VAGRANT_PF_DOTFILE_PATH: /var/local/gitlab-runner/vagrant/vagrant-${CI_COMMIT_TAG}
extends:
- .test_job
- .test_script_job
- .test_devel_branches_and_maintenance_rules

### release
configurator_el8:
variables:
Expand Down
12 changes: 12 additions & 0 deletions t/venom/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,18 @@ dot1x_eap_tls_deb11:
SCENARIOS_TO_RUN=dot1x_eap_tls \
$(MAKE_TARGET)

inline_deb11:
make \
PF_VM_NAME=pfdeb11$(DEV_ENV) \
SCENARIOS_TO_RUN=inline \
$(MAKE_TARGET)

inline_el8:
make \
PF_VM_NAME=pfel8$(DEV_ENV) \
SCENARIOS_TO_RUN=inline \
$(MAKE_TARGET)

fingerbank_invalid_db_deb11:
make \
PF_VM_NAME=pfdeb11$(DEV_ENV) \
Expand Down
25 changes: 25 additions & 0 deletions t/venom/scenarios/inline/playbooks/configure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
- hosts: pfservers
name: configure Packetfence VM
become: True

tasks:
- name: Install qemu-system-x86 on debian
apt:
name: qemu-system-x86
state: present
when: ansible_facts['os_family'] == "Debian"

- name: Install qemu-kvm on el8
yum:
name: qemu-kvm
state: present
enablerepo: "epel"
when: ansible_facts['os_family'] == "RedHat"

- name: For RHEL8Create a symbolic link for qemu-system-x86_64
ansible.builtin.file:
src: /usr/libexec/qemu-kvm
dest: /usr/bin/qemu-system-x86_64
state: link
when: ansible_facts['os_family'] == "RedHat"
18 changes: 18 additions & 0 deletions t/venom/scenarios/inline/playbooks/rsync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
- hosts: pfservers, service_venom, nodes
name: Rsync Git repository t/venom with /usr/local/pf/t/venom (localdev only)
become: True

tasks:
- name: Synchronize Git repository t/venom with /usr/local/pf/t/venom
ansible.posix.synchronize:
# src is provided through test-wrapper.sh
# as $PWD/venom (no leading slash)
src: "{{ lookup('env', 'VENOM_ROOT_DIR') }}"
dest: '/usr/local/pf/t/'
archive: yes
delete: yes
# exclude files dynamically generated by Ansible
rsync_opts:
- "--exclude=vars/local.yml"

34 changes: 34 additions & 0 deletions t/venom/scenarios/inline/playbooks/run_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
- hosts: pfservers
name: Run example tests
become: True

vars:
# put your test suites to try here
test_suites:
- configurator_inline
- inline/l3
- inline/l3/teardown
- inline/l2
- inline/l2/teardown

tasks:
- name: Run Venom testsuites
command: '{{ venom_dir }}/venom-wrapper.sh {{ venom_dir }}/test_suites/{{ item }}'
args:
chdir: '{{ venom_dir }}'
loop: '{{ test_suites }}'
vars:
venom_wrapper_args:
# temp, overcome two Venom issues:
# - tap: https://github.com/ovh/venom/issues/428
# - when running test suite one by one, previous logs and results are overriden
# Venom will create one directory per test suite to store results
VENOM_COMMON_FLAGS: '--format=tap --output-dir={{ venom_dir }}/results/{{ item }}'

# add inventory__group_environment to Ansible environment
# useful to make env vars available for Venom
environment: '{{ inventory__group_environment | d({})
| combine(venom_wrapper_args | d({})) }}'


10 changes: 10 additions & 0 deletions t/venom/scenarios/inline/site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
# - import_playbook: playbooks/provision.yml

# rsync before tests when doing local development
- import_playbook: playbooks/rsync.yml
when: lookup("env", "CI") != 'true'

- import_playbook: playbooks/configure.yml

- import_playbook: playbooks/run_tests.yml
1 change: 0 additions & 1 deletion t/venom/scenarios/unit_tests/playbooks/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
- backup_db_and_restore
- backup_db_and_restore/teardown


tasks:
# only to debug what is injected in Ansible environment
# - name: Display ansible_env
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Configure DHCP listener interface
testcases:
# get_name_of: one-liner to get name (ex: eth0) based on index (ex: 1, 2)
- name: get_name_of_dhcp_listener_int
steps:
- type: exec
script: "ip -o link show | egrep -v '^1:' | grep '^{{.configurator.interfaces.dhcp_listener.index}}' | awk -F ': ' '{print $2;}'"
vars:
dhcp_listener_interface:
from: result.systemout

- name: configure_dhcp_listener_int
steps:
- type: http
method: PATCH
url: '{{.pfserver_webadmin_url}}/api/v1/configurator/config/interface/{{.get_name_of_dhcp_listener_int.dhcp_listener_interface}}'
ignore_verify_ssl: true
body: >-
{
"ipaddress": "{{.configurator.interfaces.dhcp_listener.ip}}",
"netmask": "{{.configurator.interfaces.dhcp_listener.netmask}}",
"type": "dhcp-listener"
}
headers:
"Content-Type": "application/json"
assertions:
- result.statuscode ShouldEqual 200

# switch interface to static state
- name: bounce_dhcp_listener_int
steps:
- type: http
method: POST
url: '{{.pfserver_webadmin_url}}/api/v1/configurator/config/interface/{{.get_name_of_dhcp_listener_int.dhcp_listener_interface}}/down'
ignore_verify_ssl: true
headers:
"Content-Type": "application/json"
assertions:
- result.statuscode ShouldEqual 200
- result.bodyjson.message ShouldEqual "Interface {{.get_name_of_dhcp_listener_int.dhcp_listener_interface}} disabled"

- type: http
method: POST
url: '{{.pfserver_webadmin_url}}/api/v1/configurator/config/interface/{{.get_name_of_dhcp_listener_int.dhcp_listener_interface}}/up'
ignore_verify_ssl: true
headers:
"Content-Type": "application/json"
assertions:
- result.statuscode ShouldEqual 200
- result.bodyjson.message ShouldEqual "Interface {{.get_name_of_dhcp_listener_int.dhcp_listener_interface}} enabled"

# start dhclient without any action on /etc/resolv.conf
- name: start_dhclient_on_dhcp_listener_int
steps:
- type: exec
script: "echo 'make_resolv_conf() { :; }' > /etc/dhcp/dhclient-enter-hooks"

- type: exec
script: "/usr/sbin/dhclient -nw {{.get_name_of_dhcp_listener_int.dhcp_listener_interface}}"


Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Run configurator step 1
testcases:
# get_name_of: one-liner to get name (ex: eth0) based on index (ex: 1, 2)
- name: get_name_of_mgmt_int
steps:
- type: exec
script: "ip -o link show | egrep -v '^1:' | grep '^{{.configurator.interfaces.mgmt.index}}' | awk -F ': ' '{print $2;}'"
vars:
mgmt_interface:
from: result.systemout

- name: configure_mgmt_int
steps:
- type: http
method: PATCH
url: '{{.pfserver_webadmin_url}}/api/v1/configurator/config/interface/{{.get_name_of_mgmt_int.mgmt_interface}}'
ignore_verify_ssl: true
body: >-
{
"ipaddress": "{{.configurator.interfaces.mgmt.ip}}",
"netmask": "{{.configurator.interfaces.mgmt.netmask}}",
"type": "management",
"additional_listening_daemons": ["portal"]
}
headers:
"Content-Type": "application/json"
assertions:
- result.statuscode ShouldEqual 200


- name: configure_dns_servers
steps:
- type: http
method: PUT
url: '{{.pfserver_webadmin_url}}/api/v1/configurator/config/system/dns_servers'
ignore_verify_ssl: true
body: >-
{
"dns_servers": ["{{.configurator.dns.primary_ip}}", "{{.configurator.dns.secondary_ip}}"]
}
headers:
"Content-Type": "application/json"
assertions:
- result.statuscode ShouldEqual 200
Loading