diff --git a/debian/control b/debian/control index 2e99bdc28..883e08649 100644 --- a/debian/control +++ b/debian/control @@ -1,341 +1,347 @@ Source: vyos-1x Section: contrib/net Priority: extra Maintainer: VyOS Package Maintainers <maintainers@vyos.net> Build-Depends: debhelper (>= 9), dh-python, fakeroot, gcc, iproute2, libvyosconfig0 (>= 0.0.7), libzmq3-dev, procps, python3 (>= 3.10), # For QA pylint, # For generating command definitions python3-lxml, python3-xmltodict, # For running tests python3-coverage, + python3-hurry.filesize, + python3-netaddr, python3-netifaces, python3-nose, python3-jinja2, + python3-paramiko, + python3-passlib, python3-psutil, python3-requests, python3-setuptools, + python3-tabulate, + python3-zmq, quilt, whois Standards-Version: 3.9.6 Package: vyos-1x Architecture: amd64 arm64 Pre-Depends: libnss-tacplus [amd64], libpam-tacplus [amd64], libpam-radius-auth [amd64] Depends: ## Fundamentals ${python3:Depends} (>= 3.10), libvyosconfig0, vyatta-bash, vyatta-cfg, vyos-http-api-tools, vyos-utils, ## End of Fundamentals ## Python libraries used in multiple modules and scripts python3, python3-cryptography, python3-hurry.filesize, python3-inotify, python3-jinja2, python3-jmespath, python3-netaddr, python3-netifaces, python3-paramiko, python3-passlib, python3-psutil, python3-pyhumps, python3-pystache, python3-pyudev, python3-six, python3-tabulate, python3-voluptuous, python3-xmltodict, python3-zmq, ## End of Python libraries ## Basic System services and utilities sudo, systemd, bsdmainutils, openssl, curl, dbus, file, iproute2 (>= 6.0.0), linux-cpupower, # ipaddrcheck is widely used in IP value validators ipaddrcheck, ethtool, fdisk, lm-sensors, procps, netplug, sed, ssl-cert, tuned, beep, wide-dhcpv6-client, # Generic colorizer grc, ## End of System services and utilities ## For the installer # Image signature verification tool minisign, # Live filesystem tools squashfs-tools, fuse-overlayfs, ## End installer auditd, iputils-arping, isc-dhcp-client, # For "vpn pptp", "vpn l2tp", "vpn sstp", "service ipoe-server" accel-ppp, # End "vpn pptp", "vpn l2tp", "vpn sstp", "service ipoe-server" avahi-daemon, conntrack, conntrackd, ## Conf mode features # For "interfaces wireless" hostapd, hsflowd, iw, wireless-regdb, wpasupplicant (>= 0.6.7), # End "interfaces wireless" # For "interfaces wwan" modemmanager, usb-modeswitch, libqmi-utils, # End "interfaces wwan" # For "interfaces openvpn" openvpn, openvpn-auth-ldap, openvpn-auth-radius, openvpn-otp, libpam-google-authenticator, # End "interfaces openvpn" # For "interfaces wireguard" wireguard-tools, qrencode, # End "interfaces wireguard" # For "interfaces pppoe" pppoe, # End "interfaces pppoe" # For "interfaces sstpc" sstp-client, # End "interfaces sstpc" # For "protocols *" frr (>= 7.5), frr-pythontools, frr-rpki-rtrlib, frr-snmp, # End "protocols *" # For "protocols nhrp" (part of DMVPN) opennhrp, # End "protocols nhrp" # For "protocols igmp-proxy" igmpproxy, # End "protocols igmp-proxy" # For "pki" certbot, # End "pki" # For "service console-server" conserver-client, conserver-server, console-data, dropbear, # End "service console-server" # For "service aws glb" aws-gwlbtun, # For "service dns dynamic" ddclient (>= 3.11.1), # End "service dns dynamic" # # For "service ids" fastnetmon [amd64], suricata, suricata-update, # End "service ids" # # For "service ndp-proxy" ndppd, # End "service ndp-proxy" # For "service router-advert" radvd, # End "service route-advert" # For "high-availability reverse-proxy" haproxy, # End "high-availability reverse-proxy" # For "service dhcp-relay" isc-dhcp-relay, # For "service dhcp-server" kea, # End "service dhcp-server" # For "service lldp" lldpd, # End "service lldp" # For "service https" nginx-light, # End "service https" # For "service ssh" openssh-server, sshguard, # End "service ssh" # For "service salt-minion" salt-minion, # End "service salt-minion" # For "service snmp" snmp, snmpd, # End "service snmp" # For "service webproxy" squid, squidclient, squidguard, # End "service webproxy" # For "service monitoring telegraf" telegraf (>= 1.20), # End "service monitoring telegraf" # For "service monitoring zabbix-agent" zabbix-agent2, # End "service monitoring zabbix-agent" # For "service tftp-server" tftpd-hpa, # End "service tftp-server" # For "service dns forwarding" pdns-recursor, # End "service dns forwarding" # For "service sla owamp" owamp-client, owamp-server, # End "service sla owamp" # For "service sla twamp" twamp-client, twamp-server, # End "service sla twamp" # For "service broadcast-relay" udp-broadcast-relay, # End "service broadcast-relay" # For "high-availability vrrp" keepalived (>=2.0.5), # End "high-availability-vrrp" # For "system task-scheduler" cron, # End "system task-scheduler" # For "system lcd" lcdproc, lcdproc-extra-drivers, # End "system lcd" # For "system config-management commit-archive" git, # End "system config-management commit-archive" # For firewall libndp-tools, libnetfilter-conntrack3, libnfnetlink0, nfct, nftables (>= 0.9.3), # For "vpn ipsec" strongswan (>= 5.9), strongswan-swanctl (>= 5.9), charon-systemd, libcharon-extra-plugins (>=5.9), libcharon-extauth-plugins (>=5.9), libstrongswan-extra-plugins (>=5.9), libstrongswan-standard-plugins (>=5.9), python3-vici (>= 5.7.2), # End "vpn ipsec" # For "nat64" jool, # End "nat64" # For "system conntrack modules rtsp" nat-rtsp, # End "system conntrack modules rtsp" # For "system ntp" chrony, # End "system ntp" # For "vpn openconnect" ocserv, # End "vpn openconnect" # For "system flow-accounting" pmacct (>= 1.6.0), # End "system flow-accounting" # For container podman, netavark, aardvark-dns, # iptables is only used for containers now, not the the firewall CLI iptables, # End container ## End Configuration mode ## Operational mode # Used for hypervisor model in "run show version" hvinfo, # For "run traceroute" traceroute, # For "run monitor traffic" tcpdump, # End "run monitor traffic" # For "show hardware dmi" dmidecode, # For "run show hardware storage smart" smartmontools, # For "run show hardware scsi" lsscsi, # For "run show hardware pci" pciutils, # For "show hardware usb" usbutils, # For "run show hardware storage nvme" nvme-cli, # For "run monitor bandwidth-test" iperf, iperf3, # End "run monitor bandwidth-test" # For "run wake-on-lan" etherwake, # For "run force ipv6-nd" ndisc6, # For "run monitor bandwidth" bmon, # End Operational mode ## TPM tools cryptsetup, tpm2-tools, ## End TPM tools ## Optional utilities easy-rsa, tcptraceroute, mtr-tiny, telnet, stunnel4, uidmap ## End optional utilities Description: VyOS configuration scripts and data VyOS configuration scripts, interface definitions, and everything Package: vyos-1x-vmware Architecture: amd64 Depends: vyos-1x, open-vm-tools Description: VyOS configuration scripts and data for VMware Adds configuration files required for VyOS running on VMware hosts. Package: vyos-1x-smoketest Architecture: all Depends: skopeo, snmp, vyos-1x Description: VyOS build sanity checking toolkit diff --git a/smoketest/scripts/cli/test_configd_inspect.py b/src/tests/test_configd_inspect.py old mode 100755 new mode 100644 similarity index 90% rename from smoketest/scripts/cli/test_configd_inspect.py rename to src/tests/test_configd_inspect.py index af46c6148..98552c8f3 --- a/smoketest/scripts/cli/test_configd_inspect.py +++ b/src/tests/test_configd_inspect.py @@ -1,110 +1,105 @@ -#!/usr/bin/env python3 -# -# Copyright (C) 2020 VyOS maintainers and contributors +# Copyright (C) 2020-2024 VyOS maintainers and contributors # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 or later as # published by the Free Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import os import re import json -import unittest + import warnings import importlib.util -from inspect import signature, getsource +from inspect import signature +from inspect import getsource from functools import wraps +from unittest import TestCase -from vyos.defaults import directories - -INC_FILE = '/usr/share/vyos/configd-include.json' -CONF_DIR = directories['conf_mode'] +INC_FILE = 'data/configd-include.json' +CONF_DIR = 'src/conf_mode' f_list = ['get_config', 'verify', 'generate', 'apply'] def import_script(s): path = os.path.join(CONF_DIR, s) name = os.path.splitext(s)[0].replace('-', '_') spec = importlib.util.spec_from_file_location(name, path) module = importlib.util.module_from_spec(spec) spec.loader.exec_module(module) return module # importing conf_mode scripts imports jinja2 with deprecation warning def ignore_deprecation_warning(f): @wraps(f) def decorated_function(*args, **kwargs): with warnings.catch_warnings(): warnings.simplefilter("ignore") f(*args, **kwargs) return decorated_function -class TestConfigdInclude(unittest.TestCase): +class TestConfigdInspect(TestCase): def setUp(self): with open(INC_FILE) as f: self.inc_list = json.load(f) @ignore_deprecation_warning def test_signatures(self): for s in self.inc_list: m = import_script(s) for i in f_list: f = getattr(m, i, None) if not f: continue sig = signature(f) par = sig.parameters l = len(par) self.assertEqual(l, 1, f"'{s}': '{i}' incorrect signature") if i == 'get_config': for p in par.values(): self.assertTrue(p.default is None, f"'{s}': '{i}' incorrect signature") @ignore_deprecation_warning def test_function_instance(self): for s in self.inc_list: m = import_script(s) for i in f_list: f = getattr(m, i, None) if not f: continue str_f = getsource(f) # Regex not XXXConfig() T3108 n = len(re.findall(r'[^a-zA-Z]Config\(\)', str_f)) if i == 'get_config': self.assertEqual(n, 1, f"'{s}': '{i}' no instance of Config") if i != 'get_config': self.assertEqual(n, 0, f"'{s}': '{i}' instance of Config") @ignore_deprecation_warning def test_file_instance(self): for s in self.inc_list: m = import_script(s) str_m = getsource(m) # Regex not XXXConfig T3108 n = len(re.findall(r'[^a-zA-Z]Config\(\)', str_m)) self.assertEqual(n, 1, f"'{s}' more than one instance of Config") @ignore_deprecation_warning def test_config_modification(self): for s in self.inc_list: m = import_script(s) str_m = getsource(m) n = str_m.count('my_set') self.assertEqual(n, 0, f"'{s}' modifies config") - -if __name__ == '__main__': - unittest.main(verbosity=2)