diff --git a/README.md b/README.md index 7ada12f..b26829a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# napalm-comware-ssh +# napalm-h3c-cw7-ssh ## NAPALM @@ -6,11 +6,9 @@ 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 @@ -36,19 +34,18 @@ 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 @@ -56,7 +53,7 @@ pip install napalm-comware-ssh -U ```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() diff --git a/napalm_comware/__init__.py b/napalm_h3c_comware/__init__.py similarity index 89% rename from napalm_comware/__init__.py rename to napalm_h3c_comware/__init__.py index 5f05e35..e42dba1 100644 --- a/napalm_comware/__init__.py +++ b/napalm_h3c_comware/__init__.py @@ -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" \ No newline at end of file +__version__ = "0.1.1" \ No newline at end of file diff --git a/napalm_comware/comware.py b/napalm_h3c_comware/comware.py similarity index 98% rename from napalm_comware/comware.py rename to napalm_h3c_comware/comware.py index e87f97f..d413119 100644 --- a/napalm_comware/comware.py +++ b/napalm_h3c_comware/comware.py @@ -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. """ @@ -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, @@ -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, @@ -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): @@ -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) @@ -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 = "" @@ -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): """ diff --git a/napalm_comware/templates/.placeholder b/napalm_h3c_comware/templates/.placeholder similarity index 100% rename from napalm_comware/templates/.placeholder rename to napalm_h3c_comware/templates/.placeholder diff --git a/napalm_comware/utils/__init__.py b/napalm_h3c_comware/utils/__init__.py similarity index 100% rename from napalm_comware/utils/__init__.py rename to napalm_h3c_comware/utils/__init__.py diff --git a/napalm_comware/utils/helpers.py b/napalm_h3c_comware/utils/helpers.py similarity index 100% rename from napalm_comware/utils/helpers.py rename to napalm_h3c_comware/utils/helpers.py diff --git a/napalm_comware/utils/textfsm_templates/display_arp.tpl b/napalm_h3c_comware/utils/textfsm_templates/display_arp.tpl similarity index 100% rename from napalm_comware/utils/textfsm_templates/display_arp.tpl rename to napalm_h3c_comware/utils/textfsm_templates/display_arp.tpl diff --git a/napalm_comware/utils/textfsm_templates/display_cpu-usage_summary.tpl b/napalm_h3c_comware/utils/textfsm_templates/display_cpu-usage_summary.tpl similarity index 100% rename from napalm_comware/utils/textfsm_templates/display_cpu-usage_summary.tpl rename to napalm_h3c_comware/utils/textfsm_templates/display_cpu-usage_summary.tpl diff --git a/napalm_comware/utils/textfsm_templates/display_current-configuration_configuration_irf-port.tpl b/napalm_h3c_comware/utils/textfsm_templates/display_current-configuration_configuration_irf-port.tpl similarity index 100% rename from napalm_comware/utils/textfsm_templates/display_current-configuration_configuration_irf-port.tpl rename to napalm_h3c_comware/utils/textfsm_templates/display_current-configuration_configuration_irf-port.tpl diff --git a/napalm_comware/utils/textfsm_templates/display_device_manuinfo.tpl b/napalm_h3c_comware/utils/textfsm_templates/display_device_manuinfo.tpl similarity index 100% rename from napalm_comware/utils/textfsm_templates/display_device_manuinfo.tpl rename to napalm_h3c_comware/utils/textfsm_templates/display_device_manuinfo.tpl diff --git a/napalm_comware/utils/textfsm_templates/display_environment.tpl b/napalm_h3c_comware/utils/textfsm_templates/display_environment.tpl similarity index 100% rename from napalm_comware/utils/textfsm_templates/display_environment.tpl rename to napalm_h3c_comware/utils/textfsm_templates/display_environment.tpl diff --git a/napalm_comware/utils/textfsm_templates/display_fan.tpl b/napalm_h3c_comware/utils/textfsm_templates/display_fan.tpl similarity index 100% rename from napalm_comware/utils/textfsm_templates/display_fan.tpl rename to napalm_h3c_comware/utils/textfsm_templates/display_fan.tpl diff --git a/napalm_comware/utils/textfsm_templates/display_interface.tpl b/napalm_h3c_comware/utils/textfsm_templates/display_interface.tpl similarity index 100% rename from napalm_comware/utils/textfsm_templates/display_interface.tpl rename to napalm_h3c_comware/utils/textfsm_templates/display_interface.tpl diff --git a/napalm_comware/utils/textfsm_templates/display_lldp_neighbor-information_verbose.tpl b/napalm_h3c_comware/utils/textfsm_templates/display_lldp_neighbor-information_verbose.tpl similarity index 100% rename from napalm_comware/utils/textfsm_templates/display_lldp_neighbor-information_verbose.tpl rename to napalm_h3c_comware/utils/textfsm_templates/display_lldp_neighbor-information_verbose.tpl diff --git a/napalm_comware/utils/textfsm_templates/display_mac-address.tpl b/napalm_h3c_comware/utils/textfsm_templates/display_mac-address.tpl similarity index 100% rename from napalm_comware/utils/textfsm_templates/display_mac-address.tpl rename to napalm_h3c_comware/utils/textfsm_templates/display_mac-address.tpl diff --git a/napalm_comware/utils/textfsm_templates/display_mac-address_mac-move.tpl b/napalm_h3c_comware/utils/textfsm_templates/display_mac-address_mac-move.tpl similarity index 100% rename from napalm_comware/utils/textfsm_templates/display_mac-address_mac-move.tpl rename to napalm_h3c_comware/utils/textfsm_templates/display_mac-address_mac-move.tpl diff --git a/napalm_comware/utils/textfsm_templates/display_memory.tpl b/napalm_h3c_comware/utils/textfsm_templates/display_memory.tpl similarity index 100% rename from napalm_comware/utils/textfsm_templates/display_memory.tpl rename to napalm_h3c_comware/utils/textfsm_templates/display_memory.tpl diff --git a/napalm_comware/utils/textfsm_templates/display_power.tpl b/napalm_h3c_comware/utils/textfsm_templates/display_power.tpl similarity index 100% rename from napalm_comware/utils/textfsm_templates/display_power.tpl rename to napalm_h3c_comware/utils/textfsm_templates/display_power.tpl diff --git a/napalm_comware/utils/textfsm_templates/display_version.tpl b/napalm_h3c_comware/utils/textfsm_templates/display_version.tpl similarity index 100% rename from napalm_comware/utils/textfsm_templates/display_version.tpl rename to napalm_h3c_comware/utils/textfsm_templates/display_version.tpl diff --git a/napalm_comware/utils/textfsm_templates/display_vlan_all.tpl b/napalm_h3c_comware/utils/textfsm_templates/display_vlan_all.tpl similarity index 100% rename from napalm_comware/utils/textfsm_templates/display_vlan_all.tpl rename to napalm_h3c_comware/utils/textfsm_templates/display_vlan_all.tpl diff --git a/release.md b/release.md new file mode 100644 index 0000000..0ea79c6 --- /dev/null +++ b/release.md @@ -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 -m + ``` + +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/* + ``` + diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..9ce95f6 --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,4 @@ +twine +setuptools +build +-r requirements.txt \ No newline at end of file diff --git a/setup.py b/setup.py index a39d2da..479d15a 100644 --- a/setup.py +++ b/setup.py @@ -14,22 +14,22 @@ __author__ = "Eric Wu " # 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="vip@xdai.vip", - 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",