2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-30 17:46:38 +00:00

Merge pull request #5003 from bybai/valid

add xcat-inventory passwd network route validation testcase
This commit is contained in:
Weihua Hu 2018-03-30 17:07:53 +08:00 committed by GitHub
commit f1780b0c79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 173 additions and 0 deletions

View File

@ -0,0 +1,51 @@
start:xcat_inventory_import_validation_network
description:This case is used to test network validation function of xcat-inventory import yaml and json file. To test "net" "mask" "dynamicrange" and "staticrange" attributes
cmd:lsdef -t network -o autotestnet > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t network -o autotestnet -z >/tmp/xcat_inventory_import_validation_network_bak/autotestnet.stanza ;rmdef -t network -o autotestnet;fi
check:rc==0
cmd:mkdir -p /tmp/xcat_inventory_import_validation_network_bak
check:rc==0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "network" "autotestnet" "basic_attr.net" "200.0.0.0" "/tmp/xcat_inventory_import_validation_network"
check:rc==0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "network" "autotestnet" "basic_attr.net" "234abc" "/tmp/xcat_inventory_import_validation_network"
check:rc!=0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "network" "autotestnet" "basic_attr.net" "" "/tmp/xcat_inventory_import_validation_network"
check:rc!=0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "network" "autotestnet" "basic_attr.net" "234.abc.456.789" "/tmp/xcat_inventory_import_validation_network"
check:rc!=0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "network" "autotestnet" "basic_attr.mask" "234.abc.456.789" "/tmp/xcat_inventory_import_validation_network"
check:rc!=0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "network" "autotestnet" "basic_attr.mask" "" "/tmp/xcat_inventory_import_validation_network"
check:rc!=0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "network" "autotestnet" "basic_attr.mask" "234.0.0.0" "/tmp/xcat_inventory_import_validation_network"
check:rc==0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "network" "autotestnet" "pool.dynamicrange" "200.0.0.100-200.0.0.200" "/tmp/xcat_inventory_import_validation_network"
check:rc==0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "network" "autotestnet" "pool.dynamicrange" "200.0.0.100" "/tmp/xcat_inventory_import_validation_network"
check:rc==0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "network" "autotestnet" "pool.dynamicrange" "abc-bcd" "/tmp/xcat_inventory_import_validation_network"
check:rc!=0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "network" "autotestnet" "pool.staticrange" "200.0.0.100-200.0.0.200" "/tmp/xcat_inventory_import_validation_network"
check:rc==0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "network" "autotestnet" "pool.staticrange" "200.0.0.100" "/tmp/xcat_inventory_import_validation_network"
check:rc==0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "network" "autotestnet" "pool.staticrange" "abc-bcd" "/tmp/xcat_inventory_import_validation_network"
check:rc!=0
cmd:if [[ -e /tmp/xcat_inventory_import_validation_network_bak/autotestnet.stanza ]]; then cat /tmp/xcat_inventory_import_validation_network_bak/autotestnet.stanza | mkdef -z; fi
check:rc==0
cmd:rm -rf /tmp/xcat_inventory_import_validation_network_bak
check:rc==0
end

View File

@ -0,0 +1,30 @@
start:xcat_inventory_import_validation_passwd
description:This case is used to test passwd validation function of xcat-inventory import yaml and json file. To test "cryptmethod" attribute
cmd:tabdump -w 'key==autotest' passwd |grep autotest > /dev/null 2>&1;if [[ $? -eq 0 ]]; then xcat-inventory export -t passwd -o autotest >/tmp/xcat_inventory_import_validation_passwd_bak/autotest ;tabch -d 'key==autotest' passwd;fi
check:rc==0
cmd:mkdir -p /tmp/xcat_inventory_import_validation_passwd_bak
check:rc==0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "passwd" "autotest" "cryptmethod" "" "/tmp/xcat_inventory_import_validation_passwd"
check:rc==0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "passwd" "autotest" "cryptmethod" "md5" "/tmp/xcat_inventory_import_validation_passwd"
check:rc==0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "passwd" "autotest" "cryptmethod" "sha256" "/tmp/xcat_inventory_import_validation_passwd"
check:rc==0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "passwd" "autotest" "cryptmethod" "sha512" "/tmp/xcat_inventory_import_validation_passwd"
check:rc==0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "passwd" "autotest" "cryptmethod" "a.a" "/tmp/xcat_inventory_import_validation_passwd"
check:rc!=0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "passwd" "autotest" "cryptmethod" "MD5" "/tmp/xcat_inventory_import_validation_passwd"
check:rc!=0
cmd:if [[ -e /tmp/xcat_inventory_import_validation_passwd_bak/autotest ]]; then xcat-inventory import -f /tmp/xcat_inventory_import_validation_passwd_bak/autotest; fi
check:rc==0
cmd:rm -rf /tmp/xcat_inventory_import_validation_passwd_bak
check:rc==0
end

View File

@ -0,0 +1,27 @@
start:xcat_inventory_import_validation_route
description:This case is used to test route validation function of xcat-inventory import yaml and json file. To test "net" and "mask" attributes
cmd:mkdir -p /tmp/xcat_inventory_import_validation_route_bak
check:rc==0
cmd:lsdef -t route -o autotestnet > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t route -o autotestnet -z >/tmp/xcat_inventory_import_validation_route_bak/autotestnet.stanza ;rmdef -t route -o autotestnet;fi
check:rc==0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "route" "autotestnet" "net" "200.0.0.0" "/tmp/xcat_inventory_import_validation_route"
check:rc==0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "route" "autotestnet" "net" "200.0" "/tmp/xcat_inventory_import_validation_route"
check:rc!=0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "route" "autotestnet" "net" "" "/tmp/xcat_inventory_import_validation_route"
check:rc!=0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "route" "autotestnet" "net" "default" "/tmp/xcat_inventory_import_validation_route"
check:rc==0
cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "route" "autotestnet" "net" "abc.345.123.202" "/tmp/xcat_inventory_import_validation_route"
check:rc!=0
cmd:if [[ -e /tmp/xcat_inventory_import_validation_route_bak/autotestnet.stanza ]]; then cat /tmp/xcat_inventory_import_validation_route_bak/autotestnet.stanza | mkdef -z;fi
check:rc==0
cmd:rm -rf /tmp/xcat_inventory_import_validation_route_bak
check:rc==0
end

View File

@ -0,0 +1,16 @@
{
"network": {
"autotestnet": {
"basic_attr": {
"gateway": "123.0.0.100",
"mask": "255.0.0.0",
"net": "123.0.0.0"
},
"pool": {
"dynamicrange": "123.0.0.100-123.0.0.200",
"staticrange": "123.0.0.201-123.0.0.222"
}
}
},
"schema_version": "1.0"
}

View File

@ -0,0 +1,11 @@
network:
autotestnet:
basic_attr:
gateway: 123.0.0.100
mask: 255.0.0.0
net: 123.0.0.0
pool:
dynamicrange: 123.0.0.100-123.0.0.200
staticrange: 123.0.0.201-123.0.0.222
schema_version: '1.0'

View File

@ -0,0 +1,10 @@
{
"passwd": {
"autotest": {
"cryptmethod": "md5",
"password": "cluster",
"username": "root"
}
},
"schema_version": "1.0"
}

View File

@ -0,0 +1,7 @@
passwd:
autotest:
cryptmethod: md5
password: cluster
username: root
schema_version: '1.0'

View File

@ -0,0 +1,12 @@
{
"route": {
"autotestnet": {
"gateway": "0.0.0.0",
"ifname": "eth1",
"mask": "255.0.0.0",
"net": "100.0.0.0",
"usercomment": "hello world"
}
},
"schema_version": "1.0"
}

View File

@ -0,0 +1,9 @@
route:
autotestnet:
gateway: 0.0.0.0
ifname: eth1
mask: 255.0.0.0
net: 100.0.0.0
usercomment: hello world
schema_version: '1.0'