Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integration workflow for iosxr #526

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: Integration
on:
pull_request_target:
branches: [main]
types:
- labeled
- opened
- reopened
- synchronize
paths:
- "plugins/**"
- "tests/integration/**"
workflow_dispatch:

jobs:
safe-to-test:
if: >-
github.event.label.name == 'safe to test' ||
github.event.action != 'labeled'
uses: ansible-network/github_actions/.github/workflows/safe-to-test.yml@main
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

integration:
uses: ansible/ansible-content-actions/.github/workflows/network_integration.yaml@main
needs:
- safe-to-test
with:
lab_title: cisco_iosxr
network_os: cisco.iosxr.iosxr
pytest_addopts: "--color=yes -n 2 --log-level WARNING -vvv"
collection_pre_install: >-
git+https://github.com/ansible-collections/ansible.utils.git
git+https://github.com/ansible-collections/ansible.netcommon.git
secrets:
cml_ssh_password: ${{ secrets.CML_SSH_PASSWORD }}
virl_host: ${{ secrets.VIRL_HOST }}
virl_password: ${{ secrets.VIRL_PASSWORD }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,4 @@ tests/units/.coverage.*
/SYMLINK_CACHE.json
changelogs/.plugin-cache.yaml
.ansible-test-timeout.json
.env
Empty file added tests/integration/__init__.py
Empty file.
119 changes: 119 additions & 0 deletions tests/integration/labs/single.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
---
lab:
description: ""
notes: ""
title: cisco.iosxr.iosxr
version: 0.2.2
links:
- id: l0
n1: n0
n2: n1
i1: i0
i2: i1
conditioning: {}
label: ext-conn-0-port<->xr9kv-0-MgmtEth0/RP0/CPU0/0
annotations: []
nodes:
- boot_disk_size: null
configuration: []
cpu_limit: null
cpus: null
data_volume: null
hide_links: false
id: n0
image_definition: null
label: ext-conn-0
node_definition: external_connector
parameters: {}
ram: null
tags: []
x: -440
y: 0
interfaces:
- id: i0
label: port
slot: 0
type: physical
- boot_disk_size: null
configuration: |2-
hostname iosxr
domain name ansible.com
username ansible
group root-lr
group cisco-support
secret 10 $6$Z9Luu1mZiydfDu1.$bG2UOKkX0dWR3C//DW3YMYeF3VktNkQIxvEV5ndAyBi4bDUZImvEPK.alEoccyv5N7yui2NmgBrzkI4EM1rx9/
password 7 14161C180506262E
!
aaa authentication login default local
cdp
line default
login authentication default
transport input ssh
!
call-home
service active
contact smart-licensing
profile CiscoTAC-1
active
destination transport-method email disable
destination transport-method http
!
!
control-plane
management-plane
inband
interface all
allow all
allow SSH
!
!
!
!
interface MgmtEth0/RP0/CPU0/0
ipv4 address dhcp
!
interface GigabitEthernet0/0/0/0
shutdown
!
router static
address-family ipv4 unicast
0.0.0.0/0 192.168.255.1
!
!
ssh timeout 60
ssh server v2
commit
end
cpu_limit: null
cpus: null
data_volume: null
hide_links: false
id: n1
image_definition: null
label: xr9kv-0
node_definition: iosxrv9000
parameters: {}
ram: null
tags: []
x: -160
y: 0
interfaces:
- id: i0
label: Loopback0
type: loopback
- id: i1
label: MgmtEth0/RP0/CPU0/0
slot: 0
type: physical
- id: i2
label: GigabitEthernet0/0/0/2
slot: 1
type: physical
- id: i3
label: GigabitEthernet0/0/0/1
slot: 2
type: physical
- id: i4
label: GigabitEthernet0/0/0/0
slot: 3
type: physical
4 changes: 4 additions & 0 deletions tests/integration/network-integration.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[persistent_connection]
command_timeout = 100
connect_timeout = 100
connect_retry_timeout = 100
41 changes: 41 additions & 0 deletions tests/integration/test_integration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import subprocess

import pytest


def run(ansible_project, environment):
__tracebackhide__ = True
args = [
"ansible-navigator",
"run",
str(ansible_project.playbook),
"-i",
str(ansible_project.inventory),
"--ee",
"false",
"--mode",
"stdout",
"--pas",
str(ansible_project.playbook_artifact),
"--ll",
"debug",
"--lf",
str(ansible_project.log_file),
]
process = subprocess.run(
args=args,
env=environment,
stderr=subprocess.PIPE,
stdout=subprocess.PIPE,
check=False,
shell=False,
)
if process.returncode:
print(process.stdout.decode("utf-8"))
print(process.stderr.decode("utf-8"))

pytest.fail(reason=f"Integration test failed: {ansible_project.role}")


def test_integration(ansible_project, environment):
run(ansible_project, environment)
Loading