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 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_create_custom_os_type(self): """ Verify initiator group creation when name and OS type specified explicitly. """ initiatorGroupName = 'IG-1' osType = 'Xen' LOG.step('Opening wizard') wizard = CreateInitiatorGroupWizard(driver=self.driver) wizard.open() LOG.info('Wizard open.') LOG.step('Setting initiator group name') wizard.activePage.setName(name=initiatorGroupName) name = wizard.activePage.txtName.getText() self.assertTrue(name == initiatorGroupName) LOG.info('Initiator group name set:', name) LOG.step('Setting OS type: %s' % osType) wizard.activePage.setOSType(osType=osType) setOSType = wizard.activePage.dLstOSType.getText() self.assertTrue(setOSType == osType) LOG.info('OS type set:', setOSType) LOG.step('Submitting dialog') wizard.activePage.submit() LOG.info('Dialog submitted.') LOG.step('Verifying initiator group has been created') initiatorGroups = self.marscluster.igroup.show(json=True) self.assertTrue(len(initiatorGroups) == 1) self.assertTrue(initiatorGroups[0]['name'] == initiatorGroupName) LOG.info("Initiator group's name:", initiatorGroups[0]['name']) self.assertTrue(initiatorGroups[0]['ostype'] == osType.lower()) LOG.info("Initiator group's OS type:", initiatorGroups[0]['ostype'])
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 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_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 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 test_single_lun_map_exist_new_parent_cg(self): """ Test verifies creation of single LUN mapped to existing parent and new consistency groups. """ lunName = 'LuN' lunSize = '1g' parentConsistencyGroupName = 'Parent-CG' newConsistencyGroupName = 'New-CG' initiatorGroupPrefix = 'IG' initiatorGroupNumber = 3 initiatorGroups = self._createInitiatorGroups( prefix=initiatorGroupPrefix, number=initiatorGroupNumber) LOG.step('Creating consistency group') self.marscluster.cg.create(name=parentConsistencyGroupName) consistencyGroups = self.marscluster.cg.show(json=True) self.assertTrue(len(consistencyGroups) == 1) self.assertTrue( consistencyGroups[0]['name'] == parentConsistencyGroupName) LOG.info('Consistency group created:', parentConsistencyGroupName) LOG.step('Creating wizard') wizard = CreateLUNsIGPageWizard(driver=self.driver, locale=self.locale) wizard.open(initiator_group=initiatorGroups[0]) LOG.info('Wizard created.') LOG.step('Defining single LUN') wizard.activePage.defineSingleLUN(name=lunName, size=lunSize) LOG.info('LUN name:', lunName) LOG.info('LUN size:', lunSize) wizard.activePage.addToConsistencyGroup( parentConsistencyGroup=parentConsistencyGroupName, newConsistencyGroup=newConsistencyGroupName) LOG.info("LUN's consistency group:", parentConsistencyGroupName) wizard.activePage.submit() LOG.info('Wizard submitted.') LOG.step('Verifying mapped LUN has been created') luns = self.marscluster.lun.show(json=True) self.assertTrue(len(luns) == 1) self.assertTrue(luns[0]['name'] == (parentConsistencyGroupName + '/' + newConsistencyGroupName + '/' + lunName)) self.assertTrue(luns[0]['cg'] == (parentConsistencyGroupName + '/' + newConsistencyGroupName)) LOG.info("LUN created: 'name': '%s'; 'cg': '%s'" % (luns[0]['name'], luns[0]['cg'])) mappingFound = False for consistencyGroup in self.marscluster.cg.show(json=True): if consistencyGroup['name'] == luns[0]['cg']: mappingFound = True self.assertTrue(mappingFound) LOG.info('Mapped consistency group found.') LOG.step('Verifying LUN has specified mapping') self.assertTrue(len(luns[0]['maps']) == 1) self.assertTrue( luns[0]['maps'][0]['igroup-name'] == initiatorGroups[0]) LOG.info('LUN mapping:', luns[0]['maps'])
def testSetup(self): self.driver = self.getDriver() self.loginPage = LoginPage(driver=self.driver, url=self.webUIHostName) self.initiatorGroupsPage = InitiatorGroupsPage(driver=self.driver) LOG.info('Destroying existing LUNs...') self.marscluster.lun.unmapAll() self.marscluster.lun.destroyAll() self.assertFalse(self.marscluster.lun.show(json=True)) LOG.info('Done.') LOG.info('Destroying existing initiator groups...') self.marscluster.igroup.destroyAll() LOG.info('Done.') self.luns = express.Luns(node=self.marscluster) LOG.step('Signing in') self.loginPage.open() self.loginPage.waitUntilOpen() 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.')
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_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_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())
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_create_minimal(self): """ Verify new consistency group creation when only name specified. """ consistencyGroupName = 'cg1' LOG.step('Opening wizard') wizard = CreateConsistencyGroupWizard(driver=self.driver) wizard.open() LOG.info('Wizard open.') LOG.step('Verifying default parameters') self.assertFalse(wizard.activePage.txtName.getText()) LOG.info("Default name: %s" % wizard.activePage.txtName.getText()) candidates = wizard.activePage.gridCandidates.find() self.assertFalse(candidates) LOG.info('Candidates:', candidates) LOG.step('Setting consistency group name') wizard.activePage.setName(name=consistencyGroupName) name = wizard.activePage.txtName.getText() self.assertTrue(name == consistencyGroupName) LOG.info('Consistency group name set:', name) LOG.step('Submitting dialog') wizard.submit() LOG.info('Dialog submitted.') LOG.step('Verifying consistency group has been created') consistencyGroups = self.marscluster.cg.show(json=True) self.assertTrue(len(consistencyGroups) == 1) self.assertTrue(consistencyGroups[0]['name'] == consistencyGroupName) self.assertFalse(consistencyGroups[0]['members']) LOG.info('Consistency group created:', consistencyGroups[0]['name'])
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 suiteTeardown(self): LOG.step('Closing browser') self.driver.quit() luns = express.Luns(node=self.marscluster, cleanup=True) del luns consistencyGroups = self.marscluster.cg.show(json=True) for consistencyGroup in consistencyGroups: self.marscluster.cg.delete(name=consistencyGroup['name']) self.assertFalse(self.marscluster.cg.show(json=True))
def test_multiple_mappings(self): """ Verify setting IDs for LUN with multiple initiator group mappings. """ initiatorGroupsNumber = 5 maxID = 4095 LOG.step('Creating LUN') self.luns.create(count=1, size='1g', prefix='LuN') LOG.info('LUN created:\n', self.marscluster.lun.show(json=True)) # List of initiator group names with default IDs ids = { groupName: 0 for groupName in self.createInitiatorGroups( prefix='IG', number=initiatorGroupsNumber) } LOG.step('Mapping LUN to initiator groups') for groupName in ids: self.marscluster.lun.map({'name': 'LuN_1', 'igroup': groupName}) 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('Setting random IDs') uniqueIDs = [] for groupName in ids: # To avoid duplicated IDs. while True: id = random.randint(0, maxID) if id not in uniqueIDs: uniqueIDs.append(id) ids[groupName] = id LOG.info("Initiator group '%s': ID set to %s" % (groupName, id)) break wizard.activePage.setIDs(ids=ids) wizard.activePage.submit() LOG.info('Dialog submitted.') LOG.step('Verifying LUN mapping IDs') mappings = self.marscluster.lun.show(json=True)[0]['maps'] self.assertTrue(len(mappings) == len(ids)) for mapping in mappings: self.assertTrue(mapping['lun-name'] == 'LuN_1') self.assertTrue(mapping['lun-id'] == ids[mapping['igroup-name']]) LOG.info("Initiator group '%s': ID=%s" % (mapping['igroup-name'], ids[mapping['igroup-name']]))
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): LOG.step('Loading existing LUNs') self.luns = express.Luns(node=self.node, cleanup=True) self.igroups = express.Igroups(node=self.node, cleanup=self.cleanupMars) self.igroups.create(count=1, ostype='vmware', initiators=self.fcInitiators, prefix='ig_esx')
def test_invalid_inputs(self): """ Verify wizard cannot proceed (button 'OK' is disabled) when inputs are not fully populated. """ lunName = 'LuN' lunSize = '10' 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('Verifying proceed is disabled') self.assertFalse(wizard.activePage.txtName.getText()) LOG.info("Name: '%s'" % wizard.activePage.txtName.getText()) self.assertFalse(wizard.activePage.txtSize.getText()) LOG.info("Size: '%s'" % wizard.activePage.txtSize.getText()) wizard.activePage.btnOK.waitUntilDisabled() LOG.info("Button 'OK' is enabled:", wizard.activePage.btnOK.isEnabled()) LOG.step('Setting only LUN name') wizard.activePage.txtName.setText(text=lunName) self.assertTrue(wizard.activePage.txtName.getText() == lunName) LOG.info('LUN name:', wizard.activePage.txtName.getText()) LOG.info('LUN size:', wizard.activePage.txtSize.getText()) wizard.activePage.btnOK.waitUntilDisabled() LOG.info("Button 'OK' is enabled:", wizard.activePage.btnOK.isEnabled()) LOG.step('Setting only LUN size') wizard.activePage.txtName.clear() wizard.activePage.txtSize.setText(text=lunSize) self.assertTrue(wizard.activePage.txtSize.getText() == lunSize) LOG.info('LUN name:', wizard.activePage.txtName.getText()) LOG.info('LUN size:', wizard.activePage.txtSize.getText()) wizard.activePage.btnOK.waitUntilDisabled() LOG.info("Button 'OK' is enabled:", wizard.activePage.btnOK.isEnabled()) LOG.step('Setting LUN name & size') wizard.activePage.txtName.setText(text=lunName) LOG.info('LUN name:', wizard.activePage.txtName.getText()) LOG.info('LUN size:', wizard.activePage.txtSize.getText()) wizard.activePage.btnOK.waitUntilEnabled() LOG.info("Button 'OK' is enabled:", wizard.activePage.btnOK.isEnabled())
def test_clone_sequent(self): """ Verify auto-naming of clone when previous auto-named clone already exists. """ LOG.step('Creating LUNs') lunCount = 3 lunSize = 1 lunSizeUnit = 'G' lunNamePrefix = 'LuN' initiatorGroupName = 'IG-' initiatorGroupsNumber = 5 parentConsistencyGroupName = 'Parent-CG' self.luns.create(count=lunCount, size=str(lunSize) + lunSizeUnit, prefix=lunNamePrefix) originalLUNs = self.marscluster.lun.show(json=True) LOG.info('LUNs created:\n', originalLUNs) # Refresh LUN grid self.lunsPage.btnRefresh.click() self.lunsPage.btnRefresh.waitUntilEnabled() LOG.step('Opening wizard') wizard = CloneLUNWizard(driver=self.driver) wizard.open(name=lunNamePrefix + '_1') LOG.info('Wizard open.') LOG.step('Cloning LUN') wizard.activePage.submit() luns = self.marscluster.lun.show(json=True) self.assertTrue(len(luns) == len(originalLUNs) + 1) clonedLUN = [lun for lun in luns if lun['name'] == lunNamePrefix + '_1_clone_0'][0] self.assertTrue(clonedLUN['size'] == lun['size']) LOG.info("Cloned LUN's size equal to original:", clonedLUN['size']) self.assertTrue(clonedLUN['parent'] == lunNamePrefix + '_1') LOG.info("Cloned LUN's parent is original LUN:", clonedLUN['parent']) self.lunsPage.btnRefresh.click() self.lunsPage.btnRefresh.waitUntilEnabled() LOG.step('Opening wizard') wizard = CloneLUNWizard(driver=self.driver) wizard.open(name=lunNamePrefix + '_1') LOG.info('Wizard open.') LOG.step('Sequent cloning of LUN') wizard.activePage.submit() luns = self.marscluster.lun.show(json=True) self.assertTrue(len(luns) == len(originalLUNs) + 2) clonedLUN = [lun for lun in luns if lun['name'] == lunNamePrefix + '_1_clone_1'][0] self.assertTrue(clonedLUN['size'] == lun['size']) LOG.info("Cloned LUN's size equal to original:", clonedLUN['size']) self.assertTrue(clonedLUN['parent'] == lunNamePrefix + '_1') LOG.info("Cloned LUN's parent is original LUN:", clonedLUN['parent'])
def test_clone_no_ig_cg(self): """ Verify LUN snapshot cloning when no initiator/consistency groups exist. """ lunNamePrefix = 'LuN' lunName = lunNamePrefix + '_1' snapshotName = lunName + '_snap' cloneName = lunName + '_clone_0' LOG.step('Creating LUN') self.luns.create(count=1, size='1g', prefix=lunNamePrefix) luns = self.marscluster.lun.show(json=True) LOG.info('LUNs created:\n', luns) LOG.step('Creating LUN snapshot') self.marscluster.snapshot.create(luns=lunName, name=snapshotName) snapshots = self.marscluster.snapshot.show(json=True) LOG.info('Snapshot created:\n', snapshots) self.lunsPage.btnRefresh.click() self.lunsPage.btnRefresh.waitUntilEnabled() self._navigateToLUNSnapshotsPage(lunName=lunName) LOG.step('Opening wizard') wizard = CloneLUNSnapshotWizard(driver=self.driver) wizard.open(lunName=lunName, lunSnapshotName=snapshotName) LOG.info('Wizard open.') LOG.step('Verifying default details of LUN snapshot clone') self.assertTrue( wizard.activePage.lblSubtitle.getText() == snapshotName) LOG.info('LUN snapshot name:', wizard.activePage.lblSubtitle.getText()) self.assertTrue(wizard.activePage.txtName.getText() == cloneName) LOG.info('LUN snapshot clone name:', wizard.activePage.txtName.getText()) self.assertFalse( wizard.activePage.cBoxParentConsistencyGroup.isEnabled()) LOG.info('Parent consistency group is enabled:', wizard.activePage.cBoxParentConsistencyGroup.isEnabled()) wizard.activePage.dLstMappedTo.expand() wizard.selectInitiatorGroupsPage.waitUntilOpen() initiatorGroups = wizard.selectInitiatorGroupsPage.gridInitiatorGroups.find( ) self.assertFalse(initiatorGroups) LOG.info('Initiator groups available:', initiatorGroups) wizard.activePage.dLstMappedTo.collapse() LOG.step('Cloning LUN snapshot') wizard.activePage.submit() self._verifyClone(snapshotName=snapshotName, cloneName=cloneName)
def test_change_os_type(self): """ Verify changing of OS type for initiator group. """ initiatorGroupCount = 3 initiatorGroupPrefix = 'IG' osTypes = ['Windows', 'Linux', 'VMware', 'Xen'] initiatorGroups = self._createInitiatorGroups(prefix=initiatorGroupPrefix, number=initiatorGroupCount) initiatorGroupName = initiatorGroups[0] LOG.step('Changing OS type of initiator group in dialog') wizard = ChangeInitiatorGroupOSTypeWizard(driver=self.driver) for osType in osTypes: LOG.step('Opening dialog') wizard.open(initiator_groups=initiatorGroupName) LOG.info('Dialog open for initiator group:', initiatorGroupName) LOG.step('Setting OS type: %s' % osType) wizard.activePage.setOSType(osType=osType) wizard.submit() LOG.info('OS type set and dialog submitted') LOG.step('Verifying OS type has been changed') initiatorGroup = [initiatorGroup for initiatorGroup in self.marscluster.igroup.show(json=True) if initiatorGroup['name'] == initiatorGroupName][0] self.assertTrue(initiatorGroup['ostype'] == osType.lower()) LOG.info('OS type has been changed to:', initiatorGroup['ostype'])
def test_dialog_cancel(self): """ Verify LUN name remains intact on dialog cancel. """ 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('Assigning new LUN name 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('Canceling dialog without submission') wizard.cancel() LOG.info('Dialog cancelled.') LOG.step('Verifying LUN name has not been changed') luns = self.lunsPage.gridLUNs.find(name=lunNamePrefix + '_1') self.assertTrue(len(luns) == 1) self.assertTrue(luns[0]['name'] == lunNamePrefix + '_1') LOG.info('LUNs with old name:\n', luns) luns = self.lunsPage.gridLUNs.find(name=lunNewName) self.assertTrue(len(luns) == 0) LOG.info('LUNs with new name:\n', luns)
def test_create_sequent(self): """ Verify default name has increased number when snapshot with default name exists. """ 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('Creating snapshot with default name') self.assertTrue(wizard.activePage.txtName.getText() == lunNamePrefix + '_1_snap_0') LOG.info('Default snapshot name set:', wizard.activePage.txtName.getText()) wizard.activePage.submit() LOG.info('Dialog submitted.') LOG.step('Subsequent creation of snapshot with default name') wizard.open(name=lunNamePrefix + '_1') self.assertTrue(wizard.activePage.txtName.getText() == lunNamePrefix + '_1_snap_1') LOG.info('Default snapshot name set:', wizard.activePage.txtName.getText()) wizard.activePage.submit() LOG.info('Dialog submitted.') LOG.step("Verifying snapshots' names") snapshotNames = [ snapshot['name'] for snapshot in self.marscluster.snapshot.show(json=True) ] self.assertTrue(len(snapshotNames) == 2) self.assertTrue((lunNamePrefix + '_1_snap_0') in snapshotNames) LOG.info('Snapshot found:', lunNamePrefix + '_1_snap_0') self.assertTrue((lunNamePrefix + '_1_snap_1') in snapshotNames) LOG.info('Snapshot found:', lunNamePrefix + '_1_snap_1')
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_valid_name(self): """ Verify LUN snapshot renaming with valid name. """ lunNamePrefix = 'LuN' lunName = lunNamePrefix + '_1' snapshotName = lunName + '_snap_0' snapshotNewName = snapshotName + '.m' LOG.step('Creating LUN') self.luns.create(count=1, size='1g', prefix=lunNamePrefix) LOG.info('LUN created:\n', self.marscluster.lun.show(json=True)) LOG.step('Creating LUN snapshot') self.marscluster.snapshot.create(luns=lunName, name=snapshotName) snapshots = self.marscluster.snapshot.show(json=True) snapshot = [ snapshot for snapshot in snapshots if (snapshot['name'] == snapshotName and snapshot['object'] == lunName) ][0] snapshotUUID = snapshot['uuid'] LOG.info('Snapshot created:\n', snapshot) LOG.step("LUN '%s': Opening Snapshots page" % lunName) lunSnapshotsPage = LUNSnapshotsPage( driver=self.driver, url=self.webUIHostName + ('/#manager/storage/allstorage/luns/%s/snapshot' % lunName)) lunSnapshotsPage.open() lunSnapshotsPage.waitUntilOpen() LOG.info('LUN Snapshots page is open.') LOG.step('Renaming LUN snapshot in dialog') wizard = RenameLUNSnapshotWizard(driver=self.driver) wizard.open(name=snapshotName) LOG.info('Old snapshot name:', snapshotName) wizard.renameLUNSnapshotPage.renameLUNSnapshot(name=snapshotNewName) LOG.info('New snapshot name:', snapshotNewName) wizard.renameLUNSnapshotPage.submit() LOG.info('Rename submitted.') LOG.step('Verifying LUN snapshot name has been changed') snapshots = self.marscluster.snapshot.show(json=True) snapshot = [ snapshot for snapshot in snapshots if snapshot['uuid'] == snapshotUUID ][0] self.assertTrue(snapshot['name'] == snapshotNewName) LOG.info('LUN snapshot has been renamed:\n', snapshot)
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)