# Uploading Application
            code, localapp = fd.add_app("./NettestApp2V1_lxc.tar.gz", publish_on_upload=True)

            for myapp_index in range(0, DEPLOYMENT_NUMBER):
                
                dev_list = dev_list_sort(dev_list)
                    
                dep = "dep"+str(myapp_index)
                _, myappId = fd.create_myapp(localapp["localAppId"], dep, minjobs=1)
                
                deviceId = dev_list[0][0]
                profile = "normal"
                r = random.random()
                if r < 0.2:
                    profile = "angry"
                code, res = fd.fast_install_app(myappId, [deviceId], profile=profile)

                device_notReachable = 0
                current_device = 0
                if code != 400:
                    dev_list[0][1] -= 100
                    dev_list[0][2] -= 32
                while code == 400:
                    if "Error" in res and res["Error"] == "Device does not reachable":
                        device_notReachable += 1
                        if device_notReachable == 10:
                            current_device += 1
                            device_notReachable = 0
                            deviceId = dev_list[current_device][0]
                    r = random.random()
                    if r < 0.2:
    # Uploading Application
    code, localapp = fd.add_app("./NettestApp2V1_lxc.tar.gz",
                                publish_on_upload=True)
    print("STARTING TO DEPLOY", simulation_counter())
    for myapp_index in range(0, DEPLOYMENT_NUMBER):
        if DEPLOYMENT_NUMBER % 200 == 0:
            dev_list = fog_torch()
            dev_list = dev_list_sort(dev_list)
        else:
            dev_list = dev_list_sort(dev_list)

        dep = "dep" + str(myapp_index)
        _, myappId = fd.create_myapp(localapp["localAppId"], dep)

        deviceId = dev_list[0][0]
        code, res = fd.fast_install_app(myappId, [deviceId])
        if code != 400:
            dev_list[0][1] -= 100
            dev_list[0][2] -= 32
        while code == 400:
            fallimento += 1
            deviceId = dev_list[0][0]
            code, res = fd.fast_install_app(myappId, [deviceId])
            if code != 400:
                dev_list[0][1] -= 100
                dev_list[0][2] -= 32
        fd.fast_start_app(myappId)
    print("ENDING TO DEPLOY", simulation_counter())
    while simulation_counter() < 15000:
        _, alerts = fd.get_alerts()
        migrated = []