pyATS Server
Overview
This project provides a FastAPI server interface for AI agents and systems to interact with network devices via pyATS. Interactions are carried out over HTTP.
Note
This project is a proof-of-concept, so I won't be adding new features on request. If you need more functionality, feel free to fork the repo.
Features
- Retrieve device health data (memory, CPU, logging).
- Obtain interface details and configuration.
- Currently supports only IOS-XE functions.
Setup
Add your network devices by placing your pyats_testbed.yaml file in the config directory. A default testbed is available. Update the TESTBED_FILE variable if you use a different filename.
The env var PYATS_SERVER_PORT set the port the pyATS server will listen to. Defaults to 57000.
Run
You can run directly on your shell or using a container.
Option 1. Container Based
Start the container
make container-run
Stop the container
make stop-container
Option 2. Shell based
Install dependencies:
pip install -r requirements.txt
Run the server using one of the following commands:
make run
API Endpoints
See the endpoints in the OAD client at http://<IP_SERVER>:<PYATS_SERVER_PORT>/docs or the docstrings in the source code under the pyats_connector/api directory.
Endpoints:
GET /health/memoryGET /health/cpuGET /health/loggingGET /interface/running-configGET /interfaces/status-and-descriptionGET /interfaces/statusGET /interface/detailed-statusGET /interface/informationGET /interface/admin-statusGET /interface/verify-state-upGET /interface/eventsGET /devices/listGET /isis/neighborsGET /isis/interface-eventsGET /isis/interface-informationGET /vrf/presentGET /interface/interfaces-under-vrfGET /routing/routesPATCH /interface/shutPATCH /interface/unshut
Additional Information
- Use the provided
pyats_server.jsonfor client code generation. - For testing pyATS functions independently of the API layer, see the comments in tests/README.md.