start:export_import_single_osimage_by_yaml description:This case is used to test xcat-inventory export and import one linux osimage definition by yaml between 2 exact same MNs. Before running this case, make sure these two MNs have been installed same exactly, and the current MN can connect the other MN by ssh without password. This case also can be run in one MN, this is, export from currnet node then import back to currnet node, in this case, just need to set $$DSTMN= Attribute: $$DSTMN - the ip of MN which is used to run import operation. label:others,xcat_inventory cmd:mkdir -p /tmp/export_import_single_osimage_by_yaml check:rc==0 cmd:ssh $$DSTMN 'mkdir -p /tmp/export_import_single_osimage_by_yaml_$$DSTMN/' check:rc==0 cmd:lsdef -t osimage -o bogus_image >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o bogus_image -z >/tmp/export_import_single_osimage_by_yaml/bogus_image.stanza ;rmdef -t osimage -o bogus_image;fi check:rc==0 cmd:ssh $$DSTMN 'lsdef -t osimage -o bogus_image > /dev/null 2>&1; if [[ $? -eq 0 ]]; then lsdef -t osimage -o bogus_image -z >/tmp/export_import_single_osimage_by_yaml_$$DSTMN/bogus_image.stanza ;rmdef -t osimage -o bogus_image;fi' check:rc==0 cmd:chdef -t osimage -o bogus_image addkcmdline=addkcmdline boottarget=boottarget cfmdir=cfmdir crashkernelsize=crashkernelsize description=description driverupdatesrc=driverupdatesrc dump=dump exlist=exlist groups=groups imagename=imagename imagetype=linux isdeletable=isdeletable kerneldir=kerneldir kernelver=kernelver kitcomponents=kitcomponents krpmver=krpmver netdrivers=netdrivers nodebootif=nodebootif osarch=osarch osdistroname=osdistroname osname=osname osupdatename=osupdatename osvers=osvers otherifce=otherifce otherpkgdir=otherpkgdir otherpkglist=otherpkglist partitionfile=partitionfile permission=permission pkgdir=pkgdir pkglist=pkglist postbootscripts=postbootscripts postinstall=postinstall postscripts=postscripts profile=compute provmethod=netboot rootfstype=nfs rootimgdir=rootimgdir serverrole=serverrole synclists=synclists template=template usercomment=usercomment check:rc==0 cmd:lsdef -t osimage -o bogus_image -z|sort -t'=' -k1 |tee /tmp/export_import_single_osimage_by_yaml/src_bogus_osimage.stanza check:rc==0 cmd:xcat-inventory export --format=yaml -t osimage -o bogus_image |tee /tmp/export_import_single_osimage_by_yaml/bogus_image.yaml check:rc==0 cmd:scp /tmp/export_import_single_osimage_by_yaml/bogus_image.yaml $$DSTMN:/tmp/export_import_single_osimage_by_yaml_$$DSTMN/ check:rc==0 cmd: rmdef -t osimage -o bogus_image check:rc==0 cmd: ssh $$DSTMN 'xcat-inventory import -f /tmp/export_import_single_osimage_by_yaml_$$DSTMN/bogus_image.yaml -t osimage -o bogus_image' check:rc==0 cmd: ssh $$DSTMN 'lsdef -t osimage -o bogus_image -z |sort -t'=' -k1|tee /tmp/export_import_single_osimage_by_yaml_$$DSTMN/dst_bogus_image.stanza' check:rc==0 cmd: scp $$DSTMN:/tmp/export_import_single_osimage_by_yaml_$$DSTMN/dst_bogus_image.stanza /tmp/export_import_single_osimage_by_yaml/dst_bogus_image.stanza check:rc==0 cmd: cat /tmp/export_import_single_osimage_by_yaml/dst_bogus_image.stanza check:rc==0 cmd:diff -y /tmp/export_import_single_osimage_by_yaml/src_bogus_osimage.stanza /tmp/export_import_single_osimage_by_yaml/dst_bogus_image.stanza check:rc==0 cmd:ssh $$DSTMN 'rmdef -t osimage -o bogus_image' check:rc==0 cmd:if [[ -e /tmp/export_import_single_osimage_by_yaml/bogus_image.stanza ]]; then cat /tmp/export_import_single_osimage_by_yaml/bogus_image.stanza | mkdef -z;fi check:rc==0 cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_osimage_by_yaml_$$DSTMN/bogus_image.stanza ]]; then cat /tmp/export_import_single_osimage_by_yaml_$$DSTMN/bogus_image.stanza | mkdef -z;fi' check:rc==0 cmd:ssh $$DSTMN 'rm -rf /tmp/export_import_single_osimage_by_yaml_$$DSTMN/' check:rc==0 cmd:rm -rf /tmp/export_import_single_osimage_by_yaml check:rc==0 end start:export_import_single_osimage_by_json description:This case is used to test xcat-inventory export and import one linux osimage definition by json between 2 exact same MNs. Before running this case, make sure these two MNs have been installed same exactly, and the current MN can connect the other MN by ssh without password. This case also can be run in one MN, this is, export from currnet node then import back to currnet node, in this case, just need to set $$DSTMN= Attribute: $$DSTMN - the ip of MN which is used to run import operation. label:others,xcat_inventory cmd:mkdir -p /tmp/export_import_single_osimage_by_json check:rc==0 cmd:ssh $$DSTMN 'mkdir -p /tmp/export_import_single_osimage_by_json_$$DSTMN/' check:rc==0 cmd:lsdef -t osimage -o bogus_image >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o bogus_image -z >/tmp/export_import_single_osimage_by_json/bogus_image.stanza ;rmdef -t osimage -o bogus_image;fi check:rc==0 cmd:ssh $$DSTMN 'lsdef -t osimage -o bogus_image > /dev/null 2>&1; if [[ $? -eq 0 ]]; then lsdef -t osimage -o bogus_image -z >/tmp/export_import_single_osimage_by_json_$$DSTMN/bogus_image.stanza ;rmdef -t osimage -o bogus_image;fi' check:rc==0 cmd:chdef -t osimage -o bogus_image addkcmdline=addkcmdline boottarget=boottarget cfmdir=cfmdir crashkernelsize=crashkernelsize description=description driverupdatesrc=driverupdatesrc dump=dump exlist=exlist groups=groups imagename=imagename imagetype=linux isdeletable=isdeletable kerneldir=kerneldir kernelver=kernelver kitcomponents=kitcomponents krpmver=krpmver netdrivers=netdrivers nodebootif=nodebootif osarch=osarch osdistroname=osdistroname osname=osname osupdatename=osupdatename osvers=osvers otherifce=otherifce otherpkgdir=otherpkgdir otherpkglist=otherpkglist partitionfile=partitionfile permission=permission pkgdir=pkgdir pkglist=pkglist postbootscripts=postbootscripts postinstall=postinstall postscripts=postscripts profile=compute provmethod=netboot rootfstype=nfs rootimgdir=rootimgdir serverrole=serverrole synclists=synclists template=template usercomment=usercomment check:rc==0 cmd:lsdef -t osimage -o bogus_image -z|sort -t'=' -k1 |tee /tmp/export_import_single_osimage_by_json/src_bogus_osimage.stanza check:rc==0 cmd:xcat-inventory export --format=json -t osimage -o bogus_image |tee /tmp/export_import_single_osimage_by_json/bogus_image.json check:rc==0 cmd:scp /tmp/export_import_single_osimage_by_json/bogus_image.json $$DSTMN:/tmp/export_import_single_osimage_by_json_$$DSTMN/ check:rc==0 cmd: rmdef -t osimage -o bogus_image check:rc==0 cmd: ssh $$DSTMN 'xcat-inventory import -f /tmp/export_import_single_osimage_by_json_$$DSTMN/bogus_image.json -t osimage -o bogus_image' check:rc==0 cmd: ssh $$DSTMN 'lsdef -t osimage -o bogus_image -z |sort -t'=' -k1|tee /tmp/export_import_single_osimage_by_json_$$DSTMN/dst_bogus_image.stanza' check:rc==0 cmd: scp $$DSTMN:/tmp/export_import_single_osimage_by_json_$$DSTMN/dst_bogus_image.stanza /tmp/export_import_single_osimage_by_json/dst_bogus_image.stanza check:rc==0 cmd: cat /tmp/export_import_single_osimage_by_json/dst_bogus_image.stanza check:rc==0 cmd:diff -y /tmp/export_import_single_osimage_by_json/src_bogus_osimage.stanza /tmp/export_import_single_osimage_by_json/dst_bogus_image.stanza check:rc==0 cmd:ssh $$DSTMN 'rmdef -t osimage -o bogus_image' check:rc==0 cmd:if [[ -e /tmp/export_import_single_osimage_by_json/bogus_image.stanza ]]; then cat /tmp/export_import_single_osimage_by_json/bogus_image.stanza | mkdef -z;fi check:rc==0 cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_osimage_by_json_$$DSTMN/bogus_image.stanza ]]; then cat /tmp/export_import_single_osimage_by_json_$$DSTMN/bogus_image.stanza | mkdef -z;fi' check:rc==0 cmd:ssh $$DSTMN 'rm -rf /tmp/export_import_single_osimage_by_json_$$DSTMN/' check:rc==0 cmd:rm -rf /tmp/export_import_single_osimage_by_json check:rc==0 end start:xcat_inventory_try_to_export_all_type_is_osimage_default_format label:others,xcat_inventory description:This case is used to test xcat-inventory export all definition which type is osimage by default format, i.e. json format. cmd:mkdir -p /tmp/xcat_inventory_try_to_export_all_type_is_osimage_default_format check:rc==0 cmd:lsdef -t osimage -o bogus_image >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o bogus_image -z >/tmp/xcat_inventory_try_to_export_all_type_is_osimage_default_format/bogus_image.stanza ;rmdef -t osimage -o bogus_image;fi check:rc==0 cmd:chdef -t osimage -o bogus_image addkcmdline=addkcmdline boottarget=boottarget cfmdir=cfmdir crashkernelsize=crashkernelsize description=description driverupdatesrc=driverupdatesrc dump=dump exlist=exlist groups=groups imagename=imagename imagetype=linux isdeletable=isdeletable kerneldir=kerneldir kernelver=kernelver kitcomponents=kitcomponents krpmver=krpmver netdrivers=netdrivers nodebootif=nodebootif osarch=osarch osdistroname=osdistroname osname=osname osupdatename=osupdatename osvers=osvers otherifce=otherifce otherpkgdir=otherpkgdir otherpkglist=otherpkglist partitionfile=partitionfile permission=permission pkgdir=pkgdir pkglist=pkglist postbootscripts=postbootscripts postinstall=postinstall postscripts=postscripts profile=compute provmethod=netboot rootfstype=nfs rootimgdir=rootimgdir serverrole=serverrole synclists=synclists template=template usercomment=usercomment check:rc==0 cmd:xcat-inventory export -t osimage |tee /tmp/xcat_inventory_try_to_export_all_type_is_osimage_default_format/export.file check:rc==0 cmd:grep ' "osimage": {' /tmp/xcat_inventory_try_to_export_all_type_is_osimage_default_format/export.file check:rc==0 cmd:grep '"bogus_image": {' /tmp/xcat_inventory_try_to_export_all_type_is_osimage_default_format/export.file check:rc==0 cmd: grep '"node": {' /tmp/xcat_inventory_try_to_export_all_type_is_osimage_default_format/export.file check:rc!=0 cmd: grep '"obj_type": "node",' /tmp/xcat_inventory_try_to_export_all_type_is_osimage_default_format/export.file check:rc!=0 cmd: grep '"policy": {'' /tmp/xcat_inventory_try_to_export_all_type_is_osimage_default_format/export.file check:rc!=0 cmd: grep '"passwd": {' /tmp/xcat_inventory_try_to_export_all_type_is_osimage_default_format/export.file check:rc!=0 cmd: grep '"network": {' /tmp/xcat_inventory_try_to_export_all_type_is_osimage_default_format/export.file check:rc!=0 cmd: grep '"route": {' /tmp/xcat_inventory_try_to_export_all_type_is_osimage_default_format/export.file check:rc!=0 cmd: grep '"site": {' /tmp/xcat_inventory_try_to_export_all_type_is_osimage_default_format/export.file check:rc!=0 cmd:lsdef -t osimage |tee /tmp/xcat_inventory_try_to_export_all_type_is_osimage_default_format/osimage_in_xcat_db check:rc==0 cmd: a=0;for i in `awk -F' ' '{print $1}' /tmp/xcat_inventory_try_to_export_all_type_is_osimage_default_format/osimage_in_xcat_db`; do if grep -E "\"$i\": {" /tmp/xcat_inventory_try_to_export_all_type_is_osimage_default_format/export.file > /dev/null; then ((a++));fi; done; do=$(cat /tmp/xcat_inventory_try_to_export_all_type_is_osimage_default_format/osimage_in_xcat_db|wc -l);if [[ $do -eq $a ]]; then exit 0; else exit 1;fi check:rc==0 cmd: rmdef -t osimage -o bogus_image check:rc==0 cmd:if [[ -e /tmp/xcat_inventory_try_to_export_all_type_is_osimage_default_format/bogus_image.stanza ]]; then cat /tmp/xcat_inventory_try_to_export_all_type_is_osimage_default_format/bogus_image.stanza | mkdef -z;fi check:rc==0 cmd:rm -rf /tmp/xcat_inventory_try_to_export_all_type_is_osimage_default_format check:rc==0 end start:xcat_inventory_try_to_export_all_type_is_osimage_json_format label:others,xcat_inventory description:This case is used to test xcat-inventory export all definition which type is osimage by json format. cmd:mkdir -p /tmp/xcat_inventory_try_to_export_all_type_is_osimage_json_format check:rc==0 cmd:lsdef -t osimage -o bogus_image >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o bogus_image -z >/tmp/xcat_inventory_try_to_export_all_type_is_osimage_json_format/bogus_image.stanza ;rmdef -t osimage -o bogus_image;fi check:rc==0 cmd:chdef -t osimage -o bogus_image addkcmdline=addkcmdline boottarget=boottarget cfmdir=cfmdir crashkernelsize=crashkernelsize description=description driverupdatesrc=driverupdatesrc dump=dump exlist=exlist groups=groups imagename=imagename imagetype=linux isdeletable=isdeletable kerneldir=kerneldir kernelver=kernelver kitcomponents=kitcomponents krpmver=krpmver netdrivers=netdrivers nodebootif=nodebootif osarch=osarch osdistroname=osdistroname osname=osname osupdatename=osupdatename osvers=osvers otherifce=otherifce otherpkgdir=otherpkgdir otherpkglist=otherpkglist partitionfile=partitionfile permission=permission pkgdir=pkgdir pkglist=pkglist postbootscripts=postbootscripts postinstall=postinstall postscripts=postscripts profile=compute provmethod=netboot rootfstype=nfs rootimgdir=rootimgdir serverrole=serverrole synclists=synclists template=template usercomment=usercomment check:rc==0 cmd:xcat-inventory export --format=json -t osimage |tee /tmp/xcat_inventory_try_to_export_all_type_is_osimage_json_format/export.file check:rc==0 cmd:grep ' "osimage": {' /tmp/xcat_inventory_try_to_export_all_type_is_osimage_json_format/export.file check:rc==0 cmd:grep '"bogus_image": {' /tmp/xcat_inventory_try_to_export_all_type_is_osimage_json_format/export.file check:rc==0 cmd: grep '"node": {' /tmp/xcat_inventory_try_to_export_all_type_is_osimage_json_format/export.file check:rc!=0 cmd: grep '"obj_type": "node",' /tmp/xcat_inventory_try_to_export_all_type_is_osimage_json_format/export.file check:rc!=0 cmd: grep '"policy": {'' /tmp/xcat_inventory_try_to_export_all_type_is_osimage_json_format/export.file check:rc!=0 cmd: grep '"passwd": {' /tmp/xcat_inventory_try_to_export_all_type_is_osimage_json_format/export.file check:rc!=0 cmd: grep '"network": {' /tmp/xcat_inventory_try_to_export_all_type_is_osimage_json_format/export.file check:rc!=0 cmd: grep '"route": {' /tmp/xcat_inventory_try_to_export_all_type_is_osimage_json_format/export.file check:rc!=0 cmd: grep '"site": {' /tmp/xcat_inventory_try_to_export_all_type_is_osimage_json_format/export.file check:rc!=0 cmd:lsdef -t osimage |tee /tmp/xcat_inventory_try_to_export_all_type_is_osimage_json_format/osimage_in_xcat_db check:rc==0 cmd: a=0;for i in `awk -F' ' '{print $1}' /tmp/xcat_inventory_try_to_export_all_type_is_osimage_json_format/osimage_in_xcat_db`; do if grep -E "\"$i\": {" /tmp/xcat_inventory_try_to_export_all_type_is_osimage_json_format/export.file > /dev/null; then ((a++));fi; done; do=$(cat /tmp/xcat_inventory_try_to_export_all_type_is_osimage_json_format/osimage_in_xcat_db|wc -l);if [[ $do -eq $a ]]; then exit 0; else exit 1;fi check:rc==0 cmd: rmdef -t osimage -o bogus_image check:rc==0 cmd:if [[ -e /tmp/xcat_inventory_try_to_export_all_type_is_osimage_json_format/bogus_image.stanza ]]; then cat /tmp/xcat_inventory_try_to_export_all_type_is_osimage_json_format/bogus_image.stanza | mkdef -z;fi check:rc==0 cmd:rm -rf /tmp/xcat_inventory_try_to_export_all_type_is_osimage_json_format check:rc==0 end start:xcat_inventory_try_to_export_all_type_is_osimage_yaml_format label:others,xcat_inventory description:This case is used to test xcat-inventory export all definition which type is osimage by yaml format. cmd:mkdir -p /tmp/xcat_inventory_try_to_export_all_type_is_osimage_yaml_format check:rc==0 cmd:lsdef -t osimage -o bogus_image >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o bogus_image -z >/tmp/xcat_inventory_try_to_export_all_type_is_osimage_yaml_format/bogus_image.stanza ;rmdef -t osimage -o bogus_image;fi check:rc==0 cmd:chdef -t osimage -o bogus_image addkcmdline=addkcmdline boottarget=boottarget cfmdir=cfmdir crashkernelsize=crashkernelsize description=description driverupdatesrc=driverupdatesrc dump=dump exlist=exlist groups=groups imagename=imagename imagetype=linux isdeletable=isdeletable kerneldir=kerneldir kernelver=kernelver kitcomponents=kitcomponents krpmver=krpmver netdrivers=netdrivers nodebootif=nodebootif osarch=osarch osdistroname=osdistroname osname=osname osupdatename=osupdatename osvers=osvers otherifce=otherifce otherpkgdir=otherpkgdir otherpkglist=otherpkglist partitionfile=partitionfile permission=permission pkgdir=pkgdir pkglist=pkglist postbootscripts=postbootscripts postinstall=postinstall postscripts=postscripts profile=compute provmethod=netboot rootfstype=nfs rootimgdir=rootimgdir serverrole=serverrole synclists=synclists template=template usercomment=usercomment check:rc==0 cmd:xcat-inventory export --format=yaml -t osimage |tee /tmp/xcat_inventory_try_to_export_all_type_is_osimage_yaml_format/export.file check:rc==0 cmd:grep -E "^osimage:" /tmp/xcat_inventory_try_to_export_all_type_is_osimage_yaml_format/export.file check:rc==0 cmd:grep -E "^\s*bogus_image:" /tmp/xcat_inventory_try_to_export_all_type_is_osimage_yaml_format/export.file check:rc==0 cmd: grep -E "^node:" /tmp/xcat_inventory_try_to_export_all_type_is_osimage_yaml_format/export.file check:rc!=0 cmd: grep -E "obj_type: node" /tmp/xcat_inventory_try_to_export_all_type_is_osimage_yaml_format/export.file check:rc!=0 cmd: grep -E "^policy:" /tmp/xcat_inventory_try_to_export_all_type_is_osimage_yaml_format/export.file check:rc!=0 cmd: grep -E "^passwd:" /tmp/xcat_inventory_try_to_export_all_type_is_osimage_yaml_format/export.file check:rc!=0 cmd: grep -E "^network:" /tmp/xcat_inventory_try_to_export_all_type_is_osimage_yaml_format/export.file check:rc!=0 cmd: grep -E "^route:" /tmp/xcat_inventory_try_to_export_all_type_is_osimage_yaml_format/export.file check:rc!=0 cmd: grep -E "^site:" /tmp/xcat_inventory_try_to_export_all_type_is_osimage_yaml_format/export.file check:rc!=0 cmd:lsdef -t osimage |tee /tmp/xcat_inventory_try_to_export_all_type_is_osimage_yaml_format/osimage_in_xcat_db check:rc==0 cmd: a=0;for i in `awk -F' ' '{print $1}' /tmp/xcat_inventory_try_to_export_all_type_is_osimage_yaml_format/osimage_in_xcat_db`; do if grep -E "$i:" /tmp/xcat_inventory_try_to_export_all_type_is_osimage_yaml_format/export.file > /dev/null; then ((a++));fi; done; do=$(cat /tmp/xcat_inventory_try_to_export_all_type_is_osimage_yaml_format/osimage_in_xcat_db|wc -l);if [[ $do -eq $a ]]; then exit 0; else exit 1;fi check:rc==0 cmd: rmdef -t osimage -o bogus_image check:rc==0 cmd:if [[ -e /tmp/xcat_inventory_try_to_export_all_type_is_osimage_yaml_format/bogus_image.stanza ]]; then cat /tmp/xcat_inventory_try_to_export_all_type_is_osimage_yaml_format/bogus_image.stanza | mkdef -z;fi check:rc==0 cmd:rm -rf /tmp/xcat_inventory_try_to_export_all_type_is_osimage_yaml_format check:rc==0 end start:xcat_inventory_try_to_import_all_type_is_osimage_yaml_format label:others,xcat_inventory description:This case is used to test xcat-inventory import all definition which type is osimage from a yaml file. cmd:mkdir -p /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format check:rc==0 cmd:lsdef -t osimage -o bogus_image >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o bogus_image -z >/tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/bogus_image.stanza ;rmdef -t osimage -o bogus_image;fi check:rc==0 cmd:lsdef -t node -l > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_nodes_db check:rc==0 cmd:lsdef -t group -l > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_group_db check:rc==0 cmd:tabdump site > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_site_db check:rc==0 cmd:tabdump passwd > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_pw_db check:rc==0 cmd:tabdump policy > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_policy_db check:rc==0 cmd:tabdump networks > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_network_db check:rc==0 cmd:tabdump routes > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_route_db check:rc==0 cmd:lsdef -t osimage -l|sed '/^Could not find any object definitions to display/d' > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_osimage_db check:rc==0 cmd:#!/bin/bash echo "network: 10_0_0_0-255_0_0_0: basic_attr: gateway: 10.0.0.103 mask: 255.0.0.0 mgtifname: eth0 mtu: '1500' net: 10.0.0.0 service: tftpserver: node: bogusnode1: device_type: server engines: console_engine: engine_info: cons: openbmc engine_type: openbmc hardware_mgt_engine: engine_info: bmc: 10.3.11.101 bmcpassword: 0penBmc bmcusername: root engine_type: openbmc netboot_engine: engine_type: petitboot power_mgt_engine: engine_type: openbmc network_info: primarynic: ip: 10.100.100.1 obj_info: groups: bogusgroup obj_type: node role: compute bogusnode2: device_type: server engines: console_engine: engine_info: cons: openbmc engine_type: openbmc hardware_mgt_engine: engine_info: bmc: 10.3.11.102 bmcpassword: 0penBmc bmcusername: root engine_type: openbmc netboot_engine: engine_type: petitboot power_mgt_engine: engine_type: openbmc network_info: primarynic: ip: 10.100.100.2 obj_info: groups: bogusgroup obj_type: node role: compute bogusnode3: device_type: server engines: console_engine: engine_info: cons: openbmc engine_type: openbmc hardware_mgt_engine: engine_info: bmc: 10.3.11.103 bmcpassword: 0penBmc bmcusername: root engine_type: openbmc netboot_engine: engine_type: petitboot power_mgt_engine: engine_type: openbmc network_info: primarynic: ip: 10.100.100.3 obj_info: groups: bogusgroup obj_type: node role: compute service: device_type: server engines: netboot_engine: engine_info: postscripts: servicenode obj_type: group role: compute xcatdefaults: device_type: server engines: netboot_engine: engine_info: postbootscripts: otherpkgs postscripts: syslog,remoteshell,syncfiles obj_type: group role: compute osimage: bogus_image: addkcmdline: aaaa boottarget: aaa imagetype: linux provision_mode: statelite role: compute passwd: {} policy: '1': name: root rule: allow '1.2': name: c910f03c05k08.pok.stglabs.ibm.com rule: trusted '2': commands: getbmcconfig rule: allow '2.1': commands: remoteimmsetup rule: allow '2.3': commands: lsxcatd rule: allow '3': commands: nextdestiny rule: allow '4': commands: getdestiny rule: allow '4.4': commands: getpostscript rule: allow '4.5': commands: getcredentials rule: allow '4.6': commands: syncfiles rule: allow '4.7': commands: litefile rule: allow '4.8': commands: litetree rule: allow '4.9': commands: getadapter rule: allow route: {} site: cluster: SNsyncfiledir: /var/xcat/syncfiles auditnosyslog: '0' auditskipcmds: ALL blademaxp: '64' cleanupxcatpost: 'no' consoleondemand: 'no' databaseloc: /var/lib db2installloc: /mntdb2 dhcplease: '43200' dnshandler: ddns enableASMI: 'no' forwarders: 10.3.17.10 fsptimeout: '0' installdir: /install ipmimaxp: '64' ipmiretries: '3' ipmitimeout: '2' master: 10.3.5.8 maxssh: '8' nameservers: 10.3.5.8 nodesyncfiledir: /var/xcat/node/syncfiles powerinterval: '0' ppcmaxp: '64' ppcretry: '3' ppctimeout: '0' sharedtftp: '1' sshbetweennodes: ALLGROUPS syspowerinterval: '0' tftpdir: /tftpboot timezone: America/New_York useNmapfromMN: 'no' vsftp: n xcatconfdir: /etc/xcat xcatdport: '3001' xcatiport: '3002' xcatsslversion: TLSv1" > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/import.file check:rc==0 cmd:#!/bin/bash echo "Object name: bogus_image addkcmdline=aaaa boottarget=aaa imagetype=linux profile=compute provmethod=statelite" >> /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_osimage_db check:rc==0 cmd:sort /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_osimage_db > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/target_osimage_sort cmd:xcat-inventory import -f /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/import.file -t osimage check:rc==0 cmd:lsdef -t osimage -l|sort > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/import_osimage check:rc==0 cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/target_osimage_sort /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/import_osimage check:rc==0 cmd:lsdef -t node -l > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_nodes_db check:rc==0 cmd:lsdef -t group -l > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_group_db check:rc==0 cmd:tabdump site > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_site_db check:rc==0 cmd:tabdump passwd > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_pw_db check:rc==0 cmd:tabdump policy > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_policy_db check:rc==0 cmd:tabdump networks > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_network_db check:rc==0 cmd:tabdump routes > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_route_db check:rc==0 cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_nodes_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_nodes_db check:rc==0 cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_group_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_group_db check:rc==0 cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_site_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_site_db check:rc==0 cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_pw_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_pw_db check:rc==0 cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_policy_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_policy_db check:rc==0 cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_network_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_network_db check:rc==0 cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/org_route_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/after_route_db check:rc==0 cmd: rmdef -t osimage -o bogus_image check:rc==0 cmd:if [[ -e /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/bogus_image.stanza ]]; then cat /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format/bogus_image.stanza | mkdef -z;fi check:rc==0 cmd:rm -rf /tmp/xcat_inventory_try_to_import_all_type_is_osimage_yaml_format check:rc==0 end start:xcat_inventory_try_to_import_all_type_is_osimage_json_format label:others,xcat_inventory description:This case is used to test xcat-inventory import all definition which type is osimage from a json file. cmd:mkdir -p /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format check:rc==0 cmd:lsdef -t osimage -o bogus_image >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o bogus_image -z >/tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/bogus_image.stanza ;rmdef -t osimage -o bogus_image;fi check:rc==0 cmd:lsdef -t node -l > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_nodes_db check:rc==0 cmd:lsdef -t group -l > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_group_db check:rc==0 cmd:tabdump site > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_site_db check:rc==0 cmd:tabdump passwd > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_pw_db check:rc==0 cmd:tabdump policy > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_policy_db check:rc==0 cmd:tabdump networks > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_network_db check:rc==0 cmd:tabdump routes > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_route_db check:rc==0 cmd:lsdef -t osimage -l > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_osimage_db check:rc==0 cmd:lsdef -t osimage -l|sed '/^Could not find any object definitions to display/d' > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_osimage_db check:rc==0 cmd:#!/bin/bash echo '{ "network": { "10_0_0_0-255_0_0_0": { "basic_attr": { "gateway": "10.0.0.103", "mask": "255.0.0.0", "mgtifname": "eth0", "mtu": "1500", "net": "10.0.0.0" }, "service": { "tftpserver": "" } } }, "node": { "bogusnode1": { "device_type": "server", "engines": { "console_engine": { "engine_info": { "cons": "openbmc" }, "engine_type": "openbmc" }, "hardware_mgt_engine": { "engine_info": { "bmc": "10.3.11.101", "bmcpassword": "0penBmc", "bmcusername": "root" }, "engine_type": "openbmc" }, "netboot_engine": { "engine_type": "petitboot" }, "power_mgt_engine": { "engine_type": "openbmc" } }, "network_info": { "primarynic": { "ip": "10.100.100.1" } }, "obj_info": { "groups": "bogusgroup" }, "obj_type": "node", "role": "compute", }, "bogusnode2": { "device_type": "server", "engines": { "console_engine": { "engine_info": { "cons": "openbmc" }, "engine_type": "openbmc" }, "hardware_mgt_engine": { "engine_info": { "bmc": "10.3.11.102", "bmcpassword": "0penBmc", "bmcusername": "root" }, "engine_type": "openbmc" }, "netboot_engine": { "engine_type": "petitboot" }, "power_mgt_engine": { "engine_type": "openbmc" } }, "network_info": { "primarynic": { "ip": "10.100.100.2" } }, "obj_info": { "groups": "bogusgroup" }, "obj_type": "node", "role": "compute", }, "bogusnode3": { "device_type": "server", "engines": { "console_engine": { "engine_info": { "cons": "openbmc" }, "engine_type": "openbmc" }, "hardware_mgt_engine": { "engine_info": { "bmc": "10.3.11.103", "bmcpassword": "0penBmc", "bmcusername": "root" }, "engine_type": "openbmc" }, "netboot_engine": { "engine_type": "petitboot" }, "power_mgt_engine": { "engine_type": "openbmc" } }, "network_info": { "primarynic": { "ip": "10.100.100.3" } }, "obj_info": { "groups": "bogusgroup" }, "obj_type": "node", "role": "compute", }, "service": { "device_type": "server", "engines": { "netboot_engine": { "engine_info": { "postscripts": "servicenode" } } }, "obj_type": "group", "role": "compute", }, "xcatdefaults": { "device_type": "server", "engines": { "netboot_engine": { "engine_info": { "postbootscripts": "otherpkgs", "postscripts": "syslog,remoteshell,syncfiles" } } }, "obj_type": "group", "role": "compute", } }, "osimage": { "bogus_image": { "addkcmdline": "aaaa", "boottarget": "aaa", "imagetype": "linux", "provision_mode": "statelite", "role": "compute" } }, "passwd": {}, "policy": { "1": { "name": "root", "rule": "allow" }, "1.2": { "name": "c910f03c05k08.pok.stglabs.ibm.com", "rule": "trusted" }, "2": { "commands": "getbmcconfig", "rule": "allow" }, "2.1": { "commands": "remoteimmsetup", "rule": "allow" }, "2.3": { "commands": "lsxcatd", "rule": "allow" }, "3": { "commands": "nextdestiny", "rule": "allow" }, "4": { "commands": "getdestiny", "rule": "allow" }, "4.4": { "commands": "getpostscript", "rule": "allow" }, "4.5": { "commands": "getcredentials", "rule": "allow" }, "4.6": { "commands": "syncfiles", "rule": "allow" }, "4.7": { "commands": "litefile", "rule": "allow" }, "4.8": { "commands": "litetree", "rule": "allow" }, "4.9": { "commands": "getadapter", "rule": "allow" } }, "route": {}, "site": { "cluster": { "SNsyncfiledir": "/var/xcat/syncfiles", "auditnosyslog": "0", "auditskipcmds": "ALL", "blademaxp": "64", "cleanupxcatpost": "no", "consoleondemand": "no", "databaseloc": "/var/lib", "db2installloc": "/mntdb2", "dhcplease": "43200", "dnshandler": "ddns", "enableASMI": "no", "forwarders": "10.3.17.10", "fsptimeout": "0", "installdir": "/install", "ipmimaxp": "64", "ipmiretries": "3", "ipmitimeout": "2", "master": "10.3.5.8", "maxssh": "8", "nameservers": "10.3.5.8", "nodesyncfiledir": "/var/xcat/node/syncfiles", "powerinterval": "0", "ppcmaxp": "64", "ppcretry": "3", "ppctimeout": "0", "sharedtftp": "1", "sshbetweennodes": "ALLGROUPS", "syspowerinterval": "0", "tftpdir": "/tftpboot", "timezone": "America/New_York", "useNmapfromMN": "no", "vsftp": "n", "xcatconfdir": "/etc/xcat", "xcatdport": "3001", "xcatiport": "3002", "xcatsslversion": "TLSv1" } } }' > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/import.file check:rc==0 cmd:#!/bin/bash echo "Object name: bogus_image addkcmdline=aaaa boottarget=aaa imagetype=linux profile=compute provmethod=statelite" >> /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_osimage_db check:rc==0 cmd:sort /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_osimage_db > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/target_osimage_sort cmd:xcat-inventory import -f /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/import.file -t osimage check:rc==0 cmd:lsdef -t osimage -l|sort > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/import_osimage check:rc==0 cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/target_osimage_sort /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/import_osimage check:rc==0 cmd:lsdef -t node -l > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_nodes_db check:rc==0 cmd:lsdef -t group -l > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_group_db check:rc==0 cmd:tabdump site > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_site_db check:rc==0 cmd:tabdump passwd > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_pw_db check:rc==0 cmd:tabdump policy > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_policy_db check:rc==0 cmd:tabdump networks > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_network_db check:rc==0 cmd:tabdump routes > /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_route_db check:rc==0 cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_nodes_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_nodes_db check:rc==0 cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_group_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_group_db check:rc==0 cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_site_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_site_db check:rc==0 cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_pw_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_pw_db check:rc==0 cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_policy_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_policy_db check:rc==0 cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_network_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_network_db check:rc==0 cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/org_route_db /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/after_route_db check:rc==0 cmd: rmdef -t osimage -o bogus_image check:rc==0 cmd:if [[ -e /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/bogus_image.stanza ]]; then cat /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format/bogus_image.stanza | mkdef -z;fi check:rc==0 #cmd:rm -rf /tmp/xcat_inventory_try_to_import_all_type_is_osimage_json_format #check:rc==0 end start:export_single_osimage_then_modify_json_then_import label:others,xcat_inventory description:This case is used to test xcat-inventory import a osimage , then modify the export json file, then import the json file cmd:mkdir -p /tmp/export_single_osimage_then_modify_json_then_import check:rc==0 cmd:ssh $$DSTMN 'mkdir -p /tmp/export_single_osimage_then_modify_json_then_import_$$DSTMN/' check:rc==0 cmd:lsdef -t osimage -o bogus_image >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o bogus_image -z >/tmp/export_single_osimage_then_modify_json_then_import/bogus_image.stanza ;rmdef -t osimage -o bogus_image;fi check:rc==0 cmd:ssh $$DSTMN 'lsdef -t osimage -o bogus_image > /dev/null 2>&1; if [[ $? -eq 0 ]]; then lsdef -t osimage -o bogus_image -z >/tmp/export_single_osimage_then_modify_json_then_import_$$DSTMN/bogus_image.stanza ;rmdef -t osimage -o bogus_image;fi' check:rc==0 cmd:chdef -t osimage -o bogus_image addkcmdline=1111 boottarget=1111 cfmdir=1111 crashkernelsize=1111 description=1111 driverupdatesrc=1111 dump=1111 exlist=1111 groups=1111 imagename=1111 imagetype=linux isdeletable=1111 kerneldir=1111 kernelver=1111 kitcomponents=1111 krpmver=1111 netdrivers=1111 nodebootif=1111 osarch=1111 osdistroname=1111 osname=1111 osupdatename=1111 osvers=1111 otherifce=1111 otherpkgdir=1111 otherpkglist=1111 partitionfile=1111 permission=1111 pkgdir=1111 pkglist=1111 postbootscripts=1111 postinstall=1111 postscripts=1111 profile=compute provmethod=statelite rootfstype=nfs rootimgdir=1111 serverrole=1111 synclists=1111 template=1111 usercomment=1111 check:rc==0 cmd:lsdef -t osimage -o bogus_image -z|sed 's/1111/2222/g'|sort -t'=' -k1 |tee /tmp/export_single_osimage_then_modify_json_then_import/src_bogus_osimage.stanza check:rc==0 cmd:sed -i 's/profile=compute/profile=service/g' /tmp/export_single_osimage_then_modify_json_then_import/src_bogus_osimage.stanza check:rc==0 cmd:sed -i 's/provmethod=statelite/provmethod=netboot/g' /tmp/export_single_osimage_then_modify_json_then_import/src_bogus_osimage.stanza check:rc==0 cmd:sed -i 's/rootfstype=nfs/rootfstype=ramdisk/g' /tmp/export_single_osimage_then_modify_json_then_import/src_bogus_osimage.stanza check:rc==0 cmd:xcat-inventory export --format=json -t osimage -o bogus_image |tee /tmp/export_single_osimage_then_modify_json_then_import/bogus_image.json check:rc==0 cmd:sed -i 's/1111/2222/g' /tmp/export_single_osimage_then_modify_json_then_import/bogus_image.json check:rc==0 cmd:sed -i 's/"role": "compute"/"role": "service"/g' /tmp/export_single_osimage_then_modify_json_then_import/bogus_image.json check:rc==0 cmd:sed -i 's/"provision_mode": "statelite"/"provision_mode": "netboot"/g' /tmp/export_single_osimage_then_modify_json_then_import/bogus_image.json check:rc==0 cmd:sed -i 's/"rootfstype": "nfs"/"rootfstype": "ramdisk"/g' /tmp/export_single_osimage_then_modify_json_then_import/bogus_image.json check:rc==0 cmd:scp /tmp/export_single_osimage_then_modify_json_then_import/bogus_image.json $$DSTMN:/tmp/export_single_osimage_then_modify_json_then_import_$$DSTMN/ check:rc==0 cmd: rmdef -t osimage -o bogus_image check:rc==0 cmd: ssh $$DSTMN 'xcat-inventory import -f /tmp/export_single_osimage_then_modify_json_then_import_$$DSTMN/bogus_image.json -t osimage -o bogus_image' check:rc==0 cmd: ssh $$DSTMN 'lsdef -t osimage -o bogus_image -z |sort -t'=' -k1|tee /tmp/export_single_osimage_then_modify_json_then_import_$$DSTMN/dst_bogus_image.stanza' check:rc==0 cmd: scp $$DSTMN:/tmp/export_single_osimage_then_modify_json_then_import_$$DSTMN/dst_bogus_image.stanza /tmp/export_single_osimage_then_modify_json_then_import/dst_bogus_image.stanza check:rc==0 cmd: cat /tmp/export_single_osimage_then_modify_json_then_import/dst_bogus_image.stanza check:rc==0 cmd:diff -y /tmp/export_single_osimage_then_modify_json_then_import/src_bogus_osimage.stanza /tmp/export_single_osimage_then_modify_json_then_import/dst_bogus_image.stanza check:rc==0 cmd:ssh $$DSTMN 'rmdef -t osimage -o bogus_image' check:rc==0 cmd:if [[ -e /tmp/export_single_osimage_then_modify_json_then_import/bogus_image.stanza ]]; then cat /tmp/export_single_osimage_then_modify_json_then_import/bogus_image.stanza | mkdef -z;fi check:rc==0 cmd:ssh $$DSTMN 'if [[ -e /tmp/export_single_osimage_then_modify_json_then_import_$$DSTMN/bogus_image.stanza ]]; then cat /tmp/export_single_osimage_then_modify_json_then_import_$$DSTMN/bogus_image.stanza | mkdef -z;fi' check:rc==0 cmd:ssh $$DSTMN 'rm -rf /tmp/export_single_osimage_then_modify_json_then_import_$$DSTMN/' check:rc==0 cmd:rm -rf /tmp/export_single_osimage_then_modify_json_then_import check:rc==0 end start:export_single_osimage_then_modify_yaml_then_import label:others,xcat_inventory description:This case is used to test xcat-inventory import a osimage , then modify the export yaml file, then import the yaml file cmd:mkdir -p /tmp/export_single_osimage_then_modify_yaml_then_import check:rc==0 cmd:ssh $$DSTMN 'mkdir -p /tmp/export_single_osimage_then_modify_yaml_then_import_$$DSTMN/' check:rc==0 cmd:lsdef -t osimage -o bogus_image >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o bogus_image -z >/tmp/export_single_osimage_then_modify_yaml_then_import/bogus_image.stanza ;rmdef -t osimage -o bogus_image;fi check:rc==0 cmd:ssh $$DSTMN 'lsdef -t osimage -o bogus_image > /dev/null 2>&1; if [[ $? -eq 0 ]]; then lsdef -t osimage -o bogus_image -z >/tmp/export_single_osimage_then_modify_yaml_then_import_$$DSTMN/bogus_image.stanza ;rmdef -t osimage -o bogus_image;fi' check:rc==0 cmd:chdef -t osimage -o bogus_image addkcmdline=1111 boottarget=1111 cfmdir=1111 crashkernelsize=1111 description=1111 driverupdatesrc=1111 dump=1111 exlist=1111 groups=1111 imagename=1111 imagetype=linux isdeletable=1111 kerneldir=1111 kernelver=1111 kitcomponents=1111 krpmver=1111 netdrivers=1111 nodebootif=1111 osarch=1111 osdistroname=1111 osname=1111 osupdatename=1111 osvers=1111 otherifce=1111 otherpkgdir=1111 otherpkglist=1111 partitionfile=1111 permission=1111 pkgdir=1111 pkglist=1111 postbootscripts=1111 postinstall=1111 postscripts=1111 profile=compute provmethod=statelite rootfstype=nfs rootimgdir=1111 serverrole=1111 synclists=1111 template=1111 usercomment=1111 check:rc==0 cmd:lsdef -t osimage -o bogus_image -z|sed 's/1111/2222/g'|sort -t'=' -k1 |tee /tmp/export_single_osimage_then_modify_yaml_then_import/src_bogus_osimage.stanza check:rc==0 cmd:sed -i 's/profile=compute/profile=service/g' /tmp/export_single_osimage_then_modify_yaml_then_import/src_bogus_osimage.stanza check:rc==0 cmd:sed -i 's/provmethod=statelite/provmethod=netboot/g' /tmp/export_single_osimage_then_modify_yaml_then_import/src_bogus_osimage.stanza check:rc==0 cmd:sed -i 's/rootfstype=nfs/rootfstype=ramdisk/g' /tmp/export_single_osimage_then_modify_yaml_then_import/src_bogus_osimage.stanza check:rc==0 cmd:xcat-inventory export --format=yaml -t osimage -o bogus_image |tee /tmp/export_single_osimage_then_modify_yaml_then_import/bogus_image.yaml check:rc==0 cmd:sed -i 's/1111/2222/g' /tmp/export_single_osimage_then_modify_yaml_then_import/bogus_image.yaml check:rc==0 cmd:sed -i "s/role: '*compute'*/role: 'service'/g" /tmp/export_single_osimage_then_modify_yaml_then_import/bogus_image.yaml check:rc==0 cmd:sed -i "s/provision_mode: '*statelite'*/provision_mode: 'netboot'/g" /tmp/export_single_osimage_then_modify_yaml_then_import/bogus_image.yaml check:rc==0 cmd:sed -i "s/rootfstype: '*nfs'*/rootfstype: 'ramdisk'/g" /tmp/export_single_osimage_then_modify_yaml_then_import/bogus_image.yaml check:rc==0 cmd:scp /tmp/export_single_osimage_then_modify_yaml_then_import/bogus_image.yaml $$DSTMN:/tmp/export_single_osimage_then_modify_yaml_then_import_$$DSTMN/ check:rc==0 cmd: rmdef -t osimage -o bogus_image check:rc==0 cmd: ssh $$DSTMN 'xcat-inventory import -f /tmp/export_single_osimage_then_modify_yaml_then_import_$$DSTMN/bogus_image.yaml -t osimage -o bogus_image' check:rc==0 cmd: ssh $$DSTMN 'lsdef -t osimage -o bogus_image -z |sort -t'=' -k1|tee /tmp/export_single_osimage_then_modify_yaml_then_import_$$DSTMN/dst_bogus_image.stanza' check:rc==0 cmd: scp $$DSTMN:/tmp/export_single_osimage_then_modify_yaml_then_import_$$DSTMN/dst_bogus_image.stanza /tmp/export_single_osimage_then_modify_yaml_then_import/dst_bogus_image.stanza check:rc==0 cmd: cat /tmp/export_single_osimage_then_modify_yaml_then_import/dst_bogus_image.stanza check:rc==0 cmd:diff -y /tmp/export_single_osimage_then_modify_yaml_then_import/src_bogus_osimage.stanza /tmp/export_single_osimage_then_modify_yaml_then_import/dst_bogus_image.stanza check:rc==0 cmd:ssh $$DSTMN 'rmdef -t osimage -o bogus_image' check:rc==0 cmd:if [[ -e /tmp/export_single_osimage_then_modify_yaml_then_import/bogus_image.stanza ]]; then cat /tmp/export_single_osimage_then_modify_yaml_then_import/bogus_image.stanza | mkdef -z;fi check:rc==0 cmd:ssh $$DSTMN 'if [[ -e /tmp/export_single_osimage_then_modify_yaml_then_import_$$DSTMN/bogus_image.stanza ]]; then cat /tmp/export_single_osimage_then_modify_yaml_then_import_$$DSTMN/bogus_image.stanza | mkdef -z;fi' check:rc==0 cmd:ssh $$DSTMN 'rm -rf /tmp/export_single_osimage_then_modify_yaml_then_import_$$DSTMN/' check:rc==0 cmd:rm -rf /tmp/export_single_osimage_then_modify_yaml_then_import check:rc==0 end start:export_import_single_osimage_by_dir label:others,xcat_inventory description:This case is used to test xcat-inventory export and import one linux osimage definition by files. cmd:if [ -e /tmp/otherpkglist ]; then cp -f /tmp/otherpkglist /tmp/otherpkglist.bak; fi cmd:echo "test" >> /tmp/otherpkglist cmd:if [ -e /tmp/synclists ]; then cp -f /tmp/synclists /tmp/synclists.bak; fi cmd:echo "test" >> /tmp/synclists cmd:if [ -e /tmp/postinstall ]; then cp -f /tmp/postinstall /tmp/postinstall.bak; fi cmd:echo "test" >> /tmp/postinstall cmd:if [ -e /tmp/exlist ]; then cp -f /tmp/exlist /tmp/exlist.bak; fi cmd:echo "test" >> /tmp/exlist cmd:if [ -e /tmp/partitionfile ]; then cp -f /tmp/partitionfile /tmp/partitionfile.bak; fi cmd:echo "test" >> /tmp/partitionfile cmd:lsdef -t osimage -o test_myimage >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test_myimage -z >/tmp/test_myimage.stanza ;rmdef -t osimage -o test_myimage;fi check:rc==0 cmd:chdef -t osimage -o test_myimage imagetype=linux provmethod=install pkglist=/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl otherpkglist=/tmp/otherpkglist synclists=/tmp/synclists postinstall=/tmp/postinstall exlist=/tmp/exlist partitionfile=/tmp/partitionfile check:rc==0 cmd:lsdef -t osimage test_myimage cmd:dir="/opt/inventory/site/osimage";if [ -e "${dir}" ];then mv ${dir} ${dir}".bak"; fi; mkdir -p $dir cmd:xcat-inventory export -t osimage -o test_myimage --format yaml -d /opt/inventory/site/osimage check:rc==0 check:output=~The osimage objects has been exported to directory /opt/inventory/site/osimage cmd: ls -lFR /opt/inventory/site/osimage cmd:otherpkglist=`lsdef -t osimage -o test_myimage |grep otherpkglist|awk -F= '{print $2}'`;diff -y $otherpkglist /opt/inventory/site/osimage/test_myimage$otherpkglist check:rc==0 cmd:synclists=`lsdef -t osimage -o test_myimage |grep synclists|awk -F= '{print $2}'`;diff -y $synclists /opt/inventory/site/osimage/test_myimage$synclists check:rc==0 cmd:postinstall=`lsdef -t osimage -o test_myimage |grep postinstall|awk -F= '{print $2}'`;diff -y $postinstall /opt/inventory/site/osimage/test_myimage$postinstall check:rc==0 cmd:exlist=`lsdef -t osimage -o test_myimage |grep exlist|awk -F= '{print $2}'`;diff -y $exlist /opt/inventory/site/osimage/test_myimage$exlist check:rc==0 cmd:partitionfile=`lsdef -t osimage -o test_myimage |grep partitionfile|awk -F= '{print $2}'`;diff -y $partitionfile /opt/inventory/site/osimage/test_myimage$partitionfile check:rc==0 cmd:pkglist=`lsdef -t osimage -o test_myimage |grep -w pkglist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage$pkglist check:rc!=0 cmd:template=`lsdef -t osimage -o test_myimage |grep template|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage$template check:rc!=0 cmd: rmdef -t osimage -o test_myimage check:rc==0 cmd:rm -rf /tmp/otherpkglist /tmp/synclists /tmp/postinstall /tmp/exlist /tmp/partitionfile cmd:xcat-inventory import -t osimage -o test_myimage -d /opt/inventory/site/osimage check:rc==0 check:output=~The object test_myimage has been imported cmd:lsdef -t osimage -o test_myimage check:rc==0 cmd:otherpkglist=`lsdef -t osimage -o test_myimage |grep otherpkglist|awk -F= '{print $2}'`;diff -y $otherpkglist /opt/inventory/site/osimage/test_myimage$otherpkglist check:rc==0 cmd:synclists=`lsdef -t osimage -o test_myimage |grep synclists|awk -F= '{print $2}'`;diff -y $synclists /opt/inventory/site/osimage/test_myimage$synclists check:rc==0 cmd:postinstall=`lsdef -t osimage -o test_myimage |grep postinstall|awk -F= '{print $2}'`;diff -y $postinstall /opt/inventory/site/osimage/test_myimage$postinstall check:rc==0 cmd:exlist=`lsdef -t osimage -o test_myimage |grep exlist|awk -F= '{print $2}'`;diff -y $exlist /opt/inventory/site/osimage/test_myimage$exlist check:rc==0 cmd:partitionfile=`lsdef -t osimage -o test_myimage |grep partitionfile|awk -F= '{print $2}'`;diff -y $partitionfile /opt/inventory/site/osimage/test_myimage$partitionfile check:rc==0 cmd:pkglist=`lsdef -t osimage -o test_myimage |grep -w pkglist|awk -F= '{print $2}'`;if [ $pkglist == "/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist" ]; then exit 0; else exit 1; fi check:rc==0 cmd:template=`lsdef -t osimage -o test_myimage |grep template|awk -F= '{print $2}'`;if [ $template == "/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl" ]; then exit 0; else exit 1; fi check:rc==0 cmd: rmdef -t osimage -o test_myimage check:rc==0 cmd: if [ -e /tmp/test_myimage.stanza ]; then cat /tmp/test_myimage.stanza |mkdef -z;fi cmd:dir="/opt/inventory/site/osimage"; rm -rf $dir; if [ -d ${dir}".bak" ];then mv ${dir}".bak" $dir; fi cmd:if [ -e /tmp/otherpkglist.bak ]; then mv -f /tmp/otherpkglist.bak /tmp/otherpkglist; fi cmd:file="/tmp/otherpkglist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/tmp/synclists"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/tmp/postinstall"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/tmp/exlist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/tmp/partitionfile"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi end start:export_import_multiple_osimages_by_dir label:others,xcat_inventory description:This case is used to test xcat-inventory export and import several linux osimages definition by dir. cmd:if [ -e /tmp/otherpkglist ]; then cp -f /tmp/otherpkglist /tmp/otherpkglist.bak; fi cmd:echo "test" >> /tmp/otherpkglist cmd:if [ -e /tmp/synclists ]; then cp -f /tmp/synclists /tmp/synclists.bak; fi cmd:echo "test" >> /tmp/synclists cmd:if [ -e /tmp/postinstall ]; then cp -f /tmp/postinstall /tmp/postinstall.bak; fi cmd:echo "test" >> /tmp/postinstall cmd:if [ -e /tmp/exlist ]; then cp -f /tmp/exlist /tmp/exlist.bak; fi cmd:echo "test" >> /tmp/exlist cmd:if [ -e /tmp/partitionfile ]; then cp -f /tmp/partitionfile /tmp/partitionfile.bak; fi cmd:echo "test" >> /tmp/partitionfile cmd:if [ -e /tmp/pkglist ]; then cp -f /tmp/pkglist /tmp/pkglist.bak; fi cmd:echo "test" >> /tmp/pkglist cmd:if [ -e /tmp/template ]; then cp -f /tmp/template /tmp/template.bak; fi cmd:echo "test" >> /tmp/template cmd:if [ -e /opt/xcat/share/xcat/install/rh/otherpkglist ]; then cp -f /opt/xcat/share/xcat/install/rh/otherpkglist /opt/xcat/share/xcat/install/rh/otherpkglist.bak; fi cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/otherpkglist cmd:if [ -e /opt/xcat/share/xcat/install/rh/synclists ]; then cp -f /opt/xcat/share/xcat/install/rh/synclists /opt/xcat/share/xcat/install/rh/synclists.bak; fi cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/synclists cmd:if [ -e /opt/xcat/share/xcat/install/rh/synclists ]; then cp -f /opt/xcat/share/xcat/install/rh/synclists /opt/xcat/share/xcat/install/rh/synclists.bak; fi cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/synclists cmd:if [ -e /opt/xcat/share/xcat/install/rh/postinstall ]; then cp -f /opt/xcat/share/xcat/install/rh/postinstall /opt/xcat/share/xcat/install/rh/postinstall.bak; fi cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/postinstall cmd:if [ -e /opt/xcat/share/xcat/install/rh/exlist ]; then cp -f /opt/xcat/share/xcat/install/rh/exlist /opt/xcat/share/xcat/install/rh/exlist.bak; fi cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/exlist cmd:if [ -e /opt/xcat/share/xcat/install/rh/partitionfile ]; then cp -f /opt/xcat/share/xcat/install/rh/partitionfile /opt/xcat/share/xcat/install/rh/partitionfile.bak; fi cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/partitionfile cmd:if [ -e /opt/xcat/share/xcat/install/rh/pkglist ]; then cp -f /opt/xcat/share/xcat/install/rh/pkglist /opt/xcat/share/xcat/install/rh/pkglist.bak; fi cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/pkglist cmd:if [ -e /opt/xcat/share/xcat/install/rh/template ]; then cp -f /opt/xcat/share/xcat/install/rh/template /opt/xcat/share/xcat/install/rh/template.bak; fi cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/template cmd:lsdef -t osimage -o test_myimage1 >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test_myimage1 -z >/tmp/test_myimage1.stanza ;rmdef -t osimage -o test_myimage1;fi `check:rc==0 cmd:lsdef -t osimage -o test_myimage2 >/dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t osimage -o test_myimage2 -z >/tmp/test_myimage2.stanza ;rmdef -t osimage -o test_myimage2;fi check:rc==0 cmd:chdef -t osimage -o test_myimage1 imagetype=linux provmethod=install pkglist=/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl otherpkglist=/tmp/otherpkglist synclists=/tmp/synclists postinstall=/tmp/postinstall exlist=/tmp/exlist partitionfile=/tmp/partitionfile check:rc==0 cmd:chdef -t osimage -o test_myimage2 imagetype=linux provmethod=install pkglist=/tmp/pkglist template=/tmp/template otherpkglist=/opt/xcat/share/xcat/install/rh/otherpkglist synclists=/opt/xcat/share/xcat/install/rh/synclists postinstall=/opt/xcat/share/xcat/install/rh/postinstall exlist=/opt/xcat/share/xcat/install/rh/exlist partitionfile=/opt/xcat/share/xcat/install/rh/partitionfile check:rc==0 cmd:lsdef -t osimage test_myimage1,test_myimage2 cmd:dir="/opt/inventory/site/osimage";if [ -e "${dir}" ];then mv ${dir} ${dir}".bak"; fi; mkdir -p $dir cmd:xcat-inventory export -t osimage -o test_myimage1,test_myimage2 --format json -d /opt/inventory/site/osimage check:rc==0 check:output=~The osimage objects has been exported to directory /opt/inventory/site/osimage cmd:otherpkglist=`lsdef -t osimage -o test_myimage1 |grep otherpkglist|awk -F= '{print $2}'`;diff -y $otherpkglist /opt/inventory/site/osimage/test_myimage1$otherpkglist check:rc==0 cmd:synclists=`lsdef -t osimage -o test_myimage1 |grep synclists|awk -F= '{print $2}'`;diff -y $synclists /opt/inventory/site/osimage/test_myimage1$synclists check:rc==0 cmd:postinstall=`lsdef -t osimage -o test_myimage1 |grep postinstall|awk -F= '{print $2}'`;diff -y $postinstall /opt/inventory/site/osimage/test_myimage1$postinstall check:rc==0 cmd:exlist=`lsdef -t osimage -o test_myimage1 |grep exlist|awk -F= '{print $2}'`;diff -y $exlist /opt/inventory/site/osimage/test_myimage1$exlist check:rc==0 cmd:partitionfile=`lsdef -t osimage -o test_myimage1 |grep partitionfile|awk -F= '{print $2}'`;diff -y $partitionfile /opt/inventory/site/osimage/test_myimage1$partitionfile check:rc==0 cmd:pkglist=`lsdef -t osimage -o test_myimage1 |grep -w pkglist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage1$pkglist check:rc!=0 cmd:template=`lsdef -t osimage -o test_myimage1 |grep template|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage1$template check:rc!=0 cmd:otherpkglist=`lsdef -t osimage -o test_myimage2 |grep otherpkglist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage2$otherpkglist check:rc!=0 cmd:synclists=`lsdef -t osimage -o test_myimage2 |grep synclists|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage2$synclists check:rc!=0 cmd:postinstall=`lsdef -t osimage -o test_myimage2 |grep postinstall|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage2$postinstall check:rc!=0 cmd:exlist=`lsdef -t osimage -o test_myimage2 |grep exlist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage2$exlist check:rc!=0 cmd:partitionfile=`lsdef -t osimage -o test_myimage2 |grep partitionfile|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage2$partitionfile check:rc!=0 cmd:pkglist=`lsdef -t osimage -o test_myimage2 |grep -w pkglist|awk -F= '{print $2}'`;diff -y $pkglist /opt/inventory/site/osimage/test_myimage2$pkglist check:rc==0 cmd:template=`lsdef -t osimage -o test_myimage2 |grep template|awk -F= '{print $2}'`;diff -y $template /opt/inventory/site/osimage/test_myimage2$template check:rc==0 cmd: rmdef -t osimage -o test_myimage1,test_myimage2 check:rc==0 cmd:rm -rf /tmp/otherpkglist /tmp/synclists /tmp/postinstall /tmp/exlist /tmp/partitionfile /tmp/pkglist /tmp/template cmd:xcat-inventory import -t osimage -o test_myimage1,test_myimage2 -d /opt/inventory/site check:rc==0 check:output=~The object test_myimage1 has been imported check:output=~The object test_myimage2 has been imported cmd:lsdef -t osimage -o test_myimage1,test_myimage2 check:rc==0 cmd:otherpkglist=`lsdef -t osimage -o test_myimage1 |grep otherpkglist|awk -F= '{print $2}'`;diff -y $otherpkglist /opt/inventory/site/osimage/test_myimage1$otherpkglist check:rc==0 cmd:synclists=`lsdef -t osimage -o test_myimage1 |grep synclists|awk -F= '{print $2}'`;diff -y $synclists /opt/inventory/site/osimage/test_myimage1$synclists check:rc==0 cmd:postinstall=`lsdef -t osimage -o test_myimage1 |grep postinstall|awk -F= '{print $2}'`;diff -y $postinstall /opt/inventory/site/osimage/test_myimage1$postinstall check:rc==0 cmd:exlist=`lsdef -t osimage -o test_myimage1 |grep exlist|awk -F= '{print $2}'`;diff -y $exlist /opt/inventory/site/osimage/test_myimage1$exlist check:rc==0 cmd:partitionfile=`lsdef -t osimage -o test_myimage1 |grep partitionfile|awk -F= '{print $2}'`;diff -y $partitionfile /opt/inventory/site/osimage/test_myimage1$partitionfile check:rc==0 cmd:pkglist=`lsdef -t osimage -o test_myimage1 |grep -w pkglist|awk -F= '{print $2}'`;if [ $pkglist == "/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist" ]; then exit 0; else exit 1; fi check:rc==0 cmd:template=`lsdef -t osimage -o test_myimage1 |grep template|awk -F= '{print $2}'`;if [ $template == "/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl" ]; then exit 0; else exit 1; fi check:rc==0 cmd:otherpkglist=`lsdef -t osimage -o test_myimage2 |grep otherpkglist|awk -F= '{print $2}'`;if [ $otherpkglist == "/opt/xcat/share/xcat/install/rh/otherpkglist" ]; then exit 0; else exit 1; fi check:rc==0 cmd:synclists=`lsdef -t osimage -o test_myimage2 |grep synclists|awk -F= '{print $2}'`;if [ $synclists == "/opt/xcat/share/xcat/install/rh/synclists" ]; then exit 0; else exit 1; fi check:rc==0 cmd:postinstall=`lsdef -t osimage -o test_myimage2 |grep postinstall|awk -F= '{print $2}'`;if [ $postinstall == "/opt/xcat/share/xcat/install/rh/postinstall" ]; then exit 0; else exit 1; fi check:rc==0 cmd:exlist=`lsdef -t osimage -o test_myimage2 |grep exlist|awk -F= '{print $2}'`;if [ $exlist == "/opt/xcat/share/xcat/install/rh/exlist" ]; then exit 0; else exit 1; fi check:rc==0 cmd:partitionfile=`lsdef -t osimage -o test_myimage2 |grep partitionfile|awk -F= '{print $2}'`;if [ $partitionfile == "/opt/xcat/share/xcat/install/rh/partitionfile" ]; then exit 0; else exit 1; fi check:rc==0 cmd:pkglist=`lsdef -t osimage -o test_myimage2 |grep -w pkglist|awk -F= '{print $2}'`;diff -y $pkglist /opt/inventory/site/osimage/test_myimage2$pkglist check:rc==0 cmd:template=`lsdef -t osimage -o test_myimage2 |grep template|awk -F= '{print $2}'`;diff -y $template /opt/inventory/site/osimage/test_myimage2$template check:rc==0 cmd: rmdef -t osimage -o test_myimage1,test_myimage2 check:rc==0 cmd: if [ -e /tmp/test_myimage1.stanza ]; then cat /tmp/test_myimage1.stanza |mkdef -z;fi cmd: if [ -e /tmp/test_myimage2.stanza ]; then cat /tmp/test_myimage2.stanza |mkdef -z;fi cmd:dir="/opt/inventory/site/osimage"; rm -rf $dir; if [ -d ${dir}".bak" ];then mv ${dir}".bak" $dir; fi cmd:file="/tmp/otherpkglist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/tmp/synclists"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/tmp/postinstall"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/tmp/exlist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/tmp/partitionfile"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/tmp/pkglist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/tmp/template"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/opt/xcat/share/xcat/install/rh/otherpkglist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/opt/xcat/share/xcat/install/rh/synclists"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/opt/xcat/share/xcat/install/rh/postinstall"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/opt/xcat/share/xcat/install/rh/exlist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/opt/xcat/share/xcat/install/rh/partitionfile"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/opt/xcat/share/xcat/install/rh/pkglist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/opt/xcat/share/xcat/install/rh/template"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi end start:export_import_all_osimages_by_dir label:others,xcat_inventory description:This case is used to test xcat-inventory export and import all linux osimage definition by files. cmd:lsdef -t osimage -z | tee /tmp/osimage.list check:rc==0 #backup all osimage cmd:if [ -e /tmp/osimages ]; then cp -f /tmp/osimages /tmp/osimages.bak ; else mkdir -p /tmp/osimages; fi cmd:imgdir='/tmp/osimages';for img in $(lsdef -t osimage -s|awk -F' ' '{print $1}'); do lsdef -t osimage -o $img -z > $imgdir/${img}.stanza;done check:rc==0 cmd:for img in $(lsdef -t osimage -s|awk -F' ' '{print $1}');do rmdef -t osimage -o $img;done check:rc==0 cmd:if [ -e /tmp/otherpkglist ]; then cp -f /tmp/otherpkglist /tmp/otherpkglist.bak; fi cmd:echo "test" >> /tmp/otherpkglist cmd:if [ -e /tmp/synclists ]; then cp -f /tmp/synclists /tmp/synclists.bak; fi cmd:echo "test" >> /tmp/synclists cmd:if [ -e /tmp/postinstall ]; then cp -f /tmp/postinstall /tmp/postinstall.bak; fi cmd:echo "test" >> /tmp/postinstall cmd:if [ -e /tmp/exlist ]; then cp -f /tmp/exlist /tmp/exlist.bak; fi cmd:echo "test" >> /tmp/exlist cmd:if [ -e /tmp/partitionfile ]; then cp -f /tmp/partitionfile /tmp/partitionfile.bak; fi cmd:echo "test" >> /tmp/partitionfile cmd:if [ -e /tmp/pkglist ]; then cp -f /tmp/pkglist /tmp/pkglist.bak; fi cmd:echo "test" >> /tmp/pkglist cmd:if [ -e /tmp/template ]; then cp -f /tmp/template /tmp/pkglist.bak; fi cmd:echo "test" >> /tmp/template cmd:if [ -e /opt/xcat/share/xcat/install/rh/otherpkglist ]; then cp -f /opt/xcat/share/xcat/install/rh/otherpkglist /opt/xcat/share/xcat/install/rh/otherpkglist.bak; fi cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/otherpkglist cmd:if [ -e /opt/xcat/share/xcat/install/rh/synclists ]; then cp -f /opt/xcat/share/xcat/install/rh/synclists /opt/xcat/share/xcat/install/rh/synclists.bak; fi cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/synclists cmd:if [ -e /opt/xcat/share/xcat/install/rh/postinstall ]; then cp -f /opt/xcat/share/xcat/install/rh/postinstall /opt/xcat/share/xcat/install/rh/postinstall.bak; fi cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/postinstall cmd:if [ -e /opt/xcat/share/xcat/install/rh/exlist ]; then cp -f /opt/xcat/share/xcat/install/rh/exlist /opt/xcat/share/xcat/install/rh/exlist.bak; fi cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/exlist cmd:if [ -e /opt/xcat/share/xcat/install/rh/partitionfile ]; then cp -f /opt/xcat/share/xcat/install/rh/partitionfile /opt/xcat/share/xcat/install/rh/partitionfile.bak; fi cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/partitionfile cmd:if [ -e /opt/xcat/share/xcat/install/rh/pkglist ]; then cp -f /opt/xcat/share/xcat/install/rh/pkglist /opt/xcat/share/xcat/install/rh/pkglist.bak; fi cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/pkglist cmd:if [ -e /opt/xcat/share/xcat/install/rh/template ]; then cp -f /opt/xcat/share/xcat/install/rh/template /opt/xcat/share/xcat/install/rh/template.bak; fi cmd:echo "test" >> /opt/xcat/share/xcat/install/rh/template cmd:chdef -t osimage -o test_myimage1 imagetype=linux provmethod=install pkglist=/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist template=/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl otherpkglist=/tmp/otherpkglist synclists=/tmp/synclists postinstall=/tmp/postinstall exlist=/tmp/exlist partitionfile=/tmp/partitionfile check:rc==0 cmd:chdef -t osimage -o test_myimage2 imagetype=linux provmethod=install pkglist=/tmp/pkglist template=/tmp/template otherpkglist=/opt/xcat/share/xcat/install/rh/otherpkglist synclists=/opt/xcat/share/xcat/install/rh/synclists postinstall=/opt/xcat/share/xcat/install/rh/postinstall exlist=/opt/xcat/share/xcat/install/rh/exlist partitionfile=/opt/xcat/share/xcat/install/rh/partitionfile check:rc==0 cmd:lsdef -t osimage -o test_myimage1,test_myimage2 cmd:dir="/opt/inventory/site/osimage";if [ -e "${dir}" ];then mv ${dir} ${dir}".bak"; fi; mkdir -p $dir cmd:xcat-inventory export -d /opt/inventory/site/ check:rc==0 check:output=~The osimage objects has been exported to directory /opt/inventory/site/ cmd:ls -lFR /opt/inventory/site/ cmd:otherpkglist=`lsdef -t osimage -o test_myimage1 |grep otherpkglist|awk -F= '{print $2}'`;diff -y $otherpkglist /opt/inventory/site/osimage/test_myimage1$otherpkglist check:rc==0 cmd:synclists=`lsdef -t osimage -o test_myimage1 |grep synclists|awk -F= '{print $2}'`;diff -y $synclists /opt/inventory/site/osimage/test_myimage1$synclists check:rc==0 cmd:postinstall=`lsdef -t osimage -o test_myimage1 |grep postinstall|awk -F= '{print $2}'`;diff -y $postinstall /opt/inventory/site/osimage/test_myimage1$postinstall check:rc==0 cmd:exlist=`lsdef -t osimage -o test_myimage1 |grep exlist|awk -F= '{print $2}'`;diff -y $exlist /opt/inventory/site/osimage/test_myimage1$exlist check:rc==0 cmd:partitionfile=`lsdef -t osimage -o test_myimage1 |grep partitionfile|awk -F= '{print $2}'`;diff -y $partitionfile /opt/inventory/site/osimage/test_myimage1$partitionfile check:rc==0 cmd:pkglist=`lsdef -t osimage -o test_myimage1 |grep -w pkglist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage1$pkglist check:rc!=0 cmd:template=`lsdef -t osimage -o test_myimage1 |grep template|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage1$template check:rc!=0 cmd:otherpkglist=`lsdef -t osimage -o test_myimage2 |grep otherpkglist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage2$otherpkglist check:rc!=0 cmd:synclists=`lsdef -t osimage -o test_myimage2 |grep synclists|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage2$synclists check:rc!=0 cmd:postinstall=`lsdef -t osimage -o test_myimage2 |grep postinstall|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage2$postinstall check:rc!=0 cmd:exlist=`lsdef -t osimage -o test_myimage2 |grep exlist|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage2$exlist check:rc!=0 cmd:partitionfile=`lsdef -t osimage -o test_myimage2 |grep partitionfile|awk -F= '{print $2}'`;ls -l /opt/inventory/site/osimage/test_myimage2$partitionfile check:rc!=0 cmd:pkglist=`lsdef -t osimage -o test_myimage2 |grep -w pkglist|awk -F= '{print $2}'`;diff -y $pkglist /opt/inventory/site/osimage/test_myimage2$pkglist check:rc==0 cmd:template=`lsdef -t osimage -o test_myimage2 |grep template|awk -F= '{print $2}'`;diff -y $template /opt/inventory/site/osimage/test_myimage2$template check:rc==0 cmd: rmdef -t osimage -o test_myimage1,test_myimage2 check:rc==0 cmd:rm -rf /tmp/otherpkglist /tmp/synclists /tmp/postinstall /tmp/exlist /tmp/pkglist /tmp/template /tmp/partitionfile cmd:xcat-inventory import -t osimage -d /opt/inventory/site check:rc==0 check:output=~Importing object: test_myimage1 check:output=~Inventory import successfully! check:output=~The object test_myimage1 has been imported check:output=~Importing object: test_myimage2 check:output=~Inventory import successfully! check:output=~The object test_myimage2 has been imported cmd:lsdef -t osimage -o test_myimage1,test_myimage2 check:rc==0 cmd:otherpkglist=`lsdef -t osimage -o test_myimage1 |grep otherpkglist|awk -F= '{print $2}'`;diff -y $otherpkglist /opt/inventory/site/osimage/test_myimage1$otherpkglist check:rc==0 cmd:synclists=`lsdef -t osimage -o test_myimage1 |grep synclists|awk -F= '{print $2}'`;diff -y $synclists /opt/inventory/site/osimage/test_myimage1$synclists check:rc==0 cmd:postinstall=`lsdef -t osimage -o test_myimage1 |grep postinstall|awk -F= '{print $2}'`;diff -y $postinstall /opt/inventory/site/osimage/test_myimage1$postinstall check:rc==0 cmd:exlist=`lsdef -t osimage -o test_myimage1 |grep exlist|awk -F= '{print $2}'`;diff -y $exlist /opt/inventory/site/osimage/test_myimage1$exlist check:rc==0 cmd:partitionfile=`lsdef -t osimage -o test_myimage1 |grep partitionfile|awk -F= '{print $2}'`;diff -y $partitionfile /opt/inventory/site/osimage/test_myimage1$partitionfile check:rc==0 cmd:pkglist=`lsdef -t osimage -o test_myimage1 |grep -w pkglist|awk -F= '{print $2}'`;if [ $pkglist == "/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist" ]; then exit 0; else exit 1; fi check:rc==0 cmd:template=`lsdef -t osimage -o test_myimage1 |grep template|awk -F= '{print $2}'`;if [ $template == "/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl" ]; then exit 0; else exit 1; fi check:rc==0 cmd:otherpkglist=`lsdef -t osimage -o test_myimage2 |grep otherpkglist|awk -F= '{print $2}'`;if [ $otherpkglist == "/opt/xcat/share/xcat/install/rh/otherpkglist" ]; then exit 0; else exit 1; fi check:rc==0 cmd:synclists=`lsdef -t osimage -o test_myimage2 |grep synclists|awk -F= '{print $2}'`;if [ $synclists == "/opt/xcat/share/xcat/install/rh/synclists" ]; then exit 0; else exit 1; fi check:rc==0 cmd:postinstall=`lsdef -t osimage -o test_myimage2 |grep postinstall|awk -F= '{print $2}'`;if [ $postinstall == "/opt/xcat/share/xcat/install/rh/postinstall" ]; then exit 0; else exit 1; fi check:rc==0 cmd:exlist=`lsdef -t osimage -o test_myimage2 |grep exlist|awk -F= '{print $2}'`;if [ $exlist == "/opt/xcat/share/xcat/install/rh/exlist" ]; then exit 0; else exit 1; fi check:rc==0 cmd:partitionfile=`lsdef -t osimage -o test_myimage2 |grep partitionfile|awk -F= '{print $2}'`;if [ $partitionfile == "/opt/xcat/share/xcat/install/rh/partitionfile" ]; then exit 0; else exit 1; fi check:rc==0 cmd:pkglist=`lsdef -t osimage -o test_myimage2 |grep -w pkglist|awk -F= '{print $2}'`;diff -y $pkglist /opt/inventory/site/osimage/test_myimage2$pkglist check:rc==0 cmd:template=`lsdef -t osimage -o test_myimage2 |grep template|awk -F= '{print $2}'`;diff -y $template /opt/inventory/site/osimage/test_myimage2$template check:rc==0 cmd: rmdef -t osimage -o test_myimage1,test_myimage2 check:rc==0 cmd: if [ -e /tmp/test_myimage1.stanza ]; then cat /tmp/test_myimage1.stanza |mkdef -z;fi cmd: if [ -e /tmp/test_myimage2.stanza ]; then cat /tmp/test_myimage2.stanza |mkdef -z;fi cmd:dir="/opt/inventory/site/osimage"; rm -rf $dir; if [ -d ${dir}".bak" ];then mv ${dir}".bak" $dir; fi cmd:dir="/opt/inventory/site/osimage"; rm -rf $dir; if [ -d ${dir}".bak" ];then mv ${dir}".bak" $dir; fi cmd:file="/tmp/otherpkglist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/tmp/synclists"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/tmp/postinstall"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/tmp/exlist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/tmp/partitionfile"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/tmp/pkglist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/tmp/template"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/opt/xcat/share/xcat/install/rh/otherpkglist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/opt/xcat/share/xcat/install/rh/synclists"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/opt/xcat/share/xcat/install/rh/postinstall"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/opt/xcat/share/xcat/install/rh/exlist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/opt/xcat/share/xcat/install/rh/partitionfile"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/opt/xcat/share/xcat/install/rh/pkglist"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:file="/opt/xcat/share/xcat/install/rh/template"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${file}".bak" $file; fi cmd:for file in /tmp/osimages/*.stanza; do cat $file|mkdef -z; done cmd:if [ -e /tmp/osimages.bak ]; then mv -f /tmp/osimages.bak /tmp/osimages; fi end start:export_import_osimages_by_dir_with_c label:others,xcat_inventory description:This case is used to test xcat-inventory export and import linux osimage definition witch -c option. label:others,xcat_inventory cmd:dir="/tmp/export";if [ -e "${dir}" ];then mv ${dir} ${dir}".bak"; fi; mkdir -p $dir cmd:imgdir='/tmp/export';for img in $(lsdef -t osimage -s|awk -F' ' '{print $1}'); do lsdef -t osimage -o $img -z > $imgdir/${img}.stanza;done check:rc==0 cmd:for img in $(lsdef -t osimage -s|awk -F' ' '{print $1}');do rmdef -t osimage -o $img;done check:rc==0 cmd:chdef -t osimage -o test_myimage1,test_myimage2,test_myimage3 imagetype=linux provmethod=install check:rc==0 cmd:xcat-inventory export -t osimage -o test_myimage1,test_myimage2 -d /tmp/export check:rc==0 check:output=~The osimage objects has been exported to directory /tmp/export cmd:ls -lFR /tmp/export cmd: xcat-inventory import -t osimage -d /tmp/export -c check:rc==0 check:output=~Importing object: test_myimage1 check:output=~Inventory import successfully! check:output=~The object test_myimage1 has been imported check:output=~Importing object: test_myimage2 check:output=~Inventory import successfully! check:output=~The object test_myimage2 has been imported cmd:lsdef -t osimage -o test_myimage1,test_myimage2 check:rc==0 cmd:lsdef -t osimage -o test_myimage3 check:rc!=0 cmd:rmdef -t osimage -o test_myimage1,test_myimage2 cmd:for file in /tmp/export/*.stanza; do cat $file|mkdef -z; done cmd:dir="/tmp/export"; rm -rf $dir; if [ -d ${dir}".bak" ];then mv ${dir}".bak" $dir; fi end