diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.network b/xCAT-test/autotest/testcase/xcat-inventory/cases.network new file mode 100644 index 000000000..c923f33ca --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.network @@ -0,0 +1,37 @@ +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" "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" "net" "234abc" "/tmp/xcat_inventory_import_validation_network" +check:rc!=0 +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "network" "autotestnet" "net" "" "/tmp/xcat_inventory_import_validation_network" +check:rc!=0 +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "network" "autotestnet" "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" "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" "mask" "" "/tmp/xcat_inventory_import_validation_network" +check:rc!=0 +cmd:/opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/validatehelper "network" "autotestnet" "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" "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" "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" "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" "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" "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" "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 diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.passwd b/xCAT-test/autotest/testcase/xcat-inventory/cases.passwd new file mode 100644 index 000000000..ec1be08de --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.passwd @@ -0,0 +1,23 @@ +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 diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.route b/xCAT-test/autotest/testcase/xcat-inventory/cases.route new file mode 100644 index 000000000..d31451aa4 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.route @@ -0,0 +1,21 @@ +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 diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/network.json b/xCAT-test/autotest/testcase/xcat-inventory/templates/network.json new file mode 100644 index 000000000..263b936b6 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/network.json @@ -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" +} diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/network.yaml b/xCAT-test/autotest/testcase/xcat-inventory/templates/network.yaml new file mode 100644 index 000000000..88e4114d4 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/network.yaml @@ -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' + diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/passwd.json b/xCAT-test/autotest/testcase/xcat-inventory/templates/passwd.json new file mode 100644 index 000000000..ca7f4bb78 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/passwd.json @@ -0,0 +1,10 @@ +{ + "passwd": { + "autotest": { + "cryptmethod": "md5", + "password": "cluster", + "username": "root" + } + }, + "schema_version": "1.0" +} diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/passwd.yaml b/xCAT-test/autotest/testcase/xcat-inventory/templates/passwd.yaml new file mode 100644 index 000000000..1225761cb --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/passwd.yaml @@ -0,0 +1,7 @@ +passwd: + autotest: + cryptmethod: md5 + password: cluster + username: root +schema_version: '1.0' + diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/route.json b/xCAT-test/autotest/testcase/xcat-inventory/templates/route.json new file mode 100644 index 000000000..aa2b9febe --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/route.json @@ -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" +} diff --git a/xCAT-test/autotest/testcase/xcat-inventory/templates/route.yaml b/xCAT-test/autotest/testcase/xcat-inventory/templates/route.yaml new file mode 100644 index 000000000..5afda5a8d --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/templates/route.yaml @@ -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' +