def __set_body_attributes (self, content):
     """
     add attribute before the end marker of request
     :param content: "xml" or "json"
     """
     for id in range(0, len(body_message.ATTRIBUTES)):
         self.ADD_PRODUCT_BODY = utils.body_elements(self.ADD_PRODUCT_BODY, body_message.ATTRIBUTES[id], "attributes", "addProduct", content)
 def __set_body_attributes(self, content):
     """
     add attribute before the end marker of request
     :param content: "xml" or "json"
     """
     for id in range(0, len(body_message.ATTRIBUTES)):
         self.ADD_PRODUCT_BODY = utils.body_elements(
             self.ADD_PRODUCT_BODY, body_message.ATTRIBUTES[id],
             "attributes", "addProduct", content)
 def __set_body_metadata (self, meta, value, content):
     """
     add metadata before the end marker of request
     :param meta: label for metadata (key)
     :param value: value for metadata
     :param content: "xml" or "json"
     """
     if meta == "all": metadata = body_message.ALL_METADATAS
     else:
         key = meta[len("metadata_"):]
         metadata = [[{'label': 'key', 'value': key}, {'label': 'value', 'value': value}]]
     for id in range(0, len(metadata)):
         self.ADD_PRODUCT_BODY = utils.body_elements(self.ADD_PRODUCT_BODY, metadata[id], "metadatas", "addProduct", content)
    def provisioning_installProduct (self, ip, hostname, osType, product, release, errorType, content):
        """
         install a product in a VM
        :param product:
        :param release:
        :param ip:
        :param errorType:
        :param content:
        """
        vmElement = [{'label': 'ip',       'value': ip},
                     {'label': 'hostname', 'value': hostname},
                     {'label': 'domain',   'value': None},
                     {'label': 'fqn',      'value': 'fqn'},
                     {'label': 'osType',   'value': osType}]

        productElement = [{'label': 'name',          'value': product},
                          {'label': 'version',       'value': release},
                          {'label': 'type',          'value': None}]

        self.__init_body(content)
        self.INSTALL_BODY = utils.body_elements(self.INSTALL_BODY, vmElement,      "vm",      "installProduct", content)
        self.INSTALL_BODY = utils.body_elements(self.INSTALL_BODY, productElement, "product", "installProduct", content)

        world.response = utils.request("POST", self.__create__url("installProduct"), self.__create__headers(content), self.INSTALL_BODY, errorType)
 def __set_body_metadata(self, meta, value, content):
     """
     add metadata before the end marker of request
     :param meta: label for metadata (key)
     :param value: value for metadata
     :param content: "xml" or "json"
     """
     if meta == "all": metadata = body_message.ALL_METADATAS
     else:
         key = meta[len("metadata_"):]
         metadata = [[{
             'label': 'key',
             'value': key
         }, {
             'label': 'value',
             'value': value
         }]]
     for id in range(0, len(metadata)):
         self.ADD_PRODUCT_BODY = utils.body_elements(
             self.ADD_PRODUCT_BODY, metadata[id], "metadatas", "addProduct",
             content)