summaryrefslogtreecommitdiff
path: root/tests/integration/targets/vyos_linkagg
diff options
context:
space:
mode:
authorCaptTrews <capttrews@gmail.com>2019-08-29 14:21:30 +0000
committerCaptTrews <capttrews@gmail.com>2019-08-29 14:21:30 +0000
commitae8514ce0289ee2096a3a9f54be6a4654153c880 (patch)
tree2d9a958c135c5ec4cad86650e8f7d7ef173d33c2 /tests/integration/targets/vyos_linkagg
parent59af486ab07108815ad1774205959fa8287d6e53 (diff)
downloadvyos-ansible-old-ae8514ce0289ee2096a3a9f54be6a4654153c880.tar.gz
vyos-ansible-old-ae8514ce0289ee2096a3a9f54be6a4654153c880.zip
Updated from network content collector
Signed-off-by: CaptTrews <capttrews@gmail.com>
Diffstat (limited to 'tests/integration/targets/vyos_linkagg')
-rw-r--r--tests/integration/targets/vyos_linkagg/aliases0
-rw-r--r--tests/integration/targets/vyos_linkagg/defaults/main.yaml3
-rw-r--r--tests/integration/targets/vyos_linkagg/tasks/cli.yaml22
-rw-r--r--tests/integration/targets/vyos_linkagg/tasks/main.yaml2
-rw-r--r--tests/integration/targets/vyos_linkagg/tests/cli/basic.yaml184
-rw-r--r--tests/integration/targets/vyos_linkagg/tests/cli/net_linkagg.yaml31
6 files changed, 242 insertions, 0 deletions
diff --git a/tests/integration/targets/vyos_linkagg/aliases b/tests/integration/targets/vyos_linkagg/aliases
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/integration/targets/vyos_linkagg/aliases
diff --git a/tests/integration/targets/vyos_linkagg/defaults/main.yaml b/tests/integration/targets/vyos_linkagg/defaults/main.yaml
new file mode 100644
index 0000000..9ef5ba5
--- /dev/null
+++ b/tests/integration/targets/vyos_linkagg/defaults/main.yaml
@@ -0,0 +1,3 @@
+---
+testcase: "*"
+test_items: []
diff --git a/tests/integration/targets/vyos_linkagg/tasks/cli.yaml b/tests/integration/targets/vyos_linkagg/tasks/cli.yaml
new file mode 100644
index 0000000..890d3ac
--- /dev/null
+++ b/tests/integration/targets/vyos_linkagg/tasks/cli.yaml
@@ -0,0 +1,22 @@
+---
+- name: collect all cli test cases
+ find:
+ paths: "{{ role_path }}/tests/cli"
+ patterns: "{{ testcase }}.yaml"
+ register: test_cases
+ delegate_to: localhost
+
+- name: set test_items
+ set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}"
+
+- name: run test case (connection=network_cli)
+ include: "{{ test_case_to_run }} ansible_connection=network_cli"
+ with_items: "{{ test_items }}"
+ loop_control:
+ loop_var: test_case_to_run
+
+- name: run test case (connection=local)
+ include: "{{ test_case_to_run }} ansible_connection=local"
+ with_first_found: "{{ test_items }}"
+ loop_control:
+ loop_var: test_case_to_run
diff --git a/tests/integration/targets/vyos_linkagg/tasks/main.yaml b/tests/integration/targets/vyos_linkagg/tasks/main.yaml
new file mode 100644
index 0000000..415c99d
--- /dev/null
+++ b/tests/integration/targets/vyos_linkagg/tasks/main.yaml
@@ -0,0 +1,2 @@
+---
+- { include: cli.yaml, tags: ['cli'] }
diff --git a/tests/integration/targets/vyos_linkagg/tests/cli/basic.yaml b/tests/integration/targets/vyos_linkagg/tests/cli/basic.yaml
new file mode 100644
index 0000000..5a02255
--- /dev/null
+++ b/tests/integration/targets/vyos_linkagg/tests/cli/basic.yaml
@@ -0,0 +1,184 @@
+---
+- debug: msg="cli/basic.yaml on connection={{ ansible_connection }}"
+
+- name: Remove linkagg
+ vyos.vyos.vyos_linkagg:
+ name: bond0
+ state: absent
+
+- name: Remove linkagg
+ vyos.vyos.vyos_linkagg:
+ name: bond1
+ state: absent
+
+- name: Create linkagg
+ vyos.vyos.vyos_linkagg:
+ name: bond0
+ members:
+ - eth1
+ state: present
+ register: result
+
+- assert:
+ that:
+ - 'result.changed == true'
+ - '"set interfaces bonding bond0 mode 802.3ad" in result.commands'
+ - '"set interfaces ethernet eth1 bond-group bond0" in result.commands'
+
+- name: Create linkagg again (idempotent)
+ vyos.vyos.vyos_linkagg:
+ name: bond0
+ members:
+ - eth1
+ state: present
+ register: result
+
+- assert:
+ that:
+ - 'result.changed == false'
+
+- name: Add linkagg member
+ vyos.vyos.vyos_linkagg:
+ name: bond0
+ members:
+ - eth2
+ state: present
+ register: result
+
+- assert:
+ that:
+ - 'result.changed == true'
+ - '"set interfaces ethernet eth2 bond-group bond0" in result.commands'
+
+- name: Add linkagg member again (idempotent)
+ vyos.vyos.vyos_linkagg:
+ name: bond0
+ members:
+ - eth2
+ state: present
+ register: result
+
+- assert:
+ that:
+ - 'result.changed == false'
+
+- name: Disable linkagg
+ vyos.vyos.vyos_linkagg:
+ name: bond0
+ state: down
+ register: result
+
+- assert:
+ that:
+ - 'result.changed == true'
+ - '"set interfaces bonding bond0 disable" in result.commands'
+
+- name: Disable linkagg again (idempotent)
+ vyos.vyos.vyos_linkagg:
+ name: bond0
+ state: down
+ register: result
+
+- assert:
+ that:
+ - 'result.changed == false'
+
+- name: Enable linkagg
+ vyos.vyos.vyos_linkagg:
+ name: bond0
+ state: up
+ register: result
+
+- assert:
+ that:
+ - 'result.changed == true'
+ - '"delete interfaces bonding bond0 disable" in result.commands[0]'
+
+- name: Enable linkagg again (idempotent)
+ vyos.vyos.vyos_linkagg:
+ name: bond0
+ state: up
+ register: result
+
+- assert:
+ that:
+ - 'result.changed == false'
+
+- name: Remove linkagg
+ vyos.vyos.vyos_linkagg:
+ name: bond0
+ state: absent
+ register: result
+
+- assert:
+ that:
+ - 'result.changed == true'
+ - '"delete interfaces ethernet eth1 bond-group" in result.commands'
+ - '"delete interfaces ethernet eth2 bond-group" in result.commands'
+ - '"delete interfaces bonding bond0" in result.commands'
+
+- name: Remove linkagg again (idempotent)
+ vyos.vyos.vyos_linkagg:
+ name: bond0
+ state: absent
+ register: result
+
+- assert:
+ that:
+ - 'result.changed == false'
+
+- name: Create collection of linkagg definitions
+ vyos.vyos.vyos_linkagg:
+ aggregate:
+ - { name: bond0, members: [eth1] }
+ - { name: bond1, members: [eth2] }
+ state: present
+ register: result
+
+- assert:
+ that:
+ - 'result.changed == true'
+ - '"set interfaces bonding bond0 mode 802.3ad" in result.commands'
+ - '"set interfaces ethernet eth1 bond-group bond0" in result.commands'
+ - '"set interfaces bonding bond1 mode 802.3ad" in result.commands'
+ - '"set interfaces ethernet eth2 bond-group bond1" in result.commands'
+
+- name: Create collection of linkagg definitions again (idempotent)
+ vyos.vyos.vyos_linkagg:
+ aggregate:
+ - { name: bond0, members: [eth1] }
+ - { name: bond1, members: [eth2] }
+ state: present
+ register: result
+
+- assert:
+ that:
+ - 'result.changed == false'
+
+- name: Remove collection of linkagg definitions
+ vyos.vyos.vyos_linkagg:
+ aggregate:
+ - name: bond0
+ - name: bond1
+ state: absent
+ register: result
+
+- assert:
+ that:
+ - 'result.changed == true'
+ - '"delete interfaces ethernet eth1 bond-group" in result.commands'
+ - '"delete interfaces bonding bond0" in result.commands'
+ - '"delete interfaces ethernet eth2 bond-group" in result.commands'
+ - '"delete interfaces bonding bond1" in result.commands'
+
+- name: Remove collection of linkagg definitions again (idempotent)
+ vyos.vyos.vyos_linkagg:
+ aggregate:
+ - name: bond0
+ - name: bond1
+ state: absent
+ register: result
+
+- assert:
+ that:
+ - 'result.changed == false'
diff --git a/tests/integration/targets/vyos_linkagg/tests/cli/net_linkagg.yaml b/tests/integration/targets/vyos_linkagg/tests/cli/net_linkagg.yaml
new file mode 100644
index 0000000..93f98e7
--- /dev/null
+++ b/tests/integration/targets/vyos_linkagg/tests/cli/net_linkagg.yaml
@@ -0,0 +1,31 @@
+---
+- debug: msg="START vyos cli/net_linkagg.yaml on connection={{ ansible_connection }}"
+
+# Add minimal testcase to check args are passed correctly to
+# implementation module and module run is successful.
+
+- name: Remove linkagg - set
+ net_linkagg:
+ name: bond0
+ state: absent
+
+- name: Create linkagg using platform agnostic module
+ net_linkagg:
+ name: bond0
+ members:
+ - eth1
+ state: present
+ register: result
+
+- assert:
+ that:
+ - 'result.changed == true'
+ - '"set interfaces bonding bond0 mode 802.3ad" in result.commands'
+ - '"set interfaces ethernet eth1 bond-group bond0" in result.commands'
+
+- name: Remove linkagg - teardown
+ net_linkagg:
+ name: bond0
+ state: absent
+
+- debug: msg="END vyos cli/net_linkagg.yaml on connection={{ ansible_connection }}"