def fake_is_v3(self, conn, serialNumber):
return False
+ def test_format_system_name(self):
+ v2array = ['SYMMETRIX', '000195900551', 'U', 'gold']
+ systemnameV2 = self.driver.utils._format_system_name(v2array[0],
+ v2array[1],
+ '+')
+ self.assertEqual('SYMMETRIX+000195900551', systemnameV2)
+
+ v3array = ['SYMMETRIX', '000197200056', 'SRP_1']
+ systemnameV3 = self.driver.utils._format_system_name(v3array[0],
+ v3array[1],
+ '-+-')
+ self.assertEqual('SYMMETRIX-+-000197200056', systemnameV3)
+
def test_wait_for_job_complete(self):
myjob = SE_ConcreteJob()
myjob.classname = 'SE_ConcreteJob'
idarray = poolInstanceId.split('+')
if len(idarray) > 2:
- systemName = self._format_system_name(idarray[0], idarray[1])
+ systemName = self._format_system_name(idarray[0], idarray[1], '+')
LOG.debug("Pool name: %(poolName)s System name: %(systemName)s.",
{'poolName': poolName, 'systemName': systemName})
return poolName, systemName
- def _format_system_name(self, part1, part2):
+ def _format_system_name(self, part1, part2, sep):
"""Join to make up system name
:param part1: the prefix
+ :param sep: the separator
:param part2: the postfix
:returns: systemName
"""
- return ("%(part1)s+%(part2)s"
+ return ("%(part1)s%(sep)s%(part2)s"
% {'part1': part1,
+ 'sep': sep,
'part2': part2})
def parse_pool_instance_id_v3(self, poolInstanceId):
idarray = poolInstanceId.split('-+-')
if len(idarray) > 2:
- systemName = self._format_system_name(idarray[0], idarray[1])
+ systemName = (
+ self._format_system_name(idarray[0], idarray[1], '-+-'))
LOG.debug("Pool name: %(poolName)s System name: %(systemName)s.",
{'poolName': poolName, 'systemName': systemName})