Skip to content

Commit

Permalink
refactor: rename
Browse files Browse the repository at this point in the history
  • Loading branch information
xdai555 committed Feb 1, 2022
1 parent a083718 commit e2fe550
Show file tree
Hide file tree
Showing 23 changed files with 63 additions and 29 deletions.
17 changes: 7 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
# napalm-comware-ssh
# napalm-h3c-cw7-ssh

## NAPALM

[NAPALM](https://github.com/napalm-automation/napalm) (Network Automation and Programmability Abstraction Layer with Multivendor support) is a Python library that implements a set of functions to interact with different router vendor devices using a unified API.

NAPALM supports several methods to connect to the devices, to manipulate configurations or to retrieve data.

## napalm-comware-ssh
## napalm-h3c-cw7-ssh

NAPALM driver for H3C/HPE Comware V7 network devices.

> [About H3C](https://www.h3c.com/en/About_Us/).
NAPALM driver for H3C Comware V7 network devices, over ssh.

# Supported devices

Expand All @@ -36,27 +34,26 @@ S5100、S5500、S6800、S12500 Series Data Center Switches.
- :white_check_mark: is_irf()



# Getting Started

## Install

```shell
pip install napalm-comware-ssh
pip install napalm-h3c-comware
```

## Upgrading

```
pip install napalm-comware-ssh -U
```shell
pip install napalm-h3c-comware -U
```

## Use

```python
from napalm import get_network_driver

driver = get_network_driver("comware")
driver = get_network_driver("h3c_comware")
driver = driver("192.168.56.20", "netdevops", "NetDevops@01",)
driver.open()
ret = driver.is_alive()
Expand Down
4 changes: 2 additions & 2 deletions napalm_comware/__init__.py → napalm_h3c_comware/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations under
# the License.

from napalm_comware.comware import ComwareDriver
from napalm_h3c_comware.comware import ComwareDriver

__all__ = ("ComwareDriver",)
__version__ = "0.1.0"
__version__ = "0.1.1"
19 changes: 7 additions & 12 deletions napalm_comware/comware.py → napalm_h3c_comware/comware.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# the License.

"""
Napalm driver for H3C/HPE ComwareV7 devices.
Napalm driver for H3C ComwareV7 devices.
Read https://napalm.readthedocs.io for more information.
"""
Expand All @@ -22,11 +22,6 @@
from collections import defaultdict
from typing import Any, Optional, Dict, List
from napalm.base.base import NetworkDriver
from napalm.base.exceptions import (
ConnectionClosedException,
ConnectionException,
)
import napalm.base.constants as C
from napalm.base.helpers import (
textfsm_extractor,
mac,
Expand All @@ -43,7 +38,7 @@


class ComwareDriver(NetworkDriver):
"""Napalm driver for H3C/HP Comware7 network devices (using ssh)."""
"""Napalm driver for H3C Comware7 network devices (using ssh)."""

def __init__(
self,
Expand Down Expand Up @@ -72,7 +67,7 @@ def open(self):
def close(self):
self._netmiko_close()

def send_command(self, command, *args, **kwargs):
def send_command(self, command: str, *args, **kwargs):
return self.device.send_command(command, *args, **kwargs)

def is_alive(self):
Expand Down Expand Up @@ -140,8 +135,8 @@ def get_facts(self):
slot_sn = sn.get("serial_number")
if slot_sn != "":
slot_list.append(slot_sn)
if len(chassis_list) > 0 :

if len(chassis_list) > 0:
serial_number = ",".join(chassis_list)
elif len(chassis_list) == 0 and len(slot_list) > 0:
serial_number = ",".join(slot_list)
Expand Down Expand Up @@ -403,7 +398,7 @@ def get_interfaces_counters(self):

return counters

def get_lldp_neighbors_detail(self, interface=""):
def get_lldp_neighbors_detail(self, interface: str = ""):
lldp = {}
# `parent_interface` is not supported
parent_interface = ""
Expand Down Expand Up @@ -560,7 +555,7 @@ def get_config(self, retrieve="all", full=False, sanitized=False):
pass
return configs

def get_network_instances(self, name=""): ...
def get_network_instances(self, name: str = ""): ...

def get_vlans(self):
"""
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
38 changes: 38 additions & 0 deletions release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Release procedure

## Local install test

```
python setup.py develop
```

## Publish

1. Enter to venv
```
source ./venv/bin/activate
```
2. Increase version in `napalm_h3c_comware/__init__.py`
3. Add tag to release a new version
```
git tag -a <version> -m <comment>
```
4. Push to my github
```
git push origin --tags
```
5. Push to napalm-automation-community
```
git push community --tags
```
6. Build dist & upload to pypi.org
```
python -m build
python -m twine upload dist/*
```
4 changes: 4 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
twine
setuptools
build
-r requirements.txt
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@
__author__ = "Eric Wu <[email protected]>"

# get version without importing
with open("napalm_comware/__init__.py", "r") as f:
with open("napalm_h3c_comware/__init__.py", "r") as f:
VERSION = str(re.search('__version__ = "(.+?)"', f.read()).group(1))


setup(
name="napalm-comware-ssh",
name="napalm-h3c-comware",
version=VERSION,
author="Eric Wu",
author_email="[email protected]",
description="NAPALM driver for H3C/HPE Comware V7 network devices.",
description="NAPALM driver for H3C Comware V7 network devices, over ssh.",
license="Apache 2.0",
long_description_content_type="text/markdown",
long_description=long_description,
url="https://github.com/xdai555/napalm-comware-ssh",
url="https://github.com/napalm-automation-community/napalm-h3c-cw7-ssh/",
project_urls={
"Bug Tracker": "https://github.com/xdai555/napalm-comware-ssh/issues",
"Bug Tracker": "https://github.com/napalm-automation-community/napalm-h3c-cw7-ssh/issues",
},
classifiers=[
"Topic :: Utilities",
Expand Down

0 comments on commit e2fe550

Please sign in to comment.