Ejemplo n.º 1
0
    def set_rw(self, data):
        self.driver.click("VOLUME", locator=self.__volume)

        volumes = self.driver.find_elements(self.__volumeTable)
        for volume in volumes:
            if self.driver.get_text("NAMETD",
                                    locator=self.__nameTd,
                                    element=volume) == data["name"]:
                self.driver.click("ACTIONS",
                                  locator=self.__actions,
                                  element=volume)
                self.driver.click("SETRW", locator=self.__setRw)
                self.driver.clear("READIOPSRW", locator=self.__readIopsRw)
                self.driver.input("READIOPSRW",
                                  data["read_iops"],
                                  locator=self.__readIopsRw)
                self.driver.clear("WRITEIOPSRW", locator=self.__writeIopsRw)
                self.driver.input("WRITEIOPSRW",
                                  data["write_iops"],
                                  locator=self.__writeIopsRw)
                self.driver.clear("READTHROUGHPUT",
                                  locator=self.__readThoughput)
                self.driver.input("READTHROUGHPUT",
                                  data["read_throughput"],
                                  locator=self.__readThoughput)
                self.driver.clear("WRITETHROUGHPUT",
                                  locator=self.__writeThoughput)
                self.driver.input("WRITETHROUGHPUT",
                                  data["write_throughput"],
                                  locator=self.__writeThoughput)
                self.driver.click("SUBMITDIALOG", locator=self.__submitDialog)
                break

        volumes = self.driver.find_elements(self.__volumeTable)
        for volume in volumes:
            if self.driver.get_text("NAMETD",
                                    locator=self.__nameTd,
                                    element=volume) == data["name"]:
                self.driver.click("NAMETD", locator=self.__nameTd)
                break

        Utils.assert_str_equal_str(
            self.driver.get_text("READIOPSINFO", locator=self.__readIopsInfo),
            data["read_iops"])
        Utils.assert_str_equal_str(
            self.driver.get_text("WRITEIOPSINFO",
                                 locator=self.__writeIopsInfo),
            data["write_iops"])
        Utils.assert_str_equal_str(
            self.driver.get_text("READTHROUGHPUTINFO",
                                 locator=self.__readThroughputInfo),
            data["read_throughput"])
        Utils.assert_str_equal_str(
            self.driver.get_text("WRITETHROUGHPUTINFO",
                                 locator=self.__writeThroughputInfo),
            data["write_throughput"])
    def create_project(self, data):
        self.driver.click("ENTERPRISE", locator=self.__enterprise)
        self.driver.click("CREATE", locator=self.__create)
        self.driver.input("NAME", data["name"], locator=self.__name)
        self.driver.input("DESCRIPTION",
                          data["description"],
                          locator=self.__description)
        self.driver.click("OKBUTTON", locator=self.__okButton)

        projects = self.driver.find_elements(self.__projectTr)
        nameTd = self.driver.find_elements(self.__nameTd)
        descriptionTd = self.driver.find_elements(self.__descriptionTd)
        projectAdminTd = self.driver.find_elements(self.__prjectAdminTd)
        userCountTd = self.driver.find_elements(self.__userCountTd)
        enableTd = self.driver.find_elements(self.__enableTd)
        isCheck = False
        for i in range(len(projects)):
            if data["name"] in self.driver.get_text("PROJECT",
                                                    element=projects[i]):
                Utils.assert_str_equal_str(
                    self.driver.get_text("NAME", element=nameTd[i]),
                    data["name"])
                Utils.assert_str_equal_str(
                    self.driver.get_text("DESCRIPTIONTD",
                                         element=descriptionTd[i]),
                    data["description"])
                Utils.assert_str_equal_str(
                    self.driver.get_text("PROJECTADMINTD",
                                         element=projectAdminTd[i]),
                    data["project_admin"])
                Utils.assert_str_equal_str(
                    self.driver.get_text("USERCOUNTTD",
                                         element=userCountTd[i]),
                    data["user_count"])
                Utils.assert_str_equal_str(
                    self.driver.get_text("ENABLETD", element=enableTd[i]),
                    data["enable"])
                isCheck = True
                break
            i += i
        if isCheck is not True:
            assert False
Ejemplo n.º 3
0
    def expand(self, data):
        self.driver.click("VOLUME", locator=self.__volume)

        volumes = self.driver.find_elements(self.__volumeTable)
        for volume in volumes:
            if self.driver.get_text("NAMETD",
                                    locator=self.__nameTd,
                                    element=volume) == data["name"]:
                self.driver.click("ACTIONS",
                                  locator=self.__actions,
                                  element=volume)
                self.driver.click("EXPAND", locator=self.__expand)

                Utils.assert_str_equal_str(
                    self.driver.get_text("NAMEEXPAND",
                                         locator=self.__nameExpand,
                                         element=volume), data["name"])

                self.driver.clear("CAPACITYEXPAND",
                                  locator=self.__capacityExpand)
                self.driver.input("CAPACITYEXPAND",
                                  data["capacity_expand"],
                                  locator=self.__capacityExpand)
                self.driver.click("SUBMITDIALOG", locator=self.__submitDialog)
                break

        volumes = self.driver.find_elements(self.__volumeTable)
        for volume in volumes:
            if self.driver.get_text("NAMETD",
                                    locator=self.__nameTd,
                                    element=volume) == data["name"]:
                Utils.assert_str_equal_str(
                    self.driver.get_text("CAPACITYTD",
                                         locator=self.__capacityTd,
                                         element=volume),
                    data["capacity_expand"])
                break
Ejemplo n.º 4
0
    def create_volume(self, data):
        self.driver.click("VOLUME", locator=self.__volume)
        self.driver.click("CREATE", locator=self.__create)
        self.driver.click("PROJECT", locator=self.__project)
        self.driver.click("PROJECT",
                          locator="XPATH://li[contains(text(),'" +
                          data["project"] + "')]")
        self.driver.click("DATADISK", locator=self.__dataDisk)
        self.driver.input("NAME", data["name"], locator=self.__name)
        self.driver.click("TYPE", locator=self.__type)

        type_value = ("XPATH://li[contains(text(),'" + data["type"] +
                      "')]").decode("gb2312")
        self.driver.click("TYPE", locator=type_value)
        self.driver.clear("CAPACITY", locator=self.__capacity)
        print data["capacity"]
        self.driver.input("CAPACITY",
                          data["capacity"],
                          locator=self.__capacity)
        self.driver.clear("NUMBER", locator=self.__number)
        print data["number"]
        self.driver.input("NUMBER", data["number"], locator=self.__number)
        self.select_checkbox(self.__sharedVolume, "SHAREDVOLUME",
                             data["shared"])
        self.driver.input("DESCRIPTION",
                          data["description"],
                          locator=self.__description)
        self.driver.click("OKBUTTON", locator=self.__okButton)

        volumes = self.driver.find_elements(self.__volumeTable)
        for volume in volumes:
            if self.driver.get_text("NAMETD", locator=self.__nameTd, element=volume) == \
                    data["name"]:
                Utils.assert_str_equal_str(
                    self.driver.get_text("PROJECTTD",
                                         locator=self.__projectTd,
                                         element=volume), data["project"])
                Utils.assert_str_equal_str(
                    self.driver.get_text("TYPETD",
                                         locator=self.__typeTd,
                                         element=volume), data["type"])
                Utils.assert_str_equal_str(
                    self.driver.get_text("CAPACITYTD",
                                         locator=self.__capacityTd,
                                         element=volume), data["capacity"])
                Utils.assert_str_equal_str(
                    self.driver.get_text("CAPABILITYTD",
                                         locator=self.__capabilityTd,
                                         element=volume), data["capability"])
                Utils.assert_str_equal_str(
                    self.driver.get_text("STATETD",
                                         locator=self.__stateTd,
                                         element=volume), data["state"])
                self.driver.click("NAMETD", locator=self.__nameTd)
                break

        Utils.assert_str_equal_str(
            self.driver.get_text("PROJECTINFO", locator=self.__projectInfo),
            data["project"])
        Utils.assert_str_equal_str(
            self.driver.get_text("NAMEINFO", locator=self.__nameInfo),
            data["name"])
        Utils.assert_str_equal_str(
            self.driver.get_text("STATEINFO", locator=self.__stateInfo),
            data["state"])
        Utils.assert_str_equal_str(
            self.driver.get_text("CAPABILITYINFO",
                                 locator=self.__capabilityInfo),
            data["capability"])
        Utils.assert_str_equal_str(
            self.driver.get_text("DESCRIPTIONINFO",
                                 locator=self.__descriptionInfo),
            data["description"])
        Utils.assert_str_equal_str(
            self.driver.get_text("TYPEINFO", locator=self.__typeInfo),
            data["type"])