Exemple #1
0
 def build_cmd_string(self):
     self.cmdstr = "wr_seeprom" + " " + self.port_id + " " + self.device_addr + " " + self.offset + " " + self.offset_width + " " + self.data_to_write + "\n"
     _LOGGER.info("cmdstr = %s" % self.cmdstr)
     print "cmdstr = %s" % self.cmdstr
     self.cmd = pmcses.PMCCommand(self.cmdstr, self.uart_port,
                                  self.uart_baudrate, self.uart_timeout,
                                  None, self.cmd_timeout, None, None, None)
Exemple #2
0
 def build_cmd_string(self):
     if self.number_bytes_to_read >= self.block_size:
         self.cmdstr = "rd_seeprom" + " " + self.port_id + " " + self.device_addr + " " + self.offset + " " + self.offset_width + " " + (
             str(self.block_size)) + "\n"
         self.offset = hex(int(self.offset, 16) + self.block_size)
     else:
         self.cmdstr = "rd_seeprom" + " " + self.port_id + " " + self.device_addr + " " + self.offset + " " + self.offset_width + " " + (
             str(self.number_bytes_to_read)) + "\n"
     _LOGGER.info("%s " % self.cmdstr)
     self.cmd = pmcses.PMCCommand(self.cmdstr, self.uart_port,
                                  self.uart_baudrate, self.uart_timeout,
                                  None, self.cmd_timeout, None, None, None)
Exemple #3
0
    def action_init(self, kwargs):
        testcasexml = kwargs.get("testcase")
        node = self.parameter.find(self.item_type)
        node = analyse_fw_node(testcasexml, node, self.item_type)
        #node_combined = analyse_ses_command_node(testcasexml, node, self.item_type)
        # Set command
        for optnode in node.findall("version"):
            i = len(optnode.items())
            if i == 2:
                name = optnode.get("name")
                ver = optnode.get("ver")
                item = {name: (ver)}
            else:
                name = optnode.get("name")
                ver = optnode.get("ver")
                misc = optnode.get("misc")
                item = {name: (ver, misc)}
            self.dict.update(item)

        cmd_node = node.find("cmd")
        cmd = cmd_node.get("value")
        for optnode in node.findall("option"):
            cmd += " %s" % (optnode.get("args"))
        cmd_timeout = cmd_node.get("timeout")
        cmd_recv = cmd_node.get("recv")

        proxy = node.get("proxy")
        if proxy == "uart":
            uart_node = node.find("uart")
            uart_port = uart_node.get("port")
            uart_baudrate = uart_node.get("baudrate")
            uart_timeout = uart_node.get("timeout")
            uart_end_of_line = uart_node.get("end-of-line")
            endmarks = []
            for endmark_node in node.findall("end-mark"):
                endmark = endmark_node.get("keyword")
                endmarks.append(endmark)
            error_filters = []
            for error_filter_node in node.findall("error-filter"):
                error_filter = command.ErrorFilters[error_filter_node.get(
                    "type")](error_filter_node.get("operation"),
                             error_filter_node.get("value"))
                error_filters.append(error_filter)

            self.cmd = pmcses.PMCCommand(cmd, uart_port, uart_baudrate,
                                         uart_timeout, uart_end_of_line,
                                         cmd_timeout, cmd_recv, endmarks,
                                         error_filters)
        elif proxy == "uart-daemon":
            self.cmd = SESCommandUartDaemon()
        else:
            raise ValueError("Unknown proxy type '%s'", proxy)
        return True
Exemple #4
0
    def action_init(self, kwargs):

        testcasexml = kwargs.get("testcase")
        node = self.parameter.find(self.item_type)
        node_combined = analyse_i2c_node(testcasexml, node, self.item_type)

        # Get timeout attribute
        cmd_timeout = int(node_combined.get("timeout"),0)
        proxy = node_combined.get("proxy")

        # Set command
        cmd = "wr_seeprom"
        port_id = int(node_combined.find("port_id").get("value"),0)
        device_addr= node_combined.find("device_addr").get("value")
        offset = int(node_combined.find("offset").get("value"),0)
        offset_width = int(node_combined.find("offset_width").get("value"),0)
        data_to_write = node_combined.find("data_to_write").get("value")
        cmd=cmd + " " + str(port_id) + " " + device_addr + " " + str(offset) + " " + str(offset_width) + " " + data_to_write +"\r"

		 
        #send command
        if proxy == "uart":
            uart_node = node_combined.find("uart")
            uart_port = uart_node.get("port")
            uart_baudrate = uart_node.get("baudrate")
            uart_newline_transmit = uart_node.get("new_line_transmit")
            endmarks = []
            for endmark_node in node_combined.findall("end-mark"):
                endmark = endmark_node.get("keyword")
                endmarks.append(endmark)
            error_filters = []
            for error_filter_node in node_combined.findall("error-filter"):
                error_filter = command.ErrorFilters[error_filter_node.get("type")](
                                               error_filter_node.get("operation"),
                                               error_filter_node.get("value"))
                error_filters.append(error_filter) 
            self.cmd = pmcses.PMCCommand(cmd,
                                      uart_port, uart_baudrate, None,
                                      uart_newline_transmit,
                                      cmd_timeout, None,
                                      endmarks, error_filters)
									  
        elif proxy == "uart-daemon":
#            self.cmd = sescmd.SESCommandUartDaemon()
             print "Has not supported uart-daemon\n"
        else:
            raise ValueError("Unknown proxy type '%s'", proxy)
        return True
Exemple #5
0
    def action_init(self, kwargs):
        testcasexml = kwargs.get("testcase")
        node = self.parameter.find(self.item_type)
        node_combine = analyse_powercycle_node(testcasexml, node,
                                               self.item_type)
        #node_combined = analyse_ses_command_node(testcasexml, node, self.item_type)
        # Set command
        phytree = node_combine.find("phy-table")
        self.phynum = int(phytree.get("number"))
        # dicton = {}
        # dictoff = {}
        # dicterror = {}
        for optphy in phytree.findall("phy"):
            print self.dicton
            print self.dictoff
            print self.dicterror
            phystr = ""
            phylist = []
            phy_id = optphy.get("id")
            phy_id = phy_id.split(",")
            for phy in phy_id:
                if -1 != phy.find("-"):
                    phy = phy.split("-")
                    for i in range(int(phy[0]), int(phy[1]) + 1):
                        #phystr += str(i) + " "
                        phylist.append(str(i))
                else:
                    # phystr += phy
                    phylist.append(phy)
            phystr = " ".join(phylist)
            attrnode = optphy.findall("attribute")
            for node in attrnode:
                attri = node.get("name")
                print attri
                status = node.get("status")
                print status

                if status == "*":
                    if attri in self.dicton.keys():
                        print "********key exist,extend list*******"
                        #self.dicton[attri].extend(phylist)
                        print "phystr%s" % phystr
                        self.dicton[attri] = str(
                            self.dicton[attri]) + " " + str(phystr)
                        list(self.dicton[attri]).sort()
                        print self.dicton
                        print self.dictoff
                        print self.dicterror
                    else:
                        dictitem = {attri: str(phystr)}
                        print dictitem
                        self.dicton.update(dictitem)

                elif status == "-":
                    if attri in self.dictoff.keys():

                        print "-----------key exist,extend list-------"
                        self.dictoff[attri] = self.dictoff[attri] + " " + str(
                            phystr)
                        list(self.dictoff[attri]).sort()

                        # self.dictoff[attri].sort()
                        print self.dictoff
                        print self.dicton
                        print self.dicterror
                    else:
                        dictitem = {attri: str(phystr)}
                        print dictitem
                        self.dictoff.update(dictitem)
                else:
                    if attri in self.dicterror.keys():
                        print "!!!!!!!!!key exist,extend list!!!!!!!!!"
                        # self.dicterror[attri].extend(phylist)
                        self.dicterror[
                            attri] = self.dicterror[attri] + " " + str(phystr)
                        list(self.dicterror[attri]).sort()

                        #print self.dicterror

                    else:
                        dictitem = {attri: str(phystr)}
                        print dictitem
                        self.dicterror.update(dictitem)

        print "xml* dict !!!"
        print self.dicton
        print "xml- dict !!!"
        print self.dictoff
        print "xml! dict !!!"
        print self.dicterror

        # set command
        cmd = node_combine.find("cmd").get("value")
        cmd_timeout = node_combine.find("cmd").get("timeout")
        cmd_recv = node_combine.find("cmd").get("recv")

        proxy = node_combine.get("proxy")
        if proxy == "uart":
            uart_node = node_combine.find("uart")
            uart_port = uart_node.get("port")
            uart_baudrate = uart_node.get("baudrate")
            uart_timeout = uart_node.get("timeout")
            uart_end_of_line = uart_node.get("end-of-line")
            endmarks = []
            for endmark_node in node_combine.findall("end-mark"):
                endmark = endmark_node.get("keyword")
                endmarks.append(endmark)
            error_filters = []
            for error_filter_node in node_combine.findall("error-filter"):
                error_filter = command.ErrorFilters[error_filter_node.get(
                    "type")](error_filter_node.get("operation"),
                             error_filter_node.get("value"))
                error_filters.append(error_filter)

            self.cmd = pmcses.PMCCommand(cmd, uart_port, uart_baudrate,
                                         uart_timeout, uart_end_of_line,
                                         cmd_timeout, cmd_recv, endmarks,
                                         error_filters)
        elif proxy == "uart-daemon":
            self.cmd = SESCommandUartDaemon()
        else:
            raise ValueError("Unknown proxy type '%s'", proxy)
        return True
Exemple #6
0
    def action_init(self, kwargs):

        testcasexml = kwargs.get("testcase")
       
        node = self.parameter.find(self.item_type)
     
        node_combined = analyse_i2c_node(testcasexml, node, self.item_type)

        # Get timeout attribute
        cmd_timeout = int(node_combined.get("timeout"),0)
        proxy = node_combined.get("proxy")

        # Set command
        cmd = "rd_seeprom"
        port_id = int(node_combined.find("port_id").get("value"),0)
        device_addr = node_combined.find("device_addr").get("value")
        offset = int(node_combined.find("offset").get("value"),0)
        offset_width = int(node_combined.find("offset_width").get("value"),0)
        number_bytes_to_read = int(node_combined.find("number_bytes_to_read").get("value"),0)
		
	cmd = cmd + " " + str(port_id) + " " + device_addr + " " + str(offset) + " " + str(offset_width) + " " + str(number_bytes_to_read) +"\r"
         
        # Set condition_type
        self.condition_type = node_combined.get("condition_type").lower()
        if (self.condition_type=="and") or (self.condition_type=="or"):
	   pass
        else:
           raise ValueError("Unknown I2C condition type '%s'",self.condition_type)
		
        #set condition
        for cnode in node_combined.findall("condition"):
            operation = cnode.get("operation")
            value_type = cnode.get("value_type")
            value = cnode.get("value")
            self.conditions.append(I2CCondition(value_type,operation,value))
        #send command
        if proxy == "uart":
            uart_node = node_combined.find("uart")
            uart_port = uart_node.get("port")
            uart_baudrate = uart_node.get("baudrate")
            uart_newline_transmit = uart_node.get("new_line_transmit")
            endmarks = []
            for endmark_node in node_combined.findall("end-mark"):
                endmark = endmark_node.get("keyword")
                endmarks.append(endmark)
            error_filters = []
            for error_filter_node in node_combined.findall("error-filter"):
                error_filter = command.ErrorFilters[error_filter_node.get("type")](
                                               error_filter_node.get("operation"),
                                               error_filter_node.get("value"))
                error_filters.append(error_filter) 
            self.cmd = pmcses.PMCCommand(cmd,
                                      uart_port, uart_baudrate, None,
                                      uart_newline_transmit,
                                      cmd_timeout, None,
                                      endmarks, error_filters)
									  
        elif proxy == "uart-daemon":
            _LOGGER.info("uart-daemon not support")
        else:
            raise ValueError("Unknown proxy type '%s'", proxy)
        return True