diff --git a/examples/demo6/python/notebook/MEC application.ipynb b/examples/demo6/python/notebook/MEC application.ipynb
index 2b1f41c4da9c1c58a57744770e83dfe0dc03d588..c19b9722f5bc37c45481f6e24ad1f8a84b977626 100644
--- a/examples/demo6/python/notebook/MEC application.ipynb
+++ b/examples/demo6/python/notebook/MEC application.ipynb
@@ -55,7 +55,11 @@
"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://labs.etsi.org/rep/mec/etsi-mec-sandbox/-/blob/STF678_Task1_2_3_4/go-apps/meep-sandbox-api/api/swagger.yaml).\n",
- "The model folder contains the python implementation of the data type definitions introduced by the openApi [file](https://labs.etsi.org/rep/mec/etsi-mec-sandbox/-/blob/STF678_Task1_2_3_4/go-apps/meep-sandbox-api/api/swagger.yaml).\n"
+ "The model folder contains the python implementation of the data type definitions introduced by the openApi [file](https://labs.etsi.org/rep/mec/etsi-mec-sandbox/-/blob/STF678_Task1_2_3_4/go-apps/meep-sandbox-api/api/swagger.yaml).\n",
+ "\n",
+ "
\n",
+ " Note: The sub-paragraph 'Putting everything together' is a specific paragraph where all the newly features introduced in the main paragraph are put together to create an executable block of code. It is possible to skip this block of code by removing the comment character (#) on first line of this block of code.\n",
+ "
\n"
]
},
{
@@ -68,19 +72,11 @@
},
{
"cell_type": "code",
- "execution_count": 1,
+ "execution_count": null,
"metadata": {
"scrolled": true
},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "/home/jovyan/work/mecapp\n"
- ]
- }
- ],
+ "outputs": [],
"source": [
"import os\n",
"os.chdir(os.path.join(os.getcwd(), '../mecapp'))\n",
@@ -96,7 +92,7 @@
},
{
"cell_type": "code",
- "execution_count": 2,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -136,7 +132,7 @@
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -162,7 +158,7 @@
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -202,7 +198,7 @@
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -253,7 +249,7 @@
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -299,7 +295,7 @@
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -321,7 +317,8 @@
" 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"
+ " # End of function process_logout\n",
+ "\n"
]
},
{
@@ -337,6 +334,8 @@
"metadata": {},
"outputs": [],
"source": [
+ "#%%script echo skipping\n",
+ "# Uncomment the ;line above to skip execution of this cell\n",
"def process_main():\n",
" \"\"\"\n",
" This is the skeleton of our MEC application:\n",
@@ -376,11 +375,7 @@
},
{
"cell_type": "markdown",
- "metadata": {
- "jupyter": {
- "source_hidden": true
- }
- },
+ "metadata": {},
"source": [
"### Second step: Retrieve the list of network scenarios\n",
"\n",
@@ -400,7 +395,7 @@
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -446,6 +441,8 @@
"metadata": {},
"outputs": [],
"source": [
+ "#%%script echo skipping\n",
+ "# Uncomment the ;line above to skip execution of this cell\n",
"def process_main():\n",
" \"\"\"\n",
" This is the first sprint of our skeleton of our MEC application:\n",
@@ -507,7 +504,7 @@
},
{
"cell_type": "code",
- "execution_count": 12,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -532,7 +529,7 @@
},
{
"cell_type": "code",
- "execution_count": 9,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -573,7 +570,7 @@
},
{
"cell_type": "code",
- "execution_count": 10,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -620,174 +617,12 @@
},
{
"cell_type": "code",
- "execution_count": 13,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "2024-11-12 13:17:20,694 - __main__ - DEBUG - Starting at 20241112-131720\n",
- "2024-11-12 13:17:20,695 - __main__ - DEBUG - \t pwd= /home/jovyan/work/mecapp\n",
- "2024-11-12 13:17:20,696 - __main__ - DEBUG - >>> process_login\n",
- "2024-11-12 13:17:20,696 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
- "2024-11-12 13:17:20,779 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/login?provider=Jupyter2024 HTTP/11\" 201 0\n",
- "2024-11-12 13:17:20,780 DEBUG response body: b'{\"user_code\":\"sbxxl3m7gk\",\"verification_uri\":\"\"}'\n",
- "2024-11-12 13:17:20,781 - __main__ - DEBUG - process_login (step1): oauth: {'user_code': 'sbxxl3m7gk', 'verification_uri': ''}\n",
- "2024-11-12 13:17:20,782 - __main__ - DEBUG - =======================> DO AUTHORIZATION WITH CODE : sbxxl3m7gk\n",
- "2024-11-12 13:17:20,783 - __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, 12 Nov 2024 13:17:20 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-11-12 13:17:23,799 DEBUG https://mec-platform2.etsi.org:443 \"GET /sandbox-api/v1/namespace?user_code=sbxxl3m7gk HTTP/11\" 200 0\n",
- "2024-11-12 13:17:23,800 DEBUG response body: b'{\"sandbox_name\":\"sbxxl3m7gk\"}'\n",
- "2024-11-12 13:17:23,802 - __main__ - DEBUG - process_login (step2): result: {'sandbox_name': 'sbxxl3m7gk'}\n",
- "2024-11-12 13:17:23,802 - __main__ - INFO - Sandbox created: sbxxl3m7gk\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "send: b'GET /sandbox-api/v1/namespace?user_code=sbxxl3m7gk 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, 12 Nov 2024 13:17:23 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-11-12 13:17:33,803 - __main__ - DEBUG - >>> get_network_scenarios: sandbox=sbxxl3m7gk\n",
- "2024-11-12 13:17:33,804 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
- "2024-11-12 13:17:33,916 DEBUG https://mec-platform2.etsi.org:443 \"GET /sandbox-api/v1/sandboxNetworkScenarios?sandbox_name=sbxxl3m7gk HTTP/11\" 200 0\n",
- "2024-11-12 13:17:33,917 DEBUG response body: b'[{\"id\":\"4g-5g-macro-v2x\"},{\"id\":\"4g-5g-macro-v2x-fed\"},{\"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-11-12 13:17:33,918 - __main__ - DEBUG - get_network_scenarios: result: [{'id': '4g-5g-macro-v2x'}, {'id': '4g-5g-macro-v2x-fed'}, {'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-11-12 13:17:33,918 - __main__ - INFO - nw_scenarios: \n",
- "2024-11-12 13:17:33,919 - __main__ - INFO - nw_scenarios: [{'id': '4g-5g-macro-v2x'}, {'id': '4g-5g-macro-v2x-fed'}, {'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=sbxxl3m7gk 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, 12 Nov 2024 13:17:33 GMT\n",
- "header: Content-Type: application/json; charset=UTF-8\n",
- "header: Content-Length: 186\n",
- "header: Connection: keep-alive\n",
- "header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "2024-11-12 13:17:43,920 - __main__ - DEBUG - >>> activate_network_scenario: sbxxl3m7gk\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "send: b'POST /sandbox-api/v1/sandboxNetworkScenarios/sbxxl3m7gk?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"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "2024-11-12 13:17:44,933 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/sandboxNetworkScenarios/sbxxl3m7gk?network_scenario_id=4g-5g-macro-v2x HTTP/11\" 204 0\n",
- "2024-11-12 13:17:44,934 DEBUG response body: b''\n",
- "2024-11-12 13:17:44,940 - __main__ - INFO - Network scenario activated: 4g-5g-macro-v2x\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "reply: 'HTTP/1.1 204 No Content\\r\\n'\n",
- "header: Date: Tue, 12 Nov 2024 13:17:44 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-11-12 13:18:04,940 - __main__ - 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",
- "2024-11-12 13:18:34,941 - __main__ - DEBUG - >>> deactivate_network_scenario: sbxxl3m7gk\n",
- "2024-11-12 13:18:34,943 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
- "2024-11-12 13:18:35,247 DEBUG https://mec-platform2.etsi.org:443 \"DELETE /sandbox-api/v1/sandboxNetworkScenarios/sbxxl3m7gk/4g-5g-macro-v2x HTTP/11\" 204 0\n",
- "2024-11-12 13:18:35,248 DEBUG response body: b''\n",
- "2024-11-12 13:18:35,249 - __main__ - INFO - Network scenario deactivated: 4g-5g-macro-v2x\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "send: b'DELETE /sandbox-api/v1/sandboxNetworkScenarios/sbxxl3m7gk/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, 12 Nov 2024 13:18:35 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-11-12 13:18:55,251 - __main__ - DEBUG - >>> process_logout: sandbox=sbxxl3m7gk\n",
- "2024-11-12 13:18:55,252 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
- "2024-11-12 13:18:55,301 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/logout?sandbox_name=sbxxl3m7gk HTTP/11\" 204 0\n",
- "2024-11-12 13:18:55,302 DEBUG response body: b''\n",
- "2024-11-12 13:18:55,302 - __main__ - DEBUG - To check that logout is effective, verify on the MEC Sandbox server that the MEC Sandbox is removed (kubectl get pods -A)\n",
- "2024-11-12 13:18:55,302 - __main__ - DEBUG - Stopped at 20241112-131855\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "send: b'POST /sandbox-api/v1/logout?sandbox_name=sbxxl3m7gk 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, 12 Nov 2024 13:18:55 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"
- ]
- }
- ],
+ "outputs": [],
"source": [
+ "#%%script echo skipping\n",
+ "# Uncomment the ;line above to skip execution of this cell\n",
"def process_main():\n",
" \"\"\"\n",
" This is the second sprint of our skeleton of our MEC application:\n",
@@ -878,7 +713,7 @@
},
{
"cell_type": "code",
- "execution_count": 14,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -917,7 +752,7 @@
},
{
"cell_type": "code",
- "execution_count": 15,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -953,7 +788,7 @@
},
{
"cell_type": "code",
- "execution_count": 16,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -1006,6 +841,8 @@
"metadata": {},
"outputs": [],
"source": [
+ "#%%script echo skipping\n",
+ "# Uncomment the ;line above to skip execution of this cell\n",
"def process_main():\n",
" \"\"\"\n",
" This is the second sprint of our skeleton of our MEC application:\n",
@@ -1133,7 +970,7 @@
},
{
"cell_type": "code",
- "execution_count": 17,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -1198,7 +1035,7 @@
},
{
"cell_type": "code",
- "execution_count": 18,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -1234,7 +1071,7 @@
" return (result, 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",
+ " return (None, status, None)\n",
" # End of function send_subscribe_termination"
]
},
@@ -1249,7 +1086,7 @@
},
{
"cell_type": "code",
- "execution_count": 19,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -1281,7 +1118,7 @@
},
{
"cell_type": "code",
- "execution_count": 20,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -1329,7 +1166,7 @@
},
{
"cell_type": "code",
- "execution_count": 21,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -1396,6 +1233,8 @@
"metadata": {},
"outputs": [],
"source": [
+ "#%%script echo skipping\n",
+ "# Uncomment the ;line above to skip execution of this cell\n",
"def process_main():\n",
" \"\"\"\n",
" This is the second sprint of our skeleton of our MEC application:\n",
@@ -1528,7 +1367,7 @@
},
{
"cell_type": "code",
- "execution_count": 22,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -1606,7 +1445,7 @@
},
{
"cell_type": "code",
- "execution_count": 23,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -1663,6 +1502,8 @@
"metadata": {},
"outputs": [],
"source": [
+ "#%%script echo skipping\n",
+ "# Uncomment the ;line above to skip execution of this cell\n",
"def process_main():\n",
" \"\"\"\n",
" This is the second sprint of our skeleton of our MEC application:\n",
@@ -1715,7 +1556,7 @@
},
{
"cell_type": "code",
- "execution_count": 24,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -1746,7 +1587,7 @@
" return (result, status)\n",
" except ApiException as e:\n",
" logger.error('Exception when calling call_api: %s\\n' % e)\n",
- " return None\n",
+ " return (None, status)\n",
" # End of function get_ue_location"
]
},
@@ -1822,6 +1663,8 @@
"metadata": {},
"outputs": [],
"source": [
+ "#%%script echo skipping\n",
+ "# Uncomment the ;line above to skip execution of this cell\n",
"def process_main():\n",
" \"\"\"\n",
" This is the second sprint of our skeleton of our MEC application:\n",
@@ -1890,7 +1733,7 @@
},
{
"cell_type": "code",
- "execution_count": 25,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -1905,12 +1748,19 @@
" ctype = self.headers.get('content-type')\n",
" logger.info('do_GET: ' + ctype)\n",
"\n",
+ " message = ''\n",
+ " if self.path == '/statistic/v1/quantity':\n",
+ " logger.info('do_GET: Computing statistic quantities for application MEC service')\n",
+ " # TODO Add logit to our MEC service\n",
+ " message = '{\"time\":20180124,\"avg\": 0.0,\"max\": 0.0,\"min\": 0.0,\"stddev\": 0.0 }'\n",
+ " else:\n",
+ " # Send message back to client\n",
+ " message = bytes(str(self.headers) + \"\\n\" +self.requestline +\"\\n\", 'utf8')\n",
+ " logger.info('do_GET: message: ' + message)\n",
+ " \n",
" # Send response status code\n",
" self.send_response(HTTPStatus.OK)\n",
"\n",
- " # Send message back to client\n",
- " message = bytes(str(self.headers) + \"\\n\" +self.requestline +\"\\n\", 'utf8')\n",
- "\n",
" # Send headers\n",
" self.send_header('Content-type','text/plain; charset=utf-8')\n",
" self.send_header('Content-length', str(len(message)))\n",
@@ -1983,10 +1833,10 @@
" Start the notification server\n",
" :return The instance of the HTTP server\n",
" \"\"\"\n",
- " global LISTENER_PORT, got_notification\n",
+ " global LISTENER_PORT, got_notification, logger\n",
"\n",
+ " logger.debug('>>> start_notification_server on port ' + str(LISTENER_PORT))\n",
" got_notification = False\n",
- "\n",
" server_address = ('', LISTENER_PORT)\n",
" httpd = HTTPServer(server_address, HTTPServer_RequestHandler)\n",
" # Start notification server in a daemonized thread\n",
@@ -2001,6 +1851,9 @@
" Stop the notification server\n",
" :param The instance of the HTTP server\n",
" \"\"\"\n",
+ " global logger\n",
+ "\n",
+ " logger.debug('>>> stop_notification_server')\n",
" httpd.server_close()\n",
" httpd=None\n",
" # End of function HTTPRequestHandler\n"
@@ -2008,7 +1861,7 @@
},
{
"cell_type": "code",
- "execution_count": 26,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -2046,7 +1899,7 @@
" return (result, 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",
+ " return (None, None, None)\n",
" # End of function subscribe_for_user_are_event"
]
},
@@ -2070,310 +1923,14 @@
},
{
"cell_type": "code",
- "execution_count": 29,
+ "execution_count": null,
"metadata": {
"scrolled": true
},
- "outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "2024-11-12 13:26:28,384 - __main__ - DEBUG - Starting at 20241112-132628\n",
- "2024-11-12 13:26:28,385 - __main__ - DEBUG - \t pwd= /home/jovyan/work/mecapp\n",
- "2024-11-12 13:26:28,388 - __main__ - DEBUG - >>> process_login\n",
- "2024-11-12 13:26:28,390 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
- "2024-11-12 13:26:28,457 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/login?provider=Jupyter2024 HTTP/11\" 201 0\n",
- "2024-11-12 13:26:28,463 DEBUG response body: b'{\"user_code\":\"sbxlm5h1yu\",\"verification_uri\":\"\"}'\n",
- "2024-11-12 13:26:28,464 - __main__ - DEBUG - process_login (step1): oauth: {'user_code': 'sbxlm5h1yu', 'verification_uri': ''}\n",
- "2024-11-12 13:26:28,465 - __main__ - DEBUG - =======================> DO AUTHORIZATION WITH CODE : sbxlm5h1yu\n",
- "2024-11-12 13:26:28,466 - __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, 12 Nov 2024 13:26:28 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-11-12 13:26:31,477 DEBUG https://mec-platform2.etsi.org:443 \"GET /sandbox-api/v1/namespace?user_code=sbxlm5h1yu HTTP/11\" 200 0\n",
- "2024-11-12 13:26:31,478 DEBUG response body: b'{\"sandbox_name\":\"sbxlm5h1yu\"}'\n",
- "2024-11-12 13:26:31,479 - __main__ - DEBUG - process_login (step2): result: {'sandbox_name': 'sbxlm5h1yu'}\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "send: b'GET /sandbox-api/v1/namespace?user_code=sbxlm5h1yu 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, 12 Nov 2024 13:26:31 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-11-12 13:26:41,481 - __main__ - DEBUG - >>> get_network_scenarios: sandbox=sbxlm5h1yu\n",
- "2024-11-12 13:26:41,483 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
- "2024-11-12 13:26:41,566 DEBUG https://mec-platform2.etsi.org:443 \"GET /sandbox-api/v1/sandboxNetworkScenarios?sandbox_name=sbxlm5h1yu HTTP/11\" 200 0\n",
- "2024-11-12 13:26:41,568 DEBUG response body: b'[{\"id\":\"4g-5g-macro-v2x\"},{\"id\":\"4g-5g-macro-v2x-fed\"},{\"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-11-12 13:26:41,568 - __main__ - DEBUG - get_network_scenarios: result: [{'id': '4g-5g-macro-v2x'}, {'id': '4g-5g-macro-v2x-fed'}, {'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=sbxlm5h1yu 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, 12 Nov 2024 13:26:41 GMT\n",
- "header: Content-Type: application/json; charset=UTF-8\n",
- "header: Content-Length: 186\n",
- "header: Connection: keep-alive\n",
- "header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "2024-11-12 13:26:51,569 - __main__ - DEBUG - >>> activate_network_scenario: sbxlm5h1yu\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "send: b'POST /sandbox-api/v1/sandboxNetworkScenarios/sbxlm5h1yu?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"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "2024-11-12 13:26:53,000 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/sandboxNetworkScenarios/sbxlm5h1yu?network_scenario_id=4g-5g-macro-v2x HTTP/11\" 204 0\n",
- "2024-11-12 13:26:53,006 DEBUG response body: b''\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "reply: 'HTTP/1.1 204 No Content\\r\\n'\n",
- "header: Date: Tue, 12 Nov 2024 13:26:52 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-11-12 13:27:13,007 - __main__ - DEBUG - >>> request_application_instance_id: sbxlm5h1yu\n",
- "2024-11-12 13:27:13,009 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
- "2024-11-12 13:27:13,101 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/sandboxAppInstances/sbxlm5h1yu HTTP/11\" 201 0\n",
- "2024-11-12 13:27:13,102 DEBUG response body: b'{\"id\":\"546415bd-46a0-459c-a5da-1fd80b2719e5\",\"name\":\"JupyterMecApp\",\"nodeName\":\"mep1\",\"type\":\"USER\"}'\n",
- "2024-11-12 13:27:13,104 - __main__ - DEBUG - request_application_instance_id: result: {'id': '546415bd-46a0-459c-a5da-1fd80b2719e5',\n",
- " 'name': 'JupyterMecApp',\n",
- " 'node_name': 'mep1',\n",
- " 'persist': None,\n",
- " 'type': 'USER'}\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "send: b'POST /sandbox-api/v1/sandboxAppInstances/sbxlm5h1yu 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\": \"546415bd-46a0-459c-a5da-1fd80b2719e5\", \"name\": \"JupyterMecApp\", \"nodeName\": \"mep1\", \"type\": \"USER\"}'\n",
- "reply: 'HTTP/1.1 201 Created\\r\\n'\n",
- "header: Date: Tue, 12 Nov 2024 13:27:13 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-11-12 13:27:23,105 - __main__ - DEBUG - >>> send_ready_confirmation: 546415bd-46a0-459c-a5da-1fd80b2719e5\n",
- "2024-11-12 13:27:23,106 - __main__ - DEBUG - send_ready_confirmation: url: /{sandbox_name}/{mec_pltf}/mec_app_support/v2/applications/{app_inst_id}/confirm_ready\n",
- "2024-11-12 13:27:23,107 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
- "2024-11-12 13:27:23,156 DEBUG https://mec-platform2.etsi.org:443 \"POST /sbxlm5h1yu/mep1/mec_app_support/v2/applications/546415bd-46a0-459c-a5da-1fd80b2719e5/confirm_ready HTTP/11\" 204 0\n",
- "2024-11-12 13:27:23,159 DEBUG response body: b''\n",
- "2024-11-12 13:27:23,160 - __main__ - DEBUG - >>> send_subscribe_termination: 546415bd-46a0-459c-a5da-1fd80b2719e5\n",
- "2024-11-12 13:27:23,166 - __main__ - DEBUG - send_subscribe_termination: url: /{sandbox_name}/{mec_pltf}/mec_app_support/v2/applications/{app_inst_id}/subscriptions\n",
- "2024-11-12 13:27:23,171 DEBUG https://mec-platform2.etsi.org:443 \"POST /sbxlm5h1yu/mep1/mec_app_support/v2/applications/546415bd-46a0-459c-a5da-1fd80b2719e5/subscriptions HTTP/11\" 201 0\n",
- "2024-11-12 13:27:23,173 DEBUG response body: b'{\"subscriptionType\":\"AppTerminationNotificationSubscription\",\"callbackReference\":\"http://mec-platform2.etsi.org:31111/sandbox/v1/mec011/v2/termination\",\"_links\":{\"self\":{\"href\":\"https://mec-platform2.etsi.org/sbxlm5h1yu/mep1/mec_app_support/v2/applications/546415bd-46a0-459c-a5da-1fd80b2719e5/subscriptions/sub-LtLIjh4RP1-aiUeZ\"}},\"appInstanceId\":\"546415bd-46a0-459c-a5da-1fd80b2719e5\"}'\n",
- "2024-11-12 13:27:23,175 - __main__ - DEBUG - >>> extract_sub_id: resource_url: https://mec-platform2.etsi.org/sbxlm5h1yu/mep1/mec_app_support/v2/applications/546415bd-46a0-459c-a5da-1fd80b2719e5/subscriptions/sub-LtLIjh4RP1-aiUeZ\n",
- "2024-11-12 13:27:23,176 - __main__ - DEBUG - >>> subscribe_for_user_events: sbxlm5h1yu\n",
- "2024-11-12 13:27:23,177 - __main__ - DEBUG - subscribe_for_user_events: url: /{sandbox_name}/{mec_pltf}//location/v3/subscriptions/users\n",
- "2024-11-12 13:27:23,184 DEBUG https://mec-platform2.etsi.org:443 \"POST /sbxlm5h1yu/mep1//location/v3/subscriptions/users HTTP/11\" 201 0\n",
- "2024-11-12 13:27:23,185 DEBUG response body: b'{\"userLocationEventSubscription\":{\"_links\":{\"self\":{\"href\":\"https://mec-platform2.etsi.org/sbxlm5h1yu/mep1/location/v3/subscriptions/users/2\"}},\"address\":\"10.100.0.1\",\"callbackReference\":\"http://mec-platform2.etsi.org:31111/sandbox/v1/mec013/v3/location\",\"clientCorrelator\":\"12345\",\"locationEventCriteria\":[\"ENTERING_AREA_EVENT\",\"LEAVING_AREA_EVENT\"],\"subscriptionType\":\"UserLocationEventSubscription\"}}'\n",
- "2024-11-12 13:27:23,186 - __main__ - DEBUG - >>> extract_sub_id: resource_url: https://mec-platform2.etsi.org/sbxlm5h1yu/mep1/location/v3/subscriptions/users/2\n",
- "2024-11-12 13:27:23,188 - __main__ - INFO - UE location information: status: 2\n",
- "2024-11-12 13:27:23,188 - __main__ - ERROR - Failed to get UE location information\n",
- "2024-11-12 13:27:23,203 - __main__ - DEBUG - >>> get_ue_location: 10.100.0.1\n",
- "2024-11-12 13:27:23,207 - __main__ - DEBUG - get_ue_location: url: /{sandbox_name}/{mec_pltf}/location/v3/queries/users\n",
- "2024-11-12 13:27:23,220 DEBUG https://mec-platform2.etsi.org:443 \"GET /sbxlm5h1yu/mep1/location/v3/queries/users?address=10.100.0.1 HTTP/11\" 200 0\n",
- "2024-11-12 13:27:23,221 DEBUG response body: b'{\"userList\":{\"resourceURL\":\"https://mec-platform2.etsi.org/sbxlm5h1yu/mep1/location/v3/queries/users\",\"user\":[{\"address\":\"10.100.0.1\",\"accessPointId\":\"5g-small-cell-2\",\"zoneId\":\"zone01\",\"resourceURL\":\"https://mec-platform2.etsi.org/sbxlm5h1yu/mep1/location/v3/queries/users?address=10.100.0.1\",\"timestamp\":{\"nanoSeconds\":0,\"seconds\":1731418042},\"locationInfo\":{\"latitude\":[43.73147],\"longitude\":[7.417372],\"shape\":2},\"civicInfo\":{\"country\":\"MC\"},\"relativeLocationInfo\":{\"X\":7.594824,\"Y\":-314.42572,\"mapInfo\":{\"mapId\":\"324561243\",\"origin\":{\"latitude\":43.7314,\"longitude\":7.4202}}}}]}}'\n",
- "2024-11-12 13:27:23,222 - __main__ - INFO - UE location information: status: 200\n",
- "2024-11-12 13:27:23,222 - __main__ - INFO - UE location information: b'{\"userList\":{\"resourceURL\":\"https://mec-platform2.etsi.org/sbxlm5h1yu/mep1/location/v3/queries/users\",\"user\":[{\"address\":\"10.100.0.1\",\"accessPointId\":\"5g-small-cell-2\",\"zoneId\":\"zone01\",\"resourceURL\":\"https://mec-platform2.etsi.org/sbxlm5h1yu/mep1/location/v3/queries/users?address=10.100.0.1\",\"timestamp\":{\"nanoSeconds\":0,\"seconds\":1731418042},\"locationInfo\":{\"latitude\":[43.73147],\"longitude\":[7.417372],\"shape\":2},\"civicInfo\":{\"country\":\"MC\"},\"relativeLocationInfo\":{\"X\":7.594824,\"Y\":-314.42572,\"mapInfo\":{\"mapId\":\"324561243\",\"origin\":{\"latitude\":43.7314,\"longitude\":7.4202}}}}]}}'\n",
- "2024-11-12 13:27:23,223 - __main__ - INFO - Waiting for subscription...\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "send: b'POST /sbxlm5h1yu/mep1/mec_app_support/v2/applications/546415bd-46a0-459c-a5da-1fd80b2719e5/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, 12 Nov 2024 13:27:23 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 /sbxlm5h1yu/mep1/mec_app_support/v2/applications/546415bd-46a0-459c-a5da-1fd80b2719e5/subscriptions HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 212\\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://mec-platform2.etsi.org:31111/sandbox/v1/mec011/v2/termination\", \"appInstanceId\": \"546415bd-46a0-459c-a5da-1fd80b2719e5\"}'\n",
- "reply: 'HTTP/1.1 201 Created\\r\\n'\n",
- "header: Date: Tue, 12 Nov 2024 13:27:23 GMT\n",
- "header: Content-Type: application/json; charset=UTF-8\n",
- "header: Content-Length: 387\n",
- "header: Connection: keep-alive\n",
- "header: Location: https://mec-platform2.etsi.org/sbxlm5h1yu/mep1/mec_app_support/v2/applications/546415bd-46a0-459c-a5da-1fd80b2719e5/subscriptions/sub-LtLIjh4RP1-aiUeZ\n",
- "header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n",
- "send: b'POST /sbxlm5h1yu/mep1//location/v3/subscriptions/users HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 304\\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'{\"userLocationEventSubscription\": {\"subscriptionType\": \"UserLocationEventSubscription\", \"callbackReference\": \"http://mec-platform2.etsi.org:31111/sandbox/v1/mec013/v3/location\", \"address\": \"10.100.0.1\", \"clientCorrelator\": \"12345\", \"locationEventCriteria\": [\"ENTERING_AREA_EVENT\", \"LEAVING_AREA_EVENT\"]}}'\n",
- "reply: 'HTTP/1.1 201 Created\\r\\n'\n",
- "header: Date: Tue, 12 Nov 2024 13:27:23 GMT\n",
- "header: Content-Type: application/json; charset=UTF-8\n",
- "header: Content-Length: 403\n",
- "header: Connection: keep-alive\n",
- "header: Location: https://mec-platform2.etsi.org/sbxlm5h1yu/mep1/location/v3/subscriptions/users/2\n",
- "header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n",
- "send: b'GET /sbxlm5h1yu/mep1/location/v3/queries/users?address=10.100.0.1 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, 12 Nov 2024 13:27:23 GMT\n",
- "header: Content-Type: application/json; charset=UTF-8\n",
- "header: Content-Length: 583\n",
- "header: Connection: keep-alive\n",
- "header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "2024-11-12 13:27:33,223 - __main__ - INFO - Waiting for subscription...\n",
- "2024-11-12 13:27:43,224 - __main__ - INFO - Waiting for subscription...\n",
- "2024-11-12 13:27:53,225 - __main__ - INFO - Waiting for subscription...\n",
- "2024-11-12 13:28:03,227 - __main__ - INFO - Waiting for subscription...\n",
- "2024-11-12 13:28:13,228 - __main__ - INFO - Waiting for subscription...\n",
- "2024-11-12 13:28:23,229 - __main__ - INFO - Waiting for subscription...\n",
- "2024-11-12 13:28:33,231 - __main__ - INFO - Waiting for subscription...\n",
- "2024-11-12 13:28:43,232 - __main__ - INFO - Waiting for subscription...\n",
- "2024-11-12 13:28:53,233 - __main__ - INFO - Waiting for subscription...\n",
- "2024-11-12 13:29:03,234 - __main__ - DEBUG - >>> delete_subscribe_termination: 546415bd-46a0-459c-a5da-1fd80b2719e5\n",
- "2024-11-12 13:29:03,235 - __main__ - DEBUG - delete_subscribe_termination: url: /{sandbox_name}/{mec_pltf}/mec_app_support/v2/applications/{app_inst_id}/subscriptions/{sub_id}\n",
- "2024-11-12 13:29:03,235 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
- "2024-11-12 13:29:03,270 DEBUG https://mec-platform2.etsi.org:443 \"DELETE /sbxlm5h1yu/mep1/mec_app_support/v2/applications/546415bd-46a0-459c-a5da-1fd80b2719e5/subscriptions/sub-LtLIjh4RP1-aiUeZ HTTP/11\" 204 0\n",
- "2024-11-12 13:29:03,272 DEBUG response body: b''\n",
- "2024-11-12 13:29:03,273 - __main__ - DEBUG - >>> delete_application_instance_id: sbxlm5h1yu\n",
- "2024-11-12 13:29:03,274 - __main__ - DEBUG - >>> delete_application_instance_id: 546415bd-46a0-459c-a5da-1fd80b2719e5\n",
- "2024-11-12 13:29:03,275 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
- "2024-11-12 13:29:03,415 DEBUG https://mec-platform2.etsi.org:443 \"DELETE /sandbox-api/v1/sandboxAppInstances/sbxlm5h1yu/546415bd-46a0-459c-a5da-1fd80b2719e5 HTTP/11\" 204 0\n",
- "2024-11-12 13:29:03,416 DEBUG response body: b''\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "send: b'DELETE /sbxlm5h1yu/mep1/mec_app_support/v2/applications/546415bd-46a0-459c-a5da-1fd80b2719e5/subscriptions/sub-LtLIjh4RP1-aiUeZ 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, 12 Nov 2024 13:29:03 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/sbxlm5h1yu/546415bd-46a0-459c-a5da-1fd80b2719e5 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, 12 Nov 2024 13:29:03 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-11-12 13:29:13,417 - __main__ - DEBUG - >>> deactivate_network_scenario: sbxlm5h1yu\n",
- "2024-11-12 13:29:13,445 DEBUG https://mec-platform2.etsi.org:443 \"DELETE /sandbox-api/v1/sandboxNetworkScenarios/sbxlm5h1yu/4g-5g-macro-v2x HTTP/11\" 204 0\n",
- "2024-11-12 13:29:13,447 DEBUG response body: b''\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "send: b'DELETE /sandbox-api/v1/sandboxNetworkScenarios/sbxlm5h1yu/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, 12 Nov 2024 13:29: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-11-12 13:29:33,451 - __main__ - DEBUG - >>> process_logout: sandbox=sbxlm5h1yu\n",
- "2024-11-12 13:29:33,452 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
- "2024-11-12 13:29:33,560 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/logout?sandbox_name=sbxlm5h1yu HTTP/11\" 204 0\n",
- "2024-11-12 13:29:33,562 DEBUG response body: b''\n",
- "2024-11-12 13:29:33,563 - __main__ - DEBUG - Stopped at 20241112-132933\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "send: b'POST /sandbox-api/v1/logout?sandbox_name=sbxlm5h1yu 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, 12 Nov 2024 13:29:33 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"
- ]
- }
- ],
+ "outputs": [],
"source": [
+ "#%%script echo skipping\n",
+ "# Uncomment the ;line above to skip execution of this cell\n",
"def process_main():\n",
" \"\"\"\n",
" This is the second sprint of our skeleton of our MEC application:\n",
@@ -2458,7 +2015,7 @@
},
{
"cell_type": "code",
- "execution_count": 30,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -2490,7 +2047,7 @@
" return (result, status, header)\n",
" except ApiException as e:\n",
" logger.error('Exception when calling call_api: %s\\n' % e)\n",
- " return None\n",
+ " return (None, status, None)\n",
" # End of function send_uu_unicast_provisioning_info"
]
},
@@ -2520,6 +2077,8 @@
"metadata": {},
"outputs": [],
"source": [
+ "#%%script echo skipping\n",
+ "# Uncomment the ;line above to skip execution of this cell\n",
"def process_main():\n",
" \"\"\"\n",
" This is the second sprint of our skeleton of our MEC application:\n",
@@ -2580,7 +2139,7 @@
},
{
"cell_type": "code",
- "execution_count": 31,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -2745,7 +2304,7 @@
},
{
"cell_type": "code",
- "execution_count": 32,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -2899,7 +2458,7 @@
},
{
"cell_type": "code",
- "execution_count": 33,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -2930,7 +2489,7 @@
" return (result, status, 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",
+ " return (None, status, None)\n",
" # End of function subscribe_v2x_message"
]
},
@@ -2943,7 +2502,7 @@
},
{
"cell_type": "code",
- "execution_count": 34,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -2986,6 +2545,8 @@
"metadata": {},
"outputs": [],
"source": [
+ "#%%script echo skipping\n",
+ "# Uncomment the ;line above to skip execution of this cell\n",
"def process_main():\n",
" \"\"\"\n",
" This is the second sprint of our skeleton of our MEC application:\n",
@@ -3053,6 +2614,8 @@
"metadata": {},
"outputs": [],
"source": [
+ "#%%script echo skipping\n",
+ "# Uncomment the ;line above to skip execution of this cell\n",
"def process_main():\n",
" \"\"\"\n",
" This is the third sprint of our skeleton of our MEC application:\n",
@@ -3213,7 +2776,7 @@
},
{
"cell_type": "code",
- "execution_count": 35,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -3862,7 +3425,7 @@
},
{
"cell_type": "code",
- "execution_count": 36,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -3898,7 +3461,7 @@
" return (result, status, headers)\n",
" except ApiException as e:\n",
" logger.error('Exception when calling call_api: %s\\n' % e)\n",
- " return None\n",
+ " return (None, status, None)\n",
" # End of function send_uu_unicast_provisioning_info"
]
},
@@ -3918,282 +3481,12 @@
},
{
"cell_type": "code",
- "execution_count": 37,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "2024-11-12 13:31:23,547 - __main__ - DEBUG - Starting at 20241112-133123\n",
- "2024-11-12 13:31:23,548 - __main__ - DEBUG - \t pwd= /home/jovyan/work/mecapp\n",
- "2024-11-12 13:31:23,549 - __main__ - DEBUG - >>> process_login\n",
- "2024-11-12 13:31:23,550 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
- "2024-11-12 13:31:23,621 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/login?provider=Jupyter2024 HTTP/11\" 201 0\n",
- "2024-11-12 13:31:23,622 DEBUG response body: b'{\"user_code\":\"sbx8rconuz\",\"verification_uri\":\"\"}'\n",
- "2024-11-12 13:31:23,624 - __main__ - DEBUG - process_login (step1): oauth: {'user_code': 'sbx8rconuz', 'verification_uri': ''}\n",
- "2024-11-12 13:31:23,626 - __main__ - DEBUG - =======================> DO AUTHORIZATION WITH CODE : sbx8rconuz\n",
- "2024-11-12 13:31:23,627 - __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, 12 Nov 2024 13:31:23 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-11-12 13:31:26,637 DEBUG https://mec-platform2.etsi.org:443 \"GET /sandbox-api/v1/namespace?user_code=sbx8rconuz HTTP/11\" 200 0\n",
- "2024-11-12 13:31:26,639 DEBUG response body: b'{\"sandbox_name\":\"sbx8rconuz\"}'\n",
- "2024-11-12 13:31:26,642 - __main__ - DEBUG - process_login (step2): result: {'sandbox_name': 'sbx8rconuz'}\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "send: b'GET /sandbox-api/v1/namespace?user_code=sbx8rconuz 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, 12 Nov 2024 13:31:26 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-11-12 13:31:36,642 - __main__ - DEBUG - >>> get_network_scenarios: sandbox=sbx8rconuz\n",
- "2024-11-12 13:31:36,644 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
- "2024-11-12 13:31:36,747 DEBUG https://mec-platform2.etsi.org:443 \"GET /sandbox-api/v1/sandboxNetworkScenarios?sandbox_name=sbx8rconuz HTTP/11\" 200 0\n",
- "2024-11-12 13:31:36,748 DEBUG response body: b'[{\"id\":\"4g-5g-macro-v2x\"},{\"id\":\"4g-5g-macro-v2x-fed\"},{\"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-11-12 13:31:36,750 - __main__ - DEBUG - get_network_scenarios: result: [{'id': '4g-5g-macro-v2x'}, {'id': '4g-5g-macro-v2x-fed'}, {'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=sbx8rconuz 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, 12 Nov 2024 13:31:36 GMT\n",
- "header: Content-Type: application/json; charset=UTF-8\n",
- "header: Content-Length: 186\n",
- "header: Connection: keep-alive\n",
- "header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "2024-11-12 13:31:46,752 - __main__ - DEBUG - >>> activate_network_scenario: sbx8rconuz\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "send: b'POST /sandbox-api/v1/sandboxNetworkScenarios/sbx8rconuz?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"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "2024-11-12 13:31:47,980 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/sandboxNetworkScenarios/sbx8rconuz?network_scenario_id=4g-5g-macro-v2x HTTP/11\" 204 0\n",
- "2024-11-12 13:31:47,983 DEBUG response body: b''\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "reply: 'HTTP/1.1 204 No Content\\r\\n'\n",
- "header: Date: Tue, 12 Nov 2024 13:31:47 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-11-12 13:32:07,984 - __main__ - DEBUG - >>> request_application_instance_id: sbx8rconuz\n",
- "2024-11-12 13:32:07,986 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
- "2024-11-12 13:32:08,065 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/sandboxAppInstances/sbx8rconuz HTTP/11\" 201 0\n",
- "2024-11-12 13:32:08,067 DEBUG response body: b'{\"id\":\"ac6d042f-b52e-4480-b850-33c4c2520474\",\"name\":\"JupyterMecApp\",\"nodeName\":\"mep1\",\"type\":\"USER\"}'\n",
- "2024-11-12 13:32:08,071 - __main__ - DEBUG - request_application_instance_id: result: {'id': 'ac6d042f-b52e-4480-b850-33c4c2520474',\n",
- " 'name': 'JupyterMecApp',\n",
- " 'node_name': 'mep1',\n",
- " 'persist': None,\n",
- " 'type': 'USER'}\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "send: b'POST /sandbox-api/v1/sandboxAppInstances/sbx8rconuz 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\": \"ac6d042f-b52e-4480-b850-33c4c2520474\", \"name\": \"JupyterMecApp\", \"nodeName\": \"mep1\", \"type\": \"USER\"}'\n",
- "reply: 'HTTP/1.1 201 Created\\r\\n'\n",
- "header: Date: Tue, 12 Nov 2024 13:32:08 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-11-12 13:32:18,072 - __main__ - DEBUG - >>> send_ready_confirmation: ac6d042f-b52e-4480-b850-33c4c2520474\n",
- "2024-11-12 13:32:18,074 - __main__ - DEBUG - send_ready_confirmation: url: /{sandbox_name}/{mec_pltf}/mec_app_support/v2/applications/{app_inst_id}/confirm_ready\n",
- "2024-11-12 13:32:18,074 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
- "2024-11-12 13:32:18,117 DEBUG https://mec-platform2.etsi.org:443 \"POST /sbx8rconuz/mep1/mec_app_support/v2/applications/ac6d042f-b52e-4480-b850-33c4c2520474/confirm_ready HTTP/11\" 204 0\n",
- "2024-11-12 13:32:18,118 DEBUG response body: b''\n",
- "2024-11-12 13:32:18,119 - __main__ - DEBUG - >>> send_subscribe_termination: ac6d042f-b52e-4480-b850-33c4c2520474\n",
- "2024-11-12 13:32:18,120 - __main__ - DEBUG - send_subscribe_termination: url: /{sandbox_name}/{mec_pltf}/mec_app_support/v2/applications/{app_inst_id}/subscriptions\n",
- "2024-11-12 13:32:18,126 DEBUG https://mec-platform2.etsi.org:443 \"POST /sbx8rconuz/mep1/mec_app_support/v2/applications/ac6d042f-b52e-4480-b850-33c4c2520474/subscriptions HTTP/11\" 201 0\n",
- "2024-11-12 13:32:18,127 DEBUG response body: b'{\"subscriptionType\":\"AppTerminationNotificationSubscription\",\"callbackReference\":\"http://mec-platform2.etsi.org:31111/sandbox/v1/mec011/v2/termination\",\"_links\":{\"self\":{\"href\":\"https://mec-platform2.etsi.org/sbx8rconuz/mep1/mec_app_support/v2/applications/ac6d042f-b52e-4480-b850-33c4c2520474/subscriptions/sub-uRWBHjrCD7tGrHc0\"}},\"appInstanceId\":\"ac6d042f-b52e-4480-b850-33c4c2520474\"}'\n",
- "2024-11-12 13:32:18,128 - __main__ - DEBUG - >>> extract_sub_id: resource_url: https://mec-platform2.etsi.org/sbx8rconuz/mep1/mec_app_support/v2/applications/ac6d042f-b52e-4480-b850-33c4c2520474/subscriptions/sub-uRWBHjrCD7tGrHc0\n",
- "2024-11-12 13:32:18,128 - __main__ - DEBUG - >>> get_qos_prediction: sandbox_name: sbx8rconuz\n",
- "2024-11-12 13:32:18,129 - __main__ - DEBUG - send_uu_unicast_provisioning_info: url: /{sandbox_name}/{mec_pltf}/vis/v2/provide_predicted_qos\n",
- "2024-11-12 13:32:18,160 DEBUG https://mec-platform2.etsi.org:443 \"POST /sbx8rconuz/mep1/vis/v2/provide_predicted_qos HTTP/11\" 200 0\n",
- "2024-11-12 13:32:18,162 DEBUG response body: b'{\"locationGranularity\":\"30\",\"predictionTarget\":\"SINGLE_UE_PREDICTION\",\"qos\":{\"stream\":[{\"streamId\":\"0\",\"qosKpi\":[{\"confidence\":\"1\",\"kpiName\":\"rsrp\",\"kpiValue\":\"60\"},{\"confidence\":\"1\",\"kpiName\":\"rsrq\",\"kpiValue\":\"20\"}]},{\"streamId\":\"1\",\"qosKpi\":[{\"confidence\":\"1\",\"kpiName\":\"rsrp\",\"kpiValue\":\"55\"},{\"confidence\":\"1\",\"kpiName\":\"rsrq\",\"kpiValue\":\"13\"}]}]},\"routes\":[{\"routeInfo\":[{\"location\":{\"geoArea\":{\"latitude\":43.729416,\"longitude\":7.414853}},\"time\":{\"nanoSeconds\":0,\"seconds\":1653295620}},{\"location\":{\"geoArea\":{\"latitude\":43.732456,\"longitude\":7.418417}},\"time\":{\"nanoSeconds\":0,\"seconds\":1653299220}}]}]}'\n",
- "2024-11-12 13:32:18,163 - __main__ - INFO - UU unicast provisioning information: result: b'{\"locationGranularity\":\"30\",\"predictionTarget\":\"SINGLE_UE_PREDICTION\",\"qos\":{\"stream\":[{\"streamId\":\"0\",\"qosKpi\":[{\"confidence\":\"1\",\"kpiName\":\"rsrp\",\"kpiValue\":\"60\"},{\"confidence\":\"1\",\"kpiName\":\"rsrq\",\"kpiValue\":\"20\"}]},{\"streamId\":\"1\",\"qosKpi\":[{\"confidence\":\"1\",\"kpiName\":\"rsrp\",\"kpiValue\":\"55\"},{\"confidence\":\"1\",\"kpiName\":\"rsrq\",\"kpiValue\":\"13\"}]}]},\"routes\":[{\"routeInfo\":[{\"location\":{\"geoArea\":{\"latitude\":43.729416,\"longitude\":7.414853}},\"time\":{\"nanoSeconds\":0,\"seconds\":1653295620}},{\"location\":{\"geoArea\":{\"latitude\":43.732456,\"longitude\":7.418417}},\"time\":{\"nanoSeconds\":0,\"seconds\":1653299220}}]}]}'\n",
- "2024-11-12 13:32:18,163 - __main__ - INFO - body: b'{\"locationGranularity\":\"30\",\"predictionTarget\":\"SINGLE_UE_PREDICTION\",\"qos\":{\"stream\":[{\"streamId\":\"0\",\"qosKpi\":[{\"confidence\":\"1\",\"kpiName\":\"rsrp\",\"kpiValue\":\"60\"},{\"confidence\":\"1\",\"kpiName\":\"rsrq\",\"kpiValue\":\"20\"}]},{\"streamId\":\"1\",\"qosKpi\":[{\"confidence\":\"1\",\"kpiName\":\"rsrp\",\"kpiValue\":\"55\"},{\"confidence\":\"1\",\"kpiName\":\"rsrq\",\"kpiValue\":\"13\"}]}]},\"routes\":[{\"routeInfo\":[{\"location\":{\"geoArea\":{\"latitude\":43.729416,\"longitude\":7.414853}},\"time\":{\"nanoSeconds\":0,\"seconds\":1653295620}},{\"location\":{\"geoArea\":{\"latitude\":43.732456,\"longitude\":7.418417}},\"time\":{\"nanoSeconds\":0,\"seconds\":1653299220}}]}]}'\n",
- "2024-11-12 13:32:18,164 - __main__ - INFO - data: {'locationGranularity': '30', 'predictionTarget': 'SINGLE_UE_PREDICTION', 'qos': {'stream': [{'streamId': '0', 'qosKpi': [{'confidence': '1', 'kpiName': 'rsrp', 'kpiValue': '60'}, {'confidence': '1', 'kpiName': 'rsrq', 'kpiValue': '20'}]}, {'streamId': '1', 'qosKpi': [{'confidence': '1', 'kpiName': 'rsrp', 'kpiValue': '55'}, {'confidence': '1', 'kpiName': 'rsrq', 'kpiValue': '13'}]}]}, 'routes': [{'routeInfo': [{'location': {'geoArea': {'latitude': 43.729416, 'longitude': 7.414853}}, 'time': {'nanoSeconds': 0, 'seconds': 1653295620}}, {'location': {'geoArea': {'latitude': 43.732456, 'longitude': 7.418417}}, 'time': {'nanoSeconds': 0, 'seconds': 1653299220}}]}]}\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "send: b'POST /sbx8rconuz/mep1/mec_app_support/v2/applications/ac6d042f-b52e-4480-b850-33c4c2520474/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, 12 Nov 2024 13:32:18 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 /sbx8rconuz/mep1/mec_app_support/v2/applications/ac6d042f-b52e-4480-b850-33c4c2520474/subscriptions HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 212\\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://mec-platform2.etsi.org:31111/sandbox/v1/mec011/v2/termination\", \"appInstanceId\": \"ac6d042f-b52e-4480-b850-33c4c2520474\"}'\n",
- "reply: 'HTTP/1.1 201 Created\\r\\n'\n",
- "header: Date: Tue, 12 Nov 2024 13:32:18 GMT\n",
- "header: Content-Type: application/json; charset=UTF-8\n",
- "header: Content-Length: 387\n",
- "header: Connection: keep-alive\n",
- "header: Location: https://mec-platform2.etsi.org/sbx8rconuz/mep1/mec_app_support/v2/applications/ac6d042f-b52e-4480-b850-33c4c2520474/subscriptions/sub-uRWBHjrCD7tGrHc0\n",
- "header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n",
- "send: b'POST /sbx8rconuz/mep1/vis/v2/provide_predicted_qos HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 354\\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'{\"locationGranularity\": \"30\", \"predictionTarget\": \"SINGLE_UE_PREDICTION\", \"routes\": [{\"routeInfo\": [{\"location\": {\"geoArea\": {\"latitude\": 43.729416, \"longitude\": 7.414853}}, \"time\": {\"seconds\": 1653295620, \"nanoSeconds\": 0}}, {\"location\": {\"geoArea\": {\"latitude\": 43.732456, \"longitude\": 7.418417}}, \"time\": {\"seconds\": 1653299220, \"nanoSeconds\": 0}}]}]}'\n",
- "reply: 'HTTP/1.1 200 OK\\r\\n'\n",
- "header: Date: Tue, 12 Nov 2024 13:32:18 GMT\n",
- "header: Content-Type: application/json; charset=UTF-8\n",
- "header: Content-Length: 610\n",
- "header: Connection: keep-alive\n",
- "header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "2024-11-12 13:32:28,170 - __main__ - DEBUG - >>> delete_subscribe_termination: ac6d042f-b52e-4480-b850-33c4c2520474\n",
- "2024-11-12 13:32:28,171 - __main__ - DEBUG - delete_subscribe_termination: url: /{sandbox_name}/{mec_pltf}/mec_app_support/v2/applications/{app_inst_id}/subscriptions/{sub_id}\n",
- "2024-11-12 13:32:28,183 DEBUG https://mec-platform2.etsi.org:443 \"DELETE /sbx8rconuz/mep1/mec_app_support/v2/applications/ac6d042f-b52e-4480-b850-33c4c2520474/subscriptions/sub-uRWBHjrCD7tGrHc0 HTTP/11\" 204 0\n",
- "2024-11-12 13:32:28,184 DEBUG response body: b''\n",
- "2024-11-12 13:32:28,185 - __main__ - DEBUG - >>> delete_application_instance_id: sbx8rconuz\n",
- "2024-11-12 13:32:28,186 - __main__ - DEBUG - >>> delete_application_instance_id: ac6d042f-b52e-4480-b850-33c4c2520474\n",
- "2024-11-12 13:32:28,340 DEBUG https://mec-platform2.etsi.org:443 \"DELETE /sandbox-api/v1/sandboxAppInstances/sbx8rconuz/ac6d042f-b52e-4480-b850-33c4c2520474 HTTP/11\" 204 0\n",
- "2024-11-12 13:32:28,347 DEBUG response body: b''\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "send: b'DELETE /sbx8rconuz/mep1/mec_app_support/v2/applications/ac6d042f-b52e-4480-b850-33c4c2520474/subscriptions/sub-uRWBHjrCD7tGrHc0 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, 12 Nov 2024 13:32:28 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/sbx8rconuz/ac6d042f-b52e-4480-b850-33c4c2520474 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, 12 Nov 2024 13:32:28 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-11-12 13:32:38,351 - __main__ - DEBUG - >>> deactivate_network_scenario: sbx8rconuz\n",
- "2024-11-12 13:32:38,390 DEBUG https://mec-platform2.etsi.org:443 \"DELETE /sandbox-api/v1/sandboxNetworkScenarios/sbx8rconuz/4g-5g-macro-v2x HTTP/11\" 204 0\n",
- "2024-11-12 13:32:38,394 DEBUG response body: b''\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "send: b'DELETE /sandbox-api/v1/sandboxNetworkScenarios/sbx8rconuz/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, 12 Nov 2024 13:32:38 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-11-12 13:32:58,395 - __main__ - DEBUG - >>> process_logout: sandbox=sbx8rconuz\n",
- "2024-11-12 13:32:58,397 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
- "2024-11-12 13:32:58,461 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/logout?sandbox_name=sbx8rconuz HTTP/11\" 204 0\n",
- "2024-11-12 13:32:58,462 DEBUG response body: b''\n",
- "2024-11-12 13:32:58,464 - __main__ - DEBUG - Stopped at 20241112-133258\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "send: b'POST /sandbox-api/v1/logout?sandbox_name=sbx8rconuz 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, 12 Nov 2024 13:32:58 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"
- ]
- }
- ],
+ "outputs": [],
"source": [
+ "#%%script echo skipping\n",
+ "# Uncomment the ;line above to skip execution of this cell\n",
"def process_main():\n",
" \"\"\"\n",
" This is the fourth sprint of our skeleton of our MEC application:\n",
@@ -4303,7 +3596,7 @@
},
{
"cell_type": "code",
- "execution_count": 38,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -5064,6 +4357,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
+ "### Create an application MEC service\n",
+ "\n",
"The function below is creating an application MEC services\n",
"\n",
"**Note:** This is call application MEC service in opposition of a standardized MEC service exposed by the MEC Sanbox such as MEC 013, MEC 030...\n",
@@ -5073,7 +4368,7 @@
},
{
"cell_type": "code",
- "execution_count": 39,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -5111,7 +4406,7 @@
" return (result, status, headers['Location'])\n",
" except ApiException as e:\n",
" logger.error('Exception when calling call_api: %s\\n' % e)\n",
- " return None\n",
+ " return (None, status, None)\n",
" # End of function create_mec_service"
]
},
@@ -5119,6 +4414,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
+ "### Delete an application MEC service\n",
+ "\n",
"The function below is deleting an application MEC services.\n",
"\n",
"**Reference:** ETSI GS MEC 011 V3.2.1 (2024-04) Clause 8.2.7.3.5 DELETE"
@@ -5126,7 +4423,7 @@
},
{
"cell_type": "code",
- "execution_count": 41,
+ "execution_count": null,
"metadata": {},
"outputs": [],
"source": [
@@ -5160,296 +4457,28 @@
" # End of function delete_mec_service"
]
},
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Putting everything together\n",
+ "\n",
+ "The sequence is the following:\n",
+ "- Mec application setup\n",
+ "- Create new MEC service\n",
+ "- Send a request to our MEC service\n",
+ "- Delete newly created MEC service\n",
+ "- Mec application termination\n"
+ ]
+ },
{
"cell_type": "code",
- "execution_count": 42,
+ "execution_count": null,
"metadata": {},
- "outputs": [
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "2024-11-12 13:35:50,697 - __main__ - DEBUG - Starting at 20241112-133550\n",
- "2024-11-12 13:35:50,698 - __main__ - DEBUG - \t pwd= /home/jovyan/work/mecapp\n",
- "2024-11-12 13:35:50,699 - __main__ - DEBUG - >>> process_login\n",
- "2024-11-12 13:35:50,701 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
- "2024-11-12 13:35:50,791 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/login?provider=Jupyter2024 HTTP/11\" 201 0\n",
- "2024-11-12 13:35:50,792 DEBUG response body: b'{\"user_code\":\"sbxbp3kdqu\",\"verification_uri\":\"\"}'\n",
- "2024-11-12 13:35:50,793 - __main__ - DEBUG - process_login (step1): oauth: {'user_code': 'sbxbp3kdqu', 'verification_uri': ''}\n",
- "2024-11-12 13:35:50,794 - __main__ - DEBUG - =======================> DO AUTHORIZATION WITH CODE : sbxbp3kdqu\n",
- "2024-11-12 13:35:50,796 - __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, 12 Nov 2024 13:35:50 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-11-12 13:35:53,809 DEBUG https://mec-platform2.etsi.org:443 \"GET /sandbox-api/v1/namespace?user_code=sbxbp3kdqu HTTP/11\" 200 0\n",
- "2024-11-12 13:35:53,810 DEBUG response body: b'{\"sandbox_name\":\"sbxbp3kdqu\"}'\n",
- "2024-11-12 13:35:53,811 - __main__ - DEBUG - process_login (step2): result: {'sandbox_name': 'sbxbp3kdqu'}\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "send: b'GET /sandbox-api/v1/namespace?user_code=sbxbp3kdqu 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, 12 Nov 2024 13:35:53 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-11-12 13:36:03,816 - __main__ - DEBUG - >>> get_network_scenarios: sandbox=sbxbp3kdqu\n",
- "2024-11-12 13:36:03,819 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
- "2024-11-12 13:36:03,974 DEBUG https://mec-platform2.etsi.org:443 \"GET /sandbox-api/v1/sandboxNetworkScenarios?sandbox_name=sbxbp3kdqu HTTP/11\" 200 0\n",
- "2024-11-12 13:36:03,975 DEBUG response body: b'[{\"id\":\"4g-5g-macro-v2x\"},{\"id\":\"4g-5g-macro-v2x-fed\"},{\"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-11-12 13:36:03,975 - __main__ - DEBUG - get_network_scenarios: result: [{'id': '4g-5g-macro-v2x'}, {'id': '4g-5g-macro-v2x-fed'}, {'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=sbxbp3kdqu 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, 12 Nov 2024 13:36:03 GMT\n",
- "header: Content-Type: application/json; charset=UTF-8\n",
- "header: Content-Length: 186\n",
- "header: Connection: keep-alive\n",
- "header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "2024-11-12 13:36:13,976 - __main__ - DEBUG - >>> activate_network_scenario: sbxbp3kdqu\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "send: b'POST /sandbox-api/v1/sandboxNetworkScenarios/sbxbp3kdqu?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"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "2024-11-12 13:36:15,256 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/sandboxNetworkScenarios/sbxbp3kdqu?network_scenario_id=4g-5g-macro-v2x HTTP/11\" 204 0\n",
- "2024-11-12 13:36:15,258 DEBUG response body: b''\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "reply: 'HTTP/1.1 204 No Content\\r\\n'\n",
- "header: Date: Tue, 12 Nov 2024 13:36:15 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-11-12 13:36:35,262 - __main__ - DEBUG - >>> request_application_instance_id: sbxbp3kdqu\n",
- "2024-11-12 13:36:35,265 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
- "2024-11-12 13:36:35,396 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/sandboxAppInstances/sbxbp3kdqu HTTP/11\" 201 0\n",
- "2024-11-12 13:36:35,397 DEBUG response body: b'{\"id\":\"068fbd70-b8bf-4af3-85bf-b560e5bfaddc\",\"name\":\"JupyterMecApp\",\"nodeName\":\"mep1\",\"type\":\"USER\"}'\n",
- "2024-11-12 13:36:35,397 - __main__ - DEBUG - request_application_instance_id: result: {'id': '068fbd70-b8bf-4af3-85bf-b560e5bfaddc',\n",
- " 'name': 'JupyterMecApp',\n",
- " 'node_name': 'mep1',\n",
- " 'persist': None,\n",
- " 'type': 'USER'}\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "send: b'POST /sandbox-api/v1/sandboxAppInstances/sbxbp3kdqu 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\": \"068fbd70-b8bf-4af3-85bf-b560e5bfaddc\", \"name\": \"JupyterMecApp\", \"nodeName\": \"mep1\", \"type\": \"USER\"}'\n",
- "reply: 'HTTP/1.1 201 Created\\r\\n'\n",
- "header: Date: Tue, 12 Nov 2024 13:36:35 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-11-12 13:36:45,398 - __main__ - DEBUG - >>> send_ready_confirmation: 068fbd70-b8bf-4af3-85bf-b560e5bfaddc\n",
- "2024-11-12 13:36:45,400 - __main__ - DEBUG - send_ready_confirmation: url: /{sandbox_name}/{mec_pltf}/mec_app_support/v2/applications/{app_inst_id}/confirm_ready\n",
- "2024-11-12 13:36:45,403 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
- "2024-11-12 13:36:45,464 DEBUG https://mec-platform2.etsi.org:443 \"POST /sbxbp3kdqu/mep1/mec_app_support/v2/applications/068fbd70-b8bf-4af3-85bf-b560e5bfaddc/confirm_ready HTTP/11\" 204 0\n",
- "2024-11-12 13:36:45,466 DEBUG response body: b''\n",
- "2024-11-12 13:36:45,467 - __main__ - DEBUG - >>> send_subscribe_termination: 068fbd70-b8bf-4af3-85bf-b560e5bfaddc\n",
- "2024-11-12 13:36:45,468 - __main__ - DEBUG - send_subscribe_termination: url: /{sandbox_name}/{mec_pltf}/mec_app_support/v2/applications/{app_inst_id}/subscriptions\n",
- "2024-11-12 13:36:45,483 DEBUG https://mec-platform2.etsi.org:443 \"POST /sbxbp3kdqu/mep1/mec_app_support/v2/applications/068fbd70-b8bf-4af3-85bf-b560e5bfaddc/subscriptions HTTP/11\" 201 0\n",
- "2024-11-12 13:36:45,486 DEBUG response body: b'{\"subscriptionType\":\"AppTerminationNotificationSubscription\",\"callbackReference\":\"http://mec-platform2.etsi.org:31111/sandbox/v1/mec011/v2/termination\",\"_links\":{\"self\":{\"href\":\"https://mec-platform2.etsi.org/sbxbp3kdqu/mep1/mec_app_support/v2/applications/068fbd70-b8bf-4af3-85bf-b560e5bfaddc/subscriptions/sub-q-kCgregXGwXCyGz\"}},\"appInstanceId\":\"068fbd70-b8bf-4af3-85bf-b560e5bfaddc\"}'\n",
- "2024-11-12 13:36:45,487 - __main__ - DEBUG - >>> extract_sub_id: resource_url: https://mec-platform2.etsi.org/sbxbp3kdqu/mep1/mec_app_support/v2/applications/068fbd70-b8bf-4af3-85bf-b560e5bfaddc/subscriptions/sub-q-kCgregXGwXCyGz\n",
- "2024-11-12 13:36:45,489 - __main__ - DEBUG - >>> create_mec_service\n",
- "2024-11-12 13:36:45,490 - __main__ - DEBUG - create_mec_service: url: /{sandbox_name}/{mec_pltf}/mec_service_mgmt/v1/applications/{app_inst_id}/services\n",
- "2024-11-12 13:36:45,530 DEBUG https://mec-platform2.etsi.org:443 \"POST /sbxbp3kdqu/mep1/mec_service_mgmt/v1/applications/068fbd70-b8bf-4af3-85bf-b560e5bfaddc/services HTTP/11\" 201 0\n",
- "2024-11-12 13:36:45,531 DEBUG response body: b'{\"serInstanceId\":\"25e0201a-0f52-4e1f-9290-e4dc9f1eee4a\",\"serName\":\"demo6 MEC Service\",\"serCategory\":{\"href\":\"http://mec-platform2.etsi.org:31111/sandbox/v1/statistic/v1/quantity\",\"id\":\"9795944c-2777-4ef9-b9fd-f85e3ffccbae\",\"name\":\"Demo\",\"version\":\"1.0.0\"},\"version\":\"1.0.0\",\"state\":\"ACTIVE\",\"transportInfo\":{\"id\":\"960f105a-69d1-43f9-baa8-ba593cd4f01b\",\"name\":\"HTTP REST API\",\"type\":\"REST_HTTP\",\"protocol\":\"HTTP\",\"version\":\"2.0\",\"endpoint\":{\"uris\":null,\"fqdn\":null,\"addresses\":null,\"alternative\":null},\"security\":{}},\"serializer\":\"JSON\",\"scopeOfLocality\":\"MEC_HOST\",\"consumedLocalOnly\":true,\"isLocal\":true,\"_links\":{\"self\":{\"href\":\"https://mec-platform2.etsi.org/sbxbp3kdqu/mep1/mec_service_mgmt/v1/applications/068fbd70-b8bf-4af3-85bf-b560e5bfaddc/services/25e0201a-0f52-4e1f-9290-e4dc9f1eee4a\"}}}'\n",
- "2024-11-12 13:36:45,531 - __main__ - INFO - mec_service_resource: https://mec-platform2.etsi.org/sbxbp3kdqu/mep1/mec_service_mgmt/v1/applications/068fbd70-b8bf-4af3-85bf-b560e5bfaddc/services/25e0201a-0f52-4e1f-9290-e4dc9f1eee4a\n",
- "2024-11-12 13:36:45,532 - __main__ - INFO - body: b'{\"serInstanceId\":\"25e0201a-0f52-4e1f-9290-e4dc9f1eee4a\",\"serName\":\"demo6 MEC Service\",\"serCategory\":{\"href\":\"http://mec-platform2.etsi.org:31111/sandbox/v1/statistic/v1/quantity\",\"id\":\"9795944c-2777-4ef9-b9fd-f85e3ffccbae\",\"name\":\"Demo\",\"version\":\"1.0.0\"},\"version\":\"1.0.0\",\"state\":\"ACTIVE\",\"transportInfo\":{\"id\":\"960f105a-69d1-43f9-baa8-ba593cd4f01b\",\"name\":\"HTTP REST API\",\"type\":\"REST_HTTP\",\"protocol\":\"HTTP\",\"version\":\"2.0\",\"endpoint\":{\"uris\":null,\"fqdn\":null,\"addresses\":null,\"alternative\":null},\"security\":{}},\"serializer\":\"JSON\",\"scopeOfLocality\":\"MEC_HOST\",\"consumedLocalOnly\":true,\"isLocal\":true,\"_links\":{\"self\":{\"href\":\"https://mec-platform2.etsi.org/sbxbp3kdqu/mep1/mec_service_mgmt/v1/applications/068fbd70-b8bf-4af3-85bf-b560e5bfaddc/services/25e0201a-0f52-4e1f-9290-e4dc9f1eee4a\"}}}'\n",
- "2024-11-12 13:36:45,533 - __main__ - INFO - data: {'serInstanceId': '25e0201a-0f52-4e1f-9290-e4dc9f1eee4a', 'serName': 'demo6 MEC Service', 'serCategory': {'href': 'http://mec-platform2.etsi.org:31111/sandbox/v1/statistic/v1/quantity', 'id': '9795944c-2777-4ef9-b9fd-f85e3ffccbae', 'name': 'Demo', 'version': '1.0.0'}, 'version': '1.0.0', 'state': 'ACTIVE', 'transportInfo': {'id': '960f105a-69d1-43f9-baa8-ba593cd4f01b', 'name': 'HTTP REST API', 'type': 'REST_HTTP', 'protocol': 'HTTP', 'version': '2.0', 'endpoint': {'uris': None, 'fqdn': None, 'addresses': None, 'alternative': None}, 'security': {}}, 'serializer': 'JSON', 'scopeOfLocality': 'MEC_HOST', 'consumedLocalOnly': True, 'isLocal': True, '_links': {'self': {'href': 'https://mec-platform2.etsi.org/sbxbp3kdqu/mep1/mec_service_mgmt/v1/applications/068fbd70-b8bf-4af3-85bf-b560e5bfaddc/services/25e0201a-0f52-4e1f-9290-e4dc9f1eee4a'}}}\n",
- "2024-11-12 13:36:45,533 - __main__ - INFO - =============> Execute the command: curl http://mec-platform2.etsi.org:31111/sandbox/v1/statistic/v1/quantity\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "send: b'POST /sbxbp3kdqu/mep1/mec_app_support/v2/applications/068fbd70-b8bf-4af3-85bf-b560e5bfaddc/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, 12 Nov 2024 13:36:45 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 /sbxbp3kdqu/mep1/mec_app_support/v2/applications/068fbd70-b8bf-4af3-85bf-b560e5bfaddc/subscriptions HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 212\\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://mec-platform2.etsi.org:31111/sandbox/v1/mec011/v2/termination\", \"appInstanceId\": \"068fbd70-b8bf-4af3-85bf-b560e5bfaddc\"}'\n",
- "reply: 'HTTP/1.1 201 Created\\r\\n'\n",
- "header: Date: Tue, 12 Nov 2024 13:36:45 GMT\n",
- "header: Content-Type: application/json; charset=UTF-8\n",
- "header: Content-Length: 387\n",
- "header: Connection: keep-alive\n",
- "header: Location: https://mec-platform2.etsi.org/sbxbp3kdqu/mep1/mec_app_support/v2/applications/068fbd70-b8bf-4af3-85bf-b560e5bfaddc/subscriptions/sub-q-kCgregXGwXCyGz\n",
- "header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n",
- "send: b'POST /sbxbp3kdqu/mep1/mec_service_mgmt/v1/applications/068fbd70-b8bf-4af3-85bf-b560e5bfaddc/services HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 453\\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'{\"serName\": \"demo6 MEC Service\", \"serCategory\": {\"href\": \"http://mec-platform2.etsi.org:31111/sandbox/v1/statistic/v1/quantity\", \"id\": \"9795944c-2777-4ef9-b9fd-f85e3ffccbae\", \"name\": \"Demo\", \"version\": \"1.0.0\"}, \"version\": \"1.0.0\", \"state\": \"ACTIVE\", \"transportInfo\": {\"id\": \"960f105a-69d1-43f9-baa8-ba593cd4f01b\", \"name\": \"HTTP REST API\", \"type\": \"REST_HTTP\", \"protocol\": \"HTTP\", \"version\": \"2.0\", \"endpoint\": {}, \"security\": {}}, \"serializer\": \"JSON\"}'\n",
- "reply: 'HTTP/1.1 201 Created\\r\\n'\n",
- "header: Date: Tue, 12 Nov 2024 13:36:45 GMT\n",
- "header: Content-Type: application/json; charset=UTF-8\n",
- "header: Content-Length: 797\n",
- "header: Connection: keep-alive\n",
- "header: Location: https://mec-platform2.etsi.org/sbxbp3kdqu/mep1/mec_service_mgmt/v1/applications/068fbd70-b8bf-4af3-85bf-b560e5bfaddc/services/25e0201a-0f52-4e1f-9290-e4dc9f1eee4a\n",
- "header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
- ]
- },
- {
- "name": "stderr",
- "output_type": "stream",
- "text": [
- "2024-11-12 13:37:15,534 - __main__ - DEBUG - >>> delete_mec_subscription: resource_url: https://mec-platform2.etsi.org/sbxbp3kdqu/mep1/mec_service_mgmt/v1/applications/068fbd70-b8bf-4af3-85bf-b560e5bfaddc/services/25e0201a-0f52-4e1f-9290-e4dc9f1eee4a\n",
- "2024-11-12 13:37:15,545 DEBUG https://mec-platform2.etsi.org:443 \"DELETE /sbxbp3kdqu/mep1/mec_service_mgmt/v1/applications/068fbd70-b8bf-4af3-85bf-b560e5bfaddc/services/25e0201a-0f52-4e1f-9290-e4dc9f1eee4a HTTP/11\" 204 0\n",
- "2024-11-12 13:37:15,552 DEBUG response body: b''\n",
- "2024-11-12 13:37:15,553 - __main__ - DEBUG - >>> delete_subscribe_termination: 068fbd70-b8bf-4af3-85bf-b560e5bfaddc\n",
- "2024-11-12 13:37:15,555 - __main__ - DEBUG - delete_subscribe_termination: url: /{sandbox_name}/{mec_pltf}/mec_app_support/v2/applications/{app_inst_id}/subscriptions/{sub_id}\n",
- "2024-11-12 13:37:15,564 DEBUG https://mec-platform2.etsi.org:443 \"DELETE /sbxbp3kdqu/mep1/mec_app_support/v2/applications/068fbd70-b8bf-4af3-85bf-b560e5bfaddc/subscriptions/sub-q-kCgregXGwXCyGz HTTP/11\" 204 0\n",
- "2024-11-12 13:37:15,565 DEBUG response body: b''\n",
- "2024-11-12 13:37:15,566 - __main__ - DEBUG - >>> delete_application_instance_id: sbxbp3kdqu\n",
- "2024-11-12 13:37:15,567 - __main__ - DEBUG - >>> delete_application_instance_id: 068fbd70-b8bf-4af3-85bf-b560e5bfaddc\n",
- "2024-11-12 13:37:15,611 DEBUG https://mec-platform2.etsi.org:443 \"DELETE /sandbox-api/v1/sandboxAppInstances/sbxbp3kdqu/068fbd70-b8bf-4af3-85bf-b560e5bfaddc HTTP/11\" 204 0\n",
- "2024-11-12 13:37:15,612 DEBUG response body: b''\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "send: b'DELETE /sbxbp3kdqu/mep1/mec_service_mgmt/v1/applications/068fbd70-b8bf-4af3-85bf-b560e5bfaddc/services/25e0201a-0f52-4e1f-9290-e4dc9f1eee4a 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, 12 Nov 2024 13:37:15 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 /sbxbp3kdqu/mep1/mec_app_support/v2/applications/068fbd70-b8bf-4af3-85bf-b560e5bfaddc/subscriptions/sub-q-kCgregXGwXCyGz 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, 12 Nov 2024 13:37:15 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/sbxbp3kdqu/068fbd70-b8bf-4af3-85bf-b560e5bfaddc 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, 12 Nov 2024 13:37:15 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-11-12 13:37:25,614 - __main__ - DEBUG - >>> deactivate_network_scenario: sbxbp3kdqu\n",
- "2024-11-12 13:37:25,649 DEBUG https://mec-platform2.etsi.org:443 \"DELETE /sandbox-api/v1/sandboxNetworkScenarios/sbxbp3kdqu/4g-5g-macro-v2x HTTP/11\" 204 0\n",
- "2024-11-12 13:37:25,651 DEBUG response body: b''\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "send: b'DELETE /sandbox-api/v1/sandboxNetworkScenarios/sbxbp3kdqu/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, 12 Nov 2024 13:37:25 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-11-12 13:37:45,657 - __main__ - DEBUG - >>> process_logout: sandbox=sbxbp3kdqu\n",
- "2024-11-12 13:37:45,658 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
- "2024-11-12 13:37:45,756 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/logout?sandbox_name=sbxbp3kdqu HTTP/11\" 204 0\n",
- "2024-11-12 13:37:45,758 DEBUG response body: b''\n",
- "2024-11-12 13:37:45,759 - __main__ - DEBUG - Stopped at 20241112-133745\n"
- ]
- },
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "send: b'POST /sandbox-api/v1/logout?sandbox_name=sbxbp3kdqu 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, 12 Nov 2024 13:37:45 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"
- ]
- }
- ],
+ "outputs": [],
"source": [
+ "#%%script echo skipping\n",
+ "# Uncomment the ;line above to skip execution of this cell\n",
"def process_main():\n",
" \"\"\"\n",
" This is the fith sprint of our skeleton of our MEC application:\n",
@@ -5464,6 +4493,9 @@
" logger.debug('Starting at ' + time.strftime('%Y%m%d-%H%M%S'))\n",
" logger.debug('\\t pwd= ' + os.getcwd())\n",
"\n",
+ " # Start notification server in a daemonized thread\n",
+ " httpd = start_notification_server()\n",
+ "\n",
" # Setup the MEC application\n",
" sandbox_name, app_inst_id, sub_id = mec_app_setup()\n",
"\n",
@@ -5474,12 +4506,15 @@
" else:\n",
" logger.info('mec_service_resource: %s', mec_service_resource)\n",
"\n",
- " # Any processing here\n",
+ " # Send a request to our MEC service\n",
" logger.info('body: ' + str(result.data))\n",
" data = json.loads(result.data)\n",
" logger.info('data: %s', str(data))\n",
- " logger.info('=============> Execute the command: curl %s/statistic/v1/quantity', CALLBACK_URI)\n",
- " time.sleep(30)\n",
+ " logger.info('=============> Execute the command: curl --request GET %s/statistic/v1/quantity --header \"Accept: application/json\" --data \\'{\"time\":20180124,\"data1\":\"[1516752000,11590.6,11616.9,11590.4,11616.9,0.25202387,1516752060,11622.4,11651.7,11622.4,11644.6,1.03977764]\"}\\'', CALLBACK_URI)\n",
+ " time.sleep(45)\n",
+ "\n",
+ " # Stop notification server\n",
+ " stop_notification_server(httpd)\n",
"\n",
" # Delete the MEC servce\n",
" delete_mec_service(mec_service_resource)\n",
@@ -5504,13 +4539,18 @@
"\n",
"The sample code below illustrates the usage of MEC-CAPI endpoints:\n",
"- /service-apis/v1/allServiceAPIs\n",
- "- /published-apis/v1/{apfId}/service-apis\n",
+ "- /published-apis/v1/{apfId}/service-apis\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Getting all MEC services\n",
"\n",
- "To be continued\n",
+ "The code below illustrates how to use CAPIF '/service-apis/v1/allServiceAPIs' endpoint to retrieve the complete list of available MEC services.\n",
"\n",
- "\n",
- " Note: The functions used in the sample code below are defined after this cell.\n",
- "
"
+ "**Reference:** ETSI GS MEC 011 (V3.2.1) Clause 9.2.3 Resource: All published service APIs"
]
},
{
@@ -5519,36 +4559,149 @@
"metadata": {},
"outputs": [],
"source": [
+ "def capif_get_all_mec_services(sandbox_name: str):\n",
+ " \"\"\"\n",
+ " To retrieves the MEC services using CAPIF endpoint\n",
+ " :param sandbox_name: The MEC Sandbox instance to use\n",
+ " :return The HTTP response and the response status on success, None otherwise\n",
+ " :see ETSI GS MEC 011 (V3.2.1) Clause 9\n",
+ " \"\"\"\n",
+ " global MEC_PLTF, logger, service_api\n",
+ "\n",
+ " logger.debug('>>> capif_get_all_mec_services: ' + sandbox_name)\n",
+ " try:\n",
+ " url = '/{sandbox_name}/{mec_pltf}/service-apis/v1/allServiceAPIs'\n",
+ " logger.debug('capif_get_all_mec_services: 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, 'GET', header_params=header_params, path_params=path_params, async_req=False)\n",
+ " return (result, status)\n",
+ " except ApiException as e:\n",
+ " logger.error('Exception when calling call_api: %s\\n' % e)\n",
+ " return (None, status)\n",
+ " # End of capif_get_all_mec_services function"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Getting MEC services for a specified MEC application instance ID\n",
+ "\n",
+ "The code below illustrates how to use CAPIF '/published-apis/v1/{apfId}/service-apis' endpoint to retrieve the complete list of MEC services for a specified MEC application instance ID (apfid).\n",
+ "\n",
+ "**Reference:** ETSI GS MEC 011 (V3.2.1) Table 9.2.4.2-1: Profiling of the URI variables"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "def capif_get_mec_services(sandbox_name: str, apfId: str):\n",
+ " \"\"\"\n",
+ " To retrieves the MEC services using CAPIF endpoint\n",
+ " :param sandbox_name: The MEC Sandbox instance to use\n",
+ " :param apfId: The identifier of the entity that registers the service API\n",
+ " :return The HTTP response and the response status on success, None otherwise\n",
+ " :see ETSI GS MEC 011 (V3.2.1) Clause 9\n",
+ " \"\"\"\n",
+ " global MEC_PLTF, logger, service_api\n",
+ "\n",
+ " logger.debug('>>> capif_get_all_mec_services: ' + sandbox_name)\n",
+ " try:\n",
+ " url = '/{sandbox_name}/{mec_pltf}/published-apis/v1/{apfId}/service-apis'\n",
+ " logger.debug('capif_get_mec_services: url: ' + url)\n",
+ " path_params = {}\n",
+ " path_params['sandbox_name'] = sandbox_name\n",
+ " path_params['mec_pltf'] = MEC_PLTF\n",
+ " path_params['apfId'] = apfId\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, 'GET', header_params=header_params, path_params=path_params, async_req=False)\n",
+ " return (result, status)\n",
+ " except ApiException as e:\n",
+ " logger.error('Exception when calling call_api: %s\\n' % e)\n",
+ " return (None, status)\n",
+ " # End of capif_get_mec_services function"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Putting evrythong together\n",
+ "\n",
+ "It is time now to create the our third iteration of our MEC application.\n",
+ "\n",
+ "The sequence is the following:\n",
+ "\n",
+ "- Login\n",
+ "- Activate a network scenario\n",
+ "- Create an application instance identifier\n",
+ "- Retrieve all MEC services (/service-apis/v1/allServiceAPIs)\n",
+ "- Retrieve MEC services for the newly created application instance identifier\n",
+ "- Delete our application instance identifier\n",
+ "- Deactivate a network scenario\n",
+ "- Logout"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "#%%script echo skipping\n",
+ "# Uncomment the ;line above to skip execution of this cell\n",
"def process_main():\n",
" \"\"\"\n",
" This code illustrates the usage of MEC-CAPI endpoints:\n",
- " - /service-apis/v1/allServiceAPIs\n",
- " - /published-apis/v1/{apfId}/service-apis\n",
+ " - Login\n",
+ " - Activate a network scenario\n",
+ " - Create an application instance identifier\n",
+ " - Retrieve all MEC services (/service-apis/v1/allServiceAPIs)\n",
+ " - Retrieve MEC services for the newly created application instance identifier\n",
+ " - Delete our application instance identifier\n",
+ " - Deactivate a network scenario\n",
+ " - Logout\n",
" \"\"\" \n",
" global LISTENER_IP, LISTENER_PORT, 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",
- " # Start notification server in a daemonized thread\n",
- " httpd = start_notification_server()\n",
- "\n",
" # Setup the MEC application\n",
" sandbox_name, app_inst_id, sub_id = mec_app_setup()\n",
"\n",
" # Get the list of the MEC sevices using CAPIF endpoints\n",
- " result, status, mec_services = capif_get_all_mec_services(sandbox_name)\n",
+ " result, status = capif_get_all_mec_services(sandbox_name)\n",
" if status != 200:\n",
" logger.error('Failed to get the list of MEC services using CAPIF endpoint')\n",
" else:\n",
- " logger.info('capif_get_all_mec_services: %s', mec_services)\n",
+ " logger.info('capif_get_all_mec_services: ' + str(result.data))\n",
"\n",
" # Get the list of the MEC sevices for our AppInstanceId using CAPIF endpoints\n",
- " result, status, mec_services = capif_get_mec_services(sandbox_name, app_inst_id)\n",
+ " result, status = capif_get_mec_services(sandbox_name, app_inst_id.id)\n",
" if status != 200:\n",
" logger.error('Failed to get the list of MEC services for our AppInstanceId using CAPIF endpoint')\n",
" else:\n",
- " logger.info('capif_get_all_mec_services: %s', mec_services)\n",
+ " logger.info('capif_get_mec_services: ' + str(result.data))\n",
"\n",
" # In the previous request, the list of services for our AppInstanceId is empty.\n",
" # Let's create a new MEC service\n",
@@ -5558,11 +4711,18 @@
" else:\n",
" logger.info('mec_service_resource: %s', mec_service_resource)\n",
"\n",
- " # Now, we can send the CAPIF endpoint\n",
- " # To be continued\n",
- "\n",
- " # Stop notification server\n",
- " stop_notification_server(httpd)\n",
+ " # Now, we can send a new request for services for our MEC application\n",
+ " # Get the list of the MEC sevices for our AppInstanceId using CAPIF endpoints\n",
+ " result, status = capif_get_mec_services(sandbox_name, app_inst_id.id)\n",
+ " if status != 200:\n",
+ " logger.error('Failed to get the list of MEC services for our AppInstanceId using CAPIF endpoint')\n",
+ " else:\n",
+ " logger.info('capif_get_mec_services: ' + str(result.data))\n",
+ " data = json.loads(result.data)\n",
+ " logger.info('serviceAPIDescriptions: ' + str(data))\n",
+ " # b'{\"serviceAPIDescriptions\":[{\"apiName\":\"demo6 MEC Service\",\"apiId\":\"6172de7d-ed42-4ba2-947a-a0db7cc8915e\",\"aefProfiles\":[{\"aefId\":\"3daa9b79-ba81-4a74-9668-df710dc68020\",\"versions\":[\"1.0.0\"],\"interfaceDescriptions\":{\"uris\":null,\"fqdn\":null,\"addresses\":null,\"alternative\":null},\"vendorSpecific-urn:etsi:mec:capifext:transport-info\":{\"name\":\"HTTP REST API\",\"type\":\"REST_HTTP\",\"protocol\":\"HTTP\",\"version\":\"2.0\",\"security\":{}}}],\"vendorSpecific-urn:etsi:mec:capifext:service-info\":{\"serializer\":\"JSON\",\"state\":\"ACTIVE\",\"scopeOfLocality\":\"MEC_HOST\",\"consumedLocalOnly\":true,\"isLocal\":true,\"category\":{\"href\":\"http://mec-platform2.etsi.org:31111/sandbox/v1/statistic/v1/quantity\",\"id\":\"98a5039d-2b7c-49b1-b3b1-45a6ebad2ea4\",\"name\":\"Demo\",\"version\":\"1.0.0\"}}}]}'\n",
+ " logger.info('apiId: ' + str(data['serviceAPIDescriptions'][0]['apiId'] + ' matching MEC serInstanceID'))\n",
+ " logger.info('aefId: ' + str(data['serviceAPIDescriptions'][0]['aefProfiles'][0]['aefId'] + ' matching MEC TransportInfo.Id\"'))\n",
"\n",
" # Delete the MEC servce\n",
" delete_mec_service(mec_service_resource)\n",