forked from ansible-network/network-engine
-
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.
add interface_split and interface_range filter plugin tests (ansible-…
…network#92) Signed-off-by: Trishna Guha <[email protected]>
- Loading branch information
1 parent
a344ce3
commit 3ede6d7
Showing
9 changed files
with
83 additions
and
0 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 @@ | ||
--- | ||
dependencies: | ||
- ../../../network-engine |
34 changes: 34 additions & 0 deletions
34
tests/interface_range/interface_range/tasks/interface_range.yaml
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,34 @@ | ||
- name: interface_range Ethernet1-3 | ||
debug: | ||
msg: "{{ 'Ethernet1-3' | interface_range }}" | ||
register: result | ||
|
||
- assert: | ||
that: | ||
- "'Ethernet1' in result.msg" | ||
- "'Ethernet2' in result.msg" | ||
- "'Ethernet3' in result.msg" | ||
|
||
- name: interface_range Ethernet1,3-4,5 | ||
debug: | ||
msg: "{{ 'Ethernet1,3-4,5' | interface_range }}" | ||
register: result | ||
|
||
- assert: | ||
that: | ||
- "'Ethernet1' in result.msg" | ||
- "'Ethernet3' in result.msg" | ||
- "'Ethernet4' in result.msg" | ||
- "'Ethernet5' in result.msg" | ||
|
||
- name: interface_range Ethernet1/3-5,8 | ||
debug: | ||
msg: "{{ 'Ethernet1/3-5,8' | interface_range }}" | ||
register: result | ||
|
||
- assert: | ||
that: | ||
- "'Ethernet1/3' in result.msg" | ||
- "'Ethernet1/4' in result.msg" | ||
- "'Ethernet1/5' in result.msg" | ||
- "'Ethernet1/8' in result.msg" |
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: interface_range test | ||
import_tasks: interface_range.yaml |
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,4 @@ | ||
- hosts: localhost | ||
connection: local | ||
roles: | ||
- interface_range |
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: | ||
- ../../../network-engine |
27 changes: 27 additions & 0 deletions
27
tests/interface_split/interface_split/tasks/interface_split.yaml
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,27 @@ | ||
- name: interface_split Ethernet1 | ||
debug: | ||
msg: "{{ 'Ethernet1' | interface_split }}" | ||
register: result | ||
|
||
- assert: | ||
that: | ||
- "'1' in result.msg.index" | ||
- "'Ethernet' in result.msg.name" | ||
|
||
- name: interface_split Ethernet1 name | ||
debug: | ||
msg: "{{ 'Ethernet1' | interface_split('name') }}" | ||
register: result | ||
|
||
- assert: | ||
that: | ||
- "'Ethernet' in result.msg" | ||
|
||
- name: interface_split Ethernet1 index | ||
debug: | ||
msg: "{{ 'Ethernet1' | interface_split('index') }}" | ||
register: result | ||
|
||
- assert: | ||
that: | ||
- "'1' in result.msg" |
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: interface_split test | ||
import_tasks: interface_split.yaml |
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,4 @@ | ||
- hosts: localhost | ||
connection: local | ||
roles: | ||
- interface_split |
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