{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# How to develop a MEC application using the MEC Sandbox HTTP REST API\n",
"This tutorial introduces the step by step procedure to create a basic MEC appcation following ETSI MEC standards.\n",
"It uses the ETSI MEC Sandbox simulator.\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## What is a MEC application\n",
"\n",
"See [The Wiki MEC web site](https://www.etsi.org/technologies/multi-access-edge-computing)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## The basics of developing a MEC application\n",
"\n",
"The developement of a MEC application follows a strict process in order to access the ETSI MEC services and provides valuable services to the customers.\n",
"Mainly, this process can be split in several steps:\n",
"1. Global initializations (constant, variables...)\n",
"2. Create a new instance of a MEC Sandbox (Note that using an existing one could be a solution too (see Annex A)\n",
"3. Activate a network scenario in order to access the ETSI MEC services\n",
"4. Create a new application identifier\n",
"5. Register our MEC application and subscribe to service termination (see MEC 011)\n",
"6. Use MEC services in order to provide valuable services to the customers\n",
" 6.1. Apply MEC services required subscriptions (e.g. MEC 013 location subscription)\n",
"7. Terminate the MEC application\n",
" 7.1. Remove MEC services subscriptions\n",
" 7.2. Deactivate the current network scenario\n",
" 7.3. Delete the instance of the MEC Sandbox\n",
"8. Release all the MEC application resources\n",
"\n",
"NOTE: Several application identifier can be created to address several MEC applications\n",
"\n",
"## Use the MEC Sandbox HTTP REST API models and code\n",
"\n",
"The MEC sandbox provides a piece of code (the python sub) that shall be used to develop the MEC application and interact with the MEC Sandbox. This piece of code mainly contains swagger models to serialize/deserialize JSON data structures and HTTP REST API call functions.\n",
"The openApi file is availabe [here](https://forge.etsi.org/rep/mec/AdvantEDGE/-/blob/Task2_PoC/go-apps/meep-sandbox-sandbox_api/sandbox_api/swagger.yaml) and the [Swagger editor](https://editor-next.swagger.io/) is used to generate the python sub.\n",
"\n",
"The project architecture is describe [here](images/project_arch.jpg).\n",
"\n",
"The sandbox_api folder contains the python implementation of the HTTP REST API definitions introduced by the openApi [file](https://forge.etsi.org/rep/mec/AdvantEDGE/-/blob/Task2_PoC/go-apps/meep-sandbox-sandbox_api/sandbox_api/swagger.yaml).\n",
"The model folder contains the python implementation of the data type definitions introduced by the openApi [file](https://forge.etsi.org/rep/mec/AdvantEDGE/-/blob/Task2_PoC/go-apps/meep-sandbox-sandbox_api/sandbox_api/swagger.yaml).\n",
"directory:"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Before going to create our MEC application skeleton, the following steps shall be done:\n",
"1) Change the working directory (see the project architecture)"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/home/yann/dev/jupyter/Sandbox/mecapp\n"
]
}
],
"source": [
"import os\n",
"os.chdir(os.path.join(os.getcwd(), '../mecapp'))\n",
"print(os.getcwd())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"2) Apply the python imports"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"from __future__ import division # Import floating-point division (1/4=0.25) instead of Euclidian division (1/4=0)\n",
"\n",
"import os\n",
"import sys\n",
"import re\n",
"import logging\n",
"import threading\n",
"import time\n",
"import json\n",
"import uuid\n",
"\n",
"import pprint\n",
"\n",
"import six\n",
"\n",
"import swagger_client\n",
"from swagger_client.rest import ApiException\n",
"\n",
"from http import HTTPStatus\n",
"from http.server import BaseHTTPRequestHandler, HTTPServer\n",
"\n",
"try:\n",
" import urllib3\n",
"except ImportError:\n",
" raise ImportError('Swagger python client requires urllib3.')\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"3) Initialize of the global constants (cell 3)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"MEC_SANDBOX_URL = 'https://mec-platform2.etsi.org' # MEC Sandbox host/base URL\n",
"MEC_SANDBOX_API_URL = 'https://mec-platform2.etsi.org/sandbox-api/v1' # MEC Sandbox API host/base URL\n",
"PROVIDER = 'Jupyter2024' # Login provider value - To skip authorization: 'github'\n",
"MEC_PLTF = 'mep1' # MEC plateform name. Linked to the network scenario\n",
"LOGGER_FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s' # Logging format\n",
"STABLE_TIME_OUT = 6 # Timer to wait for MEC Sndbox reaches its stable state (K8S pods in running state)\n",
"LOGIN_TIMEOUT = 3 #30 # Timer to wait for user to authorize from GITHUB\n",
"LISTENER_IP = '0.0.0.0' # Listener IPv4 address for notification callback calls\n",
"LISTENER_PORT = 32100 # Listener IPv4 port for notification callback calls\n",
"CALLBACK_URI = \"https://yanngarcia.ddns.net/jupyter/sandbox/demo6/v1/\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"4) Setup the logger instance and the HTTP REST API (cell 4)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"# Initialize the logger\n",
"logger = logging.getLogger(__name__)\n",
"logger.setLevel(logging.DEBUG)\n",
"logging.basicConfig(filename='/tmp/' + time.strftime('%Y%m%d-%H%M%S') + '.log')\n",
"l = logging.StreamHandler()\n",
"l.setFormatter(logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s'))\n",
"logger.addHandler(l)\n",
"\n",
"# Setup the HTTP REST API configuration to be used to send request to MEC Sandbox API \n",
"configuration = swagger_client.Configuration()\n",
"configuration.host = MEC_SANDBOX_API_URL\n",
"configuration.verify_ssl = True\n",
"configuration.debug = True\n",
"configuration.logger_format = LOGGER_FORMAT\n",
"# Create an instance of ApiClient\n",
"sandbox_api = swagger_client.ApiClient(configuration, 'Content-Type', 'application/json')\n",
"\n",
"# Setup the HTTP REST API configuration to be used to send request to MEC Services\n",
"configuration1 = swagger_client.Configuration()\n",
"configuration1.host = MEC_SANDBOX_URL\n",
"configuration1.verify_ssl = True\n",
"configuration1.debug = True\n",
"configuration1.logger_format = LOGGER_FORMAT\n",
"# Create an instance of ApiClient\n",
"service_api = swagger_client.ApiClient(configuration1, 'Content-Type', 'application/json')\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"5) Setup the global variables (cell 5)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"# Initialize the global variables\n",
"nw_scenarios = [] # The list of available network scenarios\n",
"nw_scenario_idx = -1 # The network scenario idx to activate (deactivate)\n",
"app_inst_id = None # The requested application instance identifier"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Create our first MEC application\n",
"\n",
"The first step to develop a MEC application is to create the application skeleton which contains the minimum steps below:\n",
" \n",
"- Login to instanciate a MEC Sandbox\n",
"- Logout to delete a existing MEC Sandbox"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### First steps: the login/logout\n",
"\n",
"Here is the first squeleton with the following sequence:\n",
"- Login\n",
"- Print sandbox identifier\n",
"- Logout\n",
"- Check that logout is effective\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### The login function\n",
"\n",
"To log to the MEC Sandbox, \n",
"the login process is done in two step. In step 1, a user code is requested to GITHUB. In step 2, the user has to enter this user code to https://github.com/login/device and proceed to the authorization.\n",
"Please, pay attention to the log '=======================> DO AUTHORIZATION WITH CODE :' which indicates you the user code to use for the authorization.\n",
"\n",
"It uses the HTTP POST request with the URL 'POST /sandbox-sandbox_api/v1/login?provide=github' (see PROVIDER constant).\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"# Login\n",
"def process_login() -> str:\n",
" \"\"\"\n",
" Authenticate and create a new MEC Sandbox instance.\n",
"\n",
" :return: The sandbox instance identifier on success, None otherwise\n",
" \"\"\" \n",
"\n",
" global PROVIDER, logger\n",
"\n",
" logger.debug('>>> process_login')\n",
"\n",
" try:\n",
" auth = swagger_client.AuthorizationApi(sandbox_api)\n",
" oauth = auth.login(PROVIDER, async_req = False)\n",
" logger.debug('process_login (step1): oauth: ' + str(oauth))\n",
" # Wait for the MEC Sandbox is running\n",
" logger.debug('=======================> DO AUTHORIZATION WITH CODE : ' + oauth.user_code)\n",
" logger.debug('=======================> DO AUTHORIZATION HERE : ' + oauth.verification_uri)\n",
" if oauth.verification_uri == \"\":\n",
" time.sleep(LOGIN_TIMEOUT) # Skip scecurity, wait for a few seconds\n",
" else:\n",
" time.sleep(10 * LOGIN_TIMEOUT) # Wait for Authirization from user side\n",
" namespace = auth.get_namespace(oauth.user_code)\n",
" logger.debug('process_login (step2): result: ' + str(namespace))\n",
" return namespace.sandbox_name\n",
" except ApiException as e:\n",
" logger.error('Exception when calling AuthorizationApi->login: %s\\n' % e)\n",
"\n",
" return None\n",
" # End of function process_login\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### The logout function\n",
"\n",
"It uses the HTTP POST request with the URL 'POST /sandbox-sandbox_api/v1/logout?sandbox_name={sandbox_name}'.\n"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"# Logout\n",
"def process_logout(sandbox: str) -> int:\n",
" \"\"\"\n",
" Delete the specified MEC Sandbox instance.\n",
"\n",
" :param sandbox: The MEC Sandbox to delete\n",
" :return: 0 on success, -1 otherwise\n",
" \"\"\"\n",
"\n",
" global logger\n",
"\n",
" logger.debug('>>> process_logout: sandbox=' + sandbox)\n",
"\n",
" try:\n",
" auth = swagger_client.AuthorizationApi(sandbox_api)\n",
" result = auth.logout(sandbox, async_req = False) # noqa: E501\n",
" return 0\n",
" except ApiException as e:\n",
" logger.error('Exception when calling AuthorizationApi->logout: %s\\n' % e)\n",
" return -1\n",
" # End of function process_logout\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now, let put in action our Login/Logout functions:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def process_main():\n",
" \"\"\"\n",
" This is the skeleton of our MEC application:\n",
" - Login\n",
" - Print sandbox identifier\n",
" - Logout\n",
" - Check that logout is effective\n",
" This skeleton will be the bas of the next sprint in order to achieve a full implementation of a MEC application\n",
" \"\"\" \n",
"\n",
" global logger\n",
"\n",
" logger.debug('Starting at ' + time.strftime('%Y%m%d-%H%M%S'))\n",
" logger.debug('\\t pwd= ' + os.getcwd())\n",
"\n",
" # Login\n",
" sandbox = process_login()\n",
" if sandbox is None:\n",
" return\n",
"\n",
" # Print sandbox identifier\n",
" logger.info('Sandbox created: ' + sandbox)\n",
" # Wait for the MEC Sandbox is running\n",
" time.sleep(STABLE_TIME_OUT) # Wait for k8s pods up and running\n",
"\n",
" # Logout\n",
" process_logout(sandbox)\n",
"\n",
" # Check that logout is effective\n",
" logger.debug('To check that logout is effective, verify on the MEC Sandbox server that the MEC Sandbox is removed (kubectl get pods -A)')\n",
" \n",
" logger.debug('Stopped at ' + time.strftime('%Y%m%d-%H%M%S'))\n",
" # End of function process_main\n",
"\n",
"if __name__ == '__main__':\n",
" process_main()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Second step: Retrieve the list of network scenarios\n",
"\n",
"Let's go futhur and see how we can retrieve the list of the network scenarios available in order to activate one of them and access the MEC services exposed such as MEC 013 or MEC 030.\n",
"\n",
"The sequence will be:\n",
"- Login\n",
"- Print sandbox identifier\n",
"- Print available network scenarios\n",
"- Logout\n",
"- Check that logout is effective\n",
"\n",
"The login and logout functions are described in cell 3 and 4.\n",
"\n",
"To retrieve the list of the network scenarios, let's create a new function called 'get_network_scenarios'. It uses the HTTP GET request with the URL '/sandbox-sandbox_api/v1/sandboxNetworkScenarios?sandbox_name={sandbox_name}'."
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"def get_network_scenarios(sandbox: str) -> list:\n",
" \"\"\"\n",
" Retrieve the list of the available network scenarios.\n",
"\n",
" :param sandbox: The MEC Sandbox instance to use\n",
" :return: The list of the available network scenarios on success, None otherwise\n",
" \"\"\"\n",
"\n",
" global PROVIDER, logger, configuration\n",
"\n",
" logger.debug('>>> get_network_scenarios: sandbox=' + sandbox)\n",
"\n",
" try:\n",
" nw = swagger_client.SandboxNetworkScenariosApi(sandbox_api)\n",
" result = nw.sandbox_network_scenarios_get(sandbox, async_req = False) # noqa: E501\n",
" logger.debug('get_network_scenarios: result: ' + str(result))\n",
" return result\n",
" except ApiException as e:\n",
" logger.error('Exception when calling SandboxNetworkScenariosApi->sandbox_network_scenarios_get: %s\\n' % e)\n",
"\n",
" return None\n",
" # End of function get_network_scenarios\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Putting everything together:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def process_main():\n",
" \"\"\"\n",
" This is the first sprint of our skeleton of our MEC application:\n",
" - Login\n",
" - Print sandbox identifier\n",
" - Print available network scenarios\n",
" - Logout\n",
" - Check that logout is effective\n",
" \"\"\" \n",
" global logger, nw_scenarios \n",
"\n",
" logger.debug('Starting at ' + time.strftime('%Y%m%d-%H%M%S'))\n",
" logger.debug('\\t pwd= ' + os.getcwd())\n",
"\n",
" # Login\n",
" sandbox = process_login()\n",
" if sandbox is None:\n",
" logger.error('Failed to instanciate a MEC Sandbox')\n",
" return\n",
"\n",
" # Print sandbox identifier\n",
" logger.info('Sandbox created: ' + sandbox)\n",
" # Wait for the MEC Sandbox is running\n",
" time.sleep(STABLE_TIME_OUT) # Wait for k8s pods up and running\n",
"\n",
" # Print available network scenarios\n",
" nw_scenarios = get_network_scenarios(sandbox)\n",
" if nw_scenarios is None:\n",
" logger.error('Failed to retrieve the list of network scenarios')\n",
" elif len(nw_scenarios) != 0:\n",
" logger.info('nw_scenarios: %s', str(type(nw_scenarios[0])))\n",
" logger.info('nw_scenarios: %s', str(nw_scenarios))\n",
" else:\n",
" logger.info('nw_scenarios: No scenario available')\n",
"\n",
" # Logout\n",
" process_logout(sandbox)\n",
"\n",
" # Check that logout is effective\n",
" logger.debug('To check that logout is effective, verify on the MEC Sandbox server that the MEC Sandbox is removed (kubectl get pods -A)')\n",
" \n",
" logger.debug('Stopped at ' + time.strftime('%Y%m%d-%H%M%S'))\n",
" # End of function process_main\n",
"\n",
"if __name__ == '__main__':\n",
" process_main()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Third step: Activate and deactivate a network scenario\n",
"\n",
"Having a list of network scenarion, the next step is to actvate (and deactivate) a network scenario. This step is mandatory to create a new application instance id and access the MEC services.\n",
"\n",
"In this section, we will arbitrary activate the network scenario called '4g-5g-macro-v2x', which is at the index 0 of the nw_scenarios. "
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"def select_network_scenario_based_on_criteria(criterias_list: list) -> int:\n",
" \"\"\"\n",
" Select the network scenario to activate based of the provided list of criterias.\n",
"\n",
" :param criterias_list: The list of criterias to select the correct network scenario\n",
" :return: 0 on success, -1 otherwise\n",
" \"\"\"\n",
" return 0 # The index of the '4g-5g-macro-v2x' network scenario - Hard coded"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### The activate function\n",
"\n",
"The process to activate a scenario is based on an HTTP POST request with the URL '/sandboxNetworkScenarios/{sandbox_name}?network_scenario_id={network_scenario_id}'.\n"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"def activate_network_scenario(sandbox: str) -> int:\n",
" \"\"\"\n",
" Activate the specified network scenario.\n",
"\n",
" :param sandbox: The MEC Sandbox instance to use\n",
" :return: 0 on success, -1 otherwise\n",
" \"\"\"\n",
"\n",
" global logger, configuration, nw_scenarios, nw_scenario_idx\n",
"\n",
" logger.debug('>>> activate_network_scenario: ' + sandbox)\n",
"\n",
" nw_scenario_idx = select_network_scenario_based_on_criteria([])\n",
" if nw_scenario_idx == -1:\n",
" logger.error('activate_network_scenario: Failed to select a network scenarion')\n",
" return -1\n",
"\n",
" try:\n",
" nw = swagger_client.SandboxNetworkScenariosApi(sandbox_api)\n",
" nw.sandbox_network_scenario_post(sandbox, nw_scenarios[nw_scenario_idx].id, async_req = False) # noqa: E501\n",
" return 0\n",
" except ApiException as e:\n",
" logger.error('Exception when calling SandboxNetworkScenariosApi->activate_network_scenario: %s\\n' % e)\n",
"\n",
" return -1\n",
" # End of function activate_network_scenario\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### The deactivate function\n",
"\n",
"The process to deactivate a scenario is based on an HTTP DELETE request with the URL '/sandboxNetworkScenarios/{sandbox_name}?network_scenario_id={network_scenario_id}'.\n"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
"def deactivate_network_scenario(sandbox: str) -> int:\n",
" \"\"\"\n",
" Deactivate the current network scenario.\n",
"\n",
" :param sandbox: The MEC Sandbox instance to use\n",
" :return: 0 on success, -1 otherwise\n",
" \"\"\"\n",
"\n",
" global MEC_SANDBOX_API_URL, logger, configuration, nw_scenarios, nw_scenario_idx\n",
"\n",
" logger.debug('>>> deactivate_network_scenario: ' + sandbox)\n",
"\n",
" try:\n",
" nw = swagger_client.SandboxNetworkScenariosApi(sandbox_api)\n",
" nw.sandbox_network_scenario_delete(sandbox, nw_scenarios[nw_scenario_idx].id, async_req = False) # noqa: E501\n",
" return 0\n",
" except ApiException as e:\n",
" logger.error('Exception when calling SandboxNetworkScenariosApi->deactivate_network_scenario: %s\\n' % e)\n",
"\n",
" return -1\n",
" # End of function deactivate_network_scenario\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now, it is time to create the second iteration of our MEC application.\n",
"\n",
"The sequence is the following:\n",
"- Login\n",
"- Print sandbox identifier\n",
"- Print available network scenarios\n",
"- Activate a network scenario\n",
"- Check that the network scenario is activated and the MEC services are running\n",
"- Deactivate a network scenario\n",
"- Logout\n",
"- Check that logout is effective\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def process_main():\n",
" \"\"\"\n",
" This is the second sprint of our skeleton of our MEC application:\n",
" - Login\n",
" - Print sandbox identifier\n",
" - Print available network scenarios\n",
" - Activate a network scenario\n",
" - Check that the network scenario is activated and the MEC services are running\n",
" - Deactivate a network scenario\n",
" - Logout\n",
" - Check that logout is effective\n",
" \"\"\" \n",
" global logger, nw_scenarios \n",
"\n",
" logger.debug('Starting at ' + time.strftime('%Y%m%d-%H%M%S'))\n",
" logger.debug('\\t pwd= ' + os.getcwd())\n",
"\n",
" # Login\n",
" sandbox = process_login()\n",
" if sandbox is None:\n",
" logger.error('Failed to instanciate a MEC Sandbox')\n",
" return\n",
"\n",
" # Print sandbox identifier\n",
" logger.info('Sandbox created: ' + sandbox)\n",
" # Wait for the MEC Sandbox is running\n",
" time.sleep(STABLE_TIME_OUT) # Wait for k8s pods up and running\n",
"\n",
" # Print available network scenarios\n",
" nw_scenarios = get_network_scenarios(sandbox)\n",
" if nw_scenarios is None:\n",
" logger.error('Failed to retrieve the list of network scenarios')\n",
" elif len(nw_scenarios) != 0:\n",
" logger.info('nw_scenarios: %s', str(type(nw_scenarios[0])))\n",
" logger.info('nw_scenarios: %s', str(nw_scenarios))\n",
" # Wait for the MEC Sandbox is running\n",
" time.sleep(STABLE_TIME_OUT) # Wait for k8s pods up and running\n",
" else:\n",
" logger.info('nw_scenarios: No scenario available')\n",
"\n",
" # Activate a network scenario based on a list of criterias (hard coded!!!)\n",
" if activate_network_scenario(sandbox) == -1:\n",
" logger.error('Failed to activate network scenario')\n",
" else:\n",
" logger.info('Network scenario activated: ' + nw_scenarios[nw_scenario_idx].id)\n",
" # Wait for the MEC services are running\n",
" time.sleep(2 * STABLE_TIME_OUT) # Wait for k8s pods up and running\n",
"\n",
" # Check that the network scenario is activated and the MEC services are running \n",
" logger.info('To check that the network scenario is activated, verify on the MEC Sandbox server that the MEC services are running (kubectl get pods -A)')\n",
" time.sleep(30) # Sleep for 30 seconds\n",
"\n",
" # Deactivate a network scenario based on a list of criterias (hard coded!!!)\n",
" if deactivate_network_scenario(sandbox) == -1:\n",
" logger.error('Failed to deactivate network scenario')\n",
" else:\n",
" logger.info('Network scenario deactivated: ' + nw_scenarios[nw_scenario_idx].id)\n",
" # Wait for the MEC services are terminated\n",
" time.sleep(2 * STABLE_TIME_OUT)\n",
"\n",
" # Logout\n",
" process_logout(sandbox)\n",
"\n",
" # Check that logout is effective\n",
" logger.debug('To check that logout is effective, verify on the MEC Sandbox server that the MEC Sandbox is removed (kubectl get pods -A)')\n",
" \n",
" logger.debug('Stopped at ' + time.strftime('%Y%m%d-%H%M%S'))\n",
" # End of function process_main\n",
"\n",
"if __name__ == '__main__':\n",
" process_main()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Fourth step: Create and delete an appliction instance id\n",
"\n",
"To enable our MEC application to be part of the activated network scenario, we need to request the MEC sandbox to create a new application instance identifier. Our MEC application will use this identifier to register to the MEC Sandbox according to MEC 011.\n",
"\n",
"#### The appliction instance id creation function\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"def request_application_instance_id(sandbox: str) -> swagger_client.models.ApplicationInfo:\n",
" \"\"\"\n",
" \"\"\"\n",
"\n",
" global MEC_PLTF, logger, configuration\n",
"\n",
" logger.debug('>>> request_application_instance_id: ' + sandbox)\n",
"\n",
" # Create a instance of our MEC application\n",
" a = swagger_client.models.ApplicationInfo(id=str(uuid.uuid4()), name='JupyterMecApp', node_name=MEC_PLTF, type='USER') # noqa: E501\n",
" print(a)\n",
" \n",
" try:\n",
" nw = swagger_client.SandboxAppInstancesApi(sandbox_api)\n",
" result = nw.sandbox_app_instances_post(a, sandbox, async_req = False) # noqa: E501\n",
" logger.debug('request_application_instance_id: result: ' + str(result))\n",
" return result\n",
" except ApiException as e:\n",
" logger.error('Exception when calling SandboxAppInstancesApi->sandbox_app_instances_post: %s\\n' % e)\n",
"\n",
" return None\n",
" # End of function request_application_instance_id"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### The appliction instance id deletion function"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
"def delete_application_instance_id(sandbox: str, id: str) -> int:\n",
" \"\"\"\n",
" \"\"\"\n",
"\n",
" global logger, configuration\n",
"\n",
" logger.debug('>>> delete_application_instance_id: ' + sandbox)\n",
" logger.debug('>>> delete_application_instance_id: ' + id)\n",
"\n",
" try:\n",
" nw = swagger_client.SandboxAppInstancesApi(sandbox_api)\n",
" result = nw.sandbox_app_instances_delete(sandbox, id, async_req = False) # noqa: E501\n",
" return result\n",
" except ApiException as e:\n",
" logger.error('Exception when calling SandboxAppInstancesApi->sandbox_app_instances_delete: %s\\n' % e)\n",
"\n",
" return -1\n",
" # End of function deletet_application_instance_id"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Getting the list of applications"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"def get_applications_list(sandbox: str) -> list:\n",
" \"\"\"\n",
" \"\"\"\n",
"\n",
" global MEC_SANDBOX_API_URL, logger, configuration\n",
"\n",
" logger.debug('>>> get_applications_list: ' + sandbox)\n",
"\n",
" try:\n",
" nw = swagger_client.SandboxAppInstancesApi(sandbox_api)\n",
" result = nw.sandbox_app_instances_get(sandbox, async_req = False) # noqa: E501\n",
" logger.debug('get_applications_list: result: ' + str(result))\n",
" return result\n",
" except ApiException as e:\n",
" logger.error('Exception when calling SandboxAppInstancesApi->get_applications_list: %s\\n' % e)\n",
"\n",
" return None \n",
" # End of function delete_application_instance_id"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"It is time now to create the our third iteration of our MEC application.\n",
"\n",
"The sequence is the following:\n",
"- Login\n",
"- Print sandbox identifier\n",
"- Print available network scenarios\n",
"- Activate a network scenario\n",
"- Request for a new application instance identifier\n",
"- Retrieve the list of the applications instance identifier\n",
"- Check the demo application is present in the list of applications\n",
"- Delete our application instance identifier\n",
"- Deactivate a network scenario\n",
"- Logout\n",
"- Check that logout is effective\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def process_main():\n",
" \"\"\"\n",
" This is the second sprint of our skeleton of our MEC application:\n",
" - Login\n",
" - Print sandbox identifier\n",
" - Print available network scenarios\n",
" - Activate a network scenario\n",
" - Request for a new application instance identifier\n",
" - Retrieve the list of the applications instance identifier\n",
" - Check the demo application is present in the list of applications\n",
" - Deactivate a network scenario\n",
" - Logout\n",
" - Check that logout is effective\n",
" \"\"\" \n",
" global logger, nw_scenarios\n",
"\n",
" logger.debug('Starting at ' + time.strftime('%Y%m%d-%H%M%S'))\n",
" logger.debug('\\t pwd= ' + os.getcwd())\n",
"\n",
" # Login\n",
" sandbox = process_login()\n",
" if sandbox is None:\n",
" logger.error('Failed to instanciate a MEC Sandbox')\n",
" return\n",
"\n",
" # Print sandbox identifier\n",
" logger.info('Sandbox created: ' + sandbox)\n",
" # Wait for the MEC Sandbox is running\n",
" time.sleep(STABLE_TIME_OUT) # Wait for k8s pods up and running\n",
"\n",
" # Print available network scenarios\n",
" nw_scenarios = get_network_scenarios(sandbox)\n",
" if nw_scenarios is None:\n",
" logger.error('Failed to retrieve the list of network scenarios')\n",
" elif len(nw_scenarios) != 0:\n",
" logger.info('nw_scenarios: %s', str(type(nw_scenarios[0])))\n",
" logger.info('nw_scenarios: %s', str(nw_scenarios))\n",
" # Wait for the MEC Sandbox is running\n",
" time.sleep(STABLE_TIME_OUT) # Wait for k8s pods up and running\n",
" else:\n",
" logger.info('nw_scenarios: No scenario available')\n",
"\n",
" # Activate a network scenario based on a list of criterias (hard coded!!!)\n",
" if activate_network_scenario(sandbox) == -1:\n",
" logger.error('Failed to activate network scenario')\n",
" else:\n",
" logger.info('Network scenario activated: ' + nw_scenarios[nw_scenario_idx].id)\n",
" # Wait for the MEC services are running\n",
" time.sleep(2 * STABLE_TIME_OUT) # Wait for k8s pods up and running\n",
"\n",
" # Request for a new application instance identifier\n",
" app_inst_id = request_application_instance_id(sandbox)\n",
" if app_inst_id == None:\n",
" logger.error('Failed to request an application instance identifier')\n",
" else:\n",
" logger.info('app_inst_id: %s', str(type(app_inst_id)))\n",
" logger.info('app_inst_id: %s', str(app_inst_id))\n",
"\n",
" # Check the demo application is present in the list of applications\n",
" app_list = get_applications_list(sandbox)\n",
" if app_list is None:\n",
" logger.error('Failed to request the list of applications')\n",
" else:\n",
" logger.info('app_list: %s', str(type(app_list)))\n",
" logger.info('app_list: %s', str(app_list))\n",
" # Check if our application is present in the list of applications\n",
" found = False\n",
" for item in app_list:\n",
" if item.id == app_inst_id.id:\n",
" found = True\n",
" break\n",
" if not found:\n",
" logger.error('Failed to retrieve our application instance identifier')\n",
"\n",
" # Delete the application instance identifier\n",
" if delete_application_instance_id(sandbox, app_inst_id.id) == -1:\n",
" logger.error('Failed to delete the application instance identifier')\n",
" else:\n",
" logger.info('app_inst_id deleted: ' + app_inst_id.id)\n",
"\n",
" # Deactivate a network scenario based on a list of criterias (hard coded!!!)\n",
" if deactivate_network_scenario(sandbox) == -1:\n",
" logger.error('Failed to deactivate network scenario')\n",
" else:\n",
" logger.info('Network scenario deactivated: ' + nw_scenarios[nw_scenario_idx].id)\n",
" # Wait for the MEC services are terminated\n",
" time.sleep(2 * STABLE_TIME_OUT)\n",
"\n",
" # Logout\n",
" process_logout(sandbox)\n",
"\n",
" # Check that logout is effective\n",
" logger.debug('To check that logout is effective, verify on the MEC Sandbox server that the MEC Sandbox is removed (kubectl get pods -A)')\n",
" \n",
" logger.debug('Stopped at ' + time.strftime('%Y%m%d-%H%M%S'))\n",
" # End of function process_main\n",
"\n",
"if __name__ == '__main__':\n",
" process_main()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## MEC Registration and the READY confirmation\n",
"\n",
"Having an application instance identifier allows us to register with the MEC Sandbox and interact with it (e.g. to send service queries, to subscribe to events and to recieve notifications...).\n",
"\n",
"The standard MEC 011 Clause 5.2.2 MEC application start-up describes the start up process. Basically, our MEC application has to:\n",
"1. Indicates that it is running by sending a Confirm Ready message\n",
"2. Retrieve the list of MEC services \n",
"\n",
"To do so, a MEC application needs to be able to send requests but also to receive notifications (POST requests) and to reply to them."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Fifth step: Send the READY confirmation\n",
"\n",
"Sending READY confirmation is described by MEC 011 Clause 5.2.2 MEC application start-up.\n"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"def send_ready_confirmation(sandbox_name: str, app_inst_id: swagger_client.models.application_info.ApplicationInfo) -> int:\n",
" global MEC_PLTF, logger\n",
"\n",
" logger.debug('>>> send_ready_confirmation: ' + app_inst_id.id)\n",
" try:\n",
" url = '/{sandbox_name}/{mec_pltf}/mec_app_support/v2/applications/{app_inst_id}/confirm_ready'\n",
" logger.debug('send_ready_confirmation: url: ' + url)\n",
" path_params = {}\n",
" path_params['sandbox_name'] = sandbox_name\n",
" path_params['mec_pltf'] = MEC_PLTF\n",
" path_params['app_inst_id'] = app_inst_id.id\n",
" header_params = {}\n",
" # HTTP header `Accept`\n",
" header_params['Accept'] = 'application/json' # noqa: E501\n",
" # HTTP header `Content-Type`\n",
" header_params['Content-Type'] = 'application/json' # noqa: E501\n",
" # JSON indication READY\n",
" dict_body = {}\n",
" dict_body['indication'] = 'READY'\n",
" result = service_api.call_api(url, 'POST', header_params=header_params, path_params = path_params, body=dict_body, async_req=False)\n",
" return 0\n",
" except ApiException as e:\n",
" logger.error('Exception when calling call_api: %s\\n' % e)\n",
" return -1\n",
" # End of function send_ready_confirmation"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In addition, our MEC application is registering to AppTerminationNotificationSubscription and it needs to delete its subscription when terminating.\n",
"\n",
"At this stage, it is important to note that all subscription deletion use the same format: / (see ETSI MEC GS 003 [16]). \n",
"In this case, it the AppTerminationNotificationSubscription is 'sub-1234', the URIs to do the susbscription and to delete it are:\n",
"- MEC_SANDBOX_URL + '/' + sandbox_name + '/' + MEC_PLTF + '/mec_app_support/v2/applications/' + app_inst_id + '/subscriptions'\n",
"- MEC_SANDBOX_URL + '/' + sandbox_name + '/' + MEC_PLTF + '/mec_app_support/v2/applications/' + app_inst_id + '/subscriptions/sub-1234'\n",
"\n",
"So, it will be usefull to create a small function to extract the subscription identifier from either the HTTP Location header or from the Link field found into the reponse body data structure. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Subscribing to application termination"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
"def send_subscribe_termination(sandbox_name: str, app_inst_id: swagger_client.models.application_info.ApplicationInfo) -> int:\n",
" global MEC_PLTF, logger\n",
"\n",
" logger.debug('>>> send_subscribe_termination: ' + app_inst_id.id)\n",
" try:\n",
" url = '/{sandbox_name}/{mec_pltf}/mec_app_support/v2/applications/{app_inst_id}/subscriptions'\n",
" logger.debug('send_subscribe_termination: url: ' + url)\n",
" path_params = {}\n",
" path_params['sandbox_name'] = sandbox_name\n",
" path_params['mec_pltf'] = MEC_PLTF\n",
" path_params['app_inst_id'] = app_inst_id.id\n",
" header_params = {}\n",
" # HTTP header `Accept`\n",
" header_params['Accept'] = 'application/json' # noqa: E501\n",
" # HTTP header `Content-Type`\n",
" header_params['Content-Type'] = 'application/json' # noqa: E501\n",
" # Body\n",
" dict_body = {}\n",
" dict_body['subscriptionType'] = 'AppTerminationNotificationSubscription'\n",
" dict_body['callbackReference'] = 'http://yanngarcia.ddns.net/mec011/v2/termination' # FIXME To be parameterized\n",
" dict_body['appInstanceId'] = app_inst_id.id\n",
" (result, status, headers) = service_api.call_api(url, 'POST', header_params=header_params, path_params = path_params, body=dict_body, async_req=False)\n",
" return (extract_sub_id(headers['Location']), headers['Location'])\n",
" except ApiException as e:\n",
" logger.error('Exception when calling call_api: %s\\n' % e)\n",
" return None\n",
" # End of function send_subscribe_termination"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Extracting subscription identifier"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
"def extract_sub_id(resource_url: str) -> str:\n",
" global logger\n",
"\n",
" logger.debug('>>> extract_sub_id: resource_url: ' + resource_url)\n",
"\n",
" res = urllib3.util.parse_url(resource_url)\n",
" if res is not None and res.path is not None and res.path != '':\n",
" id = res.path.rsplit('/', 1)[-1]\n",
" if id is not None:\n",
" return id\n",
"\n",
" return None\n",
" # End of function extract_sub_id"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Delete subscription to application termination"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [],
"source": [
"def delete_subscribe_termination(sandbox_name: str, app_inst_id: swagger_client.models.application_info.ApplicationInfo, sub_id: str) -> int:\n",
" global MEC_PLTF, logger\n",
"\n",
" logger.debug('>>> delete_subscribe_termination: ' + app_inst_id.id)\n",
" try:\n",
" url = '/{sandbox_name}/{mec_pltf}/mec_app_support/v2/applications/{app_inst_id}/subscriptions/{sub_id}'\n",
" logger.debug('delete_subscribe_termination: url: ' + url)\n",
" path_params = {}\n",
" path_params['sandbox_name'] = sandbox_name\n",
" path_params['mec_pltf'] = MEC_PLTF\n",
" path_params['app_inst_id'] = app_inst_id.id\n",
" path_params['sub_id'] = sub_id\n",
" header_params = {}\n",
" # HTTP header `Accept`\n",
" header_params['Accept'] = 'application/json' # noqa: E501\n",
" # HTTP header `Content-Type`\n",
" header_params['Content-Type'] = 'application/json' # noqa: E501\n",
" service_api.call_api(url, 'DELETE', header_params=header_params, path_params = path_params, async_req=False)\n",
" return 0\n",
" except ApiException as e:\n",
" logger.error('Exception when calling call_api: %s\\n' % e)\n",
" return -1\n",
" # End of function delete_subscribe_termination"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Now, it is time now to create the our fifth iteration of our MEC application.\n",
"\n",
"The sequence is the following:\n",
"- Login\n",
"- Print sandbox identifier\n",
"- Print available network scenarios\n",
"- Activate a network scenario\n",
"- Request for a new application instance identifier\n",
"- Send READY confirmation\n",
"- Subscribe to AppTerminationNotificationSubscription\n",
"- Check list of services\n",
"- Delete AppTerminationNotification subscription\n",
"- Delete our application instance identifier\n",
"- Deactivate a network scenario\n",
"- Logout\n",
"- Check that logout is effective\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def process_main():\n",
" \"\"\"\n",
" This is the second sprint of our skeleton of our MEC application:\n",
" - Login\n",
" - Print sandbox identifier\n",
" - Print available network scenarios\n",
" - Activate a network scenario\n",
" - Request for a new application instance identifier\n",
" - Send READY confirmation\n",
" \n",
" - Subscribe to AppTermination Notification\n",
" - Send Termination\n",
" - Delete AppTerminationNotification subscription\n",
" - Delete our application instance identifier\n",
" - Deactivate a network scenario\n",
" - Logout\n",
" - Check that logout is effective\n",
" \"\"\" \n",
" global logger, nw_scenarios\n",
"\n",
" logger.debug('Starting at ' + time.strftime('%Y%m%d-%H%M%S'))\n",
" logger.debug('\\t pwd= ' + os.getcwd())\n",
"\n",
" # Login\n",
" sandbox = process_login()\n",
" if sandbox is None:\n",
" logger.error('Failed to instanciate a MEC Sandbox')\n",
" return\n",
"\n",
" # Print sandbox identifier\n",
" logger.info('Sandbox created: ' + sandbox)\n",
" # Wait for the MEC Sandbox is running\n",
" time.sleep(STABLE_TIME_OUT) # Wait for k8s pods up and running\n",
"\n",
" # Print available network scenarios\n",
" nw_scenarios = get_network_scenarios(sandbox)\n",
" if nw_scenarios is None:\n",
" logger.error('Failed to retrieve the list of network scenarios')\n",
" elif len(nw_scenarios) != 0:\n",
" logger.info('nw_scenarios: %s', str(type(nw_scenarios[0])))\n",
" logger.info('nw_scenarios: %s', str(nw_scenarios))\n",
" # Wait for the MEC Sandbox is running\n",
" time.sleep(STABLE_TIME_OUT) # Wait for k8s pods up and running\n",
" else:\n",
" logger.info('nw_scenarios: No scenario available')\n",
"\n",
" # Activate a network scenario based on a list of criterias (hard coded!!!)\n",
" if activate_network_scenario(sandbox) == -1:\n",
" logger.error('Failed to activate network scenario')\n",
" else:\n",
" logger.info('Network scenario activated: ' + nw_scenarios[nw_scenario_idx].id)\n",
" # Wait for the MEC services are running\n",
" time.sleep(2 * STABLE_TIME_OUT) # Wait for k8s pods up and running\n",
"\n",
" # Request for a new application instance identifier\n",
" app_inst_id = request_application_instance_id(sandbox)\n",
" if app_inst_id == None:\n",
" logger.error('Failed to request an application instance identifier')\n",
" else:\n",
" logger.info('app_inst_id: %s', str(app_inst_id))\n",
" time.sleep(STABLE_TIME_OUT)\n",
"\n",
" # Send READY confirmation\n",
" sub_id = None\n",
" if send_ready_confirmation(sandbox, app_inst_id) == -1:\n",
" logger.error('Failed to send confirm_ready')\n",
" else:\n",
" # Subscribe to AppTerminationNotificationSubscription\n",
" sub_id, res_url = send_subscribe_termination(sandbox, app_inst_id)\n",
" if sub_id == None:\n",
" logger.error('Failed to do the subscription')\n",
" else:\n",
" logger.info('sub_id: %s', sub_id)\n",
"\n",
" # Any processing here\n",
" time.sleep(STABLE_TIME_OUT)\n",
"\n",
" # Delete AppTerminationNotification subscription\n",
" if sub_id is not None:\n",
" if delete_subscribe_termination(sandbox, app_inst_id, sub_id) == -1:\n",
" logger.error('Failed to delete the application instance identifier')\n",
" else:\n",
" logger.info('app_inst_id deleted: ' + app_inst_id.id)\n",
"\n",
" # Delete the application instance identifier\n",
" if delete_application_instance_id(sandbox, app_inst_id.id) == -1:\n",
" logger.error('Failed to delete the application instance identifier')\n",
" else:\n",
" logger.info('app_inst_id deleted: ' + app_inst_id.id)\n",
"\n",
" # Deactivate a network scenario based on a list of criterias (hard coded!!!)\n",
" if deactivate_network_scenario(sandbox) == -1:\n",
" logger.error('Failed to deactivate network scenario')\n",
" else:\n",
" logger.info('Network scenario deactivated: ' + nw_scenarios[nw_scenario_idx].id)\n",
" # Wait for the MEC services are terminated\n",
" time.sleep(2 * STABLE_TIME_OUT)\n",
"\n",
" # Logout\n",
" process_logout(sandbox)\n",
"\n",
" # Check that logout is effective\n",
" logger.debug('To check that logout is effective, verify on the MEC Sandbox server that the MEC Sandbox is removed (kubectl get pods -A)')\n",
" \n",
" logger.debug('Stopped at ' + time.strftime('%Y%m%d-%H%M%S'))\n",
" # End of function process_main\n",
"\n",
"if __name__ == '__main__':\n",
" process_main()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Conclusion: Create two procedures for the setup and the termination of our MEC application\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### The procedure for the setup of a MEC application\n",
"\n",
"This function provides the steps to setup a MEC application and to be ready to use the MEC service exposed by the created MEC Sandbox.\n"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"def mec_app_setup():\n",
" \"\"\"\n",
" This function provides the steps to setup a MEC application:\n",
" - Login\n",
" - Print sandbox identifier\n",
" - Print available network scenarios\n",
" - Activate a network scenario\n",
" - Request for a new application instance identifier\n",
" - Send READY confirmation\n",
" - Subscribe to AppTermination Notification\n",
" \"\"\"\n",
" global logger, nw_scenarios\n",
"\n",
" # Login\n",
" sandbox = process_login()\n",
" if sandbox is None:\n",
" logger.error('Failed to instanciate a MEC Sandbox')\n",
" return\n",
" # Wait for the MEC Sandbox is running\n",
" time.sleep(STABLE_TIME_OUT) # Wait for k8s pods up and running\n",
"\n",
" # Print available network scenarios\n",
" nw_scenarios = get_network_scenarios(sandbox)\n",
" if nw_scenarios is None:\n",
" logger.error('Failed to retrieve the list of network scenarios')\n",
" elif len(nw_scenarios) != 0:\n",
" # Wait for the MEC Sandbox is running\n",
" time.sleep(STABLE_TIME_OUT) # Wait for k8s pods up and running\n",
" else:\n",
" logger.info('nw_scenarios: No scenario available')\n",
"\n",
" # Activate a network scenario based on a list of criterias (hard coded!!!)\n",
" if activate_network_scenario(sandbox) == -1:\n",
" logger.error('Failed to activate network scenario')\n",
" else:\n",
" # Wait for the MEC services are running\n",
" time.sleep(2 * STABLE_TIME_OUT) # Wait for k8s pods up and running\n",
"\n",
" # Request for a new application instance identifier\n",
" app_inst_id = request_application_instance_id(sandbox)\n",
" if app_inst_id == None:\n",
" logger.error('Failed to request an application instance identifier')\n",
" else:\n",
" # Wait for the MEC services are terminated\n",
" time.sleep(STABLE_TIME_OUT)\n",
"\n",
" # Send READY confirmation\n",
" sub_id = None\n",
" if send_ready_confirmation(sandbox, app_inst_id) == -1:\n",
" logger.error('Failed to send confirm_ready')\n",
" else:\n",
" # Subscribe to AppTerminationNotificationSubscription\n",
" sub_id, res_url = send_subscribe_termination(sandbox, app_inst_id)\n",
" if sub_id == None:\n",
" logger.error('Failed to do the subscription')\n",
"\n",
" return (sandbox, app_inst_id, sub_id)\n",
" # End of function mec_app_setup"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### The procedure for the termination of a MEC application\n",
"\n",
"This function provides the steps to terminate a MEC application.\n",
"\n",
"NOTE: All subscriptions done outside of the mec_app_setup function are not deleted."
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"def mec_app_termination(sandbox: str, app_inst_id:swagger_client.models.ApplicationInfo, sub_id: str):\n",
" \"\"\"\n",
" This function provides the steps to setup a MEC application:\n",
" - Login\n",
" - Print sandbox identifier\n",
" - Print available network scenarios\n",
" - Activate a network scenario\n",
" - Request for a new application instance identifier\n",
" - Send READY confirmation\n",
" - Subscribe to AppTermination Notification\n",
" \"\"\"\n",
" # Delete AppTerminationNotification subscription\n",
" if sub_id is not None:\n",
" if delete_subscribe_termination(sandbox, app_inst_id, sub_id) == -1:\n",
" logger.error('Failed to delete the application instance identifier')\n",
"\n",
" # Delete the application instance identifier\n",
" if delete_application_instance_id(sandbox, app_inst_id.id) == -1:\n",
" logger.error('Failed to delete the application instance identifier')\n",
" else:\n",
" # Wait for the MEC services are terminated\n",
" time.sleep(STABLE_TIME_OUT)\n",
"\n",
" # Deactivate a network scenario based on a list of criterias (hard coded!!!)\n",
" if deactivate_network_scenario(sandbox) == -1:\n",
" logger.error('Failed to deactivate network scenario')\n",
" else:\n",
" # Wait for the MEC services are terminated\n",
" time.sleep(2 * STABLE_TIME_OUT)\n",
"\n",
" # Logout\n",
" process_logout(sandbox)\n",
"\n",
" # End of function mec_app_termination"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The following cell descrbes the new basic MEC application architecture. It will be used in the rest of this titorial."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def process_main():\n",
" \"\"\"\n",
" This is the second sprint of our skeleton of our MEC application:\n",
" - Mec application setup\n",
" - Get UU unicast provisioning information\n",
" - Mec application termination\n",
" \"\"\" \n",
" global logger, nw_scenarios\n",
"\n",
" logger.debug('Starting at ' + time.strftime('%Y%m%d-%H%M%S'))\n",
" logger.debug('\\t pwd= ' + os.getcwd())\n",
"\n",
" # Setup the MEC application\n",
" (sandbox_name, app_inst_id, sub_id) = mec_app_setup()\n",
"\n",
" # Any processing here\n",
" logger.info('sandbox_name: ' + sandbox_name)\n",
" logger.info('app_inst_id: ' + app_inst_id.id)\n",
" if sub_id is not None:\n",
" logger.info('sub_id: ' + sub_id)\n",
" time.sleep(STABLE_TIME_OUT)\n",
"\n",
" # Terminate the MEC application\n",
" mec_app_termination(sandbox_name, app_inst_id, sub_id)\n",
"\n",
" logger.debug('Stopped at ' + time.strftime('%Y%m%d-%H%M%S'))\n",
" # End of function process_main\n",
"\n",
"if __name__ == '__main__':\n",
" process_main()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Create our second MEC application: how to use MEC Services\n",
"\n",
"After doing the logging, network scenario activation, MEC application instance creation steps, we are ready to exploit the MEC services exposed by the MEC Sandbox.\n",
"\n",
"In this clause, we use the following functionalities provided by MEC-030:\n",
"- Getting UU unicast provisioning information (ETSI GS MEC 030 Clause 5.5.1)\n",
"- Subscribe to the V2X message distribution server (ETSI GS MEC 030 Clause 5.5.7)\n",
"- Delete subscription\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Getting UU unicast provisioning information\n",
"\n",
"The purpose is to query provisioning information for V2X communication over Uu unicast."
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [],
"source": [
"def send_uu_unicast_provisioning_info(sandbox_name: str, ecgi: str) -> str:\n",
" global MEC_PLTF, logger\n",
"\n",
" logger.debug('>>> send_uu_unicast_provisioning_info: ' + ecgi)\n",
" try:\n",
" url = '/{sandbox_name}/{mec_pltf}/vis/v2/queries/uu_unicast_provisioning_info'\n",
" logger.debug('send_uu_unicast_provisioning_info: url: ' + url)\n",
" path_params = {}\n",
" path_params['sandbox_name'] = sandbox_name\n",
" path_params['mec_pltf'] = MEC_PLTF\n",
" query_params = []\n",
" query_params.append(('location_info', 'ecgi,' + ecgi))\n",
" header_params = {}\n",
" # HTTP header `Accept`\n",
" header_params['Accept'] = 'application/json' # noqa: E501\n",
" # HTTP header `Content-Type`\n",
" header_params['Content-Type'] = 'application/json' # noqa: E501\n",
" result = service_api.call_api(url, 'GET', header_params=header_params, path_params=path_params, query_params=query_params, async_req=False)\n",
" return result\n",
" except ApiException as e:\n",
" logger.error('Exception when calling call_api: %s\\n' % e)\n",
" return None\n",
" # End of function send_uu_unicast_provisioning_info"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's create the our second MEC application.\n",
"The sequence is the following:\n",
"- Mec application setup\n",
"- Get UU unicast provisioning information\n",
"- Mec application termination\n",
"\n",
"Note that the UU unicast provisioning information is returned as a JSON string. To de-serialized it into a Python data structure, please refer to clause [Subscribing to V2X message distribution server](#subscribing_to_v2x_message_distribution_server)."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def process_main():\n",
" \"\"\"\n",
" This is the second sprint of our skeleton of our MEC application:\n",
" - Mec application setup\n",
" - Get UU unicast provisioning information\n",
" - Mec application termination\n",
" \"\"\" \n",
" global logger, nw_scenarios\n",
"\n",
" logger.debug('Starting at ' + time.strftime('%Y%m%d-%H%M%S'))\n",
" logger.debug('\\t pwd= ' + os.getcwd())\n",
"\n",
" # Setup the MEC application\n",
" (sandbox_name, app_inst_id, sub_id) = mec_app_setup()\n",
"\n",
" ecgi = \"268708941961,268711972264\" # List of ecgi spearated by a ','\n",
" result = send_uu_unicast_provisioning_info(sandbox_name, ecgi)\n",
" if result is None:\n",
" logger.error('Failed to get UU unicast provisioning information')\n",
" else:\n",
" logger.info('UU unicast provisioning information: ', str(result))\n",
"\n",
" # Terminate the MEC application\n",
" mec_app_termination(sandbox_name, app_inst_id, sub_id)\n",
"\n",
" logger.debug('Stopped at ' + time.strftime('%Y%m%d-%H%M%S'))\n",
" # End of function process_main\n",
"\n",
"if __name__ == '__main__':\n",
" process_main()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Subscribing to V2X message distribution server\n",
"\n",
"Here, we need to come back to the MEC 030 standard to create the type V2xMsgSubscription. It involves the creation of a set of basic types described below.\n",
"\n",
"Note: These new type shall be 'JSON\"serializable. It means that they have to implement the following methods:\n",
"```python\n",
"to_dict()\n",
"to_str()\n",
"__repr__()\n",
"__eq__()\n",
"__ne__()\n",
"```\n",
"`\r\n",
"}\r\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [],
"source": [
"class LinkType(object):\n",
" swagger_types = {'href': 'str'}\n",
" attribute_map = {'href': 'href'}\n",
" def __init__(self, href=None): # noqa: E501\n",
" self._href = href\n",
" @property\n",
" def href(self):\n",
" return self._href\n",
" @href.setter\n",
" def href(self, href):\n",
" self._href = href\n",
" def to_dict(self):\n",
" result = {}\n",
" for attr, _ in six.iteritems(self.swagger_types):\n",
" value = getattr(self, attr)\n",
" if isinstance(value, list):\n",
" result[attr] = list(map(\n",
" lambda x: x.to_dict() if hasattr(x, 'to_dict') else x,\n",
" value\n",
" ))\n",
" elif hasattr(value, 'to_dict'):\n",
" result[attr] = value.to_dict()\n",
" elif isinstance(value, dict):\n",
" result[attr] = dict(map(\n",
" lambda item: (item[0], item[1].to_dict())\n",
" if hasattr(item[1], 'to_dict') else item,\n",
" value.items()\n",
" ))\n",
" else:\n",
" result[attr] = value\n",
" if issubclass(LinkType, dict):\n",
" for key, value in self.items():\n",
" result[key] = value\n",
" return result\n",
" def to_str(self):\n",
" return pprint.pformat(self.to_dict())\n",
" def __repr__(self):\n",
" return self.to_str()\n",
" def __eq__(self, other):\n",
" if not isinstance(other, LinkType):\n",
" return False\n",
" return self.__dict__ == other.__dict__\n",
" def __ne__(self, other):\n",
" return not self == other\n",
"\n",
"class Links(object):\n",
" swagger_types = {'self': 'LinkType'}\n",
" attribute_map = {'self': 'self'}\n",
" def __init__(self, self_=None): # noqa: E501\n",
" self._self = self_\n",
" @property\n",
" def self_(self):\n",
" return self._self\n",
" @self_.setter\n",
" def self_(self, self_):\n",
" self._self = self_\n",
" def to_dict(self):\n",
" result = {}\n",
" for attr, _ in six.iteritems(self.swagger_types):\n",
" value = getattr(self, attr)\n",
" if isinstance(value, list):\n",
" result[attr] = list(map(\n",
" lambda x: x.to_dict() if hasattr(x, 'to_dict') else x,\n",
" value\n",
" ))\n",
" elif hasattr(value, 'to_dict'):\n",
" result[attr] = value.to_dict()\n",
" elif isinstance(value, dict):\n",
" result[attr] = dict(map(\n",
" lambda item: (item[0], item[1].to_dict())\n",
" if hasattr(item[1], 'to_dict') else item,\n",
" value.items()\n",
" ))\n",
" else:\n",
" result[attr] = value\n",
" if issubclass(Links, dict):\n",
" for key, value in self.items():\n",
" result[key] = value\n",
" return result\n",
" def to_str(self):\n",
" return pprint.pformat(self.to_dict())\n",
" def __repr__(self):\n",
" return self.to_str()\n",
" def __eq__(self, other):\n",
" if not isinstance(other, Links):\n",
" return False\n",
" return self.__dict__ == other.__dict__\n",
" def __ne__(self, other):\n",
" return not self == other\n",
"\n",
"class TimeStamp(object):\n",
" swagger_types = {'seconds': 'int', 'nano_seconds': 'int'}\n",
" attribute_map = {'seconds': 'seconds', 'nano_seconds': 'nanoSeconds'}\n",
" def __init__(self, seconds=None, nano_seconds=None): # noqa: E501\n",
" self._seconds = seconds\n",
" self._nano_seconds = nano_seconds\n",
" @property\n",
" def seconds(self):\n",
" return self._seconds\n",
" @seconds.setter\n",
" def seconds(self, seconds):\n",
" self._seconds = seconds\n",
" @property\n",
" def nano_seconds(self):\n",
" return self._nano_seconds\n",
" @nano_seconds.setter\n",
" def nano_seconds(self, nano_seconds):\n",
" self._nano_seconds = nano_seconds\n",
" def to_dict(self):\n",
" result = {}\n",
" for attr, _ in six.iteritems(self.swagger_types):\n",
" value = getattr(self, attr)\n",
" if isinstance(value, list):\n",
" result[attr] = list(map(\n",
" lambda x: x.to_dict() if hasattr(x, 'to_dict') else x,\n",
" value\n",
" ))\n",
" elif hasattr(value, 'to_dict'):\n",
" result[attr] = value.to_dict()\n",
" elif isinstance(value, dict):\n",
" result[attr] = dict(map(\n",
" lambda item: (item[0], item[1].to_dict())\n",
" if hasattr(item[1], 'to_dict') else item,\n",
" value.items()\n",
" ))\n",
" else:\n",
" result[attr] = value\n",
" if issubclass(TimeStamp, dict):\n",
" for key, value in self.items():\n",
" result[key] = value\n",
" return result\n",
" def to_str(self):\n",
" return pprint.pformat(self.to_dict())\n",
" def __repr__(self):\n",
" return self.to_str()\n",
" def __eq__(self, other):\n",
" if not isinstance(other, TimeStamp):\n",
" return False\n",
" return self.__dict__ == other.__dict__\n",
" def __ne__(self, other):\n",
" return not self == other"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Subscribing to V2X message distribution server\n",
"\n",
"The cell bellow implements the V2xMsgSubscription data structure.\"`\r\n",
"}\r\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [],
"source": [
"class V2xMsgSubscription(object):\n",
" swagger_types = {'links': 'Links', 'callback_reference': 'str', 'filter_criteria': 'V2xMsgSubscriptionFilterCriteria', 'request_test_notification': 'bool', 'subscription_type': 'str'}\n",
" attribute_map = {'links': 'Links', 'callback_reference': 'callbackReference', 'filter_criteria': 'filterCriteria', 'request_test_notification': 'requestTestNotification', 'subscription_type': 'subscriptionType'}\n",
" def __init__(self, links=None, callback_reference=None, filter_criteria=None, request_test_notification=None): # noqa: E501\n",
" self._links = None\n",
" self._callback_reference = None\n",
" self._filter_criteria = None\n",
" self._request_test_notification = None\n",
" self._subscription_type = \"V2xMsgSubscription\"\n",
" if links is not None:\n",
" self.links = links\n",
" if callback_reference is not None:\n",
" self.callback_reference = callback_reference\n",
" if filter_criteria is not None:\n",
" self.filter_criteria = filter_criteria\n",
" if request_test_notification is not None:\n",
" self.request_test_notification = request_test_notification\n",
" @property\n",
" def links(self):\n",
" return self._links\n",
" @links.setter\n",
" def links(self, links):\n",
" self_.links = links\n",
" @property\n",
" def callback_reference(self):\n",
" return self._callback_reference\n",
" @callback_reference.setter\n",
" def callback_reference(self, callback_reference):\n",
" self._callback_reference = callback_reference\n",
" @property\n",
" def links(self):\n",
" return self._links\n",
" @links.setter\n",
" def links(self, links):\n",
" self._links = links\n",
" @property\n",
" def filter_criteria(self):\n",
" return self._filter_criteria\n",
" @filter_criteria.setter\n",
" def filter_criteria(self, filter_criteria):\n",
" self._filter_criteria = filter_criteria\n",
" @property\n",
" def request_test_notification(self):\n",
" return self._request_test_notification\n",
" @request_test_notification.setter\n",
" def request_test_notification(self, request_test_notification):\n",
" self._request_test_notification = request_test_notification\n",
" @property\n",
" def subscription_type(self):\n",
" return self._subscription_type\n",
" def to_dict(self):\n",
" result = {}\n",
" for attr, _ in six.iteritems(self.swagger_types):\n",
" value = getattr(self, attr)\n",
" if isinstance(value, list):\n",
" result[attr] = list(map(\n",
" lambda x: x.to_dict() if hasattr(x, 'to_dict') else x,\n",
" value\n",
" ))\n",
" elif hasattr(value, 'to_dict'):\n",
" result[attr] = value.to_dict()\n",
" elif isinstance(value, dict):\n",
" result[attr] = dict(map(\n",
" lambda item: (item[0], item[1].to_dict())\n",
" if hasattr(item[1], 'to_dict') else item,\n",
" value.items()\n",
" ))\n",
" else:\n",
" result[attr] = value\n",
" if issubclass(V2xMsgSubscription, dict):\n",
" for key, value in self.items():\n",
" result[key] = value\n",
" return result\n",
" def to_str(self):\n",
" return pprint.pformat(self.to_dict())\n",
" def __repr__(self):\n",
" return self.to_str()\n",
" def __eq__(self, other):\n",
" if not isinstance(other, V2xMsgSubscription):\n",
" return False\n",
" return self.__dict__ == other.__dict__\n",
" def __ne__(self, other):\n",
" return not self == other\n",
"\n",
"class V2xMsgSubscriptionFilterCriteria(object):\n",
" swagger_types = {'msg_type': 'list[str]', 'std_organization': 'str'}\n",
" attribute_map = {'msg_type': 'MsgType', 'std_organization': 'stdOrganization'}\n",
" def __init__(self, msg_type, std_organization): # noqa: E501\n",
" self._msg_type = None\n",
" self._std_organization = None\n",
" self.msg_type = msg_type\n",
" self.std_organization = std_organization\n",
" @property\n",
" def msg_type(self):\n",
" return self._msg_type\n",
" @msg_type.setter\n",
" def msg_type(self, msg_type):\n",
" self._msg_type = msg_type\n",
" @property\n",
" def std_organization(self):\n",
" return self._std_organization\n",
" @std_organization.setter\n",
" def std_organization(self, std_organization):\n",
" self._std_organization = std_organization\n",
" def to_dict(self):\n",
" result = {}\n",
" for attr, _ in six.iteritems(self.swagger_types):\n",
" value = getattr(self, attr)\n",
" if isinstance(value, list):\n",
" result[attr] = list(map(\n",
" lambda x: x.to_dict() if hasattr(x, 'to_dict') else x,\n",
" value\n",
" ))\n",
" elif hasattr(value, 'to_dict'):\n",
" result[attr] = value.to_dict()\n",
" elif isinstance(value, dict):\n",
" result[attr] = dict(map(\n",
" lambda item: (item[0], item[1].to_dict())\n",
" if hasattr(item[1], 'to_dict') else item,\n",
" value.items()\n",
" ))\n",
" else:\n",
" result[attr] = value\n",
" if issubclass(V2xMsgSubscriptionFilterCriteria, dict):\n",
" for key, value in self.items():\n",
" result[key] = value\n",
" return result\n",
" def to_str(self):\n",
" return pprint.pformat(self.to_dict())\n",
" def __repr__(self):\n",
" return self.to_str()\n",
" def __eq__(self, other):\n",
" if not isinstance(other, V2xMsgSubscriptionFilterCriteria):\n",
" return False\n",
" return self.__dict__ == other.__dict__\n",
" def __ne__(self, other):\n",
" return not self == other"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Here is the V2X message subscription function. The body contains a 'JSON' serialized instance of the class V2xMsgSubscription."
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [],
"source": [
"def subscribe_v2x_message(sandbox_name: str, v2xMsgSubscription: V2xMsgSubscription) -> int:\n",
" global MEC_SANDBOX_URL, MEC_PLTF, CALLBACK_URI, logger\n",
"\n",
" logger.debug('>>> subscribe_v2x_message: v2xMsgSubscription: ' + str(v2xMsgSubscription))\n",
" try:\n",
" url = '/{sandbox_name}/{mec_pltf}/vis/v2/subscriptions'\n",
" logger.debug('subscribe_v2x_message: url: ' + url)\n",
" path_params = {}\n",
" path_params['sandbox_name'] = sandbox_name\n",
" path_params['mec_pltf'] = MEC_PLTF\n",
" header_params = {}\n",
" # HTTP header `Accept`\n",
" header_params['Accept'] = 'application/json' # noqa: E501\n",
" # HTTP header `Content-Type`\n",
" header_params['Content-Type'] = 'application/json' # noqa: E501\n",
" (result, status, headers) = service_api.call_api(url, 'POST', header_params=header_params, path_params=path_params, body=v2xMsgSubscription, async_req=False)\n",
" return (extract_sub_id(headers['Location']), headers['Location'])\n",
" except ApiException as e:\n",
" logger.error('Exception when calling call_api: %s\\n' % e)\n",
" return None\n",
" # End of function subscribe_v2x_message"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Here is a generic function to delete any MEC service subscription based on the subscription resource URL provided in the Location header of the subscription creation response."
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [],
"source": [
"def delete_mec_subscription(resource_url: str) -> int:\n",
" global logger\n",
"\n",
" logger.debug('>>> delete_mec_subscription: resource_url: ' + resource_url)\n",
" try:\n",
" res = urllib3.util.parse_url(resource_url)\n",
" if res is None:\n",
" logger.error('delete_mec_subscription: Failed to paerse URL')\n",
" return -1\n",
" header_params = {}\n",
" # HTTP header `Accept`\n",
" header_params['Accept'] = 'application/json' # noqa: E501\n",
" # HTTP header `Content-Type`\n",
" header_params['Content-Type'] = 'application/json' # noqa: E501\n",
" service_api.call_api(res.path, 'DELETE', header_params=header_params, async_req=False)\n",
" return 0\n",
" except ApiException as e:\n",
" logger.error('Exception when calling call_api: %s\\n' % e)\n",
" return -1\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Finaly, here is how to implement the V2X message subscription:"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-01 12:51:59,320 - __main__ - DEBUG - Starting at 20241001-125159\n",
"2024-10-01 12:51:59,321 - __main__ - DEBUG - \t pwd= /home/yann/dev/jupyter/Sandbox/mecapp\n",
"2024-10-01 12:51:59,322 - __main__ - DEBUG - >>> process_login\n",
"2024-10-01 12:51:59,322 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
"2024-10-01 12:51:59,505 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/login?provider=Jupyter2024 HTTP/1.1\" 201 48\n",
"2024-10-01 12:51:59,506 DEBUG response body: b'{\"user_code\":\"sbx5bl4at0\",\"verification_uri\":\"\"}'\n",
"2024-10-01 12:51:59,507 - __main__ - DEBUG - process_login (step1): oauth: {'user_code': 'sbx5bl4at0', 'verification_uri': ''}\n",
"2024-10-01 12:51:59,507 - __main__ - DEBUG - =======================> DO AUTHORIZATION WITH CODE : sbx5bl4at0\n",
"2024-10-01 12:51:59,508 - __main__ - DEBUG - =======================> DO AUTHORIZATION HERE : \n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"send: b'POST /sandbox-api/v1/login?provider=Jupyter2024 HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 2\\r\\nAccept: application/json\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"send: b'{}'\n",
"reply: 'HTTP/1.1 201 Created\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:51:58 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Content-Length: 48\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-01 12:52:02,541 DEBUG https://mec-platform2.etsi.org:443 \"GET /sandbox-api/v1/namespace?user_code=sbx5bl4at0 HTTP/1.1\" 200 29\n",
"2024-10-01 12:52:02,543 DEBUG response body: b'{\"sandbox_name\":\"sbx5bl4at0\"}'\n",
"2024-10-01 12:52:02,546 - __main__ - DEBUG - process_login (step2): result: {'sandbox_name': 'sbx5bl4at0'}\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"send: b'GET /sandbox-api/v1/namespace?user_code=sbx5bl4at0 HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"reply: 'HTTP/1.1 200 OK\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:52:01 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Content-Length: 29\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-01 12:52:08,554 - __main__ - DEBUG - >>> get_network_scenarios: sandbox=sbx5bl4at0\n",
"2024-10-01 12:52:08,558 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
"2024-10-01 12:52:08,744 DEBUG https://mec-platform2.etsi.org:443 \"GET /sandbox-api/v1/sandboxNetworkScenarios?sandbox_name=sbx5bl4at0 HTTP/1.1\" 200 157\n",
"2024-10-01 12:52:08,747 DEBUG response body: b'[{\"id\":\"4g-5g-macro-v2x\"},{\"id\":\"4g-5g-wifi-macro\"},{\"id\":\"4g-macro\"},{\"id\":\"4g-wifi-macro\"},{\"id\":\"dual-mep-4g-5g-wifi-macro\"},{\"id\":\"dual-mep-short-path\"}]'\n",
"2024-10-01 12:52:08,750 - __main__ - DEBUG - get_network_scenarios: result: [{'id': '4g-5g-macro-v2x'}, {'id': '4g-5g-wifi-macro'}, {'id': '4g-macro'}, {'id': '4g-wifi-macro'}, {'id': 'dual-mep-4g-5g-wifi-macro'}, {'id': 'dual-mep-short-path'}]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"send: b'GET /sandbox-api/v1/sandboxNetworkScenarios?sandbox_name=sbx5bl4at0 HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"reply: 'HTTP/1.1 200 OK\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:52:08 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Content-Length: 157\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-01 12:52:14,757 - __main__ - DEBUG - >>> activate_network_scenario: sbx5bl4at0\n",
"2024-10-01 12:52:14,862 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/sandboxNetworkScenarios/sbx5bl4at0?network_scenario_id=4g-5g-macro-v2x HTTP/1.1\" 204 0\n",
"2024-10-01 12:52:14,865 DEBUG response body: b''\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"send: b'POST /sandbox-api/v1/sandboxNetworkScenarios/sbx5bl4at0?network_scenario_id=4g-5g-macro-v2x HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 2\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"send: b'{}'\n",
"reply: 'HTTP/1.1 204 No Content\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:52:14 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-01 12:52:26,879 - __main__ - DEBUG - >>> request_application_instance_id: sbx5bl4at0\n",
"2024-10-01 12:52:26,883 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
"2024-10-01 12:52:27,074 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/sandboxAppInstances/sbx5bl4at0 HTTP/1.1\" 201 100\n",
"2024-10-01 12:52:27,075 DEBUG response body: b'{\"id\":\"ae79ecfc-b6c8-457a-b67b-40bf019ac568\",\"name\":\"JupyterMecApp\",\"nodeName\":\"mep1\",\"type\":\"USER\"}'\n",
"2024-10-01 12:52:27,075 - __main__ - DEBUG - request_application_instance_id: result: {'id': 'ae79ecfc-b6c8-457a-b67b-40bf019ac568',\n",
" 'name': 'JupyterMecApp',\n",
" 'node_name': 'mep1',\n",
" 'persist': None,\n",
" 'type': 'USER'}\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'id': 'ae79ecfc-b6c8-457a-b67b-40bf019ac568',\n",
" 'name': 'JupyterMecApp',\n",
" 'node_name': 'mep1',\n",
" 'persist': None,\n",
" 'type': 'USER'}\n",
"send: b'POST /sandbox-api/v1/sandboxAppInstances/sbx5bl4at0 HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 107\\r\\nAccept: application/json\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"send: b'{\"id\": \"ae79ecfc-b6c8-457a-b67b-40bf019ac568\", \"name\": \"JupyterMecApp\", \"nodeName\": \"mep1\", \"type\": \"USER\"}'\n",
"reply: 'HTTP/1.1 201 Created\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:52:26 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Content-Length: 100\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-01 12:52:33,081 - __main__ - DEBUG - >>> send_ready_confirmation: ae79ecfc-b6c8-457a-b67b-40bf019ac568\n",
"2024-10-01 12:52:33,084 - __main__ - DEBUG - send_ready_confirmation: url: /{sandbox_name}/{mec_pltf}/mec_app_support/v2/applications/{app_inst_id}/confirm_ready\n",
"2024-10-01 12:52:33,087 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
"2024-10-01 12:52:33,216 DEBUG https://mec-platform2.etsi.org:443 \"POST /sbx5bl4at0/mep1/mec_app_support/v2/applications/ae79ecfc-b6c8-457a-b67b-40bf019ac568/confirm_ready HTTP/1.1\" 204 0\n",
"2024-10-01 12:52:33,217 DEBUG response body: b''\n",
"2024-10-01 12:52:33,217 - __main__ - DEBUG - >>> send_subscribe_termination: ae79ecfc-b6c8-457a-b67b-40bf019ac568\n",
"2024-10-01 12:52:33,218 - __main__ - DEBUG - send_subscribe_termination: url: /{sandbox_name}/{mec_pltf}/mec_app_support/v2/applications/{app_inst_id}/subscriptions\n",
"2024-10-01 12:52:33,236 DEBUG https://mec-platform2.etsi.org:443 \"POST /sbx5bl4at0/mep1/mec_app_support/v2/applications/ae79ecfc-b6c8-457a-b67b-40bf019ac568/subscriptions HTTP/1.1\" 201 367\n",
"2024-10-01 12:52:33,237 DEBUG response body: b'{\"subscriptionType\":\"AppTerminationNotificationSubscription\",\"callbackReference\":\"http://yanngarcia.ddns.net/mec011/v2/termination\",\"_links\":{\"self\":{\"href\":\"https://mec-platform2.etsi.org/sbx5bl4at0/mep1/mec_app_support/v2/applications/ae79ecfc-b6c8-457a-b67b-40bf019ac568/subscriptions/sub-YamGx8Gewxznv4X7\"}},\"appInstanceId\":\"ae79ecfc-b6c8-457a-b67b-40bf019ac568\"}'\n",
"2024-10-01 12:52:33,238 - __main__ - DEBUG - >>> extract_sub_id: resource_url: https://mec-platform2.etsi.org/sbx5bl4at0/mep1/mec_app_support/v2/applications/ae79ecfc-b6c8-457a-b67b-40bf019ac568/subscriptions/sub-YamGx8Gewxznv4X7\n",
"2024-10-01 12:52:33,239 - __main__ - DEBUG - >>> subscribe_v2x_message: v2xMsgSubscription: {'callback_reference': 'https://yanngarcia.ddns.net/jupyter/sandbox/demo6/v1//vis/v2/v2x_msg_notification',\n",
" 'filter_criteria': {'msg_type': ['1', '2'], 'std_organization': 'ETSI'},\n",
" 'links': None,\n",
" 'request_test_notification': None,\n",
" 'subscription_type': 'V2xMsgSubscription'}\n",
"2024-10-01 12:52:33,239 - __main__ - DEBUG - subscribe_v2x_message: url: /{sandbox_name}/{mec_pltf}/vis/v2/subscriptions\n",
"2024-10-01 12:52:33,261 DEBUG https://mec-platform2.etsi.org:443 \"POST /sbx5bl4at0/mep1/vis/v2/subscriptions HTTP/1.1\" 201 308\n",
"2024-10-01 12:52:33,262 DEBUG response body: b'{\"_links\":{\"self\":{\"href\":\"https://mec-platform2.etsi.org/sbx5bl4at0/mep1/vis/v2/subscriptions/1\"}},\"callbackReference\":\"https://yanngarcia.ddns.net/jupyter/sandbox/demo6/v1//vis/v2/v2x_msg_notification\",\"filterCriteria\":{\"msgType\":[\"1\",\"2\"],\"stdOrganization\":\"ETSI\"},\"subscriptionType\":\"V2xMsgSubscription\"}'\n",
"2024-10-01 12:52:33,263 - __main__ - DEBUG - >>> extract_sub_id: resource_url: https://mec-platform2.etsi.org/sbx5bl4at0/mep1/vis/v2/subscriptions/1\n",
"2024-10-01 12:52:33,264 - __main__ - INFO - sandbox_name: sbx5bl4at0\n",
"2024-10-01 12:52:33,265 - __main__ - INFO - app_inst_id: ae79ecfc-b6c8-457a-b67b-40bf019ac568\n",
"2024-10-01 12:52:33,267 - __main__ - INFO - sub_id: sub-YamGx8Gewxznv4X7\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"send: b'POST /sbx5bl4at0/mep1/mec_app_support/v2/applications/ae79ecfc-b6c8-457a-b67b-40bf019ac568/confirm_ready HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 23\\r\\nAccept: application/json\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"send: b'{\"indication\": \"READY\"}'\n",
"reply: 'HTTP/1.1 204 No Content\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:52:32 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n",
"send: b'POST /sbx5bl4at0/mep1/mec_app_support/v2/applications/ae79ecfc-b6c8-457a-b67b-40bf019ac568/subscriptions HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 192\\r\\nAccept: application/json\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"send: b'{\"subscriptionType\": \"AppTerminationNotificationSubscription\", \"callbackReference\": \"http://yanngarcia.ddns.net/mec011/v2/termination\", \"appInstanceId\": \"ae79ecfc-b6c8-457a-b67b-40bf019ac568\"}'\n",
"reply: 'HTTP/1.1 201 Created\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:52:32 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Content-Length: 367\n",
"header: Connection: keep-alive\n",
"header: Location: https://mec-platform2.etsi.org/sbx5bl4at0/mep1/mec_app_support/v2/applications/ae79ecfc-b6c8-457a-b67b-40bf019ac568/subscriptions/sub-YamGx8Gewxznv4X7\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n",
"send: b'POST /sbx5bl4at0/mep1/vis/v2/subscriptions HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 218\\r\\nAccept: application/json\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"send: b'{\"callbackReference\": \"https://yanngarcia.ddns.net/jupyter/sandbox/demo6/v1//vis/v2/v2x_msg_notification\", \"filterCriteria\": {\"MsgType\": [\"1\", \"2\"], \"stdOrganization\": \"ETSI\"}, \"subscriptionType\": \"V2xMsgSubscription\"}'\n",
"reply: 'HTTP/1.1 201 Created\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:52:32 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Content-Length: 308\n",
"header: Connection: keep-alive\n",
"header: Location: https://mec-platform2.etsi.org/sbx5bl4at0/mep1/vis/v2/subscriptions/1\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-01 12:52:39,274 - __main__ - DEBUG - >>> delete_mec_subscription: resource_url: https://mec-platform2.etsi.org/sbx5bl4at0/mep1/vis/v2/subscriptions/1\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"send: b'DELETE /sbx5bl4at0/mep1/vis/v2/subscriptions/1 HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 2\\r\\nAccept: application/json\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"send: b'{}'\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-01 12:52:41,375 DEBUG https://mec-platform2.etsi.org:443 \"DELETE /sbx5bl4at0/mep1/vis/v2/subscriptions/1 HTTP/1.1\" 204 0\n",
"2024-10-01 12:52:41,377 DEBUG response body: b''\n",
"2024-10-01 12:52:41,379 - __main__ - DEBUG - >>> delete_subscribe_termination: ae79ecfc-b6c8-457a-b67b-40bf019ac568\n",
"2024-10-01 12:52:41,381 - __main__ - DEBUG - delete_subscribe_termination: url: /{sandbox_name}/{mec_pltf}/mec_app_support/v2/applications/{app_inst_id}/subscriptions/{sub_id}\n",
"2024-10-01 12:52:41,403 DEBUG https://mec-platform2.etsi.org:443 \"DELETE /sbx5bl4at0/mep1/mec_app_support/v2/applications/ae79ecfc-b6c8-457a-b67b-40bf019ac568/subscriptions/sub-YamGx8Gewxznv4X7 HTTP/1.1\" 204 0\n",
"2024-10-01 12:52:41,406 DEBUG response body: b''\n",
"2024-10-01 12:52:41,408 - __main__ - DEBUG - >>> delete_application_instance_id: sbx5bl4at0\n",
"2024-10-01 12:52:41,409 - __main__ - DEBUG - >>> delete_application_instance_id: ae79ecfc-b6c8-457a-b67b-40bf019ac568\n",
"2024-10-01 12:52:41,445 DEBUG https://mec-platform2.etsi.org:443 \"DELETE /sandbox-api/v1/sandboxAppInstances/sbx5bl4at0/ae79ecfc-b6c8-457a-b67b-40bf019ac568 HTTP/1.1\" 204 0\n",
"2024-10-01 12:52:41,447 DEBUG response body: b''\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"reply: 'HTTP/1.1 204 No Content\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:52:40 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n",
"send: b'DELETE /sbx5bl4at0/mep1/mec_app_support/v2/applications/ae79ecfc-b6c8-457a-b67b-40bf019ac568/subscriptions/sub-YamGx8Gewxznv4X7 HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 2\\r\\nAccept: application/json\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"send: b'{}'\n",
"reply: 'HTTP/1.1 204 No Content\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:52:40 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n",
"send: b'DELETE /sandbox-api/v1/sandboxAppInstances/sbx5bl4at0/ae79ecfc-b6c8-457a-b67b-40bf019ac568 HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 2\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"send: b'{}'\n",
"reply: 'HTTP/1.1 204 No Content\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:52:40 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-01 12:52:47,452 - __main__ - DEBUG - >>> deactivate_network_scenario: sbx5bl4at0\n",
"2024-10-01 12:52:47,507 DEBUG https://mec-platform2.etsi.org:443 \"DELETE /sandbox-api/v1/sandboxNetworkScenarios/sbx5bl4at0/4g-5g-macro-v2x HTTP/1.1\" 204 0\n",
"2024-10-01 12:52:47,510 DEBUG response body: b''\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"send: b'DELETE /sandbox-api/v1/sandboxNetworkScenarios/sbx5bl4at0/4g-5g-macro-v2x HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 2\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"send: b'{}'\n",
"reply: 'HTTP/1.1 204 No Content\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:52:46 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-01 12:52:59,523 - __main__ - DEBUG - >>> process_logout: sandbox=sbx5bl4at0\n",
"2024-10-01 12:52:59,526 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
"2024-10-01 12:52:59,697 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/logout?sandbox_name=sbx5bl4at0 HTTP/1.1\" 204 0\n",
"2024-10-01 12:52:59,699 DEBUG response body: b''\n",
"2024-10-01 12:52:59,700 - __main__ - DEBUG - Stopped at 20241001-125259\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"send: b'POST /sandbox-api/v1/logout?sandbox_name=sbx5bl4at0 HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 2\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"send: b'{}'\n",
"reply: 'HTTP/1.1 204 No Content\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:52:59 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
}
],
"source": [
"def process_main():\n",
" \"\"\"\n",
" This is the second sprint of our skeleton of our MEC application:\n",
" - Mec application setup\n",
" - Subscribe to V2XMessage\n",
" - Delete subscription\n",
" - Mec application termination\n",
" \"\"\" \n",
" global MEC_PLTF, CALLBACK_URI, logger\n",
"\n",
" logger.debug('Starting at ' + time.strftime('%Y%m%d-%H%M%S'))\n",
" logger.debug('\\t pwd= ' + os.getcwd())\n",
"\n",
" # Setup the MEC application\n",
" (sandbox_name, app_inst_id, sub_id) = mec_app_setup()\n",
"\n",
" # Create a V2X message subscritpion\n",
" filter_criteria = V2xMsgSubscriptionFilterCriteria(['1', '2'], 'ETSI')\n",
" v2xMsgSubscription = V2xMsgSubscription(callback_reference = CALLBACK_URI + '/vis/v2/v2x_msg_notification', filter_criteria = filter_criteria)\n",
" v2x_sub_id, v2x_resource = subscribe_v2x_message(sandbox_name, v2xMsgSubscription)\n",
" if v2x_sub_id is None:\n",
" logger.error('Failed to get UU unicast provisioning information')\n",
"\n",
" # Any processing here\n",
" logger.info('sandbox_name: ' + sandbox_name)\n",
" logger.info('app_inst_id: ' + app_inst_id.id)\n",
" if sub_id is not None:\n",
" logger.info('sub_id: ' + sub_id)\n",
" time.sleep(STABLE_TIME_OUT)\n",
"\n",
" # Delete the V2X message subscritpion\n",
" delete_mec_subscription(v2x_resource)\n",
"\n",
" # Terminate the MEC application\n",
" mec_app_termination(sandbox_name, app_inst_id, sub_id)\n",
"\n",
" logger.debug('Stopped at ' + time.strftime('%Y%m%d-%H%M%S'))\n",
" # End of function process_main\n",
"\n",
"if __name__ == '__main__':\n",
" process_main()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Notification support\n",
"\n",
"To recieve notifcation, our MEC application is required to support an HTTP listenener to recieve POST request from the MEC Sandbox and replto repry to them: this is the notification mechanism.\n",
"\n",
"The class HTTPRequestHandler (see cell below) provides the suport of such mechanism.\n"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [],
"source": [
"class HTTPRequestHandler(BaseHTTPRequestHandler):\n",
" global logger\n",
"\n",
" def do_POST(self):\n",
" if re.search(CALLBACK_URI, self.path):\n",
" ctype, pdict = _parse_header(self.headers.get('content-type'))\n",
" if ctype == \"application/json\":\n",
" length = int(self.headers.get('content-length'))\n",
" rfile_str = self.rfile.read(length).decode('utf8')\n",
" data = parse.parse_qs(rfile_str, keep_blank_values=True)\n",
" record_id = self.path.split('/')[-1]\n",
" LocalData.records[record_id] = data\n",
" logger.info('addrecord %s: %s' % (record_id, data))\n",
" self.send_response(HTTPStatus.OK)\n",
" else:\n",
" self.send_response(HTTPStatus.BAD_REQUEST, 'Only application/json is supported')\n",
" else:\n",
" self.send_response(HTTPStatus.BAD_REQUEST, 'Unsupported URI')\n",
" self.end_headers()\n",
"\n",
" def do_GET(self):\n",
" self.send_response(HTTPStatus.BAD_REQUEST)\n",
" self.end_headers()\n",
" # End of class HTTPRequestHandler\n",
"\n",
"class LocalData(object):\n",
" records = {}\n",
" # End of class LocalData"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Put all together\n",
"\n",
"let's add a subscription the our previous MEC application.\n",
"The sequence is the following:\n",
"- Mec application setup\n",
"- Get UU unicast provisioning information\n",
"- Add subscription\n",
"- Mec application termination"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-01 12:58:31,914 - __main__ - DEBUG - Starting at 20241001-125831\n",
"2024-10-01 12:58:31,917 - __main__ - DEBUG - \t pwd= /home/yann/dev/jupyter/Sandbox/mecapp\n",
"2024-10-01 12:58:31,919 - __main__ - DEBUG - >>> process_login\n",
"2024-10-01 12:58:31,922 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
"2024-10-01 12:58:32,109 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/login?provider=Jupyter2024 HTTP/1.1\" 201 48\n",
"2024-10-01 12:58:32,111 DEBUG response body: b'{\"user_code\":\"sbxsn3v6jl\",\"verification_uri\":\"\"}'\n",
"2024-10-01 12:58:32,114 - __main__ - DEBUG - process_login (step1): oauth: {'user_code': 'sbxsn3v6jl', 'verification_uri': ''}\n",
"2024-10-01 12:58:32,118 - __main__ - DEBUG - =======================> DO AUTHORIZATION WITH CODE : sbxsn3v6jl\n",
"2024-10-01 12:58:32,120 - __main__ - DEBUG - =======================> DO AUTHORIZATION HERE : \n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"send: b'POST /sandbox-api/v1/login?provider=Jupyter2024 HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 2\\r\\nAccept: application/json\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"send: b'{}'\n",
"reply: 'HTTP/1.1 201 Created\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:58:31 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Content-Length: 48\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-01 12:58:35,155 DEBUG https://mec-platform2.etsi.org:443 \"GET /sandbox-api/v1/namespace?user_code=sbxsn3v6jl HTTP/1.1\" 200 29\n",
"2024-10-01 12:58:35,158 DEBUG response body: b'{\"sandbox_name\":\"sbxsn3v6jl\"}'\n",
"2024-10-01 12:58:35,160 - __main__ - DEBUG - process_login (step2): result: {'sandbox_name': 'sbxsn3v6jl'}\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"send: b'GET /sandbox-api/v1/namespace?user_code=sbxsn3v6jl HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"reply: 'HTTP/1.1 200 OK\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:58:34 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Content-Length: 29\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-01 12:58:41,167 - __main__ - DEBUG - >>> get_network_scenarios: sandbox=sbxsn3v6jl\n",
"2024-10-01 12:58:41,170 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
"2024-10-01 12:58:41,356 DEBUG https://mec-platform2.etsi.org:443 \"GET /sandbox-api/v1/sandboxNetworkScenarios?sandbox_name=sbxsn3v6jl HTTP/1.1\" 200 157\n",
"2024-10-01 12:58:41,358 DEBUG response body: b'[{\"id\":\"4g-5g-macro-v2x\"},{\"id\":\"4g-5g-wifi-macro\"},{\"id\":\"4g-macro\"},{\"id\":\"4g-wifi-macro\"},{\"id\":\"dual-mep-4g-5g-wifi-macro\"},{\"id\":\"dual-mep-short-path\"}]'\n",
"2024-10-01 12:58:41,361 - __main__ - DEBUG - get_network_scenarios: result: [{'id': '4g-5g-macro-v2x'}, {'id': '4g-5g-wifi-macro'}, {'id': '4g-macro'}, {'id': '4g-wifi-macro'}, {'id': 'dual-mep-4g-5g-wifi-macro'}, {'id': 'dual-mep-short-path'}]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"send: b'GET /sandbox-api/v1/sandboxNetworkScenarios?sandbox_name=sbxsn3v6jl HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"reply: 'HTTP/1.1 200 OK\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:58:40 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Content-Length: 157\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-01 12:58:47,369 - __main__ - DEBUG - >>> activate_network_scenario: sbxsn3v6jl\n",
"2024-10-01 12:58:47,430 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/sandboxNetworkScenarios/sbxsn3v6jl?network_scenario_id=4g-5g-macro-v2x HTTP/1.1\" 204 0\n",
"2024-10-01 12:58:47,432 DEBUG response body: b''\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"send: b'POST /sandbox-api/v1/sandboxNetworkScenarios/sbxsn3v6jl?network_scenario_id=4g-5g-macro-v2x HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 2\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"send: b'{}'\n",
"reply: 'HTTP/1.1 204 No Content\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:58:46 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-01 12:58:59,447 - __main__ - DEBUG - >>> request_application_instance_id: sbxsn3v6jl\n",
"2024-10-01 12:58:59,451 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
"2024-10-01 12:58:59,599 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/sandboxAppInstances/sbxsn3v6jl HTTP/1.1\" 201 100\n",
"2024-10-01 12:58:59,600 DEBUG response body: b'{\"id\":\"b49b3ae3-1fd9-48c6-9282-d449dfbba42e\",\"name\":\"JupyterMecApp\",\"nodeName\":\"mep1\",\"type\":\"USER\"}'\n",
"2024-10-01 12:58:59,601 - __main__ - DEBUG - request_application_instance_id: result: {'id': 'b49b3ae3-1fd9-48c6-9282-d449dfbba42e',\n",
" 'name': 'JupyterMecApp',\n",
" 'node_name': 'mep1',\n",
" 'persist': None,\n",
" 'type': 'USER'}\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'id': 'b49b3ae3-1fd9-48c6-9282-d449dfbba42e',\n",
" 'name': 'JupyterMecApp',\n",
" 'node_name': 'mep1',\n",
" 'persist': None,\n",
" 'type': 'USER'}\n",
"send: b'POST /sandbox-api/v1/sandboxAppInstances/sbxsn3v6jl HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 107\\r\\nAccept: application/json\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"send: b'{\"id\": \"b49b3ae3-1fd9-48c6-9282-d449dfbba42e\", \"name\": \"JupyterMecApp\", \"nodeName\": \"mep1\", \"type\": \"USER\"}'\n",
"reply: 'HTTP/1.1 201 Created\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:58:59 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Content-Length: 100\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-01 12:59:05,607 - __main__ - DEBUG - >>> send_ready_confirmation: b49b3ae3-1fd9-48c6-9282-d449dfbba42e\n",
"2024-10-01 12:59:05,609 - __main__ - DEBUG - send_ready_confirmation: url: /{sandbox_name}/{mec_pltf}/mec_app_support/v2/applications/{app_inst_id}/confirm_ready\n",
"2024-10-01 12:59:05,613 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
"2024-10-01 12:59:05,715 DEBUG https://mec-platform2.etsi.org:443 \"POST /sbxsn3v6jl/mep1/mec_app_support/v2/applications/b49b3ae3-1fd9-48c6-9282-d449dfbba42e/confirm_ready HTTP/1.1\" 204 0\n",
"2024-10-01 12:59:05,716 DEBUG response body: b''\n",
"2024-10-01 12:59:05,717 - __main__ - DEBUG - >>> send_subscribe_termination: b49b3ae3-1fd9-48c6-9282-d449dfbba42e\n",
"2024-10-01 12:59:05,718 - __main__ - DEBUG - send_subscribe_termination: url: /{sandbox_name}/{mec_pltf}/mec_app_support/v2/applications/{app_inst_id}/subscriptions\n",
"2024-10-01 12:59:05,738 DEBUG https://mec-platform2.etsi.org:443 \"POST /sbxsn3v6jl/mep1/mec_app_support/v2/applications/b49b3ae3-1fd9-48c6-9282-d449dfbba42e/subscriptions HTTP/1.1\" 201 367\n",
"2024-10-01 12:59:05,741 DEBUG response body: b'{\"subscriptionType\":\"AppTerminationNotificationSubscription\",\"callbackReference\":\"http://yanngarcia.ddns.net/mec011/v2/termination\",\"_links\":{\"self\":{\"href\":\"https://mec-platform2.etsi.org/sbxsn3v6jl/mep1/mec_app_support/v2/applications/b49b3ae3-1fd9-48c6-9282-d449dfbba42e/subscriptions/sub-j1XbzihrdTWo-CRi\"}},\"appInstanceId\":\"b49b3ae3-1fd9-48c6-9282-d449dfbba42e\"}'\n",
"2024-10-01 12:59:05,744 - __main__ - DEBUG - >>> extract_sub_id: resource_url: https://mec-platform2.etsi.org/sbxsn3v6jl/mep1/mec_app_support/v2/applications/b49b3ae3-1fd9-48c6-9282-d449dfbba42e/subscriptions/sub-j1XbzihrdTWo-CRi\n",
"2024-10-01 12:59:05,746 - __main__ - DEBUG - >>> send_uu_unicast_provisioning_info: 268708941961,268711972264\n",
"2024-10-01 12:59:05,748 - __main__ - DEBUG - send_uu_unicast_provisioning_info: url: /{sandbox_name}/{mec_pltf}/vis/v2/queries/uu_unicast_provisioning_info\n",
"2024-10-01 12:59:05,768 DEBUG https://mec-platform2.etsi.org:443 \"GET /sbxsn3v6jl/mep1/vis/v2/queries/uu_unicast_provisioning_info?location_info=ecgi%2C268708941961%2C268711972264 HTTP/1.1\" 200 495\n",
"2024-10-01 12:59:05,770 DEBUG response body: b'{\"proInfoUuUnicast\":[{\"locationInfo\":{\"ecgi\":{\"cellId\":{\"cellId\":\"5050505\"},\"plmn\":{\"mcc\":\"1\",\"mnc\":\"1\"}},\"geoArea\":{\"latitude\":43.73411,\"longitude\":7.429257}},\"v2xApplicationServer\":{\"ipAddress\":\"broker.emqx.io\",\"udpPort\":\"1883\"}},{\"locationInfo\":{\"ecgi\":{\"cellId\":{\"cellId\":\"8080808\"},\"plmn\":{\"mcc\":\"1\",\"mnc\":\"1\"}},\"geoArea\":{\"latitude\":43.74301,\"longitude\":7.429504}},\"v2xApplicationServer\":{\"ipAddress\":\"broker.emqx.io\",\"udpPort\":\"1883\"}}],\"timeStamp\":{\"nanoSeconds\":0,\"seconds\":1727780345}}'\n",
"--- Logging error ---\n",
"Traceback (most recent call last):\n",
" File \"/usr/lib/python3.10/logging/__init__.py\", line 1100, in emit\n",
" msg = self.format(record)\n",
" File \"/usr/lib/python3.10/logging/__init__.py\", line 943, in format\n",
" return fmt.format(record)\n",
" File \"/usr/lib/python3.10/logging/__init__.py\", line 678, in format\n",
" record.message = record.getMessage()\n",
" File \"/usr/lib/python3.10/logging/__init__.py\", line 368, in getMessage\n",
" msg = msg % self.args\n",
"TypeError: not all arguments converted during string formatting\n",
"Call stack:\n",
" File \"/usr/lib/python3.10/runpy.py\", line 196, in _run_module_as_main\n",
" return _run_code(code, main_globals, None,\n",
" File \"/usr/lib/python3.10/runpy.py\", line 86, in _run_code\n",
" exec(code, run_globals)\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/ipykernel_launcher.py\", line 18, in \n",
" app.launch_new_instance()\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/traitlets/config/application.py\", line 1075, in launch_instance\n",
" app.start()\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/ipykernel/kernelapp.py\", line 739, in start\n",
" self.io_loop.start()\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/tornado/platform/asyncio.py\", line 205, in start\n",
" self.asyncio_loop.run_forever()\n",
" File \"/usr/lib/python3.10/asyncio/base_events.py\", line 603, in run_forever\n",
" self._run_once()\n",
" File \"/usr/lib/python3.10/asyncio/base_events.py\", line 1909, in _run_once\n",
" handle._run()\n",
" File \"/usr/lib/python3.10/asyncio/events.py\", line 80, in _run\n",
" self._context.run(self._callback, *self._args)\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/ipykernel/kernelbase.py\", line 542, in dispatch_queue\n",
" await self.process_one()\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/ipykernel/kernelbase.py\", line 531, in process_one\n",
" await dispatch(*args)\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/ipykernel/kernelbase.py\", line 437, in dispatch_shell\n",
" await result\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/ipykernel/ipkernel.py\", line 359, in execute_request\n",
" await super().execute_request(stream, ident, parent)\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/ipykernel/kernelbase.py\", line 775, in execute_request\n",
" reply_content = await reply_content\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/ipykernel/ipkernel.py\", line 446, in do_execute\n",
" res = shell.run_cell(\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/ipykernel/zmqshell.py\", line 549, in run_cell\n",
" return super().run_cell(*args, **kwargs)\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/IPython/core/interactiveshell.py\", line 3051, in run_cell\n",
" result = self._run_cell(\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/IPython/core/interactiveshell.py\", line 3106, in _run_cell\n",
" result = runner(coro)\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/IPython/core/async_helpers.py\", line 129, in _pseudo_sync_runner\n",
" coro.send(None)\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/IPython/core/interactiveshell.py\", line 3311, in run_cell_async\n",
" has_raised = await self.run_ast_nodes(code_ast.body, cell_name,\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/IPython/core/interactiveshell.py\", line 3493, in run_ast_nodes\n",
" if await self.run_code(code, result, async_=asy):\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/IPython/core/interactiveshell.py\", line 3553, in run_code\n",
" exec(code_obj, self.user_global_ns, self.user_ns)\n",
" File \"/tmp/ipykernel_3188007/1838553892.py\", line 52, in \n",
" process_main()\n",
" File \"/tmp/ipykernel_3188007/1838553892.py\", line 22, in process_main\n",
" logger.info('UU unicast provisioning information: ', str(result))\n",
"Message: 'UU unicast provisioning information: '\n",
"Arguments: (\"(None, 200, HTTPHeaderDict({'Date': 'Tue, 01 Oct 2024 10:59:05 GMT', 'Content-Type': 'application/json; charset=UTF-8', 'Content-Length': '495', 'Connection': 'keep-alive', 'Strict-Transport-Security': 'max-age=15724800; includeSubDomains'}))\",)\n",
"--- Logging error ---\n",
"Traceback (most recent call last):\n",
" File \"/usr/lib/python3.10/logging/__init__.py\", line 1100, in emit\n",
" msg = self.format(record)\n",
" File \"/usr/lib/python3.10/logging/__init__.py\", line 943, in format\n",
" return fmt.format(record)\n",
" File \"/usr/lib/python3.10/logging/__init__.py\", line 678, in format\n",
" record.message = record.getMessage()\n",
" File \"/usr/lib/python3.10/logging/__init__.py\", line 368, in getMessage\n",
" msg = msg % self.args\n",
"TypeError: not all arguments converted during string formatting\n",
"Call stack:\n",
" File \"/usr/lib/python3.10/runpy.py\", line 196, in _run_module_as_main\n",
" return _run_code(code, main_globals, None,\n",
" File \"/usr/lib/python3.10/runpy.py\", line 86, in _run_code\n",
" exec(code, run_globals)\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/ipykernel_launcher.py\", line 18, in \n",
" app.launch_new_instance()\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/traitlets/config/application.py\", line 1075, in launch_instance\n",
" app.start()\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/ipykernel/kernelapp.py\", line 739, in start\n",
" self.io_loop.start()\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/tornado/platform/asyncio.py\", line 205, in start\n",
" self.asyncio_loop.run_forever()\n",
" File \"/usr/lib/python3.10/asyncio/base_events.py\", line 603, in run_forever\n",
" self._run_once()\n",
" File \"/usr/lib/python3.10/asyncio/base_events.py\", line 1909, in _run_once\n",
" handle._run()\n",
" File \"/usr/lib/python3.10/asyncio/events.py\", line 80, in _run\n",
" self._context.run(self._callback, *self._args)\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/ipykernel/kernelbase.py\", line 542, in dispatch_queue\n",
" await self.process_one()\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/ipykernel/kernelbase.py\", line 531, in process_one\n",
" await dispatch(*args)\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/ipykernel/kernelbase.py\", line 437, in dispatch_shell\n",
" await result\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/ipykernel/ipkernel.py\", line 359, in execute_request\n",
" await super().execute_request(stream, ident, parent)\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/ipykernel/kernelbase.py\", line 775, in execute_request\n",
" reply_content = await reply_content\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/ipykernel/ipkernel.py\", line 446, in do_execute\n",
" res = shell.run_cell(\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/ipykernel/zmqshell.py\", line 549, in run_cell\n",
" return super().run_cell(*args, **kwargs)\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/IPython/core/interactiveshell.py\", line 3051, in run_cell\n",
" result = self._run_cell(\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/IPython/core/interactiveshell.py\", line 3106, in _run_cell\n",
" result = runner(coro)\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/IPython/core/async_helpers.py\", line 129, in _pseudo_sync_runner\n",
" coro.send(None)\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/IPython/core/interactiveshell.py\", line 3311, in run_cell_async\n",
" has_raised = await self.run_ast_nodes(code_ast.body, cell_name,\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/IPython/core/interactiveshell.py\", line 3493, in run_ast_nodes\n",
" if await self.run_code(code, result, async_=asy):\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/IPython/core/interactiveshell.py\", line 3553, in run_code\n",
" exec(code_obj, self.user_global_ns, self.user_ns)\n",
" File \"/tmp/ipykernel_3188007/1838553892.py\", line 52, in \n",
" process_main()\n",
" File \"/tmp/ipykernel_3188007/1838553892.py\", line 22, in process_main\n",
" logger.info('UU unicast provisioning information: ', str(result))\n",
"Message: 'UU unicast provisioning information: '\n",
"Arguments: (\"(None, 200, HTTPHeaderDict({'Date': 'Tue, 01 Oct 2024 10:59:05 GMT', 'Content-Type': 'application/json; charset=UTF-8', 'Content-Length': '495', 'Connection': 'keep-alive', 'Strict-Transport-Security': 'max-age=15724800; includeSubDomains'}))\",)\n",
"/tmp/ipykernel_3188007/1838553892.py:26: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead\n",
" notification_server.setDaemon(True) # Set as a daemon so it will be killed once the main thread is dead.\n",
"Exception in thread notification_server:\n",
"Traceback (most recent call last):\n",
" File \"/usr/lib/python3.10/threading.py\", line 1016, in _bootstrap_inner\n",
"2024-10-01 12:59:05,778 - __main__ - DEBUG - >>> subscribe_v2x_message: v2xMsgSubscription: {'callback_reference': 'https://yanngarcia.ddns.net/jupyter/sandbox/demo6/v1//vis/v2/v2x_msg_notification',\n",
" 'filter_criteria': {'msg_type': ['1', '2'], 'std_organization': 'ETSI'},\n",
" 'links': None,\n",
" 'request_test_notification': None,\n",
" 'subscription_type': 'V2xMsgSubscription'}\n",
" self.run()\n",
" File \"/home/yann/.local/lib/python3.10/site-packages/ipykernel/ipkernel.py\", line 761, in run_closure\n",
"2024-10-01 12:59:05,782 - __main__ - DEBUG - subscribe_v2x_message: url: /{sandbox_name}/{mec_pltf}/vis/v2/subscriptions\n",
" _threading_Thread_run(self)\n",
" File \"/usr/lib/python3.10/threading.py\", line 953, in run\n",
" self._target(*self._args, **self._kwargs)\n",
"TypeError: BaseRequestHandler.__init__() missing 1 required positional argument: 'server'\n",
"2024-10-01 12:59:05,808 DEBUG https://mec-platform2.etsi.org:443 \"POST /sbxsn3v6jl/mep1/vis/v2/subscriptions HTTP/1.1\" 201 308\n",
"2024-10-01 12:59:05,810 DEBUG response body: b'{\"_links\":{\"self\":{\"href\":\"https://mec-platform2.etsi.org/sbxsn3v6jl/mep1/vis/v2/subscriptions/1\"}},\"callbackReference\":\"https://yanngarcia.ddns.net/jupyter/sandbox/demo6/v1//vis/v2/v2x_msg_notification\",\"filterCriteria\":{\"msgType\":[\"1\",\"2\"],\"stdOrganization\":\"ETSI\"},\"subscriptionType\":\"V2xMsgSubscription\"}'\n",
"2024-10-01 12:59:05,812 - __main__ - DEBUG - >>> extract_sub_id: resource_url: https://mec-platform2.etsi.org/sbxsn3v6jl/mep1/vis/v2/subscriptions/1\n",
"2024-10-01 12:59:05,814 - __main__ - INFO - v2x_sub_id: 1\n",
"2024-10-01 12:59:05,816 - __main__ - INFO - v2x_resource: https://mec-platform2.etsi.org/sbxsn3v6jl/mep1/vis/v2/subscriptions/1\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"send: b'POST /sbxsn3v6jl/mep1/mec_app_support/v2/applications/b49b3ae3-1fd9-48c6-9282-d449dfbba42e/confirm_ready HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 23\\r\\nAccept: application/json\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"send: b'{\"indication\": \"READY\"}'\n",
"reply: 'HTTP/1.1 204 No Content\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:59:05 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n",
"send: b'POST /sbxsn3v6jl/mep1/mec_app_support/v2/applications/b49b3ae3-1fd9-48c6-9282-d449dfbba42e/subscriptions HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 192\\r\\nAccept: application/json\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"send: b'{\"subscriptionType\": \"AppTerminationNotificationSubscription\", \"callbackReference\": \"http://yanngarcia.ddns.net/mec011/v2/termination\", \"appInstanceId\": \"b49b3ae3-1fd9-48c6-9282-d449dfbba42e\"}'\n",
"reply: 'HTTP/1.1 201 Created\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:59:05 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Content-Length: 367\n",
"header: Connection: keep-alive\n",
"header: Location: https://mec-platform2.etsi.org/sbxsn3v6jl/mep1/mec_app_support/v2/applications/b49b3ae3-1fd9-48c6-9282-d449dfbba42e/subscriptions/sub-j1XbzihrdTWo-CRi\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n",
"send: b'GET /sbxsn3v6jl/mep1/vis/v2/queries/uu_unicast_provisioning_info?location_info=ecgi%2C268708941961%2C268711972264 HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nAccept: application/json\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"reply: 'HTTP/1.1 200 OK\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:59:05 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Content-Length: 495\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n",
"send: b'POST /sbxsn3v6jl/mep1/vis/v2/subscriptions HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 218\\r\\nAccept: application/json\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"send: b'{\"callbackReference\": \"https://yanngarcia.ddns.net/jupyter/sandbox/demo6/v1//vis/v2/v2x_msg_notification\", \"filterCriteria\": {\"MsgType\": [\"1\", \"2\"], \"stdOrganization\": \"ETSI\"}, \"subscriptionType\": \"V2xMsgSubscription\"}'\n",
"reply: 'HTTP/1.1 201 Created\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:59:05 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Content-Length: 308\n",
"header: Connection: keep-alive\n",
"header: Location: https://mec-platform2.etsi.org/sbxsn3v6jl/mep1/vis/v2/subscriptions/1\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-01 12:59:11,820 - __main__ - DEBUG - >>> delete_mec_subscription: resource_url: https://mec-platform2.etsi.org/sbxsn3v6jl/mep1/vis/v2/subscriptions/1\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"send: b'DELETE /sbxsn3v6jl/mep1/vis/v2/subscriptions/1 HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 2\\r\\nAccept: application/json\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"send: b'{}'\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-01 12:59:13,977 DEBUG https://mec-platform2.etsi.org:443 \"DELETE /sbxsn3v6jl/mep1/vis/v2/subscriptions/1 HTTP/1.1\" 204 0\n",
"2024-10-01 12:59:13,979 DEBUG response body: b''\n",
"2024-10-01 12:59:13,981 - __main__ - DEBUG - >>> delete_subscribe_termination: b49b3ae3-1fd9-48c6-9282-d449dfbba42e\n",
"2024-10-01 12:59:13,984 - __main__ - DEBUG - delete_subscribe_termination: url: /{sandbox_name}/{mec_pltf}/mec_app_support/v2/applications/{app_inst_id}/subscriptions/{sub_id}\n",
"2024-10-01 12:59:14,004 DEBUG https://mec-platform2.etsi.org:443 \"DELETE /sbxsn3v6jl/mep1/mec_app_support/v2/applications/b49b3ae3-1fd9-48c6-9282-d449dfbba42e/subscriptions/sub-j1XbzihrdTWo-CRi HTTP/1.1\" 204 0\n",
"2024-10-01 12:59:14,006 DEBUG response body: b''\n",
"2024-10-01 12:59:14,009 - __main__ - DEBUG - >>> delete_application_instance_id: sbxsn3v6jl\n",
"2024-10-01 12:59:14,011 - __main__ - DEBUG - >>> delete_application_instance_id: b49b3ae3-1fd9-48c6-9282-d449dfbba42e\n",
"2024-10-01 12:59:14,038 DEBUG https://mec-platform2.etsi.org:443 \"DELETE /sandbox-api/v1/sandboxAppInstances/sbxsn3v6jl/b49b3ae3-1fd9-48c6-9282-d449dfbba42e HTTP/1.1\" 204 0\n",
"2024-10-01 12:59:14,039 DEBUG response body: b''\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"reply: 'HTTP/1.1 204 No Content\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:59:13 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n",
"send: b'DELETE /sbxsn3v6jl/mep1/mec_app_support/v2/applications/b49b3ae3-1fd9-48c6-9282-d449dfbba42e/subscriptions/sub-j1XbzihrdTWo-CRi HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 2\\r\\nAccept: application/json\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"send: b'{}'\n",
"reply: 'HTTP/1.1 204 No Content\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:59:13 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n",
"send: b'DELETE /sandbox-api/v1/sandboxAppInstances/sbxsn3v6jl/b49b3ae3-1fd9-48c6-9282-d449dfbba42e HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 2\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"send: b'{}'\n",
"reply: 'HTTP/1.1 204 No Content\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:59:13 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-01 12:59:20,042 - __main__ - DEBUG - >>> deactivate_network_scenario: sbxsn3v6jl\n",
"2024-10-01 12:59:20,103 DEBUG https://mec-platform2.etsi.org:443 \"DELETE /sandbox-api/v1/sandboxNetworkScenarios/sbxsn3v6jl/4g-5g-macro-v2x HTTP/1.1\" 204 0\n",
"2024-10-01 12:59:20,105 DEBUG response body: b''\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"send: b'DELETE /sandbox-api/v1/sandboxNetworkScenarios/sbxsn3v6jl/4g-5g-macro-v2x HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 2\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"send: b'{}'\n",
"reply: 'HTTP/1.1 204 No Content\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:59:19 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-01 12:59:32,119 - __main__ - DEBUG - >>> process_logout: sandbox=sbxsn3v6jl\n",
"2024-10-01 12:59:32,122 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
"2024-10-01 12:59:32,298 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/logout?sandbox_name=sbxsn3v6jl HTTP/1.1\" 204 0\n",
"2024-10-01 12:59:32,300 DEBUG response body: b''\n",
"2024-10-01 12:59:32,301 - __main__ - DEBUG - Stopped at 20241001-125932\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"send: b'POST /sandbox-api/v1/logout?sandbox_name=sbxsn3v6jl HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 2\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"send: b'{}'\n",
"reply: 'HTTP/1.1 204 No Content\\r\\n'\n",
"header: Date: Tue, 01 Oct 2024 10:59:31 GMT\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
}
],
"source": [
"def process_main():\n",
" \"\"\"\n",
" This is the second sprint of our skeleton of our MEC application:\n",
" - Mec application setup\n",
" - Get UU unicast provisioning information\n",
" - Add subscription\n",
" - Mec application termination\n",
" \"\"\" \n",
" global logger\n",
"\n",
" logger.debug('Starting at ' + time.strftime('%Y%m%d-%H%M%S'))\n",
" logger.debug('\\t pwd= ' + os.getcwd())\n",
"\n",
" # Setup the MEC application\n",
" (sandbox_name, app_inst_id, sub_id) = mec_app_setup()\n",
"\n",
" ecgi = \"268708941961,268711972264\" # List of ecgi spearated by a ','\n",
" result = send_uu_unicast_provisioning_info(sandbox_name, ecgi)\n",
" if result is None:\n",
" logger.error('Failed to get UU unicast provisioning information')\n",
" else:\n",
" logger.info('UU unicast provisioning information: ', str(result))\n",
"\n",
" # Start notification server in a daemonized thread\n",
" notification_server = threading.Thread(name='notification_server', target=HTTPRequestHandler, args=(LISTENER_IP, LISTENER_PORT))\n",
" notification_server.setDaemon(True) # Set as a daemon so it will be killed once the main thread is dead.\n",
" notification_server.start()\n",
" # Continue\n",
"\n",
" # Create a V2X message subscritpion\n",
" filter_criteria = V2xMsgSubscriptionFilterCriteria(['1', '2'], 'ETSI')\n",
" v2xMsgSubscription = V2xMsgSubscription(callback_reference = CALLBACK_URI + '/vis/v2/v2x_msg_notification', filter_criteria = filter_criteria)\n",
" v2x_sub_id, v2x_resource = subscribe_v2x_message(sandbox_name, v2xMsgSubscription)\n",
" if v2x_sub_id is None:\n",
" logger.error('Failed to get UU unicast provisioning information')\n",
"\n",
" # Any processing here\n",
" logger.info('v2x_sub_id: ' + v2x_sub_id)\n",
" logger.info('v2x_resource: ' + v2x_resource)\n",
" time.sleep(STABLE_TIME_OUT)\n",
"\n",
" # Delete the V2X message subscritpion\n",
" delete_mec_subscription(v2x_resource)\n",
"\n",
" # Terminate the MEC application\n",
" mec_app_termination(sandbox_name, app_inst_id, sub_id)\n",
"\n",
" logger.debug('Stopped at ' + time.strftime('%Y%m%d-%H%M%S'))\n",
" # End of function process_main\n",
"\n",
"if __name__ == '__main__':\n",
" process_main()\n"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Create our third MEC application: how to use V2X QoS Prediction\n",
"\n",
"The MEC Sanbox V2X QoS Prediction is based on a grid Map of Monaco City where areas are categorized into residential, commercial and coastal. \n",
"PoA (Point Of Access) s are categorized depending on where they lie in each grid \r\n",
"Each category has its own traffic load patterns which are pre-determin. The V2X QoS PredictionPF) will give more accurate values of RSRP and RSRQ based on the diurnal traffic patterns for each z.\n",
"The network scenario named \"4g-5g-v2x-macro\" must be used to get access to the V2X QoS Prediction feature.)\r\n",
"\n",
"\n",
"Note:\n",
"- b> The MEC Sanbox V2X QoS Prediction\r\n",
"PF is enabled when the PredictedQos.routes.routeInfo.time attribute is present in the requ(ETSI GS MEC 030 Clause 6.2.6 Type: PredictedQo\n",
"- Limitations:\n",
"1. The Location Granularity is currently not being validated as RSRP/RSRP calculations are done at the exact location provided by the user.\r",
"2. The \n",
"Time Granularity is currently not supported by the Prediction Function (design limitations of the minimal, emulated, pre-determined traffic prediction model.)3. \r\n",
"Upper limit on the number of elements (10 each) in the routes and routeInfo structures (arrays) to not affect user experience and response latenci.es\r\n",
").tory\r\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The following cell is under development"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {},
"outputs": [],
"source": [
"def get_qos_prediction(sandbox_name: str, latitude: int, longitude: int) -> int:\n",
" global MEC_PLTF, logger\n",
"\n",
" logger.debug('>>> get_qos_prediction: latitude: ' + str(latitude))\n",
" logger.debug('>>> get_qos_prediction: longitude: ' + str(longitude))\n",
" try:\n",
" url = '/{sandbox_name}/{mec_pltf}/vis/v2//provide_predicted_qos'\n",
" logger.debug('send_uu_unicast_provisioning_info: url: ' + url)\n",
" path_params = {}\n",
" path_params['sandbox_name'] = sandbox_name\n",
" path_params['mec_pltf'] = MEC_PLTF\n",
" # HTTP header `Accept`\n",
" header_params['Accept'] = 'application/json' # noqa: E501\n",
" # HTTP header `Content-Type`\n",
" header_params['Content-Type'] = 'application/json' # noqa: E501\n",
" result = service_api.call_api(url, 'GET', header_params=header_params, path_params=path_params, body=body, async_req=False)\n",
" return result\n",
" except ApiException as e:\n",
" logger.error('Exception when calling call_api: %s\\n' % e)\n",
" return None\n",
" # End of function send_uu_unicast_provisioning_info"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Annexes\n",
"\n",
"## Annex A: How to use an existing MEC sandbox instance\n",
"\n",
"This case is used when the MEC Sandbox API is not used. The procedure is the following:\n",
"- Log to the MEC Sandbox using a WEB browser\n",
"- Select a network scenario\n",
"- Create a new application instance\n",
"\n",
"When it is done, the newly created application instance is used by your application when required. This application instance is usually passed to your application in the command line or using a configuration file\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Bibliography\n",
"\n",
"1. ETSI GS MEC 002 (V2.2.1) (01-2022): \"Multi-access Edge Computing (MEC); Phase 2: Use Cases and Requirements\".\n",
"2. ETSI GS MEC 010-1 (V1.1.1) (10-2017): \"Mobile Edge Computing (MEC); Mobile Edge Management; Part 1: System, host and platform management\".\n",
"3. ETSI GS MEC 010-2 (V2.2.1) (02-2022): \"Multi-access Edge Computing (MEC); MEC Management; Part 2: Application lifecycle, rules and requirements management\".\n",
"4. ETSI GS MEC 011 (V3.1.1) (09-2022): \"Multi-access Edge Computing (MEC); Edge Platform Application Enablement\".\n",
"5. ETSI GS MEC 012 (V2.2.1) (02-2022): \"Multi-access Edge Computing (MEC); Radio Network Information API\".\n",
"6. ETSI GS MEC 013 (V2.2.1) (01-2022): \"Multi-access Edge Computing (MEC); Location API\".\n",
"7. ETSI GS MEC 014 (V2.1.1) (03-2021): \"Multi-access Edge Computing (MEC); UE Identity API\".\n",
"8. ETSI GS MEC 015 (V2.1.1) (06-2020): \"Multi-Access Edge Computing (MEC); Traffic Management APIs\".\n",
"9. ETSI GS MEC 016 (V2.2.1) (04-2020): \"Multi-access Edge Computing (MEC); Device application interface\".\n",
"10. ETSI GS MEC 021 (V2.2.1) (02-2022): \"Multi-access Edge Computing (MEC); Application Mobility Service API\".\n",
"11. ETSI GS MEC 028 (V2.3.1) (07-2022): \"Multi-access Edge Computing (MEC); WLAN Access Information API\".\n",
"12. ETSI GS MEC 029 (V2.2.1) (01-2022): \"Multi-access Edge Computing (MEC); Fixed Access Information API\".\n",
"13. ETSI GS MEC 030 (V3.2.1) (05-2022): \"Multi-access Edge Computing (MEC); V2X Information Service API\".\n",
"14. ETSI GR MEC-DEC 025 (V2.1.1) (06-2019): \"Multi-access Edge Computing (MEC); MEC Testing Framework\".\n",
"15. ETSI GR MEC 001 (V3.1.1) (01-2022): \"Multi-access Edge Computing (MEC); Terminology\".\n",
"16. ETSI GR MEC 003 (V3.1.1): Multi-access Edge Computing (MEC); \n",
"Framework and Reference Architecture\n",
"17. [The Wiki MEC web site](https://www.etsi.org/technologies/multi-access-edge-computing)\n"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
}
},
"nbformat": 4,
"nbformat_minor": 4
}