nac-test-pyats-common 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,304 @@
1
+ Metadata-Version: 2.4
2
+ Name: nac-test-pyats-common
3
+ Version: 0.1.0
4
+ Summary: Architecture adapters for Network as Code (NaC) PyATS testing - auth classes, test base classes, and device resolvers
5
+ Project-URL: Homepage, https://github.com/netascode/nac-test-pyats-common
6
+ Project-URL: Documentation, https://github.com/netascode/nac-test-pyats-common
7
+ Project-URL: Repository, https://github.com/netascode/nac-test-pyats-common
8
+ Project-URL: Issues, https://github.com/netascode/nac-test-pyats-common/issues
9
+ Author-email: Andrea Testino <atestini@cisco.com>
10
+ Maintainer-email: Andrea Testino <atestini@cisco.com>
11
+ License: MPL-2.0
12
+ License-File: LICENSE
13
+ Keywords: aci,catalyst-center,cisco,nac,network,pyats,sdwan,testing
14
+ Classifier: Development Status :: 4 - Beta
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Topic :: Software Development :: Testing
24
+ Classifier: Topic :: System :: Networking
25
+ Requires-Python: >=3.10
26
+ Requires-Dist: httpx>=0.28
27
+ Provides-Extra: dev
28
+ Requires-Dist: bandit[toml]>=1.8.6; extra == 'dev'
29
+ Requires-Dist: mypy>=1.10; extra == 'dev'
30
+ Requires-Dist: pre-commit>=3.0; extra == 'dev'
31
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
32
+ Requires-Dist: pytest-cov>=4.0; extra == 'dev'
33
+ Requires-Dist: pytest-mock>=3.14; extra == 'dev'
34
+ Requires-Dist: pytest>=8.0; extra == 'dev'
35
+ Requires-Dist: respx>=0.21; extra == 'dev'
36
+ Requires-Dist: ruff>=0.4; extra == 'dev'
37
+ Description-Content-Type: text/markdown
38
+
39
+ [![Tests](https://github.com/netascode/nac-test-pyats-common/actions/workflows/test.yml/badge.svg)](https://github.com/netascode/nac-test-pyats-common/actions/workflows/test.yml)
40
+ ![Python Support](https://img.shields.io/badge/python-3.10%20%7C%203.11%20%7C%203.12-informational "Python Support: 3.10, 3.11, 3.12")
41
+
42
+ # nac-test-pyats-common
43
+
44
+ > **⚠️ INITIAL DEVELOPMENT**: This package is under active initial development and not yet ready for production use.
45
+
46
+ A shared library consolidating duplicated PyATS testing infrastructure across NAC (Network as Code) architecture repositories. This package serves as a Layer 2 adapter between architecture-specific test repositories (ACI, SD-WAN, Catalyst Center) and the core nac-test framework.
47
+
48
+ ## Overview
49
+
50
+ The `nac-test-pyats-common` package addresses the architectural challenge of duplicated `pyats_common/` directories across NAC architecture repositories. It consolidates shared PyATS testing infrastructure—including authentication classes, test base classes, and device resolvers—into a centralized, maintainable package.
51
+
52
+ ### Problem Solved
53
+
54
+ Each NAC architecture repository previously contained duplicated PyATS infrastructure code:
55
+ - ~90% of base test class code was identical across architectures
56
+ - Bug fixes and improvements required manual propagation to all repos
57
+ - Each architecture team maintained essentially the same code
58
+ - Adding new architectures (ISE, Meraki, IOS-XE) compounded the duplication problem
59
+
60
+ ### Solution Architecture
61
+
62
+ ```
63
+ ┌─────────────────────────────────────────────────────────────────────┐
64
+ │ Layer 3: Architecture Repositories │
65
+ │ (nac-aci-terraform, nac-sdwan-terraform, nac-catc-terraform) │
66
+ │ │
67
+ │ ┌─────────────────┐ ┌─────────────────┐ │
68
+ │ │ Test Files │ │ NAC Schema │ │
69
+ │ │ (verify_*.py) │ │ Definitions │ │
70
+ │ └────────┬────────┘ └─────────────────┘ │
71
+ │ │ │
72
+ │ │ imports │
73
+ │ ▼ │
74
+ └───────────┼──────────────────────────────────────────────────────────┘
75
+
76
+ ┌───────────▼──────────────────────────────────────────────────────────┐
77
+ │ Layer 2: nac-test-pyats-common (Architecture Adapters) │
78
+ │ DEPENDS ON nac-test │
79
+ │ │
80
+ │ • Architecture-specific authentication (APICAuth, VManageAuth) │
81
+ │ • Architecture-specific test base classes (APICTestBase, etc.) │
82
+ │ • Architecture-specific device resolvers (SDWANDeviceResolver) │
83
+ │ │ │
84
+ │ │ imports NACTestBase, SSHTestBase, AuthCache │
85
+ │ ▼ │
86
+ └───────────────────────┼──────────────────────────────────────────────┘
87
+
88
+ ┌───────────────────────▼──────────────────────────────────────────────┐
89
+ │ Layer 1: nac-test (Core Framework) │
90
+ │ Orchestration + Generic Infrastructure │
91
+ │ │
92
+ │ • Test orchestration (discovering tests, running them) │
93
+ │ • Testbed generation (generic device dict → PyATS YAML) │
94
+ │ • Connection brokering (SSH connection pooling) │
95
+ │ • HTML report generation │
96
+ │ • Generic base classes (NACTestBase, SSHTestBase) │
97
+ └─────────────────────────────────────────────────────────────────────┘
98
+ ```
99
+
100
+ ## Supported Architectures
101
+
102
+ ### Currently Supported
103
+ - **ACI (Application Centric Infrastructure)**
104
+ - `APICAuth` - APIC authentication with cookie-based sessions
105
+ - `APICTestBase` - Base class for ACI/APIC tests
106
+ - `ACIDeviceResolver` - Device inventory from ACI data models
107
+
108
+ - **SD-WAN**
109
+ - `VManageAuth` - vManage authentication with token-based sessions
110
+ - `VManageTestBase` - Base class for vManage API tests
111
+ - `SDWANSSHTestBase` - Base class for SD-WAN D2D/SSH tests
112
+ - `SDWANDeviceResolver` - Device inventory from sites.nac.yaml
113
+
114
+ - **Catalyst Center**
115
+ - `CatalystCenterAuth` - Token-based authentication (X-Auth-Token)
116
+ - `CatalystCenterTestBase` - Base class for Catalyst Center API tests
117
+ - `CatalystCenterDeviceResolver` - Device inventory from NAC schemas
118
+
119
+ ### Planned Support
120
+ - ISE (Identity Services Engine)
121
+ - Meraki
122
+ - IOS-XE (Direct device access)
123
+
124
+ ## Installation
125
+
126
+ Python 3.10+ is required. Don't have Python 3.10 or later? See [Python 3 Installation & Setup Guide](https://realpython.com/installing-python/).
127
+
128
+ ```shell
129
+ pip install nac-test-pyats-common
130
+ ```
131
+
132
+ This will automatically install the required dependencies:
133
+ - `nac-test~=1.1.0` - Core testing framework (brings PyATS as transitive dependency)
134
+ - `httpx>=0.28` - HTTP client for authentication
135
+
136
+ ## Usage
137
+
138
+ ### Import Pattern
139
+
140
+ Replace the old fragile imports from architecture repos:
141
+
142
+ ```python
143
+ # Old pattern (remove this)
144
+ from templates.catc.test.pyats_common.catc_base_test import CatalystCenterTestBase
145
+
146
+ # New pattern (use this)
147
+ from nac_test_pyats_common.catc import CatalystCenterTestBase
148
+ ```
149
+
150
+ ### Example Test File
151
+
152
+ ```python
153
+ # In nac-catalystcenter-terraform/tests/templates/catc/test/api/verify_something.py
154
+
155
+ from nac_test_pyats_common.catc import CatalystCenterTestBase
156
+ from nac_test.pyats_core.reporting.types import ResultStatus
157
+ from pyats import aetest
158
+
159
+ class TestCatalystCenterFeature(CatalystCenterTestBase):
160
+ """Test class for Catalyst Center feature verification."""
161
+
162
+ @aetest.test
163
+ def verify_feature(self):
164
+ """Verify feature configuration."""
165
+ # self.client is already configured with auth headers
166
+ response = self.client.get("/api/v1/feature")
167
+
168
+ if response.status_code == 200:
169
+ self.result = ResultStatus.PASS
170
+ else:
171
+ self.result = ResultStatus.FAIL
172
+ ```
173
+
174
+ ## API Structure
175
+
176
+ ### Authentication Classes
177
+
178
+ Each architecture provides an authentication class that handles controller-specific authentication:
179
+
180
+ ```python
181
+ from nac_test_pyats_common.aci import APICAuth
182
+ from nac_test_pyats_common.sdwan import VManageAuth
183
+ from nac_test_pyats_common.catc import CatalystCenterAuth
184
+
185
+ # Authentication is handled automatically when using test base classes
186
+ # But can be used directly if needed:
187
+ auth_data = CatalystCenterAuth.get_auth() # Uses AuthCache internally
188
+ ```
189
+
190
+ ### Test Base Classes
191
+
192
+ Test base classes extend `NACTestBase` from nac-test with architecture-specific setup:
193
+
194
+ ```python
195
+ from nac_test_pyats_common.catc import CatalystCenterTestBase
196
+
197
+ class MyTest(CatalystCenterTestBase):
198
+ """Your test class."""
199
+
200
+ @aetest.setup
201
+ def setup(self):
202
+ """Setup is handled by base class."""
203
+ super().setup()
204
+ # self.client is now available with auth headers configured
205
+ # self.auth_data contains authentication tokens/cookies
206
+ ```
207
+
208
+ ### Device Resolvers
209
+
210
+ Device resolvers parse NAC schemas to provide device inventory for SSH tests:
211
+
212
+ ```python
213
+ from nac_test_pyats_common.sdwan import SDWANDeviceResolver
214
+
215
+ # Used by nac-test orchestrator internally
216
+ devices = SDWANDeviceResolver.get_ssh_device_inventory(data_model)
217
+ ```
218
+
219
+ ## Environment Variables
220
+
221
+ Each architecture requires specific environment variables for authentication:
222
+
223
+ ### Catalyst Center
224
+ - `CC_URL` - Controller URL
225
+ - `CC_USERNAME` - Username
226
+ - `CC_PASSWORD` - Password
227
+ - `CC_INSECURE` - Skip SSL verification (optional, default: "True")
228
+
229
+ ### SD-WAN
230
+ - `VMANAGE_URL` - vManage URL
231
+ - `VMANAGE_USERNAME` - Username
232
+ - `VMANAGE_PASSWORD` - Password
233
+ - `VMANAGE_INSECURE` - Skip SSL verification (optional, default: "True")
234
+
235
+ ### ACI
236
+ - `APIC_URL` - APIC URL
237
+ - `APIC_USERNAME` - Username
238
+ - `APIC_PASSWORD` - Password
239
+ - `APIC_INSECURE` - Skip SSL verification (optional, default: "True")
240
+
241
+ ## Development
242
+
243
+ ### Local Development Setup
244
+
245
+ ```bash
246
+ # Clone the repository
247
+ git clone https://github.com/netascode/nac-test-pyats-common.git
248
+ cd nac-test-pyats-common
249
+
250
+ # Install in editable mode with dev dependencies
251
+ pip install -e ".[dev]"
252
+
253
+ # Run tests
254
+ pytest tests/unit/ -v
255
+ pytest tests/integration/ -v # Requires nac-test
256
+
257
+ # Type checking
258
+ mypy --strict src/
259
+
260
+ # Linting
261
+ ruff check src/
262
+ ```
263
+
264
+ ### Contributing
265
+
266
+ When contributing, understand which repository to modify:
267
+
268
+ | Change Type | Repository | Example |
269
+ |-------------|------------|---------|
270
+ | Auth endpoint change | nac-test-pyats-common | Catalyst Center adds new auth API |
271
+ | Test base setup logic | nac-test-pyats-common | Add new setup step for all CC tests |
272
+ | Generic orchestration | nac-test | Change how tests are discovered/run |
273
+ | HTML report format | nac-test | Modify report template |
274
+ | Test file (verify_*.py) | Architecture repo | Add new verification test |
275
+
276
+ ## Dependencies
277
+
278
+ - `nac-test~=1.1.0` - Core testing framework
279
+ - Provides: `NACTestBase`, `SSHTestBase`, `AuthCache`, orchestration
280
+ - Brings PyATS as transitive dependency
281
+ - `httpx>=0.28` - Modern async-capable HTTP client
282
+
283
+ ## Versioning
284
+
285
+ This package follows [Semantic Versioning 2.0.0](https://semver.org/):
286
+ - **MAJOR**: Breaking API changes
287
+ - **MINOR**: New features, backward compatible
288
+ - **PATCH**: Bug fixes, backward compatible
289
+
290
+ ### Compatibility Matrix
291
+
292
+ | nac-test-pyats-common | nac-test Required | Notes |
293
+ |-----------------------|-------------------|-------|
294
+ | 1.0.x | ~=1.1.0 | Initial release |
295
+ | 1.1.x | ~=1.1.0 | New architecture added |
296
+ | 2.0.x | ~=2.0.0 | Breaking changes |
297
+
298
+ ## License
299
+
300
+ This project is licensed under the Mozilla Public License 2.0 (MPL-2.0) - see the [LICENSE](LICENSE) file for details.
301
+
302
+ ## Support
303
+
304
+ For issues, questions, or contributions, please visit the [GitHub repository](https://github.com/netascode/nac-test-pyats-common).
@@ -0,0 +1,24 @@
1
+ nac_test_pyats_common/__init__.py,sha256=yhvIGEkgMoZhwZKWxXUTzkzQT6-6YtpdOOa8mAVgNaY,1551
2
+ nac_test_pyats_common/py.typed,sha256=BrP39il8_cNN1K0KDeyBUtySS9oI2_SK5xKx1SxdSoY,59
3
+ nac_test_pyats_common/aci/__init__.py,sha256=hEqGdhP_DtCqmLnUncYdmmH5d5WFRsdIkoCzH3DbV1k,1263
4
+ nac_test_pyats_common/aci/auth.py,sha256=CSBHmmN8GYNXP-uCC6u31S-AOWcUDhIeLwuolN4OEjU,7772
5
+ nac_test_pyats_common/aci/test_base.py,sha256=Em0GTrU0lJLWhwoZOptwnEEDnY3L8YkB-2Sre4endzI,6131
6
+ nac_test_pyats_common/catc/__init__.py,sha256=1e5RjeEKApalS9CqSRi_nvER1MRtaCfQJ-kVOq8zp0w,1247
7
+ nac_test_pyats_common/catc/auth.py,sha256=yCp9NGe48CngxGN0QVLS17ukfJge7rdBcV-L2_lez7U,9350
8
+ nac_test_pyats_common/catc/test_base.py,sha256=myhdMFN310z6D3IC_BcSvtNQ4iyGbZZtiROxoNAHs0I,7367
9
+ nac_test_pyats_common/common/__init__.py,sha256=tMBObh27Bl3AHe4UVu3EoI6rbhxWV901WKw4SEMvnwk,1012
10
+ nac_test_pyats_common/common/base_device_resolver.py,sha256=VQDkV6EzZCJL9TrJcB2i34BFz9Y8cK7g2Y_8NP7AVrQ,18420
11
+ nac_test_pyats_common/iosxe/__init__.py,sha256=dIXPUdOJAy8P7KM4_scfkFSB4g1c-b7AdsEC3Ok8gEE,2075
12
+ nac_test_pyats_common/iosxe/catc_resolver.py,sha256=YK8-1Y0EIkX5CBawAqAxYk2kMjYwoBWXLtM3Yz_7kfQ,2441
13
+ nac_test_pyats_common/iosxe/iosxe_resolver.py,sha256=CmvbF8eFo5I_Uy_JDx1lO-2YaB_fiDxK-I7WBvu7X5o,2283
14
+ nac_test_pyats_common/iosxe/registry.py,sha256=toRNcIcXkPPrm-kC4tpxOf6kTXgvC2Dsh8Vm5EXEwRY,5562
15
+ nac_test_pyats_common/iosxe/test_base.py,sha256=dJrTpRy3V8Q0vK5FODHzDh85EZ7eM8dS9PnBvRF-i_0,4220
16
+ nac_test_pyats_common/sdwan/__init__.py,sha256=QUnYDV25cwubonnpXkkhGrDcSOcDtmabAAx8fPnM4zQ,1697
17
+ nac_test_pyats_common/sdwan/api_test_base.py,sha256=gTy57JSa6pjuCayfZMzS1lUPZHYSTqZjr8LeDNoLouc,7507
18
+ nac_test_pyats_common/sdwan/auth.py,sha256=V_OVAZzCSOvfTYrPGyv-xXZEDDHIpTl2BBxDoB5Mwro,10189
19
+ nac_test_pyats_common/sdwan/device_resolver.py,sha256=huAfUG6TADF3lWeOUyr244jRogC5SqWhz4k-1191ZnY,5968
20
+ nac_test_pyats_common/sdwan/ssh_test_base.py,sha256=KvV_Hw56EiX5HcVRNG2A2ryLH0v6RbmLlUzyJMQ-424,4078
21
+ nac_test_pyats_common-0.1.0.dist-info/METADATA,sha256=hZNaqHtElHIADhf2CumhWpg8qf9aEWEE_eM2tIr6IQw,13039
22
+ nac_test_pyats_common-0.1.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
23
+ nac_test_pyats_common-0.1.0.dist-info/licenses/LICENSE,sha256=zt2sx-c0iEk6-OO0iqRQ4l6fIGazRKW_qLMqfDpLm6M,16295
24
+ nac_test_pyats_common-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.28.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any