Skip to content

Commit

Permalink
Merge pull request #32 from h4ndzdatm0ld/develop
Browse files Browse the repository at this point in the history
Version Bump
  • Loading branch information
h4ndzdatm0ld authored Feb 8, 2022
2 parents d60c5e8 + 62daafe commit fa99a65
Show file tree
Hide file tree
Showing 18 changed files with 294 additions and 193 deletions.
23 changes: 23 additions & 0 deletions .clab-topo-netconf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: "clab-topo-netconf.yml"

mgmt:
network: "nornir-netconf-testing" # management network name
ipv4_subnet: "172.100.100.0/24" # ipv4 range
topology:
kinds:
vr-xrv: # clab/clab@123
image: "h4ndzdatm0ld/vr-xrv:6.1.3"
vr-sros:
image: "h4ndzdatm0ld/sros:latest"
nodes:
xrv-p1:
kind: "vr-xrv"
mgmt_ipv4: "172.100.100.11"
sros-p2:
kind: "vr-sros"
mgmt_ipv4: "172.100.100.12"
links:
# p1 XR port 1 is connected to p2 SROS port 1
- endpoints: ["xrv-p1:eth1", "sros-p2:eth1"]

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,7 @@ tests/stubs/*.pyi

# Docs
docs/README.md

# containerlab
*.clab-topo-netconf.yaml
*clab-topo-netconf.yml/*
2 changes: 2 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ rules:

ignore: |
.github/
clab-clab-topo-netconf.yml/
.clab-topo-netconf.yaml
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,17 +317,16 @@ pytest --cov=nornir_netconf --color=yes --disable-pytest-warnings -vvv

### Integration Tests

Devices with full integration tests (Eve-NG)
Devices with full integration tests (ContainerLab)

* Nokia SROS - TiMOS-C -20.5.R2
* Cisco IOSxR - 6.3.1
* Nokia SROS - TiMOS-B-21.2.R1
* Cisco IOSxR - Cisco IOS XR Software, Version 6.1.3

Devices testing against Always-ON Sandboxes (Cisco DevNet)

* ios-xe - Cisco IOS XE Software, Version 17.03.01a
* ios-xr - ( Pending )
* Cisco IOS-XE - Cisco IOS XE Software, Version 17.03.01a

These tests are ran locally against an EVE-NG environment. At the moment, there is no solution to run these integration tests within the Github Actions CI.
These tests are ran locally, and will soon be integrated into Github CI.

### Sysrepo: netopeer2

Expand Down
10 changes: 10 additions & 0 deletions clab-clab-topo-netconf.yml/ansible-inventory.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
all:
children:
vr-sros:
hosts:
clab-clab-topo-netconf.yml-sros-p2:
ansible_host: 172.100.100.12
vr-xrv:
hosts:
clab-clab-topo-netconf.yml-xrv-p1:
ansible_host: 172.100.100.11
1 change: 1 addition & 0 deletions clab-clab-topo-netconf.yml/authorized_keys
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

22 changes: 22 additions & 0 deletions clab-topo-netconf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: "clab-topo-netconf.yml"

mgmt:
network: "nornir-netconf-testing" # management network name
ipv4_subnet: "172.100.100.0/24" # ipv4 range
topology:
kinds:
vr-xrv: # clab/clab@123
image: "h4ndzdatm0ld/vr-xrv:6.1.3"
vr-sros:
image: "h4ndzdatm0ld/sros:latest"
nodes:
xrv-p1:
kind: "vr-xrv"
mgmt_ipv4: "172.100.100.11"
sros-p2:
kind: "vr-sros"
mgmt_ipv4: "172.100.100.12"
links:
# p1 XR port 1 is connected to p2 SROS port 1
- endpoints: ["xrv-p1:eth1", "sros-p2:eth1"]
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,19 @@ services:
- "netconf1"
# volumes:
# - "./:/usr/src/app"
clab:
image: "ghcr.io/srl-labs/clab"
network_mode: "host"
working_dir: "/src"
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "/var/run/netns:/var/run/netns"
- "/etc/hosts:/etc/hosts"
- "./:/src"
- "./clab-topo-netconf.yml:/src/clab-topo-netconf.yml"
pid: "host"
command: "containerlab deploy -t clab-topo-netconf.yml"
# If you want to destroy the lab, ovveride the command while executing docker-compose service
# docker-compose run clab containerlab destroy -t clab-topo-netconf.yml
privileged: true
tty: true
23 changes: 22 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.0.0] - 2021-01-17
[Unreleased]

### Added

- Github CI Integration tests with ContainerLab

## [1.0.1] - 2022-02-08

### Added

- Local integration tests with ContainerLab

### Changed

- Lowered requirement version for `ncclient`

### Fixed

- Several integration tests are OS versions changed from previous eve-ng lab

## [1.0.0] - 2022-01-17

### Changed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def netconf_edit_config(
manager = task.host.get_connection(CONNECTION_NAME, task.nornir.config)
if target in ["candidate", "startup"]:
capabilities = list(manager.server_capabilities)
print(capabilities)
if not check_capability(capabilities, target):
raise ValueError(f"{target} datastore is not supported.")
result = manager.edit_config(config, target=target, default_operation=default_operation)
Expand Down
342 changes: 173 additions & 169 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "nornir_netconf"
version = "1.0.0"
version = "1.0.1"
description = "Netconf plugin for nornir using ncclient"
authors = ["Hugo Tinoco <[email protected]>", "Patrick Ogenstad <[email protected]>"]
license = "Apache-2.0"
Expand All @@ -17,7 +17,7 @@ packages = [

[tool.poetry.dependencies]
python = "^3.7.0"
ncclient = "^0.6.12"
ncclient = "^0.6.9"
xmltodict = "^0.12.0"
nornir = {version = "^3.0.0", allow-prereleases = true}

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/cisco_iosxr/test_iosxr_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_iosxr_netconf_get(nornir):
result = nr.run(netconf_get, filter_type="subtree", path=filter, xmldict=True)
assert result[DEVICE_NAME].result
assert result[DEVICE_NAME].result["rpc"].data_xml
assert result[DEVICE_NAME].result["xml_dict"]["data"]["interfaces"]["interface"][0]["state"]["enabled"]
assert result[DEVICE_NAME].result["xml_dict"]["data"]["interfaces"]["interface"]["config"]["enabled"]


@skip_integration_tests
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/iosxe/test_iosxe_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ def test_iosxe_netconf_get_config(nornir):
filter_type="subtree",
xmldict=True,
)
assert (
"Welcome to the DevNet Sandbox"
in result[DEVICE_NAME].result["xml_dict"]["data"]["native"]["banner"]["motd"]["banner"]
)
# assert (
# "Welcome to the DevNet Sandbox"
# in result[DEVICE_NAME].result["xml_dict"]["data"]["native"]["banner"]["motd"]["banner"]
# )
assert result[DEVICE_NAME].result["rpc"]
assert result[DEVICE_NAME].result["rpc"].data_xml
# with open("tests/test_data/get-iosxe-config-filter.xml", "w+") as file:
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/nokia_sros/test_sros_netconf_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
def test_netconf_capabilities_get_schema(nornir, schema_path):
"""Test NETCONF Capabilities + Get Schemas success."""
nr = nornir.filter(name="nokia_rtr")
result = nr.run(netconf_get_schemas, schemas=["nokia-conf-aaa"], schema_path=schema_path)
assert result["nokia_rtr"].result["log"][0] == "tests/test_data/schema_path/nokia-conf-aaa.txt created."
result = nr.run(netconf_get_schemas, schemas=["nokia-bof-state"], schema_path=schema_path)
assert result["nokia_rtr"].result["log"][0] == "tests/test_data/schema_path/nokia-bof-state.txt created."
assert not result["nokia_rtr"].result["errors"]


Expand All @@ -17,5 +17,5 @@ def test_netconf_capabilities_get_schema_errors(nornir, schema_path):
"""Test NETCONF Capabilities + Get Schemas unrecognized schema name."""
nr = nornir.filter(name="nokia_rtr")
result = nr.run(netconf_get_schemas, schemas=["nokia-conf-aaa", "ok"], schema_path=schema_path)
assert result["nokia_rtr"].result["log"][0] == "tests/test_data/schema_path/nokia-conf-aaa.txt created."
assert not result["nokia_rtr"].result["log"]
assert result["nokia_rtr"].result["errors"][0] == "MINOR: MGMT_CORE #2301: Invalid element value"
8 changes: 4 additions & 4 deletions tests/inventory_data/groups.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ netconf_docker_nossh:
ssh_config: null

sros:
username: "netconf"
password: "NCadmin123"
username: "admin"
password: "admin"
port: 830
platform: "sros"
connection_options:
Expand All @@ -50,8 +50,8 @@ sros:
look_for_keys: false

iosxr:
username: "netconf"
password: "NCadmin123"
username: "clab"
password: "clab@123"
port: 830
platform: "iosxr"
connection_options:
Expand Down
4 changes: 2 additions & 2 deletions tests/inventory_data/hosts-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ netconf4:
groups:
- "netconf_docker_nossh"
nokia_rtr:
hostname: "192.168.1.205"
hostname: "172.100.100.12"
port: 830
groups:
- "sros"
iosxr_rtr:
hostname: "192.168.1.187"
hostname: "172.100.100.11"
port: 830
groups:
- "iosxr"
Expand Down
Empty file modified tests/test_data/test_folder/file-name.txt
100755 → 100644
Empty file.

0 comments on commit fa99a65

Please sign in to comment.