This repository was archived by the owner on Apr 20, 2021. It is now read-only.
File tree 14 files changed +38
-39
lines changed
module_utils/vyos/facts/interfaces
14 files changed +38
-39
lines changed Original file line number Diff line number Diff line change
1
+ - job :
2
+ name : network-vyos-test
3
+ parent : ansible-network-vyos-base
4
+ run : tests/foo.yaml
5
+
6
+ - project :
7
+ check :
8
+ jobs :
9
+ - network-vyos-test
Original file line number Diff line number Diff line change 12
12
from ansible .module_utils . \
13
13
vyos .facts .base import FactsBase
14
14
from re import findall , M
15
- import q
15
+
16
16
17
17
class InterfacesFacts (FactsBase ):
18
18
""" The vyos interfaces fact class
Original file line number Diff line number Diff line change
1
+ ansible >= 2.4.0
Original file line number Diff line number Diff line change
1
+ ara
1
2
flake8
2
3
yamllint
Original file line number Diff line number Diff line change
1
+ [defaults]
2
+ callback_whitelist = profile_tasks, timer
3
+ retry_files_enabled = false
4
+ roles_path = ../..
5
+ stdout_callback = yaml
6
+
7
+ [ssh_connection]
8
+ pipelining = true
Original file line number Diff line number Diff line change
1
+ - hosts : controller
2
+ tasks :
3
+ - name : Bootstrap tox environment
4
+ args :
5
+ chdir : ~/src/github.com/ansible/network
6
+ shell : tox -v -evenv --notest
7
+
8
+ - name : Run ansible tests
9
+ args :
10
+ chdir : ~/src/github.com/ansible/network
11
+ shell : tox -evenv -- ansible-playbook -v -c network_cli tests/vyos/modules/interfaces/main.yaml
Original file line number Diff line number Diff line change 8
8
vyos_interfaces : &deleted
9
9
config :
10
10
- name : eth1
11
-
12
- - name : eth2
13
11
state : deleted
14
12
register : result
15
13
21
19
- " 'delete interfaces ethernet {{ intf }} mtu' in result.commands"
22
20
loop :
23
21
- eth1
24
- - eth2
25
22
loop_control :
26
23
loop_var : intf
27
24
Original file line number Diff line number Diff line change 1
1
---
2
2
- hosts : appliance
3
3
gather_facts : true
4
- gather_subset :
5
- - net_configuration_interfaces
6
4
tasks :
7
5
- import_role :
8
- name : ~/collections/ network
6
+ name : network
9
7
10
8
- include_tasks : " {{ item }}.yaml"
11
9
loop :
Original file line number Diff line number Diff line change 13
13
speed : auto
14
14
duplex : auto
15
15
16
- - name : eth2
17
- description : " Configured by Ansible - Interface 2 (ADMIN DOWN)"
18
- mtu : 600
19
- enable : false
20
-
21
- - name : eth3
22
- description : " Configured by Ansible - Interface 3"
23
- speed : 100
24
- duplex : full
25
16
state : merged
26
17
register : result
27
18
34
25
- " 'set interfaces ethernet eth1 mtu \\ '1200\\ '' in result.commands"
35
26
- " 'set interfaces ethernet eth1 duplex \\ 'auto\\ '' in result.commands"
36
27
- " 'set interfaces ethernet eth1 speed \\ 'auto\\ '' in result.commands"
37
- - " 'set interfaces ethernet eth2 description \\ 'Configured by Ansible - Interface 2 (ADMIN DOWN)\\ '' in result.commands"
38
- - " 'set interfaces ethernet eth2 mtu \\ '600\\ '' in result.commands"
39
- - " 'set interfaces ethernet eth2 disable' in result.commands"
40
- - " 'set interfaces ethernet eth3 description \\ 'Configured by Ansible - Interface 3\\ '' in result.commands"
41
- - " 'set interfaces ethernet eth3 speed \\ '100\\ '' in result.commands"
42
- - " 'set interfaces ethernet eth3 duplex \\ 'full\\ '' in result.commands"
43
28
44
29
- name : Merge the provided configuration with the existing running configuration (IDEMPOTENT)
45
30
vyos_interfaces : *merged
Original file line number Diff line number Diff line change 7
7
- name : Overrides all device configuration with provided configuration
8
8
vyos_interfaces : &overridden
9
9
config :
10
- - name : eth2
10
+ - name : eth1
11
11
description : " Overridden by Ansible"
12
12
mtu : 1500
13
13
state : overridden
19
19
- " 'delete interfaces ethernet {{ item }} speed' in result.commands"
20
20
- " 'delete interfaces ethernet {{ item }} duplex' in result.commands"
21
21
- " 'delete interfaces ethernet {{ item }} mtu' in result.commands"
22
- - " 'set interfaces ethernet eth2 description \\ 'Overridden by Ansible\\ '' in result.commands"
23
- - " 'set interfaces ethernet eth2 mtu \\ '1500\\ '' in result.commands"
24
22
loop :
25
23
- eth1
26
- - eth3
27
24
28
25
- name : Overrides all device configuration with provided configurations (IDEMPOTENT)
29
26
vyos_interfaces : *overridden
Original file line number Diff line number Diff line change 10
10
set interfaces ethernet "{{ intf }}" mtu '1200'
11
11
loop :
12
12
- eth1
13
- - eth2
14
- - eth3
15
13
loop_control :
16
14
loop_var : intf
Original file line number Diff line number Diff line change 11
11
delete interfaces ethernet "{{ intf }}" disable
12
12
loop :
13
13
- eth1
14
- - eth2
15
- - eth3
16
14
loop_control :
17
15
loop_var : intf
Original file line number Diff line number Diff line change 9
9
config :
10
10
- name : eth1
11
11
description : " Replaced by Ansible"
12
-
13
- - name : eth2
14
- mtu : 1500
15
- description : " Replaced by Ansible"
16
12
state : replaced
17
13
register : result
18
14
22
18
- " 'delete interfaces ethernet eth1 speed' in result.commands"
23
19
- " 'delete interfaces ethernet eth1 duplex' in result.commands"
24
20
- " 'set interfaces ethernet eth1 description \\ 'Replaced by Ansible\\ '' in result.commands"
25
- - " 'set interfaces ethernet eth2 mtu \\ '1500\\ '' in result.commands"
26
- - " 'delete interfaces ethernet eth2 speed' in result.commands"
27
- - " 'delete interfaces ethernet eth2 duplex' in result.commands"
28
- - " 'set interfaces ethernet eth2 description \\ 'Replaced by Ansible\\ '' in result.commands"
29
21
30
22
- name : Replace device configurations of listed interfaces with provided configurarions
31
23
vyos_interfaces : *replaced
Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ envlist = linters
6
6
[testenv]
7
7
basepython = python3
8
8
install_command = pip install {opts} {packages}
9
- deps = -r{toxinidir}/test-requirements.txt
9
+ deps = -r{toxinidir}/requirements.txt
10
+ -r{toxinidir}/test-requirements.txt
10
11
11
12
[testenv:linters]
12
13
basepython = python3
@@ -15,6 +16,9 @@ commands =
15
16
flake8 {posargs}
16
17
17
18
[testenv:venv]
19
+ setenv =
20
+ ANSIBLE_CONFIG = {toxinidir}/tests/ansible.cfg
21
+ ANSIBLE_CALLBACK_PLUGINS = {envsitepackagesdir}/ara/plugins/callbacks
18
22
basepython = python3
19
23
commands = {posargs}
20
24
You can’t perform that action at this time.
0 commit comments