2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-08-20 10:10:22 +00:00

Merge branch 'master' into lsdef-z

This commit is contained in:
Bin Xu
2018-12-27 14:35:37 +08:00
committed by GitHub
20 changed files with 421 additions and 39 deletions

View File

@@ -49,15 +49,15 @@ OPTIONS
Display all definitions.
For performance consideration, the auditlog and eventlog objects will not be listed.
To list auditlog or eventlog objects, use lsdef -t auditlog or lsdef -t eventlog instead.
To list auditlog or eventlog objects, use \ **lsdef -t auditlog**\ or \ **lsdef -t eventlog**\ instead.
\ **-c|-**\ **-compress**\
Display information in compressed mode, each output line has format "<object name>: <data>".
The output can be passed to command xcoll or xdshbak for formatted output.
The -c flag must be used with -i flag.
The output can be passed to command \ **xcoll**\ or \ **xdshbak**\ for formatted output.
The \ **-c**\ flag must be used with \ **-i**\ flag.
@@ -136,13 +136,18 @@ OPTIONS
\ **-w**\ \ *attr==val*\ \ **-w**\ \ *attr=~val*\ ...
Use one or multiple -w flags to specify the selection string that can be used to select objects. The operators ==, !=, =~ and !~ are available. Use the help option to get a list of valid attributes for each object type.
Use one or multiple \ **-w**\ flags to specify the selection string that can be used to select objects. The operators ==, !=, =~ and !~ are available. Use the help option to get a list of valid attributes for each object type.
Operator descriptions:
== Select nodes where the attribute value is exactly this value.
!= Select nodes where the attribute value is not this specific value.
=~ Select nodes where the attribute value matches this regular expression.
!~ Select nodes where the attribute value does not match this regular expression.
.. code-block:: perl
== Select nodes where the attribute value is exactly this value.
!= Select nodes where the attribute value is not this specific value.
=~ Select nodes where the attribute value matches this regular expression.
!~ Select nodes where the attribute value does not match this regular expression.
Note: if the "val" fields includes spaces or any other characters that will be parsed by shell, the "attr<operator>val" needs to be quoted. If the operator is "!~", the "attr<operator>val" needs to be quoted using single quote.
@@ -150,7 +155,7 @@ OPTIONS
\ **-z|-**\ **-stanza**\
Display output in stanza format. See the xcatstanzafile man page for details on using xCAT stanza files.
Display output in stanza format. See the "xcatstanzafile" man page for details on using xCAT stanza files.
@@ -191,8 +196,6 @@ EXAMPLES
.. code-block:: perl
lsdef
OR
lsdef -a
@@ -350,7 +353,7 @@ EXAMPLES
15.
To list the nodes status and use xcoll to format the output.
To list the nodes status and use \ **xcoll**\ to format the output.
.. code-block:: perl

View File

@@ -28,13 +28,13 @@ in the xCAT database and xCAT object definition templates shipped in xCAT.
Display all definitions.
For performance consideration, the auditlog and eventlog objects will not be listed.
To list auditlog or eventlog objects, use lsdef -t auditlog or lsdef -t eventlog instead.
To list auditlog or eventlog objects, use B<lsdef -t auditlog> or B<lsdef -t eventlog> instead.
=item B<-c|--compress>
Display information in compressed mode, each output line has format "<object name>: <data>".
The output can be passed to command xcoll or xdshbak for formatted output.
The -c flag must be used with -i flag.
The output can be passed to command B<xcoll> or B<xdshbak> for formatted output.
The B<-c> flag must be used with B<-i> flag.
=item B<-h|--help>
@@ -87,9 +87,10 @@ Verbose mode.
=item B<-w> I<attr==val> B<-w> I<attr=~val> ...
Use one or multiple -w flags to specify the selection string that can be used to select objects. The operators ==, !=, =~ and !~ are available. Use the help option to get a list of valid attributes for each object type.
Use one or multiple B<-w> flags to specify the selection string that can be used to select objects. The operators ==, !=, =~ and !~ are available. Use the help option to get a list of valid attributes for each object type.
Operator descriptions:
== Select nodes where the attribute value is exactly this value.
!= Select nodes where the attribute value is not this specific value.
=~ Select nodes where the attribute value matches this regular expression.
@@ -126,8 +127,6 @@ when defining an xCAT node.
To get a list of all the objects that have been defined.
lsdef
OR
lsdef -a
=item 3.
@@ -211,7 +210,7 @@ The hidden nodes are FSP/BPAs.
=item 15.
To list the nodes status and use xcoll to format the output.
To list the nodes status and use B<xcoll> to format the output.
lsdef -t node -i status -c | xcoll

View File

@@ -9,6 +9,7 @@ from gevent.subprocess import Popen, PIPE
import requests
import urllib3
urllib3.disable_warnings()
from requests.auth import AuthBase
import exceptions as xcat_exception
@@ -17,6 +18,7 @@ class RestSession(object):
def __init__(self):
self.session = requests.Session()
self.cookies = None
self.auth = None
def request(self, method, url, headers, data=None, timeout=30):
@@ -24,6 +26,7 @@ class RestSession(object):
response = self.session.request(method, url,
data=data,
headers=headers,
auth=self.auth,
verify=False,
timeout=timeout)
except requests.exceptions.ConnectionError as e:
@@ -60,6 +63,9 @@ class RestSession(object):
if not self.cookies:
self.cookies = requests.utils.dict_from_cookiejar(self.session.cookies)
if not self.auth and 'X-Auth-Token' in response.headers:
self.auth = XTokenAuth(response.headers['X-Auth-Token'])
return response
def extract_server_and_port(self, message_string, format="STRING"):
@@ -127,3 +133,13 @@ class RestSession(object):
raise SelfServerException(error)
return response
class XTokenAuth(AuthBase):
def __init__(self,authToken):
self.authToken=authToken
def __call__(self, auth):
auth.headers['X-Auth-Token']=self.authToken
return(auth)

View File

@@ -0,0 +1,34 @@
#!/usr/bin/env python
###############################################################################
# IBM(c) 2018 EPL license http://www.eclipse.org/legal/epl-v10.html
###############################################################################
# -*- coding: utf-8 -*-
#
from __future__ import print_function
import gevent
import time
from common.task import ParallelNodesCommand
from common.exceptions import SelfClientException, SelfServerException
from hwctl import redfish_client as redfish
import logging
logger = logging.getLogger('xcatagent')
class RedfishPowerTask(ParallelNodesCommand):
"""Executor for power-related actions."""
def get_state(self, **kw):
node = kw['node']
rf = redfish.RedfishRest(name=node, nodeinfo=kw['nodeinfo'], messager=self.callback,
debugmode=self.debugmode, verbose=self.verbose)
state = 'Unknown'
try:
rf.login()
self.callback.info('%s: %s' % (node, state))
except (SelfServerException, SelfClientException) as e:
self.callback.error(e.message, node)
return state

View File

@@ -0,0 +1,129 @@
#!/usr/bin/env python
###############################################################################
# IBM(c) 2018 EPL license http://www.eclipse.org/legal/epl-v10.html
###############################################################################
# -*- coding: utf-8 -*-
#
import os
import requests
import json
import time
from common import utils, rest
from common.exceptions import SelfClientException, SelfServerException
import logging
logger = logging.getLogger('xcatagent')
HTTP_PROTOCOL = "https://"
PROJECT_URL = "/redfish/v1"
SESSION_URL = PROJECT_URL + "/SessionService/Sessions"
class RedfishRest(object):
headers = {'Content-Type': 'application/json'}
def __init__(self, name, **kwargs):
self.name = name
self.username = None
self.password = None
if 'nodeinfo' in kwargs:
for key, value in kwargs['nodeinfo'].items():
setattr(self, key, value)
if not hasattr(self, 'bmcip'):
self.bmcip = self.name
self.verbose = kwargs.get('debugmode')
self.messager = kwargs.get('messager')
self.session = rest.RestSession()
self.root_url = HTTP_PROTOCOL + self.bmcip
def _print_record_log (self, msg, cmd, error_flag=False):
if self.verbose or error_flag:
localtime = time.asctime( time.localtime(time.time()) )
log = self.name + ': [redfish_debug] ' + cmd + ' ' + msg
if self.verbose:
self.messager.info(localtime + ' ' + log)
logger.debug(log)
def _print_error_log (self, msg, cmd):
self._print_record_log(msg, cmd, True)
def _log_request (self, method, url, headers, data=None, files=None, file_path=None, cmd=''):
header_str = ' '.join([ "%s: %s" % (k, v) for k,v in headers.items() ])
msg = 'curl -k -X %s -H \"%s\" ' % (method, header_str)
if cmd != 'login':
msg += '-H \"X-Auth-Token: xxxxxx\" '
if data:
if cmd == 'login':
data = data.replace('"Password": "%s"' % self.password, '"Password": "xxxxxx"')
data = '-d \'%s\'' % data
msg += '%s %s -v' % (url, data)
else:
msg += url
self._print_record_log(msg, cmd)
return msg
def request (self, method, resource, headers=None, payload=None, timeout=30, cmd=''):
httpheaders = headers or RedfishRest.headers
url = resource
if not url.startswith(HTTP_PROTOCOL):
url = self.root_url + resource
data = None
if payload:
data=json.dumps(payload)
self._log_request(method, url, httpheaders, data=data, cmd=cmd)
try:
response = self.session.request(method, url, headers=httpheaders, data=data, timeout=timeout)
return self.handle_response(response, cmd=cmd)
except SelfServerException as e:
if cmd == 'login':
e.message = "Login to BMC failed: Can't connect to {0} {1}.".format(e.host_and_port, e.detail_msg)
else:
e.message = 'BMC did not respond. ' \
'Validate BMC configuration and retry the command.'
self._print_error_log(e.message, cmd)
raise
except ValueError:
error = 'Received wrong format response: %s' % response
self._print_error_log(error, cmd)
raise SelfServerException(error)
def handle_response (self, resp, cmd=''):
data = resp.json()
code = resp.status_code
if code != requests.codes.ok and code != requests.codes.created:
description = ''.join(data['error']['@Message.ExtendedInfo'][0]['Message'])
error = '[%d] %s' % (code, description)
self._print_error_log(error, cmd)
raise SelfClientException(error, code)
if cmd == 'login' and not 'X-Auth-Token' in resp.headers:
raise SelfServerException('Login Failed: Did not get Session Token from response')
self._print_record_log('%s %s' % (code, data['Name']), cmd)
return data
def login(self):
payload = { "UserName": self.username, "Password": self.password }
self.request('POST', SESSION_URL, payload=payload, timeout=20, cmd='login')

View File

@@ -2,7 +2,8 @@ from common import utils
import gevent
from gevent.pool import Pool
MODULE_MAP = {"openbmc": "OpenBMCManager"}
MODULE_MAP = {"openbmc": "OpenBMCManager",
"redfish": "RedfishManager"}
class BaseManager(object):
def __init__(self, messager, cwd):

View File

@@ -0,0 +1,77 @@
#!/usr/bin/env python
###############################################################################
# IBM(c) 2018 EPL license http://www.eclipse.org/legal/epl-v10.html
###############################################################################
# -*- coding: utf-8 -*-
#
import os
import gevent
import re
import sys
from docopt import docopt,DocoptExit
from common import utils
from common import exceptions as xcat_exception
from hwctl.executor.redfish_power import RedfishPowerTask
from hwctl.power import DefaultPowerManager
from xcatagent import base
import logging
logger = logging.getLogger('xcatagent')
try:
if not logger.handlers:
utils.enableSyslog('xcat.agent')
except:
pass
DEBUGMODE = False
VERBOSE = False
# global variables of rpower
POWER_REBOOT_OPTIONS = ('boot', 'reset')
POWER_SET_OPTIONS = ('on', 'off', 'bmcreboot', 'softoff')
POWER_GET_OPTIONS = ('bmcstate', 'state', 'stat', 'status')
class RedfishManager(base.BaseManager):
def __init__(self, messager, cwd, nodes=None, envs=None):
super(RedfishManager, self).__init__(messager, cwd)
self.nodes = nodes
self.debugmode = (envs and envs.get('debugmode')) or None
#TODO, remove the global variable DEBUGMODE
global DEBUGMODE
DEBUGMODE = envs['debugmode']
if self.debugmode:
logger.setLevel(logging.DEBUG)
def rpower(self, nodesinfo, args):
# 1, parse args
rpower_usage = """
Usage:
rpower [-V|--verbose] [boot|bmcreboot|bmcstate|off|on|reset|softoff|stat|state|status]
Options:
-V --verbose rpower verbose mode.
"""
try:
opts=docopt(rpower_usage, argv=args)
self.verbose=opts.pop('--verbose')
action=[k for k,v in opts.items() if v][0]
except Exception as e:
# It will not be here as perl has validation for args
self.messager.error("Failed to parse arguments for rpower: %s" % args)
return
# 2, validate the args
if action not in (POWER_GET_OPTIONS + POWER_SET_OPTIONS + POWER_REBOOT_OPTIONS):
self.messager.error("Not supported subcommand for rpower: %s" % action)
return
# 3, run the subcommands
runner = RedfishPowerTask(nodesinfo, callback=self.messager, debugmode=self.debugmode, verbose=self.verbose)
DefaultPowerManager().get_power_state(runner)

View File

@@ -973,6 +973,7 @@ sub mknetboot
my $xcatdport = "3001";
my $xcatiport = "3002";
my $nodestatus = "y";
my $httpport="80";
my @myself = xCAT::NetworkUtils->determinehostname();
my $myname = $myself[ (scalar @myself) - 1 ];
@@ -1003,6 +1004,12 @@ sub mknetboot
{
$nodestatus = $ref->{value};
}
($ref) = $sitetab->getAttribs({ key => 'httpport' }, 'value');
if ($ref and $ref->{value})
{
$httpport = $ref->{value};
}
}
my %donetftp = ();
my %oents = %{ $ostab->getNodesAttribs(\@nodes, [qw(os arch profile provmethod)]) };

View File

@@ -2677,7 +2677,7 @@ sub addnet
}
}
#for cumulus ZTP process
push @netent, " option cumulus-provision-url \"http://$tftp.':' . $httpport/install/postscripts/cumulusztp\";\n";
push @netent, " option cumulus-provision-url \"http://$tftp:$httpport/install/postscripts/cumulusztp\";\n";
my $ddnserver = $nameservers;
$ddnserver =~ s/,.*//;
@@ -2717,9 +2717,9 @@ sub addnet
# $lstatements = 'if exists gpxe.bus-id { filename = \"\"; } else if exists client-architecture { filename = \"xcat/xnba.kpxe\"; } '.$lstatements;
push @netent, " if option user-class-identifier = \"xNBA\" and option client-architecture = 00:00 { #x86, xCAT Network Boot Agent\n";
push @netent, " always-broadcast on;\n";
push @netent, " filename = \"http://$tftp.':' . $httpport/tftpboot/xcat/xnba/nets/" . $net . "_" . $maskbits . "\";\n";
push @netent, " filename = \"http://$tftp:$httpport/tftpboot/xcat/xnba/nets/" . $net . "_" . $maskbits . "\";\n";
push @netent, " } else if option user-class-identifier = \"xNBA\" and option client-architecture = 00:09 { #x86, xCAT Network Boot Agent\n";
push @netent, " filename = \"http://$tftp.':' . $httpport/tftpboot/xcat/xnba/nets/" . $net . "_" . $maskbits . ".uefi\";\n";
push @netent, " filename = \"http://$tftp:$httpport/tftpboot/xcat/xnba/nets/" . $net . "_" . $maskbits . ".uefi\";\n";
push @netent, " } else if option client-architecture = 00:00 { #x86\n";
push @netent, " filename \"xcat/xnba.kpxe\";\n";
push @netent, " } else if option vendor-class-identifier = \"Etherboot-5.4\" { #x86\n";
@@ -2735,10 +2735,10 @@ sub addnet
push @netent, " filename \"elilo.efi\";\n";
push @netent,
" } else if option client-architecture = 00:0e { #OPAL-v3\n ";
push @netent, " option conf-file = \"http://$tftp.':' . $httpport/tftpboot/pxelinux.cfg/p/" . $net . "_" . $maskbits . "\";\n";
push @netent, " option conf-file = \"http://$tftp:$httpport/tftpboot/pxelinux.cfg/p/" . $net . "_" . $maskbits . "\";\n";
push @netent,
" } else if substring (option vendor-class-identifier,0,11) = \"onie_vendor\" { #for onie on cumulus switch\n";
push @netent, " option www-server = \"http://$tftp.':' . $httpport/install/onie/onie-installer\";\n";
push @netent, " option www-server = \"http://$tftp:$httpport/install/onie/onie-installer\";\n";
push @netent,
" } else if substring(filename,0,1) = null { #otherwise, provide yaboot if the client isn't specific\n ";
push @netent, " filename \"/yaboot\";\n";

View File

@@ -167,8 +167,8 @@ my %rsp_set_valid_values = (
autoreboot => "0|1",
bootmode => "regular|safe|setup",
powersupplyredundancy => "disabled|enabled",
powerrestorepolicy => "restore|always_on|always_off",
timesyncmethod => "ntp|manual",
powerrestorepolicy => "always_off|always_on|restore",
timesyncmethod => "manual|ntp",
);
my @rspconfig_get_options = (@rsp_common_options, qw/ipsrc sshcfg gard dump/);
#-------------------------------------------------------

View File

@@ -273,3 +273,46 @@ check:output=~300
cmd:if [ -f /tmp/sitevalue ];then var=`cat /tmp/sitevalue`;chdef -t site clustersite dhcplease=$var;rm -rf /tmp/sitevalue;fi
check:rc==0
end
start:chdef_network_not_exist
description:This case is use to create a network, but not set net and mask.
label:mn_only,db
cmd:chdef -t network aaaaa_not_exist
check:output=~No object definitions have been created or modified
#check:rc!=0
cmd:chdef -t network aaaaa_not_exist mtu=1500
check:rc!=0
check:output=~Net or mask value should not be empty
cmd:chdef -t network aaaaa_not_exist mtu=1500 net=10.0.0.0
check:rc!=0
check:output=~Net or mask value should not be empty
cmd:chdef -t network aaaaa_not_exist mtu=1500 mask=255.255.255.0
check:rc!=0
check:output=~Net or mask value should not be empty
cmd:chdef -t network aaaaa_not_exist mask=255.255.255.0 net=100.0.0.0 mtu=1500
check:rc==0
check:output=~1 object definitions have been created or modified
cmd:lsdef -t network aaaaa_not_exist
check:rc==0
cmd:chdef -t network aaaaa_not_exist gateway=10.0.0.101
check:rc==0
cmd:lsdef -t network aaaaa_not_exist -i gateway
check:output=~10.0.0.101
cmd:chdef -t network bbbbb_not_exist mask=255.255.255.0 net=100.0.0.0
check:rc!=0
check:output=~A network definition called 'aaaaa_not_exist' already exists
cmd:echo '
bbbbb_not_exist:
objtype=network
net=150.0.0.0
' > /tmp/bbbbb_not_exist.def
cmd:cat /tmp/bbbbb_not_exist.def |mkdef -z
check:rc!=0
check:output=~Net or mask value should not be empty
cmd:lsdef -t network -o bbbbb_not_exist
check:rc!=0
cmd:rmdef -t network -o aaaaa_not_exist
check:rc==0
cmd:rm -rf /tmp/bbbbb_not_exist.def
end

View File

@@ -70,5 +70,11 @@ cmd:rm -f /tmp/testnetworks
cmd:rm -f /tmp/inetworktest1
end
start:makenetworks_netname_exist
os:Linux
description:test makenetworks works as design when netname exists.
label:others,network
cmd:netname=`lsdef -t network |cut -d" " -f1 |sed -n '1p'`;makenetworks $netname
check:rc==0
check:output=~(already exists)
end

View File

@@ -159,6 +159,53 @@ check:output=~gateway=1.2.3.1
cmd:rmdef -t network testnetwork
end
start:mkdef_netname_exist
os:Linux
description:test mkdef works as design when netname exists.
label:mn_only,ci_test,db
cmd:netname=`lsdef -t network |cut -d" " -f1 |sed -n '1p'`;mkdef -t network -o $netname
check:rc==0
check:output=~(already exists)
end
start:mkdef_netname_notexist_without_net_mask
os:Linux
description:test mkdef works as design when net and mask is not defined.
label:mn_only,ci_test,db
cmd:mkdef -t network -o testnetworkwithoutnetandmask
check:rc!=0
check:output=~Error
cmd:mkdef -t network -o testnetworkwithoutnetandmask mtu=1500
check:rc!=0
check:output=~Net or mask value should not be empty
cmd:mkdef -t network -o testnetworkwithoutnetandmask net=10.0.0.0 mtu=1500
check:rc!=0
check:output=~Net or mask value should not be empty
cmd:mkdef -t network -o testnetworkwithoutnetandmask mask=255.0.0.0 mtu=1500
check:rc!=0
check:output=~Net or mask value should not be empty
cmd:mkdef -t network -o testnetworkwithoutnetandmask net=100.0.0.1 mask=255.0.0.0 mtu=1500
check:rc==0
check:output=~1 object definitions have been created or modified
cmd:lsdef -t network -z testnetworkwithoutnetandmask |tee /tmp/testnetworkwithoutnetandmask.stanza
check:rc==0
cmd:cat /tmp/testnetworkwithoutnetandmask.stanza|mkdef -z
check:rc!=0
check:output=~(already exists)
cmd:rmdef -t network testnetworkwithoutnetandmask
check:rc==0
end
start:mkdef_networks_if_net_mask_exists
os:Linux
description:test makenetworks works as design when net and mask exists. The network could not be created since net and mask are
the same.
label:mn_only,ci_test,db
cmd:netname=`lsdef -t network |cut -d" " -f1 |sed -n '1p'`;net=`lsdef -t network -o $netname |grep -i net |awk -F = '{print $2}'`;mask=`lsdef -t network -o $netname |grep -i mask |awk -F = '{print $2}'`;mkdef -t network -o testnetworkwithnetandmask net=$net mask=$mask
check:rc!=0
check:output=~(already exists)
end
start:mkdef_t_o_error
description:mkdef -t wrongtype
label:mn_only,ci_test,db

View File

@@ -197,3 +197,23 @@ check:output=~Error: (\[.*?\]: )?[Uu]nsupported command[:]* rpower ddd
check:rc==1
end
start:rpower_off_on
description:This case is to test off and on option could work for a diskful node. This case is do task 82, for bug 4132, the node status cannot be updated on normal system reboot #4138.
Attribute: $$CN-The operation object of rpower command
label:others,hctrl_general
cmd:rpower $$CN stat
check:output=~Running|on
cmd:lsdef -l $$CN -i status
check:output=~booted
cmd:rpower $$CN off
check:rc==0
cmd:a=0;while ! `rpower $$CN stat|grep "Not Activated\|off" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done
cmd:rpower $$CN on
check:rc==0
cmd:a=0;while ! `rpower $$CN stat|grep "Running\|on" >/dev/null`; do sleep 5;((a++));if [ $a -gt 11 ];then break;fi done
cmd:rpower $$CN stat
check:output=~Running|on
cmd:a=0;while ! `lsdef -l $$CN -i status|grep "booted" >/dev/null`; do sleep 5;((a++));if [ $a -gt 50 ];then break;fi done
cmd:lsdef -l $$CN -i status|grep "booted"
check:rc==0
end

View File

@@ -13,7 +13,7 @@ start:xcat_inventory_diff_without_option
description:This case is used to test xcat-inventory diff without option, should be error
label:others,inventory_ci
cmd:xcat-inventory diff
check:output=~Error: No valid source type!
check:output=~Backend not initialized, please initialize the backend with
check:rc!=0
end
@@ -45,7 +45,7 @@ start:xcat_inventory_diff_filename
description:This case is used to test xcat-inventory diff filename, should be error
label:others,inventory_ci
cmd:xcat-inventory diff --filename test_filename
check:output=~Error: No valid source type!
check:output=~Backend not initialized, please initialize the backend with
check:rc!=0
end

View File

@@ -1,7 +1,7 @@
start:import_osimage_with_environments_in_yaml
description:this case is to verify if osimage import could support environment variables.
os:Linux
label:others,inventory_ci,invoke_provision
label:others,invoke_provision
cmd:chdef -t node -o $$CN servicenode= monserver=$$MN nfsserver=$$MN tftpserver=$$MN xcatmaster=$$MN
check:rc==0

View File

@@ -1,6 +1,6 @@
start:export_import_osimage_with_INCLUDE_in_file
description:This case is used to test xcat-inventory export and import one linux osimage definition which has INCLUDE in the attribute's specified files. The attributes are pkglist, otherpkglist,exlist,synclists,template,postinstall and partitionfile.
label:others,xcat_inventory
label:others,inventory_ci
cmd:dir="/tmp/imagedata/";if [ -e "${dir}" ];then mv ${dir} ${dir}".bak"; fi; mkdir -p $dir
check:rc==0
cmd:dir="/tmp/imagedata/export";if [ -e "${dir}" ];then mv ${dir} ${dir}".bak"; fi; mkdir -p $dir

View File

@@ -2051,7 +2051,7 @@ check:rc==0
end
start:import_validation_node_device_type
label:others,xcat_inventory
label:others,inventory_ci
description:This case is used to test node validation function of xcat-inventory import yaml and json file. To test "device_type" attribute
cmd:mkdir -p /tmp/import_validation_node_device_type_bak
check:rc==0
@@ -2414,7 +2414,7 @@ end
start:import_validation_node_role
label:others,xcat_inventory
label:others,inventory_ci
descrroletion:This case is used to test node validation function of xcat-inventory import yaml and json file. To test "role" attribute
cmd:mkdir -p /tmp/import_validation_node_role_bak
check:rc==0

View File

@@ -995,7 +995,7 @@ cmd:file="/tmp/partitionfile"; rm -rf $file; if [ -d ${file}".bak" ];then mv ${f
end
start:export_import_multiple_osimages_by_dir
label:others,xcat_inventory
label:others,inventory_ci
description:This case is used to test xcat-inventory export and import several linux osimages definition by dir.
cmd:if [ -e /tmp/otherpkglist ]; then cp -f /tmp/otherpkglist /tmp/otherpkglist.bak; fi
cmd:echo "test" >> /tmp/otherpkglist
@@ -1127,7 +1127,7 @@ cmd:file="/opt/xcat/share/xcat/install/rh/template"; rm -rf $file; if [ -d ${fil
end
start:export_import_all_osimages_by_dir
label:others,xcat_inventory
label:others,inventory_ci
description:This case is used to test xcat-inventory export and import all linux osimage definition by files.
cmd:lsdef -t osimage -z | tee /tmp/osimage.list
check:rc==0
@@ -1264,7 +1264,7 @@ cmd:if [ -e /tmp/osimages.bak ]; then mv -f /tmp/osimages.bak /tmp/osimages; fi
end
start:export_import_osimages_by_dir_with_c
label:others,xcat_inventory
label:others,inventory_ci
description:This case is used to test xcat-inventory export and import linux osimage definition witch -c option.
cmd:dir="/tmp/export";if [ -e "${dir}" ];then mv ${dir} ${dir}".bak"; fi; mkdir -p $dir
cmd:imgdir='/tmp/export';for img in $(lsdef -t osimage -s|awk -F' ' '{print $1}'); do lsdef -t osimage -o $img -z > $imgdir/${img}.stanza;done

View File

@@ -1,6 +1,6 @@
start:export_import_an_osimage_directory
description: import an osimage diretory with `xcat-inventroy import -d <osimage directory>`
label:others,xcat_inventory
label:others,inventory_ci
#backup any existing test_myimage
cmd:mkdir -p /tmp/export_import_an_osimage_directory/backup
check:rc==0