Test Design of xcat inventory regular expression - xcat2/xcat-core GitHub Wiki
Introduction
This document provides an overview of test xcat-inventory export and import could process regex in database. This test plan is intended for the use of xCAT FVT team.
The test is against xCAT version 2.14.4. The build of xCAT will be picked up from the xcat.org
The xcat inventory regex design is under https://github.com/xcat2/xcat-inventory/pull/74
Affected tables
The following table will be used in the test
#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",,,,,,
Test steps
- create a new nics table with regex in it.
#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",,,,,,
2.execute xcat-inventory export with correct options
[root@c910f03c01p13 ~]# xcat-inventory export -t node -o testnodes -f /tmp/export/nics.yaml --format yaml
The inventory data has been dumped to /tmp/export/nics.yaml
- check if inventory data is correct in /tmp/export/nics.yaml
[root@c910f03c01p13 ~]# cat /tmp/export/nics.yaml
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'
#Version 2.14.3 (git commit 7b7d9ab67589afec1ba58cd5138154290c529c0e, built Tue
- execute xcat-inventory with correct options
[root@c910f03c01p13 ~]# xcat-inventory export -t node -o testnodes -f /tmp/export/nics.json --format json
The inventory data has been dumped to /tmp/export/nics.json
- check /tmp/export/nics.json is correct
[root@c910f03c01p13 ~]# cat /tmp/export/nics.json
{
"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"
}
#Version 2.14.3 (git commit 7b7d9ab67589afec1ba58cd5138154290c529c0e, built Tue Aug 21 07:16:00 EDT 2018)
- remove nics table and to run import options
[root@c910f03c01p13 ~]# tabdump nics
#node,nicips,nichostnamesuffixes,nichostnameprefixes,nictypes,niccustomscripts,nicnetworks,nicaliases,nicextraparams,nicdevices,nicsadapter,comments,disable
- run xcat-inventory import with correct options
[root@c910f03c01p13 ~]# xcat-inventory import -t node -o testnodes -f /tmp/export/nics.json
loading inventory date in "/tmp/export/nics.json"
start to import "node" type objects
preprocessing "node" type objects
writting "node" type objects
Inventory import successfully!
- Check nics table is correctly imported
[root@c910f03c01p13 ~]# tabdump nics
#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",,,,,,
- Remove nics table
[root@c910f03c01p13 ~]# xcat-inventory import -t node -o testnodes -f /tmp/export/nics.yaml
loading inventory date in "/tmp/export/nics.yaml"
start to import "node" type objects
preprocessing "node" type objects
writting "node" type objects
Inventory import successfully!
- run xcat-inventory import with correct options
[root@c910f03c01p13 ~]# xcat-inventory import -t node -o testnodes -f /tmp/export/nics.json
loading inventory date in "/tmp/export/nics.json"
start to import "node" type objects
preprocessing "node" type objects
writting "node" type objects
Inventory import successfully!
- Check nics table is correctly imported
[root@c910f03c01p13 ~]# tabdump nics
#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",,,,,,