Newer
Older
" # End of function subscribe_v2x_message"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Here is a generic function to delete any MEC service subscription based on the subscription resource URL provided in the Location header of the subscription creation response."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def delete_mec_subscription(resource_url: str) -> int:\n",
" \"\"\"\n",
" Delete any existing MEC subscription\n",
" :param resource_url: The subscription URL\n",
" :return 0 on success, -1 otherwise\n",
" \"\"\"\n",
" global MEC_PLTF, logger, service_api\n",
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
"\n",
" logger.debug('>>> delete_mec_subscription: resource_url: ' + resource_url)\n",
" try:\n",
" res = urllib3.util.parse_url(resource_url)\n",
" if res is None:\n",
" logger.error('delete_mec_subscription: Failed to paerse URL')\n",
" return -1\n",
" header_params = {}\n",
" # HTTP header `Accept`\n",
" header_params['Accept'] = 'application/json' # noqa: E501\n",
" # HTTP header `Content-Type`\n",
" header_params['Content-Type'] = 'application/json' # noqa: E501\n",
" service_api.call_api(res.path, 'DELETE', header_params=header_params, async_req=False)\n",
" return 0\n",
" except ApiException as e:\n",
" logger.error('Exception when calling call_api: %s\\n' % e)\n",
" return -1\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Finaly, here is how to implement the V2X message subscription:"
]
},
{
"cell_type": "code",
"source": [
"def process_main():\n",
" \"\"\"\n",
" This is the second sprint of our skeleton of our MEC application:\n",
" - Mec application setup\n",
" - Subscribe to V2XMessage\n",
" - Delete subscription\n",
" - Mec application termination\n",
" \"\"\" \n",
" global MEC_PLTF, CALLBACK_URI, logger\n",
"\n",
" logger.debug('Starting at ' + time.strftime('%Y%m%d-%H%M%S'))\n",
" logger.debug('\\t pwd= ' + os.getcwd())\n",
"\n",
" # Setup the MEC application\n",
" (sandbox_name, app_inst_id, sub_id) = mec_app_setup()\n",
" # Create a V2X message subscritpion\n",
" filter_criteria = V2xMsgSubscriptionFilterCriteria(['1', '2'], 'ETSI')\n",
" v2xMsgSubscription = V2xMsgSubscription(callback_reference = CALLBACK_URI + '/vis/v2/v2x_msg_notification', filter_criteria = filter_criteria)\n",
" result, status, v2x_sub_id, v2x_resource = subscribe_v2x_message(sandbox_name, v2xMsgSubscription)\n",
" if status != 201:\n",
" logger.error('Failed to create subscription')\n",
" # Any processing here\n",
" logger.info('body: ' + str(result.data))\n",
" data = json.loads(result.data)\n",
" logger.info('data: %s', str(data))\n",
" logger.info('app_inst_id: ' + app_inst_id.id)\n",
" if sub_id is not None:\n",
" logger.info('sub_id: ' + sub_id)\n",
" time.sleep(STABLE_TIME_OUT)\n",
"\n",
" # Delete the V2X message subscritpion\n",
" delete_mec_subscription(v2x_resource)\n",
"\n",
" # Terminate the MEC application\n",
" mec_app_termination(sandbox_name, app_inst_id, sub_id)\n",
"\n",
" logger.debug('Stopped at ' + time.strftime('%Y%m%d-%H%M%S'))\n",
" # End of function process_main\n",
"\n",
"if __name__ == '__main__':\n",
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To recieve notifcation, our MEC application is required to support an HTTP listenener to recieve POST requests from the MEC Sandbox and reply to them: this is the notification mechanism.\n",
"\n",
"This minimalistic HTTP server will also be used to implement the endpoints provided by our MEC application service: see chapter [Our third MEC application: how to create a new MEC Services](#our_third_mec_application_how_to_create_a_new_mec_services).\n",
"\n",
"The class HTTPRequestHandler (see cell below) provides the suport of such mechanism.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
"class HTTPServer_RequestHandler(BaseHTTPRequestHandler):\n",
" \"\"\"\n",
" Minimal implementation of an HTTP server (http only).\n",
" \"\"\"\n",
"\n",
" def do_GET(self):\n",
" logger.info('>>> do_GET: ' + self.path)\n",
"\n",
" ctype = self.headers.get('content-type')\n",
" logger.info('do_GET: ' + ctype)\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",
" self.end_headers()\n",
"\n",
" # Write content as utf-8 data\n",
" self.wfile.write(message)\n",
" return\n",
" logger.info('>>> do_POST: ' + self.path)\n",
"\n",
" ctype = self.headers.get('content-type')\n",
" logger.info('do_POST: ' + ctype)\n",
"\n",
" content_len = int(self.headers.get('Content-Length'))\n",
" if content_len != 0:\n",
" body = self.rfile.read(content_len).decode('utf8')\n",
" logger.info('do_POST: body:' + str(type(body)))\n",
" logger.info('do_POST: body:' + str(body))\n",
" data = json.loads(str(body))\n",
" logger.info('do_POST: data: %s', str(data))\n",
"\n",
" self.send_response(HTTPStatus.NOT_IMPLEMENTED)\n",
" def do_PUT(self):\n",
" logger.info('>>> do_PUT: ' + self.path)\n",
"\n",
" ctype = self.headers.get('content-type')\n",
" logger.info('do_PUT: ' + ctype)\n",
"\n",
" self.send_response(HTTPStatus.NOT_IMPLEMENTED)\n",
" self.end_headers()\n",
"\n",
" def do_PATCH(self):\n",
" logger.info('>>> do_PATCH: ' + self.path)\n",
"\n",
" ctype = self.headers.get('content-type')\n",
" logger.info('do_PATCH: ' + ctype)\n",
" \n",
" self.send_response(HTTPStatus.NOT_IMPLEMENTED)\n",
" self.end_headers()\n",
" # End of class HTTPRequestHandler\n",
"\n",
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
" def do_DELETE(self):\n",
" logger.info('>>> do_DELETE: ' + self.path)\n",
"\n",
" ctype = self.headers.get('content-type')\n",
" logger.info('do_DELETE: ' + ctype)\n",
" \n",
" self.send_response(HTTPStatus.NOT_IMPLEMENTED)\n",
" self.end_headers()\n",
" # End of class HTTPRequestHandler\n",
"\n",
"def start_notification_server() -> HTTPServer:\n",
" \"\"\"\n",
" Start the notification server\n",
" :return The instance of the HTTP server\n",
" \"\"\"\n",
" global LISTENER_PORT\n",
"\n",
" server_address = ('', LISTENER_PORT)\n",
" httpd = HTTPServer(server_address, HTTPServer_RequestHandler)\n",
" # Start notification server in a daemonized thread\n",
" notification_server = threading.Thread(target = httpd.serve_forever, name='notification_server')\n",
" notification_server.daemon = True\n",
" notification_server.start()\n",
" return httpd\n",
" # End of function HTTPRequestHandler\n",
"\n",
"def stop_notification_server(httpd: HTTPServer):\n",
" \"\"\"\n",
" Stop the notification server\n",
" :param The instance of the HTTP server\n",
" \"\"\"\n",
" httpd.server_close()\n",
" httpd=None\n",
" # End of function HTTPRequestHandler\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Put all together\n",
"\n",
"let's add a subscription the our previous MEC application.\n",
"The sequence is the following:\n",
"- Mec application setup\n",
"- Start the notification server\n",
"- Get UU unicast provisioning information\n",
"- Add subscription\n",
"- Stop the notification server\n",
"- Mec application termination"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def process_main():\n",
" \"\"\"\n",
" This is the second sprint of our skeleton of our MEC application:\n",
" - Mec application setup\n",
" - Start the notification server\n",
" - Get UU unicast provisioning information\n",
" - Add subscription\n",
" - Stop the notification server\n",
" global CALLBACK_URI, logger\n",
"\n",
" logger.debug('Starting at ' + time.strftime('%Y%m%d-%H%M%S'))\n",
" logger.debug('\\t pwd= ' + os.getcwd())\n",
"\n",
" # Setup the MEC application\n",
" (sandbox_name, app_inst_id, sub_id) = mec_app_setup()\n",
"\n",
" # Get UU unicast provisioning information\n",
" ecgi = \"268708941961,268711972264\" # List of ecgi spearated by a ','\n",
" result = send_uu_unicast_provisioning_info(sandbox_name, ecgi)\n",
" if result is None:\n",
" logger.error('Failed to get UU unicast provisioning information')\n",
" else:\n",
" logger.info('UU unicast provisioning information: ' + str(result))\n",
"\n",
" # Start notification server in a daemonized thread\n",
" httpd = start_notification_server()\n",
"\n",
" # Create a V2X message subscritpion\n",
" filter_criteria = V2xMsgSubscriptionFilterCriteria(['1', '2'], 'ETSI')\n",
" v2xMsgSubscription = V2xMsgSubscription(callback_reference = CALLBACK_URI + '/vis/v2/v2x_msg_notification', filter_criteria = filter_criteria)\n",
" result, status, v2x_sub_id, v2x_resource = subscribe_v2x_message(sandbox_name, v2xMsgSubscription)\n",
" if status != 201:\n",
" logger.error('Failed to create subscription')\n",
"\n",
" # Any processing here\n",
" logger.info('body: ' + str(result.data))\n",
" data = json.loads(result.data)\n",
" logger.info('data: %s', str(data))\n",
" logger.info('v2x_resource: ' + v2x_resource)\n",
" if sub_id is not None:\n",
" logger.info('sub_id: ' + sub_id)\n",
" time.sleep(STABLE_TIME_OUT)\n",
"\n",
" # Stop notification server\n",
" stop_notification_server(httpd)\n",
"\n",
" # Delete the V2X message subscritpion\n",
" delete_mec_subscription(v2x_resource)\n",
"\n",
" # Terminate the MEC application\n",
" mec_app_termination(sandbox_name, app_inst_id, sub_id)\n",
"\n",
" logger.debug('Stopped at ' + time.strftime('%Y%m%d-%H%M%S'))\n",
" # End of function process_main\n",
"\n",
"if __name__ == '__main__':\n",
" process_main()\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Create our third MEC application: how to use V2X QoS Prediction\n",
"\n",
"The MEC Sanbox V2X QoS Prediction is based on a grid Map of Monaco City where areas are categorized into residential, commercial and coastal. \n",
"PoAs (Point Of Access) are categorized depending on where they lie in each grid. \n",
"Each category has its own traffic load patterns which are pre-determin. The V2X QoS Prediction) will give more accurate values of RSRP and RSRQ based on the diurnal traffic patterns for each. The network scenario named \"4g-5g-v2x-macro\" must be used to get access to the V2X QoS Prediction feature.\n",
"\n",
"**Note:** The MEC Sanbox V2X QoS Prediction is enabled when the PredictedQos.routes.routeInfo.time attribute is present in the request (see ETSI GS MEC 030 V3.2.1 (2024-02) Clause 6.2.6 Type: Preditecd QoS)\n",
"\n",
"Limitations:\n",
"* The Location Granularity is currently not being validated as RSRP/RSRP calculations are done at the exact location provided by the user.\n",
"* Time Granularity is currently not supported by the Prediction Function (design limitations of the minimal, emulated, pre-determined traffic prediction)\n",
"* Upper limit on the number of elements (10 each) in the routes and routeInfo structures (arrays) to not affect user experience and respoy\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The table below describes the excepted Qos with and without the prediction model in deiffrent area and at different time.\n",
"\n",
"| Location | Time | PoA | Category | Status | QoS without Prediction Model | QoS with Prediction Model | Expected |\n",
"| \t | (Unix time in sec) | Standard (GMT) | | | | RSRP | RSRQ | RSRP | RSRQ | |\n",
"| ------------------- | ----------- | -------------- | ---------------- | ----------- | ------------- | -------------- | ----------- | ----------- | ----------- | -------- |\n",
"| 43.729416,7.414853 | 1653295620 | 08:47:00 | 4g-macro-cell-2 | Residential | Congested | 63 | 21 | 60 | 20 | Yes |\n",
"| 43.732456,7.418417 | 1653299220 | 09:47:00 | 4g-macro-cell-3 | Residential | Not Congested | 55 | 13 | 55 | 13 | Yes |\n",
"| 43.73692,7.4209256 | 1653302820 | 10:47:00 | 4g-macro-cell-6 | Coastal | Not Congested | 68 | 26 | 68 | 26 | Yes |\n",
"| 43.738007,7.4230533 | 1653305220 | 11:27:00 | 4g-macro-cell-6 | Coastal | Not Congested | 55 | 13 | 55 | 13 | Yes |\n",
"| 43.739685,7.424881 | 1653308820 | 12:27:00 | 4g-macro-cell-7 | Commercial | Congested | 63 | 21 | 40 | 13 | Yes |\n",
"| 43.74103,7.425759 | 1653312600 | 13:30:00 | 4g-macro-cell-7 | Commercial | Congested | 56 | 14 | 40 | 8 | Yes |\n",
"| 43.74258,7.4277945 | 1653315900 | 14:25:00 | 4g-macro-cell-8 | Coastal | Congested | 59 | 17 | 47 | 13 | Yes |\n",
"| 43.744972,7.4295254 | 1653318900 | 15:15:00 | 4g-macro-cell-8 | Coastal | Congested | 53 | 11 | 40 | 5 | Yes |\n",
"| 43.74773,7.4320855 | 1653322500 | 16:15:00 | 5g-small-cell-14 | Commercial | Congested | 78 | 69 | 60 | 53 | Yes |\n",
"| 43.749264,7.435894 | 1653329700 | 18:15:00 | 5g-small-cell-20 | Commercial | Not Congested | 84 | 72 | 84 | 72 | Yes |\t72\t84\t72\tYes\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The image below illustrate the table above: [here](images/V2X Predicted QoS.jpg).\n",
"\n",
"Here is an example of a basic V2X predicted QoS request based on two point in path at 8am in Residential area:"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"```json\n",
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
"{\n",
" \"predictionTarget\": \"SINGLE_UE_PREDICTION\",\n",
" \"timeGranularity\": null,\n",
" \"locationGranularity\": \"30\",\n",
" \"routes\": [\n",
" {\n",
" \"routeInfo\": [\n",
" {\n",
" \"location\": {\n",
" \"geoArea\": {\n",
" \"latitude\": 43.729416,\n",
" \"longitude\": 7.414853\n",
" }\n",
" },\n",
" \"time\": {\n",
" \"nanoSeconds\": 0,\n",
" \"seconds\": 1653295620\n",
" }\n",
" },\n",
" {\n",
" \"location\": {\n",
" \"geoArea\": {\n",
" \"latitude\": 43.732456,\n",
" \"longitude\": 7.418417\n",
" }\n",
" },\n",
" \"time\": {\n",
" \"nanoSeconds\": 0,\n",
" \"seconds\": 1653299220\n",
" ]\n",
" }\n",
" ]\n",
"}\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let first create the required types before to prepare a V2X Predicted QoS request based on the JSON above.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
"metadata": {},
"outputs": [],
"source": [
"class Routes(object):\n",
" swagger_types = {'_route_info': 'list[RouteInfo]'}\n",
" attribute_map = {'_route_info': 'routeInfo'}\n",
" def __init__(self, route_info:list): # noqa: E501\n",
" self._route_info = None\n",
" self.route_info = route_info\n",
" @property\n",
" def route_info(self):\n",
" return self._route_info\n",
" @route_info.setter\n",
" def route_info(self, route_info):\n",
" if route_info is None:\n",
" raise ValueError(\"Invalid value for `route_info`, must not be `None`\") # noqa: E501\n",
" self._route_info = route_info\n",
" def to_dict(self):\n",
" result = {}\n",
" for attr, _ in six.iteritems(self.swagger_types):\n",
" value = getattr(self, attr)\n",
" if isinstance(value, list):\n",
" result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, 'to_dict') else x,value))\n",
" elif hasattr(value, 'to_dict'):\n",
" result[attr] = value.to_dict()\n",
" elif isinstance(value, dict):\n",
" result[attr] = dict(map(\n",
" lambda item: (item[0], item[1].to_dict())\n",
" if hasattr(item[1], 'to_dict') else item,\n",
" value.items()\n",
" ))\n",
" else:\n",
" result[attr] = value\n",
" if issubclass(Routes, dict):\n",
" for key, value in self.items():\n",
" result[key] = value\n",
" return result\n",
" def to_str(self):\n",
" return pprint.pformat(self.to_dict())\n",
" def __repr__(self):\n",
" return self.to_str()\n",
" def __eq__(self, other):\n",
" if not isinstance(other, Routes):\n",
" return False\n",
" return self.__dict__ == other.__dict__\n",
" def __ne__(self, other):\n",
" return not self == other\n",
"\n",
"class LocationInfo(object):\n",
" swagger_types = {'_ecgi': 'Ecgi', '_geo_area': 'LocationInfoGeoArea'}\n",
" attribute_map = {'_ecgi': 'ecgi', '_geo_area': 'geoArea'}\n",
" def __init__(self, ecgi=None, geo_area=None): # noqa: E501\n",
" self._ecgi = None\n",
" self._geo_area = None\n",
" self.discriminator = None\n",
" if ecgi is not None:\n",
" self.ecgi = ecgi\n",
" if geo_area is not None:\n",
" self.geo_area = geo_area\n",
" @property\n",
" def ecgi(self):\n",
" return self._ecgi\n",
" @ecgi.setter\n",
" def ecgi(self, ecgi):\n",
" self._ecgi = ecgi\n",
" @property\n",
" def geo_area(self):\n",
" return self._geo_area\n",
" @geo_area.setter\n",
" def geo_area(self, geo_area):\n",
" self._geo_area = geo_area\n",
" def to_dict(self):\n",
" result = {}\n",
" for attr, _ in six.iteritems(self.swagger_types):\n",
" value = getattr(self, attr)\n",
" if isinstance(value, list):\n",
" result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, 'to_dict') else x,value))\n",
" elif hasattr(value, 'to_dict'):\n",
" result[attr] = value.to_dict()\n",
" elif isinstance(value, dict):\n",
" result[attr] = dict(map(\n",
" lambda item: (item[0], item[1].to_dict())\n",
" if hasattr(item[1], 'to_dict') else item,\n",
" value.items()\n",
" ))\n",
" else:\n",
" result[attr] = value\n",
" if issubclass(LocationInfo, dict):\n",
" for key, value in self.items():\n",
" result[key] = value\n",
" return result\n",
" def to_str(self):\n",
" return pprint.pformat(self.to_dict())\n",
" def __repr__(self):\n",
" return self.to_str()\n",
" def __eq__(self, other):\n",
" if not isinstance(other, LocationInfo):\n",
" return False\n",
" return self.__dict__ == other.__dict__\n",
" def __ne__(self, other):\n",
" return not self == other\n",
"\n",
"class RouteInfo(object):\n",
" swagger_types = {'_location': 'LocationInfo', '_time_stamp': 'TimeStamp'}\n",
" attribute_map = {'_location': 'location', '_time_stamp': 'time'}\n",
" def __init__(self, location:LocationInfo, time_stamp=None): # noqa: E501\n",
" self._location = None\n",
" self.location = location\n",
" self._time_stamp = None\n",
" if time_stamp is not None:\n",
" self.time_stamp = time_stamp\n",
" @property\n",
" def location(self):\n",
" return self._location\n",
" @location.setter\n",
" def location(self, location):\n",
" if location is None:\n",
" raise ValueError(\"Invalid value for `location`, must not be `None`\") # noqa: E501\n",
" self._location = location\n",
" @property\n",
" def time_stamp(self):\n",
" return self._time_stamp\n",
" @time_stamp.setter\n",
" def time_stamp(self, time_stamp):\n",
" self._time_stamp = time_stamp\n",
" def to_dict(self):\n",
" result = {}\n",
" for attr, _ in six.iteritems(self.swagger_types):\n",
" value = getattr(self, attr)\n",
" if isinstance(value, list):\n",
" result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, 'to_dict') else x,value))\n",
" elif hasattr(value, 'to_dict'):\n",
" result[attr] = value.to_dict()\n",
" elif isinstance(value, dict):\n",
" result[attr] = dict(map(\n",
" lambda item: (item[0], item[1].to_dict())\n",
" if hasattr(item[1], 'to_dict') else item,\n",
" value.items()\n",
" ))\n",
" else:\n",
" result[attr] = value\n",
" if issubclass(RouteInfo, dict):\n",
" for key, value in self.items():\n",
" result[key] = value\n",
" return result\n",
" def to_str(self):\n",
" return pprint.pformat(self.to_dict())\n",
" def __repr__(self):\n",
" return self.to_str()\n",
" def __eq__(self, other):\n",
" if not isinstance(other, RouteInfo):\n",
" return False\n",
" return self.__dict__ == other.__dict__\n",
" def __ne__(self, other):\n",
" return not self == other\n",
"\n",
"class LocationInfoGeoArea(object):\n",
" swagger_types = {'_latitude': 'float', '_longitude': 'float'}\n",
" attribute_map = {'_latitude': 'latitude', '_longitude': 'longitude'}\n",
" def __init__(self, latitude, longitude): # noqa: E501\n",
" self._latitude = None\n",
" self._longitude = None\n",
" self.discriminator = None\n",
" if latitude is not None:\n",
" self.latitude = latitude\n",
" if longitude is not None:\n",
" self.longitude = longitude\n",
" @property\n",
" def latitude(self):\n",
" return self._latitude\n",
" @latitude.setter\n",
" def latitude(self, latitude):\n",
" if latitude is None:\n",
" raise ValueError(\"Invalid value for `latitude`, must not be `None`\") # noqa: E501\n",
" self._latitude = latitude\n",
" @property\n",
" def longitude(self):\n",
" return self._longitude\n",
" @longitude.setter\n",
" def longitude(self, longitude):\n",
" if longitude is None:\n",
" raise ValueError(\"Invalid value for `longitude`, must not be `None`\") # noqa: E501\n",
" self._longitude = longitude\n",
" def to_dict(self):\n",
" result = {}\n",
" for attr, _ in six.iteritems(self.swagger_types):\n",
" value = getattr(self, attr)\n",
" if isinstance(value, list):\n",
" result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, 'to_dict') else x,value))\n",
" elif hasattr(value, 'to_dict'):\n",
" result[attr] = value.to_dict()\n",
" elif isinstance(value, dict):\n",
" result[attr] = dict(map(\n",
" lambda item: (item[0], item[1].to_dict())\n",
" if hasattr(item[1], 'to_dict') else item,\n",
" value.items()\n",
" ))\n",
" else:\n",
" result[attr] = value\n",
" if issubclass(LocationInfoGeoArea, dict):\n",
" for key, value in self.items():\n",
" result[key] = value\n",
" return result\n",
" def to_str(self):\n",
" return pprint.pformat(self.to_dict())\n",
" def __repr__(self):\n",
" return self.to_str()\n",
" def __eq__(self, other):\n",
" if not isinstance(other, LocationInfoGeoArea):\n",
" return False\n",
" return self.__dict__ == other.__dict__\n",
" def __ne__(self, other):\n",
" return not self == other\n",
"\n",
"class Ecgi(object):\n",
" swagger_types = {'_cellId': 'CellId', '_plmn': 'Plmn'}\n",
" attribute_map = {'_cellId': 'cellId', '_plmn': 'plmn'}\n",
" def __init__(self, cellId=None, plmn=None): # noqa: E501\n",
" self._cellId = None\n",
" self._plmn = None\n",
" self.discriminator = None\n",
" if cellId is not None:\n",
" self.cellId = cellId\n",
" if plmn is not None:\n",
" self.plmn = plmn\n",
" @property\n",
" def cellId(self):\n",
" return self._cellId\n",
" @cellId.setter\n",
" def cellId(self, cellId):\n",
" self._cellId = cellId\n",
" @property\n",
" def plmn(self):\n",
" return self._plmn\n",
" @plmn.setter\n",
" def plmn(self, plmn):\n",
" self._plmn = plmn\n",
" def to_dict(self):\n",
" result = {}\n",
" for attr, _ in six.iteritems(self.swagger_types):\n",
" value = getattr(self, attr)\n",
" if isinstance(value, list):\n",
" result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, 'to_dict') else x,value))\n",
" elif hasattr(value, 'to_dict'):\n",
" result[attr] = value.to_dict()\n",
" elif isinstance(value, dict):\n",
" result[attr] = dict(map(\n",
" lambda item: (item[0], item[1].to_dict())\n",
" if hasattr(item[1], 'to_dict') else item,\n",
" value.items()\n",
" ))\n",
" else:\n",
" result[attr] = value\n",
" if issubclass(Ecgi, dict):\n",
" for key, value in self.items():\n",
" result[key] = value\n",
" return result\n",
" def to_str(self):\n",
" return pprint.pformat(self.to_dict())\n",
" def __repr__(self):\n",
" return self.to_str()\n",
" def __eq__(self, other):\n",
" if not isinstance(other, Ecgi):\n",
" return False\n",
" return self.__dict__ == other.__dict__\n",
" def __ne__(self, other):\n",
" return not self == other\n",
"\n",
"class CellId(object):\n",
" swagger_types = {'_cellId': 'str'}\n",
" attribute_map = {'_cellId': 'cellId'}\n",
" def __init__(self, cellId): # noqa: E501\n",
" self._cellId = None\n",
" self.cellId = cellId\n",
" @property\n",
" def cellId(self):\n",
" return self._cellId\n",
" @cellId.setter\n",
" def cellId(self, cellId):\n",
" if cellId is None:\n",
" raise ValueError(\"Invalid value for `cellId`, must not be `None`\") # noqa: E501\n",
" self._cellId = cellId\n",
" def to_dict(self):\n",
" result = {}\n",
" for attr, _ in six.iteritems(self.swagger_types):\n",
" value = getattr(self, attr)\n",
" if isinstance(value, list):\n",
" result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, 'to_dict') else x,value))\n",
" elif hasattr(value, 'to_dict'):\n",
" result[attr] = value.to_dict()\n",
" elif isinstance(value, dict):\n",
" result[attr] = dict(map(\n",
" lambda item: (item[0], item[1].to_dict())\n",
" if hasattr(item[1], 'to_dict') else item,\n",
" value.items()\n",
" ))\n",
" else:\n",
" result[attr] = value\n",
" if issubclass(CellId, dict):\n",
" for key, value in self.items():\n",
" result[key] = value\n",
" return result\n",
" def to_str(self):\n",
" return pprint.pformat(self.to_dict())\n",
" def __repr__(self):\n",
" return self.to_str()\n",
" def __eq__(self, other):\n",
" if not isinstance(other, CellId):\n",
" return False\n",
" return self.__dict__ == other.__dict__\n",
" def __ne__(self, other):\n",
" return not self == other\n",
"\n",
"class Plmn(object):\n",
" swagger_types = {'_mcc': 'str', '_mnc': 'str'}\n",
" attribute_map = {'_mcc': 'mcc', '_mnc': 'mnc'}\n",
" def __init__(self, mcc:str, mnc:str): # noqa: E501\n",
" self.discriminator = None\n",
" self._mcc = None\n",
" self._mnc = None\n",
" self.mcc = mcc\n",
" self.mnc = mnc\n",
" @property\n",
" def mcc(self):\n",
" return self._mcc\n",
" @mcc.setter\n",
" def kpi_nmccame(self, mcc):\n",
" if mcc is None:\n",
" raise ValueError(\"Invalid value for `mcc`, must not be `None`\") # noqa: E501\n",
" self._mcc = mcc\n",
" @property\n",
" def mnc(self):\n",
" return self._mnc\n",
" @mnc.setter\n",
" def kpi_nmccame(self, mnc):\n",
" if mnc is None:\n",
" raise ValueError(\"Invalid value for `mnc`, must not be `None`\") # noqa: E501\n",
" self._mnc = mnc\n",
" def to_dict(self):\n",
" result = {}\n",
" for attr, _ in six.iteritems(self.swagger_types):\n",
" value = getattr(self, attr)\n",
" if isinstance(value, list):\n",
" result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, 'to_dict') else x,value))\n",
" elif hasattr(value, 'to_dict'):\n",
" result[attr] = value.to_dict()\n",
" elif isinstance(value, dict):\n",
" result[attr] = dict(map(\n",
" lambda item: (item[0], item[1].to_dict())\n",
" if hasattr(item[1], 'to_dict') else item,\n",
" value.items()\n",
" ))\n",
" else:\n",
" result[attr] = value\n",
" if issubclass(Plmn, dict):\n",
" for key, value in self.items():\n",
" result[key] = value\n",
" return result\n",
" def to_str(self):\n",
" return pprint.pformat(self.to_dict())\n",
" def __repr__(self):\n",
" return self.to_str()\n",
" def __eq__(self, other):\n",
" if not isinstance(other, Plmn):\n",
" return False\n",
" return self.__dict__ == other.__dict__\n",
" def __ne__(self, other):\n",
" return not self == other\n",
"\n",
"class QosKpi(object):\n",
" swagger_types = {'_kpi_name': 'str', '_kpi_value': 'str', '_confidence': 'str'}\n",
" attribute_map = {'_kpi_name': 'kpiName', '_kpi_value': 'kpiValue', '_confidence': 'Confidence'}\n",
" def __init__(self, kpi_name:str, kpi_value:str, confidence=None): # noqa: E501\n",
" self._kpi_name = None\n",
" self._kpi_value = None\n",
" self._confidence = None\n",
" self.kpi_name = kpi_name\n",
" self.kpi_value = kpi_value\n",
" if confidence is not None:\n",
" self.confidences = confidence\n",
" @property\n",
" def kpi_name(self):\n",
" return self._kpi_name\n",
" @kpi_name.setter\n",
" def kpi_name(self, kpi_name):\n",
" if kpi_name is None:\n",
" raise ValueError(\"Invalid value for `kpi_name`, must not be `None`\") # noqa: E501\n",
" self._kpi_name = kpi_name\n",
" @property\n",
" def kpi_value(self):\n",
" return self._kpi_value\n",
" @kpi_value.setter\n",
" def kpi_value(self, kpi_value):\n",
" if kpi_value is None:\n",
" raise ValueError(\"Invalid value for `kpi_value`, must not be `None`\") # noqa: E501\n",
" self._kpi_value = kpi_value\n",
" @property\n",
" def confidence(self):\n",
" return self._confidence\n",
" @confidence.setter\n",
" def confidence(self, confidence):\n",
" self._confidence = confidence\n",
" def to_dict(self):\n",
" result = {}\n",
" for attr, _ in six.iteritems(self.swagger_types):\n",
" value = getattr(self, attr)\n",
" if isinstance(value, list):\n",
" result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, 'to_dict') else x,value))\n",
" elif hasattr(value, 'to_dict'):\n",
" result[attr] = value.to_dict()\n",
" elif isinstance(value, dict):\n",
" result[attr] = dict(map(\n",
" lambda item: (item[0], item[1].to_dict())\n",
" if hasattr(item[1], 'to_dict') else item,\n",
" value.items()\n",
" ))\n",
" else:\n",
" result[attr] = value\n",
" if issubclass(QosKpi, dict):\n",
" for key, value in self.items():\n",
" result[key] = value\n",
" return result\n",
" def to_str(self):\n",
" return pprint.pformat(self.to_dict())\n",
" def __repr__(self):\n",
" return self.to_str()\n",
" def __eq__(self, other):\n",
" if not isinstance(other, QosKpi):\n",
" return False\n",
" return self.__dict__ == other.__dict__\n",
" def __ne__(self, other):\n",
" return not self == other\n",
"\n",
"class Stream(object):\n",
" swagger_types = {'_stream_id': 'str', '_qos_kpi': 'list[QosKpi]'}\n",
" attribute_map = {'_stream_id': 'streamId', '_qos_kpi': 'qosKpi'}\n",
" def __init__(self, stream_id:str, qos_kpi:list): # noqa: E501\n",
" self._stream_id = None\n",
" self._qos_kpi = None\n",
" self.stream_id = stream_id\n",
" self.qos_kpi = qos_kpi\n",
" @property\n",
" def stream_id(self):\n",
" return self._stream_id\n",
" @stream_id.setter\n",
" def stream_id(self, stream_id):\n",
" if stream_id is None:\n",
" raise ValueError(\"Invalid value for `stream_id`, must not be `None`\") # noqa: E501\n",
" self._stream_id = stream_id\n",
" @property\n",
" def qos_kpi(self):\n",
" return self._qos_kpi\n",
" @qos_kpi.setter\n",
" def qos_kpi(self, qos_kpi):\n",
" if qos_kpi is None:\n",
" raise ValueError(\"Invalid value for `qos_kpi`, must not be `None`\") # noqa: E501\n",
" self._qos_kpi = qos_kpi\n",
" def to_dict(self):\n",
" result = {}\n",
" for attr, _ in six.iteritems(self.swagger_types):\n",
" value = getattr(self, attr)\n",
" if isinstance(value, list):\n",
" result[attr] = list(map(\n",
" lambda x: x.to_dict() if hasattr(x, 'to_dict') else x,\n",
" value\n",
" ))\n",
" elif hasattr(value, 'to_dict'):\n",
" result[attr] = value.to_dict()\n",
" elif isinstance(value, dict):\n",
" result[attr] = dict(map(\n",
" lambda item: (item[0], item[1].to_dict())\n",
" if hasattr(item[1], 'to_dict') else item,\n",
" value.items()\n",
" ))\n",
" else:\n",
" result[attr] = value\n",
" if issubclass(Stream, dict):\n",
" for key, value in self.items():\n",
" result[key] = value\n",
" return result\n",
" def to_str(self):\n",
" return pprint.pformat(self.to_dict())\n",
" def __repr__(self):\n",
" return self.to_str()\n",
" def __eq__(self, other):\n",
" if not isinstance(other, Stream):\n",
" return False\n",
" return self.__dict__ == other.__dict__\n",
" def __ne__(self, other):\n",
" return not self == other\n",
"\n",
"class Qos(object):\n",
" swagger_types = {'_stream': 'list[Stream]'}\n",
" attribute_map = {'_stream': 'stream'}\n",
" def __init__(self, stream:list): # noqa: E501\n",
" self._stream = None\n",
" self.stream = stream\n",
" @property\n",
" def stream(self):\n",
" return self._stream\n",
" @stream.setter\n",
" def stream(self, stream):\n",
" if stream is None:\n",
" raise ValueError(\"Invalid value for `stream`, must not be `None`\") # noqa: E501\n",
" self._stream = stream\n",
" def to_dict(self):\n",
" result = {}\n",
" for attr, _ in six.iteritems(self.swagger_types):\n",
" value = getattr(self, attr)\n",
" if isinstance(value, list):\n",
" result[attr] = list(map(\n",
" lambda x: x.to_dict() if hasattr(x, 'to_dict') else x,\n",
" value\n",
" ))\n",
" elif hasattr(value, 'to_dict'):\n",
" result[attr] = value.to_dict()\n",
" elif isinstance(value, dict):\n",
" result[attr] = dict(map(\n",
" lambda item: (item[0], item[1].to_dict())\n",
" if hasattr(item[1], 'to_dict') else item,\n",
" value.items()\n",
" ))\n",
" else:\n",
" result[attr] = value\n",
" if issubclass(Qos, dict):\n",
" for key, value in self.items():\n",
" result[key] = value\n",
" return result\n",
" def to_str(self):\n",
" return pprint.pformat(self.to_dict())\n",
" def __repr__(self):\n",
" return self.to_str()\n",
" def __eq__(self, other):\n",
" if not isinstance(other, Qos):\n",
" return False\n",
" return self.__dict__ == other.__dict__\n",
" def __ne__(self, other):\n",
" return not self == other\n",
"\n",
"class PredictedQos(object):\n",
" swagger_types = {'_location_granularity': 'str', '_notice_period': 'TimeStamp', '_prediction_area': 'PredictionArea', '_prediction_target': 'str', '_qos': 'Qos', '_routes': 'list[Routes]', '_time_granularity': 'TimeStamp'}\n",
" attribute_map = {'_location_granularity': 'locationGranularity', '_notice_period': 'noticePeriod', '_prediction_area': 'predictionArea', '_prediction_target': 'predictionTarget', '_qos': 'qos', '_routes': 'routes', '_time_granularity': 'timeGranularity'}\n",
" def __init__(self, prediction_target:str, location_granularity:str, notice_period=None, time_granularity=None, prediction_area=None, routes=None, qos=None): # noqa: E501\n",
" self._prediction_target = None\n",
" self._time_granularity = None\n",
" self._location_granularity = None\n",
" self._notice_period = None\n",
" self._prediction_area = None\n",
" self._routes = None\n",
" self._qos = None\n",
" self._prediction_target = prediction_target\n",
" if time_granularity is not None:\n",
" self.time_granularity = time_granularity\n",
" self.location_granularity = location_granularity\n",
" if notice_period is not None:\n",
" self.notice_period = notice_period\n",
" if prediction_area is not None:\n",
" self.prediction_area = prediction_area\n",
" if routes is not None:\n",
" self.routes = routes\n",
" if qos is not None:\n",
" self.qos = qos\n",
" @property\n",
" def prediction_target(self):\n",
" return self._prediction_target\n",
" @prediction_target.setter\n",
" def prediction_target(self, prediction_target):\n",
" if prediction_target is None:\n",
" raise ValueError(\"Invalid value for `prediction_target`, must not be `None`\") # noqa: E501\n",
" self._prediction_target = prediction_target\n",
" @property\n",
" def time_granularity(self):\n",
" return self._time_granularity\n",
" @time_granularity.setter\n",
" def time_granularity(self, time_granularity):\n",
" self._time_granularity = time_granularity\n",
" @property\n",
" def location_granularity(self):\n",
" return self._location_granularity\n",
" @location_granularity.setter\n",
" def location_granularity(self, location_granularity):\n",
" if location_granularity is None:\n",
" raise ValueError(\"Invalid value for `location_granularity`, must not be `None`\") # noqa: E501\n",
" self._location_granularity = location_granularity\n",
" @property\n",
" def notice_period(self):\n",
" return self._notice_period\n",
" @notice_period.setter\n",
" def notice_period(self, notice_period):\n",
" self._notice_period = notice_period\n",
" @property\n",
" def prediction_area(self):\n",
" return self._prediction_area\n",
" @prediction_area.setter\n",
" def prediction_area(self, prediction_area):\n",
" self._prediction_area = prediction_area\n",
" @property\n",
" def routes(self):\n",
" return self._routes\n",