Skip to content

Commit a750714

Browse files
committed
feat: Include netbox_tunnel.yml in integration tests
This commit adds the `netbox_tunnel.yml` file to the integration tests for targets v3.5, v3.6, v3.7, and v4.0. The file is included using the `ansible.builtin.include_tasks` module with the `netbox_tunnel.yml` file as the source. This change ensures that the `netbox_tunnel` tests are executed as part of the integration test suite.
1 parent 960aebe commit a750714

File tree

8 files changed

+408
-0
lines changed

8 files changed

+408
-0
lines changed

tests/integration/targets/v3.5/tasks/main.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,3 +305,12 @@
305305
- netbox_fhrp_group_assignmen
306306
tags:
307307
- netbox_fhrp_group_assignmen
308+
309+
- name: NETBOX_TUNNEL TESTS
310+
ansible.builtin.include_tasks:
311+
file: netbox_tunnel.yml
312+
apply:
313+
tags:
314+
- netbox_tunnel
315+
tags:
316+
- netbox_tunnel
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
##
3+
##
4+
### NETBOX_TUNNEL
5+
##
6+
##
7+
- name: "TUNNEL 1: Necessary info creation"
8+
netbox.netbox.netbox_tunnel:
9+
netbox_url: http://localhost:32768
10+
netbox_token: "0123456789abcdef0123456789abcdef01234567"
11+
data:
12+
name: Test Tunnel
13+
status: active
14+
encapsulation: ipsec-tunnel
15+
state: present
16+
register: test_one
17+
18+
- name: "TUNNEL 1: ASSERT - Necessary info creation"
19+
ansible.builtin.assert:
20+
that:
21+
- test_one is changed
22+
- test_one['diff']['before']['state'] == "absent"
23+
- test_one['diff']['after']['state'] == "present"
24+
- test_one['tunnel']['name'] == "Test Tunnel"
25+
- test_one['tunnel']['status'] == "active"
26+
- test_one['tunnel']['encapsulation'] == "ipsec-tunnel"
27+
- test_one['msg'] == "tunnel Test Tunnel created"
28+
29+
- name: "TUNNEL 2: Create duplicate"
30+
netbox.netbox.netbox_tunnel:
31+
netbox_url: http://localhost:32768
32+
netbox_token: "0123456789abcdef0123456789abcdef01234567"
33+
data:
34+
name: Test Tunnel
35+
status: active
36+
encapsulation: ipsec-tunnel
37+
state: present
38+
register: test_two
39+
40+
- name: "TUNNEL 2: ASSERT - Create duplicate"
41+
ansible.builtin.assert:
42+
that:
43+
- not test_two['changed']
44+
- test_two['tunnel']['name'] == "Test Tunnel"
45+
- test_two['tunnel']['status'] == "active"
46+
- test_two['tunnel']['encapsulation'] == "ipsec-tunnel"
47+
- test_two['msg'] == "tunnel Test Tunnel already exists"
48+
49+
- name: "TUNNEL 3: Update Existing"
50+
netbox.netbox.netbox_tunnel:
51+
netbox_url: http://localhost:32768
52+
netbox_token: "0123456789abcdef0123456789abcdef01234567"
53+
data:
54+
name: Test Tunnel
55+
description: Test Description
56+
tenant: Test Tenant
57+
tunnel_id: 200
58+
tags:
59+
- Schnozzberry
60+
state: present
61+
register: test_three
62+
63+
- name: "TUNNEL: ASSERT - Updated"
64+
ansible.builtin.assert:
65+
that:
66+
- test_three is changed
67+
- test_three['diff']['after']['description'] == "Test Description"
68+
- test_three['diff']['after']['tenant'] == 1
69+
- test_three['diff']['after']['tunnel_id'] == 200
70+
- test_three['diff']['after']['tags'][0] == 4
71+
- test_three['tunnel']['name'] == "Test Tunnel"
72+
- test_three['tunnel']['tenant'] == 1
73+
- test_three['tunnel']['tunnel_id'] == 200
74+
- test_three['tunnel']['description'] == "Test Description"
75+
- test_three['tunnel']['tags'][0] == 4
76+
- test_three['msg'] == "tunnel Test Tunnel updated"
77+
78+
- name: "TUNNEL 4: Delete"
79+
netbox.netbox.netbox_tunnel:
80+
netbox_url: http://localhost:32768
81+
netbox_token: "0123456789abcdef0123456789abcdef01234567"
82+
data:
83+
name: Test Tunnel
84+
state: absent
85+
register: test_four
86+
87+
- name: "TUNNEL 4: ASSERT - Delete"
88+
ansible.builtin.assert:
89+
that:
90+
- test_four is changed
91+
- test_four['diff']['before']['state'] == "present"
92+
- test_four['diff']['after']['state'] == "absent"
93+
- test_four['msg'] == "tunnel Test Tunnel deleted"

tests/integration/targets/v3.6/tasks/main.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,3 +315,12 @@
315315
ansible.builtin.include_tasks: netbox_custom_field_choice_set.yml
316316
tags:
317317
- netbox_custom_field_choice_set
318+
319+
- name: NETBOX_TUNNEL TESTS
320+
ansible.builtin.include_tasks:
321+
file: netbox_tunnel.yml
322+
apply:
323+
tags:
324+
- netbox_tunnel
325+
tags:
326+
- netbox_tunnel
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
##
3+
##
4+
### NETBOX_TUNNEL
5+
##
6+
##
7+
- name: "TUNNEL 1: Necessary info creation"
8+
netbox.netbox.netbox_tunnel:
9+
netbox_url: http://localhost:32768
10+
netbox_token: "0123456789abcdef0123456789abcdef01234567"
11+
data:
12+
name: Test Tunnel
13+
status: active
14+
encapsulation: ipsec-tunnel
15+
state: present
16+
register: test_one
17+
18+
- name: "TUNNEL 1: ASSERT - Necessary info creation"
19+
ansible.builtin.assert:
20+
that:
21+
- test_one is changed
22+
- test_one['diff']['before']['state'] == "absent"
23+
- test_one['diff']['after']['state'] == "present"
24+
- test_one['tunnel']['name'] == "Test Tunnel"
25+
- test_one['tunnel']['status'] == "active"
26+
- test_one['tunnel']['encapsulation'] == "ipsec-tunnel"
27+
- test_one['msg'] == "tunnel Test Tunnel created"
28+
29+
- name: "TUNNEL 2: Create duplicate"
30+
netbox.netbox.netbox_tunnel:
31+
netbox_url: http://localhost:32768
32+
netbox_token: "0123456789abcdef0123456789abcdef01234567"
33+
data:
34+
name: Test Tunnel
35+
status: active
36+
encapsulation: ipsec-tunnel
37+
state: present
38+
register: test_two
39+
40+
- name: "TUNNEL 2: ASSERT - Create duplicate"
41+
ansible.builtin.assert:
42+
that:
43+
- not test_two['changed']
44+
- test_two['tunnel']['name'] == "Test Tunnel"
45+
- test_two['tunnel']['status'] == "active"
46+
- test_two['tunnel']['encapsulation'] == "ipsec-tunnel"
47+
- test_two['msg'] == "tunnel Test Tunnel already exists"
48+
49+
- name: "TUNNEL 3: Update Existing"
50+
netbox.netbox.netbox_tunnel:
51+
netbox_url: http://localhost:32768
52+
netbox_token: "0123456789abcdef0123456789abcdef01234567"
53+
data:
54+
name: Test Tunnel
55+
description: Test Description
56+
tenant: Test Tenant
57+
tunnel_id: 200
58+
tags:
59+
- Schnozzberry
60+
state: present
61+
register: test_three
62+
63+
- name: "TUNNEL: ASSERT - Updated"
64+
ansible.builtin.assert:
65+
that:
66+
- test_three is changed
67+
- test_three['diff']['after']['description'] == "Test Description"
68+
- test_three['diff']['after']['tenant'] == 1
69+
- test_three['diff']['after']['tunnel_id'] == 200
70+
- test_three['diff']['after']['tags'][0] == 4
71+
- test_three['tunnel']['name'] == "Test Tunnel"
72+
- test_three['tunnel']['tenant'] == 1
73+
- test_three['tunnel']['tunnel_id'] == 200
74+
- test_three['tunnel']['description'] == "Test Description"
75+
- test_three['tunnel']['tags'][0] == 4
76+
- test_three['msg'] == "tunnel Test Tunnel updated"
77+
78+
- name: "TUNNEL 4: Delete"
79+
netbox.netbox.netbox_tunnel:
80+
netbox_url: http://localhost:32768
81+
netbox_token: "0123456789abcdef0123456789abcdef01234567"
82+
data:
83+
name: Test Tunnel
84+
state: absent
85+
register: test_four
86+
87+
- name: "TUNNEL 4: ASSERT - Delete"
88+
ansible.builtin.assert:
89+
that:
90+
- test_four is changed
91+
- test_four['diff']['before']['state'] == "present"
92+
- test_four['diff']['after']['state'] == "absent"
93+
- test_four['msg'] == "tunnel Test Tunnel deleted"

tests/integration/targets/v3.7/tasks/main.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,3 +316,12 @@
316316
ansible.builtin.include_tasks: netbox_virtual_disk.yml
317317
tags:
318318
- netbox_virtual_disk
319+
320+
- name: NETBOX_TUNNEL TESTS
321+
ansible.builtin.include_tasks:
322+
file: netbox_tunnel.yml
323+
apply:
324+
tags:
325+
- netbox_tunnel
326+
tags:
327+
- netbox_tunnel
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
##
3+
##
4+
### NETBOX_TUNNEL
5+
##
6+
##
7+
- name: "TUNNEL 1: Necessary info creation"
8+
netbox.netbox.netbox_tunnel:
9+
netbox_url: http://localhost:32768
10+
netbox_token: "0123456789abcdef0123456789abcdef01234567"
11+
data:
12+
name: Test Tunnel
13+
status: active
14+
encapsulation: ipsec-tunnel
15+
state: present
16+
register: test_one
17+
18+
- name: "TUNNEL 1: ASSERT - Necessary info creation"
19+
ansible.builtin.assert:
20+
that:
21+
- test_one is changed
22+
- test_one['diff']['before']['state'] == "absent"
23+
- test_one['diff']['after']['state'] == "present"
24+
- test_one['tunnel']['name'] == "Test Tunnel"
25+
- test_one['tunnel']['status'] == "active"
26+
- test_one['tunnel']['encapsulation'] == "ipsec-tunnel"
27+
- test_one['msg'] == "tunnel Test Tunnel created"
28+
29+
- name: "TUNNEL 2: Create duplicate"
30+
netbox.netbox.netbox_tunnel:
31+
netbox_url: http://localhost:32768
32+
netbox_token: "0123456789abcdef0123456789abcdef01234567"
33+
data:
34+
name: Test Tunnel
35+
status: active
36+
encapsulation: ipsec-tunnel
37+
state: present
38+
register: test_two
39+
40+
- name: "TUNNEL 2: ASSERT - Create duplicate"
41+
ansible.builtin.assert:
42+
that:
43+
- not test_two['changed']
44+
- test_two['tunnel']['name'] == "Test Tunnel"
45+
- test_two['tunnel']['status'] == "active"
46+
- test_two['tunnel']['encapsulation'] == "ipsec-tunnel"
47+
- test_two['msg'] == "tunnel Test Tunnel already exists"
48+
49+
- name: "TUNNEL 3: Update Existing"
50+
netbox.netbox.netbox_tunnel:
51+
netbox_url: http://localhost:32768
52+
netbox_token: "0123456789abcdef0123456789abcdef01234567"
53+
data:
54+
name: Test Tunnel
55+
description: Test Description
56+
tenant: Test Tenant
57+
tunnel_id: 200
58+
tags:
59+
- Schnozzberry
60+
state: present
61+
register: test_three
62+
63+
- name: "TUNNEL: ASSERT - Updated"
64+
ansible.builtin.assert:
65+
that:
66+
- test_three is changed
67+
- test_three['diff']['after']['description'] == "Test Description"
68+
- test_three['diff']['after']['tenant'] == 1
69+
- test_three['diff']['after']['tunnel_id'] == 200
70+
- test_three['diff']['after']['tags'][0] == 4
71+
- test_three['tunnel']['name'] == "Test Tunnel"
72+
- test_three['tunnel']['tenant'] == 1
73+
- test_three['tunnel']['tunnel_id'] == 200
74+
- test_three['tunnel']['description'] == "Test Description"
75+
- test_three['tunnel']['tags'][0] == 4
76+
- test_three['msg'] == "tunnel Test Tunnel updated"
77+
78+
- name: "TUNNEL 4: Delete"
79+
netbox.netbox.netbox_tunnel:
80+
netbox_url: http://localhost:32768
81+
netbox_token: "0123456789abcdef0123456789abcdef01234567"
82+
data:
83+
name: Test Tunnel
84+
state: absent
85+
register: test_four
86+
87+
- name: "TUNNEL 4: ASSERT - Delete"
88+
ansible.builtin.assert:
89+
that:
90+
- test_four is changed
91+
- test_four['diff']['before']['state'] == "present"
92+
- test_four['diff']['after']['state'] == "absent"
93+
- test_four['msg'] == "tunnel Test Tunnel deleted"

tests/integration/targets/v4.0/tasks/main.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,3 +328,12 @@
328328
ansible.builtin.include_tasks: netbox_virtual_disk.yml
329329
tags:
330330
- netbox_virtual_disk
331+
332+
- name: NETBOX_TUNNEL TESTS
333+
ansible.builtin.include_tasks:
334+
file: netbox_tunnel.yml
335+
apply:
336+
tags:
337+
- netbox_tunnel
338+
tags:
339+
- netbox_tunnel

0 commit comments

Comments
 (0)