diff --git a/CONTRIBUTING b/CONTRIBUTING new file mode 100644 index 0000000..99bb9b3 --- /dev/null +++ b/CONTRIBUTING @@ -0,0 +1 @@ +Please read http://napalm.readthedocs.io/en/latest/contributing/index.html \ No newline at end of file diff --git a/MANIFEST.in b/MANIFEST.in index e69de29..957aa51 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +include requirements.txt +include napalm_comware/templates/*.j2 +include napalm_comware/utils/textfsm_templates/*.tpl \ No newline at end of file diff --git a/README.md b/README.md index cb309e9..7e5c99f 100644 --- a/README.md +++ b/README.md @@ -14,21 +14,51 @@ NAPALM driver for H3C/HPE Comware V7 network devices. # Supported devices -... +S5100、S5500、S6800、S12500 Series Data Center Switches. # Supported functions - :white_check_mark: is_alive() - :white_check_mark: get_facts() -- :white_check_mark: get_vlans() +- :white_check_mark: get_interfaces() +- :white_check_mark: get_lldp_neighbors() +- :white_check_mark: get_environment() +- :white_check_mark: get_interfaces_counters() +- :white_check_mark: get_lldp_neighbors_detail() +- :white_check_mark: cli() - :white_check_mark: get_arp_table() +- :white_check_mark: get_mac_address_move_table() +- :white_check_mark: get_mac_address_table() +- :white_check_mark: get_vlans() +- :white_check_mark: get_config() - :white_check_mark: get_interfaces() +- :white_check_mark: get_irf_config() +- :white_check_mark: is_irf() + # Getting Started -... +## Install + +```shell +pip install napalm-comware-ssh +``` + +## Upgrading + +``` +pip install napalm -U +``` + +## Use -# License +```python +from napalm import get_network_driver -ASL2.0 \ No newline at end of file +driver = get_network_driver("comware") +driver = driver("192.168.56.20", "netdevops", "NetDevops@01",) +driver.open() +ret = driver.is_alive() +print(ret) +``` \ No newline at end of file diff --git a/napalm_comware/__init__.py b/napalm_comware/__init__.py index 9790239..5f05e35 100644 --- a/napalm_comware/__init__.py +++ b/napalm_comware/__init__.py @@ -14,5 +14,5 @@ from napalm_comware.comware import ComwareDriver -__all__ = ('ComwareDriver',) -__version__ = '0.0.1' \ No newline at end of file +__all__ = ("ComwareDriver",) +__version__ = "0.1.0" \ No newline at end of file diff --git a/napalm_comware/comware.py b/napalm_comware/comware.py index 3c6790f..e87f97f 100644 --- a/napalm_comware/comware.py +++ b/napalm_comware/comware.py @@ -13,17 +13,14 @@ # the License. """ -Napalm driver for H3C ComwareV7 devices. +Napalm driver for H3C/HPE ComwareV7 devices. Read https://napalm.readthedocs.io for more information. """ from operator import itemgetter from collections import defaultdict -from tabnanny import verbose from typing import Any, Optional, Dict, List -import re -from netmiko.hp.hp_comware import HPComwareBase from napalm.base.base import NetworkDriver from napalm.base.exceptions import ( ConnectionClosedException, @@ -35,6 +32,7 @@ mac, ) from napalm.base.netmiko_helpers import netmiko_args +from netmiko.hp.hp_comware import HPComwareBase from .utils.helpers import ( canonical_interface_name_comware, parse_time, diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..8fb310a --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +napalm>=3.0.0 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..a39d2da --- /dev/null +++ b/setup.py @@ -0,0 +1,49 @@ +"""setup.py file.""" + +from setuptools import setup, find_packages +import re + + +with open("requirements.txt", "r") as fs: + reqs = [r for r in fs.read().splitlines() if ( + len(r) > 0 and not r.startswith("#"))] + +with open("README.md", "r", encoding="utf-8") as fh: + long_description = fh.read() + +__author__ = "Eric Wu " + +# get version without importing +with open("napalm_comware/__init__.py", "r") as f: + VERSION = str(re.search('__version__ = "(.+?)"', f.read()).group(1)) + + +setup( + name="napalm-comware-ssh", + version=VERSION, + author="Eric Wu", + author_email="vip@xdai.vip", + description="NAPALM driver for H3C/HPE Comware V7 network devices.", + license="Apache 2.0", + long_description_content_type="text/markdown", + long_description=long_description, + url="https://github.com/xdai555/napalm-comware-ssh", + project_urls={ + "Bug Tracker": "https://github.com/xdai555/napalm-comware-ssh/issues", + }, + classifiers=[ + "Topic :: Utilities", + "License :: OSI Approved :: Apache Software License", + "Development Status :: 4 - Beta", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Operating System :: POSIX :: Linux", + "Operating System :: MacOS", + ], + packages=find_packages(exclude=("test*", "*demo.py")), + include_package_data=True, # declarations in MANIFEST.in + install_requires=reqs, +)