Ejemplo n.º 1
0
    def process(self, func_name, node, xml_path, node_path, params):
        _, result = super(ProcessOneormore, self).process(
            func_name, node, xml_path, node_path, params)

        if type(result) is int:
            child = list(self.node)[0]
            for i in xrange(result):
                xml_gen.parse_node(child, params=self.params)
        elif result is not None:
            logging.error("OneOrMore should return an int, but %s found",
                          type(result))

        return self.cont, None
Ejemplo n.º 2
0
    def process(self, func_name, node, xml_path, node_path, params):
        _, result = super(ProcessOneormore,
                          self).process(func_name, node, xml_path, node_path,
                                        params)

        if type(result) is int:
            child = list(self.node)[0]
            for i in xrange(result):
                xml_gen.parse_node(child, params=self.params)
        elif result is not None:
            logging.error("OneOrMore should return an int, but %s found",
                          type(result))

        return self.cont, None
Ejemplo n.º 3
0
    def process(self, func_name, node, xml_path, node_path, params):
        self.choices = []
        super(ProcessChoice, self).process(func_name, node, xml_path,
                                           node_path, params)

        if not self.choices:
            return self.cont, None

        choice = random.choice(self.choices)
        return self.cont, xml_gen.parse_node(choice, params=self.params)
Ejemplo n.º 4
0
    def process(self, func_name, node, xml_path, node_path, params):
        self.choices = []
        super(ProcessChoice, self).process(
            func_name, node, xml_path, node_path, params)

        if not self.choices:
            return self.cont, None

        choice = random.choice(self.choices)
        return self.cont, xml_gen.parse_node(choice, params=self.params)
Ejemplo n.º 5
0
    def domain_optional(self):
        # TODO: Move to other place
        if self.node.find("./ref[@name='qemucmdline']") is None:
            return self.go_on()

        controller = self.xml.find("./devices/controller[@type='pci']")
        if controller is None:
            node = self.nodetree.find("./define[@name='pciController']")
            params = {
                'xml_stack': [],
                'node_stack': [],
                'nodetree': self.nodetree,
            }
            pcinode = xml_gen.parse_node(node, params=params)
            self.xml.find("./devices").append(pcinode)
Ejemplo n.º 6
0
    def domain_optional(self):
        # TODO: Move to other place
        if self.node.find("./ref[@name='qemucmdline']") is None:
            return self.go_on()

        controller = self.xml.find("./devices/controller[@type='pci']")
        if controller is None:
            node = self.nodetree.find("./define[@name='pciController']")
            params = {
                'xml_stack': [],
                'node_stack': [],
                'nodetree': self.nodetree,
            }
            pcinode = xml_gen.parse_node(node, params=params)
            self.xml.find("./devices").append(pcinode)