Skip to content

Commit

Permalink
Add httpks and pre version of network MAC tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rvykydal committed May 26, 2017
1 parent 6203cb3 commit ddb8822
Show file tree
Hide file tree
Showing 4 changed files with 173 additions and 0 deletions.
40 changes: 40 additions & 0 deletions network-device-mac-httpks.ks.in
@@ -0,0 +1,40 @@
#test name: network-device-mac
url @KSTEST_URL@
install

network --bootproto=dhcp --device=52:54:00:12:34:57
network --bootproto=dhcp --device=52:54:00:12:34:58 --activate

bootloader --timeout=1
zerombr
clearpart --all
autopart

keyboard us
lang en
timezone America/New_York
rootpw qweqwe
shutdown

%packages
%end

%post

@KSINCLUDE@ post-lib-network.sh

# --device=<MAC> is used to specify the interface, not to bind the
# connection to the MAC address
check_device_ifcfg_key_missing ens3 HWADDR
check_ifcfg_exists ens3-1 no
check_device_connected ens3 yes

check_device_ifcfg_key_missing ens4 HWADDR
check_ifcfg_exists ens4-1 no
check_device_connected ens4 yes

# No error was written to /root/RESULT file, everything is OK
if [[ ! -e /root/RESULT ]]; then
echo SUCCESS > /root/RESULT
fi
%end
58 changes: 58 additions & 0 deletions network-device-mac-httpks.sh
@@ -0,0 +1,58 @@
#
# Copyright (C) 2017 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties 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, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
# source code or documentation are not subject to the GNU General Public
# License and may only be used or replicated with the express permission of
# Red Hat, Inc.
#
# Red Hat Author(s): Radek Vykydal <rvykydal@redhat.com>

TESTTYPE="network"

. ${KSTESTDIR}/functions.sh

kernel_args() {
. ${tmpdir}/ks_url
echo vnc debug=1 inst.debug ip=ens3:dhcp inst.ks=${ks_url}
}

# Arguments for virt-install --network options
prepare_network() {
echo "network=default,mac=52:54:00:12:34:57"
echo "network=default,mac=52:54:00:12:34:58"
}

prepare() {
ks=$1
tmpdir=$2

# Copy the kickstart to a directory in tmpdir
mkdir ${tmpdir}/http
cp $ks ${tmpdir}/http/ks.cfg

# Start a http server to serve the included file
start_httpd ${tmpdir}/http $tmpdir

echo ks_url=${httpd_url}ks.cfg > ${tmpdir}/ks_url
# Return empty path to kickstart file which will result in ks not
# being injected into initrd.
echo ""
}

cleanup() {
tmpdir=$1

if [ -f ${tmpdir}/httpd-pid ]; then
kill $(cat ${tmpdir}/httpd-pid)
fi
}
43 changes: 43 additions & 0 deletions network-device-mac-pre.ks.in
@@ -0,0 +1,43 @@
#test name: network-device-mac-pre
url @KSTEST_URL@
install

%include /tmp/ksinclude
%pre
echo "network --bootproto=dhcp --device=52:54:00:12:34:59" >> /tmp/ksinclude
echo "network --bootproto=dhcp --device=52:54:00:12:34:5A --activate" >> /tmp/ksinclude
%end

bootloader --timeout=1
zerombr
clearpart --all
autopart

keyboard us
lang en
timezone America/New_York
rootpw qweqwe
shutdown

%packages
%end

%post

@KSINCLUDE@ post-lib-network.sh

# --device=<MAC> is used to specify the interface, not to bind the
# connection to the MAC address
check_device_ifcfg_key_missing ens3 HWADDR
check_ifcfg_exists ens3-1 no
check_device_connected ens3 yes

check_device_ifcfg_key_missing ens4 HWADDR
check_ifcfg_exists ens4-1 no
check_device_connected ens4 yes

# No error was written to /root/RESULT file, everything is OK
if [[ ! -e /root/RESULT ]]; then
echo SUCCESS > /root/RESULT
fi
%end
32 changes: 32 additions & 0 deletions network-device-mac-pre.sh
@@ -0,0 +1,32 @@
#
# Copyright (C) 2017 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY expressed or implied, including the implied warranties 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, write to the
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
# source code or documentation are not subject to the GNU General Public
# License and may only be used or replicated with the express permission of
# Red Hat, Inc.
#
# Red Hat Author(s): Radek Vykydal <rvykydal@redhat.com>

TESTTYPE="network"

. ${KSTESTDIR}/functions.sh

kernel_args() {
echo vnc debug=1 inst.debug ip=ens3:dhcp
}

# Arguments for virt-install --network options
prepare_network() {
echo "network=default,mac=52:54:00:12:34:59"
echo "network=default,mac=52:54:00:12:34:5A"
}

0 comments on commit ddb8822

Please sign in to comment.