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.
Merge pull request ansible-network#78 from trishnaguha/vlan_filter_pl…
…ugin Add vlan_expand, vlan_compress filter plugins
- Loading branch information
Showing
13 changed files
with
156 additions
and
1 deletion.
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
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,5 @@ | ||
new_filter_plugins: | ||
- New filter plugin ``interface_range`` | ||
- New filter plugin ``interface_split`` | ||
- New filter plugin ``vlan_compress`` | ||
- New filter plugin ``vlan_expand`` |
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 @@ | ||
new_lookup_plugins: | ||
- New lookup plugin ``json_template`` | ||
- New lookup plugin ``network_template`` |
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
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: | ||
- vlan_compress |
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 |
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: vlan_compress test | ||
import_tasks: vlan_compress.yaml |
35 changes: 35 additions & 0 deletions
35
tests/vlan_compress/vlan_compress/tasks/vlan_compress.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,35 @@ | ||
- name: vlan_compress single vlan | ||
debug: | ||
msg: "{{ [1] | vlan_compress }}" | ||
register: result | ||
|
||
- assert: | ||
that: | ||
- "'1' in result.msg" | ||
|
||
- name: vlan_compress list of vlans1 | ||
debug: | ||
msg: "{{ [1,2,3,4,5] | vlan_compress }}" | ||
register: result | ||
|
||
- assert: | ||
that: | ||
- "'1-5' in result.msg" | ||
|
||
- name: vlan_compress list of vlans2 | ||
debug: | ||
msg: "{{ [1,2,3,5] | vlan_compress }}" | ||
register: result | ||
|
||
- assert: | ||
that: | ||
- "'1-3,5' in result.msg" | ||
|
||
- name: vlan_compress list of vlans3 | ||
debug: | ||
msg: "{{ [1,2,4,5,6] | vlan_compress }}" | ||
register: result | ||
|
||
- assert: | ||
that: | ||
- "'1-2,4-6' 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,4 @@ | ||
- hosts: localhost | ||
connection: local | ||
roles: | ||
- vlan_expand |
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 |
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: vlan_expand test | ||
import_tasks: vlan_expand.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: vlan_expand single vlan | ||
debug: | ||
msg: "{{ 'vlan1' | vlan_expand }}" | ||
register: result | ||
|
||
- assert: | ||
that: | ||
- "'1' in result.msg" | ||
|
||
- name: vlan_expand range of vlans1 | ||
debug: | ||
msg: "{{ 'vlan1-5' | vlan_expand }}" | ||
register: result | ||
|
||
- assert: | ||
that: | ||
- "'1' in result.msg" | ||
- "'2' in result.msg" | ||
- "'3' in result.msg" | ||
- "'4' in result.msg" | ||
- "'5' in result.msg" | ||
|
||
- name: vlan_expand range of vlans2 | ||
debug: | ||
msg: "{{ 'vlan1,3-5,7' | vlan_expand }}" | ||
register: result | ||
|
||
- assert: | ||
that: | ||
- "'1' in result.msg" | ||
- "'3' in result.msg" | ||
- "'4' in result.msg" | ||
- "'5' in result.msg" | ||
- "'7' in result.msg" |