Metadata-Version: 2.4
Name: pycw7-ansible
Version: 1.0.0
Summary: Python package to simplify working with Comware7 Based devices
Author-email: arthurcadore <arthurbarcella.ifsc@gmail.com>
License: (c) Copyright 2016 Hewlett Packard Enterprise Development LP Licensed under the Apache License, Version 2.0
        (the "License"); 
        you may not use this file except in compliance with the License. 
        You may obtain a copy of the License
         at http://www.apache.org/licenses/LICENSE-2.0 
        Unless required by applicable law or agreed to in writing, software
         distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 
        express or implied. 
        See the License for the specific language governing permissions and limitations under the License.
Project-URL: Homepage, https://github.com/arthurcadore/pycw7-ansible
Project-URL: Repository, https://github.com/arthurcadore/pycw7-ansible
Project-URL: Bug Tracker, https://github.com/arthurcadore/pycw7-ansible/issues
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: textfsm==1.1.0
Requires-Dist: lxml
Requires-Dist: ncclient
Requires-Dist: scp
Requires-Dist: ipaddr>=2.1.11
Requires-Dist: paramiko
Dynamic: license-file

# 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

```bash
python -m venv .venv
source .venv/bin/activate
```

### Install the package

```bash
pip install pycw7-ansible
```

## Usage

### Import Libraries

First of all, import the libraries of comware 7 connection and vlan features.
```python
>>> 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:

```python
>>> 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:

```python
>>> vlan1 = Vlan(device, "1")
>>> config = vlan1.get_config()
>>> print(config)
{'vlanid': '1', 'name': 'VLAN 0001', 'descr': 'VLAN-1-MANAGEMENT'}
```

