2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-30 01:26:38 +00:00
litingt@cn.ibm.com 8f23be1888 fix typo
2018-11-02 03:18:10 -04:00

143 lines
13 KiB
Plaintext

start:import_osimage_with_environments_in_yaml
description:this case is to verify if osimage import could support environment variables.
os:Linux
label:others,xcat_inventory,invoke_provison
cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN
check:rc==0
cmd:makedns -n
check:rc==0
cmd:sleep 20
cmd:if [[ "__GETNODEATTR($$CN,arch)__" = "ppc64" ]] && [[ "__GETNODEATTR($$CN,mgt)__" != "ipmi" ]]; then getmacs -D $$CN; fi
check:rc==0
cmd:makedhcp -n
check:rc==0
cmd:makedhcp -a
check:rc==0
cmd:a=0;while true; do [ $a -eq 100 ] && exit 1;output=$(makedhcp -q $$CN);[ $? -ne 0 ] && exit 1;echo $output|grep $$CN 2>/dev/null && exit 0;a=$[$a+1];sleep 1;done
check:rc==0
cmd:copycds $$ISO
check:rc==0
cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir ]; then mv $rootimgdir $rootimgdir.regbak -f;fi
check:rc==0
cmd:osarch=$(lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep osarch|awk -F'=' '{print $2}');sed -i "s/OSARCH/$osarch/g" /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.yaml
cmd:osvers=$(lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep osvers|awk -F'=' '{print $2}');sed -i "s/OSVERS/$osvers/g" /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.yaml
cmd:pkgdir=$(lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep -w pkgdir|awk -F'=' '{print $2}');sed -i "s!PKGDIR!$pkgdir!g" /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.yaml
cmd:pkglist=$(lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep -w pkglist|awk -F'=' '{print $2}');sed -i "s!PKGLIST!$pkglist!g" /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.yaml
cmd:postinstall=$(lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep -w postinstall|awk -F'=' '{print $2}');sed -i "s!POSTINSTALL!$postinstall!g" /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.yaml
cmd:osmajor=$(lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep osvers|awk -F'=' '{print $2}');sed -i "s/OSMAJOR/$osmajor/g" /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.yaml
cmd:xcat-inventory import -f /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.yaml -e GITREPO=/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/gitrepo -e SWDIR=/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/swdir
check:output=~Inventory import successfully!
check:rc==0
cmd:lsdef -t osimage -o test.environments.osimage
check:rc==0
cmd:genimage test.environments.osimage
check:rc==0
cmd:packimage test.environments.osimage
check:rc==0
cmd:rinstall $$CN osimage=test.environments.osimage
check:rc==0
check:output=~Provision node\(s\)\: $$CN
cmd:if [[ -f /var/lib/dhcp/db/dhcpd.leases ]]; then cat /var/lib/dhcp/db/dhcpd.leases; elif [[ -f /var/lib/dhcpd/dhcpd.leases ]];then cat /var/lib/dhcpd/dhcpd.leases;elif [[ -f /var/lib/dhcp/dhcpd.leases ]];then cat /var/lib/dhcp/dhcpd.leases; fi
cmd:cat /tmp/mountoutput/file.org
cmd:sleep 300
cmd:a=0;while ! `lsdef -l $$CN|grep status|grep booted >/dev/null`; do sleep 10;((a++));if [ $a -gt 60 ];then break;fi done
cmd:ping $$CN -c 3
check:rc==0
check:output=~64 bytes from $$CN
cmd:lsdef -l $$CN | grep status
check:rc==0
check:output=~booted
cmd:xdsh $$CN date
check:rc==0
check:output=~\d\d:\d\d:\d\d
cmd:xdsh $$CN mount
check:rc==0
check:output=~on / type tmpfs
cmd:sleep 120
cmd:ping $$CN -c 3
check:rc==0
check:output=~64 bytes from $$CN
cmd:rootimgdir=`lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep rootimgdir|awk -F'=' '{print $2}'`; if [ -d $rootimgdir.regbak ]; then rm -rf $rootimgdir; mv $rootimgdir.regbak $rootimgdir; fi
check:rc==0
cmd:xdsh $$CN "cat /var/log/xcat/xcat.log"
cmd:xdsh $$CN "cat /tmp/synclist"
check:rc==0
cmd:xdsh $$CN "cat /tmp/test1.postinstall"
check:rc==0
check:output=~test postisntall
cmd:xdsh $$CN "cat /tmp/test2.postinstall"
check:rc==0
check:output=~test postisntall
cmd:xdsh $$CN "rpm -qa |grep -i conserver-xcat"
check:rc==0
cmd:xdsh $$CN "rpm -qa |grep -i perl-Net-Telnet"
check:rc==0
cmd:xdsh $$CN "rpm -qa |grep -i tftp"
check:rc==0
cmd:xdsh $$CN "rpm -qa |grep -w dhcp"
check:rc==0
end
start:export_osimage_with_environments
description:this case is to verify if osimage export could support environment variables.
os:Linux
label:others,xcat_inventory
cmd:lsdef -t osimage -o test.environments.osimage >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test.environments.osimage -z >/tmp/test.environments.osimage_image.stanza ;rmdef -t osimage -o test.environments.osimage;fi
check:rc==0
cmd:dir="/tmp/export";if [ -e "${dir}" ];then mv ${dir} ${dir}".bak"; fi; mkdir -p $dir
cmd:osarch=$(lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep osarch|awk -F'=' '{print $2}');sed -i "s/OSARCH/$osarch/g" /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.yaml
cmd:osvers=$(lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep osvers|awk -F'=' '{print $2}');sed -i "s/OSVERS/$osvers/g" /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.yaml
cmd:pkgdir=$(lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep -w pkgdir|awk -F'=' '{print $2}');sed -i "s!PKGDIR!$pkgdir!g" /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.yaml
cmd:pkglist=$(lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep -w pkglist|awk -F'=' '{print $2}');sed -i "s!PKGLIST!$pkglist!g" /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.yaml
cmd:postinstall=$(lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep -w postinstall|awk -F'=' '{print $2}');sed -i "s!POSTINSTALL!$postinstall!g" /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.yaml
cmd:osmajor=$(lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep osvers|awk -F'=' '{print $2}');sed -i "s/OSMAJOR/$osmajor/g" /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.yaml
cmd:xcat-inventory import -f /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.yaml -e GITREPO=/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/gitrepo -e SWDIR=/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/swdir
check:output=~Inventory import successfully!
check:rc==0
cmd:lsdef -t osimage -o test.environments.osimage -z >> /tmp/export/test.environments.osimage.yaml.stanza
check:rc==0
cmd:osarch=$(lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep osarch|awk -F'=' '{print $2}');sed -i "s/OSARCH/$osarch/g" /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.stanza
cmd:osvers=$(lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep osvers|awk -F'=' '{print $2}');sed -i "s/OSVERS/$osvers/g" /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.stanza
cmd:pkgdir=$(lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep -w pkgdir|awk -F'=' '{print $2}');sed -i "s!PKGDIR!$pkgdir!g" /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.stanza
cmd:pkglist=$(lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep -w pkglist|awk -F'=' '{print $2}');sed -i "s!PKGLIST!$pkglist!g" /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.stanza
cmd:postinstall=$(lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep -w postinstall|awk -F'=' '{print $2}');sed -i "s!POSTINSTALL!$postinstall!g" /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.stanza
cmd:osmajor=$(lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep osvers|awk -F'=' '{print $2}');sed -i "s/OSMAJOR/$osmajor/g" /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.stanza
cmd:diff -y /tmp/export/test.environments.osimage.yaml.stanza /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.stanza
check:rc==0
cmd:xcat-inventory export -t osimage -o test.environments.osimage -f /tmp/export/test.environments.osimage.yaml --format yaml
check:rc==0
check:output=~The inventory data has been dumped to /tmp/export/test.environments.osimage.yaml
cmd:diff -y /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.yaml /tmp/export/test.environments.osimage.yaml --ignore-blank-lines -I "^#"
check:rc==0
cmd:rmdef -t osimage -o test.environments.osimage
check:rc==0
cmd:osarch=$(lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep osarch|awk -F'=' '{print $2}');sed -i "s/OSARCH/$osarch/g" /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.json
cmd:osvers=$(lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep osvers|awk -F'=' '{print $2}');sed -i "s/OSVERS/$osvers/g" /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.json
cmd:pkgdir=$(lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep -w pkgdir|awk -F'=' '{print $2}');sed -i "s!PKGDIR!$pkgdir!g" /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.json
cmd:pkglist=$(lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep -w pkglist|awk -F'=' '{print $2}');sed -i "s!PKGLIST!$pkglist!g" /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.json
cmd:postinstall=$(lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep -w postinstall|awk -F'=' '{print $2}');sed -i "s!POSTINSTALL!$postinstall!g" /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.json
cmd:osmajor=$(lsdef -t osimage __GETNODEATTR($$CN,os)__-__GETNODEATTR($$CN,arch)__-netboot-compute|grep osvers|awk -F'=' '{print $2}');sed -i "s/OSMAJOR/$osmajor/g" /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.json
cmd:xcat-inventory import -f /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.json -e GITREPO=/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/gitrepo -e SWDIR=/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/swdir
check:output=~Inventory import successfully!
check:rc==0
cmd:lsdef -t osimage -o test.environments.osimage -z >> /tmp/export/test.environments.osimage.json.stanza
check:rc==0
cmd:diff -y /tmp/export/test.environments.osimage.json.stanza /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.stanza
check:rc==0
cmd:xcat-inventory export -t osimage -o test.environments.osimage -f /tmp/export/test.environments.osimage.json
check:rc==0
cmd:diff -y /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/environment/test.environments.osimage.update.json /tmp/export/test.environments.osimage.json --ignore-blank-lines -I "^#"
check:rc==0
cmd:dir="/tmp/export"; rm -rf $dir; if [ -d ${dir}".bak" ];then mv ${dir}".bak" $dir; fi
cmd: rmdef -t osimage -o test.environments.osimage
check:rc==0
cmd: if [ -e /tmp/test.environments.osimage.stanza ]; then cat /tmp/test.environments.osimage.stanza |mkdef -z;fi
end