Esempio n. 1
0
def get(testdata_file, testdata_key):
    banner("TESTDATA.Get  file=%s  key=%s" % (testdata_file, testdata_key))
    try:
        with open(TESTDATA_FILE_DIRECTORY + testdata_file) as json_file:
            test_data = json.load(json_file)
        return test_data[testdata_key]
    except Exception as e:
        trace("ERROR: %s" % str(e))
        return {"Error": str(e)}
Esempio n. 2
0
 def delete_node(self, *args, **kwargs):
     """
     Delete Node
     [Args]
         (str) Id
     [Returns]
         (dict) Response: Delete Node response (includes any errors)
     """
     self._load_kwargs(kwargs)
     banner("PCC.Delete Node")
     conn = BuiltIn().get_variable_value("${PCC_CONN}")
     return pcc.delete_node_by_id(conn, self.Id)
Esempio n. 3
0
 def get_node_id(self, *args, **kwargs):
     """
     Get Node Id
     [Args]
         (str) Name
     [Returns]
         (dict) Response: Get Node response (includes any errors)
     """
     self._load_kwargs(kwargs)
     banner("PCC.Get Node Id")
     conn = BuiltIn().get_variable_value("${PCC_CONN}")
     return easy.get_node_id_by_name(conn, self.Name)
Esempio n. 4
0
 def get_nodes(self, *args, **kwargs):
     """
     Get Nodes
     [Args]
         None
     [Returns]
         (dict) Response: Get Node response (includes any errors)
     """
     self._load_kwargs(kwargs)
     banner("PCC.Get Nodes ")
     conn = BuiltIn().get_variable_value("${PCC_CONN}")
     return pcc.get_nodes(conn)
Esempio n. 5
0
 def get_applications(self, *args, **kwargs):
     """
     Get Applications
     [Args]
         None
     [Returns]
         (dict) List of Applications from PCC
     """
     banner("PCC.Get Applications")
     self._load_kwargs(kwargs)
     conn = BuiltIn().get_variable_value("${PCC_CONN}")
     return pcc.get_apps(conn)
Esempio n. 6
0
 def get_node_groups(self, *args, **kwargs):
     """
     Get Node Groups from PCC
     [Args]
         None
     [Returns]
         (dict) Response: Get Node Groups response (includes any errors)
     """
     banner("PCC.Get Node Groups")
     self._load_kwargs(kwargs)
     conn = BuiltIn().get_variable_value("${PCC_CONN}")
     return pcc.get_clusters(conn)
Esempio n. 7
0
 def wait_until_node_ready(self, *args, **kwargs):
     """
     Wait Until Node Ready
     [Args]
         (str) Name
     [Returns]
         (dict) OK
         (dict) Error if timeout
     """
     self._load_kwargs(kwargs)
     banner("PCC.Wait Until Node Ready")
     conn = BuiltIn().get_variable_value("${PCC_CONN}")
     return easy.wait_until_node_ready(conn, self.Name)
Esempio n. 8
0
    def get_application_id(self, *args, **kwargs):
        """
        Get Application Id
        [Args]
            (str) Name: Of the application we want Id
        [Returns]
            (int) Id: If found id of the application, otherwise None
        """
        self._load_kwargs(kwargs)
        banner("PCC.Get Application Id [Name=%s]" % self.Name)

        conn = BuiltIn().get_variable_value("${PCC_CONN}")
        return easy.get_app_id_by_name(conn, self.Name)
Esempio n. 9
0
 def get_node_group(self, *args, **kwargs):
     """
     Get Node Group from PCC
     [Args]
         (int) Id
     [Returns]
         (dict) Response: Get Node Groups response (includes any errors)
     """
     self._load_kwargs(kwargs)
     banner("PCC.Get Node Group [Id=%s]" % self.Id)
     
     conn = BuiltIn().get_variable_value("${PCC_CONN}")
     return pcc.get_cluster_by_id(conn, self.Id)
Esempio n. 10
0
    def delete_node_group(self, *args, **kwargs):
        """
        Delete Node Group for matching Id
        [Args]
            (int) Id
        [Returns]
            (dict) Delete Node Group Response
        """
        self._load_kwargs(kwargs)
        banner("PCC.Delete Node Group [Id=%s]" % self.Id)

        conn = BuiltIn().get_variable_value("${PCC_CONN}")
        return pcc.delete_cluster_by_id(conn, self.Id)
Esempio n. 11
0
    def get_application_id(self, *args, **kwargs):
        """
        Delete Certificate
        [Args]
            (str) Alias
        [Returns]
            (dict) Delete Certificate Response
        """
        self._load_kwargs(kwargs)
        banner("PCC.Delete Certificate [Alias=%s]" % self.Alias)

        conn = BuiltIn().get_variable_value("${PCC_CONN}")
        return pcc.delete_certificate_by_id(conn, self.Alias)
Esempio n. 12
0
    def get_node_group_id(self, *args, **kwargs):
        """
        Get Node Group Id
        [Args]
            (str) Name
        [Returns]
            (int) Id: Node Group Id if there is one, 
                None: If not found
        """
        self._load_kwargs(kwargs)
        banner("PCC.Get Node Group Id [Name=%s]" % self.Name)

        conn = BuiltIn().get_variable_value("${PCC_CONN}")
        return easy.get_node_group_id_by_name(conn, self.Name)
Esempio n. 13
0
 def add_certificate(self, *args, **kwargs):
     """
     Add Certificate
     [Args]
         (str) Alias: 
         (str) Filename:
         (str) Description:
     [Returns]
         (dict) Response: Add Certificate response
     """
     self._load_kwargs(kwargs)
     banner("PCC.Add Certificate [Alias=%s]" % self.Alias)
     conn = BuiltIn().get_variable_value("${PCC_CONN}")
     filename_path = os.path.join("tests/environment", self.Filename)
     return pcc.add_certificate(conn, self.Alias, self.Description,
                                filename_path)
Esempio n. 14
0
    def update_node(self, *args, **kwargs):
        """
        Update Node 
        [Args]
            (str) Name: Name of the Node
            ...
        [Returns]
            (dict) Response: Update Node response (includes any errors)
        """
        self._load_kwargs(kwargs)
        banner("PCC.Update Node [Name=%s]" % self.Name)
        conn = BuiltIn().get_variable_value("${PCC_CONN}")

        payload = {
            "Id": self.Id,
            "Name": self.Name,
            "ClusterId": self.ClusterId,
            "Host": self.Host,
            "Model": self.Model,
            "SN": self.SN,
            "Site_Id": self.Site_Id,
            "Type_Id": self.Type_Id,
            "Vendor": self.Vendor,
            "adminUser": self.adminUser,
            "bmc": self.bmc,
            "bmcKey": self.bmcKey,
            "bmcPassword": self.bmcPassword,
            "bmcUser": self.bmcUser,
            "bmcUsers": [self.bmcUser, "platina"],
            "console": self.console,
            "hardwareInventoryId": self.hardwareInventoryId,
            "hwAddr": self.hwAddr,
            "managed": self.managed,
            "owner": self.owner,
            "provisionStatus": self.provisionStatus,
            "ready": self.ready,
            "reimage": self.reimage,
            "roles": self.roles,
            "sshKeys": self.sshKeys,
            "standby": self.standby,
            "status": self.status,
            "tags": self.tags,
            "tenants": self.tenants,
            "interfaces": self.interfaces
        }
        return pcc.modify_node(conn, payload)
Esempio n. 15
0
    def add_node_group(self, *args, **kwargs):
        """
        Add Node Group to PCC
        [Args]
            (str) Name: Name of the group
            (int) owner: Tenant Id for the new group
            (str) Description: Description of the group
        [Returns]
            (dict) Response: Add Node Group response (includes any errors)
        """
        self._load_kwargs(kwargs)
        banner("PCC.Add Node Group [Name=%s]" % self.Name)
        conn = BuiltIn().get_variable_value("${PCC_CONN}")
        payload = {
            "Name": self.Name,
            "Description": self.Description,
            "owner": self.owner
        }

        return pcc.add_cluster(conn, payload)
Esempio n. 16
0
 def login(self, **kwargs):
     self._load_kwargs(kwargs)
     banner("PCC.Login")
     return pcc.login(self.url, self.username, self.password)