diff --git a/pkgs/development/python-modules/ciscoconfparse/default.nix b/pkgs/development/python-modules/ciscoconfparse/default.nix new file mode 100644 index 000000000000..8831999e9923 --- /dev/null +++ b/pkgs/development/python-modules/ciscoconfparse/default.nix @@ -0,0 +1,32 @@ +{ lib, buildPythonPackage, fetchFromGitHub, passlib, dnspython, loguru, toml +, ipaddr, poetry, poetry-core, black, Fabric, pytest, sphinx }: + +buildPythonPackage rec { + pname = "ciscoconfparse"; + version = "1.6.21"; + format = "pyproject"; + + src = fetchFromGitHub { + owner = "mpenning"; + repo = pname; + rev = version; + sha256 = "1d6nzhmdg7zlg1h3lm4v7j4hsb2aqd475r5q5vcqxfdxszc92w21"; + }; + + patchPhase = '' + patchShebangs tests + ''; + + propagatedBuildInputs = + [ passlib dnspython loguru toml ipaddr poetry black Fabric sphinx ]; + + checkInputs = [ pytest ]; + + meta = with lib; { + description = + "Parse, Audit, Query, Build, and Modify Cisco IOS-style configurations"; + homepage = "https://github.com/mpenning/ciscoconfparse"; + license = licenses.gpl3Only; + maintainers = [ maintainers.astro ]; + }; +} diff --git a/pkgs/development/python-modules/ipaddr/default.nix b/pkgs/development/python-modules/ipaddr/default.nix new file mode 100644 index 000000000000..41ef6faa7c37 --- /dev/null +++ b/pkgs/development/python-modules/ipaddr/default.nix @@ -0,0 +1,22 @@ +{ lib, buildPythonPackage, fetchPypi }: + +buildPythonPackage rec { + pname = "ipaddr"; + version = "2.2.0"; + + src = fetchPypi { + inherit pname version; + sha256 = "1ml8r8z3f0mnn381qs1snbffa920i9ycp6mm2am1d3aqczkdz4j0"; + }; + + checkPhase = '' + python ipaddr_test.py + ''; + + meta = with lib; { + description = "IP address manipulation library"; + homepage = "https://github.com/google/ipaddr-py"; + license = licenses.asl20; + maintainers = [ maintainers.astro ]; + }; +} diff --git a/pkgs/development/python-modules/napalm/default.nix b/pkgs/development/python-modules/napalm/default.nix new file mode 100644 index 000000000000..2266283cc53b --- /dev/null +++ b/pkgs/development/python-modules/napalm/default.nix @@ -0,0 +1,44 @@ +{ lib, buildPythonPackage, fetchFromGitHub, callPackage, setuptools, cffi +, paramiko, requests, future, textfsm, jinja2, netaddr, pyyaml, pyeapi, netmiko +, junos-eznc, ciscoconfparse, scp, lxml, ncclient, pytestCheckHook, ddt, mock }: + +buildPythonPackage rec { + pname = "napalm"; + version = "3.3.1"; + + src = fetchFromGitHub { + owner = "napalm-automation"; + repo = "napalm"; + rev = version; + sha256 = "15h1h1a3avv48i14x96b8v7zkhmwg7dnzxycxr18f9530j237rq6"; + }; + + buildInputs = [ setuptools ]; + propagatedBuildInputs = [ + cffi + paramiko + requests + future + textfsm + jinja2 + netaddr + pyyaml + pyeapi + netmiko + junos-eznc + ciscoconfparse + scp + lxml + ncclient + ]; + + checkInputs = [ pytestCheckHook mock ddt ]; + + meta = with lib; { + description = + "Network Automation and Programmability Abstraction Layer with Multivendor support"; + homepage = "https://github.com/napalm-automation/napalm"; + license = licenses.asl20; + maintainers = [ maintainers.astro ]; + }; +} diff --git a/pkgs/development/python-modules/napalm/hp-procurve.nix b/pkgs/development/python-modules/napalm/hp-procurve.nix new file mode 100644 index 000000000000..774fdd2299cc --- /dev/null +++ b/pkgs/development/python-modules/napalm/hp-procurve.nix @@ -0,0 +1,41 @@ +{ lib, buildPythonPackage, fetchFromGitHub, setuptools, napalm, netmiko +, pytestCheckHook }: + +buildPythonPackage rec { + pname = "napalm-hp-procurve"; + version = "0.7.0"; + + src = fetchFromGitHub { + owner = "napalm-automation-community"; + repo = pname; + rev = version; + sha256 = "1lspciddkd1w5lfyz35i0qwgpbn5jq9cbqkwjbsvi4kliz229vkh"; + }; + + # dependency installation in setup.py doesn't work + patchPhase = '' + echo -n > requirements.txt + ''; + + buildInputs = [ setuptools napalm ]; + propagatedBuildInputs = [ netmiko ]; + + # setup.cfg seems to contain invalid pytest parameters + preCheck = '' + rm setup.cfg + ''; + checkInputs = [ pytestCheckHook ]; + disabledTests = [ + # AssertionError: Some methods vary. + "test_method_signatures" + # AttributeError: 'PatchedProcurveDriver' object has no attribute 'platform' + "test_get_config_filtered" + ]; + + meta = with lib; { + description = "HP ProCurve Driver for NAPALM automation frontend"; + homepage = + "https://github.com/napalm-automation-community/napalm-hp-procurve"; + license = licenses.asl20; + }; +} diff --git a/pkgs/development/python-modules/netmiko/default.nix b/pkgs/development/python-modules/netmiko/default.nix new file mode 100644 index 000000000000..0934439f7473 --- /dev/null +++ b/pkgs/development/python-modules/netmiko/default.nix @@ -0,0 +1,27 @@ +{ lib, buildPythonPackage, fetchPypi, setuptools, paramiko, scp, tenacity +, textfsm, ntc-templates, pyserial, pytestCheckHook, pyyaml }: + +buildPythonPackage rec { + pname = "netmiko"; + version = "3.4.0"; + + src = fetchPypi { + inherit pname version; + sha256 = "14s9c6ws32swizcmfdqmlkkk2yqw6071ybq3w94fhkl6jzfvkbdc"; + }; + + buildInputs = [ setuptools ]; + propagatedBuildInputs = + [ paramiko scp tenacity textfsm ntc-templates pyserial ]; + + # tests require closed-source pyats and genie packages + doCheck = false; + + meta = with lib; { + description = + "Multi-vendor library to simplify Paramiko SSH connections to network devices"; + homepage = "https://github.com/ktbyers/netmiko/"; + license = licenses.mit; + maintainers = [ maintainers.astro ]; + }; +} diff --git a/pkgs/development/python-modules/pyeapi/default.nix b/pkgs/development/python-modules/pyeapi/default.nix new file mode 100644 index 000000000000..101f41c5ca01 --- /dev/null +++ b/pkgs/development/python-modules/pyeapi/default.nix @@ -0,0 +1,29 @@ +{ lib, buildPythonPackage, fetchFromGitHub, netaddr, pytestCheckHook, coverage +, mock }: + +buildPythonPackage rec { + pname = "pyeapi"; + version = "0.8.4"; + format = "pyproject"; + + src = fetchFromGitHub { + owner = "arista-eosplus"; + repo = pname; + rev = "v${version}"; + sha256 = "13chya6wix5jb82k67gr44bjx35gcdwz80nsvpv0gvzs6shn4d7b"; + }; + + propagatedBuildInputs = [ netaddr ]; + + checkInputs = [ coverage mock ]; + checkPhase = '' + make unittest + ''; + + meta = with lib; { + description = "Client for Arista eAPI"; + homepage = "https://github.com/arista-eosplus/pyeapi"; + license = licenses.bsd3; + maintainers = [ maintainers.astro ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 87c2377eb77d..04920302dc81 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -21363,6 +21363,15 @@ with pkgs; myserver = callPackage ../servers/http/myserver { }; + napalm = with python3Packages; toPythonApplication ( + napalm.overridePythonAttrs (attrs: { + # add community frontends that depend on the napalm python package + propagatedBuildInputs = attrs.propagatedBuildInputs ++ [ + napalm-hp-procurve + ]; + }) + ); + nas = callPackage ../servers/nas { }; nats-streaming-server = callPackage ../servers/nats-streaming-server { }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index ccbd8ed73d85..c1f5ab16baf6 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1623,6 +1623,8 @@ in { cirq-web = callPackage ../development/python-modules/cirq-web { }; + ciscoconfparse = callPackage ../development/python-modules/ciscoconfparse { }; + ciscomobilityexpress = callPackage ../development/python-modules/ciscomobilityexpress { }; ciso8601 = callPackage ../development/python-modules/ciso8601 { }; @@ -4058,6 +4060,8 @@ in { iowait = callPackage ../development/python-modules/iowait { }; + ipaddr = callPackage ../development/python-modules/ipaddr { }; + ipaddress = callPackage ../development/python-modules/ipaddress { }; ipdb = callPackage ../development/python-modules/ipdb { }; @@ -5338,6 +5342,10 @@ in { nanotime = callPackage ../development/python-modules/nanotime { }; + napalm = callPackage ../development/python-modules/napalm { }; + + napalm-hp-procurve = callPackage ../development/python-modules/napalm/hp-procurve.nix { }; + napari = callPackage ../development/python-modules/napari { inherit (pkgs.libsForQt5) mkDerivationWith wrapQtAppsHook; }; @@ -5418,6 +5426,8 @@ in { netifaces = callPackage ../development/python-modules/netifaces { }; + netmiko = callPackage ../development/python-modules/netmiko { }; + netio = callPackage ../development/python-modules/netio { }; nettigo-air-monitor = callPackage ../development/python-modules/nettigo-air-monitor { }; @@ -8221,6 +8231,8 @@ in { inherit (pkgs.llvmPackages) openmp; }; + pyeapi = callPackage ../development/python-modules/pyeapi { }; + pyeverlights = callPackage ../development/python-modules/pyeverlights { }; pytibber = callPackage ../development/python-modules/pytibber { };