# aruba/pyaoscx architecture

> Architecture diagram of the GitHub repository aruba/pyaoscx, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aruba/pyaoscx
- Repository: https://github.com/aruba/pyaoscx

## Overview

pyaoscx is a Python client library for managing AOS-CX switches through their REST API. The principal workflow is: an application or workflow establishes a session, obtains resource objects, reads or changes switch configuration, and applies those changes to the device. Resource modules cover interfaces, VLANs, VRFs, routing, ACLs, and other network features; workflows combine these lower-level operations into larger configuration tasks. The README documents the layering, while several subsystem relationships below are based on the source index rather than inspected implementations.

Main entry points: [`pyaoscx/interface.py`](https://github.com/aruba/pyaoscx/blob/master/pyaoscx/interface.py) (Interfaces), [`pyaoscx/vrf.py`](https://github.com/aruba/pyaoscx/blob/master/pyaoscx/vrf.py) (Virtual routing), [`workflows/workflow.py`](https://github.com/aruba/pyaoscx/blob/master/workflows/workflow.py) (Workflow operations), [`pyaoscx/api.py`](https://github.com/aruba/pyaoscx/blob/master/pyaoscx/api.py) (API selection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_connection["Connection and REST"]
  node_session["Device session<br/>[session.py]"]
  node_api["API selection<br/>[api.py]"]
  node_restv1["REST v1<br/>[api.py]"]
  node_rest1004["REST v10.04<br/>[api.py]"]
  node_rest1008["REST v10.08<br/>[api.py]"]
  node_rest1009["REST v10.09<br/>[api.py]"]
end

subgraph group_resources["Switch Resources"]
  node_factory["Resource factory<br/>[pyaoscx_factory.py]"]
  node_module["Resource base behavior<br/>[pyaoscx_module.py]"]
  node_device["Device operations<br/>[device.py]"]
  node_interface["Interfaces<br/>[interface.py]"]
  node_vlan["VLANs<br/>[vlan.py]"]
  node_ipv6["IPv6 addresses<br/>[ipv6.py]"]
  node_configuration["Configuration operations<br/>[configuration.py]"]
  node_utils["Shared utilities<br/>[util.py]"]
  node_attributes["List references<br/>[list_attributes.py]"]
end

subgraph group_routing["Routing and Policy"]
  node_acl["Access control lists<br/>[acl.py]"]
  node_vrf["Virtual routing<br/>[vrf.py]"]
  node_bgp["BGP routers<br/>[bgp_router.py]"]
  node_neighbor["BGP neighbors<br/>[bgp_neighbor.py]"]
  node_aggregate["BGP aggregates"]
  node_ospf["OSPF routers<br/>[ospf_router.py]"]
  node_area["OSPF areas<br/>[ospf_area.py]"]
  node_staticroute["Static routes<br/>[static_route.py]"]
end

subgraph group_workflows["Configuration Workflows"]
  node_workflow["Workflow operations<br/>[workflow.py]"]
end

node_operator(("Application or operator"))
node_switch{{"AOS-CX switch"}}

node_operator -->|"runs"| node_workflow
node_workflow -->|"opens session"| node_session
node_workflow -->|"obtains resources"| node_factory
node_workflow -->|"configures"| node_vlan
node_workflow -->|"configures"| node_interface
node_session -->|"uses API"| node_api
node_restv1 -->|"implements API"| node_api
node_rest1004 -->|"implements API"| node_api
node_rest1008 -->|"implements API"| node_api
node_rest1009 -->|"implements API"| node_api
node_session -->|"communicates with"| node_switch
node_factory -->|"uses"| node_configuration
node_factory -.->|"constructs"| node_device
node_interface -->|"loads"| node_ipv6
node_interface -->|"references"| node_vlan
node_interface -->|"references"| node_vrf
node_interface -->|"loads"| node_acl
node_vrf -->|"loads"| node_bgp
node_vrf -->|"loads"| node_ospf
node_vrf -->|"loads"| node_staticroute
node_bgp -->|"loads"| node_neighbor
node_bgp -->|"loads"| node_aggregate
node_ospf -->|"loads"| node_area
node_interface -->|"inherits behavior"| node_module
node_vrf -.->|"inherits behavior"| node_module
node_module -->|"uses"| node_utils
node_vlan -->|"uses"| node_attributes

click node_workflow "https://github.com/aruba/pyaoscx/blob/master/workflows/workflow.py"
click node_session "https://github.com/aruba/pyaoscx/blob/master/pyaoscx/session.py"
click node_api "https://github.com/aruba/pyaoscx/blob/master/pyaoscx/api.py"
click node_restv1 "https://github.com/aruba/pyaoscx/blob/master/pyaoscx/rest/v1/api.py"
click node_rest1004 "https://github.com/aruba/pyaoscx/blob/master/pyaoscx/rest/v10_04/api.py"
click node_rest1008 "https://github.com/aruba/pyaoscx/blob/master/pyaoscx/rest/v10_08/api.py"
click node_rest1009 "https://github.com/aruba/pyaoscx/blob/master/pyaoscx/rest/v10_09/api.py"
click node_factory "https://github.com/aruba/pyaoscx/blob/master/pyaoscx/pyaoscx_factory.py"
click node_module "https://github.com/aruba/pyaoscx/blob/master/pyaoscx/pyaoscx_module.py"
click node_device "https://github.com/aruba/pyaoscx/blob/master/pyaoscx/device.py"
click node_interface "https://github.com/aruba/pyaoscx/blob/master/pyaoscx/interface.py"
click node_vlan "https://github.com/aruba/pyaoscx/blob/master/pyaoscx/vlan.py"
click node_ipv6 "https://github.com/aruba/pyaoscx/blob/master/pyaoscx/ipv6.py"
click node_acl "https://github.com/aruba/pyaoscx/blob/master/pyaoscx/acl.py"
click node_vrf "https://github.com/aruba/pyaoscx/blob/master/pyaoscx/vrf.py"
click node_bgp "https://github.com/aruba/pyaoscx/blob/master/pyaoscx/bgp_router.py"
click node_neighbor "https://github.com/aruba/pyaoscx/blob/master/pyaoscx/bgp_neighbor.py"
click node_aggregate "https://github.com/aruba/pyaoscx/blob/master/pyaoscx/aggregate_address.py"
click node_ospf "https://github.com/aruba/pyaoscx/blob/master/pyaoscx/ospf_router.py"
click node_area "https://github.com/aruba/pyaoscx/blob/master/pyaoscx/ospf_area.py"
click node_staticroute "https://github.com/aruba/pyaoscx/blob/master/pyaoscx/static_route.py"
click node_configuration "https://github.com/aruba/pyaoscx/blob/master/pyaoscx/configuration.py"
click node_utils "https://github.com/aruba/pyaoscx/blob/master/pyaoscx/utils/util.py"
click node_attributes "https://github.com/aruba/pyaoscx/blob/master/pyaoscx/utils/list_attributes.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_session,node_api,node_restv1,node_rest1004,node_rest1008,node_rest1009 toneBlue
class node_factory,node_module,node_device,node_interface,node_vlan,node_ipv6,node_configuration,node_utils,node_attributes toneAmber
class node_acl,node_vrf,node_bgp,node_neighbor,node_aggregate,node_ospf,node_area,node_staticroute toneMint
class node_workflow toneRose
class node_operator,node_switch toneIndigo
```

## Components

### Connection and REST

- [Device session](https://github.com/aruba/pyaoscx/blob/master/pyaoscx/session.py): `pyaoscx/session.py`
- [API selection](https://github.com/aruba/pyaoscx/blob/master/pyaoscx/api.py): `pyaoscx/api.py`
- [REST v1](https://github.com/aruba/pyaoscx/blob/master/pyaoscx/rest/v1/api.py): `pyaoscx/rest/v1/api.py`
- [REST v10.04](https://github.com/aruba/pyaoscx/blob/master/pyaoscx/rest/v10_04/api.py): `pyaoscx/rest/v10_04/api.py`
- [REST v10.08](https://github.com/aruba/pyaoscx/blob/master/pyaoscx/rest/v10_08/api.py): `pyaoscx/rest/v10_08/api.py`
- [REST v10.09](https://github.com/aruba/pyaoscx/blob/master/pyaoscx/rest/v10_09/api.py): `pyaoscx/rest/v10_09/api.py`

### Switch Resources

- [Resource factory](https://github.com/aruba/pyaoscx/blob/master/pyaoscx/pyaoscx_factory.py): `pyaoscx/pyaoscx_factory.py`
- [Resource base behavior](https://github.com/aruba/pyaoscx/blob/master/pyaoscx/pyaoscx_module.py): `pyaoscx/pyaoscx_module.py`
- [Device operations](https://github.com/aruba/pyaoscx/blob/master/pyaoscx/device.py): `pyaoscx/device.py`
- [Interfaces](https://github.com/aruba/pyaoscx/blob/master/pyaoscx/interface.py): `pyaoscx/interface.py`
- [VLANs](https://github.com/aruba/pyaoscx/blob/master/pyaoscx/vlan.py): `pyaoscx/vlan.py`
- [IPv6 addresses](https://github.com/aruba/pyaoscx/blob/master/pyaoscx/ipv6.py): `pyaoscx/ipv6.py`
- [Configuration operations](https://github.com/aruba/pyaoscx/blob/master/pyaoscx/configuration.py): `pyaoscx/configuration.py`
- [Shared utilities](https://github.com/aruba/pyaoscx/blob/master/pyaoscx/utils/util.py): `pyaoscx/utils/util.py`
- [List references](https://github.com/aruba/pyaoscx/blob/master/pyaoscx/utils/list_attributes.py): `pyaoscx/utils/list_attributes.py`

### Routing and Policy

- [Access control lists](https://github.com/aruba/pyaoscx/blob/master/pyaoscx/acl.py): `pyaoscx/acl.py`
- [Virtual routing](https://github.com/aruba/pyaoscx/blob/master/pyaoscx/vrf.py): `pyaoscx/vrf.py`
- [BGP routers](https://github.com/aruba/pyaoscx/blob/master/pyaoscx/bgp_router.py): `pyaoscx/bgp_router.py`
- [BGP neighbors](https://github.com/aruba/pyaoscx/blob/master/pyaoscx/bgp_neighbor.py): `pyaoscx/bgp_neighbor.py`
- [BGP aggregates](https://github.com/aruba/pyaoscx/blob/master/pyaoscx/aggregate_address.py): `pyaoscx/aggregate_address.py`
- [OSPF routers](https://github.com/aruba/pyaoscx/blob/master/pyaoscx/ospf_router.py): `pyaoscx/ospf_router.py`
- [OSPF areas](https://github.com/aruba/pyaoscx/blob/master/pyaoscx/ospf_area.py): `pyaoscx/ospf_area.py`
- [Static routes](https://github.com/aruba/pyaoscx/blob/master/pyaoscx/static_route.py): `pyaoscx/static_route.py`

### Configuration Workflows

- [Workflow operations](https://github.com/aruba/pyaoscx/blob/master/workflows/workflow.py): `workflows/workflow.py`

### Other components

- **Application or operator**
- **AOS-CX switch**

## Connections

- Application or operator → Workflow operations: runs
- Workflow operations → Device session: opens session (evidence: `workflows/workflow.py`)
- Workflow operations → Resource factory: obtains resources (evidence: `workflows/workflow.py`)
- Workflow operations → VLANs: configures (evidence: `workflows/workflow.py`)
- Workflow operations → Interfaces: configures (evidence: `workflows/workflow.py`)
- Device session → API selection: uses API (evidence: `pyaoscx/session.py`)
- REST v1 → API selection: implements API (evidence: `pyaoscx/rest/v1/api.py`)
- REST v10.04 → API selection: implements API (evidence: `pyaoscx/rest/v10_04/api.py`)
- REST v10.08 → API selection: implements API (evidence: `pyaoscx/rest/v10_08/api.py`)
- REST v10.09 → API selection: implements API (evidence: `pyaoscx/rest/v10_09/api.py`)
- Device session → AOS-CX switch: communicates with (evidence: `pyaoscx/session.py`)
- Resource factory → Configuration operations: uses (evidence: `pyaoscx/pyaoscx_factory.py`)
- Resource factory → Device operations: constructs (evidence: `pyaoscx/device.py`)
- Interfaces → IPv6 addresses: loads (evidence: `pyaoscx/interface.py`)
- Interfaces → VLANs: references (evidence: `pyaoscx/interface.py`)
- Interfaces → Virtual routing: references (evidence: `pyaoscx/interface.py`)
- Interfaces → Access control lists: loads (evidence: `pyaoscx/interface.py`)
- Virtual routing → BGP routers: loads (evidence: `pyaoscx/vrf.py`)
- Virtual routing → OSPF routers: loads (evidence: `pyaoscx/vrf.py`)
- Virtual routing → Static routes: loads (evidence: `pyaoscx/vrf.py`)
- BGP routers → BGP neighbors: loads (evidence: `pyaoscx/bgp_router.py`)
- BGP routers → BGP aggregates: loads (evidence: `pyaoscx/bgp_router.py`)
- OSPF routers → OSPF areas: loads (evidence: `pyaoscx/ospf_router.py`)
- Interfaces → Resource base behavior: inherits behavior (evidence: `pyaoscx/interface.py`)
- Virtual routing → Resource base behavior: inherits behavior (evidence: `pyaoscx/vrf.py`)
- Resource base behavior → Shared utilities: uses (evidence: `pyaoscx/pyaoscx_module.py`)
- VLANs → List references: uses (evidence: `pyaoscx/vlan.py`)
