Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T6510: smoketest: generell improvement task for the smoketesting platform #3727

Merged
merged 7 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/package-smoketest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ permissions:
pull-requests: write
contents: read

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed for PR comments

jobs:
build:
runs-on: ubuntu-24.04
Expand All @@ -30,9 +33,7 @@ jobs:
- name: Clone vyos-1x source code
uses: actions/checkout@v4
with:
repository: vyos/vyos-1x
path: packages/vyos-1x
fetch-tags: true # required for Debian package version
- name: Build vyos-1x package
run: |
cd packages/vyos-1x; dpkg-buildpackage -uc -us -tc -b
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ data/component-versions.json
# vyos-1x XML cache
python/vyos/xml_ref/cache.py
python/vyos/xml_ref/pkg_cache/*_cache.py
# autogenerated vyos-configd JSON definition
data/configd-include.json

# We do not use pip
Pipfile
Expand Down
19 changes: 6 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,7 @@ vyshim:
$(MAKE) -C $(SHIM_DIR)

.PHONY: all
all: clean interface_definitions op_mode_definitions check test j2lint vyshim check_migration_scripts_executable

.PHONY: check
.ONESHELL:
check:
@echo "Checking which CLI scripts are not enabled to work with vyos-configd..."
@for file in `ls src/conf_mode -I__pycache__`
do
if ! grep -q $$file data/configd-include.json; then
echo "* $$file"
fi
done
all: clean interface_definitions op_mode_definitions test j2lint vyshim check_migration_scripts_executable generate-configd-include-json

.PHONY: clean
clean:
Expand All @@ -99,7 +88,7 @@ clean:
$(MAKE) -C $(SHIM_DIR) clean

.PHONY: test
test:
test: generate-configd-include-json
set -e; python3 -m compileall -q -x '/vmware-tools/scripts/, /ppp/' .
PYTHONPATH=python/ python3 -m "nose" --with-xunit src --with-coverage --cover-erase --cover-xml --cover-package src/conf_mode,src/op_mode,src/completion,src/helpers,src/validators,src/tests --verbose

Expand Down Expand Up @@ -127,6 +116,10 @@ unused-imports:
deb:
dpkg-buildpackage -uc -us -tc -b

.PHONY: generate-configd-include-json
generate-configd-include-json:
@scripts/generate-configd-include-json.py

.PHONY: schema
schema:
trang -I rnc -O rng schema/interface_definition.rnc schema/interface_definition.rng
Expand Down
115 changes: 0 additions & 115 deletions data/configd-include.json

This file was deleted.

6 changes: 6 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,18 @@ Build-Depends:
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
Expand Down
34 changes: 34 additions & 0 deletions scripts/generate-configd-include-json.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env python3
# Copyright (C) 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
from jinja2 import Template

conf_scripts = 'src/conf_mode'
configd_include = 'data/configd-include.json'

configd_template = Template("""[
{% for file in files %}
"{{ file }}"{{ "," if not loop.last else "" }}
{% endfor %}
]
""", trim_blocks=True)

files = [f for f in os.listdir(conf_scripts) if os.path.isfile(f'{conf_scripts}/{f}')]
files = sorted(files)

tmp = {'files' : files}
with open(configd_include, 'w') as f:
f.write(configd_template.render(tmp))
9 changes: 5 additions & 4 deletions smoketest/bin/vyos-configtest
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def make_test_function(filename, test_path=None):

if test_path:
config_commands = self.session.show(['configuration', 'commands'])

with open(test_path, 'r') as f:
for line in f.readlines():
if not line or line.startswith("#"):
Expand Down Expand Up @@ -83,9 +83,10 @@ if __name__ == '__main__':
test_path = os.path.join(config_test_dir, config)

if not os.path.exists(test_path):
test_path = None
else:
log.info(f'Loaded migration result test for config "{config}"')
log.error(f'Missing migration result test for config "{config}"')
sys.exit(1)

log.info(f'Loaded migration result test for config "{config}"')

test_func = make_test_function(config, test_path)

Expand Down
6 changes: 3 additions & 3 deletions smoketest/bin/vyos-configtest-pki
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ from vyos.pki import encode_dh_parameters
from vyos.pki import encode_private_key
from vyos.utils.file import write_file

subject = {'country': 'DE', 'state': 'BY', 'locality': 'Cloud', 'organization': 'VyOS', 'common_name': 'vyos'}
ca_subject = {'country': 'DE', 'state': 'BY', 'locality': 'Cloud', 'organization': 'VyOS', 'common_name': 'vyos CA'}
subca_subject = {'country': 'DE', 'state': 'BY', 'locality': 'Cloud', 'organization': 'VyOS', 'common_name': 'vyos SubCA'}
subject = {'country': 'DE', 'state': 'BY', 'locality': 'Cloud', 'organization': 'VyOS', 'common_name': 'VyOS'}
ca_subject = {'country': 'DE', 'state': 'BY', 'locality': 'Cloud', 'organization': 'VyOS', 'common_name': 'VyOS CA'}
subca_subject = {'country': 'DE', 'state': 'BY', 'locality': 'Cloud', 'organization': 'VyOS', 'common_name': 'VyOS SubCA'}

ca_cert = '/config/auth/ovpn_test_ca.pem'
ca_key = '/config/auth/ovpn_test_ca.key'
Expand Down
20 changes: 16 additions & 4 deletions smoketest/config-tests/basic-api-service
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
set interfaces ethernet eth0 address '192.0.2.1/31'
set interfaces ethernet eth0 address '2001:db8::1234/64'
set interfaces ethernet eth0 offload gro
set interfaces loopback lo
set service ntp server time1.vyos.net
set service ntp server time2.vyos.net
set service ntp server time3.vyos.net
set service https allow-client address '172.16.0.0/12'
set service https allow-client address '192.168.0.0/16'
set service https allow-client address '10.0.0.0/8'
set service https allow-client address '2001:db8::/32'
set service https api keys id 1 key 'S3cur3'
set service ntp allow-client address '0.0.0.0/0'
set service ntp allow-client address '::/0'
set service ntp server time1.vyos.net
set service ntp server time2.vyos.net
set service ntp server time3.vyos.net
set system config-management commit-revisions '100'
set system conntrack modules ftp
set system conntrack modules h323
set system conntrack modules nfs
set system conntrack modules pptp
set system conntrack modules sip
set system conntrack modules sqlnet
set system conntrack modules tftp
set system console device ttyS0 speed '115200'
set system host-name 'vyos'
set system login user vyos authentication encrypted-password '$6$2Ta6TWHd/U$NmrX0x9kexCimeOcYK1MfhMpITF9ELxHcaBU/znBq.X2ukQOj61fVI2UYP/xBzP4QtiTcdkgs7WOQMHWsRymO/'
set system login user vyos authentication plaintext-password ''
set system console device ttyS0 speed '115200'
set system syslog global facility all level 'info'
set system syslog global facility local7 level 'debug'
47 changes: 33 additions & 14 deletions smoketest/config-tests/basic-vyos
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
set interfaces ethernet eth0 address '192.168.0.1/24'
set interfaces ethernet eth0 address 'fe88::1/56'
set interfaces ethernet eth0 duplex 'auto'
set interfaces ethernet eth0 offload gro
set interfaces ethernet eth0 speed 'auto'
set interfaces ethernet eth1 duplex 'auto'
set interfaces ethernet eth1 offload gro
set interfaces ethernet eth1 speed 'auto'
set interfaces ethernet eth2 duplex 'auto'
set interfaces ethernet eth2 offload gro
set interfaces ethernet eth2 speed 'auto'
set interfaces ethernet eth2 vif 100 address '100.100.0.1/24'
set interfaces ethernet eth2 vif-s 200 address '100.64.200.254/24'
set interfaces ethernet eth2 vif-s 200 vif-c 201 address '100.64.201.254/24'
Expand All @@ -19,17 +28,6 @@ set protocols static arp interface eth2.200.201 address 100.64.201.20 mac '00:50
set protocols static arp interface eth2.200.202 address 100.64.202.30 mac '00:50:00:00:00:30'
set protocols static arp interface eth2.200.202 address 100.64.202.40 mac '00:50:00:00:00:40'
set protocols static route 0.0.0.0/0 next-hop 100.64.0.1
set service ssh ciphers 'aes128-ctr'
set service ssh ciphers 'aes192-ctr'
set service ssh ciphers 'aes256-ctr'
set service ssh ciphers 'chacha20-poly1305@openssh.com'
set service ssh ciphers 'rijndael-cbc@lysator.liu.se'
set service ssh key-exchange 'curve25519-sha256@libssh.org'
set service ssh key-exchange 'diffie-hellman-group1-sha1'
set service ssh key-exchange 'diffie-hellman-group-exchange-sha1'
set service ssh key-exchange 'diffie-hellman-group-exchange-sha256'
set service ssh listen-address '192.168.0.1'
set service ssh port '22'
set service dhcp-server shared-network-name LAN authoritative
set service dhcp-server shared-network-name LAN subnet 192.168.0.0/24 option default-router '192.168.0.1'
set service dhcp-server shared-network-name LAN subnet 192.168.0.0/24 option domain-name 'vyos.net'
Expand Down Expand Up @@ -66,19 +64,40 @@ set service dns forwarding allow-from '192.168.0.0/16'
set service dns forwarding cache-size '10000'
set service dns forwarding dnssec 'off'
set service dns forwarding listen-address '192.168.0.1'
set service ssh ciphers 'aes128-ctr'
set service ssh ciphers 'aes192-ctr'
set service ssh ciphers 'aes256-ctr'
set service ssh ciphers 'chacha20-poly1305@openssh.com'
set service ssh ciphers 'rijndael-cbc@lysator.liu.se'
set service ssh key-exchange 'curve25519-sha256@libssh.org'
set service ssh key-exchange 'diffie-hellman-group1-sha1'
set service ssh key-exchange 'diffie-hellman-group-exchange-sha1'
set service ssh key-exchange 'diffie-hellman-group-exchange-sha256'
set service ssh listen-address '192.168.0.1'
set service ssh port '22'
set system config-management commit-revisions '100'
set system conntrack ignore ipv4 rule 1 destination address '192.0.2.2'
set system conntrack ignore ipv4 rule 1 source address '192.0.2.1'
set system conntrack modules ftp
set system conntrack modules h323
set system conntrack modules nfs
set system conntrack modules pptp
set system conntrack modules sip
set system conntrack modules sqlnet
set system conntrack modules tftp
set system console device ttyS0 speed '115200'
set system host-name 'vyos'
set system login user vyos authentication encrypted-password '$6$O5gJRlDYQpj$MtrCV9lxMnZPMbcxlU7.FI793MImNHznxGoMFgm3Q6QP3vfKJyOSRCt3Ka/GzFQyW1yZS4NS616NLHaIPPFHc0'
set system login user vyos authentication plaintext-password ''
set system name-server '192.168.0.1'
set system syslog global facility auth level 'info'
set system syslog global preserve-fqdn
set system syslog console facility all level 'emerg'
set system syslog console facility mail level 'info'
set system syslog global facility all level 'info'
set system syslog global facility auth level 'info'
set system syslog global facility local7 level 'debug'
set system syslog global preserve-fqdn
set system syslog host syslog.vyos.net facility auth level 'warning'
set system syslog host syslog.vyos.net facility local7 level 'notice'
set system syslog host syslog.vyos.net format octet-counted
set system syslog host syslog.vyos.net port '8000'
set system console device ttyS0 speed '115200'
set system time-zone 'Europe/Berlin'
Loading
Loading