2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-06-21 05:25:32 +00:00

update case for task 246,xcat-inventory support regular expression (#5647)

This commit is contained in:
tingtli
2018-09-20 15:24:53 +08:00
committed by yangsong
parent a9190ecee6
commit a642a04b4a
4 changed files with 89 additions and 0 deletions

View File

@ -0,0 +1,45 @@
start:export_import_nics_with_regex
description:This case is used to test xcat-inventory export and import could support regex for xcat attributes.
label:others,xcat_inventory
cmd:dir="/tmp/export";if [ -e "${dir}" ];then mv ${dir} ${dir}".bak"; fi; mkdir -p $dir
cmd:tabdump nics |tee /tmp/export/nics.cvs
check:rc==0
cmd:tabrestore /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/nics.csv
check:rc==0
cmd:xcat-inventory export -t node -o testnodes -f /tmp/export/nics.yaml --format yaml
check:rc==0
check:output=~The inventory data has been dumped to /tmp/export/nics.yaml
cmd:diff -y /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/nics.yaml /tmp/export/nics.yaml --ignore-blank-lines -I "^#"
check:rc==0
cmd:xcat-inventory export -t node -o testnodes -f /tmp/export/nics.json --format json
check:rc==0
cmd:diff -y /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/nics.json /tmp/export/nics.json --ignore-blank-lines -I "^#"
check:rc==0
cmd:tabch -d node="testnodes" nics
check:rc==0
cmd:xcat-inventory import -t node -o testnodes -f /tmp/export/nics.yaml
check:rc==0
check:output=~loading inventory date in "/tmp/export/nics.yaml"
check:output=~start to import "node" type objects
check:output=~ preprocessing "node" type objects
check:output=~ writting "node" type objects
check:output=~Inventory import successfully!
cmd:tabdump nics |tee /tmp/export/nics.yaml.cvs;diff -y /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/nics.csv /tmp/export/nics.yaml.cvs
check:rc==0
cmd:tabch -d node="testnodes" nics
check:rc==0
cmd:xcat-inventory import -t node -o testnodes -f /tmp/export/nics.json
check:rc==0
check:output=~loading inventory date in "/tmp/export/nics.json"
check:output=~start to import "node" type objects
check:output=~ preprocessing "node" type objects
check:output=~ writting "node" type objects
check:output=~Inventory import successfully!
cmd:tabdump nics |tee /tmp/export/nics.json.cvs;diff -y /opt/xcat/share/xcat/tools/autotest/testcase/xcat-inventory/templates/nics.csv /tmp/export/nics.json.cvs
check:rc==0
cmd:tabch -d node="testnodes" nics
check:rc==0
cmd:tabrestore /tmp/export/nics.cvs
check:rc==0
cmd:dir="/tmp/export"; rm -rf $dir; if [ -d ${dir}".bak" ];then mv ${dir}".bak" $dir; fi
end

View File

@ -0,0 +1,2 @@
#node,nicips,nichostnamesuffixes,nichostnameprefixes,nictypes,niccustomscripts,nicnetworks,nicaliases,nicextraparams,nicdevices,nicsadapter,comments,disable
"testnodes","|(.)(..)n(..)|ib0!(ipadd(10,41,0,100,dim2idx(a2idx($1),36,$2,18,$3),2,1))|","ib0!ib",,"ib0!Infiniband",,"ib0!ipoib",,,,,,
1 #node nicips nichostnamesuffixes nichostnameprefixes nictypes niccustomscripts nicnetworks nicaliases nicextraparams nicdevices nicsadapter comments disable
2 testnodes |(.)(..)n(..)|ib0!(ipadd(10,41,0,100,dim2idx(a2idx($1),36,$2,18,$3),2,1))| ib0!ib ib0!Infiniband ib0!ipoib

View File

@ -0,0 +1,26 @@
{
"node": {
"testnodes": {
"device_type": "server",
"network_info": {
"nics": {
"ib0": {
"hostnamesuffixes": [
"ib"
],
"ips": "|(.)(..)n(..)|ib0!(ipadd(10,41,0,100,dim2idx(a2idx($1),36,$2,18,$3),2,1))|",
"networks": [
"ipoib"
],
"type": [
"Infiniband"
]
}
}
},
"obj_type": "group",
"role": "compute"
}
},
"schema_version": "1.0"
}

View File

@ -0,0 +1,16 @@
node:
testnodes:
device_type: server
network_info:
nics:
ib0:
hostnamesuffixes:
- ib
ips: '|(.)(..)n(..)|ib0!(ipadd(10,41,0,100,dim2idx(a2idx($1),36,$2,18,$3),2,1))|'
networks:
- ipoib
type:
- Infiniband
obj_type: group
role: compute
schema_version: '1.0'