def test_delete_not_available(self): """ Verify deletion is not available when no initiator groups selected in grid. """ initiatorGroupPrefix = 'ig' initiatorGroupNumber = 3 initiatorGroupNames = self._createInitiatorGroups( prefix=initiatorGroupPrefix, number=initiatorGroupNumber) self.initiatorGroupsPage.btnRefresh.click() self.initiatorGroupsPage.btnRefresh.waitUntilEnabled() LOG.step('Deselecting all initiator groups in grid') self.initiatorGroupsPage.gridInitiatorGroups.unselect( initiator_group=initiatorGroupNames) selectedGroups = self.initiatorGroupsPage.gridInitiatorGroups.find( selected=True) self.assertFalse(selectedGroups) LOG.info('Selected initiator groups:', selectedGroups) LOG.step("Verifying button 'Delete' is disabled in tool bar") self.assertFalse(self.initiatorGroupsPage.btnDelete.isEnabled()) LOG.info("Button 'Delete' is enabled:", self.initiatorGroupsPage.btnDelete.isEnabled())
def test_delete_single(self): """ Verify deletion of single unmapped initiator group. """ initiatorGroupPrefix = 'IG' initiatorGroupNumber = 5 initiatorGroupNames = self._createInitiatorGroups( prefix=initiatorGroupPrefix, number=initiatorGroupNumber) self.initiatorGroupsPage.btnRefresh.click() self.initiatorGroupsPage.btnRefresh.waitUntilEnabled() LOG.step('Selecting initiator group in grid') self.initiatorGroupsPage.gridInitiatorGroups.select( initiator_group=initiatorGroupNames[0]) selectedGroups = self.initiatorGroupsPage.gridInitiatorGroups.find( selected=True) self.assertTrue(len(selectedGroups) == 1) self.assertTrue( selectedGroups[0]['initiator_group'] == initiatorGroupNames[0]) LOG.info('Initiator group selected:', initiatorGroupNames[0]) LOG.step('Deleting and verifying initiator group has been deleted') self.initiatorGroupsPage.btnDelete.click() initiatorGroups = self.marscluster.igroup.show(json=True) self.assertTrue(len(initiatorGroups) == initiatorGroupNumber - 1) self.assertFalse(initiatorGroupNames[0] in [group['name'] for group in initiatorGroups]) LOG.info( "Initiator group '%s' is not present:\n" % initiatorGroupNames[0].encode('utf-8'), initiatorGroups)
def test_delete_multi(self): """ Verify deletion of multiple unmapped initiator groups. """ initiatorGroupPrefix = 'IG' initiatorGroupNumber = 9 initiatorGroupNames = self._createInitiatorGroups( prefix=initiatorGroupPrefix, number=initiatorGroupNumber) self.initiatorGroupsPage.btnRefresh.click() self.initiatorGroupsPage.btnRefresh.waitUntilEnabled() LOG.step('Selecting initiator groups in grid') self.initiatorGroupsPage.gridInitiatorGroups.select( initiator_group=initiatorGroupNames[:initiatorGroupNumber / 2]) selectedGroups = self.initiatorGroupsPage.gridInitiatorGroups.find( selected=True) self.assertTrue(len(selectedGroups) == initiatorGroupNumber / 2) LOG.info('Initiator group selected:', selectedGroups) LOG.step('Deleting and verifying initiator group has been deleted') self.initiatorGroupsPage.btnDelete.click() # Give some time to perform operation time.sleep(2) initiatorGroupNames = [ group['name'] for group in self.marscluster.igroup.show(json=True) ] self.assertTrue( len(initiatorGroupNames) == initiatorGroupNumber - (initiatorGroupNumber / 2)) for group in selectedGroups: self.assertFalse(group['initiator_group'] in initiatorGroupNames) LOG.info('Initiator group is not present:', group['initiator_group'])
def test_dialog_cancel(self): """ Verify no LUNs created when dialog closed without submission. """ lunName = 'LuN' lunSize = '1g' initiatorGroupPrefix = 'IG' initiatorGroupNumber = 3 initiatorGroups = self._createInitiatorGroups( prefix=initiatorGroupPrefix, number=initiatorGroupNumber) LOG.step('Opening wizard') wizard = CreateLUNsIGPageWizard(driver=self.driver, locale=self.locale) wizard.open(initiator_group=initiatorGroups[0]) LOG.info('Wizard open.') LOG.step('Defining single LUN') wizard.activePage.defineSingleLUN(name=lunName, size=lunSize) LOG.info('LUN name:', lunName) LOG.info('LUN size:', lunSize) LOG.step('Closing wizard without submission') wizard.cancel() LOG.info('Wizard cancelled.') LOG.step('Verifying LUN has not been created') luns = self.marscluster.lun.show(json=True) self.assertFalse(luns) LOG.info('LUNs:', luns)
def suiteTeardown(self): LOG.step('Closing browser') self.driver.quit() luns = express.Luns(node=self.marscluster, cleanup=True) del luns self.marscluster.igroup.destroyAll() LOG.info('LUNs & initiator groups destroyed.')
def test_invalid_name(self): """ Verify LUN renaming with invalid name. """ LOG.step('Creating LUNs') lunCount = 3 lunSize = '1g' lunNamePrefix = 'LuN' lunNewName = 'NewName*&#@1A_^?,' self.luns.create(count=lunCount, size=lunSize, prefix=lunNamePrefix) LOG.info('LUNs created:\n', self.node.lun.show(json=True)) self.lunsPage.btnRefresh.click() self.lunsPage.btnRefresh.waitUntilEnabled() LOG.step('Renaming LUN in dialog') wizard = RenameLUNWizard(driver=self.driver) wizard.open(name=lunNamePrefix + '_1') LOG.info('Old LUN name:', lunNamePrefix + '_1') wizard.renameLUNPage.renameLUN(name=lunNewName) LOG.info('New LUN name:', lunNewName) LOG.step('Verifying name error message') wizard.activePage.lblNameError.waitUntilPresent() LOG.info('Name error message:', wizard.activePage.lblNameError.getText()) self.assertFalse(wizard.activePage.btnOK.isEnabled()) LOG.info("Button 'OK' is enabled:", wizard.activePage.btnOK.isEnabled())
def test_esx_host_device(self): LOG.step('Setting up LUNs/igroups') self.luns.create(count=2, size=self.lunSize, prefix='lun_esx') for lun in self.luns: lun += self.igroups[0] LOG.info('Created and mapped LUNs') LOG.step('Rescanning HBAs') self.esxHost.rescan() LOG.info('Rescanned HBAs.') LOG.step('Getting FC initiators') fcs = self.esxHost.getFCInitiators() LOG.info('FC initiators info:\n', fcs) LOG.step('Getting specified FC initiators') fc = self.esxHost.getFCInitiators(matchWWPN=self.fcInitiators)[0] self.assertTrue(fc['WWPN'] in self.fcInitiators) LOG.info('FC initiator info:\n', fc) LOG.step('Getting storage devices') luns = self.esxHost.getDevices(uniqLuns=True, node=self.node) for lun in luns: self.assertTrue(lun['model'] == 'LUN FlashRay') self.assertTrue(lun['device-type'] == 'disk') self.assertTrue(lun['scsiLevel'] == 4) self.assertTrue(lun['protocol'] == 'FCP') self.assertTrue(lun['lun-type'] == 'disk') self.assertTrue(lun['state'] == 'ok') self.assertTrue(lun['vendor'] == 'NETAPP') LOG.info('Storage devices:\n', lun)
def suiteTeardown(self): LOG.step('Closing browser') self.driver.quit() self.marscluster.snapshot.deleteAll() luns = express.Luns(node=self.marscluster, cleanup=True) del luns LOG.info('LUNs & snapshots cleaned up.')
def test_dialog_cancel(self): """ Verify OS type of initiator group remains intact on dialog cancel. """ initiatorGroupCount = 3 initiatorGroupPrefix = 'IG' originalOStype = 'Windows' newOSType = 'Xen' LOG.step('Creating initiator groups') initiatorGroups = self._createInitiatorGroups(prefix=initiatorGroupPrefix, number=initiatorGroupCount, osType=originalOStype) LOG.info('Initiator groups created:', initiatorGroups) LOG.step('Opening dialog') wizard = ChangeInitiatorGroupOSTypeWizard(driver=self.driver) wizard.open(initiator_groups=initiatorGroups[0]) LOG.info('Dialog open for initiator group:', initiatorGroups[0]) LOG.step('Setting initiator group OS type to: %s' % newOSType) wizard.activePage.setOSType(osType=newOSType) self.assertTrue(wizard.activePage.dLstOSType.getText() == newOSType) LOG.info('OS type set to:', wizard.activePage.dLstOSType.getText()) LOG.step('Canceling dialog without submission') wizard.cancel() LOG.info('Dialog closed.') LOG.step('Verifying initiator group OS type remains original') initiatorGroup = [group for group in self.marscluster.igroup.show(json=True) if group['name'] == initiatorGroups[0]][0] self.assertTrue(initiatorGroup['ostype'] == originalOStype.lower()) LOG.info('Initiator froup OS type has not been changed:', initiatorGroup['ostype'])
def testTeardown(self): try: LOG.info("Destroying existing LUNs...") del self.luns except Exception as e: raise FailedProductException(e) self.driver.quit()
def test_fail_invalid_name(self): """ Verify error message when snapshot name is invalid. """ LOG.step('Creating LUNs') lunCount = 3 lunSize = 1 lunSizeUnit = 'G' lunNamePrefix = 'LuN' snapshotName = 'Snap$hot' self.luns.create(count=lunCount, size=str(lunSize) + lunSizeUnit, prefix=lunNamePrefix) LOG.info('LUNs created:\n', self.marscluster.lun.show(json=True)) # Refresh LUN grid self.lunsPage.btnRefresh.click() self.lunsPage.btnRefresh.waitUntilEnabled() LOG.step('Opening dialog') wizard = CreateLUNSnapshotWizard(driver=self.driver) wizard.open(name=lunNamePrefix + '_1') LOG.info('Dialog is open.') LOG.step('Verifying error message on invalid snapshot name') wizard.activePage.setName(name=snapshotName) self.assertTrue(wizard.activePage.txtName.getText() == snapshotName) LOG.info('Snapshot name set:', wizard.activePage.txtName.getText()) self.assertTrue(wizard.activePage.lblNameError.isVisible()) LOG.info('Error message displayed:', wizard.activePage.lblNameError.getText()) self.assertFalse(wizard.activePage.btnOK.isEnabled()) LOG.info("Button 'OK' is enabled:", wizard.activePage.btnOK.isEnabled())
def _navigateToLUNSnapshotsPage(self, lunName): LOG.step('Navigating to LUN Snapshots page...') self.lunsPage.gridLUNs.clickLink(name=lunName, click={'name': lunName}) self.lunDetailsPage.waitUntilOpen() self.lunDetailsPage.tabSnapshots.click() self.lunSnapshotsPage.waitUntilOpen() LOG.info('Browser landed on LUN Snapshots page.')
def test_valid_name(self): """ Verify LUN renaming with valid name. """ LOG.step('Creating LUNs') lunCount = 3 lunSize = '1g' lunNamePrefix = 'LuN' lunNewName = 'NewName' self.luns.create(count=lunCount, size=lunSize, prefix=lunNamePrefix) LOG.info('LUNs created:\n', self.node.lun.show(json=True)) self.lunsPage.btnRefresh.click() self.lunsPage.btnRefresh.waitUntilEnabled() LOG.step('Renaming LUN in dialog') wizard = RenameLUNWizard(driver=self.driver) wizard.open(name=lunNamePrefix + '_1') LOG.info('Old LUN name:', lunNamePrefix + '_1') wizard.renameLUNPage.renameLUN(name=lunNewName) LOG.info('New LUN name:', lunNewName) wizard.renameLUNPage.submit() LOG.info('Rename submitted.') LOG.step('Verifying LUN name has been changed') lun = self.lunsPage.gridLUNs.find(name=lunNewName) self.assertTrue(len(lun) == 1) self.assertTrue(lun[0]['name'] == lunNewName) LOG.info('LUN found:\n', lun)
def testTeardown(self): try: LOG.info("Destroying existing LUNs and igroups...") del self.igroups del self.luns except Exception, e: raise FailedProductException(e)
def _createInitiatorGroups(self, prefix, number, osType='vmware'): LOG.step('Creating initiator group(s)') for groupNumber in range(number): fictiveWWPN = format(random.randrange(sys.maxint), 'x').rjust(16, 'f') self.marscluster.igroup.create(name=prefix + '-' + str(groupNumber), ostype=osType.lower(), initiators=fictiveWWPN) groupNames = [group['name'] for group in self.marscluster.igroup.show(json=True)] LOG.info('Initiator group(s) created:', groupNames) return groupNames
def test_dialog_not_available(self): """ Verify menu item 'Edit -> Mappings' not available when multiple LUNs selected in grid. """ LOG.step('Creating LUNs') lunCount = 3 lunSize = 2 lunSizeUnit = 'G' lunNamePrefix = 'LuN' initiatorGroupName = 'IG-' initiatorGroupsNumber = 5 self.luns.create(count=lunCount, size=str(lunSize) + lunSizeUnit, prefix=lunNamePrefix) LOG.info('LUNs created:\n', self.marscluster.lun.show(json=True)) LOG.step('Creating initiator groups') for initiatorIndex in range(initiatorGroupsNumber): fictiveWWPN = format(random.randrange(sys.maxint), 'x').rjust(16, 'f') self.marscluster.igroup.create(name=(initiatorGroupName + str(initiatorIndex)), ostype='vmware', initiators=fictiveWWPN) initiatorGroups = self.marscluster.igroup.show(json=True) LOG.info('Initiator groups created:\n', initiatorGroups) LOG.step('Mapping LUN to initiator groups') # Map to first and last initiator groups self.marscluster.lun.map({ 'name': lunNamePrefix + '_1', 'igroup': initiatorGroups[0]['name'] }) self.marscluster.lun.map({ 'name': lunNamePrefix + '_1', 'igroup': initiatorGroups[-1]['name'] }) originalMappings = [ lun for lun in self.marscluster.lun.mapping_show(json=True) if lun['lun-name'] == lunNamePrefix + '_1' ] LOG.info('LUN mapped:\n', originalMappings) # Refresh LUN grid self.lunsPage.btnRefresh.click() self.lunsPage.btnRefresh.waitUntilEnabled() LOG.step('Selecting multiple LUNs') self.lunsPage.gridLUNs.select() LOG.info('LUNs selected:\n', self.lunsPage.gridLUNs.find(selected=True)) LOG.step("Checking state of menu 'Edit'") self.assertFalse(self.lunsPage.menuEdit.isItemEnabled(item='Mappings')) LOG.info("Menu item 'Edit -> Mappings' is enabled:", self.lunsPage.menuEdit.isItemEnabled(item='Mappings'))
def testSetup(self): self.driver = self.setupDriver() self.loginPage = LoginPage(driver=self.driver, url=self.webUIHostName) self.headerPage = HeaderPage(driver=self.driver) self.allStoragePage = AllStoragePage(driver=self.driver) self.lunsPage = LUNsPage(driver=self.driver) LOG.step('Signing in') self.loginPage.open() self.loginPage.waitUntilOpen() self.loginPage.signIn(username=self.username, password=self.password, locale=self.locale) LOG.info('Signed in with username: %s, password: %s, locale: %s.' % (self.username, self.password, self.locale)) LOG.info('Browser landed on header page.') LOG.step('Navigating to LUNs page') self.headerPage.btnManager.click() self.allStoragePage.tabLUNs.click() self.lunsPage.waitUntilOpen() LOG.info('Browser landed on LUNs page.') LOG.step('Creating LUNs') self.lunNamePrefix = 'LuN' self.lunCount = 20 self.luns.create(count=self.lunCount, size='1g', prefix=self.lunNamePrefix) luns = self.marscluster.lun.show(json=True) LOG.info('LUNs created:\n', [lun['name'] for lun in luns]) self.lunsPage.btnRefresh.click() self.lunsPage.btnRefresh.waitUntilEnabled()
def test_delete_single_lun(self): """ Verify single LUN's deletion. """ LOG.step('Creating LUNs') lunCount = 3 lunSize = 2 lunSizeUnit = 'G' lunNamePrefix = 'LuN' self.luns.create(count=lunCount, size=str(lunSize) + lunSizeUnit, prefix=lunNamePrefix) LOG.info('LUNs created:\n', pprint.pformat(self.marscluster.lun.show(json=True))) # Refresh LUN grid self.lunsPage.btnRefresh.click() self.lunsPage.btnRefresh.waitUntilEnabled() LOG.step("Deleting LUN '%s'" % (lunNamePrefix + '_1')) wizard = DeleteLUNWizard(driver=self.driver) wizard.open(name=lunNamePrefix + '_1') wizard.activePage.confirm() wizard.activePage.submit() LOG.info('LUN deletion submitted.') LOG.step('Verifying LUN has been deleted') luns = self.marscluster.lun.show(json=True) self.assertTrue(len(luns) == lunCount - 1) self.assertTrue((lunNamePrefix + '_1') not in [lun['name'] for lun in luns]) LOG.info('LUNs:\n%s' % pprint.pformat(luns)) LOG.info("LUN '%s' deleted." % (lunNamePrefix + '_1'))
def test_valid_name(self): """ Verify initiator group renaming with new valid name. """ initiatorGroupCount = 3 initiatorGroupPrefix = 'IG' newName = 'IG-New' initiatorGroups = self.createInitiatorGroups( prefix=initiatorGroupPrefix, number=initiatorGroupCount) self.initiatorGroupsPage.btnRefresh.click() self.initiatorGroupsPage.btnRefresh.waitUntilEnabled() LOG.step('Renaming initiator group in dialog') wizard = RenameInitiatorGroupWizard(driver=self.driver) wizard.open(initiator_group=initiatorGroups[0]) LOG.info('Old name:', wizard.activePage.txtName.getText()) wizard.renameInitiatorGroupPage.renameInitiatorGroup(name=newName) LOG.info('New name:', wizard.activePage.txtName.getText()) wizard.renameInitiatorGroupPage.submit() LOG.info('Rename submitted.') LOG.step('Verifying initiator group name has been changed') initiatorGroups = [ group['name'] for group in self.marscluster.igroup.show(json=True) ] self.assertTrue(newName in initiatorGroups) LOG.info("Name '%s' found in initiator groups list:\n%s" % (newName, initiatorGroups))
def test_fail_nonunique_id(self): """ Verify error message when typed ID is used by another LUN mapped to the same initiator group. """ LOG.step('Creating 2 LUNs') self.luns.create(count=2, size='1g', prefix='LuN') LOG.info('LUNs created:\n', self.marscluster.lun.show(json=True)) self.createInitiatorGroups(prefix='IG', number=1) LOG.step('Mapping LUNs to the same initiator group') self.marscluster.lun.map({'name': 'LuN_1', 'igroup': 'IG-0'}) self.marscluster.lun.map({'name': 'LuN_2', 'igroup': 'IG-0'}) mappings = self.marscluster.lun.mapping_show(json=True) LOG.info('LUN mapped:\n', mappings) # Refresh LUN grid self.lunsPage.btnRefresh.click() self.lunsPage.btnRefresh.waitUntilEnabled() LOG.step('Opening wizard') wizard = EditLUNIDsWizard(driver=self.driver) wizard.open(name=mappings[0]['lun-name'].encode('utf-8')) LOG.info('Wizard open for LUN:', mappings[0]['lun-name']) LOG.step('Setting ID same as another LUN') wizard.activePage.setIDs(ids={mappings[1]['lun-id']}) self.assertFalse(wizard.activePage.btnOK.isEnabled()) LOG.info("Button 'OK' is enabled:", wizard.activePage.btnOK.isEnabled())
def testSetup(self): self.driver = self.getDriver() self.loginPage = LoginPage(driver=self.driver, url=self.webUIHostName) self.headerPage = HeaderPage(driver=self.driver) self.allStoragePage = AllStoragePage(driver=self.driver) self.lunsPage = LUNsPage(driver=self.driver) self.marscluster.snapshot.deleteAll() luns = express.Luns(node=self.marscluster, cleanup=True) del luns self.luns = express.Luns(node=self.marscluster) LOG.step('Signing in') self.loginPage.open() if self.locale is None: self.locale = self.loginPage.getRandomLocale() self.loginPage.signIn(username=self.username, password=self.password, locale=self.locale) LOG.info('Signed in with username: %s, password: %s, locale: %s.' % (self.username, self.password, self.locale)) LOG.info('Browser landed on header page.') LOG.info('Navigating to LUNs page...') self.headerPage.btnManager.click() self.allStoragePage.tabLUNs.click() self.lunsPage.waitUntilOpen() LOG.info('Browser landed on LUNs page.')
def test_no_ig(self): """ Verify wizard's grid is empty when no initiators groups exist. """ LOG.step('Creating LUNs') lunCount = 3 lunSize = 2 lunSizeUnit = 'G' lunNamePrefix = 'LuN' self.luns.create(count=lunCount, size=str(lunSize) + lunSizeUnit, prefix=lunNamePrefix) LOG.info('LUNs created:\n', self.marscluster.lun.show(json=True)) # Refresh LUN grid self.lunsPage.btnRefresh.click() self.lunsPage.btnRefresh.waitUntilEnabled() LOG.step('Opening wizard') wizard = EditLUNMappingsWizard(driver=self.driver) wizard.open(name=lunNamePrefix + '_1') LOG.info('Wizard open') LOG.step('Verifying no initiator groups are available') initiatorGroups = wizard.activePage.gridInitiatorGroups.find() self.assertFalse(initiatorGroups) LOG.info('Initiators groups available:', initiatorGroups) LOG.step("Verifying button 'OK' is disabled") self.assertFalse(wizard.activePage.btnOK.isEnabled()) LOG.info("Button 'OK' enabled:", wizard.activePage.btnOK.isEnabled())
def test_multi_lun_auto_start_low(self): """ Test verifies creation of multiple LUNs with values of 'Start At' shorter than suffix (ex. 2 digits in 'start at' = 55 is shorter than 4 pounds in suffix '####') are justified to number of pounds (i.e. prefix 'LuN_' and 'start at' 55' gets translated to 'LuN_0055'). """ numberOfLUNs = 10 lunNamePrefix = 'LuN_' lunSize = '1G' startAt = 99 for suffixIndex in range(4): suffix = '#' * (suffixIndex + 1) LOG.step("Creating LUNs with suffix '%s' and starting at %s" % (suffix, str(startAt))) LOG.step('Creating wizard') wizard = CreateLUNsWizard(driver=self.driver, locale=self.locale) wizard.open() LOG.info('Wizard created.') LOG.step('Defining multiple LUNs') wizard.activePage.defineMultipleLUNsAuto(number=numberOfLUNs, size=lunSize, prefix=lunNamePrefix, suffix=(suffix + ' '), startAt=startAt) LOG.info( "LUN properties defined: number: %s; size: %s, prefix: '%s'; suffix: '%s'; start at: %s" % (numberOfLUNs, lunSize, lunNamePrefix, (suffix + ' '), startAt)) wizard.goNext() wizard.goNext() wizard.goNext() wizard.closePage.close() LOG.info('Wizard closed.') LOG.step('Verifying LUN names') lunNames = [ lun['name'] for lun in self.marscluster.lun.show(json=True) ] for lunIndex in range(startAt, (startAt + numberOfLUNs)): lunName = lunNamePrefix + str(lunIndex).rjust( suffixIndex + 1, '0') self.assertTrue(lunName in lunNames) LOG.info('LUN found:', lunName) LOG.step('Destroying LUNs') self.marscluster.lun.destroyAll() self.assertFalse(self.marscluster.lun.show(json=True)) LOG.info('All LUNs destroyed.')
def test_dialog_cancel(self): """ Verify canceling dialog without submission leaves LUNs and snapshots intact. """ LOG.step('Creating LUNs') lunCount = 3 lunSize = 1 lunSizeUnit = 'G' lunNamePrefix = 'LuN' self.luns.create(count=lunCount, size=str(lunSize) + lunSizeUnit, prefix=lunNamePrefix) LOG.info('LUNs created:\n', self.marscluster.lun.show(json=True)) # Refresh LUN grid self.lunsPage.btnRefresh.click() self.lunsPage.btnRefresh.waitUntilEnabled() LOG.step('Opening dialog') wizard = CreateLUNSnapshotWizard(driver=self.driver) wizard.open(name=lunNamePrefix + '_1') LOG.info('Dialog is open.') LOG.step('Canceling dialog without submission') wizard.cancel() LOG.info('Dialog closed.') LOG.step('Verifying no snapshots have been created') snapshots = self.marscluster.snapshot.show(json=True) self.assertFalse(snapshots) LOG.info('Created snapshots:', snapshots)
def test_offline_cancel(self): """ Verify 'Take Offline -> Cancel' does cancel dialog gracefully, state not affected. """ LOG.step('Creating LUNs') lunCount = 3 lunSize = 2 lunSizeUnit = 'G' lunNamePrefix = 'LuN' self.luns.create(count=lunCount, size=str(lunSize) + lunSizeUnit, prefix=lunNamePrefix) LOG.info('LUNs created:\n', self.marscluster.lun.show(json=True)) # Refresh LUN grid self.lunsPage.btnRefresh.click() self.lunsPage.btnRefresh.waitUntilEnabled() LOG.step('Taking LUN offline') wizard = EditLUNStateWizard(driver=self.driver) wizard.openTakeOffline(name=lunNamePrefix + '_1') LOG.info("'Take Offline' page is open.") LOG.step('Canceling dialog') wizard.cancel() LOG.info('Dialog cancelled.') LOG.step('Verifying LUN state has not been changed') lunState = { lun['name']: lun['lun-state'] for lun in self.node.lun.show(json=True) }[lunNamePrefix + '_1'] self.assertTrue(lunState == 'online') LOG.info('LUN state:', lunState)
def test_fail_invalid_id(self): """ Verify typing invalid ID filters out non-numeric characters. """ validIDPart = '700' invalidIDPart = 'W-' LOG.step('Creating LUN') self.luns.create(count=1, size='1g', prefix='LuN') LOG.info('LUN created:\n', self.marscluster.lun.show(json=True)) self.createInitiatorGroups(prefix='IG', number=1) LOG.step('Mapping LUN to initiator group') self.marscluster.lun.map({'name': 'LuN_1', 'igroup': 'IG-0'}) LOG.info('LUN mapped:\n', self.marscluster.lun.mapping_show(json=True)) # Refresh LUN grid self.lunsPage.btnRefresh.click() self.lunsPage.btnRefresh.waitUntilEnabled() LOG.step('Opening wizard') wizard = EditLUNIDsWizard(driver=self.driver) wizard.open(name='LuN_1') LOG.info('Wizard open.') LOG.step('Typing in invalid ID: %s' % validIDPart + invalidIDPart) wizard.activePage.setIDs(ids={'IG-0': validIDPart + invalidIDPart}) typedText = wizard.activePage.getIDs()['IG-0'] self.assertTrue(typedText == validIDPart) LOG.info('Typed value:', typedText)
def test_invalid_name(self): """ Verify error message when invalid name typed in. """ initiatorGroupCount = 3 initiatorGroupPrefix = 'IG' newName = 'IG*&#@1A_^?,' initiatorGroups = self.createInitiatorGroups( prefix=initiatorGroupPrefix, number=initiatorGroupCount) self.initiatorGroupsPage.btnRefresh.click() self.initiatorGroupsPage.btnRefresh.waitUntilEnabled() LOG.step("Changing initiator group name with: %s" % newName) wizard = RenameInitiatorGroupWizard(driver=self.driver) wizard.open(initiator_group=initiatorGroups[0]) LOG.info('Old name:', wizard.activePage.txtName.getText()) wizard.renameInitiatorGroupPage.renameInitiatorGroup(name=newName) LOG.info('New name:', wizard.activePage.txtName.getText()) LOG.step('Verifying name error message') wizard.activePage.lblNameError.waitUntilPresent() LOG.info('Name error message:', wizard.activePage.lblNameError.getText()) self.assertFalse(wizard.activePage.btnOK.isEnabled()) LOG.info("Button 'OK' is enabled:", wizard.activePage.btnOK.isEnabled())
def test_unicode_name(self): """ Verify error message on setting LUN name containing Unicode characters. """ LOG.step('Creating LUNs') lunCount = 3 lunSize = '1g' lunNamePrefix = 'LuN' lunNewName = u'Fran\u00e7ais' self.luns.create(count=lunCount, size=lunSize, prefix=lunNamePrefix) LOG.info('LUNs created:\n', self.node.lun.show(json=True)) self.lunsPage.btnRefresh.click() self.lunsPage.btnRefresh.waitUntilEnabled() LOG.step('Renaming LUN in dialog') wizard = RenameLUNWizard(driver=self.driver) wizard.open(name=lunNamePrefix + '_1') LOG.info('Old LUN name:', lunNamePrefix + '_1') wizard.renameLUNPage.renameLUN(name=lunNewName) LOG.info('New LUN name:', lunNewName) LOG.step('Verifying LUN invalid name error message') wizard.activePage.lblNameError.waitUntilVisible() LOG.info('Error message:', wizard.activePage.lblNameError.getText())
def test_dialog_cancel(self): """ Verify closing dialog without submission has no effect. """ consistencyGroupName = 'cg1' LOG.step('Opening dialog') wizard = CreateConsistencyGroupWizard(driver=self.driver) wizard.open() LOG.info('Wizard open.') LOG.step('Setting name for new consistency group') wizard.activePage.setName(name=consistencyGroupName) self.assertTrue( wizard.activePage.txtName.getText() == consistencyGroupName) LOG.info('Consistency group name set:', wizard.activePage.txtName.getText()) LOG.step('Canceling dialog without submission') wizard.cancel() LOG.info('Dialog cancelled.') LOG.step('Verifying no consistency group has been created') consistencyGroups = self.marscluster.cg.show(json=True) self.assertFalse(consistencyGroups) LOG.info('Consistency groups:', consistencyGroups)
def test_unicode_name(self): """ Verify error message on setting initiator group name to contain Unicode characters. """ initiatorGroupCount = 3 initiatorGroupPrefix = 'IG' newName = u'Fran\u00e7ais' initiatorGroups = self.createInitiatorGroups( prefix=initiatorGroupPrefix, number=initiatorGroupCount) self.initiatorGroupsPage.btnRefresh.click() self.initiatorGroupsPage.btnRefresh.waitUntilEnabled() LOG.step("Changing initiator group name with: %s" % newName) wizard = RenameInitiatorGroupWizard(driver=self.driver) wizard.open(initiator_group=initiatorGroups[0]) LOG.info('Old name:', wizard.activePage.txtName.getText()) wizard.renameInitiatorGroupPage.renameInitiatorGroup(name=newName) LOG.info('New name:', wizard.activePage.txtName.getText()) LOG.step('Verifying name error message') wizard.activePage.lblNameError.waitUntilPresent() LOG.info('Name error message:', wizard.activePage.lblNameError.getText()) self.assertFalse(wizard.activePage.btnOK.isEnabled()) LOG.info("Button 'OK' is enabled:", wizard.activePage.btnOK.isEnabled())