Beispiel #1
0
def create_uhost_instance_01(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "TimemachineFeature": "No",
        "Tag": "Default",
        "StorageType": "LocalDisk",
        "Region": variables.get("Region"),
        "Quantity": 1,
        "Password": "******",
        "NetCapability": "Normal",
        "Name": variables.get("Name"),
        "Memory": variables.get("CreateMem"),
        "LoginMode": "Password",
        "ImageId": variables.get("ImageID"),
        "HotplugFeature": False,
        "HostType": "N2",
        "GPU": False,
        "DiskSpace": variables.get("CreateDiskspace"),
        "ChargeType": variables.get("ChargeType"),
        "CPU": variables.get("CreateCPU"),
        "BootDiskSpace": variables.get("CreateBootDisk"),
    }

    try:
        resp = client.uhost().create_uhost_instance(d)
    except exc.RetCodeException as e:
        resp = e.json()

    variables["hostId"] = utest.value_at_path(resp, "UHostIds.0")
    return resp
def create_uhost_instance_11(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "UHostType": variables.get("UHostType"),
        "TimemachineFeature": "No",
        "Tag": "Default",
        "Region": variables.get("Region"),
        "Quantity": 1,
        "Password": "******",
        "NetCapability": "Normal",
        "Name": variables.get("HostName"),
        "Memory": variables.get("CreateMem"),
        "LoginMode": "Password",
        "ImageId": variables.get("ImageId"),
        "HotplugFeature": False,
        "GPU": False,
        "Disks": [
            {
                "BackupType": variables.get("BootBackup"),
                "IsBoot": True,
                "Size": variables.get("BootSize"),
                "Type": variables.get("BootType"),
            }
        ],
        "ChargeType": variables.get("ChargeType"),
        "CPU": variables.get("CreateCPU"),
    }

    try:
        resp = client.uhost().create_uhost_instance(d)
    except exc.RetCodeException as e:
        resp = e.json()

    variables["uhost_id"] = utest.value_at_path(resp, "UHostIds.0")
    return resp
Beispiel #3
0
def terminate_uhost_instance_09(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "UHostId": variables.get("hostId"),
        "Region": variables.get("Region"),
    }

    try:
        resp = client.uhost().terminate_uhost_instance(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp
Beispiel #4
0
def describe_uhost_instance_08(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "UHostIds": [variables.get("hostId")],
        "Region": variables.get("Region"),
    }

    try:
        resp = client.uhost().describe_uhost_instance(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp
Beispiel #5
0
def poweroff_uhost_instance_13(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "UHostId": variables.get("uhost_id1"),
        "Region": variables.get("Region"),
    }

    try:
        resp = client.uhost().poweroff_uhost_instance(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp
def reset_uhost_instance_password_05(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "UHostId": variables.get("hostId"),
        "Region": variables.get("Region"),
        "Password": variables.get("NewPassword"),
    }

    try:
        resp = client.uhost().reset_uhost_instance_password(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp
def resize_uhost_instance_08(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "UHostId": variables.get("hostId"),
        "Region": variables.get("Region"),
        "CPU": variables.get("UpgradeCPU"),
    }

    try:
        resp = client.uhost().resize_uhost_instance(d)
    except exc.RetCodeException as e:
        resp = e.json()

    return resp
Beispiel #8
0
def describe_image_00(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "Region": variables.get("Region"),
        "OsType": "Linux",
        "ImageType": "Base",
    }

    try:
        resp = client.uhost().describe_image(d)
    except exc.RetCodeException as e:
        resp = e.json()

    variables["ImageID"] = utest.value_at_path(resp, "ImageSet.0.ImageId")
    return resp
Beispiel #9
0
def create_uhost_instance_02(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "Tag": variables.get("tag"),
        "Region": variables.get("Region"),
        "Password": "******",
        "Name": variables.get("uhost_name_1"),
        "Memory": 1024,
        "LoginMode": "Password",
        "ImageId": variables.get("Image_Id"),
        "DiskSpace": 0,
        "CPU": 1,
    }

    try:
        resp = client.uhost().create_uhost_instance(d)
    except exc.RetCodeException as e:
        resp = e.json()

    variables["uhost_id1"] = utest.value_at_path(resp, "UHostIds.0")
    return resp
def create_uhost_instance_02(client: utest.Client, variables: dict):
    d = {
        "Zone": variables.get("Zone"),
        "TimemachineFeature": "No",
        "Tag": "Default",
        "Region": variables.get("Region"),
        "Password": "******",
        "Name": "packet-s1-bgp",
        "Memory": 1024,
        "LoginMode": "Password",
        "ImageId": variables.get("Image_Id"),
        "HotplugFeature": False,
        "DiskSpace": 0,
        "CPU": 1,
    }

    try:
        resp = client.uhost().create_uhost_instance(d)
    except exc.RetCodeException as e:
        resp = e.json()

    variables["UHostId"] = utest.value_at_path(resp, "UHostIds.0")
    return resp