Skip to content
This repository was archived by the owner on Apr 20, 2021. It is now read-only.

Commit 364df27

Browse files
committed
DNM: add zuul vyos testing
This is an example job to start testing vyos Depends-On: ansible/ansible-zuul-jobs#34 Depends-On: ansible/ansible#55589 Depends-On: ansible/ansible#55923 Signed-off-by: Paul Belanger <[email protected]>
1 parent 58b40c9 commit 364df27

File tree

12 files changed

+35
-16
lines changed

12 files changed

+35
-16
lines changed

.zuul.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
- job:
2+
name: network-vyos-test
3+
parent: ansible-network-vyos-base
4+
run: tests/foo.yaml
5+
required-projects:
6+
- name: github.com/ansible/ansible
7+
8+
- project:
9+
check:
10+
jobs:
11+
- network-vyos-test

module_utils/vyos/facts/interfaces/interfaces.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from ansible.module_utils. \
1313
vyos.facts.base import FactsBase
1414
from re import findall, M
15-
import q
15+
1616

1717
class InterfacesFacts(FactsBase):
1818
""" The vyos interfaces fact class

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ansible>=2.4.0

test-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
ara
12
flake8
23
yamllint

tests/ansible.cfg

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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

tests/foo.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
- hosts: controller
2+
tasks:
3+
- name: Setup tox role
4+
include_role:
5+
name: tox
6+
vars:
7+
tox_extra_args: -- ansible-playbook -v -c network_cli tests/vyos/modules/interfaces/main.yaml

tests/vyos/modules/interfaces/main.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
---
22
- hosts: appliance
33
gather_facts: true
4-
gather_subset:
5-
- net_configuration_interfaces
64
tasks:
75
- import_role:
8-
name: ~/collections/network
6+
name: network
97

108
- include_tasks: "{{ item }}.yaml"
119
loop:

tests/vyos/modules/interfaces/merged.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@
1717
description: "Configured by Ansible - Interface 2 (ADMIN DOWN)"
1818
mtu: 600
1919
enable: false
20-
21-
- name: eth3
22-
description: "Configured by Ansible - Interface 3"
23-
speed: 100
24-
duplex: full
2520
state: merged
2621
register: result
2722

@@ -37,9 +32,6 @@
3732
- "'set interfaces ethernet eth2 description \\'Configured by Ansible - Interface 2 (ADMIN DOWN)\\'' in result.commands"
3833
- "'set interfaces ethernet eth2 mtu \\'600\\'' in result.commands"
3934
- "'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"
4335

4436
- name: Merge the provided configuration with the existing running configuration (IDEMPOTENT)
4537
vyos_interfaces: *merged

tests/vyos/modules/interfaces/overridden.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
- "'set interfaces ethernet eth2 mtu \\'1500\\'' in result.commands"
2424
loop:
2525
- eth1
26-
- eth3
2726

2827
- name: Overrides all device configuration with provided configurations (IDEMPOTENT)
2928
vyos_interfaces: *overridden

tests/vyos/modules/interfaces/populate.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@
1111
loop:
1212
- eth1
1313
- eth2
14-
- eth3
1514
loop_control:
1615
loop_var: intf

tests/vyos/modules/interfaces/remove_config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,5 @@
1212
loop:
1313
- eth1
1414
- eth2
15-
- eth3
1615
loop_control:
1716
loop_var: intf

tox.ini

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ envlist = linters
66
[testenv]
77
basepython = python3
88
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
1011

1112
[testenv:linters]
1213
basepython = python3
@@ -15,6 +16,9 @@ commands =
1516
flake8 {posargs}
1617

1718
[testenv:venv]
19+
setenv =
20+
ANSIBLE_CONFIG = {toxinidir}/tests/ansible.cfg
21+
ANSIBLE_CALLBACK_PLUGINS = {envsitepackagesdir}/ara/plugins/callbacks
1822
basepython = python3
1923
commands = {posargs}
2024

0 commit comments

Comments
 (0)