diff --git a/xCAT-test/autotest/testcase/xcat_inventory/cases.backend b/xCAT-test/autotest/testcase/xcat_inventory/cases.backend new file mode 100644 index 000000000..b396448a4 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat_inventory/cases.backend @@ -0,0 +1,92 @@ +start:backend +description: verify xcat-inventory backend operations +label:others,inventory_ci + +cmd: rm -rf /tmp/backend_test/ +cmd:rm -rf ~/.xcatinv/inventory.cfg.bak.backend_init +check: rc==0 +cmd: [ -f ~/.xcatinv/inventory.cfg ] && mv ~/.xcatinv/inventory.cfg ~/.xcatinv/inventory.cfg.bak.backend_init +cmd: cp /opt/xcat/share/xcat/tools/autotest/testcase/xcat_inventory/templates/inventory.cfg ~/.xcatinv/inventory.cfg +cmd: xcat-inventory init +check: rc==0 +check: output=~configuring backend dir +check: output=~xcat-inventory backend initialized +cmd: xcat-inventory init +check: rc==0 +check: output=~Backend has already been initialized, do nothing +cmd: cd /tmp/backend_test/git/repo && git config --local --get user.name +check: output=~ci +cmd: cd /tmp/backend_test/git/repo && git config --local --get user.email +check: output=~xcat@xcat.org +cmd: cd /tmp/backend_test/git/repo && git config --local --get diff.tool +check: output=~invdiff +cmd: cd /tmp/backend_test/git/repo && git config --local --get difftool.invdiff.cmd +check: output=~xcat-inventory diff --filename +cmd: xcat-inventory workspace-list +check: rc==0 +check: output=~master +cmd: XCATBYPASS=1 dumpxCATdb -p /tmp/backend_test/backup/db +check: rc==0 +cmd: XCATBYPASS=1 rmdef -a -f +check: rc==0 +cmd: xcat-inventory import -d /opt/xcat/share/xcat/tools/autotest/testcase/xcat_inventory/templates/testcluster_backend +check: rc==0 +cmd:xcat-inventory commit -m "Rev1" Rev1 +check: rc==0 +check: output=~creating revision Rev1 in workspace +cmd:xcat-inventory revlist +check:rc==0 +check: output=~Rev1 + +cmd:xcat-inventory revlist Rev1 +check:rc==0 +check: output=~cluster.yaml +check: output=~definition.yaml +check: output=~Tagger: +cmd:chdef -t site -o clustersite xcatdebugmode=2 + +check: rc==0 +cmd:rmdef -t node -o nodetorm +check: rc==0 +cmd:mkdef -t osimage -o osimage3 --template osimage1 +check: rc==0 +cmd: xcat-inventory diff +check: rc==0 +check: output=~\+ xcatdebugmode\: \'2\' +check: output=~\+ osimage3\: +check: output=~\- nodetorm\: + +cmd: xcat-inventory commit Rev2 +check: rc==0 + +cmd: xcat-inventory checkout Rev1 +check: rc==0 +check: output=~checked out to revision Rev1 + +cmd: xcat-inventory whereami +check: rc==0 +check: output=~you are in revision \"Rev1\" of workspace \"master\" + +cmd: xcat-inventory workspace-new ws +check: rc==0 +cmd: +check: output=~workspace ws created +cmd: xcat-inventory workspace-list +check: rc==0 +check: output=~ws +cmd: xcat-inventory workspace-checkout ws +check: rc==0 +cmd: xcat-inventory workspace-delete ws +check: rc==0 +check: output=~deleted workspace ws +cmd: xcat-inventory workspace-list +check: rc==0 +check: output!=~ws + +cmd: XCATBYPASS=1 restorexCATdb -p /tmp/backend_test/backup/db +check: rc==0 +cmd: [ -f "~/.xcatinv/inventory.cfg.bak.backend_init" ] && rm -rf "~/.xcatinv/inventory.cfg" && mv "~/.xcatinv/inventory.cfg.bak.backend_init" "~/.xcatinv/inventory.cfg" +cmd: rm -rf /tmp/backend_test/ +end + + diff --git a/xCAT-test/autotest/testcase/xcat_inventory/templates/inventory.cfg b/xCAT-test/autotest/testcase/xcat_inventory/templates/inventory.cfg new file mode 100644 index 000000000..08030efd0 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat_inventory/templates/inventory.cfg @@ -0,0 +1,8 @@ +[backend] +type = 'git' +user = ci +workspace="master" + +[InfraRepo] +local_repo='/tmp/backend_test/git/repo' +working_dir=. diff --git a/xCAT-test/autotest/testcase/xcat_inventory/templates/testcluster_backend/cluster.yaml b/xCAT-test/autotest/testcase/xcat_inventory/templates/testcluster_backend/cluster.yaml new file mode 100644 index 000000000..7b9b261b6 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat_inventory/templates/testcluster_backend/cluster.yaml @@ -0,0 +1,124 @@ +network: + prov: + basic_attr: + gateway: 10.6.7.1 + mask: 255.0.0.0 + net: 10.6.7.0 +node: + nodetorm: + device_type: server + obj_info: + groups: all + obj_type: node + role: compute + node2: + device_type: server + obj_info: + groups: all + obj_type: node + role: compute + xcatdefaults: + device_type: server + engines: + netboot_engine: + engine_info: + postbootscripts: otherpkgs + postscripts: syslog,remoteshell,syncfiles + obj_type: group + role: compute +passwd: + ipmi: + password: admin + username: ADMIN + omapi: + password: MnJKd01IWGtzYUNoY3FWZ29mRkdFcFhkbnBRNlBtYmg= + username: xcat_key + switch: + password: admin + username: root + system: + password: cluster + username: root +policy: + '1': + name: root + rule: allow + '1.2': + name: xcatmn + 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: {} +schema_version: '2.0' +site: + clustersite: + 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.6.29.1,10.0.0.101 + fsptimeout: '0' + installdir: /install + ipmimaxp: '64' + ipmiretries: '3' + ipmitimeout: '2' + master: 10.6.7.1 + maxssh: '8' + nameservers: 10.6.7.1 + nodesyncfiledir: /var/xcat/node/syncfiles + powerinterval: '0' + ppcmaxp: '64' + ppcretry: '3' + ppctimeout: '0' + sharedtftp: '1' + sshbetweennodes: ALLGROUPS + syspowerinterval: '0' + tftpdir: /tftpboot + timezone: Universal + useNmapfromMN: 'no' + vsftp: n + xcatconfdir: /etc/xcat + xcatdport: '3001' + xcatiport: '3002' + xcatsslversion: TLSv1 +zone: {} + +#Version 2.14.5 (git commit fc0fb3fca198aa298a114f6124749275e7d81f8c, built Thu Dec 6 22:20:43 EST 2018) diff --git a/xCAT-test/autotest/testcase/xcat_inventory/templates/testcluster_backend/credential/credential/definition.yaml b/xCAT-test/autotest/testcase/xcat_inventory/templates/testcluster_backend/credential/credential/definition.yaml new file mode 100644 index 000000000..897ec8a2e --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat_inventory/templates/testcluster_backend/credential/credential/definition.yaml @@ -0,0 +1,11 @@ +credential: + credential: + CA: + certificate: /etc/xcat/ca/ca-cert.pem + private_key: /etc/xcat/ca/private/ca-key.pem + client: + root: /root/.xcat/client-cred.pem + server: /etc/xcat/cert/server-cred.pem +schema_version: '2.0' + +#Version 2.14.5 (git commit fc0fb3fca198aa298a114f6124749275e7d81f8c, built Thu Dec 6 22:20:43 EST 2018) \ No newline at end of file diff --git a/xCAT-test/autotest/testcase/xcat_inventory/templates/testcluster_backend/osimage/osimage1/definition.yaml b/xCAT-test/autotest/testcase/xcat_inventory/templates/testcluster_backend/osimage/osimage1/definition.yaml new file mode 100644 index 000000000..7bb948f46 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat_inventory/templates/testcluster_backend/osimage/osimage1/definition.yaml @@ -0,0 +1,9 @@ +osimage: + osimage1: + basic_attributes: + distribution: rh8 + imagetype: linux + provision_mode: netboot +schema_version: '2.0' + +#Version 2.14.5 (git commit fc0fb3fca198aa298a114f6124749275e7d81f8c, built Thu Dec 6 22:20:43 EST 2018) \ No newline at end of file diff --git a/xCAT-test/autotest/testcase/xcat_inventory/templates/testcluster_backend/osimage/osimage2/definition.yaml b/xCAT-test/autotest/testcase/xcat_inventory/templates/testcluster_backend/osimage/osimage2/definition.yaml new file mode 100644 index 000000000..10d0b09a1 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat_inventory/templates/testcluster_backend/osimage/osimage2/definition.yaml @@ -0,0 +1,9 @@ +osimage: + osimage2: + basic_attributes: + distribution: sles15 + imagetype: linux + provision_mode: netboot +schema_version: '2.0' + +#Version 2.14.5 (git commit fc0fb3fca198aa298a114f6124749275e7d81f8c, built Thu Dec 6 22:20:43 EST 2018) \ No newline at end of file