forked from infobloxopen/infoblox-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix sanity and added vLAN integration tests
- Loading branch information
Showing
7 changed files
with
162 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
shippable/cloud/group1 | ||
cloud/nios | ||
destructive |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
testcase: "*" | ||
test_items: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
dependencies: | ||
- prepare_nios_tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
- name: Include idempotence tasks for vlan | ||
ansible.builtin.include_tasks: nios_vlan_idempotence.yml |
94 changes: 94 additions & 0 deletions
94
tests/integration/targets/nios_vlan/tasks/nios_vlan_idempotence.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
--- | ||
- name: Cleanup VLAN | ||
nios_vlan: | ||
name: ansible-vlan | ||
id: 10 | ||
parent: default | ||
state: absent | ||
provider: "{{ nios_provider }}" | ||
|
||
- name: Configure a VLAN on the system | ||
infoblox.nios_modules.nios_vlan: | ||
name: ansible-vlan | ||
id: 10 | ||
parent: default | ||
contact: '[email protected]' | ||
department: 'IT' | ||
description: 'This is an example VLAN' | ||
reserved: true | ||
state: present | ||
provider: "{{ nios_provider }}" | ||
register: vlan_create1 | ||
|
||
- name: Configure another VLAN on the system | ||
infoblox.nios_modules.nios_vlan: | ||
name: ansible-vlan | ||
id: 10 | ||
parent: default | ||
contact: '[email protected]' | ||
department: 'IT' | ||
description: 'This is an example VLAN' | ||
reserved: true | ||
state: present | ||
provider: "{{ nios_provider }}" | ||
register: vlan_create2 | ||
|
||
- name: Update the comment and ext attributes for an existing VLAN | ||
infoblox.nios_modules.nios_vlan: | ||
name: ansible-vlan | ||
id: 10 | ||
parent: default | ||
contact: '[email protected]' | ||
department: 'IT' | ||
description: 'This is an example VLAN' | ||
reserved: true | ||
comment: this is an example comment | ||
extattrs: | ||
Site: west-dc | ||
state: present | ||
provider: "{{ nios_provider }}" | ||
register: vlan_update1 | ||
|
||
- name: Update again the comment and ext attributes for an existing VLAN | ||
infoblox.nios_modules.nios_vlan: | ||
name: ansible-vlan | ||
id: 10 | ||
parent: default | ||
contact: '[email protected]' | ||
department: 'IT' | ||
description: 'This is an example VLAN' | ||
reserved: true | ||
comment: this is an example comment | ||
extattrs: | ||
Site: west-dc | ||
state: present | ||
provider: "{{ nios_provider }}" | ||
register: vlan_update2 | ||
|
||
- name: Remove the VLAN | ||
infoblox.nios_modules.nios_vlan: | ||
name: ansible-vlan | ||
id: 10 | ||
parent: default | ||
state: absent | ||
provider: "{{ nios_provider }}" | ||
register: vlan_delete1 | ||
|
||
- name: Remove again the VLAN | ||
infoblox.nios_modules.nios_vlan: | ||
name: ansible-vlan | ||
id: 10 | ||
parent: default | ||
state: absent | ||
provider: "{{ nios_provider }}" | ||
register: vlan_delete2 | ||
|
||
- name: Assert changes in VLAN | ||
ansible.builtin.assert: | ||
that: | ||
- vlan_create1.changed | ||
- not vlan_create2.changed | ||
- vlan_update1.changed | ||
- not vlan_update2.changed | ||
- vlan_delete1.changed | ||
- not vlan_delete2.changed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,14 +79,20 @@ def test_nios_vlan_create(self): | |
res = wapi.run('NIOS_VLAN', test_spec) | ||
|
||
self.assertTrue(res['changed']) | ||
wapi.create_object.assert_called_once_with('NIOS_VLAN', {'name': 'ansible_vlan', | ||
'parent': 'default', 'id': '10'}) | ||
wapi.create_object.assert_called_once_with( | ||
'NIOS_VLAN', | ||
{ | ||
'name': 'ansible_vlan', | ||
'parent': 'default', | ||
'id': '10' | ||
} | ||
) | ||
|
||
def test_nios_vlan_update_comment(self): | ||
self.module.params = {'provider': None, 'state': 'present', 'name': 'ansible_vlan', | ||
'parent': 'default', 'id': '10', 'comment': 'updated comment', | ||
'contact': '[email protected]', 'department': 'IT', 'description': 'test', | ||
'reserved': True,'extattrs': None} | ||
'reserved': True, 'extattrs': None} | ||
|
||
ref = "vlan/ZG5zLm5ldHdvcmtfdmlldyQw:ansible_vlan" | ||
test_object = [ | ||
|