def sda_manager_apps():
            logging.info("[" + request.method + "] sda manager apps - IN")

            l = list()
            apps = list()
            ret = dict()

            response = requests.get(
                url="http://" + SDAManager().get_sda_manager_ip() + ":" +
                str(Port.sda_manager_port()) + "/api/v1/agents/" +
                SDAManager.get_device_id(),
                timeout=1500)

            if response.status_code is not 200:
                logging.error("SDAM Server Return Error, Error Code(" +
                              str(response.status_code) + ") - OUT")
                abort(500)

            root_path = os.getcwd()
            with open(root_path + "/static/user/apps", 'r') as content_file:
                content = content_file.read()
                if content != "":
                    apps = json.loads(content)["apps"]

            for obj in response.json()["apps"]:
                d = dict()
                d.update({"id": str(obj)})
                response2 = requests.get(
                    url="http://" + SDAManager().get_sda_manager_ip() + ":" +
                    str(Port.sda_manager_port()) + "/api/v1/agents/" +
                    SDAManager.get_device_id() + "/apps/" + str(obj),
                    timeout=1500)

                if response2.status_code is not 200:
                    logging.error("SDAM Server Return Error, Error Code(" +
                                  str(response.status_code) + ") - OUT")
                    abort(500)

                d.update({"services": len(response2.json()["services"])})
                d.update({"state": response2.json()["state"]})

                for app in apps:
                    if "id" in app and app["id"] == str(obj):
                        d.update({"name": app["name"]})

                l.append(d)

            ret.update({
                "device":
                "IP: " + SDAManager.get_device_ip() + ", PORT: " +
                SDAManager.get_device_port(),
                "apps":
                l
            })

            return json.dumps(json.dumps(ret)), 200
        def sda_manager_app():
            logging.info("[" + request.method + "] sda manager app - IN")
            if request.method == "POST":

                l = list()
                ret = dict()

                data = json.loads(request.data)
                SDAManager.set_app_id(data["id"])

                response = requests.get(
                    url="http://" + SDAManager().get_sda_manager_ip() + ":" +
                    str(Port.sda_manager_port()) + "/api/v1/agents/" +
                    SDAManager.get_device_id() + "/apps/" +
                    SDAManager.get_app_id(),
                    timeout=1500)

                if response.status_code is not 200:
                    logging.error("SDAM Server Return Error, Error Code(" +
                                  str(response.status_code) + ") - OUT")
                    abort(500)

                for obj in response.json()["services"]:
                    d = dict()
                    d.update({"name": str(obj["name"])})
                    d.update({"state": str(obj["state"]["Status"])})
                    d.update({"exitcode": str(obj["state"]["ExitCode"])})
                    l.append(d)

                ret.update({"services": l})

                return json.dumps(json.dumps(ret)), 200
            elif request.method == "DELETE":
                response = requests.delete(
                    url="http://" + SDAManager().get_sda_manager_ip() + ":" +
                    str(Port.sda_manager_port()) + "/api/v1/agents/" +
                    SDAManager.get_device_id() + "/apps/" +
                    SDAManager.get_app_id(),
                    timeout=1500)

                if response.status_code is not 200:
                    logging.error("SDAM Server Return Error, Error Code(" +
                                  str(response.status_code) + ") - OUT")
                    abort(500)

                return "", 200
            else:
                return abort(404)
        def sda_manager_app_install():
            logging.info("[" + request.method +
                         "] sda manager app install - IN")

            l = list()
            d = dict()
            data = json.loads(request.data)

            response = requests.post(
                url="http://" + SDAManager().get_sda_manager_ip() + ":" +
                str(Port.sda_manager_port()) + "/api/v1/agents/" +
                SDAManager.get_device_id() + "/deploy",
                data=data["data"],
                timeout=1500)

            if response.status_code is not 200:
                logging.error("SDAM Server Return Error, Error Code(" +
                              str(response.status_code) + ") - OUT")
                abort(500)

            d.update({"id": response.json()["id"], "name": data["name"]})

            root_path = os.getcwd()
            with open(root_path + "/static/user/apps", 'r') as content_file:
                content = content_file.read()
                if content == "":
                    apps = {"apps": l}
                else:
                    apps = json.loads(content)

            with open(root_path + "/static/user/apps", 'w+') as content_file:
                apps["apps"].append(d)
                content_file.write(json.dumps(apps))

            return "", 200
        def sda_manager_device_info():
            logging.info("[" + request.method + "] sda manager device - IN")
            if request.method == "GET":
                d = dict()
                response = requests.get(
                    url="http://" + SDAManager().get_sda_manager_endpoint() +
                    "/api/v1/management/nodes/" + SDAManager.get_device_id() +
                    "/configuration",
                    timeout=1500)

                if response.status_code is not 200:
                    logging.error("SDAM Server Return Error, Error Code(" +
                                  str(response.status_code) + ") - OUT")
                    abort(500)
                if "properties" in response.json():
                    for prop in response.json()["properties"]:
                        if "devicename" in prop:
                            d.update({"name": str(prop["devicename"])})
                        elif "pinginterval" in prop:
                            d.update(
                                {"pinginterval": str(prop["pinginterval"])})

                return json.dumps(d), 200

            elif request.method == "POST":
                response = requests.post(
                    url="http://" + SDAManager().get_sda_manager_endpoint() +
                    "/api/v1/management/nodes/" + SDAManager.get_device_id() +
                    "/configuration",
                    data=request.data,
                    timeout=1500)
                if response.status_code is not 200:
                    logging.error("SDAM Server Return Error, Error Code(" +
                                  str(response.status_code) + ") - OUT")
                    abort(500)
                return "", 200
            else:
                return abort(404)
        def sda_manager_app_yaml():
            logging.info("[" + request.method + "] sda manager app YAML - IN")

            if request.method == "GET":
                d = dict()
                response = requests.get(
                    url="http://" + SDAManager().get_sda_manager_ip() + ":" +
                    str(Port.sda_manager_port()) + "/api/v1/agents/" +
                    SDAManager.get_device_id() + "/apps/" +
                    SDAManager.get_app_id(),
                    timeout=1500)

                if response.status_code is not 200:
                    logging.error("SDAM Server Return Error, Error Code(" +
                                  str(response.status_code) + ") - OUT")
                    abort(500)

                if "description" in response.json():
                    d = response.json()["description"]

                return json.dumps(json.dumps(d)), 200
            elif request.method == "POST":
                data = json.loads(request.data)

                response = requests.post(
                    url="http://" + SDAManager().get_sda_manager_ip() + ":" +
                    str(Port.sda_manager_port()) + "/api/v1/agents/" +
                    SDAManager.get_device_id() + "/apps/" +
                    SDAManager.get_app_id(),
                    data=data["data"],
                    timeout=1500)

                if response.status_code is not 200:
                    logging.error("SDAM Server Return Error, Error Code(" +
                                  str(response.status_code) + ") - OUT")
                    abort(500)

                return "", 200
        def sda_manager_resource():
            logging.info("[" + request.method + "] sda manager resource - IN")
            d = dict()
            response = requests.get(
                url="http://" + SDAManager().get_sda_manager_endpoint() +
                "/api/v1/monitoring/nodes/" + SDAManager.get_device_id() +
                "/resource",
                timeout=1500)
            if response.status_code is not 200:
                logging.error("SDAM Server Return Error, Error Code(" +
                              str(response.status_code) + ") - OUT")
                abort(500)

            d = response.json()
            return json.dumps(d), 200
        def sda_manager_device_unregister():
            logging.info("[" + request.method +
                         "] sda manager device register - IN")

            response = requests.post(
                url="http://" + SDAManager.get_sda_manager_endpoint() +
                "/api/v1/management/nodes/" + SDAManager.get_device_id() +
                "/unregister",
                timeout=1500)

            if response.status_code is not 200:
                logging.error("SDAM Server Return Error, Error Code(" +
                              str(response.status_code) + ") - OUT")
                abort(500)

            return "", 200
        def sda_manager_app_update():
            logging.info("[" + request.method +
                         "] sda manager app update - IN")

            response = requests.post(
                url="http://" + SDAManager().get_sda_manager_ip() + ":" +
                str(Port.sda_manager_port()) + "/api/v1/agents/" +
                SDAManager.get_device_id() + "/apps/" +
                SDAManager.get_app_id() + "/update",
                timeout=1500)

            if response.status_code is not 200:
                logging.error("SDAM Server Return Error, Error Code(" +
                              str(response.status_code) + ") - OUT")
                abort(500)

            return "", 200
        def sda_manager_apps():
            logging.info("[" + request.method + "] sda manager apps - IN")

            l = list()
            apps = list()
            ret = dict()

            response = requests.get(
                url="http://" + SDAManager().get_sda_manager_endpoint() +
                "/api/v1/management/nodes/" + SDAManager.get_device_id(),
                timeout=1500)

            if response.status_code is not 200:
                logging.error("SDAM Server Return Error, Error Code(" +
                              str(response.status_code) + ") - OUT")
                abort(500)

            root_path = os.getcwd()

            if not os.path.exists(root_path + "/static/user/apps"):
                with open(root_path + "/static/user/apps", 'w'):
                    pass

            with open(root_path + "/static/user/apps", 'r') as content_file:
                content = content_file.read()
                if content != "":
                    apps = json.loads(content)["apps"]

            for obj in response.json()["apps"]:
                d = dict()
                d.update({"id": str(obj)})
                response2 = requests.get(
                    url="http://" + SDAManager().get_sda_manager_endpoint() +
                    "/api/v1/management/nodes/" + SDAManager.get_device_id() +
                    "/apps/" + str(obj),
                    timeout=1500)

                if response2.status_code is not 200:
                    logging.error("SDAM Server Return Error, Error Code(" +
                                  str(response.status_code) + ") - OUT")
                    abort(500)

                d.update({"services": len(response2.json()["services"])})
                d.update({"state": response2.json()["state"]})

                for app in apps:
                    if "id" in app and app["id"] == str(obj):
                        d.update({"name": app["name"]})

                l.append(d)
            response3 = requests.get(
                url="http://" + SDAManager().get_sda_manager_endpoint() +
                "/api/v1/management/nodes/" + SDAManager.get_device_id() +
                "/configuration",
                timeout=1500)
            if response3.status_code is not 200:
                logging.error("SDAM Server Return Error, Error Code(" +
                              str(response.status_code) + ") - OUT")
                abort(500)

            if "properties" in response3.json():
                for prop in response3.json()["properties"]:
                    if "devicename" in prop:
                        device_name = str(prop["devicename"])
                        ret.update({
                            "device":
                            device_name + "(" + SDAManager.get_device_ip() +
                            ")",
                            "apps":
                            l
                        })

            return json.dumps(json.dumps(ret)), 200