Network Automation high level - Ansible + Pytest

 
Configure topology using
Ansible + jinja 2 templting



Test using Pytest


ospf-lab/
├── ansible/
│   ├── inventory.yml
│   ├── playbook.yml
│   ├── group_vars/
│   │   └── all.yml
│   ├── host_vars/
│   │   ├── r1.yml
│   │   ├── r2.yml
│   │   └── r3.yml
│   └── templates/
│       └── ospf.j2

├── tests/
│   ├── conftest.py
│   └── test_ospf.py

└── requirements.txt




Cli paramiko, netmiko 
Netconf ncclient
Restconf request
Gnmi pygnmi
Yang pyang


Traffic gen
Spirent & ixia - control plane
TRex - only data (open source)


pytest -v, pytest -s , --log-cli-level=INFO

#import logging 
try to use module 


Parser
Scenario
Parser Used
NETCONF
XML (lxml, ncclient)

REST API
JSON

gNMI
JSON / Protobuf

Cisco CLI
Genie / pyATS

Multi-vendor CLI
TextFSM

Ansible
TextFSM

Legacy devices
Regex (last option)


For SP Role
“SP networks prioritize model-driven automation using NETCONF and gNMI, with CLI reserved for exceptional troubleshooting.”
For Enterprise Role
“Enterprise automation is hybrid—Ansible for config, Pytest for validation, and CLI parsing where APIs are unavailable.”

Comments

Popular posts from this blog

gNMI_with_grafana on containerlabs

EVPN Route type-1 & type-4 in action

Network Automation with ROBOT Framework