Python Comware7 Ansible Library
Python library for integrating Ansible with the Comware7 embedded system, enabling automation of inventory and device orchestration.
Installation
Create a new virtual environment
python -m venv .venv
source .venv/bin/activate
Install the package
pip install pycw7-ansible
Usage
Import Libraries
First of all, import the libraries of comware 7 connection and vlan features.
>>> from pycw7_ansible.comware import COM7
>>> from pycw7_ansible.features.vlan import Vlan
Open Connection
To open a connection, you need to create a dictionary with the device parameters and pass it to the COM7 class, then call the open method, as shown below:
>>> HOST_IP = "10.100.73.119"
>>> USERNAME = "ped"
>>> PASSWORD = "Admin@1234"
>>> PORT = 830
>>> args = dict(host=HOST_IP, username=USERNAME, password=PASSWORD, port=PORT)
>>> device = COM7(**args)
>>> device.open()
<ncclient.manager.Manager object at 0x7c5536f51d60>
Getting Example Configuration
To get the configuration of a feature, you need to create an instance of the feature class and call the get_config method, as shown below:
>>> vlan1 = Vlan(device, "1")
>>> config = vlan1.get_config()
>>> print(config)
{'vlanid': '1', 'name': 'VLAN 0001', 'descr': 'VLAN-1-MANAGEMENT'}
Metadata
Release files for pycw7-ansible 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pycw7_ansible-1.0.0.tar.gz | 160.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pycw7_ansible-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 469.6 kB
Release files / pycw7_ansible-1.0.0.tar.gz
| Download URL | pycw7_ansible-1.0.0.tar.gz |
|---|---|
| Size | 160.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b1452cf1d4c3f66b13031b3cbe56b149f146a10096493e4f22e4e0abcddf148e
|
|
BLAKE2b-256 checksum How to use checksums |
7199cbbd3067594262feb4d025ae080429b577de5ef4337d361f791a356bfdba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Release files / pycw7_ansible-1.0.0-py3-none-any.whl
| Download URL | pycw7_ansible-1.0.0-py3-none-any.whl |
|---|---|
| Size | 308.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
30ee60cfd19392045b73ee6f43a4d91868cef33b53b46e6992127b62ef347594
|
|
BLAKE2b-256 checksum How to use checksums |
8839d7b018c1c44e7486a1eb9b41ad2712b6fb127f04ef78dc29370991c9558d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|