diff --git a/.travis.yml b/.travis.yml index 25ab2393e..0c936bf7e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,8 +18,6 @@ script: - echo $TRAVIS_JOB_NUMBER - echo $TRAVIS_BRANCH - echo $TRAVIS_COMMIT_MESSAGE -- echo $USERNAME -- echo $PASSWORD - echo $GITHUB_TOKEN - git log --pretty=format:"%s %b" -2 diff --git a/docs/source/guides/admin-guides/references/man1/rbeacon.1.rst b/docs/source/guides/admin-guides/references/man1/rbeacon.1.rst index 8ace5fc08..d120615c0 100644 --- a/docs/source/guides/admin-guides/references/man1/rbeacon.1.rst +++ b/docs/source/guides/admin-guides/references/man1/rbeacon.1.rst @@ -31,7 +31,7 @@ OpenPOWER OpenBMC: ================== -\ **rbeacon**\ \ *noderange*\ {\ **on | off**\ } +\ **rbeacon**\ \ *noderange*\ {\ **on | off | stat**\ } @@ -40,7 +40,7 @@ DESCRIPTION *********** -\ **rbeacon**\ Turns beacon (a light on the front of the physical server) on/off/blink or gives status of a node or noderange. +\ **rbeacon**\ Turns beacon (a light on the front and/or rear of the physical server) on/off/blink or gives status of a node or noderange. ******** diff --git a/perl-xCAT/xCAT/Client.pm b/perl-xCAT/xCAT/Client.pm index ae0d19d98..455c3524e 100644 --- a/perl-xCAT/xCAT/Client.pm +++ b/perl-xCAT/xCAT/Client.pm @@ -1129,12 +1129,15 @@ sub handle_response { return; } - my $msgsource; + my $msgsource = ""; if ($ENV{'XCATSHOWSVR'}) { unless ($rsp->{NoSvrPrefix}) { # some plugins could disable the prefix forcely by seting the flag in response. $msgsource = $rsp->{xcatdsource}->[0] if ($rsp->{xcatdsource}); } } + if ($rsp->{host}) { + $msgsource = $rsp->{xcatdsource}->[0] if ($rsp->{xcatdsource}); + } #print "in handle_response\n"; # Handle errors @@ -1186,7 +1189,6 @@ sub handle_response { } } if ($rsp->{info}) { - #print "printing info\n"; if (ref($rsp->{info}) eq 'ARRAY') { foreach my $text (@{ $rsp->{info} }) { diff --git a/perl-xCAT/xCAT/MsgUtils.pm b/perl-xCAT/xCAT/MsgUtils.pm index 079b5e3a7..47cec0ff4 100644 --- a/perl-xCAT/xCAT/MsgUtils.pm +++ b/perl-xCAT/xCAT/MsgUtils.pm @@ -18,6 +18,8 @@ use Socket; use File::Path; use constant PERF_LOG => "/var/log/xcat/perf.log"; +my $host = ""; +my $isSN = xCAT::Utils->isServiceNode(); $::NOK = -1; $::OK = 0; @@ -546,6 +548,73 @@ sub message return; } + +#----------------------------------------------------------------------------- + +=head3 error_message + + A wrap function for message. If $callback is not defined, send the log to + syslog, otherwise, send error message to client. Print service host if runs + on service node. + + Example: + + $rsp->{data}->[0] = "message"; + xCAT::MsgUtils->error_message($rsp, $callback); +=cut + +#----------------------------------------------------------------------------- +sub error_message +{ + shift; + my $rsp = shift; + my $callback = shift; + if (!defined($callback)) { + message(undef, "S", $rsp, undef); + return; + } + if ($isSN && !$host) { + my @hostinfo = xCAT::NetworkUtils->determinehostname(); + $host = $hostinfo[-1]; + } + $rsp->{host} = $host if $host; + message(undef, "E", $rsp, $callback); +} + +#----------------------------------------------------------------------------- + +=head3 info_message + + A wrap function for message. If $callback is not defined, send the log to + syslog, otherwise, send info message to client. Print service host if runs + on service node. + + Example: + + $rsp->{data}->[0] = "message"; + xCAT::MsgUtils->info_message($rsp, $callback); +=cut + +#----------------------------------------------------------------------------- +sub info_message +{ + shift; + my $rsp = shift; + my $callback = shift; + if (!defined($callback)) { + message(undef, "S", $rsp, undef); + return; + } + if ($isSN && !$host) { + my @hostinfo = xCAT::NetworkUtils->determinehostname(); + $host = $hostinfo[-1]; + } + $rsp->{host} = $host if $host; + message(undef, "I", $rsp, $callback); +} + + + #-------------------------------------------------------------------------------- =head2 xCAT Logging Routines diff --git a/perl-xCAT/xCAT/Usage.pm b/perl-xCAT/xCAT/Usage.pm index 14052c8be..aeb8cdfe2 100755 --- a/perl-xCAT/xCAT/Usage.pm +++ b/perl-xCAT/xCAT/Usage.pm @@ -86,7 +86,7 @@ my %usage = ( ", "rbeacon.openbmc" => "OpenPOWER (OpenBMC) specific: - rbeacon [on|off] + rbeacon [on|off|stat] ", "rvitals" => "", "rvitals.common" => @@ -185,6 +185,16 @@ my %usage = ( rspconfig [hostname|ntpservers] rspconfig [hostname=<*|hostname>|ntpservers=] rspconfig sshcfg + rspconfig powerrestorepolicy + rspconfig powerrestorepolicy={always_on|restore|always_off} + rspconfig powersupplyredundancy + rspconfig powersupplyredundancy={disabled|enabled} + rspconfig timesyncmethod + rspconfig timesyncmethod={ntp|manual} + rspconfig bootmode + rspconfig bootmode={safe|regular|setup} + rspconfig autoreboot + rspconfig autoreboot={0|1} ", "rspconfig.begin" => "BMC/MPA Common: diff --git a/travis.pl b/travis.pl index 9478ab275..6fb7708f4 100644 --- a/travis.pl +++ b/travis.pl @@ -129,9 +129,14 @@ sub check_pr_format{ $check_result_str .= "> **PR FORMAT CORRECT**"; send_back_comment("$check_result_str"); }else{ - $check_result_str .= "> **PR FORMAT ERROR** : $checkrst"; - send_back_comment("$check_result_str"); - return 1; + if($checkrst =~ /milestone/ || $checkrst =~ /labels/){ + $check_result_str .= "> **PR FORMAT WARNING** : $checkrst"; + send_back_comment("$check_result_str"); + }else{ + $check_result_str .= "> **PR FORMAT ERROR** : $checkrst"; + send_back_comment("$check_result_str"); + return 1; + } } } return 0; diff --git a/xCAT-client/pods/man1/rbeacon.1.pod b/xCAT-client/pods/man1/rbeacon.1.pod index 8fc04ad4e..4db578fa4 100644 --- a/xCAT-client/pods/man1/rbeacon.1.pod +++ b/xCAT-client/pods/man1/rbeacon.1.pod @@ -17,12 +17,12 @@ B I {B|B|B|B} =head2 OpenPOWER OpenBMC: -B I {B|B} +B I {B|B|B} =head1 DESCRIPTION -B Turns beacon (a light on the front of the physical server) on/off/blink or gives status of a node or noderange. +B Turns beacon (a light on the front and/or rear of the physical server) on/off/blink or gives status of a node or noderange. =head1 EXAMPLES diff --git a/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_bmcconfig.py b/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_bmcconfig.py index 1c278e70d..33bb6077d 100644 --- a/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_bmcconfig.py +++ b/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_bmcconfig.py @@ -375,11 +375,12 @@ rmdir \"/tmp/$userid\" \n") node = kw['node'] obmc = openbmc.OpenBMCRest(name=node, nodeinfo=kw['nodeinfo'], messager=self.callback, debugmode=self.debugmode, verbose=self.verbose) + try: obmc.login() obmc.set_apis_values(key, value) except (SelfServerException, SelfClientException) as e: - self.callback.error(e.message, node) + return self.callback.error(e.message, node) self.callback.info("%s: BMC Setting %s..." % (node, openbmc.RSPCONFIG_APIS[key]['display_name'])) @@ -392,9 +393,12 @@ rmdir \"/tmp/$userid\" \n") value = obmc.get_apis_values(key) except (SelfServerException, SelfClientException) as e: - self.callback.error(e.message, node) + return self.callback.error(e.message, node) - str_value = '0.'+str(value) + if isinstance(value, dict): + str_value = value.values()[0] + else: + str_value = value result = '%s: %s: %s' % (node, openbmc.RSPCONFIG_APIS[key]['display_name'], str_value.split('.')[-1]) self.callback.info(result) diff --git a/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_power.py b/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_power.py index ae3d8fd8c..ecdf683b5 100644 --- a/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_power.py +++ b/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_power.py @@ -56,6 +56,9 @@ class OpenBMCPowerTask(ParallelNodesCommand): login_message = "Login to BMC failed: Can't connect to {0} {1}.".format(e.host_and_port, e.detail_msg) self.callback.error(login_message, node) return bmc_state + except SelfClientException as e: + self.callback.error(e.message, node) + return bmc_state try: state = obmc.get_bmc_state() @@ -66,9 +69,10 @@ class OpenBMCPowerTask(ParallelNodesCommand): self.callback.info('%s: %s' % (node, openbmc.RPOWER_STATES.get(bmc_state, bmc_state))) - except SelfServerException, SelfClientException: - # There is no response when BMC is not ready + except SelfServerException as e: self.callback.error(openbmc.RPOWER_STATES[bmc_not_ready], node) + except SelfClientException as e: + self.callback.error("%s (%s)" % (openbmc.RPOWER_STATES[bmc_not_ready], e.message), node) return bmc_state @@ -140,13 +144,32 @@ class OpenBMCPowerTask(ParallelNodesCommand): new_status = '' try: obmc.login() + except (SelfServerException, SelfClientException) as e: + return self.callback.error(e.message, node) + + firm_obj_dict = {} + try: + has_functional, firm_obj_dict = obmc.list_firmware() + except (SelfServerException, SelfClientException) as e: + self.callback.syslog('%s: %s' % (node, e.message)) + + clear_flag = False + for key, value in firm_obj_dict.items(): + if not value.functional and value.priority == 0: + clear_flag = True + break + + if clear_flag: + self.callback.info('%s: Firmware will be flashed on reboot, deleting all BMC diagnostics...' % node) + try: + obmc.clear_dump('all') + except (SelfServerException, SelfClientException) as e: + self.callback.warn('%s: Could not clear BMC diagnostics successfully %s' % (node, e.message)) + + try: + obmc.reboot_bmc(optype) except (SelfServerException, SelfClientException) as e: self.callback.error(e.message, node) else: - try: - obmc.reboot_bmc(optype) - except (SelfServerException, SelfClientException) as e: - self.callback.error(e.message, node) - else: - self.callback.info('%s: %s' % (node, openbmc.RPOWER_STATES['bmcreboot'])) + self.callback.info('%s: %s' % (node, openbmc.RPOWER_STATES['bmcreboot'])) diff --git a/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_sensor.py b/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_sensor.py index 3bee6bf98..7abd4c31d 100644 --- a/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_sensor.py +++ b/xCAT-openbmc-py/lib/python/agent/hwctl/executor/openbmc_sensor.py @@ -32,9 +32,14 @@ SENSOR_POWER_UNITS = ("Amperes", "Joules", "Watts") class OpenBMCSensorTask(ParallelNodesCommand): """Executor for sensor-related actions.""" - def _get_beacon_info(self, beacon_dict): + def _get_beacon_info(self, beacon_dict, display_type='full'): info_list = [] + # display_type == 'full' for detailed output for 'rvitals leds' command + # display_type == 'compact' for compact output for 'rbeacon stat' command + if display_type == 'compact': + info_list.append('Front:%s Rear:%s' % (beacon_dict.get('front_id'), beacon_dict.get('rear_id', 'N/A'))) + return info_list info_list.append('Front . . . . . : Power:%s Fault:%s Identify:%s' % (beacon_dict.get('front_power', 'N/A'), beacon_dict.get('front_fault', 'N/A'), @@ -92,7 +97,7 @@ class OpenBMCSensorTask(ParallelNodesCommand): return sensor_info - def get_beacon_info(self, **kw): + def get_beacon_info(self, display_type, **kw): node = kw['node'] obmc = openbmc.OpenBMCRest(name=node, nodeinfo=kw['nodeinfo'], messager=self.callback, @@ -102,7 +107,7 @@ class OpenBMCSensorTask(ParallelNodesCommand): try: obmc.login() beacon_dict = obmc.get_beacon_info() - beacon_info = self._get_beacon_info(beacon_dict) + beacon_info = self._get_beacon_info(beacon_dict, display_type) if not beacon_info: beacon_info = ['No attributes returned from the BMC.'] diff --git a/xCAT-openbmc-py/lib/python/agent/hwctl/openbmc_client.py b/xCAT-openbmc-py/lib/python/agent/hwctl/openbmc_client.py index da347fa82..635f37deb 100644 --- a/xCAT-openbmc-py/lib/python/agent/hwctl/openbmc_client.py +++ b/xCAT-openbmc-py/lib/python/agent/hwctl/openbmc_client.py @@ -185,13 +185,17 @@ RSPCONFIG_APIS = { 'set_url': "attr/AutoReboot", 'get_url': "attr/AutoReboot", 'display_name': "BMC AutoReboot", + 'attr_values': { + '0': False, + '1': True, + }, }, 'powersupplyredundancy':{ 'baseurl': "/sensors/chassis/PowerSupplyRedundancy/", - 'set_url': "/action/setValue", - 'get_url': "/action/getValue", + 'set_url': "action/setValue", + 'get_url': "action/getValue", 'get_method': 'POST', - 'get_data': '[]', + 'get_data': [], 'display_name': "BMC PowerSupplyRedundancy", 'attr_values': { 'disabled': "Disables", @@ -220,6 +224,16 @@ RSPCONFIG_APIS = { 'setup': "xyz.openbmc_project.Control.Boot.Mode.Modes.Setup", }, }, + 'timesyncmethod': { + 'baseurl': '/time/sync_method', + 'get_url': '', + 'set_url': '/attr/TimeSyncMethod', + 'display_name': 'BMC TimeSyncMethod', + 'attr_values': { + 'ntp': 'xyz.openbmc_project.Time.Synchronization.Method.NTP', + 'manual': 'xyz.openbmc_project.Time.Synchronization.Method.Manual', + }, + }, } EVENTLOG_URL = "/logging/enumerate" @@ -410,8 +424,8 @@ class OpenBMCRest(object): def get_bmc_state(self): - state = self.request('GET', BMC_URLS['state']['path'], cmd='get_bmc_state') try: + state = self.request('GET', BMC_URLS['state']['path'], cmd='get_bmc_state') return {'bmc': state.split('.')[-1]} except KeyError: error = 'Received wrong format response: %s' % state diff --git a/xCAT-openbmc-py/lib/python/agent/hwctl/sensor.py b/xCAT-openbmc-py/lib/python/agent/hwctl/sensor.py index ad8727311..510b2c920 100644 --- a/xCAT-openbmc-py/lib/python/agent/hwctl/sensor.py +++ b/xCAT-openbmc-py/lib/python/agent/hwctl/sensor.py @@ -19,13 +19,14 @@ class SensorInterface(object): """ return task.run('get_sensor_info', sensor_type) - def get_beacon_info(self, task): + def get_beacon_info(self, task, display_type='full'): """Return the beacon info of the task's nodes. + :param task: type of display to produce - full (rvitals leds) or compact (rbeacon stat) :param task: a Task instance containing the nodes to act on. :return: beacon info list """ - return task.run('get_beacon_info') + return task.run('get_beacon_info', display_type) class DefaultSensorManager(SensorInterface): """Interface for sensor-related actions.""" diff --git a/xCAT-openbmc-py/lib/python/agent/xcatagent/openbmc.py b/xCAT-openbmc-py/lib/python/agent/xcatagent/openbmc.py index 6dff2526f..c98a47bd0 100644 --- a/xCAT-openbmc-py/lib/python/agent/xcatagent/openbmc.py +++ b/xCAT-openbmc-py/lib/python/agent/xcatagent/openbmc.py @@ -49,9 +49,10 @@ VERBOSE = False all_nodes_result = {} # global variables of rbeacon -BEACON_SET_OPTIONS = ('on', 'off') +BEACON_OPTIONS = ('on', 'off', 'stat') + +RSPCONFIG_GET_OPTIONS = ['ip','ipsrc','netmask','gateway','vlan','ntpservers','hostname','bootmode','autoreboot','powersupplyredundancy','powerrestorepolicy', 'timesyncmethod'] -RSPCONFIG_GET_OPTIONS = ['ip','ipsrc','netmask','gateway','vlan','ntpservers','hostname','bootmode','autoreboot','powersupplyredundancy','powerrestorepolicy'] RSPCONFIG_SET_OPTIONS = { 'ip':'.*', 'netmask':'.*', @@ -64,6 +65,7 @@ RSPCONFIG_SET_OPTIONS = { 'powerrestorepolicy':"^always_on$|^always_off$|^restore$", 'bootmode':"^regular$|^safe$|^setup$", 'admin_passwd':'.*,.*', + 'timesyncmethod':'^ntp$|^manual$', } RSPCONFIG_USAGE = """ Handle rspconfig operations. @@ -93,6 +95,7 @@ The supported attributes and its values to set are: autoreboot={0|1} powersupplyredundancy={enabled|disabled} powerrestorepolicy={always_on|always_off|restore} + timesyncmethod={ntp|manual} """ % RSPCONFIG_GET_OPTIONS #global variables of rinv @@ -131,7 +134,7 @@ class OpenBMCManager(base.BaseManager): # 1, parse args rbeacon_usage = """ Usage: - rbeacon [-V|--verbose] [on|off] + rbeacon [-V|--verbose] [on|off|stat] Options: -V --verbose rbeacon verbose mode. @@ -148,16 +151,21 @@ class OpenBMCManager(base.BaseManager): # 2, validate the args if action is None: - self.messager.error("Not specify the subcommand for rbeacon") + self.messager.error("Subcommand for rbeacon was not specified") return - if action not in BEACON_SET_OPTIONS: + if action not in BEACON_OPTIONS: self.messager.error("Not supported subcommand for rbeacon: %s" % action) return # 3, run the subcommands - runner = OpenBMCBeaconTask(nodesinfo, callback=self.messager, debugmode=self.debugmode, verbose=self.verbose) - DefaultBeaconManager().set_beacon_state(runner, beacon_state=action) + if action == 'stat': + runner = OpenBMCSensorTask(nodesinfo, callback=self.messager, debugmode=self.debugmode, verbose=self.verbose) + + DefaultSensorManager().get_beacon_info(runner, display_type='compact') + else: + runner = OpenBMCBeaconTask(nodesinfo, callback=self.messager, debugmode=self.debugmode, verbose=self.verbose) + DefaultBeaconManager().set_beacon_state(runner, beacon_state=action) def rflash(self, nodesinfo, args): diff --git a/xCAT-server/lib/perl/xCAT/Goconserver.pm b/xCAT-server/lib/perl/xCAT/Goconserver.pm index 172e1010e..255137cb4 100644 --- a/xCAT-server/lib/perl/xCAT/Goconserver.pm +++ b/xCAT-server/lib/perl/xCAT/Goconserver.pm @@ -60,7 +60,7 @@ sub http_request { sub gen_request_data { my ($cons_map, $siteondemand, $callback) = @_; - my (@openbmc_nodes, $data); + my (@openbmc_nodes, $data, $rsp); while (my ($k, $v) = each %{$cons_map}) { my $ondemand; if ($siteondemand) { @@ -73,17 +73,14 @@ sub gen_request_data { if ($cmeth eq "openbmc") { push @openbmc_nodes, $k; } else { - $cmd = $::XCATROOT . "/share/xcat/cons/$cmeth"." ".$k; - if (!(!$isSN && $v->{conserver} && xCAT::NetworkUtils->thishostisnot($v->{conserver}))) { - my $env; - my $locerror = $isSN ? "PERL_BADLANG=0 " : ''; - if (defined($ENV{'XCATSSLVER'})) { - $env = "XCATSSLVER=$ENV{'XCATSSLVER'} "; - } - $cmd = $locerror.$env.$cmd; + my $env = ""; + my $locerror = $isSN ? "PERL_BADLANG=0 " : ''; + if (defined($ENV{'XCATSSLVER'})) { + $env = "XCATSSLVER=$ENV{'XCATSSLVER'} "; } + $data->{$k}->{params}->{env} = $locerror.$env; $data->{$k}->{driver} = "cmd"; - $data->{$k}->{params}->{cmd} = $cmd; + $data->{$k}->{params}->{cmd} = $::XCATROOT . "/share/xcat/cons/$cmeth"." ".$k; $data->{$k}->{name} = $k; } if (defined($v->{consoleondemand})) { @@ -107,11 +104,8 @@ sub gen_request_data { foreach my $node (@openbmc_nodes) { if (defined($openbmc_hash->{$node}->[0])) { if (!$openbmc_hash->{$node}->[0]->{'bmc'}) { - if($callback) { - xCAT::SvrUtils::sendmsg("Error: Unable to get attribute bmc", $callback, $node); - } else { - xCAT::MsgUtils->message("S", "$node: Error: Unable to get attribute bmc"); - } + $rsp->{data}->[0] = "$node: Failed to send delete request."; + xCAT::MsgUtils->error_message($rsp, $callback); delete $data->{$node}; next; } @@ -121,11 +115,8 @@ sub gen_request_data { } elsif ($passwd_hash and $passwd_hash->{username}) { $data->{$node}->{params}->{user} = $passwd_hash->{username}; } else { - if ($callback) { - xCAT::SvrUtils::sendmsg("Error: Unable to get attribute username", $callback, $node) - } else { - xCAT::MsgUtils->message("S", "$node: Error: Unable to get attribute username"); - } + $rsp->{data}->[0] = "$node: Unable to get attribute username."; + xCAT::MsgUtils->error_message($rsp, $callback); delete $data->{$node}; next; } @@ -134,11 +125,8 @@ sub gen_request_data { } elsif ($passwd_hash and $passwd_hash->{password}) { $data->{$node}->{params}->{password} = $passwd_hash->{password}; } else { - if ($callback) { - xCAT::SvrUtils::sendmsg("Error: Unable to get attribute password", $callback, $node) - } else { - xCAT::MsgUtils->message("S", "$node: Error: Unable to get attribute password"); - } + $rsp->{data}->[0] = "$node: Unable to get attribute password."; + xCAT::MsgUtils->error_message($rsp, $callback); delete $data->{$node}; next; } @@ -271,22 +259,14 @@ sub delete_nodes { $ret = 0; my $response = http_request("DELETE", $url, $data); if (!defined($response)) { - if ($callback) { - $rsp->{data}->[0] = "Failed to send delete request."; - xCAT::MsgUtils->message("E", $rsp, $callback) - } else { - xCAT::MsgUtils->message("S", "Failed to send delete request."); - } + $rsp->{data}->[0] = "Failed to send delete request."; + xCAT::MsgUtils->error_message($rsp, $callback); return 1; } elsif ($delmode) { while (my ($k, $v) = each %{$response}) { if ($v ne "Deleted") { - if ($callback) { - $rsp->{data}->[0] = "$k: Failed to delete entry in goconserver: $v"; - xCAT::MsgUtils->message("E", $rsp, $callback) - } else { - xCAT::MsgUtils->message("S", "$k: Failed to delete entry in goconserver: $v"); - } + $rsp->{data}->[0] = "$k: Failed to delete entry in goconserver: $v"; + xCAT::MsgUtils->error_message($rsp, $callback); $ret = 1; } else { if ($callback) { @@ -299,12 +279,8 @@ sub delete_nodes { } if (@update_nodes) { if (disable_nodes_in_db(\@update_nodes)) { - if ($callback) { - $rsp->{data}->[0] = "Failed to update consoleenabled status in db."; - xCAT::MsgUtils->message("E", $rsp, $callback); - } else { - xCAT::MsgUtils->message("S", "Failed to update consoleenabled status in db."); - } + $rsp->{data}->[0] = "Failed to update consoleenabled status in db."; + xCAT::MsgUtils->error_message($rsp, $callback); } } return $ret; @@ -321,22 +297,14 @@ sub create_nodes { $ret = 0; my $response = http_request("POST", $url, $data); if (!defined($response)) { - if ($callback) { - $rsp->{data}->[0] = "Failed to send create request."; - xCAT::MsgUtils->message("E", $rsp, $callback) - } else { - xCAT::MsgUtils->message("S", "Failed to send create request."); - } + $rsp->{data}->[0] = "Failed to send create request."; + xCAT::MsgUtils->error_message($rsp, $callback); return 1; } elsif ($response) { while (my ($k, $v) = each %{$response}) { if ($v ne "Created") { - if ($callback) { - $rsp->{data}->[0] = "$k: Failed to create console entry in goconserver: $v"; - xCAT::MsgUtils->message("E", $rsp, $callback); - } else { - xCAT::MsgUtils->message("S", "$k: Failed to create console entry in goconserver: $v"); - } + $rsp->{data}->[0] = "$k: Failed to create console entry in goconserver: $v"; + xCAT::MsgUtils->error_message($rsp, $callback); $ret = 1; } else { $rsp->{data}->[0] = "$k: $v"; @@ -347,12 +315,8 @@ sub create_nodes { } if (@update_nodes) { if (enable_nodes_in_db(\@update_nodes)) { - if ($callback) { - $rsp->{data}->[0] = "Failed to update consoleenabled status in db."; - xCAT::MsgUtils->message("E", $rsp, $callback); - } else { - CAT::MsgUtils->message("S", "Failed to update consoleenabled status in db."); - } + $rsp->{data}->[0] = "Failed to update consoleenabled status in db."; + xCAT::MsgUtils->error_message($rsp, $callback); } } return $ret; @@ -364,13 +328,13 @@ sub list_nodes { my $rsp; my $response = http_request("GET", $url); if (!defined($response)) { - $rsp->{data}->[0] = "Failed to send list request."; - xCAT::MsgUtils->message("E", $rsp, $callback); + $rsp->{data}->[0] = "Failed to send list request. Is goconserver service started?"; + xCAT::MsgUtils->error_message($rsp, $callback); return 1; } if (!$response->{nodes}) { $rsp->{data}->[0] = "Could not find any node."; - xCAT::MsgUtils->message("I", $rsp, $callback); + xCAT::MsgUtils->info_message($rsp, $callback); return 0; } $rsp->{data}->[0] = sprintf("\n".PRINT_FORMAT, "NODE", "SERVER", "STATE"); @@ -382,7 +346,7 @@ sub list_nodes { $node_map->{$node->{name}}->{vis} = 1; if (!$node->{host} || !$node->{state}) { $rsp->{data}->[0] = sprintf(PRINT_FORMAT, $node->{name}, "", "Unable to parse the response message"); - xCAT::MsgUtils->message("E", $rsp, $callback); + xCAT::MsgUtils->error_message("E", $rsp, $callback); next; } $rsp->{data}->[0] = sprintf(PRINT_FORMAT, $node->{name}, $node->{host}, substr($node->{state}, 0, 16)); @@ -406,12 +370,8 @@ sub cleanup_nodes { my $rsp; my $response = http_request("GET", "$api_url/nodes"); if (!defined($response)) { - if ($callback) { - $rsp->{data}->[0] = "Failed to send list request."; - xCAT::MsgUtils->message("E", $rsp, $callback); - } else { - xCAT::MsgUtils->message("S", "Failed to send list request."); - } + $rsp->{data}->[0] = "Failed to send list request. Is goconserver service started?"; + xCAT::MsgUtils->error_message("E", $rsp, $callback); return 1; } if (!$response->{nodes}) { diff --git a/xCAT-server/lib/perl/xCAT/OPENBMC.pm b/xCAT-server/lib/perl/xCAT/OPENBMC.pm index bc583ee87..a3c1a78be 100644 --- a/xCAT-server/lib/perl/xCAT/OPENBMC.pm +++ b/xCAT-server/lib/perl/xCAT/OPENBMC.pm @@ -255,7 +255,7 @@ sub run_cmd_in_perl { } # List of commands currently not supported in Python - my @unsupported_in_python_commands = ('rflash', 'rspconfig', 'reventlog'); + my @unsupported_in_python_commands = ('rflash', 'rspconfig', 'reventlog', 'getopenbmccons'); if ($command ~~ @unsupported_in_python_commands) { # Command currently not supported in Python diff --git a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm index 4674205df..7461133c0 100644 --- a/xCAT-server/lib/xcat/plugins/bmcdiscover.pm +++ b/xCAT-server/lib/xcat/plugins/bmcdiscover.pm @@ -1053,7 +1053,7 @@ sub bmcdiscovery_ipmi { if ($output =~ $bmcstr) { store_fd({data=>1}, $fd); - if ($output =~ /RAKP 2 message indicates an error : (.+)\nError: (.+)/) { + if ($output =~ /RAKP \d+ message indicates an error : (.+)\nError: (.+)/) { xCAT::MsgUtils->message("W", { data => ["$2: $1 for $ip"] }, $::CALLBACK); return; } @@ -1127,6 +1127,9 @@ sub bmcdiscovery_ipmi { } elsif ($output =~ /RAKP \S* \S* is invalid/) { xCAT::MsgUtils->message("W", { data => ["BMC password is incorrect for $ip"] }, $::CALLBACK); return; + } else { + xCAT::MsgUtils->message("W", { data => ["Unknown error get from $ip"] }, $::CALLBACK); + return; } display_output($opz,$opw,$mtms_node,$mac_node,$node_data,"ipmi",$request_command); diff --git a/xCAT-server/lib/xcat/plugins/conserver.pm b/xCAT-server/lib/xcat/plugins/conserver.pm index db0473f76..357f774ae 100644 --- a/xCAT-server/lib/xcat/plugins/conserver.pm +++ b/xCAT-server/lib/xcat/plugins/conserver.pm @@ -205,7 +205,7 @@ sub process_request { if (-x "/usr/bin/goconserver") { require xCAT::Goconserver; if (xCAT::Goconserver::is_goconserver_running()) { - my $rsp->{data}->[0] = "goconserver is started, please stop it at first."; + my $rsp->{data}->[0] = "goconserver is being used as the console service, did you mean: makegocons ? If not, stop goconserver and retry."; xCAT::MsgUtils->message("E", $rsp, $cb); return; } diff --git a/xCAT-server/lib/xcat/plugins/goconserver.pm b/xCAT-server/lib/xcat/plugins/goconserver.pm index a4c1e8ea2..1b397df6c 100644 --- a/xCAT-server/lib/xcat/plugins/goconserver.pm +++ b/xCAT-server/lib/xcat/plugins/goconserver.pm @@ -143,13 +143,13 @@ sub start_goconserver { my ($rsp, $running, $ready, $ret); unless (-x "/usr/bin/goconserver") { $rsp->{data}->[0] = "goconserver is not installed."; - xCAT::MsgUtils->message("E", $rsp, $::callback); + xCAT::MsgUtils->error_message($rsp, $::callback); return 1; } # if goconserver is installed, check the status of conserver service. if (xCAT::Goconserver::is_conserver_running()) { $rsp->{data}->[0] = "conserver is started, please stop it at first."; - xCAT::MsgUtils->message("E", $rsp, $::callback); + xCAT::MsgUtils->error_message($rsp, $::callback); return 1; } $running = xCAT::Goconserver::is_goconserver_running(); @@ -164,18 +164,18 @@ sub start_goconserver { $ret = xCAT::Goconserver::build_conf(); if ($ret) { $rsp->{data}->[0] = "Failed to create configuration file for goconserver."; - xCAT::MsgUtils->message("E", $rsp, $::callback); + xCAT::MsgUtils->error_message($rsp, $::callback); return 1; } } $ret = xCAT::Goconserver::restart_service(); if ($ret) { $rsp->{data}->[0] = "Failed to start goconserver service."; - xCAT::MsgUtils->message("E", $rsp, $::callback); + xCAT::MsgUtils->error_message($rsp, $::callback); return 1; } $rsp->{data}->[0] = "Starting goconserver service ..."; - xCAT::MsgUtils->message("I", $rsp, $::callback); + xCAT::MsgUtils->info_message($rsp, $::callback); sleep(3); return 0; } @@ -197,19 +197,22 @@ sub makegocons { ); my $svboot = 0; + my $rsp; if (exists($req->{svboot})) { $svboot = 1; } if ($cleanupmode) { if (exists($req->{_allnodes}) && $req->{_allnodes}->[0] != 1) { - xCAT::SvrUtils::sendmsg([ 1, "Can not specify noderange together with -C|--cleanup." ], $::callback); + $rsp->{data}->[0] = "Failed to start goconserver service."; + xCAT::MsgUtils->error_message($rsp, $::callback); return 1; } return xCAT::Goconserver::cleanup_nodes($::callback); } my %cons_map = xCAT::Goconserver::get_cons_map($req); if (! %cons_map) { - xCAT::SvrUtils::sendmsg([ 1, "Could not get any console request entry" ], $::callback); + $rsp->{data}->[0] = "Could not get any console request entry."; + xCAT::MsgUtils->error_message($rsp, $::callback); return 1; } my $api_url = "https://$host:". xCAT::Goconserver::get_api_port(); @@ -230,13 +233,15 @@ sub makegocons { } elsif (lc($site_entry) ne "no") { # consoleondemand attribute is set, but it is not "yes" or "no" - xCAT::SvrUtils::sendmsg([ 1, "Unexpected value $site_entry for consoleondemand attribute in site table" ], $::callback); + $rsp->{data}->[0] = "Unexpected value $site_entry for consoleondemand attribute in site table."; + xCAT::MsgUtils->error_message($rsp, $::callback); } } my (@nodes); my $data = xCAT::Goconserver::gen_request_data(\%cons_map, $siteondemand, $::callback); if (! $data) { - xCAT::SvrUtils::sendmsg([ 1, "Could not generate the request data" ], $::callback); + $rsp->{data}->[0] = "Could not generate the request data."; + xCAT::MsgUtils->error_message($rsp, $::callback); return 1; } $ret = xCAT::Goconserver::delete_nodes($api_url, $data, $delmode, $::callback); @@ -245,7 +250,8 @@ sub makegocons { } $ret = xCAT::Goconserver::create_nodes($api_url, $data, $::callback); if ($ret != 0) { - xCAT::SvrUtils::sendmsg([ 1, "Failed to create console entry in goconserver. "], $::callback); + $rsp->{data}->[0] = "Failed to create console entry in goconserver."; + xCAT::MsgUtils->error_message($rsp, $::callback); return $ret; } return 0; diff --git a/xCAT-server/lib/xcat/plugins/openbmc.pm b/xCAT-server/lib/xcat/plugins/openbmc.pm index 5bbc34877..b53766479 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc.pm @@ -60,7 +60,6 @@ $::RSETBOOT_URL_PATH = "boot"; $::UPLOAD_AND_ACTIVATE = 0; $::UPLOAD_ACTIVATE_STREAM = 0; $::RFLASH_STREAM_NO_HOST_REBOOT = 0; -$::TAR_FILE_PATH = ""; $::NO_ATTRIBUTES_RETURNED = "No attributes returned from the BMC."; $::UPLOAD_WAIT_ATTEMPT = 6; @@ -276,6 +275,10 @@ my %status_info = ( process => \&rflash_response, }, + RFLASH_DELETE_CHECK_STATE_RESPONSE => { + process => \&rflash_response, + }, + RINV_REQUEST => { method => "GET", init_url => "$openbmc_project_url/inventory/enumerate", @@ -789,11 +792,11 @@ sub preprocess_request { # Could not find usage for openbmc section, try getting usage for all sections $usage_string = xCAT::Usage->parseCommand($command, @exargs); } - else { + #else { # Usage for openbmc section was extracted, append autogenerated usage for # configured commands - $usage_string .= &build_config_api_usage($callback, $command); - } + # $usage_string .= &build_config_api_usage($callback, $command); + #} $callback->({ data => [$usage_string] }); $request = {}; @@ -1157,8 +1160,8 @@ sub parse_args { } if ($command eq "rbeacon") { - unless ($subcommand =~ /^on$|^off$/) { - return ([ 1, "Only 'on' or 'off' is supported for OpenBMC managed nodes."]); + unless ($subcommand =~ /^on$|^off$|^stat$/) { + return ([ 1, "Only 'on', 'off' or 'stat' are supported for OpenBMC managed nodes."]); } } elsif ($command eq "rpower") { unless ($subcommand =~ /^on$|^off$|^softoff$|^reset$|^boot$|^bmcreboot$|^bmcstate$|^status$|^stat$|^state$/) { @@ -1388,12 +1391,6 @@ sub parse_args { if ($invalid_options) { return ([ 1, "Invalid option specified $invalid_options"]); } - if (!opendir(DIR, $tarball_path[0])) { - return ([1, "Can't open directory : $tarball_path[0]"]); - } else { - $::TAR_FILE_PATH = $tarball_path[0]; - closedir(DIR); - } } elsif ($option_flag =~ /^-c$|^--check$|^-u$|^--upload$|^-a$|^--activate$/) { return ([ 1, "Invalid firmware specified with $option_flag" ]); } else { @@ -1445,6 +1442,10 @@ sub parse_command_status { } elsif ($subcommand eq "off") { $next_status{LOGIN_RESPONSE} = "RBEACON_OFF_REQUEST"; $next_status{RBEACON_OFF_REQUEST} = "RBEACON_OFF_RESPONSE"; + } elsif ($subcommand eq "stat") { + $next_status{LOGIN_RESPONSE} = "RVITALS_LEDS_REQUEST"; + $next_status{RVITALS_LEDS_REQUEST} = "RVITALS_LEDS_RESPONSE"; + $status_info{RVITALS_LEDS_RESPONSE}{argv} = "compact"; } } @@ -1646,7 +1647,13 @@ sub parse_command_status { # Everything else is invalid xCAT::SvrUtils::sendmsg([1, "Invalid value '$subcommand_value' for '$subcommand_key'"], $callback); my @valid_values = keys %{ $api_config_info{$::RSPCONFIG_CONFIGURED_API_KEY}{attr_value} }; - xCAT::SvrUtils::sendmsg([1, "Valid values: " . join(",", @valid_values)], $callback); + if (!@valid_values) { + if ($api_config_info{$::RSPCONFIG_CONFIGURED_API_KEY}{type} eq "boolean") { + xCAT::SvrUtils::sendmsg([1, "Valid values: 0,1"], $callback); + } + } else { + xCAT::SvrUtils::sendmsg([1, "Valid values: " . join(",", @valid_values)], $callback); + } return 1; } } @@ -1897,8 +1904,15 @@ sub parse_command_status { my $purpose_tag = '"purpose="'; my $purpose_value; my $version_value; - + my $tarfile_path; if (defined $update_file) { + if ($streamline) { + if ($update_file =~ /^\//){ + $tarfile_path = $update_file; + } else { + $tarfile_path =xCAT::Utils->full_path($update_file, $::cwd); + } + } # Filename or file id was specified if ($update_file =~ /.*\.tar$/) { # Filename ending on .tar was specified @@ -1950,13 +1964,18 @@ sub parse_command_status { # Display firmware version of the specified .tar file xCAT::SvrUtils::sendmsg("TAR $purpose_value Firmware Product Version\: $version_value", $callback); } - } elsif (opendir(DIR, $::TAR_FILE_PATH)) { + } elsif (defined $tarfile_path) { + if (!opendir(DIR, $tarfile_path)) { + xCAT::SvrUtils::sendmsg("Can't open directory : $tarfile_path", $callback); + closedir(DIR); + return 1; + } my @tar_files = readdir(DIR); foreach my $file (@tar_files) { if ($file !~ /.*\.tar$/) { next; } else { - my $full_path_file = $::TAR_FILE_PATH."/".$file; + my $full_path_file = $tarfile_path."/".$file; $full_path_file=~s/\/\//\//g; my $firmware_version_in_file = `$grep_cmd $version_tag $full_path_file`; my $purpose_version_in_file = `$grep_cmd $purpose_tag $full_path_file`; @@ -2034,9 +2053,10 @@ sub parse_command_status { $next_status{RFLASH_LIST_REQUEST} = "RFLASH_LIST_RESPONSE"; } if ($delete) { - # Delete uploaded image from BMC - $next_status{LOGIN_RESPONSE} = "RFLASH_DELETE_IMAGE_REQUEST"; - $next_status{RFLASH_DELETE_IMAGE_REQUEST} = "RFLASH_DELETE_IMAGE_RESPONSE"; + # Request to delete uploaded image from BMC or Host + # Firsh check if image is allowed to be deleted + $next_status{LOGIN_RESPONSE} = "RFLASH_LIST_REQUEST"; + $next_status{RFLASH_LIST_REQUEST} = "RFLASH_DELETE_CHECK_STATE_RESPONSE"; } if ($upload) { # Upload specified update file to BMC @@ -2632,32 +2652,42 @@ sub rpower_response { my $bmc_short_state = (split(/\./, $bmc_state))[-1]; if (defined($bmc_state) and $bmc_state !~ /State.BMC.BMCState.Ready$/) { if ($node_info{$node}{bmcstate_check_times} > 0) { - $node_info{$node}{bmcstate_check_times}--; - if ($node_info{$node}{wait_start}) { - $node_info{$node}{wait_end} = time(); + $node_info{$node}{bmcstate_check_times}--; + if ($node_info{$node}{wait_start}) { + $node_info{$node}{wait_end} = time(); + } else { + $node_info{$node}{wait_start} = time(); + } + retry_after($node, "RPOWER_BMC_STATUS_REQUEST", $::BMC_CHECK_INTERVAL); + return; } else { - $node_info{$node}{wait_start} = time(); + my $wait_time_X = $node_info{$node}{wait_end} - $node_info{$node}{wait_start}; + xCAT::SvrUtils::sendmsg([1, "Error: Sent bmcreboot but state did not change to BMC Ready after waiting $wait_time_X seconds. (State=BMC $bmc_short_state)."], $callback, $node); + $node_info{$node}{cur_status} = ""; + $wait_node_num--; + return; } - retry_after($node, "RPOWER_BMC_STATUS_REQUEST", $::BMC_CHECK_INTERVAL); - return; - } else { - my $wait_time_X = $node_info{$node}{wait_end} - $node_info{$node}{wait_start}; - xCAT::SvrUtils::sendmsg([1, "Error: Sent bmcreboot but state did not change to BMC Ready after waiting $wait_time_X seconds. (State=BMC $bmc_short_state)."], $callback, $node); - $node_info{$node}{cur_status} = ""; - $wait_node_num--; - return; - } } xCAT::SvrUtils::sendmsg("BMC $bmc_short_state", $callback, $node); - }else { + } else { if ($chassis_state =~ /Off$/) { # Chassis state is Off, but check if we can detect transition states if ((defined($::OPENBMC_PWR) and ($::OPENBMC_PWR eq "YES")) and $host_state =~ /Off$/ and $host_transition_state =~ /On$/) { xCAT::SvrUtils::sendmsg("$::POWER_STATE_POWERING_ON", $callback, $node); } else { - xCAT::SvrUtils::sendmsg("$::POWER_STATE_OFF", $callback, $node) if (!$next_status{ $node_info{$node}{cur_status} }); + if (defined $status_info{RPOWER_STATUS_RESPONSE}{argv} and $status_info{RPOWER_STATUS_RESPONSE}{argv} =~ /fw_delete$/) { + # We are here just to check the state of the Host to determine if ok to remove active FW + # The state is Off so FW can be removed + $next_status{"RPOWER_STATUS_RESPONSE"} = "RFLASH_DELETE_IMAGE_REQUEST"; + $next_status{"RFLASH_DELETE_IMAGE_REQUEST"} = "RFLASH_DELETE_IMAGE_RESPONSE"; + $node_info{$node}{cur_status} = $next_status{ $node_info{$node}{cur_status} }; + gen_send_request($node); + return; + } else { + xCAT::SvrUtils::sendmsg("$::POWER_STATE_OFF", $callback, $node) if (!$next_status{ $node_info{$node}{cur_status} }); + } } $all_status = $::POWER_STATE_OFF; } elsif ($chassis_state =~ /On$/) { @@ -2673,6 +2703,11 @@ sub rpower_response { $host_transition_state =~ /Off$/ and $chassis_state =~ /On$/) { xCAT::SvrUtils::sendmsg("$::POWER_STATE_POWERING_OFF", $callback, $node); } else { + if (defined $status_info{RPOWER_STATUS_RESPONSE}{argv} and $status_info{RPOWER_STATUS_RESPONSE}{argv} =~ /fw_delete$/) { + xCAT::SvrUtils::sendmsg([1, "Deleting currently active firmware on powered on host is not supported"], $callback, $node); + $wait_node_num--; + return; + } xCAT::SvrUtils::sendmsg("$::POWER_STATE_ON", $callback, $node) if (!$next_status{ $node_info{$node}{cur_status} }); } $all_status = $::POWER_STATE_ON; @@ -3879,7 +3914,7 @@ sub rspconfig_dump_response { my $dump_id = $status_info{RSPCONFIG_DUMP_CLEAR_RESPONSE}{argv}; xCAT::MsgUtils->message("I", { data => ["[$dump_id] clear"] }, $callback) unless ($next_status{ $node_info{$node}{cur_status} }); } else { - my $error_msg = "Could not clear BMC diagnostics successfully (". $response_info->{'message'} . "), ignoring..."; + my $error_msg = "Could not clear BMC diagnostics successfully (". $response_info->{'message'} . ")"; xCAT::MsgUtils->message("W", { data => ["$node: $error_msg"] }, $callback) if ($next_status{ $node_info{$node}{cur_status} }); } } @@ -4102,17 +4137,24 @@ sub rvitals_response { } if ($node_info{$node}{cur_status} =~ "RVITALS_LEDS_RESPONSE") { - $content_info = "Front . . . . . : Power:$leds{front_power} Fault:$leds{front_fault} Identify:$leds{front_id}"; - push (@sorted_output, $content_info); - $content_info = "Rear . . . . . : Power:$leds{rear_power} Fault:$leds{rear_fault} Identify:$leds{rear_id}"; - push (@sorted_output, $content_info); - # Fans - if ($leds{fan0} =~ "Off" and $leds{fan1} =~ "Off" and $leds{fan2} eq "Off" and $leds{fan3} eq "Off") { - $content_info = "Front Fans . . : No LEDs On"; - } else { - $content_info = "Front Fans . . : fan0:$leds{fan0} fan1:$leds{fan1} fan2:$leds{fan2} fan3:$leds{fan3}"; - } - push (@sorted_output, $content_info); + if ($grep_string =~ "compact") { + # Compact output for "rbeacon stat" command + $content_info = "Front:$leds{front_id} Rear:$leds{rear_id}"; + push (@sorted_output, $content_info); + } else { + # Full output for "rvitals leds" command + $content_info = "Front . . . . . : Power:$leds{front_power} Fault:$leds{front_fault} Identify:$leds{front_id}"; + push (@sorted_output, $content_info); + $content_info = "Rear . . . . . : Power:$leds{rear_power} Fault:$leds{rear_fault} Identify:$leds{rear_id}"; + push (@sorted_output, $content_info); + # Fans + if ($leds{fan0} =~ "Off" and $leds{fan1} =~ "Off" and $leds{fan2} eq "Off" and $leds{fan3} eq "Off") { + $content_info = "Front Fans . . : No LEDs On"; + } else { + $content_info = "Front Fans . . : fan0:$leds{fan0} fan1:$leds{fan1} fan2:$leds{fan2} fan3:$leds{fan3}"; + } + push (@sorted_output, $content_info); + } } # If sorted array has any contents, sort it and print it @@ -4227,6 +4269,75 @@ sub rflash_response { } xCAT::SvrUtils::sendmsg("", $callback, $node); #Separate output in case more than 1 endpoint } + if ($node_info{$node}{cur_status} eq "RFLASH_DELETE_CHECK_STATE_RESPONSE") { + # Verify selected FW ID is not active. If active, display error message, + # If not active, proceed to delete + my $to_delete_id = (split ('/', $status_info{RFLASH_DELETE_IMAGE_REQUEST}{init_url}))[4]; + # Get the functional IDs to determint if active running FW can be deleted + my $functional = get_functional_software_ids($response_info); + if ((!%{$functional}) || + (!exists($functional->{$to_delete_id}))) { + # Can not figure out if FW functional, attempt to delete anyway. + # Worst case, BMC will not allow FW deletion if we are wrong + # OR + # FW is not active, it can be deleted. Send the request to do the deletion + $next_status{"RFLASH_DELETE_CHECK_STATE_RESPONSE"} = "RFLASH_DELETE_IMAGE_REQUEST"; + $next_status{"RFLASH_DELETE_IMAGE_REQUEST"} = "RFLASH_DELETE_IMAGE_RESPONSE"; + } else { + foreach my $key_url (keys %{$response_info->{data}}) { + $update_id = (split(/\//, $key_url))[ -1 ]; + if ($update_id ne $to_delete_id) { + # Not a match on the id, try next one + next; + } + # Initialize values to Unknown for each loop, incase they are not defined in the BMC + $update_activation = "Unknown"; + $update_purpose = "Unknown"; + $update_version = "Unknown"; + + my %content = %{ ${ $response_info->{data} }{$key_url} }; + + if (defined($content{Version}) and $content{Version}) { + $update_version = $content{Version}; + } else { + # Entry has no Version attribute, skip listing it + next; + } + if (defined($content{Purpose}) and $content{Purpose}) { + $update_purpose = (split(/\./, $content{Purpose}))[ -1 ]; + } + my $update_priority = -1; + # Just check defined, because priority=0 is a valid value + if (defined($content{Priority})) { + $update_priority = (split(/\./, $content{Priority}))[ -1 ]; + } + + if ($update_purpose eq "BMC") { + # Active BMC firmware can not be deleted + xCAT::SvrUtils::sendmsg([1, "Deleting currently active BMC firmware is not supported"], $callback, $node); + $wait_node_num--; + return; + } elsif ($update_purpose eq "Host") { + # Active Host firmware can NOT be deleted if host is ON + # Active Host firmware can be deleted if host is OFF + + # Send the request to check Host state + $next_status{"RFLASH_DELETE_CHECK_STATE_RESPONSE"} = "RPOWER_STATUS_REQUEST"; + $next_status{"RPOWER_STATUS_REQUEST"} = "RPOWER_STATUS_RESPONSE"; + # Set special argv to fw_delete if Host is off + $status_info{RPOWER_STATUS_RESPONSE}{argv} = "fw_delete"; + last; + } else { + xCAT::SvrUtils::sendmsg([1, "Unable to determine the purpose of the firmware to delete"], $callback, $node); + # Can not figure out if Host or BMC, attempt to delete anyway. + # Worst case, BMC will not allow FW deletion if we are wrong + $next_status{"RFLASH_DELETE_CHECK_STATE_RESPONSE"} = "RFLASH_DELETE_IMAGE_REQUEST"; + $next_status{"RFLASH_DELETE_IMAGE_REQUEST"} = "RFLASH_DELETE_IMAGE_RESPONSE"; + last; + } + } + } + } if ($node_info{$node}{cur_status} eq "RFLASH_FILE_UPLOAD_REQUEST") { # # Special processing for file upload diff --git a/xCAT-server/lib/xcat/plugins/openbmc2.pm b/xCAT-server/lib/xcat/plugins/openbmc2.pm index 50cd4d039..3fccbcf26 100644 --- a/xCAT-server/lib/xcat/plugins/openbmc2.pm +++ b/xCAT-server/lib/xcat/plugins/openbmc2.pm @@ -186,8 +186,8 @@ sub parse_args { } if ($command eq "rbeacon") { - unless ($subcommand =~ /^on$|^off$/) { - return ([ 1, "Only 'on' or 'off' is supported for OpenBMC managed nodes."]); + unless ($subcommand =~ /^on$|^off$|^stat$/) { + return ([ 1, "Only 'on', 'off' or 'stat' is supported for OpenBMC managed nodes."]); } } elsif ($command eq "rflash") { my ($activate, $check, $delete, $directory, $list, $upload) = (0) x 6; diff --git a/xCAT-server/lib/xcat/plugins/updatenode.pm b/xCAT-server/lib/xcat/plugins/updatenode.pm index 899dd34f4..c0dfb4081 100644 --- a/xCAT-server/lib/xcat/plugins/updatenode.pm +++ b/xCAT-server/lib/xcat/plugins/updatenode.pm @@ -309,7 +309,7 @@ sub preprocess_updatenode # get server names as known by the nodes my %servernodes = - %{ xCAT::InstUtils->get_server_nodes($callback, $request->{node}) }; + %{ xCAT::InstUtils->get_server_nodes($callback, $request->{node},1) }; # it's possible that the nodes could have diff server names # do all the nodes for a particular server at once @@ -1555,7 +1555,7 @@ sub updatenoderunps # get server names as known by the nodes my %servernodes = - %{ xCAT::InstUtils->get_server_nodes($callback, \@$nodes,1) }; + %{ xCAT::InstUtils->get_server_nodes($callback, \@$nodes) }; # it's possible that the nodes could have diff server names # do all the nodes for a particular server at once diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 2b535fea6..d78832f27 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -520,7 +520,7 @@ unless ($onlyinitrd) { # Hack uname when deal otherpkgs use_hackuname($arch, $kernelver); use_devnull(); - + use_devurandom(); foreach $pass (sort { $a <=> $b } (keys(%extra_hash))) { $yumcmd = $yumcmd_base; @@ -2355,6 +2355,18 @@ sub use_devnull { } } +#in rhels7.5, the /dev/urandom does not exist in rootimg directory +#which cause any rpm command fail with `error: Failed to initialize NSS library` +#create urandom in genimage to avoid the error +sub use_devurandom { + if (-e "$rootimg_dir/dev/urandom" and !-c "$rootimg_dir/dev/urandom") { + system("rm -f $rootimg_dir/dev/urandom"); + } + if (!-e "$rootimg_dir/dev/urandom") { + system("mknod -m444 $rootimg_dir/dev/urandom c 1 9"); + } +} + # Hack uname functions to match what's installed in the rootimg # instead of what's running on the management node. # Needed for some RPMs, especially kernel modules via DKMS. diff --git a/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 b/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 index f191d85c8..63911d67b 100644 --- a/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 +++ b/xCAT-test/autotest/testcase/UT_openbmc/rflash_cases0 @@ -77,5 +77,5 @@ os:Linux hcp:openbmc cmd: rflash $$CN -l | grep \* | grep BMC | awk '{print $2}' | xargs -i{} rflash $$CN --delete {} check:rc==1 -check:output=~$$CN: Error: Deleting currently active firmware is not supported +check:output=~$$CN: Error: Deleting currently active BMC firmware is not supported end diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.common b/xCAT-test/autotest/testcase/xcat-inventory/cases.common new file mode 100644 index 000000000..cf257d6a3 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.common @@ -0,0 +1,146 @@ +start:xcat_inventory_option_h +description:This case is used to test xcat-inventory usage information +cmd:xcat-inventory -h +check:ouptut=~usage: xcat-inventory +check:ouptut!~usage: xcat-inventory export +check:ouptut!~usage: xcat-inventory import +check:rc==0 +cmd:xcat-inventory help +check:ouptut=~usage: xcat-inventory +check:ouptut!~usage: xcat-inventory export +check:ouptut!~usage: xcat-inventory import +check:rc==0 +cmd:xcat-inventory help export +check:ouptut=~usage: xcat-inventory export +check:rc==0 +cmd:xcat-inventory help import +check:output=~usage: xcat-inventory import +check:rc==0 +cmd:xcat-inventory help help +check:output=~usage: xcat-inventory help +check:rc==0 +end + + +start:xcat_inventory_option_V +description:This case is used to test xcat-inventory option V which used to get version information +cmd:xcat-inventory -V +check:ouptut=~\d\.\d +check:rc==0 +end + +start:xcat_inventory_invalid_subcmd +description:This case is used to test xcat-inventory export subcommand to handle invalid subcommand. The vaild subcommand are export and import. +cmd:xcat-inventory aaa +check:output=~ xcat-inventory: error: argument : invalid choice: +check:output=~ usage: +check:rc!=0 +end + +start:xcat_inventory_export_option_t_invalid_type +description:This case is used to test xcat-inventory export subcommand to handle invalid type for option t +cmd:xcat-inventory export -t aaa +check:output=~Invalid object type +check:output!~Traceback (most recent call last): +check:rc!=0 +end + +start:xcat_inventory_export_option_format_invalid_type +description:This case is used to test xcat-inventory export subcommand to handle invalid type for option format +cmd:xcat-inventory export --format aaa +check:output=~Invalid exporting format: aaa +check:output!~Traceback (most recent call last): +check:rc!=0 +end + +#start:xcat_inventory_export_option_f_invalid_file +#description:This case is used to test xcat-inventory export subcommand to handle invalid file for option f +#cmd:xcat-inventory export -f aaa +#check:output=~The specified path does not exist +#check:output !~Traceback +#check:rc!=0 +#end + +start:xcat_inventory_import_option_f_invalid_file +description:This case is used to test xcat-inventory import subcommand to handle invalid file for option f +cmd:mkdir -p /tmp/xcat_inventory_import_option_f_invalid_file +check:rc==0 +#to handle a non-existed file +cmd:xcat-inventory import -f aaa +check:output=~The specified path does not exist +check:output !~Traceback +check:rc!=0 +#To handle a invalid json file +cmd:#!/usr/bin/bash +echo "{ + "node": { + "bogusnode": { + "device_type": "server", + "obj_info": { + "groups": "test" + }, + "obj_type": "node", + "role": "compute" + } + } +" > /tmp/xcat_inventory_import_option_f_invalid_file/invaild_json +check:rc==0 +cmd:cat /tmp/xcat_inventory_import_option_f_invalid_file/invaild_json +check:rc==0 +cmd:xcat-inventory import -f /tmp/xcat_inventory_import_option_f_invalid_file/invaild_json +check:output =~ Error: failed to load file +check:output !~Traceback +check:rc!=0 +#To handle a invalid yaml file +cmd:#!/usr/bin/bash +echo "node: + device_type: server + obj_info: + groups: test + obj_type: node + role: compute +" > /tmp/xcat_inventory_import_option_f_invalid_file/invaild_yaml +check:rc==0 +cmd:cat /tmp/xcat_inventory_import_option_f_invalid_file/invaild_yaml +check:rc==0 +cmd:xcat-inventory import -f /tmp/xcat_inventory_import_option_f_invalid_file/invaild_yaml +check:output =~ Error: +check:output !~Traceback +check:rc!=0 +cmd:rm -rf /tmp/xcat_inventory_import_option_f_invalid_file +check:rc==0 +end + + +start:xcat_inventory_import_option_t_invalid_type +description:This case is used to test xcat-inventory import subcommand to handle invalid type for option t +cmd:xcat-inventory import -t aaa +check:output=~Invalid object type +check:output!~Traceback (most recent call last): +check:rc!=0 +end + + +start:xcat_inventory_import_miss_option +description:This case is used to test xcat-inventory import subcommand to handle missing -t or -o option +cmd:mkdir -p /tmp/export_import_nodes_delimited_with_comma_by_json +check:rc==0 +cmd:#!/usr/bin/bash +echo "{ + "node": { + "test": { + "device_type": "server", + "obj_info": { + "groups": "testgroup" + }, + "obj_type": "node", + "role": "compute" + } + } +}" > /tmp/export_import_nodes_delimited_with_comma_by_json/aaa +cmd:xcat-inventory import -f /tmp/export_import_nodes_delimited_with_comma_by_json/aaa -o aaa +check:output=~Missing object type for object +check:rc!=0 +cmd:rm -rf /tmp/export_import_nodes_delimited_with_comma_by_json +check:rc==0 +end diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.node b/xCAT-test/autotest/testcase/xcat-inventory/cases.node new file mode 100644 index 000000000..c91b9c24d --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.node @@ -0,0 +1,2935 @@ +star:texport_import_single_ppc_by_json +description:This case is used to test xcat-inventory export and import one ppc definition by json between 2 exact same MNs. This case can cover hmc,lpar. 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. +cmd:mkdir -p /tmp/export_import_single_ppc_by_json +check:rc==0 +cmd:ssh $$DSTMN 'mkdir -p /tmp/export_import_single_ppc_by_json_$$DSTMN/' +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_import_single_ppc_by_json/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_ppc_by_json/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:ssh $$DSTMN 'lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_import_single_ppc_by_json_$$DSTMN/bogusnode.stanza ;rmdef bogusnode;fi' +check:rc==0 +cmd:ssh $$DSTMN 'lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_ppc_by_json_$$DSTMN/bogusgroup.stanza; rmdef -t group bogusgroup;fi' +check:rc==0 +cmd:mkdef -t node -o bogusnode groups=bogusgroup mgt=hmc nodetype=ppc,osi addkcmdline=addkcmdline arch=ppc64 authdomain=authdomain cfgmgr=cfgmgr cfgmgtroles=cfgmgtroles cfgserver=cfgserver chain=chain chassis=chassis cmdmapping=cmdmapping cons=cons conserver=conserver consoleondemand=consoleondemand cpucount=cpucount cputype=cputype dhcpinterfaces=dhcpinterfaces disksize=disksize domainadminpassword=domainadminpassword domainadminuser=domainadminuser domaintype=domaintype getmac=getmac hcp=HMC height=height hidden=hidden hostcluster=hostcluster hostinterface=hostinterface hostmanager=hostmanager hostnames=hostnames hosttype=hosttype hwtype=hwtype id=5 installnic=installnic interface=interface ip=10.10.10.10 iscsipassword=iscsipassword iscsiserver=iscsiserver iscsitarget=iscsitarget iscsiuserid=iscsiuserid mac=42:d6:0a:03:05:08 memory=memory migrationdest=migrationdest monserver=monserver mpa=mpa mtm=mtm nameservers=nameservers netboot=grub2 nfsdir=nfsdir nfsserver=nfsserver nimserver=nimserver node=node ondiscover=ondiscover osvolume=osvolume otherinterfaces=otherinterfaces ou=ou parent=parent password=password pdu=pdu postbootscripts=postbootscripts postscripts=postscripts power=power pprofile=pprofile prescripts-begin=prescripts-begin prescripts-end=prescripts-end primarynic=primarynic primarysn=primarysn productkey=productkey provmethod=provmethod rack=rack room=room routenames=routenames serial=serial serialflow=serialflow serialport=serialport serialspeed=serialspeed servicenode=servicenode setupconserver=0 setupdhcp=0 setupftp=setupftp setupipforward=0 setupldap=0 setupnameserver=0 setupnfs=0 setupnim=setupnim setupntp=0 setupproxydhcp=0 setuptftp=0 sfp=sfp side=side slot=slot storagcontroller=storagcontroller storagetype=storagetype supernode=supernode supportedarchs=supportedarchs supportproxydhcp=supportproxydhcp switch=switch switchinterface=switchinterface switchport=50 switchvlan=switchvlan syslog=syslog termport=termport termserver=termserver tftpdir=tftpdir tftpserver=tftpserver unit=unit usercomment=usercomment username=username vmbeacon=vmbeacon vmbootorder=vmbootorder vmcfgstore=vmcfgstore vmcluster=vmcluster vmmanager=vmmanager vmmaster=vmmaster vmnicnicmodel=vmnicnicmodel vmphyslots=vmphyslots vmstorage=vmstorage vmstoragecache=vmstoragecache vmstorageformat=vmstorageformat vmstoragemodel=vmstoragemodel vmtextconsole=vmtextconsole vmvirtflags=vmvirtflags vmvncport=vmvncport xcatmaster=xcatmaster zonename=zonename nicaliases.eth0="moe larry curly" nicaliases.eth1="tom|jerry" niccustomscripts.eth0="configeth eth0" niccustomscripts.ib0="configib ib0" nicdevices.bond0="eth0|eth2" nicdevices.br0=bond0 nicextraparams.eth0="MTU=1500" nicextraparams.ib0="MTU=65520 CONNECTED_MODE=yes" nichostnameprefixes.eth0="eth0-" nichostnameprefixes.ib0="ib-" nichostnamesuffixes.eth0="-eth0" nichostnamesuffixes.ib0="-ib0" nicips.ib0=10.10.100.9 nicips.enP48p1s0f0=129.40.234.11 nicips.ib1=10.11.100.9 nicnetworks.enP5p1s0f1.4=xcat_bmc nicnetworks.enP48p1s0f1=xcat_util nicnetworks.ib0=IB00 nicnetworks.enP48p1s0f0=pub_yellow nicnetworks.ib3=IB03 nicnetworks.ib2=IB02 nicnetworks.enP5p1s0f1=xcat_compute nicnetworks.ib1=IB01 nicnetworks.enP5p1s0f1.5=xcat_infra nicnetworks.enP5p1s0f1.6=xcat_pdu nicsadapter.enP3p3s0f1="mac=98:be:94:59:fa:cd linkstate=DOWN" nicsadapter.enP3p3s0f2="mac=98:be:94:59:fa:ce candidatename=enP3p3s0f2/enx98be9459face" nictypes.enP5p1s0f1.4=unused nictypes.enP48p1s0f1=unused nictypes.ib0=Infiniband nictypes.enP48p1s0f0=Ethernet nictypes.ib3=unused nictypes.ib2=unused nictypes.enP5p1s0f1=unused nictypes.ib1=Infiniband nictypes.enP5p1s0f1.5=unused nictypes.enP5p1s0f1.6=unused +check:rc==0 +cmd:lsdef bogusnode -z|sort -t'=' -k1 |tee /tmp/export_import_single_ppc_by_json/srcbogusnode.stanza +check:rc==0 +cmd:xcat-inventory export --format=json -t node -o bogusnode |tee /tmp/export_import_single_ppc_by_json/bogusnode_json.inv +check:rc==0 +cmd:scp /tmp/export_import_single_ppc_by_json/bogusnode_json.inv $$DSTMN:/tmp/export_import_single_ppc_by_json_$$DSTMN/ +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd: ssh $$DSTMN 'xcat-inventory import -f /tmp/export_import_single_ppc_by_json_$$DSTMN/bogusnode_json.inv -t node -o bogusnode' +check:rc==0 +cmd: ssh $$DSTMN 'lsdef bogusnode -z |sort -t'=' -k1|tee /tmp/export_import_single_ppc_by_json_$$DSTMN/dstbogusnode.stanza' +check:rc==0 +cmd: scp $$DSTMN:/tmp/export_import_single_ppc_by_json_$$DSTMN/dstbogusnode.stanza /tmp/export_import_single_ppc_by_json/dstbogusnode.stanza +check:rc==0 +cmd: cat /tmp/export_import_single_ppc_by_json/dstbogusnode.stanza +check:rc==0 +cmd:diff -y /tmp/export_import_single_ppc_by_json/srcbogusnode.stanza /tmp/export_import_single_ppc_by_json/dstbogusnode.stanza +check:rc==0 +cmd:ssh $$DSTMN 'rmdef bogusnode' +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_ppc_by_json/bogusnode.stanza ]]; then cat /tmp/export_import_single_ppc_by_json/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_ppc_by_json/bogusgroup.stanza ]]; then cat /tmp/export_import_single_ppc_by_json/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_ppc_by_json_$$DSTMN/bogusnode.stanza ]]; then cat /tmp/export_import_single_ppc_by_json_$$DSTMN/bogusnode.stanza | mkdef -z;fi' +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_ppc_by_json_$$DSTMN/bogusgroup.stanza ]]; then cat /tmp/export_import_single_ppc_by_json_$$DSTMN/bogusgroup.stanza |mkdef -z -f;fi' +check:rc==0 +cmd:ssh $$DSTMN 'rm -rf /tmp/export_import_single_ppc_by_json_$$DSTMN/' +check:rc==0 +cmd:rm -rf /tmp/export_import_single_ppc_by_json +check:rc==0 +end + + +start:export_import_single_ppc_by_yaml +description:This case is used to test xcat-inventory export and import one ppc definition by yaml between 2 exact same MNs. This case can cover hmc,lpar. 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 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. +cmd:mkdir -p /tmp/export_import_single_ppc_by_yaml +check:rc==0 +cmd:ssh $$DSTMN 'mkdir -p /tmp/export_import_single_ppc_by_yaml_$$DSTMN/' +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_import_single_ppc_by_yaml/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_ppc_by_yaml/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:ssh $$DSTMN 'lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_import_single_ppc_by_yaml_$$DSTMN/bogusnode.stanza ;rmdef bogusnode;fi' +check:rc==0 +cmd:ssh $$DSTMN 'lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_ppc_by_yaml_$$DSTMN/bogusgroup.stanza; rmdef -t group bogusgroup;fi' +check:rc==0 +cmd:mkdef -t node -o bogusnode groups=bogusgroup mgt=hmc nodetype=ppc,osi addkcmdline=addkcmdline arch=ppc64 authdomain=authdomain cfgmgr=cfgmgr cfgmgtroles=cfgmgtroles cfgserver=cfgserver chain=chain chassis=chassis cmdmapping=cmdmapping cons=cons conserver=conserver consoleondemand=consoleondemand cpucount=cpucount cputype=cputype dhcpinterfaces=dhcpinterfaces disksize=disksize domainadminpassword=domainadminpassword domainadminuser=domainadminuser domaintype=domaintype getmac=getmac hcp=HMC height=height hidden=hidden hostcluster=hostcluster hostinterface=hostinterface hostmanager=hostmanager hostnames=hostnames hosttype=hosttype hwtype=hwtype id=5 installnic=installnic interface=interface ip=10.10.10.10 iscsipassword=iscsipassword iscsiserver=iscsiserver iscsitarget=iscsitarget iscsiuserid=iscsiuserid mac=42:d6:0a:03:05:08 memory=memory migrationdest=migrationdest monserver=monserver mpa=mpa mtm=mtm nameservers=nameservers netboot=grub2 nfsdir=nfsdir nfsserver=nfsserver nimserver=nimserver node=node ondiscover=ondiscover osvolume=osvolume otherinterfaces=otherinterfaces ou=ou parent=parent password=password pdu=pdu postbootscripts=postbootscripts postscripts=postscripts power=power pprofile=pprofile prescripts-begin=prescripts-begin prescripts-end=prescripts-end primarynic=primarynic primarysn=primarysn productkey=productkey provmethod=provmethod rack=rack room=room routenames=routenames serial=serial serialflow=serialflow serialport=serialport serialspeed=serialspeed servicenode=servicenode setupconserver=0 setupdhcp=0 setupftp=setupftp setupipforward=0 setupldap=0 setupnameserver=0 setupnfs=0 setupnim=setupnim setupntp=0 setupproxydhcp=0 setuptftp=0 sfp=sfp side=side slot=slot storagcontroller=storagcontroller storagetype=storagetype supernode=supernode supportedarchs=supportedarchs supportproxydhcp=supportproxydhcp switch=switch switchinterface=switchinterface switchport=50 switchvlan=switchvlan syslog=syslog termport=termport termserver=termserver tftpdir=tftpdir tftpserver=tftpserver unit=unit usercomment=usercomment username=username vmbeacon=vmbeacon vmbootorder=vmbootorder vmcfgstore=vmcfgstore vmcluster=vmcluster vmmanager=vmmanager vmmaster=vmmaster vmnicnicmodel=vmnicnicmodel vmphyslots=vmphyslots vmstorage=vmstorage vmstoragecache=vmstoragecache vmstorageformat=vmstorageformat vmstoragemodel=vmstoragemodel vmtextconsole=vmtextconsole vmvirtflags=vmvirtflags vmvncport=vmvncport xcatmaster=xcatmaster zonename=zonename nicaliases.eth0="moe larry curly" nicaliases.eth1="tom|jerry" niccustomscripts.eth0="configeth eth0" niccustomscripts.ib0="configib ib0" nicdevices.bond0="eth0|eth2" nicdevices.br0=bond0 nicextraparams.eth0="MTU=1500" nicextraparams.ib0="MTU=65520 CONNECTED_MODE=yes" nichostnameprefixes.eth0="eth0-" nichostnameprefixes.ib0="ib-" nichostnamesuffixes.eth0="-eth0" nichostnamesuffixes.ib0="-ib0" nicips.ib0=10.10.100.9 nicips.enP48p1s0f0=129.40.234.11 nicips.ib1=10.11.100.9 nicnetworks.enP5p1s0f1.4=xcat_bmc nicnetworks.enP48p1s0f1=xcat_util nicnetworks.ib0=IB00 nicnetworks.enP48p1s0f0=pub_yellow nicnetworks.ib3=IB03 nicnetworks.ib2=IB02 nicnetworks.enP5p1s0f1=xcat_compute nicnetworks.ib1=IB01 nicnetworks.enP5p1s0f1.5=xcat_infra nicnetworks.enP5p1s0f1.6=xcat_pdu nicsadapter.enP3p3s0f1="mac=98:be:94:59:fa:cd linkstate=DOWN" nicsadapter.enP3p3s0f2="mac=98:be:94:59:fa:ce candidatename=enP3p3s0f2/enx98be9459face" nictypes.enP5p1s0f1.4=unused nictypes.enP48p1s0f1=unused nictypes.ib0=Infiniband nictypes.enP48p1s0f0=Ethernet nictypes.ib3=unused nictypes.ib2=unused nictypes.enP5p1s0f1=unused nictypes.ib1=Infiniband nictypes.enP5p1s0f1.5=unused nictypes.enP5p1s0f1.6=unused +check:rc==0 +cmd:lsdef bogusnode -z|sort -t'=' -k1 |tee /tmp/export_import_single_ppc_by_yaml/srcbogusnode.stanza +check:rc==0 +cmd:xcat-inventory export --format=yaml -t node -o bogusnode |tee /tmp/export_import_single_ppc_by_yaml/bogusnode_yaml.inv +check:rc==0 +cmd:scp /tmp/export_import_single_ppc_by_yaml/bogusnode_yaml.inv $$DSTMN:/tmp/export_import_single_ppc_by_yaml_$$DSTMN/ +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd: ssh $$DSTMN 'xcat-inventory import -f /tmp/export_import_single_ppc_by_yaml_$$DSTMN/bogusnode_yaml.inv -t node -o bogusnode' +check:rc==0 +cmd: ssh $$DSTMN 'lsdef bogusnode -z |sort -t'=' -k1|tee /tmp/export_import_single_ppc_by_yaml_$$DSTMN/dstbogusnode.stanza' +check:rc==0 +cmd: scp $$DSTMN:/tmp/export_import_single_ppc_by_yaml_$$DSTMN/dstbogusnode.stanza /tmp/export_import_single_ppc_by_yaml/dstbogusnode.stanza +check:rc==0 +cmd: cat /tmp/export_import_single_ppc_by_yaml/dstbogusnode.stanza +check:rc==0 +cmd:diff -y /tmp/export_import_single_ppc_by_yaml/srcbogusnode.stanza /tmp/export_import_single_ppc_by_yaml/dstbogusnode.stanza +check:rc==0 +cmd:ssh $$DSTMN 'rmdef bogusnode' +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_ppc_by_yaml/bogusnode.stanza ]]; then cat /tmp/export_import_single_ppc_by_yaml/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_ppc_by_yaml/bogusgroup.stanza ]]; then cat /tmp/export_import_single_ppc_by_yaml/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_ppc_by_yaml_$$DSTMN/bogusnode.stanza ]]; then cat /tmp/export_import_single_ppc_by_yaml_$$DSTMN/bogusnode.stanza | mkdef -z;fi' +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_ppc_by_yaml_$$DSTMN/bogusgroup.stanza ]]; then cat /tmp/export_import_single_ppc_by_yaml_$$DSTMN/bogusgroup.stanza |mkdef -z -f;fi' +check:rc==0 +cmd:ssh $$DSTMN 'rm -rf /tmp/export_import_single_ppc_by_yaml_$$DSTMN/' +check:rc==0 +cmd:rm -rf /tmp/export_import_single_ppc_by_yaml +check:rc==0 +end + + +start:export_import_single_kvm_by_json +description:This case is used to test xcat-inventory export and import one kvm 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. +cmd:mkdir -p /tmp/export_import_single_kvm_by_json +check:rc==0 +cmd:ssh $$DSTMN 'mkdir -p /tmp/export_import_single_kvm_by_json_$$DSTMN/' +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_import_single_kvm_by_json/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_kvm_by_json/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:ssh $$DSTMN 'lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_import_single_kvm_by_json_$$DSTMN/bogusnode.stanza ;rmdef bogusnode;fi' +check:rc==0 +cmd:ssh $$DSTMN 'lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_kvm_by_json_$$DSTMN/bogusgroup.stanza; rmdef -t group bogusgroup;fi' +check:rc==0 +cmd:mkdef -t node -o bogusnode groups=bogusgroup mgt=kvm addkcmdline=addkcmdline arch=ppc64le authdomain=authdomain cfgmgr=cfgmgr cfgmgtroles=cfgmgtroles cfgserver=cfgserver chain=chain chassis=chassis cmdmapping=cmdmapping cons=cons conserver=conserver consoleondemand=consoleondemand cpucount=cpucount cputype=cputype dhcpinterfaces=dhcpinterfaces disksize=disksize domainadminpassword=domainadminpassword domainadminuser=domainadminuser domaintype=domaintype getmac=getmac height=height hidden=hidden hostcluster=hostcluster hostinterface=hostinterface hostmanager=hostmanager hostnames=hostnames hosttype=hosttype id=5 installnic=installnic interface=interface ip=10.10.10.10 iscsipassword=iscsipassword iscsiserver=iscsiserver iscsitarget=iscsitarget iscsiuserid=iscsiuserid mac=42:d6:0a:03:05:08 memory=memory migrationdest=migrationdest monserver=monserver mpa=mpa mtm=mtm nameservers=nameservers netboot=grub2 nfsdir=nfsdir nfsserver=nfsserver nimserver=nimserver node=node ondiscover=ondiscover osvolume=osvolume otherinterfaces=otherinterfaces ou=ou pdu=pdu postbootscripts=postbootscripts postscripts=postscripts power=power prescripts-begin=prescripts-begin prescripts-end=prescripts-end primarynic=primarynic primarysn=primarysn productkey=productkey provmethod=provmethod rack=rack room=room routenames=routenames serial=serial serialflow=serialflow serialport=serialport serialspeed=serialspeed servicenode=servicenode setupconserver=0 setupdhcp=0 setupftp=setupftp setupipforward=0 setupldap=0 setupnameserver=0 setupnfs=0 setupnim=setupnim setupntp=0 setupproxydhcp=0 setuptftp=0 sfp=sfp side=side slot=slot storagcontroller=storagcontroller storagetype=storagetype supernode=supernode supportedarchs=supportedarchs supportproxydhcp=supportproxydhcp switch=switch switchinterface=switchinterface switchport=50 switchvlan=switchvlan syslog=syslog termport=termport termserver=termserver tftpdir=tftpdir tftpserver=tftpserver unit=unit usercomment=usercomment vmbeacon=vmbeacon vmbootorder=vmbootorder vmcfgstore=vmcfgstore vmcluster=vmcluster vmcpus=vmcpus vmhost=vmhost vmmanager=vmmanager vmmaster=vmmaster vmmemory=vmmemory vmnicnicmodel=vmnicnicmodel vmnics=vmnics vmothersetting=vmothersetting vmphyslots=vmphyslots vmstorage=vmstorage vmstoragecache=vmstoragecache vmstorageformat=vmstorageformat vmstoragemodel=vmstoragemodel vmtextconsole=vmtextconsole vmvirtflags=vmvirtflags vmvncport=vmvncport xcatmaster=xcatmaster zonename=zonename nicaliases.eth0="moe larry curly" nicaliases.eth1="tom|jerry" niccustomscripts.eth0="configeth eth0" niccustomscripts.ib0="configib ib0" nicdevices.bond0="eth0|eth2" nicdevices.br0=bond0 nicextraparams.eth0="MTU=1500" nicextraparams.ib0="MTU=65520 CONNECTED_MODE=yes" nichostnameprefixes.eth0="eth0-" nichostnameprefixes.ib0="ib-" nichostnamesuffixes.eth0="-eth0" nichostnamesuffixes.ib0="-ib0" nicips.ib0=10.10.100.9 nicips.enP48p1s0f0=129.40.234.11 nicips.ib1=10.11.100.9 nicnetworks.enP5p1s0f1.4=xcat_bmc nicnetworks.enP48p1s0f1=xcat_util nicnetworks.ib0=IB00 nicnetworks.enP48p1s0f0=pub_yellow nicnetworks.ib3=IB03 nicnetworks.ib2=IB02 nicnetworks.enP5p1s0f1=xcat_compute nicnetworks.ib1=IB01 nicnetworks.enP5p1s0f1.5=xcat_infra nicnetworks.enP5p1s0f1.6=xcat_pdu nicsadapter.enP3p3s0f1="mac=98:be:94:59:fa:cd linkstate=DOWN" nicsadapter.enP3p3s0f2="mac=98:be:94:59:fa:ce candidatename=enP3p3s0f2/enx98be9459face" nictypes.enP5p1s0f1.4=unused nictypes.enP48p1s0f1=unused nictypes.ib0=Infiniband nictypes.enP48p1s0f0=Ethernet nictypes.ib3=unused nictypes.ib2=unused nictypes.enP5p1s0f1=unused nictypes.ib1=Infiniband nictypes.enP5p1s0f1.5=unused nictypes.enP5p1s0f1.6=unused +check:rc==0 +cmd:lsdef bogusnode -z|sort -t'=' -k1 |tee /tmp/export_import_single_kvm_by_json/srcbogusnode.stanza +check:rc==0 +cmd:xcat-inventory export --format=json -t node -o bogusnode |tee /tmp/export_import_single_kvm_by_json/bogusnode_json.inv +check:rc==0 +cmd:scp /tmp/export_import_single_kvm_by_json/bogusnode_json.inv $$DSTMN:/tmp/export_import_single_kvm_by_json_$$DSTMN/ +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd: ssh $$DSTMN 'xcat-inventory import -f /tmp/export_import_single_kvm_by_json_$$DSTMN/bogusnode_json.inv -t node -o bogusnode' +check:rc==0 +cmd: ssh $$DSTMN 'lsdef bogusnode -z |sort -t'=' -k1|tee /tmp/export_import_single_kvm_by_json_$$DSTMN/dstbogusnode.stanza' +check:rc==0 +cmd: scp $$DSTMN:/tmp/export_import_single_kvm_by_json_$$DSTMN/dstbogusnode.stanza /tmp/export_import_single_kvm_by_json/dstbogusnode.stanza +check:rc==0 +cmd: cat /tmp/export_import_single_kvm_by_json/dstbogusnode.stanza +check:rc==0 +cmd:diff -y /tmp/export_import_single_kvm_by_json/srcbogusnode.stanza /tmp/export_import_single_kvm_by_json/dstbogusnode.stanza +check:rc==0 +cmd:ssh $$DSTMN 'rmdef bogusnode' +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_kvm_by_json/bogusnode.stanza ]]; then cat /tmp/export_import_single_kvm_by_json/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_kvm_by_json/bogusgroup.stanza ]]; then cat /tmp/export_import_single_kvm_by_json/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_kvm_by_json_$$DSTMN/bogusnode.stanza ]]; then cat /tmp/export_import_single_kvm_by_json_$$DSTMN/bogusnode.stanza | mkdef -z;fi' +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_kvm_by_json_$$DSTMN/bogusgroup.stanza ]]; then cat /tmp/export_import_single_kvm_by_json_$$DSTMN/bogusgroup.stanza |mkdef -z -f;fi' +check:rc==0 +cmd:ssh $$DSTMN 'rm -rf /tmp/export_import_single_kvm_by_json_$$DSTMN/' +check:rc==0 +cmd:rm -rf /tmp/export_import_single_kvm_by_json +check:rc==0 +end + + + +start:export_import_single_kvm_by_yaml +description:This case is used to test xcat-inventory export and import one kvm 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. +cmd:mkdir -p /tmp/export_import_single_kvm_by_yaml +check:rc==0 +cmd:ssh $$DSTMN 'mkdir -p /tmp/export_import_single_kvm_by_yaml_$$DSTMN/' +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_import_single_kvm_by_yaml/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_kvm_by_yaml/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:ssh $$DSTMN 'lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_import_single_kvm_by_yaml_$$DSTMN/bogusnode.stanza ;rmdef bogusnode;fi' +check:rc==0 +cmd:ssh $$DSTMN 'lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_kvm_by_yaml_$$DSTMN/bogusgroup.stanza; rmdef -t group bogusgroup;fi' +check:rc==0 +cmd:mkdef -t node -o bogusnode groups=bogusgroup mgt=kvm addkcmdline=addkcmdline arch=ppc64le authdomain=authdomain cfgmgr=cfgmgr cfgmgtroles=cfgmgtroles cfgserver=cfgserver chain=chain chassis=chassis cmdmapping=cmdmapping cons=cons conserver=conserver consoleondemand=consoleondemand cpucount=cpucount cputype=cputype dhcpinterfaces=dhcpinterfaces disksize=disksize domainadminpassword=domainadminpassword domainadminuser=domainadminuser domaintype=domaintype getmac=getmac height=height hidden=hidden hostcluster=hostcluster hostinterface=hostinterface hostmanager=hostmanager hostnames=hostnames hosttype=hosttype id=5 installnic=installnic interface=interface ip=10.10.10.10 iscsipassword=iscsipassword iscsiserver=iscsiserver iscsitarget=iscsitarget iscsiuserid=iscsiuserid mac=42:d6:0a:03:05:08 memory=memory migrationdest=migrationdest monserver=monserver mpa=mpa mtm=mtm nameservers=nameservers netboot=grub2 nfsdir=nfsdir nfsserver=nfsserver nimserver=nimserver node=node ondiscover=ondiscover osvolume=osvolume otherinterfaces=otherinterfaces ou=ou pdu=pdu postbootscripts=postbootscripts postscripts=postscripts power=power prescripts-begin=prescripts-begin prescripts-end=prescripts-end primarynic=primarynic primarysn=primarysn productkey=productkey provmethod=provmethod rack=rack room=room routenames=routenames serial=serial serialflow=serialflow serialport=serialport serialspeed=serialspeed servicenode=servicenode setupconserver=0 setupdhcp=0 setupftp=setupftp setupipforward=0 setupldap=0 setupnameserver=0 setupnfs=0 setupnim=setupnim setupntp=0 setupproxydhcp=0 setuptftp=0 sfp=sfp side=side slot=slot storagcontroller=storagcontroller storagetype=storagetype supernode=supernode supportedarchs=supportedarchs supportproxydhcp=supportproxydhcp switch=switch switchinterface=switchinterface switchport=50 switchvlan=switchvlan syslog=syslog termport=termport termserver=termserver tftpdir=tftpdir tftpserver=tftpserver unit=unit usercomment=usercomment vmbeacon=vmbeacon vmbootorder=vmbootorder vmcfgstore=vmcfgstore vmcluster=vmcluster vmcpus=vmcpus vmhost=vmhost vmmanager=vmmanager vmmaster=vmmaster vmmemory=vmmemory vmnicnicmodel=vmnicnicmodel vmnics=vmnics vmothersetting=vmothersetting vmphyslots=vmphyslots vmstorage=vmstorage vmstoragecache=vmstoragecache vmstorageformat=vmstorageformat vmstoragemodel=vmstoragemodel vmtextconsole=vmtextconsole vmvirtflags=vmvirtflags vmvncport=vmvncport xcatmaster=xcatmaster zonename=zonename nicaliases.eth0="moe larry curly" nicaliases.eth1="tom|jerry" niccustomscripts.eth0="configeth eth0" niccustomscripts.ib0="configib ib0" nicdevices.bond0="eth0|eth2" nicdevices.br0=bond0 nicextraparams.eth0="MTU=1500" nicextraparams.ib0="MTU=65520 CONNECTED_MODE=yes" nichostnameprefixes.eth0="eth0-" nichostnameprefixes.ib0="ib-" nichostnamesuffixes.eth0="-eth0" nichostnamesuffixes.ib0="-ib0" nicips.ib0=10.10.100.9 nicips.enP48p1s0f0=129.40.234.11 nicips.ib1=10.11.100.9 nicnetworks.enP5p1s0f1.4=xcat_bmc nicnetworks.enP48p1s0f1=xcat_util nicnetworks.ib0=IB00 nicnetworks.enP48p1s0f0=pub_yellow nicnetworks.ib3=IB03 nicnetworks.ib2=IB02 nicnetworks.enP5p1s0f1=xcat_compute nicnetworks.ib1=IB01 nicnetworks.enP5p1s0f1.5=xcat_infra nicnetworks.enP5p1s0f1.6=xcat_pdu nicsadapter.enP3p3s0f1="mac=98:be:94:59:fa:cd linkstate=DOWN" nicsadapter.enP3p3s0f2="mac=98:be:94:59:fa:ce candidatename=enP3p3s0f2/enx98be9459face" nictypes.enP5p1s0f1.4=unused nictypes.enP48p1s0f1=unused nictypes.ib0=Infiniband nictypes.enP48p1s0f0=Ethernet nictypes.ib3=unused nictypes.ib2=unused nictypes.enP5p1s0f1=unused nictypes.ib1=Infiniband nictypes.enP5p1s0f1.5=unused nictypes.enP5p1s0f1.6=unused +check:rc==0 +cmd:lsdef bogusnode -z|sort -t'=' -k1 |tee /tmp/export_import_single_kvm_by_yaml/srcbogusnode.stanza +check:rc==0 +cmd:xcat-inventory export --format=yaml -t node -o bogusnode |tee /tmp/export_import_single_kvm_by_yaml/bogusnode_yaml.inv +check:rc==0 +cmd:scp /tmp/export_import_single_kvm_by_yaml/bogusnode_yaml.inv $$DSTMN:/tmp/export_import_single_kvm_by_yaml_$$DSTMN/ +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd: ssh $$DSTMN 'xcat-inventory import -f /tmp/export_import_single_kvm_by_yaml_$$DSTMN/bogusnode_yaml.inv -t node -o bogusnode' +check:rc==0 +cmd: ssh $$DSTMN 'lsdef bogusnode -z |sort -t'=' -k1|tee /tmp/export_import_single_kvm_by_yaml_$$DSTMN/dstbogusnode.stanza' +check:rc==0 +cmd: scp $$DSTMN:/tmp/export_import_single_kvm_by_yaml_$$DSTMN/dstbogusnode.stanza /tmp/export_import_single_kvm_by_yaml/dstbogusnode.stanza +check:rc==0 +cmd: cat /tmp/export_import_single_kvm_by_yaml/dstbogusnode.stanza +check:rc==0 +cmd:diff -y /tmp/export_import_single_kvm_by_yaml/srcbogusnode.stanza /tmp/export_import_single_kvm_by_yaml/dstbogusnode.stanza +check:rc==0 +cmd:ssh $$DSTMN 'rmdef bogusnode' +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_kvm_by_yaml/bogusnode.stanza ]]; then cat /tmp/export_import_single_kvm_by_yaml/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_kvm_by_yaml/bogusgroup.stanza ]]; then cat /tmp/export_import_single_kvm_by_yaml/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_kvm_by_yaml_$$DSTMN/bogusnode.stanza ]]; then cat /tmp/export_import_single_kvm_by_yaml_$$DSTMN/bogusnode.stanza | mkdef -z;fi' +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_kvm_by_yaml_$$DSTMN/bogusgroup.stanza ]]; then cat /tmp/export_import_single_kvm_by_yaml_$$DSTMN/bogusgroup.stanza |mkdef -z -f;fi' +check:rc==0 +cmd:ssh $$DSTMN 'rm -rf /tmp/export_import_single_kvm_by_yaml_$$DSTMN/' +check:rc==0 +cmd:rm -rf /tmp/export_import_single_kvm_by_yaml +check:rc==0 +end + + + +start:export_import_single_pdu_by_json +description:This case is used to test xcat-inventory export and import one pdu 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. +cmd:mkdir -p /tmp/export_import_single_pdu_by_json +check:rc==0 +cmd:ssh $$DSTMN 'mkdir -p /tmp/export_import_single_pdu_by_json_$$DSTMN/' +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_import_single_pdu_by_json/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_pdu_by_json/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:ssh $$DSTMN 'lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_import_single_pdu_by_json_$$DSTMN/bogusnode.stanza ;rmdef bogusnode;fi' +check:rc==0 +cmd:ssh $$DSTMN 'lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_pdu_by_json_$$DSTMN/bogusgroup.stanza; rmdef -t group bogusgroup;fi' +check:rc==0 +cmd:mkdef -t node -o bogusnode groups=bogusgroup mgt=pdu nodetype=pdu addkcmdline=addkcmdline arch=ppc64 authdomain=authdomain authkey=authkey authtype=MD5 cfgmgr=cfgmgr cfgmgtroles=cfgmgtroles cfgserver=cfgserver chain=chain chassis=chassis cmdmapping=cmdmapping community=community cons=cons conserver=conserver consoleondemand=consoleondemand cpucount=cpucount cputype=cputype dhcpinterfaces=dhcpinterfaces disksize=disksize domainadminpassword=domainadminpassword domainadminuser=domainadminuser domaintype=domaintype getmac=getmac height=height hidden=hidden hostcluster=hostcluster hostinterface=hostinterface hostmanager=hostmanager hostnames=hostnames hosttype=hosttype installnic=installnic interface=interface ip=10.10.10.10 iscsipassword=iscsipassword iscsiserver=iscsiserver iscsitarget=iscsitarget iscsiuserid=iscsiuserid mac=42:d6:0a:03:05:08 memory=memory migrationdest=migrationdest monserver=monserver mpa=mpa mtm=mtm nameservers=nameservers netboot=grub2 nfsdir=nfsdir nfsserver=nfsserver nimserver=nimserver node=node ondiscover=ondiscover osvolume=osvolume otherinterfaces=otherinterfaces ou=ou outlet=outlet password=password pdu=pdu pdutype=pdutype postbootscripts=postbootscripts postscripts=postscripts power=power prescripts-begin=prescripts-begin prescripts-end=prescripts-end primarynic=primarynic primarysn=primarysn privkey=privkey privtype=AES productkey=productkey provmethod=provmethod rack=rack room=room routenames=routenames seclevel=noAuthNoPriv serial=serial serialflow=serialflow serialport=serialport serialspeed=serialspeed servicenode=servicenode setupconserver=0 setupdhcp=0 setupftp=setupftp setupipforward=0 setupldap=0 setupnameserver=0 setupnfs=0 setupnim=setupnim setupntp=0 setupproxydhcp=0 setuptftp=0 sfp=sfp side=side slot=slot snmpuser=snmpuser snmpversion=SNMPv1 storagcontroller=storagcontroller storagetype=storagetype supernode=supernode supportedarchs=supportedarchs supportproxydhcp=supportproxydhcp switch=switch switchinterface=switchinterface switchport=50 switchvlan=switchvlan syslog=syslog termport=termport termserver=termserver tftpdir=tftpdir tftpserver=tftpserver unit=unit usercomment=usercomment username=username vmbeacon=vmbeacon vmbootorder=vmbootorder vmcfgstore=vmcfgstore vmcluster=vmcluster vmmanager=vmmanager vmmaster=vmmaster vmnicnicmodel=vmnicnicmodel vmphyslots=vmphyslots vmstorage=vmstorage vmstoragecache=vmstoragecache vmstorageformat=vmstorageformat vmstoragemodel=vmstoragemodel vmtextconsole=vmtextconsole vmvirtflags=vmvirtflags vmvncport=vmvncport xcatmaster=xcatmaster zonename=zonename nicaliases.eth0="moe larry curly" nicaliases.eth1="tom|jerry" niccustomscripts.eth0="configeth eth0" niccustomscripts.ib0="configib ib0" nicdevices.bond0="eth0|eth2" nicdevices.br0=bond0 nicextraparams.eth0="MTU=1500" nicextraparams.ib0="MTU=65520 CONNECTED_MODE=yes" nichostnameprefixes.eth0="eth0-" nichostnameprefixes.ib0="ib-" nichostnamesuffixes.eth0="-eth0" nichostnamesuffixes.ib0="-ib0" nicips.ib0=10.10.100.9 nicips.enP48p1s0f0=129.40.234.11 nicips.ib1=10.11.100.9 nicnetworks.enP5p1s0f1.4=xcat_bmc nicnetworks.enP48p1s0f1=xcat_util nicnetworks.ib0=IB00 nicnetworks.enP48p1s0f0=pub_yellow nicnetworks.ib3=IB03 nicnetworks.ib2=IB02 nicnetworks.enP5p1s0f1=xcat_compute nicnetworks.ib1=IB01 nicnetworks.enP5p1s0f1.5=xcat_infra nicnetworks.enP5p1s0f1.6=xcat_pdu nicsadapter.enP3p3s0f1="mac=98:be:94:59:fa:cd linkstate=DOWN" nicsadapter.enP3p3s0f2="mac=98:be:94:59:fa:ce candidatename=enP3p3s0f2/enx98be9459face" nictypes.enP5p1s0f1.4=unused nictypes.enP48p1s0f1=unused nictypes.ib0=Infiniband nictypes.enP48p1s0f0=Ethernet nictypes.ib3=unused nictypes.ib2=unused nictypes.enP5p1s0f1=unused nictypes.ib1=Infiniband nictypes.enP5p1s0f1.5=unused nictypes.enP5p1s0f1.6=unused +check:rc==0 +cmd:lsdef bogusnode -z|sort -t'=' -k1 |tee /tmp/export_import_single_pdu_by_json/srcbogusnode.stanza +check:rc==0 +cmd:xcat-inventory export --format=json -t node -o bogusnode |tee /tmp/export_import_single_pdu_by_json/bogusnode_json.inv +check:rc==0 +cmd:scp /tmp/export_import_single_pdu_by_json/bogusnode_json.inv $$DSTMN:/tmp/export_import_single_pdu_by_json_$$DSTMN/ +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd: ssh $$DSTMN 'xcat-inventory import -f /tmp/export_import_single_pdu_by_json_$$DSTMN/bogusnode_json.inv -t node -o bogusnode' +check:rc==0 +cmd: ssh $$DSTMN 'lsdef bogusnode -z |sort -t'=' -k1|tee /tmp/export_import_single_pdu_by_json_$$DSTMN/dstbogusnode.stanza' +check:rc==0 +cmd: scp $$DSTMN:/tmp/export_import_single_pdu_by_json_$$DSTMN/dstbogusnode.stanza /tmp/export_import_single_pdu_by_json/dstbogusnode.stanza +check:rc==0 +cmd: cat /tmp/export_import_single_pdu_by_json/dstbogusnode.stanza +check:rc==0 +cmd:diff -y /tmp/export_import_single_pdu_by_json/srcbogusnode.stanza /tmp/export_import_single_pdu_by_json/dstbogusnode.stanza +check:rc==0 +cmd:ssh $$DSTMN 'rmdef bogusnode' +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_pdu_by_json/bogusnode.stanza ]]; then cat /tmp/export_import_single_pdu_by_json/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_pdu_by_json/bogusgroup.stanza ]]; then cat /tmp/export_import_single_pdu_by_json/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_pdu_by_json_$$DSTMN/bogusnode.stanza ]]; then cat /tmp/export_import_single_pdu_by_json_$$DSTMN/bogusnode.stanza | mkdef -z;fi' +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_pdu_by_json_$$DSTMN/bogusgroup.stanza ]]; then cat /tmp/export_import_single_pdu_by_json_$$DSTMN/bogusgroup.stanza |mkdef -z -f;fi' +check:rc==0 +cmd:ssh $$DSTMN 'rm -rf /tmp/export_import_single_pdu_by_json_$$DSTMN/' +check:rc==0 +cmd:rm -rf /tmp/export_import_single_pdu_by_json +check:rc==0 +end + + +start:export_import_single_pdu_by_yaml +description:This case is used to test xcat-inventory export and import one pdu 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. +cmd:mkdir -p /tmp/export_import_single_pdu_by_yaml +check:rc==0 +cmd:ssh $$DSTMN 'mkdir -p /tmp/export_import_single_pdu_by_yaml_$$DSTMN/' +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_import_single_pdu_by_yaml/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_pdu_by_yaml/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:ssh $$DSTMN 'lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_import_single_pdu_by_yaml_$$DSTMN/bogusnode.stanza ;rmdef bogusnode;fi' +check:rc==0 +cmd:ssh $$DSTMN 'lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_pdu_by_yaml_$$DSTMN/bogusgroup.stanza; rmdef -t group bogusgroup;fi' +check:rc==0 +cmd:mkdef -t node -o bogusnode groups=bogusgroup mgt=pdu nodetype=pdu addkcmdline=addkcmdline arch=ppc64 authdomain=authdomain authkey=authkey authtype=MD5 cfgmgr=cfgmgr cfgmgtroles=cfgmgtroles cfgserver=cfgserver chain=chain chassis=chassis cmdmapping=cmdmapping community=community cons=cons conserver=conserver consoleondemand=consoleondemand cpucount=cpucount cputype=cputype dhcpinterfaces=dhcpinterfaces disksize=disksize domainadminpassword=domainadminpassword domainadminuser=domainadminuser domaintype=domaintype getmac=getmac height=height hidden=hidden hostcluster=hostcluster hostinterface=hostinterface hostmanager=hostmanager hostnames=hostnames hosttype=hosttype installnic=installnic interface=interface ip=10.10.10.10 iscsipassword=iscsipassword iscsiserver=iscsiserver iscsitarget=iscsitarget iscsiuserid=iscsiuserid mac=42:d6:0a:03:05:08 memory=memory migrationdest=migrationdest monserver=monserver mpa=mpa mtm=mtm nameservers=nameservers netboot=grub2 nfsdir=nfsdir nfsserver=nfsserver nimserver=nimserver node=node ondiscover=ondiscover osvolume=osvolume otherinterfaces=otherinterfaces ou=ou outlet=outlet password=password pdu=pdu pdutype=pdutype postbootscripts=postbootscripts postscripts=postscripts power=power prescripts-begin=prescripts-begin prescripts-end=prescripts-end primarynic=primarynic primarysn=primarysn privkey=privkey privtype=AES productkey=productkey provmethod=provmethod rack=rack room=room routenames=routenames seclevel=noAuthNoPriv serial=serial serialflow=serialflow serialport=serialport serialspeed=serialspeed servicenode=servicenode setupconserver=0 setupdhcp=0 setupftp=setupftp setupipforward=0 setupldap=0 setupnameserver=0 setupnfs=0 setupnim=setupnim setupntp=0 setupproxydhcp=0 setuptftp=0 sfp=sfp side=side slot=slot snmpuser=snmpuser snmpversion=SNMPv1 storagcontroller=storagcontroller storagetype=storagetype supernode=supernode supportedarchs=supportedarchs supportproxydhcp=supportproxydhcp switch=switch switchinterface=switchinterface switchport=50 switchvlan=switchvlan syslog=syslog termport=termport termserver=termserver tftpdir=tftpdir tftpserver=tftpserver unit=unit usercomment=usercomment username=username vmbeacon=vmbeacon vmbootorder=vmbootorder vmcfgstore=vmcfgstore vmcluster=vmcluster vmmanager=vmmanager vmmaster=vmmaster vmnicnicmodel=vmnicnicmodel vmphyslots=vmphyslots vmstorage=vmstorage vmstoragecache=vmstoragecache vmstorageformat=vmstorageformat vmstoragemodel=vmstoragemodel vmtextconsole=vmtextconsole vmvirtflags=vmvirtflags vmvncport=vmvncport xcatmaster=xcatmaster zonename=zonename nicaliases.eth0="moe larry curly" nicaliases.eth1="tom|jerry" niccustomscripts.eth0="configeth eth0" niccustomscripts.ib0="configib ib0" nicdevices.bond0="eth0|eth2" nicdevices.br0=bond0 nicextraparams.eth0="MTU=1500" nicextraparams.ib0="MTU=65520 CONNECTED_MODE=yes" nichostnameprefixes.eth0="eth0-" nichostnameprefixes.ib0="ib-" nichostnamesuffixes.eth0="-eth0" nichostnamesuffixes.ib0="-ib0" nicips.ib0=10.10.100.9 nicips.enP48p1s0f0=129.40.234.11 nicips.ib1=10.11.100.9 nicnetworks.enP5p1s0f1.4=xcat_bmc nicnetworks.enP48p1s0f1=xcat_util nicnetworks.ib0=IB00 nicnetworks.enP48p1s0f0=pub_yellow nicnetworks.ib3=IB03 nicnetworks.ib2=IB02 nicnetworks.enP5p1s0f1=xcat_compute nicnetworks.ib1=IB01 nicnetworks.enP5p1s0f1.5=xcat_infra nicnetworks.enP5p1s0f1.6=xcat_pdu nicsadapter.enP3p3s0f1="mac=98:be:94:59:fa:cd linkstate=DOWN" nicsadapter.enP3p3s0f2="mac=98:be:94:59:fa:ce candidatename=enP3p3s0f2/enx98be9459face" nictypes.enP5p1s0f1.4=unused nictypes.enP48p1s0f1=unused nictypes.ib0=Infiniband nictypes.enP48p1s0f0=Ethernet nictypes.ib3=unused nictypes.ib2=unused nictypes.enP5p1s0f1=unused nictypes.ib1=Infiniband nictypes.enP5p1s0f1.5=unused nictypes.enP5p1s0f1.6=unused +check:rc==0 +cmd:lsdef bogusnode -z|sort -t'=' -k1 |tee /tmp/export_import_single_pdu_by_yaml/srcbogusnode.stanza +check:rc==0 +cmd:xcat-inventory export --format=yaml -t node -o bogusnode |tee /tmp/export_import_single_pdu_by_yaml/bogusnode_yaml.inv +check:rc==0 +cmd:scp /tmp/export_import_single_pdu_by_yaml/bogusnode_yaml.inv $$DSTMN:/tmp/export_import_single_pdu_by_yaml_$$DSTMN/ +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd: ssh $$DSTMN 'xcat-inventory import -f /tmp/export_import_single_pdu_by_yaml_$$DSTMN/bogusnode_yaml.inv -t node -o bogusnode' +check:rc==0 +cmd: ssh $$DSTMN 'lsdef bogusnode -z |sort -t'=' -k1|tee /tmp/export_import_single_pdu_by_yaml_$$DSTMN/dstbogusnode.stanza' +check:rc==0 +cmd: scp $$DSTMN:/tmp/export_import_single_pdu_by_yaml_$$DSTMN/dstbogusnode.stanza /tmp/export_import_single_pdu_by_yaml/dstbogusnode.stanza +check:rc==0 +cmd: cat /tmp/export_import_single_pdu_by_yaml/dstbogusnode.stanza +check:rc==0 +cmd:diff -y /tmp/export_import_single_pdu_by_yaml/srcbogusnode.stanza /tmp/export_import_single_pdu_by_yaml/dstbogusnode.stanza +check:rc==0 +cmd:ssh $$DSTMN 'rmdef bogusnode' +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_pdu_by_yaml/bogusnode.stanza ]]; then cat /tmp/export_import_single_pdu_by_yaml/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_pdu_by_yaml/bogusgroup.stanza ]]; then cat /tmp/export_import_single_pdu_by_yaml/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_pdu_by_yaml_$$DSTMN/bogusnode.stanza ]]; then cat /tmp/export_import_single_pdu_by_yaml_$$DSTMN/bogusnode.stanza | mkdef -z;fi' +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_pdu_by_yaml_$$DSTMN/bogusgroup.stanza ]]; then cat /tmp/export_import_single_pdu_by_yaml_$$DSTMN/bogusgroup.stanza |mkdef -z -f;fi' +check:rc==0 +cmd:ssh $$DSTMN 'rm -rf /tmp/export_import_single_pdu_by_yaml_$$DSTMN/' +check:rc==0 +cmd:rm -rf /tmp/export_import_single_pdu_by_yaml +check:rc==0 +end + + +start:export_import_single_boston_by_yaml +description:This case is used to test xcat-inventory export and import one boston node definition by yaml between 2 exact same MNs. This case can also cover p8 physical node, x86 physical node. 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. +cmd:mkdir -p /tmp/export_import_single_boston_by_yaml +check:rc==0 +cmd:ssh $$DSTMN 'mkdir -p /tmp/export_import_single_boston_by_yaml_$$DSTMN/' +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_import_single_boston_by_yaml/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_boston_by_yaml/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:ssh $$DSTMN 'lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_import_single_boston_by_yaml_$$DSTMN/bogusnode.stanza ;rmdef bogusnode;fi' +check:rc==0 +cmd:ssh $$DSTMN 'lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_boston_by_yaml_$$DSTMN/bogusgroup.stanza; rmdef -t group bogusgroup;fi' +check:rc==0 +cmd:mkdef -t node -o bogusnode groups=bogusgroup mgt=ipmi addkcmdline=addkcmdline arch=ppc64le authdomain=authdomain bmc=bmc bmcpassword=bmcpassword bmcport=bmcport bmcusername=bmcusername bmcvlantag=bmcvlantag cfgmgr=cfgmgr cfgmgtroles=cfgmgtroles cfgserver=cfgserver chain=chain chassis=chassis cmdmapping=cmdmapping cons=cons conserver=conserver consoleondemand=consoleondemand cpucount=cpucount cputype=cputype dhcpinterfaces=dhcpinterfaces disksize=disksize domainadminpassword=domainadminpassword domainadminuser=domainadminuser domaintype=domaintype getmac=getmac height=height hidden=hidden hostcluster=hostcluster hostinterface=hostinterface hostmanager=hostmanager hostnames=hostnames hosttype=hosttype hwtype=hwtype installnic=installnic interface=interface ip=10.10.10.10 iscsipassword=iscsipassword iscsiserver=iscsiserver iscsitarget=iscsitarget iscsiuserid=iscsiuserid mac=42:d6:0a:03:05:08 memory=memory migrationdest=migrationdest monserver=monserver mpa=mpa mtm=mtm nameservers=nameservers netboot=grub2 nfsdir=nfsdir nfsserver=nfsserver nimserver=nimserver node=node ondiscover=ondiscover osvolume=osvolume otherinterfaces=otherinterfaces ou=ou pdu=pdu postbootscripts=postbootscripts postscripts=postscripts power=power prescripts-begin=prescripts-begin prescripts-end=prescripts-end primarynic=primarynic primarysn=primarysn productkey=productkey provmethod=provmethod rack=rack room=room routenames=routenames serial=serial serialflow=serialflow serialport=serialport serialspeed=serialspeed servicenode=servicenode setupconserver=0 setupdhcp=0 setupftp=setupftp setupipforward=0 setupldap=0 setupnameserver=0 setupnfs=0 setupnim=setupnim setupntp=0 setupproxydhcp=0 setuptftp=0 sfp=sfp side=side slot=slot slotid=slotid storagcontroller=storagcontroller storagetype=storagetype supernode=supernode supportedarchs=supportedarchs supportproxydhcp=supportproxydhcp switch=switch switchinterface=switchinterface switchport=50 switchvlan=switchvlan syslog=syslog termport=termport termserver=termserver tftpdir=tftpdir tftpserver=tftpserver unit=unit usercomment=usercomment vmbeacon=vmbeacon vmbootorder=vmbootorder vmcfgstore=vmcfgstore vmcluster=vmcluster vmmanager=vmmanager vmmaster=vmmaster vmnicnicmodel=vmnicnicmodel vmphyslots=vmphyslots vmstorage=vmstorage vmstoragecache=vmstoragecache vmstorageformat=vmstorageformat vmstoragemodel=vmstoragemodel vmtextconsole=vmtextconsole vmvirtflags=vmvirtflags vmvncport=vmvncport xcatmaster=xcatmaster zonename=zonename nicaliases.eth0="moe larry curly" nicaliases.eth1="tom|jerry" niccustomscripts.eth0="configeth eth0" niccustomscripts.ib0="configib ib0" nicdevices.bond0="eth0|eth2" nicdevices.br0=bond0 nicextraparams.eth0="MTU=1500" nicextraparams.ib0="MTU=65520 CONNECTED_MODE=yes" nichostnameprefixes.eth0="eth0-" nichostnameprefixes.ib0="ib-" nichostnamesuffixes.eth0="-eth0" nichostnamesuffixes.ib0="-ib0" nicips.ib0=10.10.100.9 nicips.enP48p1s0f0=129.40.234.11 nicips.ib1=10.11.100.9 nicnetworks.enP5p1s0f1.4=xcat_bmc nicnetworks.enP48p1s0f1=xcat_util nicnetworks.ib0=IB00 nicnetworks.enP48p1s0f0=pub_yellow nicnetworks.ib3=IB03 nicnetworks.ib2=IB02 nicnetworks.enP5p1s0f1=xcat_compute nicnetworks.ib1=IB01 nicnetworks.enP5p1s0f1.5=xcat_infra nicnetworks.enP5p1s0f1.6=xcat_pdu nicsadapter.enP3p3s0f1="mac=98:be:94:59:fa:cd linkstate=DOWN" nicsadapter.enP3p3s0f2="mac=98:be:94:59:fa:ce candidatename=enP3p3s0f2/enx98be9459face" nictypes.enP5p1s0f1.4=unused nictypes.enP48p1s0f1=unused nictypes.ib0=Infiniband nictypes.enP48p1s0f0=Ethernet nictypes.ib3=unused nictypes.ib2=unused nictypes.enP5p1s0f1=unused nictypes.ib1=Infiniband nictypes.enP5p1s0f1.5=unused nictypes.enP5p1s0f1.6=unused +check:rc==0 +cmd:lsdef bogusnode -z|sort -t'=' -k1 |tee /tmp/export_import_single_boston_by_yaml/srcbogusnode.stanza +check:rc==0 +cmd:xcat-inventory export --format=yaml -t node -o bogusnode |tee /tmp/export_import_single_boston_by_yaml/bogusnode_yaml.inv +check:rc==0 +cmd:scp /tmp/export_import_single_boston_by_yaml/bogusnode_yaml.inv $$DSTMN:/tmp/export_import_single_boston_by_yaml_$$DSTMN/ +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd: ssh $$DSTMN 'xcat-inventory import -f /tmp/export_import_single_boston_by_yaml_$$DSTMN/bogusnode_yaml.inv -t node -o bogusnode' +check:rc==0 +cmd: ssh $$DSTMN 'lsdef bogusnode -z |sort -t'=' -k1|tee /tmp/export_import_single_boston_by_yaml_$$DSTMN/dstbogusnode.stanza' +check:rc==0 +cmd: scp $$DSTMN:/tmp/export_import_single_boston_by_yaml_$$DSTMN/dstbogusnode.stanza /tmp/export_import_single_boston_by_yaml/dstbogusnode.stanza +check:rc==0 +cmd: cat /tmp/export_import_single_boston_by_yaml/dstbogusnode.stanza +check:rc==0 +cmd:diff -y /tmp/export_import_single_boston_by_yaml/srcbogusnode.stanza /tmp/export_import_single_boston_by_yaml/dstbogusnode.stanza +check:rc==0 +cmd:ssh $$DSTMN 'rmdef bogusnode' +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_boston_by_yaml/bogusnode.stanza ]]; then cat /tmp/export_import_single_boston_by_yaml/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_boston_by_yaml/bogusgroup.stanza ]]; then cat /tmp/export_import_single_boston_by_yaml/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_boston_by_yaml_$$DSTMN/bogusnode.stanza ]]; then cat /tmp/export_import_single_boston_by_yaml_$$DSTMN/bogusnode.stanza | mkdef -z;fi' +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_boston_by_yaml_$$DSTMN/bogusgroup.stanza ]]; then cat /tmp/export_import_single_boston_by_yaml_$$DSTMN/bogusgroup.stanza |mkdef -z -f;fi' +check:rc==0 +cmd:ssh $$DSTMN 'rm -rf /tmp/export_import_single_boston_by_yaml_$$DSTMN/' +check:rc==0 +cmd:rm -rf /tmp/export_import_single_boston_by_yaml +check:rc==0 +end + +start:export_import_single_boston_by_json +description:This case is used to test xcat-inventory export and import one boston node definition by json between 2 exact same MNs. This case can also cover p8 physical node, x86 physical node. 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. +cmd:mkdir -p /tmp/export_import_single_boston_by_json +check:rc==0 +cmd:ssh $$DSTMN 'mkdir -p /tmp/export_import_single_boston_by_json_$$DSTMN/' +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_import_single_boston_by_json/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_boston_by_json/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:ssh $$DSTMN 'lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_import_single_boston_by_json_$$DSTMN/bogusnode.stanza ;rmdef bogusnode;fi' +check:rc==0 +cmd:ssh $$DSTMN 'lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_boston_by_json_$$DSTMN/bogusgroup.stanza; rmdef -t group bogusgroup;fi' +check:rc==0 +cmd:mkdef -t node -o bogusnode groups=bogusgroup mgt=ipmi addkcmdline=addkcmdline arch=ppc64le authdomain=authdomain bmc=bmc bmcpassword=bmcpassword bmcport=bmcport bmcusername=bmcusername bmcvlantag=bmcvlantag cfgmgr=cfgmgr cfgmgtroles=cfgmgtroles cfgserver=cfgserver chain=chain chassis=chassis cmdmapping=cmdmapping cons=cons conserver=conserver consoleondemand=consoleondemand cpucount=cpucount cputype=cputype dhcpinterfaces=dhcpinterfaces disksize=disksize domainadminpassword=domainadminpassword domainadminuser=domainadminuser domaintype=domaintype getmac=getmac height=height hidden=hidden hostcluster=hostcluster hostinterface=hostinterface hostmanager=hostmanager hostnames=hostnames hosttype=hosttype hwtype=hwtype installnic=installnic interface=interface ip=10.10.10.10 iscsipassword=iscsipassword iscsiserver=iscsiserver iscsitarget=iscsitarget iscsiuserid=iscsiuserid mac=42:d6:0a:03:05:08 memory=memory migrationdest=migrationdest monserver=monserver mpa=mpa mtm=mtm nameservers=nameservers netboot=grub2 nfsdir=nfsdir nfsserver=nfsserver nimserver=nimserver node=node ondiscover=ondiscover osvolume=osvolume otherinterfaces=otherinterfaces ou=ou pdu=pdu postbootscripts=postbootscripts postscripts=postscripts power=power prescripts-begin=prescripts-begin prescripts-end=prescripts-end primarynic=primarynic primarysn=primarysn productkey=productkey provmethod=provmethod rack=rack room=room routenames=routenames serial=serial serialflow=serialflow serialport=serialport serialspeed=serialspeed servicenode=servicenode setupconserver=0 setupdhcp=0 setupftp=setupftp setupipforward=0 setupldap=0 setupnameserver=0 setupnfs=0 setupnim=setupnim setupntp=0 setupproxydhcp=0 setuptftp=0 sfp=sfp side=side slot=slot slotid=slotid storagcontroller=storagcontroller storagetype=storagetype supernode=supernode supportedarchs=supportedarchs supportproxydhcp=supportproxydhcp switch=switch switchinterface=switchinterface switchport=50 switchvlan=switchvlan syslog=syslog termport=termport termserver=termserver tftpdir=tftpdir tftpserver=tftpserver unit=unit usercomment=usercomment vmbeacon=vmbeacon vmbootorder=vmbootorder vmcfgstore=vmcfgstore vmcluster=vmcluster vmmanager=vmmanager vmmaster=vmmaster vmnicnicmodel=vmnicnicmodel vmphyslots=vmphyslots vmstorage=vmstorage vmstoragecache=vmstoragecache vmstorageformat=vmstorageformat vmstoragemodel=vmstoragemodel vmtextconsole=vmtextconsole vmvirtflags=vmvirtflags vmvncport=vmvncport xcatmaster=xcatmaster zonename=zonename nicaliases.eth0="moe larry curly" nicaliases.eth1="tom|jerry" niccustomscripts.eth0="configeth eth0" niccustomscripts.ib0="configib ib0" nicdevices.bond0="eth0|eth2" nicdevices.br0=bond0 nicextraparams.eth0="MTU=1500" nicextraparams.ib0="MTU=65520 CONNECTED_MODE=yes" nichostnameprefixes.eth0="eth0-" nichostnameprefixes.ib0="ib-" nichostnamesuffixes.eth0="-eth0" nichostnamesuffixes.ib0="-ib0" nicips.ib0=10.10.100.9 nicips.enP48p1s0f0=129.40.234.11 nicips.ib1=10.11.100.9 nicnetworks.enP5p1s0f1.4=xcat_bmc nicnetworks.enP48p1s0f1=xcat_util nicnetworks.ib0=IB00 nicnetworks.enP48p1s0f0=pub_yellow nicnetworks.ib3=IB03 nicnetworks.ib2=IB02 nicnetworks.enP5p1s0f1=xcat_compute nicnetworks.ib1=IB01 nicnetworks.enP5p1s0f1.5=xcat_infra nicnetworks.enP5p1s0f1.6=xcat_pdu nicsadapter.enP3p3s0f1="mac=98:be:94:59:fa:cd linkstate=DOWN" nicsadapter.enP3p3s0f2="mac=98:be:94:59:fa:ce candidatename=enP3p3s0f2/enx98be9459face" nictypes.enP5p1s0f1.4=unused nictypes.enP48p1s0f1=unused nictypes.ib0=Infiniband nictypes.enP48p1s0f0=Ethernet nictypes.ib3=unused nictypes.ib2=unused nictypes.enP5p1s0f1=unused nictypes.ib1=Infiniband nictypes.enP5p1s0f1.5=unused nictypes.enP5p1s0f1.6=unused +check:rc==0 +cmd:lsdef bogusnode -z|sort -t'=' -k1 |tee /tmp/export_import_single_boston_by_json/srcbogusnode.stanza +check:rc==0 +cmd:xcat-inventory export --format=json -t node -o bogusnode |tee /tmp/export_import_single_boston_by_json/bogusnode_json.inv +check:rc==0 +cmd:scp /tmp/export_import_single_boston_by_json/bogusnode_json.inv $$DSTMN:/tmp/export_import_single_boston_by_json_$$DSTMN/ +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd: ssh $$DSTMN 'xcat-inventory import -f /tmp/export_import_single_boston_by_json_$$DSTMN/bogusnode_json.inv -t node -o bogusnode' +check:rc==0 +cmd: ssh $$DSTMN 'lsdef bogusnode -z |sort -t'=' -k1|tee /tmp/export_import_single_boston_by_json_$$DSTMN/dstbogusnode.stanza' +check:rc==0 +cmd: scp $$DSTMN:/tmp/export_import_single_boston_by_json_$$DSTMN/dstbogusnode.stanza /tmp/export_import_single_boston_by_json/dstbogusnode.stanza +check:rc==0 +cmd: cat /tmp/export_import_single_boston_by_json/dstbogusnode.stanza +check:rc==0 +cmd:diff -y /tmp/export_import_single_boston_by_json/srcbogusnode.stanza /tmp/export_import_single_boston_by_json/dstbogusnode.stanza +check:rc==0 +cmd:ssh $$DSTMN 'rmdef bogusnode' +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_boston_by_json/bogusnode.stanza ]]; then cat /tmp/export_import_single_boston_by_json/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_boston_by_json/bogusgroup.stanza ]]; then cat /tmp/export_import_single_boston_by_json/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_boston_by_json_$$DSTMN/bogusnode.stanza ]]; then cat /tmp/export_import_single_boston_by_json_$$DSTMN/bogusnode.stanza | mkdef -z;fi' +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_boston_by_json_$$DSTMN/bogusgroup.stanza ]]; then cat /tmp/export_import_single_boston_by_json_$$DSTMN/bogusgroup.stanza |mkdef -z -f;fi' +check:rc==0 +cmd:ssh $$DSTMN 'rm -rf /tmp/export_import_single_boston_by_json_$$DSTMN/' +check:rc==0 +cmd:rm -rf /tmp/export_import_single_boston_by_json +check:rc==0 +end + +start:export_import_single_witherspoon_by_yaml +description:This case is used to test xcat-inventory export and import one witherspoon node 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. +cmd:mkdir -p /tmp/export_import_single_witherspoon_by_yaml +check:rc==0 +cmd:ssh $$DSTMN 'mkdir -p /tmp/export_import_single_witherspoon_by_yaml_$$DSTMN/' +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_import_single_witherspoon_by_yaml/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_witherspoon_by_yaml/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:ssh $$DSTMN 'lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_import_single_witherspoon_by_yaml_$$DSTMN/bogusnode.stanza ;rmdef bogusnode;fi' +check:rc==0 +cmd:ssh $$DSTMN 'lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_witherspoon_by_yaml_$$DSTMN/bogusgroup.stanza; rmdef -t group bogusgroup;fi' +check:rc==0 +cmd:mkdef -t node -o bogusnode groups=bogusgroup mgt=openbmc nodetype=mp addkcmdline=addkcmdline arch=ppc64le authdomain=authdomain bmc=bmc bmcpassword=bmcpassword bmcusername=bmcusername bmcvlantag=bmcvlantag cfgmgr=cfgmgr cfgmgtroles=cfgmgtroles cfgserver=cfgserver chain=chain chassis=chassis cmdmapping=cmdmapping cons=cons conserver=conserver consoleondemand=consoleondemand consport=consport cpucount=cpucount cputype=cputype dhcpinterfaces=dhcpinterfaces disksize=disksize domainadminpassword=domainadminpassword domainadminuser=domainadminuser domaintype=domaintype getmac=getmac height=height hidden=hidden hostcluster=hostcluster hostinterface=hostinterface hostmanager=hostmanager hostnames=hostnames hosttype=hosttype hwtype=hwtype installnic=installnic interface=interface ip=10.10.10.10 iscsipassword=iscsipassword iscsiserver=iscsiserver iscsitarget=iscsitarget iscsiuserid=iscsiuserid mac=42:d6:0a:03:05:08 memory=memory migrationdest=migrationdest monserver=monserver mpa=mpa mtm=mtm nameservers=nameservers netboot=grub2 nfsdir=nfsdir nfsserver=nfsserver nimserver=nimserver node=node ondiscover=ondiscover osvolume=osvolume otherinterfaces=otherinterfaces ou=ou pdu=pdu postbootscripts=postbootscripts postscripts=postscripts power=power prescripts-begin=prescripts-begin prescripts-end=prescripts-end primarynic=primarynic primarysn=primarysn productkey=productkey provmethod=provmethod rack=rack room=room routenames=routenames serial=serial serialflow=serialflow serialport=serialport serialspeed=serialspeed servicenode=servicenode setupconserver=0 setupdhcp=0 setupftp=setupftp setupipforward=0 setupldap=0 setupnameserver=0 setupnfs=0 setupnim=setupnim setupntp=0 setupproxydhcp=0 setuptftp=0 sfp=sfp side=side slot=slot storagcontroller=storagcontroller storagetype=storagetype supernode=supernode supportedarchs=supportedarchs supportproxydhcp=supportproxydhcp switch=switch switchinterface=switchinterface switchport=50 switchvlan=switchvlan syslog=syslog termport=termport termserver=termserver tftpdir=tftpdir tftpserver=tftpserver unit=unit usercomment=usercomment vmbeacon=vmbeacon vmbootorder=vmbootorder vmcfgstore=vmcfgstore vmcluster=vmcluster vmmanager=vmmanager vmmaster=vmmaster vmnicnicmodel=vmnicnicmodel vmphyslots=vmphyslots vmstorage=vmstorage vmstoragecache=vmstoragecache vmstorageformat=vmstorageformat vmstoragemodel=vmstoragemodel vmtextconsole=vmtextconsole vmvirtflags=vmvirtflags vmvncport=vmvncport xcatmaster=xcatmaster zonename=zonename nicaliases.eth0="moe larry curly" nicaliases.eth1="tom|jerry" niccustomscripts.eth0="configeth eth0" niccustomscripts.ib0="configib ib0" nicdevices.bond0="eth0|eth2" nicdevices.br0=bond0 nicextraparams.eth0="MTU=1500" nicextraparams.ib0="MTU=65520 CONNECTED_MODE=yes" nichostnameprefixes.eth0="eth0-" nichostnameprefixes.ib0="ib-" nichostnamesuffixes.eth0="-eth0" nichostnamesuffixes.ib0="-ib0" nicips.ib0=10.10.100.9 nicips.enP48p1s0f0=129.40.234.11 nicips.ib1=10.11.100.9 nicnetworks.enP5p1s0f1.4=xcat_bmc nicnetworks.enP48p1s0f1=xcat_util nicnetworks.ib0=IB00 nicnetworks.enP48p1s0f0=pub_yellow nicnetworks.ib3=IB03 nicnetworks.ib2=IB02 nicnetworks.enP5p1s0f1=xcat_compute nicnetworks.ib1=IB01 nicnetworks.enP5p1s0f1.5=xcat_infra nicnetworks.enP5p1s0f1.6=xcat_pdu nicsadapter.enP3p3s0f1="mac=98:be:94:59:fa:cd linkstate=DOWN" nicsadapter.enP3p3s0f2="mac=98:be:94:59:fa:ce candidatename=enP3p3s0f2/enx98be9459face" nictypes.enP5p1s0f1.4=unused nictypes.enP48p1s0f1=unused nictypes.ib0=Infiniband nictypes.enP48p1s0f0=Ethernet nictypes.ib3=unused nictypes.ib2=unused nictypes.enP5p1s0f1=unused nictypes.ib1=Infiniband nictypes.enP5p1s0f1.5=unused nictypes.enP5p1s0f1.6=unused +check:rc==0 +cmd:lsdef bogusnode -z|sort -t'=' -k1 |tee /tmp/export_import_single_witherspoon_by_yaml/srcbogusnode.stanza +check:rc==0 +cmd:xcat-inventory export --format=yaml -t node -o bogusnode |tee /tmp/export_import_single_witherspoon_by_yaml/bogusnode_yaml.inv +check:rc==0 +cmd:scp /tmp/export_import_single_witherspoon_by_yaml/bogusnode_yaml.inv $$DSTMN:/tmp/export_import_single_witherspoon_by_yaml_$$DSTMN/ +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd: ssh $$DSTMN 'xcat-inventory import -f /tmp/export_import_single_witherspoon_by_yaml_$$DSTMN/bogusnode_yaml.inv -t node -o bogusnode' +check:rc==0 +cmd: ssh $$DSTMN 'lsdef bogusnode -z |sort -t'=' -k1|tee /tmp/export_import_single_witherspoon_by_yaml_$$DSTMN/dstbogusnode.stanza' +check:rc==0 +cmd: scp $$DSTMN:/tmp/export_import_single_witherspoon_by_yaml_$$DSTMN/dstbogusnode.stanza /tmp/export_import_single_witherspoon_by_yaml/dstbogusnode.stanza +check:rc==0 +cmd: cat /tmp/export_import_single_witherspoon_by_yaml/dstbogusnode.stanza +check:rc==0 +cmd:diff -y /tmp/export_import_single_witherspoon_by_yaml/srcbogusnode.stanza /tmp/export_import_single_witherspoon_by_yaml/dstbogusnode.stanza +check:rc==0 +cmd:ssh $$DSTMN 'rmdef bogusnode' +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_witherspoon_by_yaml/bogusnode.stanza ]]; then cat /tmp/export_import_single_witherspoon_by_yaml/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_witherspoon_by_yaml/bogusgroup.stanza ]]; then cat /tmp/export_import_single_witherspoon_by_yaml/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_witherspoon_by_yaml_$$DSTMN/bogusnode.stanza ]]; then cat /tmp/export_import_single_witherspoon_by_yaml_$$DSTMN/bogusnode.stanza | mkdef -z;fi' +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_witherspoon_by_yaml_$$DSTMN/bogusgroup.stanza ]]; then cat /tmp/export_import_single_witherspoon_by_yaml_$$DSTMN/bogusgroup.stanza |mkdef -z -f;fi' +check:rc==0 +cmd:ssh $$DSTMN 'rm -rf /tmp/export_import_single_witherspoon_by_yaml_$$DSTMN/' +check:rc==0 +cmd:rm -rf /tmp/export_import_single_witherspoon_by_yaml +check:rc==0 +end + +start:export_import_single_witherspoon_by_json +description:This case is used to test xcat-inventory export and import one witherspoon node 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. +cmd:mkdir -p /tmp/export_import_single_witherspoon_by_json +check:rc==0 +cmd:ssh $$DSTMN 'mkdir -p /tmp/export_import_single_witherspoon_by_json_$$DSTMN/' +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_import_single_witherspoon_by_json/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_witherspoon_by_json/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:ssh $$DSTMN 'lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_import_single_witherspoon_by_json_$$DSTMN/bogusnode.stanza ;rmdef bogusnode;fi' +check:rc==0 +cmd:ssh $$DSTMN 'lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_witherspoon_by_json_$$DSTMN/bogusgroup.stanza; rmdef -t group bogusgroup;fi' +check:rc==0 +cmd:mkdef -t node -o bogusnode groups=bogusgroup mgt=openbmc nodetype=mp addkcmdline=addkcmdline arch=ppc64le authdomain=authdomain bmc=bmc bmcpassword=bmcpassword bmcusername=bmcusername bmcvlantag=bmcvlantag cfgmgr=cfgmgr cfgmgtroles=cfgmgtroles cfgserver=cfgserver chain=chain chassis=chassis cmdmapping=cmdmapping cons=cons conserver=conserver consoleondemand=consoleondemand consport=consport cpucount=cpucount cputype=cputype dhcpinterfaces=dhcpinterfaces disksize=disksize domainadminpassword=domainadminpassword domainadminuser=domainadminuser domaintype=domaintype getmac=getmac height=height hidden=hidden hostcluster=hostcluster hostinterface=hostinterface hostmanager=hostmanager hostnames=hostnames hosttype=hosttype hwtype=hwtype installnic=installnic interface=interface ip=10.10.10.10 iscsipassword=iscsipassword iscsiserver=iscsiserver iscsitarget=iscsitarget iscsiuserid=iscsiuserid mac=42:d6:0a:03:05:08 memory=memory migrationdest=migrationdest monserver=monserver mpa=mpa mtm=mtm nameservers=nameservers netboot=grub2 nfsdir=nfsdir nfsserver=nfsserver nimserver=nimserver node=node ondiscover=ondiscover osvolume=osvolume otherinterfaces=otherinterfaces ou=ou pdu=pdu postbootscripts=postbootscripts postscripts=postscripts power=power prescripts-begin=prescripts-begin prescripts-end=prescripts-end primarynic=primarynic primarysn=primarysn productkey=productkey provmethod=provmethod rack=rack room=room routenames=routenames serial=serial serialflow=serialflow serialport=serialport serialspeed=serialspeed servicenode=servicenode setupconserver=0 setupdhcp=0 setupftp=setupftp setupipforward=0 setupldap=0 setupnameserver=0 setupnfs=0 setupnim=setupnim setupntp=0 setupproxydhcp=0 setuptftp=0 sfp=sfp side=side slot=slot storagcontroller=storagcontroller storagetype=storagetype supernode=supernode supportedarchs=supportedarchs supportproxydhcp=supportproxydhcp switch=switch switchinterface=switchinterface switchport=50 switchvlan=switchvlan syslog=syslog termport=termport termserver=termserver tftpdir=tftpdir tftpserver=tftpserver unit=unit usercomment=usercomment vmbeacon=vmbeacon vmbootorder=vmbootorder vmcfgstore=vmcfgstore vmcluster=vmcluster vmmanager=vmmanager vmmaster=vmmaster vmnicnicmodel=vmnicnicmodel vmphyslots=vmphyslots vmstorage=vmstorage vmstoragecache=vmstoragecache vmstorageformat=vmstorageformat vmstoragemodel=vmstoragemodel vmtextconsole=vmtextconsole vmvirtflags=vmvirtflags vmvncport=vmvncport xcatmaster=xcatmaster zonename=zonename nicaliases.eth0="moe larry curly" nicaliases.eth1="tom|jerry" niccustomscripts.eth0="configeth eth0" niccustomscripts.ib0="configib ib0" nicdevices.bond0="eth0|eth2" nicdevices.br0=bond0 nicextraparams.eth0="MTU=1500" nicextraparams.ib0="MTU=65520 CONNECTED_MODE=yes" nichostnameprefixes.eth0="eth0-" nichostnameprefixes.ib0="ib-" nichostnamesuffixes.eth0="-eth0" nichostnamesuffixes.ib0="-ib0" nicips.ib0=10.10.100.9 nicips.enP48p1s0f0=129.40.234.11 nicips.ib1=10.11.100.9 nicnetworks.enP5p1s0f1.4=xcat_bmc nicnetworks.enP48p1s0f1=xcat_util nicnetworks.ib0=IB00 nicnetworks.enP48p1s0f0=pub_yellow nicnetworks.ib3=IB03 nicnetworks.ib2=IB02 nicnetworks.enP5p1s0f1=xcat_compute nicnetworks.ib1=IB01 nicnetworks.enP5p1s0f1.5=xcat_infra nicnetworks.enP5p1s0f1.6=xcat_pdu nicsadapter.enP3p3s0f1="mac=98:be:94:59:fa:cd linkstate=DOWN" nicsadapter.enP3p3s0f2="mac=98:be:94:59:fa:ce candidatename=enP3p3s0f2/enx98be9459face" nictypes.enP5p1s0f1.4=unused nictypes.enP48p1s0f1=unused nictypes.ib0=Infiniband nictypes.enP48p1s0f0=Ethernet nictypes.ib3=unused nictypes.ib2=unused nictypes.enP5p1s0f1=unused nictypes.ib1=Infiniband nictypes.enP5p1s0f1.5=unused nictypes.enP5p1s0f1.6=unused +check:rc==0 +cmd:lsdef bogusnode -z|sort -t'=' -k1 |tee /tmp/export_import_single_witherspoon_by_json/srcbogusnode.stanza +check:rc==0 +cmd:xcat-inventory export --format=json -t node -o bogusnode |tee /tmp/export_import_single_witherspoon_by_json/bogusnode_json.inv +check:rc==0 +cmd:scp /tmp/export_import_single_witherspoon_by_json/bogusnode_json.inv $$DSTMN:/tmp/export_import_single_witherspoon_by_json_$$DSTMN/ +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd: ssh $$DSTMN 'xcat-inventory import -f /tmp/export_import_single_witherspoon_by_json_$$DSTMN/bogusnode_json.inv -t node -o bogusnode' +check:rc==0 +cmd: ssh $$DSTMN 'lsdef bogusnode -z |sort -t'=' -k1|tee /tmp/export_import_single_witherspoon_by_json_$$DSTMN/dstbogusnode.stanza' +check:rc==0 +cmd: scp $$DSTMN:/tmp/export_import_single_witherspoon_by_json_$$DSTMN/dstbogusnode.stanza /tmp/export_import_single_witherspoon_by_json/dstbogusnode.stanza +check:rc==0 +cmd: cat /tmp/export_import_single_witherspoon_by_json/dstbogusnode.stanza +check:rc==0 +cmd:diff -y /tmp/export_import_single_witherspoon_by_json/srcbogusnode.stanza /tmp/export_import_single_witherspoon_by_json/dstbogusnode.stanza +check:rc==0 +cmd:ssh $$DSTMN 'rmdef bogusnode' +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_witherspoon_by_json/bogusnode.stanza ]]; then cat /tmp/export_import_single_witherspoon_by_json/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_witherspoon_by_json/bogusgroup.stanza ]]; then cat /tmp/export_import_single_witherspoon_by_json/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_witherspoon_by_json_$$DSTMN/bogusnode.stanza ]]; then cat /tmp/export_import_single_witherspoon_by_json_$$DSTMN/bogusnode.stanza | mkdef -z;fi' +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_witherspoon_by_json_$$DSTMN/bogusgroup.stanza ]]; then cat /tmp/export_import_single_witherspoon_by_json_$$DSTMN/bogusgroup.stanza |mkdef -z -f;fi' +check:rc==0 +cmd:ssh $$DSTMN 'rm -rf /tmp/export_import_single_witherspoon_by_json_$$DSTMN/' +check:rc==0 +cmd:rm -rf /tmp/export_import_single_witherspoon_by_json +check:rc==0 +end + + +start:export_import_single_switch_by_json +description:This case is used to test xcat-inventory export and import one switch node 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. +cmd:mkdir -p /tmp/export_import_single_switch_by_json +check:rc==0 +cmd:ssh $$DSTMN 'mkdir -p /tmp/export_import_single_switch_by_json_$$DSTMN/' +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_import_single_switch_by_json/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_switch_by_json/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:ssh $$DSTMN 'lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_import_single_switch_by_json_$$DSTMN/bogusnode.stanza ;rmdef bogusnode;fi' +check:rc==0 +cmd:ssh $$DSTMN 'lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_switch_by_json_$$DSTMN/bogusgroup.stanza; rmdef -t group bogusgroup;fi' +check:rc==0 +cmd:mkdef -t node -o bogusnode groups=bogusgroup mgt=switch nodetype=switch addkcmdline=addkcmdline arch=ppc64 authdomain=authdomain cfgmgr=cfgmgr cfgmgtroles=cfgmgtroles cfgserver=cfgserver chain=chain chassis=chassis cmdmapping=cmdmapping cons=cons conserver=conserver consoleondemand=consoleondemand cpucount=cpucount cputype=cputype dhcpinterfaces=dhcpinterfaces disksize=disksize domainadminpassword=domainadminpassword domainadminuser=domainadminuser domaintype=domaintype getmac=getmac height=height hidden=hidden hostcluster=hostcluster hostinterface=hostinterface hostmanager=hostmanager hostnames=hostnames hosttype=hosttype installnic=installnic interface=interface ip=10.10.10.10 iscsipassword=iscsipassword iscsiserver=iscsiserver iscsitarget=iscsitarget iscsiuserid=iscsiuserid linkports=linkports mac=42:d6:0a:03:05:08 memory=memory migrationdest=migrationdest monserver=monserver mpa=mpa mtm=mtm nameservers=nameservers netboot=grub2 nfsdir=nfsdir nfsserver=nfsserver nimserver=nimserver node=node ondiscover=ondiscover osvolume=osvolume otherinterfaces=otherinterfaces ou=ou password=password pdu=pdu postbootscripts=postbootscripts postscripts=postscripts power=power prescripts-begin=prescripts-begin prescripts-end=prescripts-end primarynic=primarynic primarysn=primarysn productkey=productkey protocol=ssh provmethod=provmethod rack=rack room=room routenames=routenames serial=serial serialflow=serialflow serialport=serialport serialspeed=serialspeed servicenode=servicenode setupconserver=0 setupdhcp=0 setupftp=setupftp setupipforward=0 setupldap=0 setupnameserver=0 setupnfs=0 setupnim=setupnim setupntp=0 setupproxydhcp=0 setuptftp=0 sfp=sfp side=side slot=slot snmpauth=SHA snmppassword=snmppassword snmpprivacy=DES snmpusername=snmpusername snmpversion=SNMPv1 storagcontroller=storagcontroller storagetype=storagetype supernode=supernode supportedarchs=supportedarchs supportproxydhcp=supportproxydhcp switch=switch switchinterface=switchinterface switchport=50 switchtype=switchtype switchvlan=switchvlan syslog=syslog termport=termport termserver=termserver tftpdir=tftpdir tftpserver=tftpserver unit=unit usercomment=usercomment username=username vmbeacon=vmbeacon vmbootorder=vmbootorder vmcfgstore=vmcfgstore vmcluster=vmcluster vmmanager=vmmanager vmmaster=vmmaster vmnicnicmodel=vmnicnicmodel vmphyslots=vmphyslots vmstorage=vmstorage vmstoragecache=vmstoragecache vmstorageformat=vmstorageformat vmstoragemodel=vmstoragemodel vmtextconsole=vmtextconsole vmvirtflags=vmvirtflags vmvncport=vmvncport xcatmaster=xcatmaster zonename=zonename nicaliases.eth0="moe larry curly" nicaliases.eth1="tom|jerry" niccustomscripts.eth0="configeth eth0" niccustomscripts.ib0="configib ib0" nicdevices.bond0="eth0|eth2" nicdevices.br0=bond0 nicextraparams.eth0="MTU=1500" nicextraparams.ib0="MTU=65520 CONNECTED_MODE=yes" nichostnameprefixes.eth0="eth0-" nichostnameprefixes.ib0="ib-" nichostnamesuffixes.eth0="-eth0" nichostnamesuffixes.ib0="-ib0" nicips.ib0=10.10.100.9 nicips.enP48p1s0f0=129.40.234.11 nicips.ib1=10.11.100.9 nicnetworks.enP5p1s0f1.4=xcat_bmc nicnetworks.enP48p1s0f1=xcat_util nicnetworks.ib0=IB00 nicnetworks.enP48p1s0f0=pub_yellow nicnetworks.ib3=IB03 nicnetworks.ib2=IB02 nicnetworks.enP5p1s0f1=xcat_compute nicnetworks.ib1=IB01 nicnetworks.enP5p1s0f1.5=xcat_infra nicnetworks.enP5p1s0f1.6=xcat_pdu nicsadapter.enP3p3s0f1="mac=98:be:94:59:fa:cd linkstate=DOWN" nicsadapter.enP3p3s0f2="mac=98:be:94:59:fa:ce candidatename=enP3p3s0f2/enx98be9459face" nictypes.enP5p1s0f1.4=unused nictypes.enP48p1s0f1=unused nictypes.ib0=Infiniband nictypes.enP48p1s0f0=Ethernet nictypes.ib3=unused nictypes.ib2=unused nictypes.enP5p1s0f1=unused nictypes.ib1=Infiniband nictypes.enP5p1s0f1.5=unused nictypes.enP5p1s0f1.6=unused +check:rc==0 +cmd:lsdef bogusnode -z|sort -t'=' -k1 |tee /tmp/export_import_single_switch_by_json/srcbogusnode.stanza +check:rc==0 +cmd:xcat-inventory export --format=json -t node -o bogusnode |tee /tmp/export_import_single_switch_by_json/bogusnode_json.inv +check:rc==0 +cmd:scp /tmp/export_import_single_switch_by_json/bogusnode_json.inv $$DSTMN:/tmp/export_import_single_switch_by_json_$$DSTMN/ +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd: ssh $$DSTMN 'xcat-inventory import -f /tmp/export_import_single_switch_by_json_$$DSTMN/bogusnode_json.inv -t node -o bogusnode' +check:rc==0 +cmd: ssh $$DSTMN 'lsdef bogusnode -z |sort -t'=' -k1|tee /tmp/export_import_single_switch_by_json_$$DSTMN/dstbogusnode.stanza' +check:rc==0 +cmd: scp $$DSTMN:/tmp/export_import_single_switch_by_json_$$DSTMN/dstbogusnode.stanza /tmp/export_import_single_switch_by_json/dstbogusnode.stanza +check:rc==0 +cmd: cat /tmp/export_import_single_switch_by_json/dstbogusnode.stanza +check:rc==0 +cmd:diff -y /tmp/export_import_single_switch_by_json/srcbogusnode.stanza /tmp/export_import_single_switch_by_json/dstbogusnode.stanza +check:rc==0 +cmd:ssh $$DSTMN 'rmdef bogusnode' +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_switch_by_json/bogusnode.stanza ]]; then cat /tmp/export_import_single_switch_by_json/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_switch_by_json/bogusgroup.stanza ]]; then cat /tmp/export_import_single_switch_by_json/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_switch_by_json_$$DSTMN/bogusnode.stanza ]]; then cat /tmp/export_import_single_switch_by_json_$$DSTMN/bogusnode.stanza | mkdef -z;fi' +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_switch_by_json_$$DSTMN/bogusgroup.stanza ]]; then cat /tmp/export_import_single_switch_by_json_$$DSTMN/bogusgroup.stanza |mkdef -z -f;fi' +check:rc==0 +cmd:ssh $$DSTMN 'rm -rf /tmp/export_import_single_switch_by_json_$$DSTMN/' +check:rc==0 +cmd:rm -rf /tmp/export_import_single_switch_by_json +check:rc==0 +end + +start:export_import_single_switch_by_yaml +description:This case is used to test xcat-inventory export and import one switch node 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. +cmd:mkdir -p /tmp/export_import_single_switch_by_yaml +check:rc==0 +cmd:ssh $$DSTMN 'mkdir -p /tmp/export_import_single_switch_by_yaml_$$DSTMN/' +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_import_single_switch_by_yaml/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_switch_by_yaml/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:ssh $$DSTMN 'lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_import_single_switch_by_yaml_$$DSTMN/bogusnode.stanza ;rmdef bogusnode;fi' +check:rc==0 +cmd:ssh $$DSTMN 'lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_switch_by_yaml_$$DSTMN/bogusgroup.stanza; rmdef -t group bogusgroup;fi' +check:rc==0 +cmd:mkdef -t node -o bogusnode groups=bogusgroup mgt=switch nodetype=switch addkcmdline=addkcmdline arch=ppc64 authdomain=authdomain cfgmgr=cfgmgr cfgmgtroles=cfgmgtroles cfgserver=cfgserver chain=chain chassis=chassis cmdmapping=cmdmapping cons=cons conserver=conserver consoleondemand=consoleondemand cpucount=cpucount cputype=cputype dhcpinterfaces=dhcpinterfaces disksize=disksize domainadminpassword=domainadminpassword domainadminuser=domainadminuser domaintype=domaintype getmac=getmac height=height hidden=hidden hostcluster=hostcluster hostinterface=hostinterface hostmanager=hostmanager hostnames=hostnames hosttype=hosttype installnic=installnic interface=interface ip=10.10.10.10 iscsipassword=iscsipassword iscsiserver=iscsiserver iscsitarget=iscsitarget iscsiuserid=iscsiuserid linkports=linkports mac=42:d6:0a:03:05:08 memory=memory migrationdest=migrationdest monserver=monserver mpa=mpa mtm=mtm nameservers=nameservers netboot=grub2 nfsdir=nfsdir nfsserver=nfsserver nimserver=nimserver node=node ondiscover=ondiscover osvolume=osvolume otherinterfaces=otherinterfaces ou=ou password=password pdu=pdu postbootscripts=postbootscripts postscripts=postscripts power=power prescripts-begin=prescripts-begin prescripts-end=prescripts-end primarynic=primarynic primarysn=primarysn productkey=productkey protocol=ssh provmethod=provmethod rack=rack room=room routenames=routenames serial=serial serialflow=serialflow serialport=serialport serialspeed=serialspeed servicenode=servicenode setupconserver=0 setupdhcp=0 setupftp=setupftp setupipforward=0 setupldap=0 setupnameserver=0 setupnfs=0 setupnim=setupnim setupntp=0 setupproxydhcp=0 setuptftp=0 sfp=sfp side=side slot=slot snmpauth=SHA snmppassword=snmppassword snmpprivacy=DES snmpusername=snmpusername snmpversion=SNMPv1 storagcontroller=storagcontroller storagetype=storagetype supernode=supernode supportedarchs=supportedarchs supportproxydhcp=supportproxydhcp switch=switch switchinterface=switchinterface switchport=50 switchtype=switchtype switchvlan=switchvlan syslog=syslog termport=termport termserver=termserver tftpdir=tftpdir tftpserver=tftpserver unit=unit usercomment=usercomment username=username vmbeacon=vmbeacon vmbootorder=vmbootorder vmcfgstore=vmcfgstore vmcluster=vmcluster vmmanager=vmmanager vmmaster=vmmaster vmnicnicmodel=vmnicnicmodel vmphyslots=vmphyslots vmstorage=vmstorage vmstoragecache=vmstoragecache vmstorageformat=vmstorageformat vmstoragemodel=vmstoragemodel vmtextconsole=vmtextconsole vmvirtflags=vmvirtflags vmvncport=vmvncport xcatmaster=xcatmaster zonename=zonename nicaliases.eth0="moe larry curly" nicaliases.eth1="tom|jerry" niccustomscripts.eth0="configeth eth0" niccustomscripts.ib0="configib ib0" nicdevices.bond0="eth0|eth2" nicdevices.br0=bond0 nicextraparams.eth0="MTU=1500" nicextraparams.ib0="MTU=65520 CONNECTED_MODE=yes" nichostnameprefixes.eth0="eth0-" nichostnameprefixes.ib0="ib-" nichostnamesuffixes.eth0="-eth0" nichostnamesuffixes.ib0="-ib0" nicips.ib0=10.10.100.9 nicips.enP48p1s0f0=129.40.234.11 nicips.ib1=10.11.100.9 nicnetworks.enP5p1s0f1.4=xcat_bmc nicnetworks.enP48p1s0f1=xcat_util nicnetworks.ib0=IB00 nicnetworks.enP48p1s0f0=pub_yellow nicnetworks.ib3=IB03 nicnetworks.ib2=IB02 nicnetworks.enP5p1s0f1=xcat_compute nicnetworks.ib1=IB01 nicnetworks.enP5p1s0f1.5=xcat_infra nicnetworks.enP5p1s0f1.6=xcat_pdu nicsadapter.enP3p3s0f1="mac=98:be:94:59:fa:cd linkstate=DOWN" nicsadapter.enP3p3s0f2="mac=98:be:94:59:fa:ce candidatename=enP3p3s0f2/enx98be9459face" nictypes.enP5p1s0f1.4=unused nictypes.enP48p1s0f1=unused nictypes.ib0=Infiniband nictypes.enP48p1s0f0=Ethernet nictypes.ib3=unused nictypes.ib2=unused nictypes.enP5p1s0f1=unused nictypes.ib1=Infiniband nictypes.enP5p1s0f1.5=unused nictypes.enP5p1s0f1.6=unused +check:rc==0 +cmd:lsdef bogusnode -z|sort -t'=' -k1 |tee /tmp/export_import_single_switch_by_yaml/srcbogusnode.stanza +check:rc==0 +cmd:xcat-inventory export --format=yaml -t node -o bogusnode |tee /tmp/export_import_single_switch_by_yaml/bogusnode_yaml.inv +check:rc==0 +cmd:scp /tmp/export_import_single_switch_by_yaml/bogusnode_yaml.inv $$DSTMN:/tmp/export_import_single_switch_by_yaml_$$DSTMN/ +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd: ssh $$DSTMN 'xcat-inventory import -f /tmp/export_import_single_switch_by_yaml_$$DSTMN/bogusnode_yaml.inv -t node -o bogusnode' +check:rc==0 +cmd: ssh $$DSTMN 'lsdef bogusnode -z |sort -t'=' -k1|tee /tmp/export_import_single_switch_by_yaml_$$DSTMN/dstbogusnode.stanza' +check:rc==0 +cmd: scp $$DSTMN:/tmp/export_import_single_switch_by_yaml_$$DSTMN/dstbogusnode.stanza /tmp/export_import_single_switch_by_yaml/dstbogusnode.stanza +check:rc==0 +cmd: cat /tmp/export_import_single_switch_by_yaml/dstbogusnode.stanza +check:rc==0 +cmd:diff -y /tmp/export_import_single_switch_by_yaml/srcbogusnode.stanza /tmp/export_import_single_switch_by_yaml/dstbogusnode.stanza +check:rc==0 +cmd:ssh $$DSTMN 'rmdef bogusnode' +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_switch_by_yaml/bogusnode.stanza ]]; then cat /tmp/export_import_single_switch_by_yaml/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_switch_by_yaml/bogusgroup.stanza ]]; then cat /tmp/export_import_single_switch_by_yaml/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_switch_by_yaml_$$DSTMN/bogusnode.stanza ]]; then cat /tmp/export_import_single_switch_by_yaml_$$DSTMN/bogusnode.stanza | mkdef -z;fi' +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_switch_by_yaml_$$DSTMN/bogusgroup.stanza ]]; then cat /tmp/export_import_single_switch_by_yaml_$$DSTMN/bogusgroup.stanza |mkdef -z -f;fi' +check:rc==0 +cmd:ssh $$DSTMN 'rm -rf /tmp/export_import_single_switch_by_yaml_$$DSTMN/' +check:rc==0 +cmd:rm -rf /tmp/export_import_single_switch_by_yaml +check:rc==0 +end + + +start:export_import_nodes_delimited_with_comma_by_yaml +description:This case is used to test xcat-inventory export and import the definition of nodes delimited with comma 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. +cmd:mkdir -p /tmp/export_import_nodes_delimited_with_comma_by_yaml +check:rc==0 +cmd:ssh $$DSTMN 'mkdir -p /tmp/export_import_nodes_delimited_with_comma_by_yaml_$$DSTMN/' +check:rc==0 +cmd:for i in 1 2 3; do lsdef bogusnode$i > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode$i -z >> /tmp/export_import_nodes_delimited_with_comma_by_yaml/bogusnode.stanza ;rmdef bogusnode$i;fi; done +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_nodes_delimited_with_comma_by_yaml/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:ssh $$DSTMN 'for i in 1 2 3; do lsdef bogusnode$i > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode$i -z >> /tmp/export_import_nodes_delimited_with_comma_by_yaml_$$DSTMN/bogusnode.stanza ;rmdef bogusnode$i;fi; done' +check:rc==0 +cmd:ssh $$DSTMN 'lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_nodes_delimited_with_comma_by_yaml_$$DSTMN/bogusgroup.stanza; rmdef -t group bogusgroup;fi' +check:rc==0 +cmd:mkdef bogusnode[1-3] groups=bogusgroup mgt=openbmc cons=openbmc netboot=petitboot +check:rc==0 +cmd:lsdef bogusnode[1-3] -z|sort -t'=' -k1 |tee /tmp/export_import_nodes_delimited_with_comma_by_yaml/srcbogusnode.stanza +check:rc==0 +cmd:xcat-inventory export --format=yaml -t node -o bogusnode1,bogusnode2,bogusnode3 |tee /tmp/export_import_nodes_delimited_with_comma_by_yaml/bogusnode_yaml.inv +check:rc==0 +cmd:scp /tmp/export_import_nodes_delimited_with_comma_by_yaml/bogusnode_yaml.inv $$DSTMN:/tmp/export_import_nodes_delimited_with_comma_by_yaml_$$DSTMN/ +check:rc==0 +cmd:rmdef bogusnode[1-3] +check:rc==0 +cmd: ssh $$DSTMN 'xcat-inventory import -f /tmp/export_import_nodes_delimited_with_comma_by_yaml_$$DSTMN/bogusnode_yaml.inv -t node -o bogusnode1,bogusnode2,bogusnode3' +check:rc==0 +cmd: ssh $$DSTMN 'lsdef bogusnode[1-3] -z|sort -t'=' -k1 |tee /tmp/export_import_nodes_delimited_with_comma_by_yaml_$$DSTMN/dstbogusnode.stanza' +check:rc==0 +cmd: scp $$DSTMN:/tmp/export_import_nodes_delimited_with_comma_by_yaml_$$DSTMN/dstbogusnode.stanza /tmp/export_import_nodes_delimited_with_comma_by_yaml/dstbogusnode.stanza +check:rc==0 +cmd: cat /tmp/export_import_nodes_delimited_with_comma_by_yaml/dstbogusnode.stanza +check:rc==0 +cmd:diff -y /tmp/export_import_nodes_delimited_with_comma_by_yaml/srcbogusnode.stanza /tmp/export_import_nodes_delimited_with_comma_by_yaml/dstbogusnode.stanza +check:rc==0 +cmd:ssh $$DSTMN 'rmdef bogusnode[1-3]' +check:rc==0 +cmd:if [[ -e /tmp/export_import_nodes_delimited_with_comma_by_yaml/bogusnode.stanza ]]; then cat /tmp/export_import_nodes_delimited_with_comma_by_yaml/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/export_import_nodes_delimited_with_comma_by_yaml/bogusgroup.stanza ]];then cat /tmp/export_import_nodes_delimited_with_comma_by_yaml/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_nodes_delimited_with_comma_by_yaml_$$DSTMN/bogusnode.stanza ]]; then cat /tmp/export_import_nodes_delimited_with_comma_by_yaml_$$DSTMN/bogusnode.stanza | mkdef -z;fi' +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_nodes_delimited_with_comma_by_yaml_$$DSTMN/bogusgroup.stanza ]];then cat /tmp/export_import_nodes_delimited_with_comma_by_yaml_$$DSTMN/bogusgroup.stanza |mkdef -z -f;fi' +check:rc==0 +cmd:ssh $$DSTMN 'rm -rf /tmp/export_import_nodes_delimited_with_comma_by_yaml_$$DSTMN/' +check:rc==0 +cmd:rm -rf /tmp/export_import_nodes_delimited_with_comma_by_yaml +check:rc==0 +end + +start:export_import_nodes_delimited_with_comma_by_json +description:This case is used to test xcat-inventory export and import the definition of nodes delimited with comma 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. +cmd:mkdir -p /tmp/export_import_nodes_delimited_with_comma_by_json +check:rc==0 +cmd:ssh $$DSTMN 'mkdir -p /tmp/export_import_nodes_delimited_with_comma_by_json_$$DSTMN/' +check:rc==0 +cmd:for i in 1 2 3; do lsdef bogusnode$i > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode$i -z >> /tmp/export_import_nodes_delimited_with_comma_by_json/bogusnode.stanza ;rmdef bogusnode$i;fi; done +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_nodes_delimited_with_comma_by_json/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:ssh $$DSTMN 'for i in 1 2 3; do lsdef bogusnode$i > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode$i -z >> /tmp/export_import_nodes_delimited_with_comma_by_json_$$DSTMN/bogusnode.stanza ;rmdef bogusnode$i;fi; done' +check:rc==0 +cmd:ssh $$DSTMN 'lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_nodes_delimited_with_comma_by_json_$$DSTMN/bogusgroup.stanza; rmdef -t group bogusgroup;fi' +check:rc==0 +cmd:mkdef bogusnode[1-3] groups=bogusgroup mgt=openbmc cons=openbmc netboot=petitboot +check:rc==0 +cmd:lsdef bogusnode[1-3] -z|sort -t'=' -k1 |tee /tmp/export_import_nodes_delimited_with_comma_by_json/srcbogusnode.stanza +check:rc==0 +cmd:xcat-inventory export --format=json -t node -o bogusnode1,bogusnode2,bogusnode3 |tee /tmp/export_import_nodes_delimited_with_comma_by_json/bogusnode_json.inv +check:rc==0 +cmd:scp /tmp/export_import_nodes_delimited_with_comma_by_json/bogusnode_json.inv $$DSTMN:/tmp/export_import_nodes_delimited_with_comma_by_json_$$DSTMN/ +check:rc==0 +cmd:rmdef bogusnode[1-3] +check:rc==0 +cmd: ssh $$DSTMN 'xcat-inventory import -f /tmp/export_import_nodes_delimited_with_comma_by_json_$$DSTMN/bogusnode_json.inv -t node -o bogusnode1,bogusnode2,bogusnode3' +check:rc==0 +cmd: ssh $$DSTMN 'lsdef bogusnode[1-3] -z|sort -t'=' -k1 |tee /tmp/export_import_nodes_delimited_with_comma_by_json_$$DSTMN/dstbogusnode.stanza' +check:rc==0 +cmd: scp $$DSTMN:/tmp/export_import_nodes_delimited_with_comma_by_json_$$DSTMN/dstbogusnode.stanza /tmp/export_import_nodes_delimited_with_comma_by_json/dstbogusnode.stanza +check:rc==0 +cmd: cat /tmp/export_import_nodes_delimited_with_comma_by_json/dstbogusnode.stanza +check:rc==0 +cmd:diff -y /tmp/export_import_nodes_delimited_with_comma_by_json/srcbogusnode.stanza /tmp/export_import_nodes_delimited_with_comma_by_json/dstbogusnode.stanza +check:rc==0 +cmd:ssh $$DSTMN 'rmdef bogusnode[1-3]' +check:rc==0 +cmd:if [[ -e /tmp/export_import_nodes_delimited_with_comma_by_json/bogusnode.stanza ]]; then cat /tmp/export_import_nodes_delimited_with_comma_by_json/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/export_import_nodes_delimited_with_comma_by_json/bogusgroup.stanza ]];then cat /tmp/export_import_nodes_delimited_with_comma_by_json/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_nodes_delimited_with_comma_by_json_$$DSTMN/bogusnode.stanza ]]; then cat /tmp/export_import_nodes_delimited_with_comma_by_json_$$DSTMN/bogusnode.stanza | mkdef -z;fi' +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_nodes_delimited_with_comma_by_json_$$DSTMN/bogusgroup.stanza ]];then cat /tmp/export_import_nodes_delimited_with_comma_by_json_$$DSTMN/bogusgroup.stanza |mkdef -z -f;fi' +check:rc==0 +cmd:ssh $$DSTMN 'rm -rf /tmp/export_import_nodes_delimited_with_comma_by_json_$$DSTMN/' +check:rc==0 +cmd:rm -rf /tmp/export_import_nodes_delimited_with_comma_by_json +check:rc==0 +end + + +start:xcat_inventory_try_to_export_nonexisted_node +description:This case is used to test xcat-inventory export a nonexisted node +cmd:mkdir -p /tmp/xcat_inventory_try_to_export_nonexisted_node +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/xcat_inventory_try_to_export_nonexisted_node/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd: xcat-inventory export --format=json -t node -o bogusnode +check:output=~Error: cannot find objects: bogusnode! +check:rc!=0 +cmd: xcat-inventory export --format=yaml -t node -o bogusnode +check:output=~Error: cannot find objects: bogusnode! +check:rc!=0 +cmd:if [[ -e /tmp/xcat_inventory_try_to_export_nonexisted_node/bogusnode.stanza ]]; then cat /tmp/xcat_inventory_try_to_export_nonexisted_node/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:rm -rf /tmp/xcat_inventory_try_to_export_nonexisted_node +check:rc==0 +end + +start:xcat_inventory_try_to_import_nonexisted_node +description:This case is used to test xcat-inventory import a nonexisted node +cmd:mkdir -p /tmp/xcat_inventory_try_to_import_nonexisted_node +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/xcat_inventory_try_to_import_nonexisted_node/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd:mkdef -t node -o bogusnode groups=test +check:rc==0 +cmd:xcat-inventory export --format=json -t node -o bogusnode |tee /tmp/xcat_inventory_try_to_import_nonexisted_node/json +check:rc==0 +cmd:xcat-inventory import -f /tmp/xcat_inventory_try_to_import_nonexisted_node/json -t node -o bogusnode1 +check:output=~Error: cannot find objects: bogusnode1! +check:rc!=0 +cmd:xcat-inventory export --format=yaml -t node -o bogusnode |tee /tmp/xcat_inventory_try_to_import_nonexisted_node/yaml +check:rc==0 +cmd:xcat-inventory import -f /tmp/xcat_inventory_try_to_import_nonexisted_node/yaml -t node -o bogusnode1 +check:output=~Error: cannot find objects: bogusnode1! +check:rc!=0 +cmd:rmdef bogusnode +check:rc==0 +cmd:if [[ -e /tmp/xcat_inventory_try_to_import_nonexisted_node/bogusnode.stanza ]]; then cat /tmp/xcat_inventory_try_to_import_nonexisted_node/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:rm -rf /tmp/xcat_inventory_try_to_import_nonexisted_node +check:rc==0 +end + +start:xcat_inventory_try_to_export_all_type_is_node_default_format +description:This case is used to test xcat-inventory export all definition which type is node by default format. I.e, do not specify the format of export. +cmd:mkdir -p /tmp/xcat_inventory_try_to_export_all_type_is_node_default_format +check:rc==0 +cmd:for i in 1 2 3; do lsdef bogusnode$i > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode$i -z >> /tmp/xcat_inventory_try_to_export_all_type_is_node_default_format/bogusnode.stanza ;rmdef bogusnode$i;fi;done +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z >> /tmp/xcat_inventory_try_to_export_all_type_is_node_default_format/bogusnode.stanza;rmdef -t group bogusgroup; fi +check:rc==0 +cmd:mkdef -t group bogusgroup +check:rc==0 +cmd:mkdef bogusnode[1-3] groups=bogusgroup +check:rc==0 +cmd:lsdef -t node|tee /tmp/xcat_inventory_try_to_export_all_type_is_node_default_format/node_in_xcat_db +check:rc==0 +cmd:lsdef -t group -i grouptype -c|grep "grouptype=static" |tee /tmp/xcat_inventory_try_to_export_all_type_is_node_default_format/group_in_xcat_db +check:rc==0 +#To test if "xcat-inventory export -t node" works correctly +cmd:xcat-inventory export -t node |tee /tmp/xcat_inventory_try_to_export_all_type_is_node_default_format/export_all_node +check:rc==0 +cmd: grep " \"xcatdefaults\": " /tmp/xcat_inventory_try_to_export_all_type_is_node_default_format/export_all_node > /dev/null 2>&1; if [[ $? -eq 0 ]]; then exit 0; else exit 1;fi +check:rc==0 +cmd: grep " \"service\": " /tmp/xcat_inventory_try_to_export_all_type_is_node_default_format/export_all_node > /dev/null 2>&1; if [[ $? -eq 0 ]]; then exit 0; else exit 1;fi +check:rc==0 +cmd:dn=$(cat /tmp/xcat_inventory_try_to_export_all_type_is_node_default_format/node_in_xcat_db|wc -l);dg=$(cat /tmp/xcat_inventory_try_to_export_all_type_is_node_default_format/group_in_xcat_db |wc -l);((da=$dn+$dg+2));echo "dn=$dn dg=$dg da=$da";ia=$(grep " \"obj_type\": " /tmp/xcat_inventory_try_to_export_all_type_is_node_default_format/export_all_node|wc -l);echo "ia=$ia"; if [[ $da -eq $ia ]];then exit 0; else exit 1;fi +check:rc==0 +cmd:a=0;for i in `awk -F':' '{print $1}' /tmp/xcat_inventory_try_to_export_all_type_is_node_default_format/group_in_xcat_db`; do grep -E " \"$i\": " /tmp/xcat_inventory_try_to_export_all_type_is_node_default_format/export_all_node; if [[ $? -eq 0 ]]; then ((a++));fi;done;dg=$(cat /tmp/xcat_inventory_try_to_export_all_type_is_node_default_format/group_in_xcat_db|wc -l);if [[ $a -eq $dg ]]; then exit 0; else exit 1;fi +check:rc==0 +cmd:a=0;for i in `awk -F' ' '{print $1}' /tmp/xcat_inventory_try_to_export_all_type_is_node_default_format/node_in_xcat_db`;do grep -E " \"$i\": " /tmp/xcat_inventory_try_to_export_all_type_is_node_default_format/export_all_node; if [[ $? -eq 0 ]]; then ((a++));fi;done;dn=$(cat /tmp/xcat_inventory_try_to_export_all_type_is_node_default_format/node_in_xcat_db |wc -l); if [[ $dn -eq $a ]]; then exit 0; else exit 1;fi +check:rc==0 +cmd:rmdef bogusnode[1-3] +check:rc==0 +cmd:rmdef -t group bogusgroup +check:rc==0 +cmd:if [[ -e /tmp/xcat_inventory_try_to_export_all_type_is_node_default_format/bogusnode.stanza ]]; then cat /tmp/xcat_inventory_try_to_export_all_type_is_node_default_format/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/xcat_inventory_try_to_export_all_type_is_node_default_format/bogusgroup.stanza ]];then cat /tmp/xcat_inventory_try_to_export_all_type_is_node_default_format/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:rm -rf /tmp/xcat_inventory_try_to_export_all_type_is_node_default_format +check:rc==0 +end + + +start:xcat_inventory_try_to_export_all_type_is_node_yaml_format +description:This case is used to test xcat-inventory export all definition which type is node by yaml format. +cmd:mkdir -p /tmp/xcat_inventory_try_to_export_all_type_is_node_yaml_format +check:rc==0 +cmd:for i in 1 2 3; do lsdef bogusnode$i > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode$i -z >> /tmp/xcat_inventory_try_to_export_all_type_is_node_yaml_format/bogusnode.stanza ;rmdef bogusnode$i;fi;done +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z >> /tmp/xcat_inventory_try_to_export_all_type_is_node_yaml_format/bogusnode.stanza;rmdef -t group bogusgroup; fi +check:rc==0 +cmd:mkdef -t group bogusgroup +check:rc==0 +cmd:mkdef bogusnode[1-3] groups=bogusgroup +check:rc==0 +cmd:lsdef -t node|tee /tmp/xcat_inventory_try_to_export_all_type_is_node_yaml_format/node_in_xcat_db +check:rc==0 +cmd: lsdef -t group -i grouptype -c|grep "grouptype=static"| tee /tmp/xcat_inventory_try_to_export_all_type_is_node_yaml_format/group_in_xcat_db +check:rc==0 +#To test if "xcat-inventory export --format=yaml -t node |tee /tmp/xcat_inventory_try_to_export_all_type_is_node_yaml_format/export_all_node +cmd:xcat-inventory export --format=yaml -t node |tee /tmp/xcat_inventory_try_to_export_all_type_is_node_yaml_format/export_all_node +check:rc==0 +cmd: grep " xcatdefaults:" /tmp/xcat_inventory_try_to_export_all_type_is_node_yaml_format/export_all_node > /dev/null 2>&1; if [[ $? -eq 0 ]]; then exit 0; else exit 1;fi +check:rc==0 +cmd: grep " service:" /tmp/xcat_inventory_try_to_export_all_type_is_node_yaml_format/export_all_node > /dev/null 2>&1; if [[ $? -eq 0 ]]; then exit 0; else exit 1;fi +check:rc==0 +cmd:dn=$(cat /tmp/xcat_inventory_try_to_export_all_type_is_node_yaml_format/node_in_xcat_db|wc -l);dg=$(cat /tmp/xcat_inventory_try_to_export_all_type_is_node_yaml_format/group_in_xcat_db |wc -l);((da=$dn+$dg+2));ia=$(grep " obj_type: " /tmp/xcat_inventory_try_to_export_all_type_is_node_yaml_format/export_all_node|wc -l); if [[ $da -eq $ia ]];then exit 0; else exit 1;fi +check:rc==0 +cmd:a=0;for i in `awk -F':' '{print $1}' /tmp/xcat_inventory_try_to_export_all_type_is_node_yaml_format/group_in_xcat_db`; do grep -E " $i:" /tmp/xcat_inventory_try_to_export_all_type_is_node_yaml_format/export_all_node; if [[ $? -eq 0 ]]; then ((a++));fi;done;dg=$(cat /tmp/xcat_inventory_try_to_export_all_type_is_node_yaml_format/group_in_xcat_db|wc -l);if [[ $a -eq $dg ]]; then exit 0; else exit 1;fi +check:rc==0 +cmd:a=0;for i in `awk -F' ' '{print $1}' /tmp/xcat_inventory_try_to_export_all_type_is_node_yaml_format/node_in_xcat_db`;do grep -E " $i:" /tmp/xcat_inventory_try_to_export_all_type_is_node_yaml_format/export_all_node; if [[ $? -eq 0 ]]; then ((a++));fi;done;dn=$(cat /tmp/xcat_inventory_try_to_export_all_type_is_node_yaml_format/node_in_xcat_db |wc -l); if [[ $dn -eq $a ]]; then exit 0; else exit 1;fi +check:rc==0 +cmd:rmdef bogusnode[1-3] +check:rc==0 +cmd:rmdef -t group bogusgroup +check:rc==0 +cmd:if [[ -e /tmp/xcat_inventory_try_to_export_all_type_is_node_yaml_format/bogusnode.stanza ]]; then cat /tmp/xcat_inventory_try_to_export_all_type_is_node_yaml_format/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/xcat_inventory_try_to_export_all_type_is_node_yaml_format/bogusgroup.stanza ]];then cat /tmp/xcat_inventory_try_to_export_all_type_is_node_yaml_format/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:rm -rf /tmp/xcat_inventory_try_to_export_all_type_is_node_yaml_format +check:rc==0 +end + + +start:xcat_inventory_try_to_export_all_type_is_node_json_format +description:This case is used to test xcat-inventory export all definition which type is node by json format. +cmd:mkdir -p /tmp/xcat_inventory_try_to_export_all_type_is_node_json_format +check:rc==0 +cmd:for i in 1 2 3; do lsdef bogusnode$i > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode$i -z >> /tmp/xcat_inventory_try_to_export_all_type_is_node_json_format/bogusnode.stanza ;rmdef bogusnode$i;fi;done +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z >> /tmp/xcat_inventory_try_to_export_all_type_is_node_json_format/bogusnode.stanza;rmdef -t group bogusgroup; fi +check:rc==0 +cmd:mkdef -t group bogusgroup +check:rc==0 +cmd:mkdef bogusnode[1-3] groups=bogusgroup +check:rc==0 +cmd:lsdef -t node|tee /tmp/xcat_inventory_try_to_export_all_type_is_node_json_format/node_in_xcat_db +check:rc==0 +cmd:lsdef -t group -i grouptype -c|grep "grouptype=static" |tee /tmp/xcat_inventory_try_to_export_all_type_is_node_json_format/group_in_xcat_db +check:rc==0 +cmd:xcat-inventory export --format=json -t node |tee /tmp/xcat_inventory_try_to_export_all_type_is_node_json_format/export_all_node +check:rc==0 +cmd: grep " \"xcatdefaults\": " /tmp/xcat_inventory_try_to_export_all_type_is_node_json_format/export_all_node > /dev/null 2>&1; if [[ $? -eq 0 ]]; then exit 0; else exit 1;fi +check:rc==0 +cmd: grep " \"service\": " /tmp/xcat_inventory_try_to_export_all_type_is_node_json_format/export_all_node > /dev/null 2>&1; if [[ $? -eq 0 ]]; then exit 0; else exit 1;fi +check:rc==0 +cmd:dn=$(cat /tmp/xcat_inventory_try_to_export_all_type_is_node_json_format/node_in_xcat_db|wc -l);dg=$(cat /tmp/xcat_inventory_try_to_export_all_type_is_node_json_format/group_in_xcat_db |wc -l);((da=$dn+$dg+2));ia=$(grep " \"obj_type\": " /tmp/xcat_inventory_try_to_export_all_type_is_node_json_format/export_all_node|wc -l); if [[ $da -eq $ia ]];then exit 0; else exit 1;fi +check:rc==0 +cmd:a=0;for i in `awk -F':' '{print $1}' /tmp/xcat_inventory_try_to_export_all_type_is_node_json_format/group_in_xcat_db`; do grep " \"$i\": " /tmp/xcat_inventory_try_to_export_all_type_is_node_json_format/export_all_node; if [[ $? -eq 0 ]]; then ((a++));fi;done;dg=$(cat /tmp/xcat_inventory_try_to_export_all_type_is_node_json_format/group_in_xcat_db|wc -l);if [[ $a -eq $dg ]]; then exit 0; else exit 1;fi +check:rc==0 +cmd:a=0;for i in `awk -F' ' '{print $1}' /tmp/xcat_inventory_try_to_export_all_type_is_node_json_format/node_in_xcat_db`;do grep -E " \"$i\": " /tmp/xcat_inventory_try_to_export_all_type_is_node_json_format/export_all_node; if [[ $? -eq 0 ]]; then ((a++));fi;done;dn=$(cat /tmp/xcat_inventory_try_to_export_all_type_is_node_json_format/node_in_xcat_db |wc -l); if [[ $dn -eq $a ]]; then exit 0; else exit 1;fi +check:rc==0 +cmd:rmdef bogusnode[1-3] +check:rc==0 +cmd:rmdef -t group bogusgroup +check:rc==0 +cmd:if [[ -e /tmp/xcat_inventory_try_to_export_all_type_is_node_json_format/bogusnode.stanza ]]; then cat /tmp/xcat_inventory_try_to_export_all_type_is_node_json_format/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/xcat_inventory_try_to_export_all_type_is_node_json_format/bogusgroup.stanza ]];then cat /tmp/xcat_inventory_try_to_export_all_type_is_node_json_format/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:rm -rf /tmp/xcat_inventory_try_to_export_all_type_is_node_json_format +check:rc==0 +end + +start:xcat_inventory_try_to_import_all_type_is_node_yaml_format +description:This case is used to test xcat-inventory import all definition which type is node from a yaml file. +cmd:mkdir -p /tmp/xcat_inventory_try_to_import_all_type_is_node_yaml_format +check:rc==0 +cmd:for i in 1 2 3; do lsdef bogusnode$i > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode$i -z >> /tmp/xcat_inventory_try_to_import_all_type_is_node_yaml_format/bogusnode.stanza ;rmdef bogusnode$i;fi;done +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z >> /tmp/xcat_inventory_try_to_import_all_type_is_node_yaml_format/bogusnode.stanza;rmdef -t group bogusgroup; fi +check:rc==0 +cmd:#!/usr/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: + bogusgroup: + device_type: server + engines: + console_engine: + engine_type: openbmc + hardware_mgt_engine: + engine_info: + bmc: '|\D+(\d+)|10.100.100.($1)|' + bmcpassword: 0penBmc + bmcusername: root + engine_type: openbmc + netboot_engine: + engine_type: petitboot + obj_info: + grouptype: static + obj_type: group + role: compute + bogusnode1: + device_type: server + engines: + console_engine: + engine_type: openbmc + hardware_mgt_engine: + engine_info: + bmc: 10.100.100.1 + bmcpassword: 0penBmc + bmcusername: root + engine_type: openbmc + netboot_engine: + engine_type: petitboot + obj_info: + groups: bogusgroup + obj_type: node + role: compute + bogusnode2: + device_type: server + engines: + console_engine: + engine_type: openbmc + hardware_mgt_engine: + engine_info: + bmc: 10.100.100.2 + bmcpassword: 0penBmc + bmcusername: root + engine_type: openbmc + netboot_engine: + engine_type: petitboot + obj_info: + groups: bogusgroup + obj_type: node + role: compute + bogusnode3: + device_type: server + engines: + console_engine: + engine_type: openbmc + hardware_mgt_engine: + engine_info: + bmc: 10.100.100.3 + bmcpassword: 0penBmc + bmcusername: root + engine_type: openbmc + netboot_engine: + engine_type: petitboot + 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 + rhels7.4-ppc64le-install-compute: + basic_attributes: + arch: ppc64le + distribution: rhels7.4 + osdistro: rhels7.4-ppc64le + osname: Linux + imagetype: linux + package_selection: + otherpkgdir: /install/post/otherpkgs/rhels7.4/ppc64le + pkgdir: /install/rhels7.4/ppc64le + pkglist: /opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist + provision_mode: install + role: compute + template: /opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl + rhels7.4-ppc64le-install-service: + basic_attributes: + arch: ppc64le + distribution: rhels7.4 + osdistro: rhels7.4-ppc64le + osname: Linux + imagetype: linux + package_selection: + otherpkgdir: /install/post/otherpkgs/rhels7.4/ppc64le + otherpkglist: /opt/xcat/share/xcat/install/rh/service.rhels7.ppc64le.otherpkgs.pkglist + pkgdir: /install/rhels7.4/ppc64le + pkglist: /opt/xcat/share/xcat/install/rh/service.rhels7.ppc64le.pkglist + provision_mode: install + role: service + scripts: + postscripts: servicenode + template: /opt/xcat/share/xcat/install/rh/service.rhels7.tmpl + rhels7.4-ppc64le-netboot-compute: + basic_attributes: + arch: ppc64le + distribution: rhels7.4 + osdistro: rhels7.4-ppc64le + osname: Linux + genimgoptions: + exlist: /opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.exlist + postinstall: /opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.postinstall + rootimgdir: /install/netboot/rhels7.4/ppc64le/compute + imagetype: linux + package_selection: + otherpkgdir: /install/post/otherpkgs/rhels7.4/ppc64le + pkgdir: /install/rhels7.4/ppc64le + pkglist: /opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.pkglist + provision_mode: netboot + role: compute + rhels7.4-ppc64le-stateful-mgmtnode: + basic_attributes: + arch: ppc64le + distribution: rhels7.4 + osdistro: rhels7.4-ppc64le + osname: Linux + imagetype: linux + package_selection: + otherpkgdir: /install/post/otherpkgs/rhels7.4/ppc64le + pkgdir: /install/rhels7.4/ppc64le + pkglist: /opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist + provision_mode: install + role: compute + template: /opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl + rhels7.4-ppc64le-statelite-compute: + basic_attributes: + arch: ppc64le + distribution: rhels7.4 + osdistro: rhels7.4-ppc64le + osname: Linux + genimgoptions: + exlist: /opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.exlist + postinstall: /opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.postinstall + rootimgdir: /install/netboot/rhels7.4/ppc64le/compute + imagetype: linux + package_selection: + otherpkgdir: /install/post/otherpkgs/rhels7.4/ppc64le + pkgdir: /install/rhels7.4/ppc64le + pkglist: /opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.pkglist + 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: {} +schema_version: '1.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.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_node_yaml_format/yaml.test +check:rc==0 +cmd:xcat-inventory import -f /tmp/xcat_inventory_try_to_import_all_type_is_node_yaml_format/yaml.test -t node +check:rc==0 +cmd:#!/bin/bash +echo "# +bogusnode1: + objtype=node + bmc=10.100.100.1 + bmcpassword=0penBmc + bmcusername=root + cons=openbmc + groups=bogusgroup + mgt=openbmc + netboot=petitboot +bogusnode2: + objtype=node + bmc=10.100.100.2 + bmcpassword=0penBmc + bmcusername=root + cons=openbmc + groups=bogusgroup + mgt=openbmc + netboot=petitboot +bogusnode3: + objtype=node + bmc=10.100.100.3 + bmcpassword=0penBmc + bmcusername=root + cons=openbmc + groups=bogusgroup + mgt=openbmc + netboot=petitboot" > /tmp/xcat_inventory_try_to_import_all_type_is_node_yaml_format/node_stanza_from_import_file +check:rc==0 +cmd:lsdef bogusnode[1-3] -z | sed -e '/^\s*$/d' > /tmp/xcat_inventory_try_to_import_all_type_is_node_yaml_format/node_stanza_after_import +check:rc==0 +cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_node_yaml_format/node_stanza_from_import_file /tmp/xcat_inventory_try_to_import_all_type_is_node_yaml_format/node_stanza_after_import +check:rc==0 +cmd:tabdump site|grep 100.3.5.8 +check:rc!=0 +cmd:tabdump networks|grep 100_0_0_0-255_0_0_0 +check:rc!=0 +cmd:rmdef bogusnode[1-3] +check:rc==0 +cmd:if [[ -e /tmp/xcat_inventory_try_to_import_all_type_is_node_yaml_format/bogusnode.stanza ]]; then cat /tmp/xcat_inventory_try_to_import_all_type_is_node_yaml_format/bogusnode.stanza | mkdef -z -f;fi +check:rc==0 +cmd:if [[ -e /tmp/xcat_inventory_try_to_import_all_type_is_node_yaml_format/bogusgroup.stanza ]];then cat /tmp/xcat_inventory_try_to_import_all_type_is_node_yaml_format/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:rm -rf /tmp/xcat_inventory_try_to_import_all_type_is_node_yaml_format +check:rc==0 +end + + +start:xcat_inventory_try_to_import_all_type_is_node_json_format +description:This case is used to test xcat-inventory import all definition which type is node from a yaml file. +cmd:mkdir -p /tmp/xcat_inventory_try_to_import_all_type_is_node_json_format +check:rc==0 +cmd:for i in 1 2 3; do lsdef bogusnode$i > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode$i -z >> /tmp/xcat_inventory_try_to_import_all_type_is_node_json_format/bogusnode.stanza ;rmdef bogusnode$i;fi;done +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z >> /tmp/xcat_inventory_try_to_import_all_type_is_node_json_format/bogusnode.stanza;rmdef -t group bogusgroup; fi +check:rc==0 +cmd:#!/usr/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": { + "bogusgroup": { + "device_type": "server", + "engines": { + "console_engine": { + "engine_type": "openbmc" + }, + "hardware_mgt_engine": { + "engine_info": { + "bmc": "|\\D+(\\d+)|10.100.100.($1)|", + "bmcpassword": "0penBmc", + "bmcusername": "root" + }, + "engine_type": "openbmc" + }, + "netboot_engine": { + "engine_type": "petitboot" + } + }, + "obj_info": { + "grouptype": "static" + }, + "obj_type": "group", + "role": "compute" + }, + "bogusnode1": { + "device_type": "server", + "engines": { + "console_engine": { + "engine_type": "openbmc" + }, + "hardware_mgt_engine": { + "engine_info": { + "bmc": "10.100.100.1", + "bmcpassword": "0penBmc", + "bmcusername": "root" + }, + "engine_type": "openbmc" + }, + "netboot_engine": { + "engine_type": "petitboot" + } + }, + "obj_info": { + "groups": "bogusgroup" + }, + "obj_type": "node", + "role": "compute" + }, + "bogusnode2": { + "device_type": "server", + "engines": { + "console_engine": { + "engine_type": "openbmc" + }, + "hardware_mgt_engine": { + "engine_info": { + "bmc": "10.100.100.2", + "bmcpassword": "0penBmc", + "bmcusername": "root" + }, + "engine_type": "openbmc" + }, + "netboot_engine": { + "engine_type": "petitboot" + } + }, + "obj_info": { + "groups": "bogusgroup" + }, + "obj_type": "node", + "role": "compute" + }, + "bogusnode3": { + "device_type": "server", + "engines": { + "console_engine": { + "engine_type": "openbmc" + }, + "hardware_mgt_engine": { + "engine_info": { + "bmc": "10.100.100.3", + "bmcpassword": "0penBmc", + "bmcusername": "root" + }, + "engine_type": "openbmc" + }, + "netboot_engine": { + "engine_type": "petitboot" + } + }, + "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" + }, + "rhels7.4-ppc64le-install-compute": { + "basic_attributes": { + "arch": "ppc64le", + "distribution": "rhels7.4", + "osdistro": "rhels7.4-ppc64le", + "osname": "Linux" + }, + "imagetype": "linux", + "package_selection": { + "otherpkgdir": "/install/post/otherpkgs/rhels7.4/ppc64le", + "pkgdir": "/install/rhels7.4/ppc64le", + "pkglist": "/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist" + }, + "provision_mode": "install", + "role": "compute", + "template": "/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl" + }, + "rhels7.4-ppc64le-install-service": { + "basic_attributes": { + "arch": "ppc64le", + "distribution": "rhels7.4", + "osdistro": "rhels7.4-ppc64le", + "osname": "Linux" + }, + "imagetype": "linux", + "package_selection": { + "otherpkgdir": "/install/post/otherpkgs/rhels7.4/ppc64le", + "otherpkglist": "/opt/xcat/share/xcat/install/rh/service.rhels7.ppc64le.otherpkgs.pkglist", + "pkgdir": "/install/rhels7.4/ppc64le", + "pkglist": "/opt/xcat/share/xcat/install/rh/service.rhels7.ppc64le.pkglist" + }, + "provision_mode": "install", + "role": "service", + "scripts": { + "postscripts": "servicenode" + }, + "template": "/opt/xcat/share/xcat/install/rh/service.rhels7.tmpl" + }, + "rhels7.4-ppc64le-netboot-compute": { + "basic_attributes": { + "arch": "ppc64le", + "distribution": "rhels7.4", + "osdistro": "rhels7.4-ppc64le", + "osname": "Linux" + }, + "genimgoptions": { + "exlist": "/opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.exlist", + "postinstall": "/opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.postinstall", + "rootimgdir": "/install/netboot/rhels7.4/ppc64le/compute" + }, + "imagetype": "linux", + "package_selection": { + "otherpkgdir": "/install/post/otherpkgs/rhels7.4/ppc64le", + "pkgdir": "/install/rhels7.4/ppc64le", + "pkglist": "/opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.pkglist" + }, + "provision_mode": "netboot", + "role": "compute" + }, + "rhels7.4-ppc64le-stateful-mgmtnode": { + "basic_attributes": { + "arch": "ppc64le", + "distribution": "rhels7.4", + "osdistro": "rhels7.4-ppc64le", + "osname": "Linux" + }, + "imagetype": "linux", + "package_selection": { + "otherpkgdir": "/install/post/otherpkgs/rhels7.4/ppc64le", + "pkgdir": "/install/rhels7.4/ppc64le", + "pkglist": "/opt/xcat/share/xcat/install/rh/compute.rhels7.pkglist" + }, + "provision_mode": "install", + "role": "compute", + "template": "/opt/xcat/share/xcat/install/rh/compute.rhels7.tmpl" + }, + "rhels7.4-ppc64le-statelite-compute": { + "basic_attributes": { + "arch": "ppc64le", + "distribution": "rhels7.4", + "osdistro": "rhels7.4-ppc64le", + "osname": "Linux" + }, + "genimgoptions": { + "exlist": "/opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.exlist", + "postinstall": "/opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.postinstall", + "rootimgdir": "/install/netboot/rhels7.4/ppc64le/compute" + }, + "imagetype": "linux", + "package_selection": { + "otherpkgdir": "/install/post/otherpkgs/rhels7.4/ppc64le", + "pkgdir": "/install/rhels7.4/ppc64le", + "pkglist": "/opt/xcat/share/xcat/netboot/rh/compute.rhels7.ppc64le.pkglist" + }, + "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": {}, + "schema_version": "1.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.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_node_json_format/json.test +check:rc==0 +cmd:xcat-inventory import -f /tmp/xcat_inventory_try_to_import_all_type_is_node_json_format/json.test -t node +check:rc==0 +cmd:#!/bin/bash +echo "# +bogusnode1: + objtype=node + bmc=10.100.100.1 + bmcpassword=0penBmc + bmcusername=root + cons=openbmc + groups=bogusgroup + mgt=openbmc + netboot=petitboot +bogusnode2: + objtype=node + bmc=10.100.100.2 + bmcpassword=0penBmc + bmcusername=root + cons=openbmc + groups=bogusgroup + mgt=openbmc + netboot=petitboot +bogusnode3: + objtype=node + bmc=10.100.100.3 + bmcpassword=0penBmc + bmcusername=root + cons=openbmc + groups=bogusgroup + mgt=openbmc + netboot=petitboot" > /tmp/xcat_inventory_try_to_import_all_type_is_node_json_format/node_stanza_from_import_file +check:rc==0 +cmd:lsdef bogusnode[1-3] -z | sed -e '/^\s*$/d' > /tmp/xcat_inventory_try_to_import_all_type_is_node_json_format/node_stanza_after_import +check:rc==0 +cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_node_json_format/node_stanza_from_import_file /tmp/xcat_inventory_try_to_import_all_type_is_node_json_format/node_stanza_after_import +check:rc==0 +cmd:tabdump site|grep 100.3.5.8 +check:rc!=0 +cmd:tabdump networks|grep 100_0_0_0-255_0_0_0 +check:rc!=0 +cmd:rmdef bogusnode[1-3] +check:rc==0 +cmd:if [[ -e /tmp/xcat_inventory_try_to_import_all_type_is_node_json_format/bogusnode.stanza ]]; then cat /tmp/xcat_inventory_try_to_import_all_type_is_node_json_format/bogusnode.stanza | mkdef -z -f;fi +check:rc==0 +cmd:if [[ -e /tmp/xcat_inventory_try_to_import_all_type_is_node_json_format/bogusgroup.stanza ]];then cat /tmp/xcat_inventory_try_to_import_all_type_is_node_json_format/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:rm -rf /tmp/xcat_inventory_try_to_import_all_type_is_node_json_format +check:rc==0 +end + +start:export_more_nodes_import_part_nodes_json +description:This case is used to test xcat-inventory import all definition which type is node from a yaml file. +cmd:mkdir -p /tmp/export_more_nodes_import_part_nodes_json +check:rc==0 +cmd:for i in 1 2 3; do lsdef bogusnode$i > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode$i -z >> /tmp/export_more_nodes_import_part_nodes_json/bogusnode.stanza ;rmdef bogusnode$i;fi;done +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z >> /tmp/export_more_nodes_import_part_nodes_json/bogusnode.stanza;rmdef -t group bogusgroup; fi +check:rc==0 +cmd:mkdef bogusnode[1-3] groups=bogusgroup +check:rc==0 +cmd:#!/bin/bash +echo '# +bogusnode1: + objtype=node + groups=bogusgroup +bogusnode2: + objtype=node + groups=bogusgroup' > /tmp/export_more_nodes_import_part_nodes_json/nodes.bogus +check:rc==0 +cmd:xcat-inventory export --format=json -t node -o bogusnode1,bogusnode2,bogusnode3|tee /tmp/export_more_nodes_import_part_nodes_json/nodes.export +check:rc==0 +cmd:rmdef bogusnode[1-3] +check:rc==0 +cmd:xcat-inventory import -f /tmp/export_more_nodes_import_part_nodes_json/nodes.export -t node -o bogusnode1,bogusnode2 +check:rc==0 +cmd:lsdef -t node bogusnode1,bogusnode2 -z |sed -e '/^\s*$/d' > /tmp/export_more_nodes_import_part_nodes_json/nodes.import +check:rc==0 +cmd:diff -y /tmp/export_more_nodes_import_part_nodes_json/nodes.bogus /tmp/export_more_nodes_import_part_nodes_json/nodes.import +check:rc==0 +cmd:lsdef -t node bogusnode3 +check:output=~Error: Could not find an object +check:rc!=0 +cmd:rmdef bogusnode[1-2] +check:rc==0 +cmd:if [[ -e /tmp/export_more_nodes_import_part_nodes_json/bogusnode.stanza ]]; then cat /tmp/export_more_nodes_import_part_nodes_json/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/export_more_nodes_import_part_nodes_json/bogusgroup.stanza ]];then cat /tmp/export_more_nodes_import_part_nodes_json/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:rm -rf /tmp/export_more_nodes_import_part_nodes_json +check:rc==0 +end + +start:export_more_nodes_import_part_nodes_yaml +description:This case is used to test xcat-inventory import all definition which type is node from a yaml file. +cmd:mkdir -p /tmp/export_more_nodes_import_part_nodes_yaml +check:rc==0 +cmd:for i in 1 2 3; do lsdef bogusnode$i > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode$i -z >> /tmp/export_more_nodes_import_part_nodes_yaml/bogusnode.stanza ;rmdef bogusnode$i;fi;done +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z >> /tmp/export_more_nodes_import_part_nodes_yaml/bogusnode.stanza;rmdef -t group bogusgroup; fi +check:rc==0 +cmd:mkdef bogusnode[1-3] groups=bogusgroup +check:rc==0 +cmd:#!/bin/bash +echo '# +bogusnode1: + objtype=node + groups=bogusgroup +bogusnode2: + objtype=node + groups=bogusgroup' > /tmp/export_more_nodes_import_part_nodes_yaml/nodes.bogus +check:rc==0 +cmd:xcat-inventory export --format=yaml -t node -o bogusnode1,bogusnode2,bogusnode3|tee /tmp/export_more_nodes_import_part_nodes_yaml/nodes.export +check:rc==0 +cmd:rmdef bogusnode[1-3] +check:rc==0 +cmd:xcat-inventory import -f /tmp/export_more_nodes_import_part_nodes_yaml/nodes.export -t node -o bogusnode1,bogusnode2 +check:rc==0 +cmd:lsdef -t node bogusnode1,bogusnode2 -z |sed -e '/^\s*$/d' > /tmp/export_more_nodes_import_part_nodes_yaml/nodes.import +check:rc==0 +cmd:diff -y /tmp/export_more_nodes_import_part_nodes_yaml/nodes.bogus /tmp/export_more_nodes_import_part_nodes_yaml/nodes.import +check:rc==0 +cmd:lsdef -t node bogusnode3 +check:output=~Error: Could not find an object +check:rc!=0 +cmd:rmdef bogusnode[1-2] +check:rc==0 +cmd:if [[ -e /tmp/export_more_nodes_import_part_nodes_yaml/bogusnode.stanza ]]; then cat /tmp/export_more_nodes_import_part_nodes_yaml/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/export_more_nodes_import_part_nodes_yaml/bogusgroup.stanza ]];then cat /tmp/export_more_nodes_import_part_nodes_yaml/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:rm -rf /tmp/export_more_nodes_import_part_nodes_yaml +check:rc==0 +end + +start:export_single_node_then_modify_yaml_then_import +description:This case is used to test xcat-inventory import a node , then modify the export yaml file, then import the yaml file +Attribute: $$DSTMN - the ip of MN which is used to run import operation. +cmd:mkdir -p /tmp/export_single_node_then_modify_yaml_then_import +check:rc==0 +cmd:ssh $$DSTMN 'mkdir -p /tmp/export_single_node_then_modify_yaml_then_import_$$DSTMN/' +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_single_node_then_modify_yaml_then_import/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_single_node_then_modify_yaml_then_import/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:ssh $$DSTMN 'lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_single_node_then_modify_yaml_then_import_$$DSTMN/bogusnode.stanza ;rmdef bogusnode;fi' +check:rc==0 +cmd:ssh $$DSTMN 'lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_single_node_then_modify_yaml_then_import_$$DSTMN/bogusgroup.stanza; rmdef -t group bogusgroup;fi' +check:rc==0 +cmd:mkdef -t node -o bogusnode groups=bogusgroup mgt=openbmc nodetype=mp addkcmdline=1111 arch=ppc64 authdomain=1111 bmc=1111 bmcpassword=1111 bmcusername=1111 bmcvlantag=1111 cfgmgr=1111 cfgmgtroles=1111 cfgserver=1111 chain=1111 chassis=1111 cmdmapping=1111 cons=1111 conserver=1111 consoleondemand=1111 consport=1111 cpucount=1111 cputype=1111 dhcpinterfaces=1111 disksize=1111 domainadminpassword=1111 domainadminuser=1111 domaintype=1111 getmac=1111 height=1111 hidden=1111 hostcluster=1111 hostinterface=1111 hostmanager=1111 hostnames=1111 hosttype=1111 hwtype=1111 installnic=1111 interface=1111 ip=10.10.10.10 iscsipassword=1111 iscsiserver=1111 iscsitarget=1111 iscsiuserid=1111 mac=42:d6:0a:03:05:08 memory=1111 migrationdest=1111 monserver=1111 mpa=1111 mtm=1111 nameservers=1111 netboot=grub2 nfsdir=1111 nfsserver=1111 nimserver=1111 node=1111 ondiscover=1111 osvolume=1111 otherinterfaces=1111 ou=1111 pdu=1111 postbootscripts=1111 postscripts=1111 power=1111 prescripts-begin=1111 prescripts-end=1111 primarynic=1111 primarysn=1111 productkey=1111 provmethod=1111 rack=1111 room=1111 routenames=1111 serial=1111 serialflow=1111 serialport=1111 serialspeed=1111 servicenode=1111 setupconserver=1 setupdhcp=1 setupftp=1111 setupipforward=1 setupldap=1 setupnameserver=1 setupnfs=1 setupnim=1111 setupntp=1 setupproxydhcp=1 setuptftp=1 sfp=1111 side=1111 slot=1111 storagcontroller=1111 storagetype=1111 supernode=1111 supportedarchs=1111 supportproxydhcp=1111 switch=1111 switchinterface=1111 switchport=1111 switchvlan=1111 syslog=1111 termport=1111 termserver=1111 tftpdir=1111 tftpserver=1111 unit=1111 usercomment=1111 vmbeacon=1111 vmbootorder=1111 vmcfgstore=1111 vmcluster=1111 vmmanager=1111 vmmaster=1111 vmnicnicmodel=1111 vmphyslots=1111 vmstorage=1111 vmstoragecache=1111 vmstorageformat=1111 vmstoragemodel=1111 vmtextconsole=1111 vmvirtflags=1111 vmvncport=1111 xcatmaster=1111 zonename=1111 nicaliases.eth0="moe larry curly" nicaliases.eth1="tom|jerry" niccustomscripts.eth0="configeth eth0" niccustomscripts.ib0="configib ib0" nicdevices.bond0="eth0|eth2" nicdevices.br0=bond0 nicextraparams.eth0="MTU=1500" nicextraparams.ib0="MTU=65520 CONNECTED_MODE=yes" nichostnameprefixes.eth0="eth0-" nichostnameprefixes.ib0="ib-" nichostnamesuffixes.eth0="-eth0" nichostnamesuffixes.ib0="-ib0" nicips.ib0=10.10.100.9 nicips.enP48p1s0f0=129.40.234.11 nicips.ib1=10.11.100.9 nicnetworks.enP5p1s0f1.4=xcat_bmc nicnetworks.enP48p1s0f1=xcat_util nicnetworks.ib0=IB00 nicnetworks.enP48p1s0f0=pub_yellow nicnetworks.ib3=IB03 nicnetworks.ib2=IB02 nicnetworks.enP5p1s0f1=xcat_compute nicnetworks.ib1=IB01 nicnetworks.enP5p1s0f1.5=xcat_infra nicnetworks.enP5p1s0f1.6=xcat_pdu nicsadapter.enP3p3s0f1="mac=98:be:94:59:fa:cd linkstate=DOWN" nicsadapter.enP3p3s0f2="mac=98:be:94:59:fa:ce candidatename=enP3p3s0f2/enx98be9459face" nictypes.enP5p1s0f1.4=unused nictypes.enP48p1s0f1=unused nictypes.ib0=Infiniband nictypes.enP48p1s0f0=Ethernet nictypes.ib3=unused nictypes.ib2=unused nictypes.enP5p1s0f1=unused nictypes.ib1=Infiniband nictypes.enP5p1s0f1.5=unused nictypes.enP5p1s0f1.6=unused +cmd:lsdef bogusnode -z|sed 's/1111/2222/g'|sed 's/unused/used/g'|sed 's/10.10.100.9/20.10.200.9/g'|sort -t'=' -k1 |tee /tmp/export_single_node_then_modify_yaml_then_import/srcbogusnode.stanza +check:rc==0 +cmd:sed -i 's/arch=ppc64/arch=ppc64le/g' /tmp/export_single_node_then_modify_yaml_then_import/srcbogusnode.stanza +check:rc==0 +cmd:sed -i 's/ip=10.10.10.10/ip=10.20.10.20/g' /tmp/export_single_node_then_modify_yaml_then_import/srcbogusnode.stanza +check:rc==0 +cmd:sed -i 's/mac=42:d6:0a:03:05:08/mac=42:d6:0a:03:05:09/g' /tmp/export_single_node_then_modify_yaml_then_import/srcbogusnode.stanza +check:rc==0 +cmd:sed -i 's/netboot=grub2/netboot=petitboot/g' /tmp/export_single_node_then_modify_yaml_then_import/srcbogusnode.stanza +check:rc==0 +cmd:a=('setuptftp' 'setupnameserver' 'setupdhcp' 'setupntp' 'setupldap' 'setupproxydhcp' 'setupipforward' 'setupconserver' 'setupnfs');for i in ${a[@]};do sed -i "s/$i=1/$i=0/g" /tmp/export_single_node_then_modify_yaml_then_import/srcbogusnode.stanza; done +check:rc==0 +cmd:xcat-inventory export --format=yaml -t node -o bogusnode |tee /tmp/export_single_node_then_modify_yaml_then_import/bogusnode_yaml.inv +check:rc==0 +cmd:sed -i 's/1111/2222/g' /tmp/export_single_node_then_modify_yaml_then_import/bogusnode_yaml.inv +check:rc==0 +cmd:sed -i 's/unused/used/g' /tmp/export_single_node_then_modify_yaml_then_import/bogusnode_yaml.inv +check:rc==0 +cmd:sed -i 's/10.10.100.9/20.10.200.9/g' /tmp/export_single_node_then_modify_yaml_then_import/bogusnode_yaml.inv +check:rc==0 + +cmd:sed -i "s/arch: '*ppc64'*/arch: 'ppc64le'/g" /tmp/export_single_node_then_modify_yaml_then_import/bogusnode_yaml.inv +check:rc==0 +cmd:sed -i "s/ip: '*10.10.10.10'*/ip: '10.20.10.20'/g" /tmp/export_single_node_then_modify_yaml_then_import/bogusnode_yaml.inv +check:rc==0 +cmd:sed -i 's/- 42:d6:0a:03:05:08/- 42:d6:0a:03:05:09/g' /tmp/export_single_node_then_modify_yaml_then_import/bogusnode_yaml.inv +check:rc==0 +cmd:sed -i 's/ grub2/ petitboot/g' /tmp/export_single_node_then_modify_yaml_then_import/bogusnode_yaml.inv +check:rc==0 +cmd:a=('setuptftp' 'setupnameserver' 'setupdhcp' 'setupntp' 'setupldap' 'setupproxydhcp' 'setupipforward' 'setupconserver' 'setupnfs');for i in ${a[@]};do sed -i "s/$i: '*1'*/$i: '0'/g" /tmp/export_single_node_then_modify_yaml_then_import/bogusnode_yaml.inv; done +check:rc==0 + +cmd:scp /tmp/export_single_node_then_modify_yaml_then_import/bogusnode_yaml.inv $$DSTMN:/tmp/export_single_node_then_modify_yaml_then_import_$$DSTMN/ +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd: ssh $$DSTMN 'xcat-inventory import -f /tmp/export_single_node_then_modify_yaml_then_import_$$DSTMN/bogusnode_yaml.inv -t node -o bogusnode' +check:rc==0 +cmd: ssh $$DSTMN 'lsdef bogusnode -z |sort -t'=' -k1|tee /tmp/export_single_node_then_modify_yaml_then_import_$$DSTMN/dstbogusnode.stanza' +check:rc==0 +cmd: scp $$DSTMN:/tmp/export_single_node_then_modify_yaml_then_import_$$DSTMN/dstbogusnode.stanza /tmp/export_single_node_then_modify_yaml_then_import/dstbogusnode.stanza +check:rc==0 +cmd: cat /tmp/export_single_node_then_modify_yaml_then_import/dstbogusnode.stanza +check:rc==0 +cmd:diff -y /tmp/export_single_node_then_modify_yaml_then_import/srcbogusnode.stanza /tmp/export_single_node_then_modify_yaml_then_import/dstbogusnode.stanza +check:rc==0 +cmd:ssh $$DSTMN 'rmdef bogusnode' +check:rc==0 +cmd:if [[ -e /tmp/export_single_node_then_modify_yaml_then_import/bogusnode.stanza ]]; then cat /tmp/export_single_node_then_modify_yaml_then_import/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/export_single_node_then_modify_yaml_then_import/bogusgroup.stanza ]]; then cat /tmp/export_single_node_then_modify_yaml_then_import/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_single_node_then_modify_yaml_then_import_$$DSTMN/bogusnode.stanza ]]; then cat /tmp/export_single_node_then_modify_yaml_then_import_$$DSTMN/bogusnode.stanza | mkdef -z;fi' +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_single_node_then_modify_yaml_then_import_$$DSTMN/bogusgroup.stanza ]]; then cat /tmp/export_single_node_then_modify_yaml_then_import_$$DSTMN/bogusgroup.stanza |mkdef -z -f;fi' +check:rc==0 +cmd:ssh $$DSTMN 'rm -rf /tmp/export_single_node_then_modify_yaml_then_import_$$DSTMN/' +check:rc==0 +cmd:rm -rf /tmp/export_single_node_then_modify_yaml_then_import +check:rc==0 +end + +start:export_single_node_then_modify_json_then_import +description:This case is used to test xcat-inventory import a node , then modify the export json file, then import the json file +Attribute: $$DSTMN - the ip of MN which is used to run import operation. +cmd:mkdir -p /tmp/export_single_node_then_modify_json_then_import +check:rc==0 +cmd:ssh $$DSTMN 'mkdir -p /tmp/export_single_node_then_modify_json_then_import_$$DSTMN/' +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_single_node_then_modify_json_then_import/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_single_node_then_modify_json_then_import/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:ssh $$DSTMN 'lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/export_single_node_then_modify_json_then_import_$$DSTMN/bogusnode.stanza ;rmdef bogusnode;fi' +check:rc==0 +cmd:ssh $$DSTMN 'lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_single_node_then_modify_json_then_import_$$DSTMN/bogusgroup.stanza; rmdef -t group bogusgroup;fi' +check:rc==0 +cmd:mkdef -t node -o bogusnode groups=bogusgroup mgt=openbmc nodetype=mp addkcmdline=1111 arch=ppc64 authdomain=1111 bmc=1111 bmcpassword=1111 bmcusername=1111 bmcvlantag=1111 cfgmgr=1111 cfgmgtroles=1111 cfgserver=1111 chain=1111 chassis=1111 cmdmapping=1111 cons=1111 conserver=1111 consoleondemand=1111 consport=1111 cpucount=1111 cputype=1111 dhcpinterfaces=1111 disksize=1111 domainadminpassword=1111 domainadminuser=1111 domaintype=1111 getmac=1111 height=1111 hidden=1111 hostcluster=1111 hostinterface=1111 hostmanager=1111 hostnames=1111 hosttype=1111 hwtype=1111 installnic=1111 interface=1111 ip=10.10.10.10 iscsipassword=1111 iscsiserver=1111 iscsitarget=1111 iscsiuserid=1111 mac=42:d6:0a:03:05:08 memory=1111 migrationdest=1111 monserver=1111 mpa=1111 mtm=1111 nameservers=1111 netboot=grub2 nfsdir=1111 nfsserver=1111 nimserver=1111 node=1111 ondiscover=1111 osvolume=1111 otherinterfaces=1111 ou=1111 pdu=1111 postbootscripts=1111 postscripts=1111 power=1111 prescripts-begin=1111 prescripts-end=1111 primarynic=1111 primarysn=1111 productkey=1111 provmethod=1111 rack=1111 room=1111 routenames=1111 serial=1111 serialflow=1111 serialport=1111 serialspeed=1111 servicenode=1111 setupconserver=1 setupdhcp=1 setupftp=1111 setupipforward=1 setupldap=1 setupnameserver=1 setupnfs=1 setupnim=1111 setupntp=1 setupproxydhcp=1 setuptftp=1 sfp=1111 side=1111 slot=1111 storagcontroller=1111 storagetype=1111 supernode=1111 supportedarchs=1111 supportproxydhcp=1111 switch=1111 switchinterface=1111 switchport=1111 switchvlan=1111 syslog=1111 termport=1111 termserver=1111 tftpdir=1111 tftpserver=1111 unit=1111 usercomment=1111 vmbeacon=1111 vmbootorder=1111 vmcfgstore=1111 vmcluster=1111 vmmanager=1111 vmmaster=1111 vmnicnicmodel=1111 vmphyslots=1111 vmstorage=1111 vmstoragecache=1111 vmstorageformat=1111 vmstoragemodel=1111 vmtextconsole=1111 vmvirtflags=1111 vmvncport=1111 xcatmaster=1111 zonename=1111 nicaliases.eth0="moe larry curly" nicaliases.eth1="tom|jerry" niccustomscripts.eth0="configeth eth0" niccustomscripts.ib0="configib ib0" nicdevices.bond0="eth0|eth2" nicdevices.br0=bond0 nicextraparams.eth0="MTU=1500" nicextraparams.ib0="MTU=65520 CONNECTED_MODE=yes" nichostnameprefixes.eth0="eth0-" nichostnameprefixes.ib0="ib-" nichostnamesuffixes.eth0="-eth0" nichostnamesuffixes.ib0="-ib0" nicips.ib0=10.10.100.9 nicips.enP48p1s0f0=129.40.234.11 nicips.ib1=10.11.100.9 nicnetworks.enP5p1s0f1.4=xcat_bmc nicnetworks.enP48p1s0f1=xcat_util nicnetworks.ib0=IB00 nicnetworks.enP48p1s0f0=pub_yellow nicnetworks.ib3=IB03 nicnetworks.ib2=IB02 nicnetworks.enP5p1s0f1=xcat_compute nicnetworks.ib1=IB01 nicnetworks.enP5p1s0f1.5=xcat_infra nicnetworks.enP5p1s0f1.6=xcat_pdu nicsadapter.enP3p3s0f1="mac=98:be:94:59:fa:cd linkstate=DOWN" nicsadapter.enP3p3s0f2="mac=98:be:94:59:fa:ce candidatename=enP3p3s0f2/enx98be9459face" nictypes.enP5p1s0f1.4=unused nictypes.enP48p1s0f1=unused nictypes.ib0=Infiniband nictypes.enP48p1s0f0=Ethernet nictypes.ib3=unused nictypes.ib2=unused nictypes.enP5p1s0f1=unused nictypes.ib1=Infiniband nictypes.enP5p1s0f1.5=unused nictypes.enP5p1s0f1.6=unused +cmd:lsdef bogusnode -z|sed 's/1111/2222/g'|sed 's/unused/used/g'|sed 's/10.10.100.9/20.10.200.9/g'|sort -t'=' -k1 |tee /tmp/export_single_node_then_modify_json_then_import/srcbogusnode.stanza +check:rc==0 +cmd:sed -i 's/arch=ppc64/arch=ppc64le/g' /tmp/export_single_node_then_modify_json_then_import/srcbogusnode.stanza +check:rc==0 +cmd:sed -i 's/ip=10.10.10.10/ip=10.20.10.20/g' /tmp/export_single_node_then_modify_json_then_import/srcbogusnode.stanza +check:rc==0 +cmd:sed -i 's/mac=42:d6:0a:03:05:08/mac=42:d6:0a:03:05:09/g' /tmp/export_single_node_then_modify_json_then_import/srcbogusnode.stanza +check:rc==0 +cmd:sed -i 's/netboot=grub2/netboot=petitboot/g' /tmp/export_single_node_then_modify_json_then_import/srcbogusnode.stanza +check:rc==0 +cmd:a=('setuptftp' 'setupnameserver' 'setupdhcp' 'setupntp' 'setupldap' 'setupproxydhcp' 'setupipforward' 'setupconserver' 'setupnfs');for i in ${a[@]};do sed -i "s/$i=1/$i=0/g" /tmp/export_single_node_then_modify_json_then_import/srcbogusnode.stanza; done +check:rc==0 +cmd:xcat-inventory export --format=json -t node -o bogusnode |tee /tmp/export_single_node_then_modify_json_then_import/bogusnode_json.inv +check:rc==0 +cmd:sed -i 's/1111/2222/g' /tmp/export_single_node_then_modify_json_then_import/bogusnode_json.inv +check:rc==0 +cmd:sed -i 's/unused/used/g' /tmp/export_single_node_then_modify_json_then_import/bogusnode_json.inv +check:rc==0 +cmd:sed -i 's/10.10.100.9/20.10.200.9/g' /tmp/export_single_node_then_modify_json_then_import/bogusnode_json.inv +check:rc==0 +cmd:sed -i 's/"arch": "ppc64"/"arch": "ppc64le"/g' /tmp/export_single_node_then_modify_json_then_import/bogusnode_json.inv +check:rc==0 +cmd:sed -i 's/"ip": "10.10.10.10"/"ip": "10.20.10.20"/g' /tmp/export_single_node_then_modify_json_then_import/bogusnode_json.inv +check:rc==0 +cmd:sed -i 's/"42:d6:0a:03:05:08"/"42:d6:0a:03:05:09"/g' /tmp/export_single_node_then_modify_json_then_import/bogusnode_json.inv +check:rc==0 +cmd:sed -i 's/ "grub2"/ "petitboot"/g' /tmp/export_single_node_then_modify_json_then_import/bogusnode_json.inv +check:rc==0 +cmd:a=('setuptftp' 'setupnameserver' 'setupdhcp' 'setupntp' 'setupldap' 'setupproxydhcp' 'setupipforward' 'setupconserver' 'setupnfs');for i in ${a[@]};do sed -i "s/\"$i\": \"1\"/\"$i\": \"0\"/g" /tmp/export_single_node_then_modify_json_then_import/bogusnode_json.inv; done +check:rc==0 +cmd:scp /tmp/export_single_node_then_modify_json_then_import/bogusnode_json.inv $$DSTMN:/tmp/export_single_node_then_modify_json_then_import_$$DSTMN/ +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd: ssh $$DSTMN 'xcat-inventory import -f /tmp/export_single_node_then_modify_json_then_import_$$DSTMN/bogusnode_json.inv -t node -o bogusnode' +check:rc==0 +cmd: ssh $$DSTMN 'lsdef bogusnode -z |sort -t'=' -k1|tee /tmp/export_single_node_then_modify_json_then_import_$$DSTMN/dstbogusnode.stanza' +check:rc==0 +cmd: scp $$DSTMN:/tmp/export_single_node_then_modify_json_then_import_$$DSTMN/dstbogusnode.stanza /tmp/export_single_node_then_modify_json_then_import/dstbogusnode.stanza +check:rc==0 +cmd: cat /tmp/export_single_node_then_modify_json_then_import/dstbogusnode.stanza +check:rc==0 +cmd:diff -y /tmp/export_single_node_then_modify_json_then_import/srcbogusnode.stanza /tmp/export_single_node_then_modify_json_then_import/dstbogusnode.stanza +check:rc==0 +cmd:ssh $$DSTMN 'rmdef bogusnode' +check:rc==0 +cmd:if [[ -e /tmp/export_single_node_then_modify_json_then_import/bogusnode.stanza ]]; then cat /tmp/export_single_node_then_modify_json_then_import/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/export_single_node_then_modify_json_then_import/bogusgroup.stanza ]]; then cat /tmp/export_single_node_then_modify_json_then_import/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_single_node_then_modify_json_then_import_$$DSTMN/bogusnode.stanza ]]; then cat /tmp/export_single_node_then_modify_json_then_import_$$DSTMN/bogusnode.stanza | mkdef -z;fi' +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_single_node_then_modify_json_then_import_$$DSTMN/bogusgroup.stanza ]]; then cat /tmp/export_single_node_then_modify_json_then_import_$$DSTMN/bogusgroup.stanza |mkdef -z -f;fi' +check:rc==0 +cmd:ssh $$DSTMN 'rm -rf /tmp/export_single_node_then_modify_json_then_import_$$DSTMN/' +check:rc==0 +cmd:rm -rf /tmp/export_single_node_then_modify_json_then_import +check:rc==0 +end + +start:export_import_single_group_json +description:This case is used to test xcat-inventory export and import the definition of group +cmd:mkdir -p /tmp/export_import_single_group_json +check:rc==0 +cmd:ssh $$DSTMN 'mkdir -p /tmp/export_import_single_group_json_$$DSTMN/' +check:rc==0 +cmd:for i in 1 2 3; do lsdef bogusnode$i > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode$i -z >> /tmp/export_import_single_group_json/bogusnode.stanza ;rmdef bogusnode$i;fi; done +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_group_json/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:ssh $$DSTMN 'for i in 1 2 3; do lsdef bogusnode$i > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode$i -z >> /tmp/export_import_single_group_json_$$DSTMN/bogusnode.stanza ;rmdef bogusnode$i;fi; done' +check:rc==0 +cmd:ssh $$DSTMN 'lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_group_json_$$DSTMN/bogusgroup.stanza; rmdef -t group bogusgroup;fi' +check:rc==0 +cmd:mkdef -t group -o bogusgroup mgt=openbmc cons=openbmc netboot=petitboot ip='|\D+(\d+)|10.100.100.($1)|' bmcusername=root bmcpassword=0penBmc +check:rc==0 +cmd: mkdef -t node -o bogusnode[1-3] groups=bogusgroup +check:rc==0 +cmd: lsdef -t node -o bogusnode[1-3] > /tmp/export_import_single_group_json/target_nodes_group +check:rc==0 +cmd: lsdef -t group -o bogusgroup >> /tmp/export_import_single_group_json/target_nodes_group +check:rc==0 +cmd:sed -e 's/members=.*$/members='"$(awk -F = '/members=/ { print $2 }' < /tmp/export_import_single_group_json/target_nodes_group | tr , ' ' | xargs -n 1 | sort -g | xargs -n 999 | tr ' ' ,)"'/' < /tmp/export_import_single_group_json/target_nodes_group > /tmp/export_import_single_group_json/target_nodes_group.1; cp -f /tmp/export_import_single_group_json/target_nodes_group.1 /tmp/export_import_single_group_json/target_nodes_group +check:rc==0 +cmd:xcat-inventory export --format=json -t node -o bogusnode1,bogusnode2,bogusnode3,bogusgroup |tee /tmp/export_import_single_group_json/export.file +check:rc==0 +cmd:scp /tmp/export_import_single_group_json/export.file $$DSTMN:/tmp/export_import_single_group_json_$$DSTMN/ +check:rc==0 +cmd:rmdef -t node -o bogusnode[1-3] +check:rc==0 +cmd:rmdef -t group -o bogusgroup +check:rc==0 +cmd:ssh $$DSTMN 'xcat-inventory import -f /tmp/export_import_single_group_json_$$DSTMN/export.file -t node -o bogusnode1,bogusnode2,bogusnode3,bogusgroup' +check:rc==0 +cmd:ssh $$DSTMN 'lsdef -t node -o bogusnode[1-3] > /tmp/export_import_single_group_json_$$DSTMN/import_nodes_group' +check:rc==0 +cmd:ssh $$DSTMN 'lsdef -t group -o bogusgroup >> /tmp/export_import_single_group_json_$$DSTMN/import_nodes_group' +check:rc==0 +cmd:scp $$DSTMN:/tmp/export_import_single_group_json_$$DSTMN/import_nodes_group /tmp/export_import_single_group_json/import_nodes_group +check:rc==0 +cmd:ssh $$DSTMN 'rmdef -t node -o bogusnode[1-3]' +check:rc==0 +cmd: ssh $$DSTMN 'rmdef -t group -o bogusgroup' +check:rc==0 +cmd:sed -e 's/members=.*$/members='"$(awk -F = '/members=/ { print $2 }' < /tmp/export_import_single_group_json/import_nodes_group | tr , ' ' | xargs -n 1 | sort -g | xargs -n 999 | tr ' ' ,)"'/' < /tmp/export_import_single_group_json/import_nodes_group > /tmp/export_import_single_group_json/import_nodes_group.1; cp -rf /tmp/export_import_single_group_json/import_nodes_group.1 /tmp/export_import_single_group_json/import_nodes_group +check:rc==0 +cmd:diff -y /tmp/export_import_single_group_json/target_nodes_group /tmp/export_import_single_group_json/import_nodes_group +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_group_json/bogusnode.stanza ]]; then cat /tmp/export_import_single_group_json/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_group_json/bogusgroup.stanza ]];then cat /tmp/export_import_single_group_json/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_group_json_$$DSTMN/bogusnode.stanza ]]; then cat /tmp/export_import_single_group_json_$$DSTMN/bogusnode.stanza | mkdef -z;fi' +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_group_json_$$DSTMN/bogusgroup.stanza ]];then cat /tmp/export_import_single_group_json_$$DSTMN/bogusgroup.stanza |mkdef -z -f;fi' +check:rc==0 +cmd:ssh $$DSTMN 'rm -rf /tmp/export_import_single_group_json_$$DSTMN/' +check:rc==0 +cmd:rm -rf /tmp/export_import_single_group_json +check:rc==0 +end + +start:export_import_single_group_yaml +description:This case is used to test xcat-inventory export and import the definition of group +cmd:mkdir -p /tmp/export_import_single_group_yaml +check:rc==0 +cmd:ssh $$DSTMN 'mkdir -p /tmp/export_import_single_group_yaml_$$DSTMN/' +check:rc==0 +cmd:for i in 1 2 3; do lsdef bogusnode$i > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode$i -z >> /tmp/export_import_single_group_yaml/bogusnode.stanza ;rmdef bogusnode$i;fi; done +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_group_yaml/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:ssh $$DSTMN 'for i in 1 2 3; do lsdef bogusnode$i > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode$i -z >> /tmp/export_import_single_group_yaml_$$DSTMN/bogusnode.stanza ;rmdef bogusnode$i;fi; done' +check:rc==0 +cmd:ssh $$DSTMN 'lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/export_import_single_group_yaml_$$DSTMN/bogusgroup.stanza; rmdef -t group bogusgroup;fi' +check:rc==0 +cmd:mkdef -t group -o bogusgroup mgt=openbmc cons=openbmc netboot=petitboot ip='|\D+(\d+)|10.100.100.($1)|' bmcusername=root bmcpassword=0penBmc +check:rc==0 +cmd: mkdef -t node -o bogusnode[1-3] groups=bogusgroup +check:rc==0 +cmd: lsdef -t node -o bogusnode[1-3] > /tmp/export_import_single_group_yaml/target_nodes_group +check:rc==0 +cmd: lsdef -t group -o bogusgroup >> /tmp/export_import_single_group_yaml/target_nodes_group +check:rc==0 +cmd:sed -e 's/members=.*$/members='"$(awk -F = '/members=/ { print $2 }' < /tmp/export_import_single_group_yaml/target_nodes_group | tr , ' ' | xargs -n 1 | sort -g | xargs -n 999 | tr ' ' ,)"'/' < /tmp/export_import_single_group_yaml/target_nodes_group > /tmp/export_import_single_group_yaml/target_nodes_group.1; cp -f /tmp/export_import_single_group_yaml/target_nodes_group.1 /tmp/export_import_single_group_yaml/target_nodes_group +check:rc==0 +cmd:xcat-inventory export --format=yaml -t node -o bogusnode1,bogusnode2,bogusnode3,bogusgroup |tee /tmp/export_import_single_group_yaml/export.file +check:rc==0 +cmd:scp /tmp/export_import_single_group_yaml/export.file $$DSTMN:/tmp/export_import_single_group_yaml_$$DSTMN/ +check:rc==0 +cmd:rmdef -t node -o bogusnode[1-3] +check:rc==0 +cmd:rmdef -t group -o bogusgroup +check:rc==0 +cmd:ssh $$DSTMN 'xcat-inventory import -f /tmp/export_import_single_group_yaml_$$DSTMN/export.file -t node -o bogusnode1,bogusnode2,bogusnode3,bogusgroup' +check:rc==0 +cmd:ssh $$DSTMN 'lsdef -t node -o bogusnode[1-3] > /tmp/export_import_single_group_yaml_$$DSTMN/import_nodes_group' +check:rc==0 +cmd:ssh $$DSTMN 'lsdef -t group -o bogusgroup >> /tmp/export_import_single_group_yaml_$$DSTMN/import_nodes_group' +check:rc==0 +cmd:scp $$DSTMN:/tmp/export_import_single_group_yaml_$$DSTMN/import_nodes_group /tmp/export_import_single_group_yaml/import_nodes_group +check:rc==0 +cmd:ssh $$DSTMN 'rmdef -t node -o bogusnode[1-3]' +check:rc==0 +cmd: ssh $$DSTMN 'rmdef -t group -o bogusgroup' +check:rc==0 +cmd:sed -e 's/members=.*$/members='"$(awk -F = '/members=/ { print $2 }' < /tmp/export_import_single_group_yaml/import_nodes_group | tr , ' ' | xargs -n 1 | sort -g | xargs -n 999 | tr ' ' ,)"'/' < /tmp/export_import_single_group_yaml/import_nodes_group > /tmp/export_import_single_group_yaml/import_nodes_group.1; cp -rf /tmp/export_import_single_group_yaml/import_nodes_group.1 /tmp/export_import_single_group_yaml/import_nodes_group +check:rc==0 +cmd:diff -y /tmp/export_import_single_group_yaml/target_nodes_group /tmp/export_import_single_group_yaml/import_nodes_group +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_group_yaml/bogusnode.stanza ]]; then cat /tmp/export_import_single_group_yaml/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/export_import_single_group_yaml/bogusgroup.stanza ]];then cat /tmp/export_import_single_group_yaml/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_group_yaml_$$DSTMN/bogusnode.stanza ]]; then cat /tmp/export_import_single_group_yaml_$$DSTMN/bogusnode.stanza | mkdef -z;fi' +check:rc==0 +cmd:ssh $$DSTMN 'if [[ -e /tmp/export_import_single_group_yaml_$$DSTMN/bogusgroup.stanza ]];then cat /tmp/export_import_single_group_yaml_$$DSTMN/bogusgroup.stanza |mkdef -z -f;fi' +check:rc==0 +cmd:ssh $$DSTMN 'rm -rf /tmp/export_import_single_group_yaml_$$DSTMN/' +check:rc==0 +cmd:rm -rf /tmp/export_import_single_group_yaml +check:rc==0 +end + +start:import_validation_json_node_obj_type +description:This case is used to test node validation function of xcat-inventory import json file. To test "obj_type" attribute +cmd:mkdir -p /tmp/import_validation_json_node_obj_type +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/import_validation_json_node_obj_type/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/import_validation_json_node_obj_type/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:#!/bin/bash +echo '{ + "node": { + "bogusnode": { + "device_type": "server", + "network_info": { + "primarynic": { + "mac": [ + "11:11:11:11:11:11" + ] + } + }, + "obj_info": { + "groups": "bogusgroup" + }, + "role": "compute" + } + }, +}' > /tmp/import_validation_json_node_obj_type/node.json +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_json_node_obj_type/node.json +check:output=~Error: failed to validate attribute +check:output=~obj_type +check:rc!=0 +cmd:lsdef bogusnode +check:output=~Error: Could not find an object named 'bogusnode' +check:rc!=0 +cmd:#!/bin/bash +echo '{ + "node": { + "bogusnode": { + "device_type": "server", + "network_info": { + "primarynic": { + "mac": [ + "11:11:11:11:11:11" + ] + } + }, + "obj_info": { + "groups": "bogusgroup" + }, + "obj_type": "aaa", + "role": "compute" + } + }, +}' > /tmp/import_validation_json_node_obj_type/node.json +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_json_node_obj_type/node.json +check:output=~Error: failed to validate attribute +check:output=~obj_type +check:rc!=0 +cmd:lsdef bogusnode +check:output=~Error: Could not find an object named 'bogusnode' +check:rc!=0 +cmd:#!/bin/bash +echo '{ + "node": { + "bogusnode": { + "device_type": "server", + "network_info": { + "primarynic": { + "mac": [ + "11:11:11:11:11:11" + ] + } + }, + "obj_info": { + "groups": "bogusgroup" + }, + "obj_type": "node", + "role": "compute" + } + }, +}' > /tmp/import_validation_json_node_obj_type/node.json +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_json_node_obj_type/node.json +check:output=~Inventory import successfully +check:rc==0 +cmd:lsdef bogusnode +check:output=~Object name: bogusnode +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd:#!/bin/bash +echo '{ + "node": { + "bogusgroup": { + "device_type": "server", + "engines": { + "hardware_mgt_engine": { + "engine_type": "ipmi" + } + }, + "obj_info": { + "grouptype": "static" + }, + "obj_type": "group", + "role": "compute" + } + }, +}' > /tmp/import_validation_json_node_obj_type/node.json +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_json_node_obj_type/node.json +check:output=~Inventory import successfully +check:rc==0 +cmd:lsdef -t group -o bogusgroup +check:output=~Object name: bogusgroup +check:rc==0 +cmd:rmdef -t group -o bogusgroup +check:rc==0 +cmd:if [[ -e /tmp/import_validation_json_node_obj_type/bogusnode.stanza ]]; then cat /tmp/import_validation_json_node_obj_type/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/import_validation_json_node_obj_type/bogusgroup.stanza ]]; then cat /tmp/import_validation_json_node_obj_type/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:rm -rf /tmp/import_validation_json_node_obj_type +check:rc==0 +end + + +start:import_validation_yaml_node_obj_type +description:This case is used to test node validation function of xcat-inventory import yaml file. To test "obj_type" attribute +cmd:mkdir -p /tmp/import_validation_yaml_node_obj_type +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/import_validation_yaml_node_obj_type/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/import_validation_yaml_node_obj_type/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:#!/bin/bash +echo "node: + bogusnode: + device_type: server + network_info: + primarynic: + mac: + - '11:11:11:11:11:11' + obj_info: + groups: bogusgroup + role: compute" > /tmp/import_validation_yaml_node_obj_type/node.yaml +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_yaml_node_obj_type/node.yaml +check:output=~Error: failed to validate attribute +check:output=~obj_type +check:rc!=0 +cmd:lsdef bogusnode +check:output=~Error: Could not find an object named 'bogusnode' +check:rc!=0 +cmd:#!/bin/bash +echo "node: + bogusnode: + device_type: server + network_info: + primarynic: + mac: + - '11:11:11:11:11:11' + obj_info: + groups: bogusgroup + obj_type: aaa + role: compute" > /tmp/import_validation_yaml_node_obj_type/node.yaml +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_yaml_node_obj_type/node.yaml +check:output=~Error: failed to validate attribute +check:output=~obj_type +check:rc!=0 +cmd:lsdef bogusnode +check:output=~Error: Could not find an object named 'bogusnode' +check:rc!=0 +cmd:#!/bin/bash +echo "node: + bogusnode: + device_type: server + network_info: + primarynic: + mac: + - '11:11:11:11:11:11' + obj_info: + groups: bogusgroup + obj_type: node + role: compute" > /tmp/import_validation_yaml_node_obj_type/node.yaml +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_yaml_node_obj_type/node.yaml +check:output=~Inventory import successfully +check:rc==0 +cmd:lsdef bogusnode +check:output=~Object name: bogusnode +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd:#!/bin/bash +echo "node: + bogusgroup: + device_type: server + engines: + hardware_mgt_engine: + engine_type: ipmi + obj_info: + grouptype: static + obj_type: group + role: compute" > /tmp/import_validation_yaml_node_obj_type/node.yaml +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_yaml_node_obj_type/node.yaml +check:output=~Inventory import successfully +check:rc==0 +cmd:lsdef -t group -o bogusgroup +check:output=~Object name: bogusgroup +check:rc==0 +cmd:rmdef -t group -o bogusgroup +check:rc==0 +cmd:if [[ -e /tmp/import_validation_yaml_node_obj_type/bogusnode.stanza ]]; then cat /tmp/import_validation_yaml_node_obj_type/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/import_validation_yaml_node_obj_type/bogusgroup.stanza ]]; then cat /tmp/import_validation_yaml_node_obj_type/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:rm -rf /tmp/import_validation_yaml_node_obj_type +check:rc==0 +end + + +start:import_validation_json_node_group +description:This case is used to test node validation function of xcat-inventory import json file. To test "group" attribute +cmd:mkdir -p /tmp/import_validation_json_node_group +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/import_validation_json_node_group/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/import_validation_json_node_group/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:#!/bin/bash +echo '{ + "node": { + "bogusnode": { + "device_type": "server", + "network_info": { + "primarynic": { + "mac": [ + "11:11:11:11:11:11" + ] + } + }, + "obj_type": "node", + "role": "compute" + } + }, +}' > /tmp/import_validation_json_node_group/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_json_node_group/node.inv +check:output=~Error: failed to validate attribute +check:output=~group +check:rc!=0 +cmd:lsdef bogusnode +check:output=~Error: Could not find an object named 'bogusnode' +check:rc!=0 +cmd:if [[ -e /tmp/import_validation_json_node_group/bogusnode.stanza ]]; then cat /tmp/import_validation_json_node_group/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/import_validation_json_node_group/bogusgroup.stanza ]]; then cat /tmp/import_validation_json_node_group/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:rm -rf /tmp/import_validation_json_node_group +check:rc==0 +end + +start:import_validation_yaml_node_group +description:This case is used to test node validation function of xcat-inventory import yaml file. To test "group" attribute +cmd:mkdir -p /tmp/import_validation_yaml_node_group +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/import_validation_yaml_node_group/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/import_validation_yaml_node_group/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:#!/bin/bash +echo "node: + bogusnode: + device_type: server + network_info: + primarynic: + mac: + - '11:11:11:11:11:11' + obj_type: node + role: compute" > /tmp/import_validation_yaml_node_group/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_yaml_node_group/node.inv +check:output=~Error: failed to validate attribute +check:output=~group +check:rc!=0 +cmd:lsdef bogusnode +check:output=~Error: Could not find an object named 'bogusnode' +check:rc!=0 +cmd:if [[ -e /tmp/import_validation_yaml_node_group/bogusnode.stanza ]]; then cat /tmp/import_validation_yaml_node_group/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/import_validation_yaml_node_group/bogusgroup.stanza ]]; then cat /tmp/import_validation_yaml_node_group/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:rm -rf /tmp/import_validation_yaml_node_group +check:rc==0 +end + +start:import_validation_json_node_device_type +description:This case is used to test node validation function of xcat-inventory import json file. To test "device_type" attribute +cmd:mkdir -p /tmp/import_validation_json_node_device_type +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/import_validation_json_node_device_type/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/import_validation_json_node_device_type/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:#!/bin/bash +echo '{ + "node": { + "bogusnode": { + "obj_info": { + "groups": "bogusgroup" + }, + "obj_type": "node", + "role": "compute" + } + }, +}' > /tmp/import_validation_json_node_device_type/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_json_node_device_type/node.inv +check:output=~Error: failed to validate attribute +check:output=~devtype +check:rc!=0 +cmd:lsdef bogusnode +check:output=~Error: Could not find an object named 'bogusnode' +check:rc!=0 +cmd:#!/bin/bash +echo '{ + "node": { + "bogusnode": { + "device_type": "aaa", + "obj_info": { + "groups": "bogusgroup" + }, + "obj_type": "node", + "role": "compute" + } + }, +}' > /tmp/import_validation_json_node_device_type/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_json_node_device_type/node.inv +check:output=~Error: failed to validate attribute +check:output=~devtype +check:rc!=0 +cmd:lsdef bogusnode +check:output=~Error: Could not find an object named 'bogusnode' +check:rc!=0 +cmd:#!/bin/bash +echo '{ + "node": { + "bogusnode": { + "device_type": "server", + "network_info": { + "primarynic": { + "mac": [ + "11:11:11:11:11:11" + ] + } + }, + "obj_info": { + "groups": "bogusgroup" + }, + "obj_type": "node", + "role": "compute" + } + }, +}' > /tmp/import_validation_json_node_device_type/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_json_node_device_type/node.inv +check:output=~Inventory import successfully +check:rc==0 +cmd:lsdef bogusnode +check:output=~Object name: bogusnode +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd:#!/bin/bash +echo '{ + "node": { + "bogusnode": { + "device_type": "switch", + "obj_info": { + "groups": "bogusgroup" + }, + "obj_type": "node", + "role": "compute" + } + }, +}' > /tmp/import_validation_json_node_device_type/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_json_node_device_type/node.inv +check:output=~Inventory import successfully +check:rc==0 +cmd:lsdef bogusnode +check:output=~Object name: bogusnode +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd:#!/bin/bash +echo '{ + "node": { + "bogusnode": { + "device_type": "pdu", + "obj_info": { + "groups": "bogusgroup" + }, + "obj_type": "node", + "role": "compute" + } + }, +}' > /tmp/import_validation_json_node_device_type/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_json_node_device_type/node.inv +check:output=~Inventory import successfully +check:rc==0 +cmd:lsdef bogusnode +check:output=~Object name: bogusnode +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd:#!/bin/bash +echo '{ + "node": { + "bogusnode": { + "device_type": "hmc", + "obj_info": { + "groups": "bogusgroup" + }, + "obj_type": "node", + "role": "compute" + } + }, +}' > /tmp/import_validation_json_node_device_type/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_json_node_device_type/node.inv +check:output=~Inventory import successfully +check:rc==0 +cmd:lsdef bogusnode +check:output=~Object name: bogusnode +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd:#!/bin/bash +echo '{ + "node": { + "bogusnode": { + "device_type": "rack", + "obj_info": { + "groups": "bogusgroup" + }, + "obj_type": "node", + "role": "compute" + } + }, +}' > /tmp/import_validation_json_node_device_type/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_json_node_device_type/node.inv +check:output=~Inventory import successfully +check:rc==0 +cmd:lsdef bogusnode +check:output=~Object name: bogusnode +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd:if [[ -e /tmp/import_validation_json_node_device_type/bogusnode.stanza ]]; then cat /tmp/import_validation_json_node_device_type/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/import_validation_json_node_device_type/bogusgroup.stanza ]]; then cat /tmp/import_validation_json_node_device_type/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:rm -rf /tmp/import_validation_json_node_device_type +check:rc==0 +end + + +start:import_validation_yaml_node_device_type +description:This case is used to test node validation function of xcat-inventory import yaml file. To test "device_type" attribute +cmd:mkdir -p /tmp/import_validation_yaml_node_device_type +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/import_validation_yaml_node_device_type/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/import_validation_yaml_node_device_type/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:#!/bin/bash +echo "node: + bogusnode: + obj_info: + groups: bogusgroup + obj_type: node + role: compute" > /tmp/import_validation_yaml_node_device_type/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_yaml_node_device_type/node.inv +check:output=~Error: failed to validate attribute +check:output=~devtype +check:rc!=0 +cmd:lsdef bogusnode +check:output=~Error: Could not find an object named 'bogusnode' +check:rc!=0 +cmd:#!/bin/bash +echo "node: + bogusnode: + device_type: aaa + obj_info: + groups: bogusgroup + obj_type: node + role: compute" > /tmp/import_validation_yaml_node_device_type/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_yaml_node_device_type/node.inv +check:output=~Error: failed to validate attribute +check:output=~devtype +check:rc!=0 +cmd:lsdef bogusnode +check:output=~Error: Could not find an object named 'bogusnode' +check:rc!=0 +cmd:#!/bin/bash +echo "node: + bogusnode: + device_type: switch + obj_info: + groups: bogusgroup + obj_type: node + role: compute" > /tmp/import_validation_yaml_node_device_type/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_yaml_node_device_type/node.inv +check:output=~Inventory import successfully +check:rc==0 +cmd:lsdef bogusnode +check:output=~Object name: bogusnode +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd:#!/bin/bash +echo "node: + bogusnode: + device_type: pdu + obj_info: + groups: bogusgroup + obj_type: node + role: compute" > /tmp/import_validation_yaml_node_device_type/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_yaml_node_device_type/node.inv +check:output=~Inventory import successfully +check:rc==0 +cmd:lsdef bogusnode +check:output=~Object name: bogusnode +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd:#!/bin/bash +echo "node: + bogusnode: + device_type: rack + obj_info: + groups: bogusgroup + obj_type: node + role: compute" > /tmp/import_validation_yaml_node_device_type/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_yaml_node_device_type/node.inv +check:output=~Inventory import successfully +check:rc==0 +cmd:lsdef bogusnode +check:output=~Object name: bogusnode +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd:#!/bin/bash +echo "node: + bogusnode: + device_type: hmc + obj_info: + groups: bogusgroup + obj_type: node + role: compute" > /tmp/import_validation_yaml_node_device_type/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_yaml_node_device_type/node.inv +check:output=~Inventory import successfully +check:rc==0 +cmd:lsdef bogusnode +check:output=~Object name: bogusnode +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd:#!/bin/bash +echo "node: + bogusnode: + device_type: server + network_info: + primarynic: + mac: + - '11:11:11:11:11:11' + obj_info: + groups: bogusgroup + obj_type: node + role: compute" > /tmp/import_validation_yaml_node_device_type/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_yaml_node_device_type/node.inv +check:output=~Inventory import successfully +check:rc==0 +cmd:lsdef bogusnode +check:output=~Object name: bogusnode +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd:if [[ -e /tmp/import_validation_yaml_node_device_type/bogusnode.stanza ]]; then cat /tmp/import_validation_yaml_node_device_type/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/import_validation_yaml_node_device_type/bogusgroup.stanza ]]; then cat /tmp/import_validation_yaml_node_device_type/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:rm -rf /tmp/import_validation_yaml_node_device_type +check:rc==0 +end + + +start:import_validation_json_node_arch_type +description:This case is used to test node validation function of xcat-inventory import json file. To test "arch" attribute +cmd:mkdir -p /tmp/import_validation_json_node_arch_type +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/import_validation_json_node_arch_type/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/import_validation_json_node_arch_type/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:#!/bin/bash +echo '{ + "node": { + "bogusnode": { + "device_info": { + "arch": "ppc" + }, + "device_type": "server", + "obj_info": { + "groups": "bogusgroup" + }, + "obj_type": "node", + "role": "compute" + } + }, +}' > /tmp/import_validation_json_node_arch_type/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_json_node_arch_type/node.inv +check:output=~Error: failed to validate attribute +check:output=~arch +check:rc!=0 +cmd:lsdef bogusnode +check:output=~Error: Could not find an object named 'bogusnode' +check:rc!=0 +cmd:#!/bin/bash +echo '{ + "node": { + "bogusnode": { + "device_info": { + "arch": "ppc64" + }, + "device_type": "server", + "obj_info": { + "groups": "bogusgroup" + }, + "obj_type": "node", + "role": "compute" + } + }, +}' > /tmp/import_validation_json_node_arch_type/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_json_node_arch_type/node.inv +check:output=~Inventory import successfully +check:rc==0 +cmd:lsdef bogusnode +check:output=~Object name: bogusnode +check:output=~arch=ppc64 +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd:#!/bin/bash +echo '{ + "node": { + "bogusnode": { + "device_info": { + "arch": "ppc64el" + }, + "device_type": "server", + "obj_info": { + "groups": "bogusgroup" + }, + "obj_type": "node", + "role": "compute" + } + }, +}' > /tmp/import_validation_json_node_arch_type/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_json_node_arch_type/node.inv +check:output=~Inventory import successfully +check:rc==0 +cmd:lsdef bogusnode +check:output=~Object name: bogusnode +check:output=~arch=ppc64el +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd:#!/bin/bash +echo '{ + "node": { + "bogusnode": { + "device_info": { + "arch": "ppc64le" + }, + "device_type": "server", + "obj_info": { + "groups": "bogusgroup" + }, + "obj_type": "node", + "role": "compute" + } + }, +}' > /tmp/import_validation_json_node_arch_type/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_json_node_arch_type/node.inv +check:output=~Inventory import successfully +check:rc==0 +cmd:lsdef bogusnode +check:output=~Object name: bogusnode +check:output=~arch=ppc64le +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd:#!/bin/bash +echo '{ + "node": { + "bogusnode": { + "device_info": { + "arch": "x86_64" + }, + "device_type": "server", + "obj_info": { + "groups": "bogusgroup" + }, + "obj_type": "node", + "role": "compute" + } + }, +}' > /tmp/import_validation_json_node_arch_type/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_json_node_arch_type/node.inv +check:output=~Inventory import successfully +check:rc==0 +cmd:lsdef bogusnode +check:output=~Object name: bogusnode +check:output=~arch=x86_64 +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd:#!/bin/bash +echo '{ + "node": { + "bogusnode": { + "device_info": { + "arch": "armv71" + }, + "device_type": "server", + "obj_info": { + "groups": "bogusgroup" + }, + "obj_type": "node", + "role": "compute" + } + }, +}' > /tmp/import_validation_json_node_arch_type/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_json_node_arch_type/node.inv +check:output=~Inventory import successfully +check:rc==0 +cmd:lsdef bogusnode +check:output=~Object name: bogusnode +check:output=~arch=armv71 +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd:if [[ -e /tmp/import_validation_json_node_arch_type/bogusnode.stanza ]]; then cat /tmp/import_validation_json_node_arch_type/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/import_validation_json_node_arch_type/bogusgroup.stanza ]]; then cat /tmp/import_validation_json_node_arch_type/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:rm -rf /tmp/import_validation_json_node_arch_type +check:rc==0 +end + +start:import_validation_yaml_node_arch_type +description:This case is used to test node validation function of xcat-inventory import yaml file. To test "arch" attribute +cmd:mkdir -p /tmp/import_validation_yaml_node_arch_type +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/import_validation_yaml_node_arch_type/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/import_validation_yaml_node_arch_type/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:#!/bin/bash +echo "node: + bogusnode: + device_info: + arch: ppc + device_type: server + obj_info: + groups: bogusgroup + obj_type: node + role: compute" > /tmp/import_validation_yaml_node_arch_type/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_yaml_node_arch_type/node.inv +check:output=~Error: failed to validate attribute +check:output=~arch +check:rc!=0 +cmd:lsdef bogusnode +check:output=~Error: Could not find an object named 'bogusnode' +check:rc!=0 +cmd:#!/bin/bash +echo "node: + bogusnode: + device_info: + arch: ppc64 + device_type: server + obj_info: + groups: bogusgroup + obj_type: node + role: compute" > /tmp/import_validation_yaml_node_arch_type/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_yaml_node_arch_type/node.inv +check:output=~Inventory import successfully +check:rc==0 +cmd:lsdef bogusnode +check:output=~Object name: bogusnode +check:output=~arch=ppc64 +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd:#!/bin/bash +echo "node: + bogusnode: + device_info: + arch: ppc64el + device_type: server + obj_info: + groups: bogusgroup + obj_type: node + role: compute" > /tmp/import_validation_yaml_node_arch_type/node.inv +cmd:xcat-inventory import -f /tmp/import_validation_yaml_node_arch_type/node.inv +check:output=~Inventory import successfully +check:rc==0 +cmd:lsdef bogusnode +check:output=~Object name: bogusnode +check:output=~arch=ppc64el +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd:#!/bin/bash +echo "node: + bogusnode: + device_info: + arch: ppc64le + device_type: server + obj_info: + groups: bogusgroup + obj_type: node + role: compute" > /tmp/import_validation_yaml_node_arch_type/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_yaml_node_arch_type/node.inv +check:output=~Inventory import successfully +check:rc==0 +cmd:lsdef bogusnode +check:output=~Object name: bogusnode +check:output=~arch=ppc64le +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd:#!/bin/bash +echo "node: + bogusnode: + device_info: + arch: x86_64 + device_type: server + obj_info: + groups: bogusgroup + obj_type: node + role: compute" > /tmp/import_validation_yaml_node_arch_type/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_yaml_node_arch_type/node.inv +check:output=~Inventory import successfully +check:rc==0 +cmd:lsdef bogusnode +check:output=~Object name: bogusnode +check:output=~arch=x86_64 +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd:#!/bin/bash +echo "node: + bogusnode: + device_info: + arch: armv71 + device_type: server + obj_info: + groups: bogusgroup + obj_type: node + role: compute" > /tmp/import_validation_yaml_node_arch_type/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_yaml_node_arch_type/node.inv +check:output=~Inventory import successfully +check:rc==0 +cmd:lsdef bogusnode +check:output=~Object name: bogusnode +check:output=~arch=armv71 +check:rc==0 +cmd:rmdef bogusnode +check:rc==0 +cmd:if [[ -e /tmp/import_validation_yaml_node_arch_type/bogusnode.stanza ]]; then cat /tmp/import_validation_yaml_node_arch_type/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/import_validation_yaml_node_arch_type/bogusgroup.stanza ]]; then cat /tmp/import_validation_yaml_node_arch_type/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:rm -rf /tmp/import_validation_yaml_node_arch_type +check:rc==0 +end + +start:import_validation_yaml_node_securitylevel +description:This case is used to test node validation function of xcat-inventory import yaml file. To test "securitylevel" attribute +cmd:mkdir -p /tmp/import_validation_yaml_node_securitylevel +check:rc==0 +cmd:lsdef bogusnode > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode -z >/tmp/import_validation_yaml_node_securitylevel/bogusnode.stanza ;rmdef bogusnode;fi +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z > /tmp/import_validation_yaml_node_securitylevel/bogusgroup.stanza; rmdef -t group bogusgroup;fi +check:rc==0 +cmd:#!/bin/bash +echo "node: + bogusnode: + deprecated: + pdunodetype: pdu + device_info: + characteristics: pdu + device_type: server + obj_info: + groups: bogusgroup + obj_type: node + role: compute + security_info: + snmp: + securitylevel: noAuthNoPriv" >/tmp/import_validation_yaml_node_securitylevel/node.inv +check:rc==0 +cmd:xcat-inventory import -f /tmp/import_validation_yaml_node_securitylevel/node.inv +check:output=~Error: failed to validate attribute +check:output=~securitylevel +check:rc!=0 +cmd:lsdef bogusnode +check:output=~Error: Could not find an object named 'bogusnode' +check:rc!=0 + +cmd:if [[ -e /tmp/import_validation_yaml_node_securitylevel/bogusnode.stanza ]]; then cat /tmp/import_validation_yaml_node_securitylevel/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/import_validation_yaml_node_securitylevel/bogusgroup.stanza ]]; then cat /tmp/import_validation_yaml_node_securitylevel/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:rm -rf /tmp/import_validation_yaml_node_securitylevel +check:rc==0 +end diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage b/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage new file mode 100644 index 000000000..a957435f8 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.osimage @@ -0,0 +1,916 @@ +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. +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. +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 +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 +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 +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 +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 +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 +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 +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 + + diff --git a/xCAT-test/autotest/testcase/xcat-inventory/cases.site b/xCAT-test/autotest/testcase/xcat-inventory/cases.site new file mode 100644 index 000000000..e23b916a5 --- /dev/null +++ b/xCAT-test/autotest/testcase/xcat-inventory/cases.site @@ -0,0 +1,1356 @@ +start:export_import_site_by_yaml +description:This case is used to test xcat-inventory export and import site table by yaml between 2 excat same MNs. Before running this case, make sure these two MNs have been installed same excatly, 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. +cmd:mkdir -p /tmp/export_import_site_by_yaml +check:rc==0 +cmd:ssh $$DSTMN 'mkdir -p /tmp/export_import_site_by_yaml_$$DSTMN/' +check:rc==0 +cmd: lsdef -t site -o clustersite -z >/tmp/export_import_site_by_yaml/site.stanza +check:rc==0 +cmd:ssh $$DSTMN 'lsdef -t site -o clustersite -z >/tmp/export_import_site_by_yaml_$$DSTMN/site.stanza ' +check:rc==0 +cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');chdef -t site -o clustersite useSSHonAIX=0 useNFSv4onAIX=0 FQDNfirst=1 SNsyncfiledir='/var/xcat/syncfiles' auditnosyslog=0 auditskipcmds=ALL blademaxp=64 cleanupxcatpost=no consoleondemand=no databaseloc='/var/lib' db2installloc='/mntdb2' dbtracelevel=0 defserialflow=0 defserialport=0 defserialspeed=9600 dhcpinterfaces=eth0 dhcplease=43200 dhcpsetup=n disjointdhcps=1 dnshandler=ddns dnsinterfaces='xcatmn|eth1,eth2;service|bond0' dnsupdaters=dnsupdaters domain='pok.stglabs.ibm.com' enableASMI=no excludenodes=excludenodes externaldns=externaldns extntpservers=extntpservers forwarders=$mnip fsptimeout=0 genmacprefix='00:11:aa' genpasswords=genpasswords hierarchicalattrs=hierarchicalattrs httpport=80 hwctrldispatch=y installdir='/install/' installloc='hostname:/path' ipmidispatch=y ipmimaxp=64 ipmiretries=3 ipmisdrcache=no ipmitimeout=2 iscsidir='/iscsidir' managedaddressmode=dhcp master=$mnip maxssh=8 mnroutenames=mnroutenames nameservers=$mnip nmapoptions='--min-rtt-timeout' nodestatus=n nodesyncfiledir='/var/xcat/node/syncfiles' ntpservers=$mnip persistkvmguests=y powerinterval=0 ppcmaxp=64 ppcretry=3 ppctimeout=0 precreatemypostscripts=1 pruneservices=1 runbootscripts=yes setinstallnic=1 sharedinstall=no sharedtftp=1 skiptables=nics skipvalidatelog=1 snmpc=snmpc sshbetweennodes=ALLGROUPS svloglocal=1 syspowerinterval=10 syspowermaxnodes=10 tftpdir='/tftprot/' tftpflags='-v' timezone='America/New_York' useNmapfromMN=no useflowcontrol=no usexhrm=no vcenterautojoin=no vmwarereconfigonpower=no vsftp=n xcatconfdir='/etc/xcat' xcatdebugmode=1 xcatdport=3001 xcatiport=3002 xcatlport=3003 xcatmaxbatchconnections=64 xcatmaxconnections=60 xcatsslciphers='3DES' xcatsslversion=TLSv1 +check:rc==0 +cmd:lsdef -t site -o clustersite -z|sort -t'=' -k1 |tee /tmp/export_import_site_by_yaml/srcsite.stanza +check:rc==0 +cmd:xcat-inventory export --format=yaml -t site -o clustersite |tee /tmp/export_import_site_by_yaml/export_site_yaml.inv +check:rc==0 +cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');sed -i "s/$mnip/$$DSTMN/g" /tmp/export_import_site_by_yaml/export_site_yaml.inv +check:rc==0 +cmd:cat /tmp/export_import_site_by_yaml/export_site_yaml.inv +check:rc==0 +cmd:scp /tmp/export_import_site_by_yaml/export_site_yaml.inv $$DSTMN:/tmp/export_import_site_by_yaml_$$DSTMN/ +check:rc==0 +cmd: ssh $$DSTMN 'xcat-inventory import -f /tmp/export_import_site_by_yaml_$$DSTMN/export_site_yaml.inv -t site -o clustersite' +check:rc==0 +cmd: ssh $$DSTMN 'lsdef -t site -o clustersite -z |sort -t'=' -k1|tee /tmp/export_import_site_by_yaml_$$DSTMN/dstsite.stanza' +check:rc==0 +cmd: scp $$DSTMN:/tmp/export_import_site_by_yaml_$$DSTMN/dstsite.stanza /tmp/export_import_site_by_yaml/dstsite.stanza +check:rc==0 +cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');sed -i "s/$$DSTMN/$mnip/g" /tmp/export_import_site_by_yaml/dstsite.stanza +check:rc==0 +cmd: cat /tmp/export_import_site_by_yaml/dstsite.stanza +check:rc==0 +cmd:diff -y /tmp/export_import_site_by_yaml/srcsite.stanza /tmp/export_import_site_by_yaml/dstsite.stanza +check:rc==0 +cmd:cat /tmp/export_import_site_by_yaml/site.stanza | mkdef -z -f +check:rc==0 +cmd:ssh $$DSTMN 'cat /tmp/export_import_site_by_yaml_$$DSTMN/site.stanza | mkdef -z -f' +check:rc==0 +cmd:ssh $$DSTMN 'rm -rf /tmp/export_import_site_by_yaml_$$DSTMN/' +check:rc==0 +cmd:rm -rf /tmp/export_import_site_by_yaml +check:rc==0 +end + + +start:export_import_site_by_json +description:This case is used to test xcat-inventory export and import site table by json between 2 excat same MNs. Before running this case, make sure these two MNs have been installed same excatly, 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. +cmd:mkdir -p /tmp/export_import_site_by_json +check:rc==0 +cmd:ssh $$DSTMN 'mkdir -p /tmp/export_import_site_by_json_$$DSTMN/' +check:rc==0 +cmd: lsdef -t site -o clustersite -z >/tmp/export_import_site_by_json/site.stanza +check:rc==0 +cmd:ssh $$DSTMN 'lsdef -t site -o clustersite -z >/tmp/export_import_site_by_json_$$DSTMN/site.stanza ' +check:rc==0 +cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');chdef -t site -o clustersite useSSHonAIX=0 useNFSv4onAIX=0 FQDNfirst=1 SNsyncfiledir='/var/xcat/syncfiles' auditnosyslog=0 auditskipcmds=ALL blademaxp=64 cleanupxcatpost=no consoleondemand=no databaseloc='/var/lib' db2installloc='/mntdb2' dbtracelevel=0 defserialflow=0 defserialport=0 defserialspeed=9600 dhcpinterfaces=eth0 dhcplease=43200 dhcpsetup=n disjointdhcps=1 dnshandler=ddns dnsinterfaces='xcatmn|eth1,eth2;service|bond0' dnsupdaters=dnsupdaters domain='pok.stglabs.ibm.com' enableASMI=no excludenodes=excludenodes externaldns=externaldns extntpservers=extntpservers forwarders=$mnip fsptimeout=0 genmacprefix='00:11:aa' genpasswords=genpasswords hierarchicalattrs=hierarchicalattrs httpport=80 hwctrldispatch=y installdir='/install/' installloc='hostname:/path' ipmidispatch=y ipmimaxp=64 ipmiretries=3 ipmisdrcache=no ipmitimeout=2 iscsidir='/iscsidir' managedaddressmode=dhcp master=$mnip maxssh=8 mnroutenames=mnroutenames nameservers=$mnip nmapoptions='--min-rtt-timeout' nodestatus=n nodesyncfiledir='/var/xcat/node/syncfiles' ntpservers=$mnip persistkvmguests=y powerinterval=0 ppcmaxp=64 ppcretry=3 ppctimeout=0 precreatemypostscripts=1 pruneservices=1 runbootscripts=yes setinstallnic=1 sharedinstall=no sharedtftp=1 skiptables=nics skipvalidatelog=1 snmpc=snmpc sshbetweennodes=ALLGROUPS svloglocal=1 syspowerinterval=10 syspowermaxnodes=10 tftpdir='/tftprot/' tftpflags='-v' timezone='America/New_York' useNmapfromMN=no useflowcontrol=no usexhrm=no vcenterautojoin=no vmwarereconfigonpower=no vsftp=n xcatconfdir='/etc/xcat' xcatdebugmode=1 xcatdport=3001 xcatiport=3002 xcatlport=3003 xcatmaxbatchconnections=64 xcatmaxconnections=60 xcatsslciphers='3DES' xcatsslversion=TLSv1 +check:rc==0 +cmd:lsdef -t site -o clustersite -z|sort -t'=' -k1 |tee /tmp/export_import_site_by_json/srcsite.stanza +check:rc==0 +cmd:xcat-inventory export --format=json -t site -o clustersite |tee /tmp/export_import_site_by_json/export_site_json.inv +check:rc==0 +cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');sed -i "s/$mnip/$$DSTMN/g" /tmp/export_import_site_by_json/export_site_json.inv +check:rc==0 +cmd:cat /tmp/export_import_site_by_json/export_site_json.inv +check:rc==0 +cmd:scp /tmp/export_import_site_by_json/export_site_json.inv $$DSTMN:/tmp/export_import_site_by_json_$$DSTMN/ +check:rc==0 +cmd: ssh $$DSTMN 'xcat-inventory import -f /tmp/export_import_site_by_json_$$DSTMN/export_site_json.inv -t site -o clustersite' +check:rc==0 +cmd: ssh $$DSTMN 'lsdef -t site -o clustersite -z |sort -t'=' -k1|tee /tmp/export_import_site_by_json_$$DSTMN/dstsite.stanza' +check:rc==0 +cmd: scp $$DSTMN:/tmp/export_import_site_by_json_$$DSTMN/dstsite.stanza /tmp/export_import_site_by_json/dstsite.stanza +check:rc==0 +cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');sed -i "s/$$DSTMN/$mnip/g" /tmp/export_import_site_by_json/dstsite.stanza +check:rc==0 +cmd: cat /tmp/export_import_site_by_json/dstsite.stanza +check:rc==0 +cmd:diff -y /tmp/export_import_site_by_json/srcsite.stanza /tmp/export_import_site_by_json/dstsite.stanza +check:rc==0 +cmd:cat /tmp/export_import_site_by_json/site.stanza | mkdef -z -f +check:rc==0 +cmd:ssh $$DSTMN 'cat /tmp/export_import_site_by_json_$$DSTMN/site.stanza | mkdef -z -f' +check:rc==0 +cmd:ssh $$DSTMN 'rm -rf /tmp/export_import_site_by_json_$$DSTMN/' +check:rc==0 +cmd:rm -rf /tmp/export_import_site_by_json +check:rc==0 +end + + +start:xcat_inventory_try_to_export_all_type_is_site_default_format +description:This case is used to test xcat-inventory export all definition which type is site to default file. I.e. json file +cmd:mkdir -p /tmp/xcat_inventory_try_to_export_all_type_is_site_default_format +check:rc==0 +cmd: lsdef -t site -o clustersite -z >/tmp/xcat_inventory_try_to_export_all_type_is_site_default_format/site.stanza +check:rc==0 +cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');chdef -t site -o clustersite useSSHonAIX=0 useNFSv4onAIX=0 FQDNfirst=1 SNsyncfiledir='/var/xcat/syncfiles' auditnosyslog=0 auditskipcmds=ALL blademaxp=64 cleanupxcatpost=no consoleondemand=no databaseloc='/var/lib' db2installloc='/mntdb2' dbtracelevel=0 defserialflow=0 defserialport=0 defserialspeed=9600 dhcpinterfaces=eth0 dhcplease=43200 dhcpsetup=n disjointdhcps=1 dnshandler=ddns dnsinterfaces='xcatmn|eth1,eth2;service|bond0' dnsupdaters=dnsupdaters domain='pok.stglabs.ibm.com' enableASMI=no excludenodes=excludenodes externaldns=externaldns extntpservers=extntpservers forwarders=$mnip fsptimeout=0 genmacprefix='00:11:aa' genpasswords=genpasswords hierarchicalattrs=hierarchicalattrs httpport=80 hwctrldispatch=y installdir='/install/' installloc='hostname:/path' ipmidispatch=y ipmimaxp=64 ipmiretries=3 ipmisdrcache=no ipmitimeout=2 iscsidir='/iscsidir' managedaddressmode=dhcp master=$mnip maxssh=8 mnroutenames=mnroutenames nameservers=$mnip nmapoptions='--min-rtt-timeout' nodestatus=n nodesyncfiledir='/var/xcat/node/syncfiles' ntpservers=$mnip persistkvmguests=y powerinterval=0 ppcmaxp=64 ppcretry=3 ppctimeout=0 precreatemypostscripts=1 pruneservices=1 runbootscripts=yes setinstallnic=1 sharedinstall=no sharedtftp=1 skiptables=nics skipvalidatelog=1 snmpc=snmpc sshbetweennodes=ALLGROUPS svloglocal=1 syspowerinterval=10 syspowermaxnodes=10 tftpdir='/tftprot/' tftpflags='-v' timezone='America/New_York' useNmapfromMN=no useflowcontrol=no usexhrm=no vcenterautojoin=no vmwarereconfigonpower=no vsftp=n xcatconfdir='/etc/xcat' xcatdebugmode=1 xcatdport=3001 xcatiport=3002 xcatlport=3003 xcatmaxbatchconnections=64 xcatmaxconnections=60 xcatsslciphers='3DES' xcatsslversion=TLSv1 +check:rc==0 +cmd:#!/bin/bash +echo '{ + "schema_version": "1.0", + "site": { + "clustersite": { + "FQDNfirst": "1", + "SNsyncfiledir": "/var/xcat/syncfiles", + "auditnosyslog": "0", + "auditskipcmds": "ALL", + "blademaxp": "64", + "cleanupxcatpost": "no", + "consoleondemand": "no", + "databaseloc": "/var/lib", + "db2installloc": "/mntdb2", + "dbtracelevel": "0", + "defserialflow": "0", + "defserialport": "0", + "defserialspeed": "9600", + "dhcpinterfaces": "eth0", + "dhcplease": "43200", + "dhcpsetup": "n", + "disjointdhcps": "1", + "dnshandler": "ddns", + "dnsinterfaces": "xcatmn|eth1,eth2;service|bond0", + "dnsupdaters": "dnsupdaters", + "domain": "pok.stglabs.ibm.com", + "enableASMI": "no", + "excludenodes": "excludenodes", + "externaldns": "externaldns", + "extntpservers": "extntpservers", + "forwarders": "10.3.5.8", + "fsptimeout": "0", + "genmacprefix": "00:11:aa", + "genpasswords": "genpasswords", + "hierarchicalattrs": "hierarchicalattrs", + "httpport": "80", + "hwctrldispatch": "y", + "installdir": "/install/", + "installloc": "hostname:/path", + "ipmidispatch": "y", + "ipmimaxp": "64", + "ipmiretries": "3", + "ipmisdrcache": "no", + "ipmitimeout": "2", + "iscsidir": "/iscsidir", + "managedaddressmode": "dhcp", + "master": "10.3.5.8", + "maxssh": "8", + "mnroutenames": "mnroutenames", + "nameservers": "10.3.5.8", + "nmapoptions": "--min-rtt-timeout", + "nodestatus": "n", + "nodesyncfiledir": "/var/xcat/node/syncfiles", + "ntpservers": "10.3.5.8", + "persistkvmguests": "y", + "powerinterval": "0", + "ppcmaxp": "64", + "ppcretry": "3", + "ppctimeout": "0", + "precreatemypostscripts": "1", + "pruneservices": "1", + "runbootscripts": "yes", + "setinstallnic": "1", + "sharedinstall": "no", + "sharedtftp": "1", + "skiptables": "nics", + "skipvalidatelog": "1", + "snmpc": "snmpc", + "sshbetweennodes": "ALLGROUPS", + "svloglocal": "1", + "syspowerinterval": "10", + "syspowermaxnodes": "10", + "tftpdir": "/tftprot/", + "tftpflags": "-v", + "timezone": "America/New_York", + "useNFSv4onAIX": "0", + "useNmapfromMN": "no", + "useSSHonAIX": "0", + "useflowcontrol": "no", + "usexhrm": "no", + "vcenterautojoin": "no", + "vmwarereconfigonpower": "no", + "vsftp": "n", + "xcatconfdir": "/etc/xcat", + "xcatdebugmode": "1", + "xcatdport": "3001", + "xcatiport": "3002", + "xcatlport": "3003", + "xcatmaxbatchconnections": "64", + "xcatmaxconnections": "60", + "xcatsslciphers": "3DES", + "xcatsslversion": "TLSv1" + } + } +}' > /tmp/xcat_inventory_try_to_export_all_type_is_site_default_format/site.org +cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');sed -i "s/10.3.5.8/$mnip/g" /tmp/xcat_inventory_try_to_export_all_type_is_site_default_format/site.org +check:rc==0 +cmd:xcat-inventory export -t site |tee /tmp/xcat_inventory_try_to_export_all_type_is_site_default_format/site.export +check:rc==0 +cmd:diff -y /tmp/xcat_inventory_try_to_export_all_type_is_site_default_format/site.org /tmp/xcat_inventory_try_to_export_all_type_is_site_default_format/site.export +check:rc==0 +cmd:cat /tmp/xcat_inventory_try_to_export_all_type_is_site_default_format/site.stanza | mkdef -z -f +check:rc==0 +cmd:rm -rf /tmp/xcat_inventory_try_to_export_all_type_is_site_default_format +check:rc==0 +end + +start:xcat_inventory_try_to_export_all_type_is_site_json_format +description:This case is used to test xcat-inventory export all definition which type is site to default file. I.e. json file +cmd:mkdir -p /tmp/xcat_inventory_try_to_export_all_type_is_site_json_format +check:rc==0 +cmd: lsdef -t site -o clustersite -z >/tmp/xcat_inventory_try_to_export_all_type_is_site_json_format/site.stanza +check:rc==0 +cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');chdef -t site -o clustersite useSSHonAIX=0 useNFSv4onAIX=0 FQDNfirst=1 SNsyncfiledir='/var/xcat/syncfiles' auditnosyslog=0 auditskipcmds=ALL blademaxp=64 cleanupxcatpost=no consoleondemand=no databaseloc='/var/lib' db2installloc='/mntdb2' dbtracelevel=0 defserialflow=0 defserialport=0 defserialspeed=9600 dhcpinterfaces=eth0 dhcplease=43200 dhcpsetup=n disjointdhcps=1 dnshandler=ddns dnsinterfaces='xcatmn|eth1,eth2;service|bond0' dnsupdaters=dnsupdaters domain='pok.stglabs.ibm.com' enableASMI=no excludenodes=excludenodes externaldns=externaldns extntpservers=extntpservers forwarders=$mnip fsptimeout=0 genmacprefix='00:11:aa' genpasswords=genpasswords hierarchicalattrs=hierarchicalattrs httpport=80 hwctrldispatch=y installdir='/install/' installloc='hostname:/path' ipmidispatch=y ipmimaxp=64 ipmiretries=3 ipmisdrcache=no ipmitimeout=2 iscsidir='/iscsidir' managedaddressmode=dhcp master=$mnip maxssh=8 mnroutenames=mnroutenames nameservers=$mnip nmapoptions='--min-rtt-timeout' nodestatus=n nodesyncfiledir='/var/xcat/node/syncfiles' ntpservers=$mnip persistkvmguests=y powerinterval=0 ppcmaxp=64 ppcretry=3 ppctimeout=0 precreatemypostscripts=1 pruneservices=1 runbootscripts=yes setinstallnic=1 sharedinstall=no sharedtftp=1 skiptables=nics skipvalidatelog=1 snmpc=snmpc sshbetweennodes=ALLGROUPS svloglocal=1 syspowerinterval=10 syspowermaxnodes=10 tftpdir='/tftprot/' tftpflags='-v' timezone='America/New_York' useNmapfromMN=no useflowcontrol=no usexhrm=no vcenterautojoin=no vmwarereconfigonpower=no vsftp=n xcatconfdir='/etc/xcat' xcatdebugmode=1 xcatdport=3001 xcatiport=3002 xcatlport=3003 xcatmaxbatchconnections=64 xcatmaxconnections=60 xcatsslciphers='3DES' xcatsslversion=TLSv1 +check:rc==0 +cmd:#!/bin/bash +echo '{ + "schema_version": "1.0", + "site": { + "clustersite": { + "FQDNfirst": "1", + "SNsyncfiledir": "/var/xcat/syncfiles", + "auditnosyslog": "0", + "auditskipcmds": "ALL", + "blademaxp": "64", + "cleanupxcatpost": "no", + "consoleondemand": "no", + "databaseloc": "/var/lib", + "db2installloc": "/mntdb2", + "dbtracelevel": "0", + "defserialflow": "0", + "defserialport": "0", + "defserialspeed": "9600", + "dhcpinterfaces": "eth0", + "dhcplease": "43200", + "dhcpsetup": "n", + "disjointdhcps": "1", + "dnshandler": "ddns", + "dnsinterfaces": "xcatmn|eth1,eth2;service|bond0", + "dnsupdaters": "dnsupdaters", + "domain": "pok.stglabs.ibm.com", + "enableASMI": "no", + "excludenodes": "excludenodes", + "externaldns": "externaldns", + "extntpservers": "extntpservers", + "forwarders": "10.3.5.8", + "fsptimeout": "0", + "genmacprefix": "00:11:aa", + "genpasswords": "genpasswords", + "hierarchicalattrs": "hierarchicalattrs", + "httpport": "80", + "hwctrldispatch": "y", + "installdir": "/install/", + "installloc": "hostname:/path", + "ipmidispatch": "y", + "ipmimaxp": "64", + "ipmiretries": "3", + "ipmisdrcache": "no", + "ipmitimeout": "2", + "iscsidir": "/iscsidir", + "managedaddressmode": "dhcp", + "master": "10.3.5.8", + "maxssh": "8", + "mnroutenames": "mnroutenames", + "nameservers": "10.3.5.8", + "nmapoptions": "--min-rtt-timeout", + "nodestatus": "n", + "nodesyncfiledir": "/var/xcat/node/syncfiles", + "ntpservers": "10.3.5.8", + "persistkvmguests": "y", + "powerinterval": "0", + "ppcmaxp": "64", + "ppcretry": "3", + "ppctimeout": "0", + "precreatemypostscripts": "1", + "pruneservices": "1", + "runbootscripts": "yes", + "setinstallnic": "1", + "sharedinstall": "no", + "sharedtftp": "1", + "skiptables": "nics", + "skipvalidatelog": "1", + "snmpc": "snmpc", + "sshbetweennodes": "ALLGROUPS", + "svloglocal": "1", + "syspowerinterval": "10", + "syspowermaxnodes": "10", + "tftpdir": "/tftprot/", + "tftpflags": "-v", + "timezone": "America/New_York", + "useNFSv4onAIX": "0", + "useNmapfromMN": "no", + "useSSHonAIX": "0", + "useflowcontrol": "no", + "usexhrm": "no", + "vcenterautojoin": "no", + "vmwarereconfigonpower": "no", + "vsftp": "n", + "xcatconfdir": "/etc/xcat", + "xcatdebugmode": "1", + "xcatdport": "3001", + "xcatiport": "3002", + "xcatlport": "3003", + "xcatmaxbatchconnections": "64", + "xcatmaxconnections": "60", + "xcatsslciphers": "3DES", + "xcatsslversion": "TLSv1" + } + } +}' > /tmp/xcat_inventory_try_to_export_all_type_is_site_json_format/site.org +cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');sed -i "s/10.3.5.8/$mnip/g" /tmp/xcat_inventory_try_to_export_all_type_is_site_json_format/site.org +check:rc==0 +cmd:xcat-inventory export --format=json -t site |tee /tmp/xcat_inventory_try_to_export_all_type_is_site_json_format/site.export +check:rc==0 +cmd:diff -y /tmp/xcat_inventory_try_to_export_all_type_is_site_json_format/site.org /tmp/xcat_inventory_try_to_export_all_type_is_site_json_format/site.export +check:rc==0 +cmd:cat /tmp/xcat_inventory_try_to_export_all_type_is_site_json_format/site.stanza | mkdef -z -f +check:rc==0 +cmd:rm -rf /tmp/xcat_inventory_try_to_export_all_type_is_site_json_format +check:rc==0 +end + +start:xcat_inventory_try_to_export_all_type_is_site_yaml_format +description:This case is used to test xcat-inventory export all definition which type is site to default file. I.e. json file +cmd:mkdir -p /tmp/xcat_inventory_try_to_export_all_type_is_site_yaml_format +check:rc==0 +cmd: lsdef -t site -o clustersite -z >/tmp/xcat_inventory_try_to_export_all_type_is_site_yaml_format/site.stanza +check:rc==0 +cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');chdef -t site -o clustersite useSSHonAIX=0 useNFSv4onAIX=0 FQDNfirst=1 SNsyncfiledir='/var/xcat/syncfiles' auditnosyslog=0 auditskipcmds=ALL blademaxp=64 cleanupxcatpost=no consoleondemand=no databaseloc='/var/lib' db2installloc='/mntdb2' dbtracelevel=0 defserialflow=0 defserialport=0 defserialspeed=9600 dhcpinterfaces=eth0 dhcplease=43200 dhcpsetup=n disjointdhcps=1 dnshandler=ddns dnsinterfaces='xcatmn|eth1,eth2;service|bond0' dnsupdaters=dnsupdaters domain='pok.stglabs.ibm.com' enableASMI=no excludenodes=excludenodes externaldns=externaldns extntpservers=extntpservers forwarders=$mnip fsptimeout=0 genmacprefix='00:11:aa' genpasswords=genpasswords hierarchicalattrs=hierarchicalattrs httpport=80 hwctrldispatch=y installdir='/install/' installloc='hostname:/path' ipmidispatch=y ipmimaxp=64 ipmiretries=3 ipmisdrcache=no ipmitimeout=2 iscsidir='/iscsidir' managedaddressmode=dhcp master=$mnip maxssh=8 mnroutenames=mnroutenames nameservers=$mnip nmapoptions='--min-rtt-timeout' nodestatus=n nodesyncfiledir='/var/xcat/node/syncfiles' ntpservers=$mnip persistkvmguests=y powerinterval=0 ppcmaxp=64 ppcretry=3 ppctimeout=0 precreatemypostscripts=1 pruneservices=1 runbootscripts=yes setinstallnic=1 sharedinstall=no sharedtftp=1 skiptables=nics skipvalidatelog=1 snmpc=snmpc sshbetweennodes=ALLGROUPS svloglocal=1 syspowerinterval=10 syspowermaxnodes=10 tftpdir='/tftprot/' tftpflags='-v' timezone='America/New_York' useNmapfromMN=no useflowcontrol=no usexhrm=no vcenterautojoin=no vmwarereconfigonpower=no vsftp=n xcatconfdir='/etc/xcat' xcatdebugmode=1 xcatdport=3001 xcatiport=3002 xcatlport=3003 xcatmaxbatchconnections=64 xcatmaxconnections=60 xcatsslciphers='3DES' xcatsslversion=TLSv1 +check:rc==0 +cmd:#!/bin/bash +echo "schema_version: '1.0' +site: + clustersite: + FQDNfirst: '1' + SNsyncfiledir: /var/xcat/syncfiles + auditnosyslog: '0' + auditskipcmds: ALL + blademaxp: '64' + cleanupxcatpost: 'no' + consoleondemand: 'no' + databaseloc: /var/lib + db2installloc: /mntdb2 + dbtracelevel: '0' + defserialflow: '0' + defserialport: '0' + defserialspeed: '9600' + dhcpinterfaces: eth0 + dhcplease: '43200' + dhcpsetup: n + disjointdhcps: '1' + dnshandler: ddns + dnsinterfaces: xcatmn|eth1,eth2;service|bond0 + dnsupdaters: dnsupdaters + domain: pok.stglabs.ibm.com + enableASMI: 'no' + excludenodes: excludenodes + externaldns: externaldns + extntpservers: extntpservers + forwarders: 10.3.5.8 + fsptimeout: '0' + genmacprefix: 00:11:aa + genpasswords: genpasswords + hierarchicalattrs: hierarchicalattrs + httpport: '80' + hwctrldispatch: y + installdir: /install/ + installloc: hostname:/path + ipmidispatch: y + ipmimaxp: '64' + ipmiretries: '3' + ipmisdrcache: 'no' + ipmitimeout: '2' + iscsidir: /iscsidir + managedaddressmode: dhcp + master: 10.3.5.8 + maxssh: '8' + mnroutenames: mnroutenames + nameservers: 10.3.5.8 + nmapoptions: --min-rtt-timeout + nodestatus: n + nodesyncfiledir: /var/xcat/node/syncfiles + ntpservers: 10.3.5.8 + persistkvmguests: y + powerinterval: '0' + ppcmaxp: '64' + ppcretry: '3' + ppctimeout: '0' + precreatemypostscripts: '1' + pruneservices: '1' + runbootscripts: 'yes' + setinstallnic: '1' + sharedinstall: 'no' + sharedtftp: '1' + skiptables: nics + skipvalidatelog: '1' + snmpc: snmpc + sshbetweennodes: ALLGROUPS + svloglocal: '1' + syspowerinterval: '10' + syspowermaxnodes: '10' + tftpdir: /tftprot/ + tftpflags: -v + timezone: America/New_York + useNFSv4onAIX: '0' + useNmapfromMN: 'no' + useSSHonAIX: '0' + useflowcontrol: 'no' + usexhrm: 'no' + vcenterautojoin: 'no' + vmwarereconfigonpower: 'no' + vsftp: n + xcatconfdir: /etc/xcat + xcatdebugmode: '1' + xcatdport: '3001' + xcatiport: '3002' + xcatlport: '3003' + xcatmaxbatchconnections: '64' + xcatmaxconnections: '60' + xcatsslciphers: 3DES + xcatsslversion: TLSv1" > /tmp/xcat_inventory_try_to_export_all_type_is_site_yaml_format/site.org +cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');sed -i "s/10.3.5.8/$mnip/g" /tmp/xcat_inventory_try_to_export_all_type_is_site_yaml_format/site.org +check:rc==0 +cmd:xcat-inventory export --format=yaml -t site|sed -e '/^\s*$/d' |tee /tmp/xcat_inventory_try_to_export_all_type_is_site_yaml_format/site.export +check:rc==0 +cmd:diff -y /tmp/xcat_inventory_try_to_export_all_type_is_site_yaml_format/site.org /tmp/xcat_inventory_try_to_export_all_type_is_site_yaml_format/site.export +check:rc==0 +cmd:cat /tmp/xcat_inventory_try_to_export_all_type_is_site_yaml_format/site.stanza | mkdef -z -f +check:rc==0 +cmd:rm -rf /tmp/xcat_inventory_try_to_export_all_type_is_site_yaml_format +check:rc==0 +end + + +start:xcat_inventory_try_to_import_all_type_is_site_json_format +description:This case is used to test xcat-inventory impport all definition which type is site from json file. +cmd:mkdir -p /tmp/xcat_inventory_try_to_import_all_type_is_site_json_format +check:rc==0 +cmd: lsdef -t site -o clustersite -z >/tmp/xcat_inventory_try_to_import_all_type_is_site_json_format/site.stanza +check:rc==0 +cmd:for i in 1 2 3; do lsdef bogusnode$i > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode$i -z >> /tmp/xcat_inventory_try_to_import_all_type_is_site_json_format/bogusnode.stanza ;rmdef bogusnode$i;fi;done +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z >> /tmp/xcat_inventory_try_to_import_all_type_is_site_json_format/bogusnode.stanza;rmdef -t group bogusgroup; fi +check:rc==0 +cmd:#!/usr/bin/bash +echo '{ + "network": { + "100_0_0_0-255_0_0_0": { + "basic_attr": { + "gateway": "100.0.0.103", + "mask": "255.0.0.0", + "mgtifname": "eth0", + "mtu": "1500", + "net": "100.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": "testgroup" + }, + "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": "testgroup" + }, + "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": "testgroup" + }, + "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": {}, + "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": { + "clustersite": { + "FQDNfirst": "1", + "SNsyncfiledir": "/var/xcat/syncfiles", + "auditnosyslog": "0", + "auditskipcmds": "ALL", + "blademaxp": "64", + "cleanupxcatpost": "no", + "consoleondemand": "no", + "databaseloc": "/var/lib", + "db2installloc": "/mntdb2", + "dbtracelevel": "0", + "defserialflow": "0", + "defserialport": "0", + "defserialspeed": "9600", + "dhcpinterfaces": "eth0", + "dhcplease": "43200", + "dhcpsetup": "n", + "disjointdhcps": "1", + "dnshandler": "ddns", + "dnsinterfaces": "xcatmn|eth1,eth2;service|bond0", + "dnsupdaters": "dnsupdaters", + "domain": "pok.stglabs.ibm.com", + "enableASMI": "no", + "excludenodes": "excludenodes", + "externaldns": "externaldns", + "extntpservers": "extntpservers", + "forwarders": "10.3.5.8", + "fsptimeout": "0", + "genmacprefix": "00:11:aa", + "genpasswords": "genpasswords", + "hierarchicalattrs": "hierarchicalattrs", + "httpport": "80", + "hwctrldispatch": "y", + "installdir": "/install/", + "installloc": "hostname:/path", + "ipmidispatch": "y", + "ipmimaxp": "64", + "ipmiretries": "3", + "ipmisdrcache": "no", + "ipmitimeout": "2", + "iscsidir": "/iscsidir", + "managedaddressmode": "dhcp", + "master": "10.3.5.8", + "maxssh": "8", + "mnroutenames": "mnroutenames", + "nameservers": "10.3.5.8", + "nmapoptions": "--min-rtt-timeout", + "nodestatus": "n", + "nodesyncfiledir": "/var/xcat/node/syncfiles", + "ntpservers": "10.3.5.8", + "persistkvmguests": "y", + "powerinterval": "0", + "ppcmaxp": "64", + "ppcretry": "3", + "ppctimeout": "0", + "precreatemypostscripts": "1", + "pruneservices": "1", + "runbootscripts": "yes", + "setinstallnic": "1", + "sharedinstall": "no", + "sharedtftp": "1", + "skiptables": "nics", + "skipvalidatelog": "1", + "snmpc": "snmpc", + "sshbetweennodes": "ALLGROUPS", + "svloglocal": "1", + "syspowerinterval": "10", + "syspowermaxnodes": "10", + "tftpdir": "/tftprot/", + "tftpflags": "-v", + "timezone": "America/New_York", + "useNFSv4onAIX": "0", + "useNmapfromMN": "no", + "useSSHonAIX": "0", + "useflowcontrol": "no", + "usexhrm": "no", + "vcenterautojoin": "no", + "vmwarereconfigonpower": "no", + "vsftp": "n", + "xcatconfdir": "/etc/xcat", + "xcatdebugmode": "1", + "xcatdport": "3001", + "xcatiport": "3002", + "xcatlport": "3003", + "xcatmaxbatchconnections": "64", + "xcatmaxconnections": "60", + "xcatsslciphers": "3DES", + "xcatsslversion": "TLSv1" + } + } +}' > /tmp/xcat_inventory_try_to_import_all_type_is_site_json_format/json.test +check:rc==0 +cmd:#!/bin/bash +echo "Object name: clustersite + FQDNfirst=1 + SNsyncfiledir=/var/xcat/syncfiles + auditnosyslog=0 + auditskipcmds=ALL + blademaxp=64 + cleanupxcatpost=no + consoleondemand=no + databaseloc=/var/lib + db2installloc=/mntdb2 + dbtracelevel=0 + defserialflow=0 + defserialport=0 + defserialspeed=9600 + dhcpinterfaces=eth0 + dhcplease=43200 + dhcpsetup=n + disjointdhcps=1 + dnshandler=ddns + dnsinterfaces=xcatmn|eth1,eth2;service|bond0 + dnsupdaters=dnsupdaters + domain=pok.stglabs.ibm.com + enableASMI=no + excludenodes=excludenodes + externaldns=externaldns + extntpservers=extntpservers + forwarders=10.3.5.8 + fsptimeout=0 + genmacprefix=00:11:aa + genpasswords=genpasswords + hierarchicalattrs=hierarchicalattrs + httpport=80 + hwctrldispatch=y + installdir=/install/ + installloc=hostname:/path + ipmidispatch=y + ipmimaxp=64 + ipmiretries=3 + ipmisdrcache=no + ipmitimeout=2 + iscsidir=/iscsidir + managedaddressmode=dhcp + master=10.3.5.8 + maxssh=8 + mnroutenames=mnroutenames + nameservers=10.3.5.8 + nmapoptions=--min-rtt-timeout + nodestatus=n + nodesyncfiledir=/var/xcat/node/syncfiles + ntpservers=10.3.5.8 + persistkvmguests=y + powerinterval=0 + ppcmaxp=64 + ppcretry=3 + ppctimeout=0 + precreatemypostscripts=1 + pruneservices=1 + runbootscripts=yes + setinstallnic=1 + sharedinstall=no + sharedtftp=1 + skiptables=nics + skipvalidatelog=1 + snmpc=snmpc + sshbetweennodes=ALLGROUPS + svloglocal=1 + syspowerinterval=10 + syspowermaxnodes=10 + tftpdir=/tftprot/ + tftpflags=-v + timezone=America/New_York + useNFSv4onAIX=0 + useNmapfromMN=no + useSSHonAIX=0 + useflowcontrol=no + usexhrm=no + vcenterautojoin=no + vmwarereconfigonpower=no + vsftp=n + xcatconfdir=/etc/xcat + xcatdebugmode=1 + xcatdport=3001 + xcatiport=3002 + xcatlport=3003 + xcatmaxbatchconnections=64 + xcatmaxconnections=60 + xcatsslciphers=3DES + xcatsslversion=TLSv1"> /tmp/xcat_inventory_try_to_import_all_type_is_site_json_format/site.org +check:rc==0 +cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');sed -i "s/10.3.5.8/$mnip/g" /tmp/xcat_inventory_try_to_import_all_type_is_site_json_format/site.org +check:rc==0 +cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');sed -i "s/10.3.5.8/$mnip/g" /tmp/xcat_inventory_try_to_import_all_type_is_site_json_format/json.test +check:rc==0 +cmd:xcat-inventory import -f /tmp/xcat_inventory_try_to_import_all_type_is_site_json_format/json.test -t site +check:rc==0 +cmd:lsdef -t site -o clustersite > /tmp/xcat_inventory_try_to_import_all_type_is_site_json_format/site.import +check:rc==0 +cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_site_json_format/site.org /tmp/xcat_inventory_try_to_import_all_type_is_site_json_format/site.import +check:rc==0 +cmd:lsdef bogusgroup1 +check:output=~Error: Could not find an object +check:rc!=0 +cmd:lsdef bogusgroup2 +check:output=~Error: Could not find an object +check:rc!=0 +cmd:lsdef bogusgroup3 +check:output=~Error: Could not find an object +check:rc!=0 +cmd:tabdump networks|grep 100_0_0_0-255_0_0_0 +check:rc!=0 +cmd:if [[ -e /tmp/xcat_inventory_try_to_import_all_type_is_site_json_format/bogusnode.stanza ]]; then cat /tmp/xcat_inventory_try_to_import_all_type_is_site_json_format/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/xcat_inventory_try_to_import_all_type_is_site_json_format/bogusgroup.stanza ]];then cat /tmp/xcat_inventory_try_to_import_all_type_is_site_json_format/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:cat /tmp/xcat_inventory_try_to_import_all_type_is_site_json_format/site.stanza | mkdef -z -f +check:rc==0 +cmd:rm -rf /tmp/xcat_inventory_try_to_import_all_type_is_site_json_format +check:rc==0 +end + +start:xcat_inventory_try_to_import_all_type_is_site_yaml_format +description:This case is used to test xcat-inventory impport all definition which type is site from json file. +cmd:mkdir -p /tmp/xcat_inventory_try_to_import_all_type_is_site_yaml_format +check:rc==0 +cmd: lsdef -t site -o clustersite -z >/tmp/xcat_inventory_try_to_import_all_type_is_site_yaml_format/site.stanza +check:rc==0 +cmd:for i in 1 2 3; do lsdef bogusnode$i > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef bogusnode$i -z >> /tmp/xcat_inventory_try_to_import_all_type_is_site_yaml_format/bogusnode.stanza ;rmdef bogusnode$i;fi;done +check:rc==0 +cmd:lsdef -t group bogusgroup > /dev/null 2>&1;if [[ $? -eq 0 ]]; then lsdef -t group bogusgroup -z >> /tmp/xcat_inventory_try_to_import_all_type_is_site_yaml_format/bogusnode.stanza;rmdef -t group bogusgroup; fi +check:rc==0 +cmd:#!/usr/bin/bash +echo "network: + 100_0_0_0-255_0_0_0: + basic_attr: + gateway: 100.0.0.103 + mask: 255.0.0.0 + mgtifname: eth0 + mtu: '1500' + net: 100.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: testgroup + 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: testgroup + 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: testgroup + 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: {} +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: + clustersite: + FQDNfirst: '1' + SNsyncfiledir: /var/xcat/syncfiles + auditnosyslog: '0' + auditskipcmds: ALL + blademaxp: '64' + cleanupxcatpost: 'no' + consoleondemand: 'no' + databaseloc: /var/lib + db2installloc: /mntdb2 + dbtracelevel: '0' + defserialflow: '0' + defserialport: '0' + defserialspeed: '9600' + dhcpinterfaces: eth0 + dhcplease: '43200' + dhcpsetup: n + disjointdhcps: '1' + dnshandler: ddns + dnsinterfaces: xcatmn|eth1,eth2;service|bond0 + dnsupdaters: dnsupdaters + domain: pok.stglabs.ibm.com + enableASMI: 'no' + excludenodes: excludenodes + externaldns: externaldns + extntpservers: extntpservers + forwarders: 10.3.5.8 + fsptimeout: '0' + genmacprefix: 00:11:aa + genpasswords: genpasswords + hierarchicalattrs: hierarchicalattrs + httpport: '80' + hwctrldispatch: y + installdir: /install/ + installloc: hostname:/path + ipmidispatch: y + ipmimaxp: '64' + ipmiretries: '3' + ipmisdrcache: 'no' + ipmitimeout: '2' + iscsidir: /iscsidir + managedaddressmode: dhcp + master: 10.3.5.8 + maxssh: '8' + mnroutenames: mnroutenames + nameservers: 10.3.5.8 + nmapoptions: --min-rtt-timeout + nodestatus: n + nodesyncfiledir: /var/xcat/node/syncfiles + ntpservers: 10.3.5.8 + persistkvmguests: y + powerinterval: '0' + ppcmaxp: '64' + ppcretry: '3' + ppctimeout: '0' + precreatemypostscripts: '1' + pruneservices: '1' + runbootscripts: 'yes' + setinstallnic: '1' + sharedinstall: 'no' + sharedtftp: '1' + skiptables: nics + skipvalidatelog: '1' + snmpc: snmpc + sshbetweennodes: ALLGROUPS + svloglocal: '1' + syspowerinterval: '10' + syspowermaxnodes: '10' + tftpdir: /tftprot/ + tftpflags: -v + timezone: America/New_York + useNFSv4onAIX: '0' + useNmapfromMN: 'no' + useSSHonAIX: '0' + useflowcontrol: 'no' + usexhrm: 'no' + vcenterautojoin: 'no' + vmwarereconfigonpower: 'no' + vsftp: n + xcatconfdir: /etc/xcat + xcatdebugmode: '1' + xcatdport: '3001' + xcatiport: '3002' + xcatlport: '3003' + xcatmaxbatchconnections: '64' + xcatmaxconnections: '60' + xcatsslciphers: 3DES + xcatsslversion: TLSv1" > /tmp/xcat_inventory_try_to_import_all_type_is_site_yaml_format/yaml.test +check:rc==0 +cmd:#!/bin/bash +echo "Object name: clustersite + FQDNfirst=1 + SNsyncfiledir=/var/xcat/syncfiles + auditnosyslog=0 + auditskipcmds=ALL + blademaxp=64 + cleanupxcatpost=no + consoleondemand=no + databaseloc=/var/lib + db2installloc=/mntdb2 + dbtracelevel=0 + defserialflow=0 + defserialport=0 + defserialspeed=9600 + dhcpinterfaces=eth0 + dhcplease=43200 + dhcpsetup=n + disjointdhcps=1 + dnshandler=ddns + dnsinterfaces=xcatmn|eth1,eth2;service|bond0 + dnsupdaters=dnsupdaters + domain=pok.stglabs.ibm.com + enableASMI=no + excludenodes=excludenodes + externaldns=externaldns + extntpservers=extntpservers + forwarders=10.3.5.8 + fsptimeout=0 + genmacprefix=00:11:aa + genpasswords=genpasswords + hierarchicalattrs=hierarchicalattrs + httpport=80 + hwctrldispatch=y + installdir=/install/ + installloc=hostname:/path + ipmidispatch=y + ipmimaxp=64 + ipmiretries=3 + ipmisdrcache=no + ipmitimeout=2 + iscsidir=/iscsidir + managedaddressmode=dhcp + master=10.3.5.8 + maxssh=8 + mnroutenames=mnroutenames + nameservers=10.3.5.8 + nmapoptions=--min-rtt-timeout + nodestatus=n + nodesyncfiledir=/var/xcat/node/syncfiles + ntpservers=10.3.5.8 + persistkvmguests=y + powerinterval=0 + ppcmaxp=64 + ppcretry=3 + ppctimeout=0 + precreatemypostscripts=1 + pruneservices=1 + runbootscripts=yes + setinstallnic=1 + sharedinstall=no + sharedtftp=1 + skiptables=nics + skipvalidatelog=1 + snmpc=snmpc + sshbetweennodes=ALLGROUPS + svloglocal=1 + syspowerinterval=10 + syspowermaxnodes=10 + tftpdir=/tftprot/ + tftpflags=-v + timezone=America/New_York + useNFSv4onAIX=0 + useNmapfromMN=no + useSSHonAIX=0 + useflowcontrol=no + usexhrm=no + vcenterautojoin=no + vmwarereconfigonpower=no + vsftp=n + xcatconfdir=/etc/xcat + xcatdebugmode=1 + xcatdport=3001 + xcatiport=3002 + xcatlport=3003 + xcatmaxbatchconnections=64 + xcatmaxconnections=60 + xcatsslciphers=3DES + xcatsslversion=TLSv1"> /tmp/xcat_inventory_try_to_import_all_type_is_site_yaml_format/site.org +check:rc==0 +cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');sed -i "s/10.3.5.8/$mnip/g" /tmp/xcat_inventory_try_to_import_all_type_is_site_yaml_format/site.org +check:rc==0 +cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');sed -i "s/10.3.5.8/$mnip/g" /tmp/xcat_inventory_try_to_import_all_type_is_site_yaml_format/yaml.test +check:rc==0 +cmd:xcat-inventory import -f /tmp/xcat_inventory_try_to_import_all_type_is_site_yaml_format/yaml.test -t site +check:rc==0 +cmd:lsdef -t site -o clustersite > /tmp/xcat_inventory_try_to_import_all_type_is_site_yaml_format/site.import +check:rc==0 +cmd:diff -y /tmp/xcat_inventory_try_to_import_all_type_is_site_yaml_format/site.org /tmp/xcat_inventory_try_to_import_all_type_is_site_yaml_format/site.import +check:rc==0 +cmd:lsdef bogusgroup1 +check:output=~Error: Could not find an object +check:rc!=0 +cmd:lsdef bogusgroup2 +check:output=~Error: Could not find an object +check:rc!=0 +cmd:lsdef bogusgroup3 +check:output=~Error: Could not find an object +check:rc!=0 +cmd:tabdump networks|grep 100_0_0_0-255_0_0_0 +check:rc!=0 +cmd:if [[ -e /tmp/xcat_inventory_try_to_import_all_type_is_site_yaml_format/bogusnode.stanza ]]; then cat /tmp/xcat_inventory_try_to_import_all_type_is_site_yaml_format/bogusnode.stanza | mkdef -z;fi +check:rc==0 +cmd:if [[ -e /tmp/xcat_inventory_try_to_import_all_type_is_site_yaml_format/bogusgroup.stanza ]];then cat /tmp/xcat_inventory_try_to_import_all_type_is_site_yaml_format/bogusgroup.stanza |mkdef -z -f;fi +check:rc==0 +cmd:cat /tmp/xcat_inventory_try_to_import_all_type_is_site_yaml_format/site.stanza | mkdef -z -f +check:rc==0 +cmd:rm -rf /tmp/xcat_inventory_try_to_import_all_type_is_site_yaml_format +check:rc==0 +end + + +start:export_site_table_then_modify_yaml_then_import +This case is used to test xcat-inventory import a site , then modify the export yaml file, then import the yaml file +Attribute: $$DSTMN - the ip of MN which is used to run import operation. +cmd:mkdir -p /tmp/export_site_table_then_modify_yaml_then_import +check:rc==0 +cmd:ssh $$DSTMN 'mkdir -p /tmp/export_site_table_then_modify_yaml_then_import_$$DSTMN/' +check:rc==0 +cmd: lsdef -t site -o clustersite -z >/tmp/export_site_table_then_modify_yaml_then_import/site.stanza +check:rc==0 +cmd:ssh $$DSTMN 'lsdef -t site -o clustersite -z >/tmp/export_site_table_then_modify_yaml_then_import_$$DSTMN/site.stanza ' +check:rc==0 +cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');chdef -t site -o clustersite useSSHonAIX=1111 useNFSv4onAIX=1111 FQDNfirst=1111 SNsyncfiledir='/var/xcat/1111' auditnosyslog=1111 auditskipcmds=ALL blademaxp=641111 cleanupxcatpost=1111 consoleondemand=1111 databaseloc='/var/lib1111' db2installloc='/mntdb1111' dbtracelevel=0 defserialflow=1111 defserialport=1111 defserialspeed=9611111111 dhcpinterfaces=eth1111 dhcplease=43211111111 dhcpsetup=1111 disjointdhcps=0 dnshandler=ddns1111 dnsinterfaces='xcatmn|eth1,eth2;service|bond1111' dnsupdaters=dnsupdaters1111 domain='pok1111.stglabs.ibm.com' enableASMI=1111 excludenodes=1111 externaldns=1111 extntpservers=1111 forwarders=$mnip fsptimeout=1111 genmacprefix='11111111:11:aa' genpasswords=1111 hierarchicalattrs=1111 httpport=81111 hwctrldispatch=1111 installdir='/install1111/' installloc='hostname:/path1111' ipmidispatch=1111 ipmimaxp=641111 ipmiretries=31111 ipmisdrcache=1111 ipmitimeout=21111 iscsidir='/iscsidir1111' managedaddressmode=dhcp master=$mnip maxssh=81111 mnroutenames=1111 nameservers=$mnip nmapoptions='--min-rtt-timeout 1111' nodestatus=n nodesyncfiledir='/var/xcat/node/syncfiles1111' ntpservers=$mnip persistkvmguests=1111 powerinterval=1111 ppcmaxp=641111 ppcretry=31111 ppctimeout=1111 precreatemypostchdef -t site -o clustersite useSSHonAIX=1111 useNFSv4onAIX=1111 FQDNfirst=1111 SNsyncfiledir='/var/xcat/1111' auditnosyslog=1111 auditskipcmds=ALL blademaxp=641111 pruneservices=1111 runbootscripts=1111 setinstallnic=1111 sharedinstall=no sharedtftp=1111 skiptables=nics1111 skipvalidatelog=1111 snmpc=xc1111 sshbetweennodes=ALLGROUPS svloglocal=1111 syspowerinterval=11111 syspowermaxnodes=11111 tftpdir='/tftprot1111/' tftpflags='-v1111' timezone='America/New_York1111' useNmapfromMN=1111 useflowcontrol=1111 usexhrm=1111 vcenterautojoin=1111 vmwarereconfigonpower=1111 vsftp=1111 xcatconfdir='/etc/xcat1111' xcatdebugmode=0 xcatdport=3001 xcatiport=3002 xcatlport=3003 xcatmaxbatchconnections=641111 xcatmaxconnections=61111 xcatsslciphers='3DES' xcatsslversion=TLSv1 +check:rc==0 +cmd:lsdef -t site -o clustersite -z|sed 's/=0$/=1/g' |sort -t'=' -k1 |tee /tmp/export_site_table_then_modify_yaml_then_import/srcsite.stanza +check:rc==0 +cmd:sed -i 's/1111/2222/g' /tmp/export_site_table_then_modify_yaml_then_import/srcsite.stanza +check:rc==0 +cmd:sed -i 's/managedaddressmode=dhcp/managedaddressmode=static/g' /tmp/export_site_table_then_modify_yaml_then_import/srcsite.stanza +check:rc==0 +cmd:sed -i 's/sharedinstall=no/sharedinstall=sns/g' /tmp/export_site_table_then_modify_yaml_then_import/srcsite.stanza +check:rc==0 +cmd:sed -i 's/sshbetweennodes=ALLGROUPS/sshbetweennodes=NOGROUPS/g' /tmp/export_site_table_then_modify_yaml_then_import/srcsite.stanza +check:rc==0 +cmd:xcat-inventory export --format=yaml -t site -o clustersite |tee /tmp/export_site_table_then_modify_yaml_then_import/export_site_yaml.inv +check:rc==0 +cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');sed -i "s/$mnip/$$DSTMN/g" /tmp/export_site_table_then_modify_yaml_then_import/export_site_yaml.inv +check:rc==0 +cmd:sed -i "s/: '*0'*$/: '1'/g" /tmp/export_site_table_then_modify_yaml_then_import/export_site_yaml.inv +check:rc==0 +cmd:sed -i "s/managedaddressmode: '*dhcp'*/managedaddressmode: 'static'/g" /tmp/export_site_table_then_modify_yaml_then_import/export_site_yaml.inv +check:rc==0 +cmd:sed -i "s/sharedinstall: '*no'*/sharedinstall: 'sns'/g" /tmp/export_site_table_then_modify_yaml_then_import/export_site_yaml.inv +check:rc==0 +cmd:sed -i "s/sshbetweennodes: '*ALLGROUPS'*/sshbetweennodes: 'NOGROUPS'/g" /tmp/export_site_table_then_modify_yaml_then_import/export_site_yaml.inv +check:rc==0 +cmd:sed -i 's/1111/2222/g' /tmp/export_site_table_then_modify_yaml_then_import/export_site_yaml.inv +check:rc==0 +cmd:cat /tmp/export_site_table_then_modify_yaml_then_import/export_site_yaml.inv +check:rc==0 +cmd:scp /tmp/export_site_table_then_modify_yaml_then_import/export_site_yaml.inv $$DSTMN:/tmp/export_site_table_then_modify_yaml_then_import_$$DSTMN/ +check:rc==0 +cmd: ssh $$DSTMN 'xcat-inventory import -f /tmp/export_site_table_then_modify_yaml_then_import_$$DSTMN/export_site_yaml.inv -t site -o clustersite' +check:rc==0 +cmd: ssh $$DSTMN 'lsdef -t site -o clustersite -z |sort -t'=' -k1|tee /tmp/export_site_table_then_modify_yaml_then_import_$$DSTMN/dstsite.stanza' +check:rc==0 +cmd: scp $$DSTMN:/tmp/export_site_table_then_modify_yaml_then_import_$$DSTMN/dstsite.stanza /tmp/export_site_table_then_modify_yaml_then_import/dstsite.stanza +check:rc==0 +cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');sed -i "s/$$DSTMN/$mnip/g" /tmp/export_site_table_then_modify_yaml_then_import/dstsite.stanza +check:rc==0 +cmd: cat /tmp/export_site_table_then_modify_yaml_then_import/dstsite.stanza +check:rc==0 +cmd:diff -y /tmp/export_site_table_then_modify_yaml_then_import/srcsite.stanza /tmp/export_site_table_then_modify_yaml_then_import/dstsite.stanza +check:rc==0 +cmd:cat /tmp/export_site_table_then_modify_yaml_then_import/site.stanza | mkdef -z -f +check:rc==0 +cmd:ssh $$DSTMN 'cat /tmp/export_site_table_then_modify_yaml_then_import_$$DSTMN/site.stanza | mkdef -z -f' +check:rc==0 +cmd:ssh $$DSTMN 'rm -rf /tmp/export_site_table_then_modify_yaml_then_import_$$DSTMN/' +check:rc==0 +cmd:rm -rf /tmp/export_site_table_then_modify_yaml_then_import +check:rc==0 +end + +start:export_site_table_then_modify_json_then_import +This case is used to test xcat-inventory import a site , then modify the export json file, then import the json file +Attribute: $$DSTMN - the ip of MN which is used to run import operation. +cmd:mkdir -p /tmp/export_site_table_then_modify_json_then_import +check:rc==0 +cmd:ssh $$DSTMN 'mkdir -p /tmp/export_site_table_then_modify_json_then_import_$$DSTMN/' +check:rc==0 +cmd: lsdef -t site -o clustersite -z >/tmp/export_site_table_then_modify_json_then_import/site.stanza +check:rc==0 +cmd:ssh $$DSTMN 'lsdef -t site -o clustersite -z >/tmp/export_site_table_then_modify_json_then_import_$$DSTMN/site.stanza ' +check:rc==0 +cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');chdef -t site -o clustersite useSSHonAIX=1111 useNFSv4onAIX=1111 FQDNfirst=1111 SNsyncfiledir='/var/xcat/1111' auditnosyslog=1111 auditskipcmds=ALL blademaxp=641111 cleanupxcatpost=1111 consoleondemand=1111 databaseloc='/var/lib1111' db2installloc='/mntdb1111' dbtracelevel=0 defserialflow=1111 defserialport=1111 defserialspeed=9611111111 dhcpinterfaces=eth1111 dhcplease=43211111111 dhcpsetup=1111 disjointdhcps=0 dnshandler=ddns1111 dnsinterfaces='xcatmn|eth1,eth2;service|bond1111' dnsupdaters=dnsupdaters1111 domain='pok1111.stglabs.ibm.com' enableASMI=1111 excludenodes=1111 externaldns=1111 extntpservers=1111 forwarders=$mnip fsptimeout=1111 genmacprefix='11111111:11:aa' genpasswords=1111 hierarchicalattrs=1111 httpport=81111 hwctrldispatch=1111 installdir='/install1111/' installloc='hostname:/path1111' ipmidispatch=1111 ipmimaxp=641111 ipmiretries=31111 ipmisdrcache=1111 ipmitimeout=21111 iscsidir='/iscsidir1111' managedaddressmode=dhcp master=$mnip maxssh=81111 mnroutenames=1111 nameservers=$mnip nmapoptions='--min-rtt-timeout 1111' nodestatus=n nodesyncfiledir='/var/xcat/node/syncfiles1111' ntpservers=$mnip persistkvmguests=1111 powerinterval=1111 ppcmaxp=641111 ppcretry=31111 ppctimeout=1111 precreatemypostchdef -t site -o clustersite useSSHonAIX=1111 useNFSv4onAIX=1111 FQDNfirst=1111 SNsyncfiledir='/var/xcat/1111' auditnosyslog=1111 auditskipcmds=ALL blademaxp=641111 pruneservices=1111 runbootscripts=1111 setinstallnic=1111 sharedinstall=no sharedtftp=1111 skiptables=nics1111 skipvalidatelog=1111 snmpc=xc1111 sshbetweennodes=ALLGROUPS svloglocal=1111 syspowerinterval=11111 syspowermaxnodes=11111 tftpdir='/tftprot1111/' tftpflags='-v1111' timezone='America/New_York1111' useNmapfromMN=1111 useflowcontrol=1111 usexhrm=1111 vcenterautojoin=1111 vmwarereconfigonpower=1111 vsftp=1111 xcatconfdir='/etc/xcat1111' xcatdebugmode=0 xcatdport=3001 xcatiport=3002 xcatlport=3003 xcatmaxbatchconnections=641111 xcatmaxconnections=61111 xcatsslciphers='3DES' xcatsslversion=TLSv1 +check:rc==0 +cmd:lsdef -t site -o clustersite -z|sed 's/=0$/=1/g' |sort -t'=' -k1 |tee /tmp/export_site_table_then_modify_json_then_import/srcsite.stanza +check:rc==0 +cmd:sed -i 's/1111/2222/g' /tmp/export_site_table_then_modify_json_then_import/srcsite.stanza +check:rc==0 +cmd:sed -i 's/managedaddressmode=dhcp/managedaddressmode=static/g' /tmp/export_site_table_then_modify_json_then_import/srcsite.stanza +check:rc==0 +cmd:sed -i 's/sharedinstall=no/sharedinstall=sns/g' /tmp/export_site_table_then_modify_json_then_import/srcsite.stanza +check:rc==0 +cmd:sed -i 's/sshbetweennodes=ALLGROUPS/sshbetweennodes=NOGROUPS/g' /tmp/export_site_table_then_modify_json_then_import/srcsite.stanza +check:rc==0 +cmd:xcat-inventory export --format=json -t site -o clustersite |tee /tmp/export_site_table_then_modify_json_then_import/export_site_json.inv +check:rc==0 +cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');sed -i "s/$mnip/$$DSTMN/g" /tmp/export_site_table_then_modify_json_then_import/export_site_json.inv +check:rc==0 +cmd:sed -i 's/"0"/"1"/g' /tmp/export_site_table_then_modify_json_then_import/export_site_json.inv +check:rc==0 +cmd:sed -i 's/"managedaddressmode": "dhcp"/"managedaddressmode": "static"/g' /tmp/export_site_table_then_modify_json_then_import/export_site_json.inv +check:rc==0 +cmd:sed -i 's/"sharedinstall": "no"/"sharedinstall": "sns"/g' /tmp/export_site_table_then_modify_json_then_import/export_site_json.inv +check:rc==0 +cmd:sed -i 's/"sshbetweennodes": "ALLGROUPS"/"sshbetweennodes": "NOGROUPS"/g' /tmp/export_site_table_then_modify_json_then_import/export_site_json.inv +check:rc==0 +cmd:sed -i 's/1111/2222/g' /tmp/export_site_table_then_modify_json_then_import/export_site_json.inv +check:rc==0 +cmd:cat /tmp/export_site_table_then_modify_json_then_import/export_site_json.inv +check:rc==0 +cmd:scp /tmp/export_site_table_then_modify_json_then_import/export_site_json.inv $$DSTMN:/tmp/export_site_table_then_modify_json_then_import_$$DSTMN/ +check:rc==0 +cmd: ssh $$DSTMN 'xcat-inventory import -f /tmp/export_site_table_then_modify_json_then_import_$$DSTMN/export_site_json.inv -t site -o clustersite' +check:rc==0 +cmd: ssh $$DSTMN 'lsdef -t site -o clustersite -z |sort -t'=' -k1|tee /tmp/export_site_table_then_modify_json_then_import_$$DSTMN/dstsite.stanza' +check:rc==0 +cmd: scp $$DSTMN:/tmp/export_site_table_then_modify_json_then_import_$$DSTMN/dstsite.stanza /tmp/export_site_table_then_modify_json_then_import/dstsite.stanza +check:rc==0 +cmd:mnip=$(lsdef -t site -o clustersite -i master -c|awk -F'=' '{print $2}');sed -i "s/$$DSTMN/$mnip/g" /tmp/export_site_table_then_modify_json_then_import/dstsite.stanza +check:rc==0 +cmd: cat /tmp/export_site_table_then_modify_json_then_import/dstsite.stanza +check:rc==0 +cmd:diff -y /tmp/export_site_table_then_modify_json_then_import/srcsite.stanza /tmp/export_site_table_then_modify_json_then_import/dstsite.stanza +check:rc==0 +cmd:cat /tmp/export_site_table_then_modify_json_then_import/site.stanza | mkdef -z -f +check:rc==0 +cmd:ssh $$DSTMN 'cat /tmp/export_site_table_then_modify_json_then_import_$$DSTMN/site.stanza | mkdef -z -f' +check:rc==0 +cmd:ssh $$DSTMN 'rm -rf /tmp/export_site_table_then_modify_json_then_import_$$DSTMN/' +check:rc==0 +cmd:rm -rf /tmp/export_site_table_then_modify_json_then_import +check:rc==0 +end + + diff --git a/xCAT-test/autotest/testcase/xcatconfig/case0 b/xCAT-test/autotest/testcase/xcatconfig/case0 index 294fe2aeb..8b33d036e 100644 --- a/xCAT-test/autotest/testcase/xcatconfig/case0 +++ b/xCAT-test/autotest/testcase/xcatconfig/case0 @@ -96,18 +96,17 @@ description:To regenerate cretials os:Linux #step1:backup: /etc/xcat/ca /etc/xcat/cert cmd:cp -r /etc/xcat/ca /etc/xcat/cabak;cp -r /etc/xcat/cert /etc/xcat/certbak - #step2:run command and check the output -cmd:xcatconfig -c >/tmp/xcatconfig.test 2>&1 +cmd:xcatconfig -c 2>&1 | tee /tmp/xcatconfig.test check:rc==0 -cmd:if [[ `cat /tmp/xcatconfig.test |grep FAILED` ]] || [[ `cat /tmp/xcatconfig.test |grep error` ]] || [[ `cat /tmp/xcatconfig.test |grep "fail"` ]] || [[ `cat /tmp/xcatconfig.test |grep Error` ]];then exit 1;fi +cmd:if [[ `cat /tmp/xcatconfig.test |grep -i fail` ]] || [[ `cat /tmp/xcatconfig.test |grep -i error` ]] ;then exit 1;else exit 0;fi check:rc==0 cmd:if [[ `cat /tmp/xcatconfig.test |grep "Created xCAT certificate"` ]] && [[ `cat /tmp/xcatconfig.test |grep "Signature ok"` ]];then exit 0;else exit 1;fi check:rc==0 #step3:make sure the /etc/xcat/ca /etc/xcat/cert is rewrite -cmd:diff /etc/xcat/ca /etc/xcat/cabak +cmd:diff -y /etc/xcat/ca /etc/xcat/cabak check:rc!=0 -cmd:diff /etc/xcat/cert /etc/xcat/certbak +cmd:diff -y /etc/xcat/cert /etc/xcat/certbak check:rc!=0 #step4:restore test environment cmd:rm -rf /tmp/xcatconfig.test diff --git a/xCAT-test/xcattest b/xCAT-test/xcattest index dedc49867..dbb218414 100755 --- a/xCAT-test/xcattest +++ b/xCAT-test/xcattest @@ -847,7 +847,11 @@ sub load_case { return 1; } while ($line = <$fd>) { - $line =~ s/^\s+|#[^!].+|\s+$//g; + if($newcmdstart){ + $line =~ s/\s+$//g ; + }else{ + $line =~ s/^\s+|#[^!].+|\s+$//g ; + } #skip blank and comment lines next if (length($line) == 0 || ($line =~ /^\s*#/));