Merge "Unsuppress and cleanup pep8 whitespace errors"
This commit is contained in:
commit
bbfb09df47
@ -264,7 +264,8 @@ class DiskOperator(object):
|
||||
model_num = ''
|
||||
serial_id = ''
|
||||
|
||||
# Can merge all try/except in one block but this allows at least attributes with no exception to be filled
|
||||
# Can merge all try/except in one block but this allows at
|
||||
# least attributes with no exception to be filled
|
||||
try:
|
||||
size_mib = utils.get_disk_capacity_mib(device.device_node)
|
||||
except Exception as e:
|
||||
|
@ -211,7 +211,8 @@ class AgentAPI(sysinv.openstack.common.rpc.proxy.RpcProxy):
|
||||
|
||||
return retval
|
||||
|
||||
# TODO(oponcea) Evaluate if we need to delete PV's from sysinv-agent in the future - may be needed for AIO SX disk cinder-volumes disk replacement.
|
||||
# TODO(oponcea) Evaluate if we need to delete PV's from sysinv-agent in the
|
||||
# future - may be needed for AIO SX disk cinder-volumes disk replacement.
|
||||
def delete_pv(self, context, host_uuid, ipv_dict):
|
||||
"""Synchronously, delete an LVM physical volume
|
||||
|
||||
|
@ -1681,7 +1681,9 @@ class HostController(rest.RestController):
|
||||
for ihost in pecan.request.dbapi.ihost_get_list()
|
||||
if ihost['mgmt_mac'] in my_macs]
|
||||
if len(ihost_obj) != 1:
|
||||
raise Exception("Unexpected: no/more_than_one host(s) contain(s) a management mac address from local network adapters")
|
||||
raise Exception("Unexpected: no/more_than_one host(s)"
|
||||
" contain(s) a management mac address"
|
||||
" from local network adapters")
|
||||
|
||||
self._patch(ihost_obj[0]['uuid'],
|
||||
changed_paths, None)
|
||||
@ -1689,9 +1691,13 @@ class HostController(rest.RestController):
|
||||
self._do_post(new_host)
|
||||
|
||||
if new_host['power_on'] is not None and new_host['bm_type'] is None:
|
||||
success_str = "%s\n %s Warning: Ignoring <power_on> due to insufficient board management (bm) data." % (success_str, new_host['hostname'])
|
||||
success_str = "%s\n %s Warning: Ignoring <power_on> due" \
|
||||
" to insufficient board management (bm)" \
|
||||
" data." % (success_str,
|
||||
new_host['hostname'])
|
||||
else:
|
||||
success_str = "%s\n %s" % (success_str, new_host['hostname'])
|
||||
success_str = "%s\n %s" % (success_str,
|
||||
new_host['hostname'])
|
||||
except Exception as ex:
|
||||
LOG.exception(ex)
|
||||
error_str += " " + (new_host.get('hostname') or
|
||||
@ -3905,11 +3911,11 @@ class HostController(rest.RestController):
|
||||
elif pv.pv_type == constants.PV_TYPE_PARTITION:
|
||||
part_info = pecan.request.dbapi.partition_get_by_ipv(pv['uuid'])
|
||||
standby_controller_allocated_space += int(
|
||||
part_info[0].size_mib) * (1024**2)
|
||||
part_info[0].size_mib) * (1024 ** 2)
|
||||
elif pv.pv_type == constants.PV_TYPE_DISK:
|
||||
disk_info = pecan.request.dbapi.idisk_get_by_ipv(pv['uuid'])
|
||||
standby_controller_allocated_space += int(
|
||||
disk_info[0].size_mib) * (1024**2)
|
||||
disk_info[0].size_mib) * (1024 ** 2)
|
||||
|
||||
LOG.info("Active controller filesystem space used: %s" %
|
||||
str(active_controller_used))
|
||||
|
@ -1152,8 +1152,11 @@ def _check_interface_data(op, interface, ihost, existing_interface,
|
||||
# Make sure network type 'oam' or 'cluster-host', with if type 'ae',
|
||||
# can only be in ae mode 'active_standby' or 'balanced' or '802.3ad'
|
||||
if interface['networktypelist'] is not None:
|
||||
if (any(network in [constants.NETWORK_TYPE_OAM, constants.NETWORK_TYPE_CLUSTER_HOST] for network in interface['networktypelist']) and
|
||||
iftype == constants.INTERFACE_TYPE_AE and (aemode not in constants.VALID_AEMODE_LIST)):
|
||||
if (any(network in [constants.NETWORK_TYPE_OAM,
|
||||
constants.NETWORK_TYPE_CLUSTER_HOST]
|
||||
for network in interface['networktypelist']) and
|
||||
iftype == constants.INTERFACE_TYPE_AE and
|
||||
(aemode not in constants.VALID_AEMODE_LIST)):
|
||||
msg = _("Device interface with network type '%s', and interface "
|
||||
"type 'aggregated ethernet' must be in mode 'active_standby' "
|
||||
"or 'balanced' or '802.3ad'." % (str(interface['networktypelist'])))
|
||||
|
@ -2615,7 +2615,8 @@ def ifprofile_apply_to_host(host, profile):
|
||||
if interface_found is False:
|
||||
hinterface = interface_api._create(data, from_profile=True)
|
||||
if interface.ifclass == constants.INTERFACE_CLASS_PLATFORM:
|
||||
interface_networks = pecan.request.dbapi.interface_network_get_by_interface(interface.id)
|
||||
interface_networks = \
|
||||
pecan.request.dbapi.interface_network_get_by_interface(interface.id)
|
||||
for ifnet in interface_networks:
|
||||
ifnetdict = {}
|
||||
ifnetdict['interface_id'] = hinterface.id
|
||||
@ -2624,7 +2625,8 @@ def ifprofile_apply_to_host(host, profile):
|
||||
network = pecan.request.dbapi.network_get_by_id(ifnet.network_id)
|
||||
ifnet_api._update_host_address(host, hinterface, network.type)
|
||||
else:
|
||||
interface_datanetworks = pecan.request.dbapi.interface_datanetwork_get_by_interface(interface.id)
|
||||
interface_datanetworks = \
|
||||
pecan.request.dbapi.interface_datanetwork_get_by_interface(interface.id)
|
||||
for ifdn in interface_datanetworks:
|
||||
ifdndict = {}
|
||||
ifdndict['interface_id'] = hinterface.id
|
||||
|
@ -301,7 +301,8 @@ class RemoteLoggingController(rest.RestController):
|
||||
|
||||
if action == constants.APPLY_ACTION:
|
||||
# perform rpc to conductor to perform config apply
|
||||
pecan.request.rpcapi.update_remotelogging_config(pecan.request.context, timeout=REMOTELOGGING_RPC_TIMEOUT)
|
||||
pecan.request.rpcapi.update_remotelogging_config(pecan.request.context,
|
||||
timeout=REMOTELOGGING_RPC_TIMEOUT)
|
||||
|
||||
return RemoteLogging.convert_with_links(rpc_remotelogging)
|
||||
|
||||
|
@ -226,7 +226,8 @@ class AuditLogging(hooks.PecanHook):
|
||||
'',
|
||||
json_post_data(state))
|
||||
|
||||
log_data = "{} \"{} {} {}\" status: {} len: {} time: {}{} host:{} agent:{} user: {} tenant: {} domain: {}".format(
|
||||
log_data = "{} \"{} {} {}\" status: {} len: {} time: {}{} host:{}" \
|
||||
" agent:{} user: {} tenant: {} domain: {}".format(
|
||||
state.request.remote_addr,
|
||||
state.request.method,
|
||||
url_path,
|
||||
|
@ -1753,9 +1753,9 @@ def get_disk_capacity_mib(device_node):
|
||||
second_half = fdisk_output.split(',')[1]
|
||||
size_bytes = second_half.split()[0].strip()
|
||||
|
||||
# Convert bytes to MiB (1 MiB = 1024*1024 bytes)
|
||||
# Convert bytes to MiB (1 MiB = 1024 * 1024 bytes)
|
||||
int_size = int(size_bytes)
|
||||
size_mib = int_size / (1024**2)
|
||||
size_mib = int_size / (1024 ** 2)
|
||||
|
||||
return int(size_mib)
|
||||
|
||||
|
@ -3049,7 +3049,9 @@ class ConductorManager(service.PeriodicService):
|
||||
i.get('serial_id'))
|
||||
# If the clone label is in the serial id, this is
|
||||
# install-from-clone scenario. Skip gpt formatting.
|
||||
if ((constants.CLONE_ISO_DISK_SID + ihost['hostname'] + i.get('device_node')) == idisk.serial_id):
|
||||
if ((constants.CLONE_ISO_DISK_SID +
|
||||
ihost['hostname'] +
|
||||
i.get('device_node')) == idisk.serial_id):
|
||||
LOG.info("Install from clone. Update disk serial"
|
||||
" id for disk %s. Skip gpt formatting."
|
||||
% idisk.uuid)
|
||||
@ -3362,7 +3364,7 @@ class ConductorManager(service.PeriodicService):
|
||||
|
||||
partitions = self.dbapi.partition_get_by_ihost(host.id)
|
||||
partition4 = next((p for p in partitions if p.device_node == pv4_name), None)
|
||||
part_size_mib = float(pv_cgts_vg.lvm_pv_size) / (1024**2) - int(partition4.size_mib)
|
||||
part_size_mib = float(pv_cgts_vg.lvm_pv_size) / (1024 ** 2) - int(partition4.size_mib)
|
||||
if part_size_mib > 0:
|
||||
LOG.info("%s is not enough for R4 cgts-vg" % pv4_name)
|
||||
else:
|
||||
@ -7429,8 +7431,14 @@ class ConductorManager(service.PeriodicService):
|
||||
if lvdisplay_dict.get('dockerdistribution-lv', None):
|
||||
dockerdistribution_lv_size = float(lvdisplay_dict['dockerdistribution-lv'])
|
||||
|
||||
LOG.info("drbd-overview: pgsql-%s, platform-%s, extension-%s, patch-vault-%s, etcd-%s, dockerdistribution-%s", drbd_pgsql_size, drbd_platform_size, drbd_extension_size, drbd_patch_size, drbd_etcd_size, dockerdistribution_size)
|
||||
LOG.info("lvdisplay: pgsql-%s, platform-%s, extension-%s, patch-vault-%s, etcd-%s, dockerdistribution-%s", pgsql_lv_size, platform_lv_size, extension_lv_size, patch_lv_size, etcd_lv_size, dockerdistribution_lv_size)
|
||||
LOG.info("drbd-overview: pgsql-%s, platform-%s, extension-%s,"
|
||||
" patch-vault-%s, etcd-%s, dockerdistribution-%s",
|
||||
drbd_pgsql_size, drbd_platform_size, drbd_extension_size,
|
||||
drbd_patch_size, drbd_etcd_size, dockerdistribution_size)
|
||||
LOG.info("lvdisplay: pgsql-%s, platform-%s, extension-%s,"
|
||||
" patch-vault-%s, etcd-%s, dockerdistribution-%s",
|
||||
pgsql_lv_size, platform_lv_size, extension_lv_size,
|
||||
patch_lv_size, etcd_lv_size, dockerdistribution_lv_size)
|
||||
|
||||
drbd_fs_updated = []
|
||||
if math.ceil(drbd_pgsql_size) < math.ceil(pgsql_lv_size):
|
||||
|
@ -105,7 +105,8 @@ class CeilometerHelm(openstack.OpenstackBaseHelm):
|
||||
messaging_urls = []
|
||||
for rabbit_path in rabbit_paths:
|
||||
messaging_urls += \
|
||||
['rabbit://%s:%s@rabbitmq.openstack.svc.cluster.local:5672%s' % (rabbit_user, rabbit_pass, rabbit_path)]
|
||||
['rabbit://%s:%s@rabbitmq.openstack.svc.cluster.local:5672%s' %
|
||||
(rabbit_user, rabbit_pass, rabbit_path)]
|
||||
|
||||
return messaging_urls
|
||||
|
||||
|
@ -140,10 +140,15 @@ class KeystoneHelm(openstack.OpenstackBaseHelm):
|
||||
return password_rule
|
||||
|
||||
def _get_conf_keystone_security_compliance_overrides(self):
|
||||
rgx = '^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()<>{}+=_\\\[\]\-?|~`,.;:]).{7,}$'
|
||||
overrides = {
|
||||
'unique_last_password_count': 2, # static controller.yaml
|
||||
'password_regex': self.quoted_str('^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*()<>{}+=_\\\[\]\-?|~`,.;:]).{7,}$'),
|
||||
'password_regex_description': self.quoted_str('Password must have a minimum length of 7 characters, and must contain at least 1 upper case, 1 lower case, 1 digit, and 1 special character'),
|
||||
'password_regex': self.quoted_str(rgx),
|
||||
'password_regex_description':
|
||||
self.quoted_str('Password must have a minimum length of 7'
|
||||
' characters, and must contain at least 1'
|
||||
' upper case, 1 lower case, 1 digit, and 1'
|
||||
' special character'),
|
||||
}
|
||||
overrides.update(self._get_password_rule())
|
||||
return overrides
|
||||
@ -198,7 +203,8 @@ class KeystoneHelm(openstack.OpenstackBaseHelm):
|
||||
"identity:delete_service": "rule:admin_required and not rule:protected_services",
|
||||
"identity:delete_domain": "rule:admin_required and not rule:protected_domains",
|
||||
"identity:delete_project": "rule:admin_required and not rule:protected_projects",
|
||||
"identity:delete_user": "rule:admin_required and not (rule:protected_admins or rule:protected_services)",
|
||||
"identity:delete_user":
|
||||
"rule:admin_required and not (rule:protected_admins or rule:protected_services)",
|
||||
"identity:change_password": "rule:admin_or_owner and not rule:protected_services",
|
||||
"identity:delete_role": "rule:admin_required and not rule:protected_roles",
|
||||
}
|
||||
|
@ -408,11 +408,11 @@ class NovaHelm(openstack.OpenstackBaseHelm):
|
||||
for cell in host_memory:
|
||||
reserved_4K_pages = 'node:%d,size:4,count:%d' % (
|
||||
cell.numa_node,
|
||||
cell.platform_reserved_mib*constants.NUM_4K_PER_MiB)
|
||||
cell.platform_reserved_mib * constants.NUM_4K_PER_MiB)
|
||||
reserved_pages.append(reserved_4K_pages)
|
||||
# vswitch pages will be either 2M or 1G
|
||||
reserved_vswitch_pages = 'node:%d,size:%d,count:%d' % (cell.numa_node,
|
||||
cell.vswitch_hugepages_size_mib*constants.Ki,
|
||||
cell.vswitch_hugepages_size_mib * constants.Ki,
|
||||
cell.vswitch_hugepages_nr)
|
||||
reserved_pages.append(reserved_vswitch_pages)
|
||||
reserved_host_memory += cell.platform_reserved_mib
|
||||
|
@ -30,7 +30,8 @@ class sensorgroupTestCase(base.FunctionalTest):
|
||||
|
||||
# Test post_json worked properly
|
||||
self.assertEqual('defaultSensorGroupName', # Expected
|
||||
self.get_json('/isensorgroups/%s/' % sensorgroup.json['uuid'])['sensorgroupname']) # Result
|
||||
self.get_json('/isensorgroups/%s/' %
|
||||
sensorgroup.json['uuid'])['sensorgroupname']) # Result
|
||||
|
||||
# Create sensor
|
||||
sensorVals = {
|
||||
@ -46,11 +47,15 @@ class sensorgroupTestCase(base.FunctionalTest):
|
||||
|
||||
# Assert sensorgroup/sensor created properly in DB
|
||||
self.assertEqual('defaultSensorGroupName', # Expected
|
||||
self.get_json('/isensorgroups/%s/' % sensorgroup.json['uuid'])['sensorgroupname']) # Result
|
||||
self.get_json('/isensorgroups/%s/' %
|
||||
sensorgroup.json['uuid'])['sensorgroupname']) # Result
|
||||
self.assertEqual('defaultSensorName', # Expected
|
||||
self.get_json('/isensors/%s/' % sensor.json['uuid'])['sensorname']) # Result
|
||||
self.assertEqual(self.get_json('/isensors/%s/' % sensor.json['uuid'])['sensorgroup_uuid'],
|
||||
self.get_json('/isensorgroups/%s/' % sensorgroup.json['uuid'])['uuid'])
|
||||
self.get_json('/isensors/%s/' %
|
||||
sensor.json['uuid'])['sensorname']) # Result
|
||||
self.assertEqual(self.get_json('/isensors/%s/' %
|
||||
sensor.json['uuid'])['sensorgroup_uuid'],
|
||||
self.get_json('/isensorgroups/%s/' %
|
||||
sensorgroup.json['uuid'])['uuid'])
|
||||
|
||||
# Set values in sensorgroup
|
||||
self.patch_dict_json('/isensorgroups/%s/' % sensorgroup.json['uuid'],
|
||||
@ -63,27 +68,37 @@ class sensorgroupTestCase(base.FunctionalTest):
|
||||
|
||||
# Assert values got set properly in sensorgroup
|
||||
self.assertEqual(42, # Expected
|
||||
self.get_json('/isensorgroups/%s/' % sensorgroup.json['uuid'])['audit_interval_group']) # Result
|
||||
self.get_json('/isensorgroups/%s/' %
|
||||
sensorgroup.json['uuid'])['audit_interval_group']) # Result
|
||||
self.assertEqual('action minor', # Expected
|
||||
self.get_json('/isensorgroups/%s/' % sensorgroup.json['uuid'])['actions_minor_group']) # Result
|
||||
self.get_json('/isensorgroups/%s/' %
|
||||
sensorgroup.json['uuid'])['actions_minor_group']) # Result
|
||||
self.assertEqual('action major', # Expected
|
||||
self.get_json('/isensorgroups/%s/' % sensorgroup.json['uuid'])['actions_major_group']) # Result
|
||||
self.get_json('/isensorgroups/%s/' %
|
||||
sensorgroup.json['uuid'])['actions_major_group']) # Result
|
||||
self.assertEqual('action critical', # Expected
|
||||
self.get_json('/isensorgroups/%s/' % sensorgroup.json['uuid'])['actions_critical_group']) # Result
|
||||
self.get_json('/isensorgroups/%s/' %
|
||||
sensorgroup.json['uuid'])['actions_critical_group']) # Result
|
||||
self.assertEqual('False', # Expected
|
||||
self.get_json('/isensorgroups/%s/' % sensorgroup.json['uuid'])['suppress']) # Result
|
||||
self.get_json('/isensorgroups/%s/' %
|
||||
sensorgroup.json['uuid'])['suppress']) # Result
|
||||
|
||||
# Assert values got propagated to sensor
|
||||
self.assertEqual(42, # Expected
|
||||
self.get_json('/isensors/%s/' % sensor.json['uuid'])['audit_interval']) # Result
|
||||
self.get_json('/isensors/%s/' %
|
||||
sensor.json['uuid'])['audit_interval']) # Result
|
||||
self.assertEqual('action minor', # Expected
|
||||
self.get_json('/isensors/%s/' % sensor.json['uuid'])['actions_minor']) # Result
|
||||
self.get_json('/isensors/%s/' %
|
||||
sensor.json['uuid'])['actions_minor']) # Result
|
||||
self.assertEqual('action major', # Expected
|
||||
self.get_json('/isensors/%s/' % sensor.json['uuid'])['actions_major']) # Result
|
||||
self.get_json('/isensors/%s/' %
|
||||
sensor.json['uuid'])['actions_major']) # Result
|
||||
self.assertEqual('action critical', # Expected
|
||||
self.get_json('/isensors/%s/' % sensor.json['uuid'])['actions_critical']) # Result
|
||||
self.get_json('/isensors/%s/' %
|
||||
sensor.json['uuid'])['actions_critical']) # Result
|
||||
self.assertEqual('False', # Expected
|
||||
self.get_json('/isensors/%s/' % sensor.json['uuid'])['suppress']) # Result
|
||||
self.get_json('/isensors/%s/' %
|
||||
sensor.json['uuid'])['suppress']) # Result
|
||||
|
||||
# delete sensorgroup and assert sensorgroup/sensor got deleted
|
||||
self.delete('/isensorgroups/%s/' % sensorgroup.json['uuid'])
|
||||
@ -105,7 +120,8 @@ class sensorgroupTestCase(base.FunctionalTest):
|
||||
|
||||
# Test post_json worked properly
|
||||
self.assertEqual('testsensorgroupname', # Expected
|
||||
self.get_json('/isensorgroups/%s/' % sensorgroup.json['uuid'])['sensorgroupname']) # Result
|
||||
self.get_json('/isensorgroups/%s/' %
|
||||
sensorgroup.json['uuid'])['sensorgroupname']) # Result
|
||||
|
||||
# Create sensors
|
||||
numOfSensors = 10
|
||||
@ -125,9 +141,11 @@ class sensorgroupTestCase(base.FunctionalTest):
|
||||
# Assert sensors created properly in DB
|
||||
for i in range(numOfSensors):
|
||||
self.assertEqual('defaultSensorName', # Expected
|
||||
self.get_json('/isensors/%s/' % sensor[i].json['uuid'])['sensorname']) # Result
|
||||
self.get_json('/isensors/%s/' %
|
||||
sensor[i].json['uuid'])['sensorname']) # Result
|
||||
self.assertEqual(sensorgroup.json['uuid'], # Expected
|
||||
self.get_json('/isensors/%s/' % sensor[i].json['uuid'])['sensorgroup_uuid']) # Result
|
||||
self.get_json('/isensors/%s/' %
|
||||
sensor[i].json['uuid'])['sensorgroup_uuid']) # Result
|
||||
|
||||
# Set values in sensorgroup, then propagate to sensors
|
||||
self.patch_dict_json('/isensorgroups/%s/' % (sensorgroup.json['uuid']),
|
||||
@ -140,28 +158,38 @@ class sensorgroupTestCase(base.FunctionalTest):
|
||||
|
||||
# Assert values got set properly in sensorgroup
|
||||
self.assertEqual(42, # Expected
|
||||
self.get_json('/isensorgroups/%s/' % sensorgroup.json['uuid'])['audit_interval_group']) # Result
|
||||
self.get_json('/isensorgroups/%s/' %
|
||||
sensorgroup.json['uuid'])['audit_interval_group']) # Result
|
||||
self.assertEqual('action minor', # Expected
|
||||
self.get_json('/isensorgroups/%s/' % sensorgroup.json['uuid'])['actions_minor_group']) # Result
|
||||
self.get_json('/isensorgroups/%s/' %
|
||||
sensorgroup.json['uuid'])['actions_minor_group']) # Result
|
||||
self.assertEqual('action major', # Expected
|
||||
self.get_json('/isensorgroups/%s/' % sensorgroup.json['uuid'])['actions_major_group']) # Result
|
||||
self.get_json('/isensorgroups/%s/' %
|
||||
sensorgroup.json['uuid'])['actions_major_group']) # Result
|
||||
self.assertEqual('action critical', # Expected
|
||||
self.get_json('/isensorgroups/%s/' % sensorgroup.json['uuid'])['actions_critical_group']) # Result
|
||||
self.get_json('/isensorgroups/%s/' %
|
||||
sensorgroup.json['uuid'])['actions_critical_group']) # Result
|
||||
self.assertEqual('False', # Expected
|
||||
self.get_json('/isensorgroups/%s/' % sensorgroup.json['uuid'])['suppress']) # Result
|
||||
self.get_json('/isensorgroups/%s/' %
|
||||
sensorgroup.json['uuid'])['suppress']) # Result
|
||||
|
||||
# Assert values got propagated to sensor
|
||||
for i in range(numOfSensors):
|
||||
self.assertEqual(42, # Expected
|
||||
self.get_json('/isensors/%s/' % sensor[i].json['uuid'])['audit_interval']) # Result
|
||||
self.get_json('/isensors/%s/' %
|
||||
sensor[i].json['uuid'])['audit_interval']) # Result
|
||||
self.assertEqual('action minor', # Expected
|
||||
self.get_json('/isensors/%s/' % sensor[i].json['uuid'])['actions_minor']) # Result
|
||||
self.get_json('/isensors/%s/' %
|
||||
sensor[i].json['uuid'])['actions_minor']) # Result
|
||||
self.assertEqual('action major', # Expected
|
||||
self.get_json('/isensors/%s/' % sensor[i].json['uuid'])['actions_major']) # Result
|
||||
self.get_json('/isensors/%s/' %
|
||||
sensor[i].json['uuid'])['actions_major']) # Result
|
||||
self.assertEqual('action critical', # Expected
|
||||
self.get_json('/isensors/%s/' % sensor[i].json['uuid'])['actions_critical']) # Result
|
||||
self.get_json('/isensors/%s/' %
|
||||
sensor[i].json['uuid'])['actions_critical']) # Result
|
||||
self.assertEqual('False', # Expected
|
||||
self.get_json('/isensors/%s/' % sensor[i].json['uuid'])['suppress']) # Result
|
||||
self.get_json('/isensors/%s/' %
|
||||
sensor[i].json['uuid'])['suppress']) # Result
|
||||
|
||||
# Delete sensorgroup and sensors
|
||||
self.delete('/isensorgroups/%s/' % sensorgroup.json['uuid'])
|
||||
@ -182,7 +210,8 @@ class sensorgroupTestCase(base.FunctionalTest):
|
||||
}
|
||||
response = self.post_json('/isensorgroups', sensorgroupVals)
|
||||
self.assertEqual('testsensorgroupname', # Expected
|
||||
self.get_json('/isensorgroups/%s/' % response.json['uuid'])['sensorgroupname']) # Result
|
||||
self.get_json('/isensorgroups/%s/' %
|
||||
response.json['uuid'])['sensorgroupname']) # Result
|
||||
|
||||
self.delete('/isensorgroups/%s/' % response.json['uuid'])
|
||||
self.assertDeleted('/isensorgroups/%s/' % response.json['uuid'])
|
||||
@ -196,7 +225,8 @@ class sensorgroupTestCase(base.FunctionalTest):
|
||||
}
|
||||
response = self.post_json('/isensors', sensorVals)
|
||||
self.assertEqual('testsensorname', # Expected
|
||||
self.get_json('/isensors/%s/' % response.json['uuid'])['sensorname']) # Result
|
||||
self.get_json('/isensors/%s/' %
|
||||
response.json['uuid'])['sensorname']) # Result
|
||||
self.delete('/isensors/%s/' % response.json['uuid'])
|
||||
self.assertDeleted('/isensors/%s/' % response.json['uuid'])
|
||||
|
||||
|
@ -174,7 +174,8 @@ class StorageBackendTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_backend', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual(constants.SB_TYPE_FILE, # Expected
|
||||
self.get_json('/storage_backend/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.get_json('/storage_backend/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
|
||||
patch_response = self.patch_dict_json('/storage_backend/%s' % response.json['uuid'],
|
||||
headers={'User-Agent': 'sysinv'},
|
||||
@ -182,7 +183,8 @@ class StorageBackendTestCases(base.FunctionalTest):
|
||||
expect_errors=True)
|
||||
self.assertEqual(http_client.OK, patch_response.status_int)
|
||||
self.assertEqual({'test_bparam1': 'bar'}, # Expected
|
||||
self.get_json('/storage_backend/%s/' % patch_response.json['uuid'])['capabilities']) # Result
|
||||
self.get_json('/storage_backend/%s/' %
|
||||
patch_response.json['uuid'])['capabilities']) # Result
|
||||
|
||||
def test_post_file_with_valid_svc_some_svc_param_and_confirm(self):
|
||||
vals = {
|
||||
@ -291,12 +293,14 @@ class StorageBackendTestCases(base.FunctionalTest):
|
||||
expect_errors=False)
|
||||
self.assertEqual(http_client.OK, patch_response.status_int)
|
||||
self.assertEqual(constants.SB_SVC_GLANCE, # Expected
|
||||
self.get_json('/storage_backend/%s/' % response.json['uuid'])['services']) # Result
|
||||
self.get_json('/storage_backend/%s/' %
|
||||
response.json['uuid'])['services']) # Result
|
||||
|
||||
self.assertEqual({'test_bparam1': 'foo',
|
||||
'test_gparam1': 'bar',
|
||||
'test_gparam2': 'far'}, # Expected
|
||||
self.get_json('/storage_backend/%s/' % response.json['uuid'])['capabilities']) # Result
|
||||
self.get_json('/storage_backend/%s/' %
|
||||
response.json['uuid'])['capabilities']) # Result
|
||||
|
||||
def test_post_file_and_list(self):
|
||||
vals = {
|
||||
@ -307,8 +311,10 @@ class StorageBackendTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_backend/', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual(constants.SB_TYPE_FILE, # Expected
|
||||
self.get_json('/storage_backend/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.assertEqual(constants.SB_TYPE_FILE, self.get_json('/storage_backend')['storage_backends'][0]['backend'])
|
||||
self.get_json('/storage_backend/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
self.assertEqual(constants.SB_TYPE_FILE,
|
||||
self.get_json('/storage_backend')['storage_backends'][0]['backend'])
|
||||
|
||||
#
|
||||
# StorageBackend API: LVM
|
||||
@ -497,7 +503,8 @@ class StorageBackendTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_backend', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual('lvm', # Expected
|
||||
self.get_json('/storage_backend/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.get_json('/storage_backend/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
|
||||
patch_response = self.patch_dict_json('/storage_backend/%s' % response.json['uuid'],
|
||||
headers={'User-Agent': 'sysinv'},
|
||||
@ -507,10 +514,12 @@ class StorageBackendTestCases(base.FunctionalTest):
|
||||
expect_errors=False)
|
||||
self.assertEqual(http_client.OK, patch_response.status_int)
|
||||
self.assertEqual(constants.SB_SVC_CINDER, # Expected
|
||||
self.get_json('/storage_backend/%s/' % response.json['uuid'])['services']) # Result
|
||||
self.get_json('/storage_backend/%s/' %
|
||||
response.json['uuid'])['services']) # Result
|
||||
self.assertEqual({'test_cparam1': 'bar2',
|
||||
'test_cparam2': 'far2'}, # Expected
|
||||
self.get_json('/storage_backend/%s/' % response.json['uuid'])['capabilities']) # Result
|
||||
self.get_json('/storage_backend/%s/' %
|
||||
response.json['uuid'])['capabilities']) # Result
|
||||
|
||||
@mock.patch('sysinv.api.controllers.v1.storage_lvm._discover_and_validate_cinder_hiera_data')
|
||||
@mock.patch('sysinv.api.controllers.v1.storage_lvm._apply_backend_changes')
|
||||
@ -525,8 +534,10 @@ class StorageBackendTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_backend/', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual(constants.SB_TYPE_LVM, # Expected
|
||||
self.get_json('/storage_backend/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.assertEqual(constants.SB_TYPE_LVM, self.get_json('/storage_backend')['storage_backends'][0]['backend'])
|
||||
self.get_json('/storage_backend/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
self.assertEqual(constants.SB_TYPE_LVM,
|
||||
self.get_json('/storage_backend')['storage_backends'][0]['backend'])
|
||||
|
||||
#
|
||||
# StorageBackend API: Ceph
|
||||
@ -571,7 +582,8 @@ class StorageBackendTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_backend', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual('ceph', # Expected
|
||||
self.get_json('/storage_backend/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.get_json('/storage_backend/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
|
||||
@mock.patch.object(StorageBackendConfig, 'get_ceph_mon_ip_addresses')
|
||||
def test_post_ceph_with_invalid_svc_and_confirm(self, mock_mon_ip):
|
||||
@ -591,7 +603,10 @@ class StorageBackendTestCases(base.FunctionalTest):
|
||||
@mock.patch.object(StorageBackendConfig, 'get_ceph_mon_ip_addresses')
|
||||
@mock.patch('sysinv.api.controllers.v1.storage_ceph._discover_and_validate_cinder_capabilities')
|
||||
@mock.patch('sysinv.api.controllers.v1.storage_ceph._apply_backend_changes')
|
||||
def test_post_ceph_with_valid_svc_no_svc_param_and_confirm(self, mock_apply, mock_validate, mock_mon_ip):
|
||||
def test_post_ceph_with_valid_svc_no_svc_param_and_confirm(self,
|
||||
mock_apply,
|
||||
mock_validate,
|
||||
mock_mon_ip):
|
||||
# Test skipped. Fix later.
|
||||
self.skipTest("Skipping to prevent failure notification on Jenkins")
|
||||
vals = {
|
||||
@ -610,7 +625,10 @@ class StorageBackendTestCases(base.FunctionalTest):
|
||||
@mock.patch.object(StorageBackendConfig, 'get_ceph_mon_ip_addresses')
|
||||
@mock.patch('sysinv.api.controllers.v1.storage_ceph._discover_and_validate_cinder_capabilities')
|
||||
@mock.patch('sysinv.api.controllers.v1.storage_ceph._apply_backend_changes')
|
||||
def test_post_ceph_with_valid_svc_some_svc_param_and_confirm(self, mock_apply, mock_validate, mock_mon_ip):
|
||||
def test_post_ceph_with_valid_svc_some_svc_param_and_confirm(self,
|
||||
mock_apply,
|
||||
mock_validate,
|
||||
mock_mon_ip):
|
||||
# Test skipped. Fix later.
|
||||
self.skipTest("Skipping to prevent failure notification on Jenkins")
|
||||
vals = {
|
||||
@ -630,7 +648,10 @@ class StorageBackendTestCases(base.FunctionalTest):
|
||||
@mock.patch.object(StorageBackendConfig, 'get_ceph_mon_ip_addresses')
|
||||
@mock.patch('sysinv.api.controllers.v1.storage_ceph._discover_and_validate_cinder_capabilities')
|
||||
@mock.patch('sysinv.api.controllers.v1.storage_ceph._apply_backend_changes')
|
||||
def test_post_ceph_with_valid_svc_all_svc_param_and_confirm(self, mock_apply, mock_validate, mock_mon_ip):
|
||||
def test_post_ceph_with_valid_svc_all_svc_param_and_confirm(self,
|
||||
mock_apply,
|
||||
mock_validate,
|
||||
mock_mon_ip):
|
||||
vals = {
|
||||
'backend': constants.SB_TYPE_CEPH,
|
||||
'services': (',').join([constants.SB_SVC_CINDER, constants.SB_SVC_GLANCE]),
|
||||
@ -642,7 +663,8 @@ class StorageBackendTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_backend', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual('ceph', # Expected
|
||||
self.get_json('/storage_backend/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.get_json('/storage_backend/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
|
||||
@mock.patch.object(StorageBackendConfig, 'get_ceph_mon_ip_addresses')
|
||||
@mock.patch.object(SBApiHelper, 'set_backend_data',
|
||||
@ -657,7 +679,8 @@ class StorageBackendTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_backend', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual('ceph', # Expected
|
||||
self.get_json('/storage_backend/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.get_json('/storage_backend/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
|
||||
patch_response = self.patch_dict_json('/storage_backend/%s' % response.json['uuid'],
|
||||
headers={'User-Agent': 'sysinv'},
|
||||
@ -685,7 +708,8 @@ class StorageBackendTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_backend', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual('ceph', # Expected
|
||||
self.get_json('/storage_backend/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.get_json('/storage_backend/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
|
||||
patch_response = self.patch_dict_json('/storage_backend/%s' % response.json['uuid'],
|
||||
headers={'User-Agent': 'sysinv'},
|
||||
@ -702,8 +726,11 @@ class StorageBackendTestCases(base.FunctionalTest):
|
||||
@mock.patch('sysinv.api.controllers.v1.storage_ceph._apply_backend_changes')
|
||||
@mock.patch.object(SBApiHelper, 'set_backend_data',
|
||||
side_effect=set_backend_state_configured)
|
||||
def test_post_ceph_and_confirm_modify_with_svc_missing_some_params(self, mock_set_backend_data, mock_apply,
|
||||
mock_validate, mock_mon_ip):
|
||||
def test_post_ceph_and_confirm_modify_with_svc_missing_some_params(self,
|
||||
mock_set_backend_data,
|
||||
mock_apply,
|
||||
mock_validate,
|
||||
mock_mon_ip):
|
||||
vals = {
|
||||
'backend': constants.SB_TYPE_CEPH,
|
||||
'capabilities': {'test_bparam3': 'foo'},
|
||||
@ -712,7 +739,8 @@ class StorageBackendTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_backend', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual('ceph', # Expected
|
||||
self.get_json('/storage_backend/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.get_json('/storage_backend/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
|
||||
patch_response = self.patch_dict_json('/storage_backend/%s' % response.json['uuid'],
|
||||
headers={'User-Agent': 'sysinv'},
|
||||
@ -744,7 +772,8 @@ class StorageBackendTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_backend', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual('ceph', # Expected
|
||||
self.get_json('/storage_backend/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.get_json('/storage_backend/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
|
||||
patch_response = self.patch_dict_json('/storage_backend/%s' % response.json['uuid'],
|
||||
headers={'User-Agent': 'sysinv'},
|
||||
@ -753,12 +782,14 @@ class StorageBackendTestCases(base.FunctionalTest):
|
||||
'test_gparam3': 'too'}),
|
||||
expect_errors=False)
|
||||
self.assertEqual(http_client.OK, patch_response.status_int)
|
||||
json_result = self.get_json('/storage_backend/%s/' % response.json['uuid'])['services']
|
||||
json_result = self.get_json('/storage_backend/%s/' %
|
||||
response.json['uuid'])['services']
|
||||
self.assertTrue(services_string == json_result or services_string2 == json_result)
|
||||
self.assertEqual({'test_bparam3': 'foo',
|
||||
'test_cparam3': 'bar',
|
||||
'test_gparam3': 'too'}, # Expected
|
||||
self.get_json('/storage_backend/%s/' % response.json['uuid'])['capabilities']) # Result
|
||||
self.get_json('/storage_backend/%s/' %
|
||||
response.json['uuid'])['capabilities']) # Result
|
||||
|
||||
@mock.patch.object(StorageBackendConfig, 'get_ceph_mon_ip_addresses')
|
||||
def test_post_ceph_and_list(self, mock_mon_ip):
|
||||
@ -770,8 +801,10 @@ class StorageBackendTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_backend/', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual(constants.SB_TYPE_CEPH, # Expected
|
||||
self.get_json('/storage_backend/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.assertEqual(constants.SB_TYPE_CEPH, self.get_json('/storage_backend')['storage_backends'][0]['backend'])
|
||||
self.get_json('/storage_backend/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
self.assertEqual(constants.SB_TYPE_CEPH,
|
||||
self.get_json('/storage_backend')['storage_backends'][0]['backend'])
|
||||
|
||||
|
||||
class StorageFileTestCases(base.FunctionalTest):
|
||||
@ -823,7 +856,8 @@ class StorageFileTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_file', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual(constants.SB_TYPE_FILE, # Expected
|
||||
self.get_json('/storage_file/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.get_json('/storage_file/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
|
||||
def test_post_with_invalid_svc_and_confirm(self):
|
||||
vals = {
|
||||
@ -862,7 +896,8 @@ class StorageFileTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_file', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual(constants.SB_TYPE_FILE, # Expected
|
||||
self.get_json('/storage_file/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.get_json('/storage_file/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
|
||||
patch_response = self.patch_dict_json('/storage_file/%s' % response.json['uuid'],
|
||||
headers={'User-Agent': 'sysinv'},
|
||||
@ -870,7 +905,8 @@ class StorageFileTestCases(base.FunctionalTest):
|
||||
expect_errors=True)
|
||||
self.assertEqual(http_client.OK, patch_response.status_int)
|
||||
self.assertEqual({'test_bparam1': 'bar'}, # Expected
|
||||
self.get_json('/storage_file/%s/' % patch_response.json['uuid'])['capabilities']) # Result
|
||||
self.get_json('/storage_file/%s/' %
|
||||
patch_response.json['uuid'])['capabilities']) # Result
|
||||
|
||||
def test_post_with_valid_svc_some_svc_param_and_confirm(self):
|
||||
vals = {
|
||||
@ -899,7 +935,8 @@ class StorageFileTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_file', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual(constants.SB_TYPE_FILE, # Expected
|
||||
self.get_json('/storage_file/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.get_json('/storage_file/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
|
||||
@mock.patch.object(SBApiHelper, 'set_backend_data',
|
||||
side_effect=set_backend_state_configured)
|
||||
@ -912,7 +949,8 @@ class StorageFileTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_file', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual(constants.SB_TYPE_FILE, # Expected
|
||||
self.get_json('/storage_file/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.get_json('/storage_file/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
|
||||
patch_response = self.patch_dict_json('/storage_file/%s' % response.json['uuid'],
|
||||
headers={'User-Agent': 'sysinv'},
|
||||
@ -921,7 +959,8 @@ class StorageFileTestCases(base.FunctionalTest):
|
||||
self.assertEqual(http_client.BAD_REQUEST, patch_response.status_int)
|
||||
self.assertEqual('application/json', patch_response.content_type)
|
||||
self.assertTrue(patch_response.json['error_message'])
|
||||
self.assertIn('Service cinder is not supported', patch_response.json['error_message'])
|
||||
self.assertIn('Service cinder is not supported',
|
||||
patch_response.json['error_message'])
|
||||
|
||||
def test_post_and_confirm_modify_with_svc_missing_params(self):
|
||||
vals = {
|
||||
@ -932,7 +971,8 @@ class StorageFileTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_file', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual(constants.SB_TYPE_FILE, # Expected
|
||||
self.get_json('/storage_file/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.get_json('/storage_file/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
|
||||
patch_response = self.patch_dict_json('/storage_file/%s' % response.json['uuid'],
|
||||
headers={'User-Agent': 'sysinv'},
|
||||
@ -941,7 +981,8 @@ class StorageFileTestCases(base.FunctionalTest):
|
||||
self.assertEqual(http_client.BAD_REQUEST, patch_response.status_int)
|
||||
self.assertEqual('application/json', patch_response.content_type)
|
||||
self.assertTrue(patch_response.json['error_message'])
|
||||
self.assertIn('Missing required glance service parameter', patch_response.json['error_message'])
|
||||
self.assertIn('Missing required glance service parameter',
|
||||
patch_response.json['error_message'])
|
||||
|
||||
def test_post_and_confirm_modify_with_svc_missing_some_params(self):
|
||||
vals = {
|
||||
@ -952,7 +993,8 @@ class StorageFileTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_file', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual(constants.SB_TYPE_FILE, # Expected
|
||||
self.get_json('/storage_file/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.get_json('/storage_file/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
|
||||
patch_response = self.patch_dict_json('/storage_file/%s' % response.json['uuid'],
|
||||
headers={'User-Agent': 'sysinv'},
|
||||
@ -962,7 +1004,8 @@ class StorageFileTestCases(base.FunctionalTest):
|
||||
self.assertEqual(http_client.BAD_REQUEST, patch_response.status_int)
|
||||
self.assertEqual('application/json', patch_response.content_type)
|
||||
self.assertTrue(patch_response.json['error_message'])
|
||||
self.assertIn('Missing required glance service parameter', patch_response.json['error_message'])
|
||||
self.assertIn('Missing required glance service parameter',
|
||||
patch_response.json['error_message'])
|
||||
|
||||
def test_post_and_confirm_modify_with_svc_with_params(self):
|
||||
# Test skipped. Fix later.
|
||||
@ -975,7 +1018,8 @@ class StorageFileTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_file', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual(constants.SB_TYPE_FILE, # Expected
|
||||
self.get_json('/storage_file/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.get_json('/storage_file/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
|
||||
patch_response = self.patch_dict_json('/storage_file/%s' % response.json['uuid'],
|
||||
headers={'User-Agent': 'sysinv'},
|
||||
@ -985,12 +1029,14 @@ class StorageFileTestCases(base.FunctionalTest):
|
||||
expect_errors=False)
|
||||
self.assertEqual(http_client.OK, patch_response.status_int)
|
||||
self.assertEqual(constants.SB_SVC_GLANCE, # Expected
|
||||
self.get_json('/storage_file/%s/' % response.json['uuid'])['services']) # Result
|
||||
self.get_json('/storage_file/%s/' %
|
||||
response.json['uuid'])['services']) # Result
|
||||
|
||||
self.assertEqual({'test_bparam1': 'foo',
|
||||
'test_gparam1': 'bar',
|
||||
'test_gparam2': 'far'}, # Expected
|
||||
self.get_json('/storage_file/%s/' % response.json['uuid'])['capabilities']) # Result
|
||||
self.get_json('/storage_file/%s/' %
|
||||
response.json['uuid'])['capabilities']) # Result
|
||||
|
||||
def test_post_and_list(self):
|
||||
vals = {
|
||||
@ -1001,8 +1047,10 @@ class StorageFileTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_file/', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual(constants.SB_TYPE_FILE, # Expected
|
||||
self.get_json('/storage_file/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.assertEqual(constants.SB_TYPE_FILE, self.get_json('/storage_backend')['storage_backends'][0]['backend'])
|
||||
self.get_json('/storage_file/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
self.assertEqual(constants.SB_TYPE_FILE,
|
||||
self.get_json('/storage_backend')['storage_backends'][0]['backend'])
|
||||
|
||||
|
||||
class StorageLvmTestCases(base.FunctionalTest):
|
||||
@ -1051,7 +1099,8 @@ class StorageLvmTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_lvm', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual(constants.SB_TYPE_LVM, # Expected
|
||||
self.get_json('/storage_lvm/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.get_json('/storage_lvm/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
|
||||
@mock.patch('sysinv.api.controllers.v1.storage_lvm._discover_and_validate_cinder_hiera_data')
|
||||
@mock.patch('sysinv.api.controllers.v1.storage_lvm._apply_backend_changes')
|
||||
@ -1132,7 +1181,8 @@ class StorageLvmTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_lvm', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual(constants.SB_TYPE_LVM, # Expected
|
||||
self.get_json('/storage_lvm/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.get_json('/storage_lvm/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
|
||||
patch_response = self.patch_dict_json('/storage_lvm/%s' % response.json['uuid'],
|
||||
headers={'User-Agent': 'sysinv'},
|
||||
@ -1157,8 +1207,10 @@ class StorageLvmTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_lvm/', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual(constants.SB_TYPE_LVM, # Expected
|
||||
self.get_json('/storage_lvm/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.assertEqual(constants.SB_TYPE_LVM, self.get_json('/storage_backend')['storage_backends'][0]['backend'])
|
||||
self.get_json('/storage_lvm/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
self.assertEqual(constants.SB_TYPE_LVM,
|
||||
self.get_json('/storage_backend')['storage_backends'][0]['backend'])
|
||||
|
||||
|
||||
class StorageCephTestCases(base.FunctionalTest):
|
||||
@ -1203,7 +1255,8 @@ class StorageCephTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_ceph', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual(constants.SB_TYPE_CEPH, # Expected
|
||||
self.get_json('/storage_ceph/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.get_json('/storage_ceph/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
|
||||
@mock.patch.object(StorageBackendConfig, 'get_ceph_mon_ip_addresses')
|
||||
def test_post_with_invalid_svc_and_confirm(self, mock_mon_ip):
|
||||
@ -1232,12 +1285,15 @@ class StorageCephTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_ceph', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual(constants.SB_TYPE_CEPH, # Expected
|
||||
self.get_json('/storage_ceph/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.get_json('/storage_ceph/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
|
||||
@mock.patch.object(StorageBackendConfig, 'get_ceph_mon_ip_addresses')
|
||||
@mock.patch.object(SBApiHelper, 'set_backend_data',
|
||||
side_effect=set_backend_state_configured)
|
||||
def test_post_and_confirm_modify_with_invalid_svc(self, mock_set_backend_data, mock_mon_ip):
|
||||
def test_post_and_confirm_modify_with_invalid_svc(self,
|
||||
mock_set_backend_data,
|
||||
mock_mon_ip):
|
||||
vals = {
|
||||
'backend': constants.SB_TYPE_CEPH,
|
||||
'capabilities': {'test_bparam3': 'foo'},
|
||||
@ -1246,7 +1302,8 @@ class StorageCephTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_ceph', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual(constants.SB_TYPE_CEPH, # Expected
|
||||
self.get_json('/storage_ceph/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.get_json('/storage_ceph/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
|
||||
patch_response = self.patch_dict_json('/storage_ceph/%s' % response.json['uuid'],
|
||||
headers={'User-Agent': 'sysinv'},
|
||||
@ -1255,7 +1312,8 @@ class StorageCephTestCases(base.FunctionalTest):
|
||||
self.assertEqual(http_client.BAD_REQUEST, patch_response.status_int)
|
||||
self.assertEqual('application/json', patch_response.content_type)
|
||||
self.assertTrue(patch_response.json['error_message'])
|
||||
self.assertIn('Service invalid_svc is not supported', patch_response.json['error_message'])
|
||||
self.assertIn('Service invalid_svc is not supported',
|
||||
patch_response.json['error_message'])
|
||||
|
||||
@mock.patch.object(StorageBackendConfig, 'get_ceph_mon_ip_addresses')
|
||||
def test_post_and_confirm_modify_with_svc_with_params(self, mock_mon_ip):
|
||||
@ -1269,7 +1327,8 @@ class StorageCephTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_ceph', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual(constants.SB_TYPE_CEPH, # Expected
|
||||
self.get_json('/storage_ceph/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.get_json('/storage_ceph/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
|
||||
patch_response = self.patch_dict_json('/storage_ceph/%s' % response.json['uuid'],
|
||||
headers={'User-Agent': 'sysinv'},
|
||||
@ -1278,10 +1337,12 @@ class StorageCephTestCases(base.FunctionalTest):
|
||||
expect_errors=False)
|
||||
self.assertEqual(http_client.OK, patch_response.status_int)
|
||||
self.assertEqual(constants.SB_SVC_SWIFT, # Expected
|
||||
self.get_json('/storage_ceph/%s/' % response.json['uuid'])['services']) # Result
|
||||
self.get_json('/storage_ceph/%s/' %
|
||||
response.json['uuid'])['services']) # Result
|
||||
self.assertEqual({'test_bparam3': 'foo',
|
||||
'test_sparam1': 'bar'}, # Expected
|
||||
self.get_json('/storage_ceph/%s/' % response.json['uuid'])['capabilities']) # Result
|
||||
self.get_json('/storage_ceph/%s/' %
|
||||
response.json['uuid'])['capabilities']) # Result
|
||||
|
||||
@mock.patch.object(StorageBackendConfig, 'get_ceph_mon_ip_addresses')
|
||||
def test_post_and_list(self, mock_mon_ip):
|
||||
@ -1293,5 +1354,7 @@ class StorageCephTestCases(base.FunctionalTest):
|
||||
response = self.post_json('/storage_ceph/', vals, expect_errors=False)
|
||||
self.assertEqual(http_client.OK, response.status_int)
|
||||
self.assertEqual(constants.SB_TYPE_CEPH, # Expected
|
||||
self.get_json('/storage_ceph/%s/' % response.json['uuid'])['backend']) # Result
|
||||
self.assertEqual(constants.SB_TYPE_CEPH, self.get_json('/storage_backend')['storage_backends'][0]['backend'])
|
||||
self.get_json('/storage_ceph/%s/' %
|
||||
response.json['uuid'])['backend']) # Result
|
||||
self.assertEqual(constants.SB_TYPE_CEPH,
|
||||
self.get_json('/storage_backend')['storage_backends'][0]['backend'])
|
||||
|
@ -63,9 +63,6 @@ commands =
|
||||
# E126 continuation line over-indented for hanging indent
|
||||
# E127 continuation line over-indented for visual indent
|
||||
# E128 continuation line under-indented for visual indent
|
||||
# E226 missing whitespace around arithmetic operator
|
||||
# E402 module level import not at top of file
|
||||
# E501 line too long > 80
|
||||
# H series are hacking
|
||||
# H101 is TODO
|
||||
# H102 is apache license
|
||||
@ -79,8 +76,9 @@ commands =
|
||||
# H701 Empty localization string
|
||||
# H702 Formatting operation should be outside of localization method call
|
||||
# H703 Multiple positional placeholders
|
||||
ignore = E126,E127,E128,E226,E402,E501,H101,H102,H104,H105,H306,H401,H403,H404,H405,H701,H702,H703
|
||||
ignore = E126,E127,E128,H101,H102,H104,H105,H306,H401,H403,H404,H405,H701,H702,H703
|
||||
exclude = build,dist,tools
|
||||
max-line-length=120
|
||||
|
||||
[testenv:flake8]
|
||||
basepython = python2.7
|
||||
|
Loading…
Reference in New Issue
Block a user