mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-31 01:56:39 +00:00
add validation cases for site object
This commit is contained in:
parent
38893aebe9
commit
bcbaf03175
126
xCAT-test/autotest/testcase/xcat-inventory/cases.site.validation
Normal file
126
xCAT-test/autotest/testcase/xcat-inventory/cases.site.validation
Normal file
@ -0,0 +1,126 @@
|
||||
start: xcat_inventory_import_validation_site
|
||||
description: verify the validation mechanisom while importing site object
|
||||
|
||||
cmd: rm -rf /tmp/xcat_inventory_import_validation_site
|
||||
cmd: mkdir -p /tmp/xcat_inventory_import_validation_site
|
||||
cmd: mkdir -p /tmp/xcat_inventory_import_validation_site/trash/
|
||||
cmd: mkdir -p /tmp/xcat_inventory_import_validation_site/backup/
|
||||
cmd: lsdef -t site -o clustersite -z 2>/dev/null >/tmp/xcat_inventory_import_validation_site/backup/clustersite.stanza
|
||||
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "dbtracelevel" "0" "/tmp/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "dbtracelevel" "1" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "dbtracelevel" "2" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "dbtracelevel" "3" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "dbtracelevel" "4" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "dbtracelevel" "invalid" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc!=0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "dbtracelevel" "" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "dhcplease" "" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "dhcplease" "10240" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "dhcplease" "invalid" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc!=0
|
||||
|
||||
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "disjointdhcps" "0" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "disjointdhcps" "1" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "disjointdhcps" "" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "disjointdhcps" "invalid" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc!=0
|
||||
|
||||
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "httpport" "" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "httpport" "80" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "httpport" "invalid" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc!=0
|
||||
|
||||
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "managedaddressmode" "" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "managedaddressmode" "static" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "managedaddressmode" "dhcp" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "managedaddressmode" "invalid" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc!=0
|
||||
|
||||
|
||||
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "sharedinstall" "" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "sharedinstall" "no" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "sharedinstall" "sns" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "sharedinstall" "all" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "sharedinstall" "invalid" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc!=0
|
||||
|
||||
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "sshbetweennodes" "" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "sshbetweennodes" "ALLGROUPS" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "sshbetweennodes" "NOGROUPS" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "sshbetweennodes" "invalid" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc!=0
|
||||
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "xcatdebugmode" "" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "xcatdebugmode" "0" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "xcatdebugmode" "1" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "xcatdebugmode" "2" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "xcatdebugmode" "invalid" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc!=0
|
||||
|
||||
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "xcatdport" "" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "xcatdport" "3001" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "xcatdport" "invalid" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc!=0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "xcatdport" "3002" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc!=0
|
||||
|
||||
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "xcatiport" "" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "xcatiport" "3001" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc!=0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "xcatiport" "invalid" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc!=0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "xcatiport" "3002" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
|
||||
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "xcatlport" "" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "xcatlport" "3001" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc!=0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "xcatlport" "invalid" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc!=0
|
||||
cmd: /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "site" "clustersite" "xcatlport" "3003" "/tmp/xcat_inventory_import_validation_site/trash/"
|
||||
check: rc==0
|
||||
|
||||
cmd: cat /tmp/xcat_inventory_import_validation_site/backup/clustersite.stanza 2>/dev/null |mkdef -z -f
|
||||
cmd: rm -rf /tmp/xcat_inventory_import_validation_site
|
||||
end
|
@ -0,0 +1,18 @@
|
||||
{
|
||||
"schema_version": "1.0",
|
||||
"site": {
|
||||
"clustersite": {
|
||||
"dbtracelevel": "1",
|
||||
"dhcplease": "10240",
|
||||
"disjointdhcps": "0",
|
||||
"httpport": "80",
|
||||
"sharedinstall": "no",
|
||||
"managedaddressmode": "dhcp",
|
||||
"sshbetweennodes": "ALLGROUPS",
|
||||
"xcatdebugmode": "0",
|
||||
"xcatdport": "3001",
|
||||
"xcatiport": "3002",
|
||||
"xcatlport": "3003"
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
schema_version: '1.0'
|
||||
site:
|
||||
clustersite:
|
||||
dbtracelevel: '1'
|
||||
dhcplease: '10240'
|
||||
disjointdhcps: '0'
|
||||
httpport: '80'
|
||||
sharedinstall: 'no'
|
||||
managedaddressmode: 'dhcp'
|
||||
sshbetweennodes: 'ALLGROUPS'
|
||||
xcatdebugmode: '0'
|
||||
xcatdport: '3001'
|
||||
xcatiport: '3002'
|
||||
xcatlport: '3003'
|
||||
|
@ -51,6 +51,15 @@ jsondef="${tmpdir}/${objtype}.json"
|
||||
yamldefout="${tmpdir}/${objtype}.out.yaml"
|
||||
jsondefout="${tmpdir}/${objtype}.out.json"
|
||||
|
||||
echo "removing existing \"$objtype\" type object \"$objname\" from xCAT"
|
||||
echo "osimage node network site route zone policy "|grep -q -w "$objtype"
|
||||
if [ $? -eq 0 ];then
|
||||
rmdef -t $objtype -o $objname
|
||||
fi
|
||||
if [ "$objtype" = "passwd" ];then
|
||||
tabch -d key=$objname passwd
|
||||
fi
|
||||
|
||||
#substitute the attribute value in inventory files
|
||||
if [ ${#attrvalue} -ne 0 ];then
|
||||
sed -i -E -e "s/^(\s*["'"'"']?$attribute["'"'"']?:\s*["'"'"']?)[^'"'"'"]*(["'"'"']?[,]?\s*)$/\1$attrvalue\2/g" $yamldef
|
||||
@ -62,15 +71,6 @@ echo "=================the inventory file to import: ${yamldef}=================
|
||||
cat $yamldef
|
||||
echo "=============================================================================="
|
||||
|
||||
echo "removing existing \"$objtype\" type object \"$objname\" from xCAT"
|
||||
echo "osimage node network site route zone policy "|grep -q -w "$objtype"
|
||||
if [ $? -eq 0 ];then
|
||||
rmdef -t $objtype -o $objname
|
||||
fi
|
||||
if [ "$objtype" = "passwd" ];then
|
||||
tabch -d key=$objname passwd
|
||||
fi
|
||||
|
||||
|
||||
echo "import the inventory file $yamldef "
|
||||
xcat-inventory import -t $objtype -o $objname -f $yamldef
|
||||
@ -181,6 +181,9 @@ if [ "$objtype" = "passwd" ];then
|
||||
tabch -d key=$objname passwd
|
||||
fi
|
||||
|
||||
echo "remove intermediate directory $tmpdir"
|
||||
[ -e "$tmpdir" ] || rm -rf $tmpdir
|
||||
|
||||
if [ $RETCODE_YAML -ne 0 ] || [ $RETCODE_JSON -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user