Exemple #1
0
def create_backuppolicy_oss(driver):
    rw = random.randint(1, 30)
    a = driver.find_elements_by_xpath(
        '//*[@id="initialBackupPolicy"]/div/button/div/span')
    if len(a) == 0:
        driver.find_element_by_xpath(
            '//*[@id="createBackupPolicy"]/div[1]/span').click()
    else:
        a[0].click()
    cm.by_id_input("backupPolicyName", "%s" % backup_policy_name, driver)
    ###choose the oss as the destination##
    cm.by_id_select(
        "ojChoiceId_backupDestinationId_selected",
        '//*[@id="oj-listbox-results-backupDestinationId"]/li[2]/div', driver)
    cm.by_id_input("containerName", "chqin", driver)
    cm.by_id_input("recoveryWindow", '%s' % rw, driver)
    cm.option_random_choice(
        'ojChoiceId_objectStoreSelectionName_selected',
        '//*[@id="oj-listbox-results-objectStoreSelectionName"]/li/div',
        driver)
    driver.find_element_by_xpath(
        '//*[@id="okCreateBackupPolicy"]/div/span').click()
    ui.WebDriverWait(driver,
                     30).until(ec.element_to_be_clickable(
                         (By.ID, "yesButton")))
    time.sleep(3)
    driver.find_element_by_id("yesButton").click()
    time.sleep(2)
    status = submit_job_status(driver, "createBackupPolicySubmitDialog")
    return status
Exemple #2
0
def main():
    if node in [
            "rwsoda6s005", "scaoda7m005", "scaoda710c1n", "rwsoda6f004",
            "rwsoda6m005", "scaoda7s005", "scaoda704c1n", "10.31.129.245"
    ]:
        ll.login(node)
        ui.WebDriverWait(driver, 30).until(
            ec.element_to_be_clickable(
                (By.CSS_SELECTOR, "ul>li:nth-child(5)>a[role='button']>span")))
        driver.find_element_by_css_selector(
            "ul>li:nth-child(5)>a[role='button']>span").click()
        time.sleep(2)
        driver.find_element_by_css_selector(
            "ul>li:nth-child(3)>a[role='button']>span").click()
        time.sleep(10)
        driver.find_element_by_xpath('// *[ @ id = "dbhome"]/a/span').click()
        time.sleep(5)
        driver.find_element_by_xpath('//*[@id="database"]/a/span').click()
        dbs = driver.find_elements_by_xpath(
            '// *[ @ id = "listview"]/li/div/div/div/div/*[text() = "%s"]' %
            dbname)
        if len(dbs) == 0:
            print "There is no databases named %s!" % dbname
        else:
            dbs[0].click()
        ui.WebDriverWait(driver, 30).until(
            ec.element_to_be_clickable((By.ID, "applyBackupPolicy")))
        driver.find_element_by_xpath(
            '//*[@id="applyBackupPolicy"]/div/span').click()
        ui.WebDriverWait(driver, 30).until(
            ec.element_to_be_clickable(
                (By.ID, "ojChoiceId_backupPolicyNameId_selected")))
        cm.option_random_choice(
            "ojChoiceId_backupPolicyNameId_selected",
            '//*[@id="oj-listbox-results-backupPolicyNameId"]/li/div')
        cm.by_id_input("password", "%s" % backup_password)
        cm.by_id_input("cpassword", "%s" % backup_password)
        driver.find_element_by_xpath(
            '//*[@id="okApplyBackupPolicy"]/div/span').click()
        ui.WebDriverWait(driver, 30).until(
            ec.element_to_be_clickable(
                (By.ID, "applyBackupPolicySubmitDialog")))
        time.sleep(1)
        driver.find_element_by_xpath(
            '//*[@id="applyBackupPolicySubmitDialog"]/div/div/div/div[3]/a'
        ).click()
Exemple #3
0
def find_db_to_apply_backup_policy(driver):
    # a = driver.find_elements_by_xpath('//*[@id="listview"]/li/div/div/div/div/a')
    go_db_page_with_name(driver)
    ui.WebDriverWait(driver, 30).until(
        ec.element_to_be_clickable((By.ID, "applyBackupPolicy")))
    driver.find_element_by_xpath(
        '//*[@id="applyBackupPolicy"]/div/span').click()
    ui.WebDriverWait(driver, 30).until(
        ec.element_to_be_clickable(
            (By.ID, "oj-select-choice-backupPolicyNameId")))
    cm.option_random_choice(
        "oj-select-choice-backupPolicyNameId",
        '//*[@id="oj-listbox-results-backupPolicyNameId"]/li/div', driver)
    cm.by_id_input("password", '%s' % backuprmanpassword, driver)
    cm.by_id_input("cpassword", '%s' % backuprmanpassword, driver)
    driver.find_element_by_xpath(
        '//*[@id="okApplyBackupPolicy"]/div/span').click()
    status = submit_job_status(driver, "applyBackupPolicySubmitDialog")
    return status
Exemple #4
0
def main():
    if node in [
            "rwsoda6s005", "scaoda7m005", "scaoda710c1n", "rwsoda6f004",
            "rwsoda6m005", "scaoda7s005", "scaoda704c1n", "10.31.129.245"
    ]:
        ll.login(node)
        ui.WebDriverWait(driver, 30).until(
            ec.element_to_be_clickable(
                (By.CSS_SELECTOR, "ul>li:nth-child(5)>a[role='button']>span")))
        driver.find_element_by_css_selector(
            "ul>li:nth-child(3)>a[role='button']>span").click()
        time.sleep(2)
        driver.find_element_by_xpath('//*[@id="database"]/a/span').click()
        time.sleep(2)
        driver.find_element_by_xpath('// *[ @ id = "dbhome"]/a/span').click()
        time.sleep(2)
        driver.find_element_by_xpath('//*[@id="backupPolicy"]/a/span').click()
        a = driver.find_elements_by_xpath(
            '//*[@id="initialBackupPolicy"]/div/button/div/span')

        if (len(a) == 0):
            driver.find_element_by_xpath(
                '//*[@id="createBackupPolicy"]/div[1]/span').click()
        else:
            a[0].click()
        cm.by_id_input("backupPolicyName", "%s" % backup_policy_name)
        cm.by_id_select(
            "ojChoiceId_backupDestinationId_selected",
            '//*[@id="oj-listbox-results-backupDestinationId"]/li[2]/div')
        cm.by_id_input("containerName", "chqin")
        cm.option_random_choice(
            'ojChoiceId_objectStoreSelectionName_selected',
            '//*[@id="oj-listbox-results-objectStoreSelectionName"]/li/div')
        driver.find_element_by_xpath(
            '//*[@id="okCreateBackupPolicy"]/div/span').click()
        ui.WebDriverWait(driver, 30).until(
            ec.element_to_be_clickable((By.ID, "yesButton")))
        time.sleep(3)
        driver.find_element_by_id("yesButton").click()
        time.sleep(2)
        driver.find_element_by_xpath(
            '//*[@id="createBackupPolicySubmitDialog"]/div[2]/div/div/div[3]/a'
        ).click()
def input_system_network(node):
    if node in [
            "rwsoda6s005", "scaoda7m005", "rwsoda6f004", "rwsoda6m005",
            "scaoda7s005"
    ]:
        cm.by_id_input("hostnodeName", "%s" % node)
    if node in ["scaoda710c1n", "scaoda704c1n"]:
        cm.by_id_input("systemName", "%s" % node)
    if node in ["10.31.129.245"]:
        cm.by_id_input("hostnodeName", "scaoda7s005")
    if node in ["10.31.130.36"]:
        cm.by_id_input("systemName", "scaoda704c1n1")
    for key, value in system_text_box.items():
        cm.by_id_input(key, value)
    cm.option_random_choice("ojChoiceId_region_selected",
                            '//*[@id="oj-listbox-results-region"]/li/div')
    cm.option_random_choice("ojChoiceId_timezone_selected",
                            '//*[@id="oj-listbox-results-timezone"]/li/div')
    if cm.is_element_exist_by_id("ojChoiceId_dgRedundancy_selected"):
        cm.option_random_choice(
            "ojChoiceId_dgRedundancy_selected",
            '//*[@id="oj-listbox-results-dgRedundancy"]/li/div')
    if node not in ["10.31.130.36", "10.31.129.245"]:
        for key, value in system_text_boxes.items():
            cm.by_xpath_input(key, value)

    if node == "rwsoda6m005":
        for key, value in ilom_network_info.items():
            cm.by_id_input(key, value)
        cm.by_id_select(
            "oj-select-choice-ilomSubnet",
            "//*[text() = '%s']" % oj_select_choice_ilomSubnet_6m005)
    if node == "scaoda704c1n":
        for key, value in scaoda704_public_network_info.items():
            cm.by_id_input(key, value)
        cm.by_xpath_select('//*[@id="ilomSubnetDiv_0"]/div[2]/div[1]',
                           '//*[text() = "%s"]' % ilom_submet_scaoda704)
    if node == "10.31.130.36":
        for key, value in scaoda704_vlan_public_network_info.items():
            cm.by_id_input(key, value)
        cm.by_xpath_select('//*[@id="ilomSubnetDiv_0"]/div[2]/div[1]',
                           '//*[text() = "%s"]' % ilom_submet_scaoda704)

    if node == "rwsoda6s005":
        cm.by_id_input("ipPublic", "%s" % ipPublic_6s005)
        for key, value in network_dropdown_6s005.items():
            cm.by_id_select(key, value)
    elif node == "scaoda7m005":
        cm.by_id_input("ipPublic", "%s" % ipPublic_7m005)
        cm.by_id_select(
            "ojChoiceId_subnetPublic_selected",
            "//*[text() = '%s']" % ojChoiceId_subnetPublic_selected_7m005)
    elif node == "scaoda710c1n":
        for key, value in network_text_box_710.items():
            cm.by_id_input(key, value)
        cm.by_id_select(
            "ojChoiceId_subnetPublic_selected",
            "//*[text() = '%s']" % ojChoiceId_subnetPublic_selected_710)
Exemple #6
0
def create_dbfrombackup_choose_dbversion(driver):
    driver.find_element_by_id("newBackupReportDbHome").click()
    cm.option_random_choice(
        "ojChoiceId_backupReportDbVersion_selected",
        '// *[ @ id = "oj-listbox-results-backupReportDbVersion"]/li/div',
        driver)
Exemple #7
0
def create_database_frombackup_restore_page(driver):
    jsonfile_path = "D:\sendjsonfile.exe D:\my.json"
    numofchannel = random.randint(1, 5)
    using_existing_dbhome = random.choice([True, False])
    emconsole = random.choice(
        ["noBackupReportEnableConsole", "yesBackupReportEnableConsole"])
    cm.option_random_choice(
        "ojChoiceId_objectStoreSelectionName_selected",
        '//*[@id="oj-listbox-results'
        '-objectStoreSelectionName"]/li/div', driver)
    driver.find_element_by_id("backupReportFileId").click()
    time.sleep(3)
    os.system(jsonfile_path)
    cm.by_id_input("backupReportRmanPasswords", backuprmanpassword, driver)
    cm.by_id_input("backupReportRmanPasswordsRepeat", backuprmanpassword,
                   driver)
    cm.by_id_input("bkupReportDbName", dbName, driver)
    cm.by_id_input("bkupReportDbUniqueName", dbUniqueName, driver)
    if using_existing_dbhome:
        driver.find_element_by_id("existingBackupReportDbHome").click()
        if cm.is_element_exist_by_id("oj-listbox-results-backupReportDbHome",
                                     driver):
            cm.option_random_choice(
                "oj-select-choice-backupReportDbHome",
                '//*[@id="oj-listbox-results-backupReportDbHome"]/li/div',
                driver)
        else:
            create_dbfrombackup_choose_dbversion(driver)
    else:
        create_dbfrombackup_choose_dbversion(driver)
    if cm.is_element_exist_by_id("ojChoiceId_bkupReportDbType_selected",
                                 driver):
        cm.option_random_choice(
            "ojChoiceId_bkupReportDbType_selected",
            '//*[@id="oj-listbox-results-bkupReportDbType"]/li/div', driver)
    cm.option_random_choice(
        "ojChoiceId_bkupReportDbShape_selected",
        '//*[@id="oj-listbox-results-bkupReportDbShape"]/li/div', driver)

    cm.option_random_choice(
        "oj-select-choice-bkupReportDbClass",
        '//*[@id="oj-listbox-results-bkupReportDbClass"]/li/div[not(@aria-disabled)]',
        driver)
    cm.option_random_choice(
        "ojChoiceId_bkupReportDbStorage_selected",
        '//*[@id="oj-listbox-results-bkupReportDbStorage"]/li/div[not(@aria-disabled)]',
        driver)
    # cm.by_id_input("noOfRmanChannels", numofchannel, driver)
    time.sleep(2)
    if emconsole == "yesBackupReportEnableConsole":
        cm.by_id_click(emconsole, driver)
    cm.by_id_input("bkupReportSysPassword", '%s' % dbsyspassword, driver)
    cm.by_id_input("bkupReportCSysPassword", '%s' % dbsyspassword, driver)
    driver.find_element_by_xpath('//*[@id="okRestoreDb"]/div/span[1]').click()
    time.sleep(1)
    cm.by_id_click("yesCreateDbUsingExistingBackup", driver)
Exemple #8
0
def input_db(x="adminPwd",
             y="cpadminPwd",
             dbhome=False,
             db1=dbName,
             driver=driver1):
    cm.by_id_input("dbName", db1, driver)
    cm.by_id_input("dbUniqueName", dbUniqueName, driver)
    # for key, value in dbName_text_box.items():
    #    cm.by_id_input(key, value)
    # for key, value in db_choice.items():
    # cm.option_random_choice(key, value)
    if dbhome:
        cm.by_id_click("existingDbHome", driver)
        cm.option_random_choice("oj-select-choice-dbHome",
                                '//*[@id="oj-listbox-results-dbHome"]/li/div',
                                driver)
    else:
        cm.option_random_choice(
            "ojChoiceId_dbVersion_selected",
            '//*[@id="oj-listbox-results-dbVersion"]/li/div[not (@aria-disabled)]',
            driver)
        cm.option_random_choice(
            "ojChoiceId_dbEdition_selected",
            '//*[@id="oj-listbox-results-dbEdition"]/li/div', driver)
    cm.option_random_choice("oj-select-choice-dbShape",
                            '//*[@id="oj-listbox-results-dbShape"]/li/div',
                            driver)
    cm.option_random_choice(
        "ojChoiceId_dbClass_selected",
        '//*[@id="oj-listbox-results-dbClass"]/li/div[not (@aria-disabled)]',
        driver)
    cm.option_random_choice(
        "ojChoiceId_dbStorage_selected",
        '//*[@id="oj-listbox-results-dbStorage"]/li/div[not (@aria-disabled)]',
        driver)
    cm.option_random_choice("ojChoiceId_dbCharset_selected",
                            '//*[@id="oj-listbox-results-dbCharset"]/li/div',
                            driver)
    cm.option_random_choice(
        "ojChoiceId_dbNlsCharset_selected",
        '//*[@id="oj-listbox-results-dbNlsCharset"]/li/div', driver)
    cm.option_random_choice("ojChoiceId_dbLanguage_selected",
                            '//*[@id="oj-listbox-results-dbLanguage"]/li/div',
                            driver)
    cm.option_random_choice(
        "ojChoiceId_dbTerritory_selected",
        '//*[@id="oj-listbox-results-dbTerritory"]/li/div', driver)

    if cm.is_element_exist_by_id("yesCdb", driver):
        input_cdb_info(driver)
    if cm.is_element_exist_by_id("ojChoiceId_dbType_selected", driver):
        cm.option_random_choice("ojChoiceId_dbType_selected",
                                '//*[@id="oj-listbox-results-dbType"]/li/div',
                                driver)
    if cm.is_element_exist_by_id("nodeNumber0", driver):
        choose_option(node_list, driver)
    if cm.is_element_exist_by_id("yesFlash", driver):
        choose_option(flash_list, driver)

    cm.by_id_click(EmConsole, driver)
    cm.by_id_input(x, password2, driver)
    cm.by_id_input(y, password2, driver)