Newer
Older
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
" 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",
" @routes.setter\n",
" def routes(self, routes):\n",
" self._routes = routes\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(PredictedQos, 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, PredictedQos):\n",
" return False\n",
" return self.__dict__ == other.__dict__\n",
" def __ne__(self, other):\n",
" return not self == other\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Here is the V2X Prediscted QoS:"
"metadata": {},
"outputs": [],
"source": [
"def get_qos_prediction(sandbox_name: str) -> object:\n",
" global MEC_PLTF, logger\n",
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
" logger.debug('>>> get_qos_prediction: sandbox_name: ' + sandbox_name)\n",
" try:\n",
" url = '/{sandbox_name}/{mec_pltf}/vis/v2/provide_predicted_qos'\n",
" logger.debug('send_uu_unicast_provisioning_info: url: ' + url)\n",
" path_params = {}\n",
" path_params['sandbox_name'] = sandbox_name\n",
" path_params['mec_pltf'] = MEC_PLTF\n",
" # HTTP header `Accept`\n",
" header_params = {}\n",
" header_params['Accept'] = 'application/json' # noqa: E501\n",
" # HTTP header `Content-Type`\n",
" header_params['Content-Type'] = 'application/json' # noqa: E501\n",
" # Body request\n",
" loc1 = LocationInfo(geo_area=LocationInfoGeoArea(latitude=43.729416, longitude=7.414853))\n",
" loc2 = LocationInfo(geo_area=LocationInfoGeoArea(latitude=43.732456, longitude=7.418417))\n",
" routeInfo1 = RouteInfo(loc1, TimeStamp(nano_seconds=0, seconds=1653295620))\n",
" routeInfo2 = RouteInfo(loc2, TimeStamp(nano_seconds=0, seconds=1653299220))\n",
" routesInfo = [routeInfo1, routeInfo2]\n",
" predictedQos = PredictedQos(prediction_target=\"SINGLE_UE_PREDICTION\", location_granularity=\"30\", routes=[Routes(routesInfo)])\n",
" (result, status, headers) = service_api.call_api(url, 'POST', header_params=header_params, path_params=path_params, body=predictedQos, async_req=False)\n",
" return (result, status, headers)\n",
" except ApiException as e:\n",
" logger.error('Exception when calling call_api: %s\\n' % e)\n",
" return None\n",
" # End of function send_uu_unicast_provisioning_info"
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Grouping all together provides the process_main funtion.. The sequence is the following:\n",
"- Mec application setup\n",
"- V2X QoS request\n",
"- Mec application termination\n",
"\n",
"The expected response should be:\n",
"- RSRP: 55\n",
"- RSRQ: 13"
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-10 15:28:52,773 - __main__ - DEBUG - Starting at 20241010-152852\n",
"2024-10-10 15:28:52,775 - __main__ - DEBUG - \t pwd= /home/yann/dev/jupyter/Sandbox/mecapp\n",
"2024-10-10 15:28:52,779 - __main__ - DEBUG - >>> process_login\n",
"2024-10-10 15:28:52,781 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
"2024-10-10 15:28:52,989 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/login?provider=Jupyter2024 HTTP/1.1\" 201 48\n",
"2024-10-10 15:28:52,990 DEBUG response body: b'{\"user_code\":\"sbx0gt5amu\",\"verification_uri\":\"\"}'\n",
"2024-10-10 15:28:52,991 - __main__ - DEBUG - process_login (step1): oauth: {'user_code': 'sbx0gt5amu', 'verification_uri': ''}\n",
"2024-10-10 15:28:52,993 - __main__ - DEBUG - =======================> DO AUTHORIZATION WITH CODE : sbx0gt5amu\n",
"2024-10-10 15:28:52,995 - __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: Content-Type: application/json; charset=UTF-8\n",
"header: Content-Length: 48\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-10 15:28:56,039 DEBUG https://mec-platform2.etsi.org:443 \"GET /sandbox-api/v1/namespace?user_code=sbx0gt5amu HTTP/1.1\" 200 29\n",
"2024-10-10 15:28:56,042 DEBUG response body: b'{\"sandbox_name\":\"sbx0gt5amu\"}'\n",
"2024-10-10 15:28:56,045 - __main__ - DEBUG - process_login (step2): result: {'sandbox_name': 'sbx0gt5amu'}\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"send: b'GET /sandbox-api/v1/namespace?user_code=sbx0gt5amu 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: Content-Type: application/json; charset=UTF-8\n",
"header: Content-Length: 29\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-10 15:29:02,048 - __main__ - DEBUG - >>> get_network_scenarios: sandbox=sbx0gt5amu\n",
"2024-10-10 15:29:02,051 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
"2024-10-10 15:29:02,229 DEBUG https://mec-platform2.etsi.org:443 \"GET /sandbox-api/v1/sandboxNetworkScenarios?sandbox_name=sbx0gt5amu HTTP/1.1\" 200 186\n",
"2024-10-10 15:29:02,231 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-10-10 15:29:02,232 - __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=sbx0gt5amu 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: Content-Type: application/json; charset=UTF-8\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-10 15:29:08,239 - __main__ - DEBUG - >>> activate_network_scenario: sbx0gt5amu\n",
"2024-10-10 15:29:08,299 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/sandboxNetworkScenarios/sbx0gt5amu?network_scenario_id=4g-5g-macro-v2x HTTP/1.1\" 204 0\n",
"2024-10-10 15:29:08,302 DEBUG response body: b''\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"send: b'POST /sandbox-api/v1/sandboxNetworkScenarios/sbx0gt5amu?network_scenario_id=4g-5g-macro-v2x HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 2\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"send: b'{}'\n",
"reply: 'HTTP/1.1 204 No Content\\r\\n'\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-10 15:29:20,316 - __main__ - DEBUG - >>> request_application_instance_id: sbx0gt5amu\n",
"2024-10-10 15:29:20,319 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
"2024-10-10 15:29:20,505 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/sandboxAppInstances/sbx0gt5amu HTTP/1.1\" 201 100\n",
"2024-10-10 15:29:20,507 DEBUG response body: b'{\"id\":\"6ea0e588-f421-4c01-8e9e-7c6617e5fba7\",\"name\":\"JupyterMecApp\",\"nodeName\":\"mep1\",\"type\":\"USER\"}'\n",
"2024-10-10 15:29:20,510 - __main__ - DEBUG - request_application_instance_id: result: {'id': '6ea0e588-f421-4c01-8e9e-7c6617e5fba7',\n",
" 'name': 'JupyterMecApp',\n",
" 'node_name': 'mep1',\n",
" 'persist': None,\n",
" 'type': 'USER'}\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
" 'name': 'JupyterMecApp',\n",
" 'node_name': 'mep1',\n",
" 'persist': None,\n",
" 'type': 'USER'}\n",
"send: b'POST /sandbox-api/v1/sandboxAppInstances/sbx0gt5amu 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\": \"6ea0e588-f421-4c01-8e9e-7c6617e5fba7\", \"name\": \"JupyterMecApp\", \"nodeName\": \"mep1\", \"type\": \"USER\"}'\n",
"reply: 'HTTP/1.1 201 Created\\r\\n'\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Content-Length: 100\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-10 15:29:26,518 - __main__ - DEBUG - >>> send_ready_confirmation: 6ea0e588-f421-4c01-8e9e-7c6617e5fba7\n",
"2024-10-10 15:29:26,521 - __main__ - DEBUG - send_ready_confirmation: url: /{sandbox_name}/{mec_pltf}/mec_app_support/v2/applications/{app_inst_id}/confirm_ready\n",
"2024-10-10 15:29:26,524 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
"2024-10-10 15:29:26,658 DEBUG https://mec-platform2.etsi.org:443 \"POST /sbx0gt5amu/mep1/mec_app_support/v2/applications/6ea0e588-f421-4c01-8e9e-7c6617e5fba7/confirm_ready HTTP/1.1\" 204 0\n",
"2024-10-10 15:29:26,659 DEBUG response body: b''\n",
"2024-10-10 15:29:26,660 - __main__ - DEBUG - >>> send_subscribe_termination: 6ea0e588-f421-4c01-8e9e-7c6617e5fba7\n",
"2024-10-10 15:29:26,660 - __main__ - DEBUG - send_subscribe_termination: url: /{sandbox_name}/{mec_pltf}/mec_app_support/v2/applications/{app_inst_id}/subscriptions\n",
"2024-10-10 15:29:26,678 DEBUG https://mec-platform2.etsi.org:443 \"POST /sbx0gt5amu/mep1/mec_app_support/v2/applications/6ea0e588-f421-4c01-8e9e-7c6617e5fba7/subscriptions HTTP/1.1\" 201 367\n",
"2024-10-10 15:29:26,680 DEBUG response body: b'{\"subscriptionType\":\"AppTerminationNotificationSubscription\",\"callbackReference\":\"http://yanngarcia.ddns.net/mec011/v2/termination\",\"_links\":{\"self\":{\"href\":\"https://mec-platform2.etsi.org/sbx0gt5amu/mep1/mec_app_support/v2/applications/6ea0e588-f421-4c01-8e9e-7c6617e5fba7/subscriptions/sub-biC1jfldf9zjXl8s\"}},\"appInstanceId\":\"6ea0e588-f421-4c01-8e9e-7c6617e5fba7\"}'\n",
"2024-10-10 15:29:26,680 - __main__ - DEBUG - >>> extract_sub_id: resource_url: https://mec-platform2.etsi.org/sbx0gt5amu/mep1/mec_app_support/v2/applications/6ea0e588-f421-4c01-8e9e-7c6617e5fba7/subscriptions/sub-biC1jfldf9zjXl8s\n",
"2024-10-10 15:29:26,681 - __main__ - DEBUG - >>> get_qos_prediction: sandbox_name: sbx0gt5amu\n",
"2024-10-10 15:29:26,682 - __main__ - DEBUG - send_uu_unicast_provisioning_info: url: /{sandbox_name}/{mec_pltf}/vis/v2/provide_predicted_qos\n",
"2024-10-10 15:29:26,739 DEBUG https://mec-platform2.etsi.org:443 \"POST /sbx0gt5amu/mep1/vis/v2/provide_predicted_qos HTTP/1.1\" 200 610\n",
"2024-10-10 15:29:26,742 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-10-10 15:29:26,744 - __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-10-10 15:29:26,745 - __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-10-10 15:29:26,747 - __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 /sbx0gt5amu/mep1/mec_app_support/v2/applications/6ea0e588-f421-4c01-8e9e-7c6617e5fba7/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: 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 /sbx0gt5amu/mep1/mec_app_support/v2/applications/6ea0e588-f421-4c01-8e9e-7c6617e5fba7/subscriptions HTTP/1.1\\r\\nHost: mec-platform2.etsi.org\\r\\nAccept-Encoding: identity\\r\\nContent-Length: 192\\r\\nAccept: application/json\\r\\nContent-Type: application/json\\r\\nUser-Agent: Swagger-Codegen/1.0.0/python\\r\\n\\r\\n'\n",
"send: b'{\"subscriptionType\": \"AppTerminationNotificationSubscription\", \"callbackReference\": \"http://yanngarcia.ddns.net/mec011/v2/termination\", \"appInstanceId\": \"6ea0e588-f421-4c01-8e9e-7c6617e5fba7\"}'\n",
"reply: 'HTTP/1.1 201 Created\\r\\n'\n",
"header: Content-Type: application/json; charset=UTF-8\n",
"header: Content-Length: 367\n",
"header: Connection: keep-alive\n",
"header: Location: https://mec-platform2.etsi.org/sbx0gt5amu/mep1/mec_app_support/v2/applications/6ea0e588-f421-4c01-8e9e-7c6617e5fba7/subscriptions/sub-biC1jfldf9zjXl8s\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n",
"send: b'POST /sbx0gt5amu/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: Content-Type: application/json; charset=UTF-8\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-10 15:29:32,755 - __main__ - DEBUG - >>> delete_subscribe_termination: 6ea0e588-f421-4c01-8e9e-7c6617e5fba7\n",
"2024-10-10 15:29:32,757 - __main__ - DEBUG - delete_subscribe_termination: url: /{sandbox_name}/{mec_pltf}/mec_app_support/v2/applications/{app_inst_id}/subscriptions/{sub_id}\n",
"2024-10-10 15:29:32,807 DEBUG https://mec-platform2.etsi.org:443 \"DELETE /sbx0gt5amu/mep1/mec_app_support/v2/applications/6ea0e588-f421-4c01-8e9e-7c6617e5fba7/subscriptions/sub-biC1jfldf9zjXl8s HTTP/1.1\" 204 0\n",
"2024-10-10 15:29:32,810 DEBUG response body: b''\n",
"2024-10-10 15:29:32,812 - __main__ - DEBUG - >>> delete_application_instance_id: sbx0gt5amu\n",
"2024-10-10 15:29:32,814 - __main__ - DEBUG - >>> delete_application_instance_id: 6ea0e588-f421-4c01-8e9e-7c6617e5fba7\n",
"2024-10-10 15:29:32,847 DEBUG https://mec-platform2.etsi.org:443 \"DELETE /sandbox-api/v1/sandboxAppInstances/sbx0gt5amu/6ea0e588-f421-4c01-8e9e-7c6617e5fba7 HTTP/1.1\" 204 0\n",
"2024-10-10 15:29:32,850 DEBUG response body: b''\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"send: b'DELETE /sbx0gt5amu/mep1/mec_app_support/v2/applications/6ea0e588-f421-4c01-8e9e-7c6617e5fba7/subscriptions/sub-biC1jfldf9zjXl8s 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: 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/sbx0gt5amu/6ea0e588-f421-4c01-8e9e-7c6617e5fba7 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: Content-Type: application/json; charset=UTF-8\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-10 15:29:38,859 - __main__ - DEBUG - >>> deactivate_network_scenario: sbx0gt5amu\n",
"2024-10-10 15:29:38,929 DEBUG https://mec-platform2.etsi.org:443 \"DELETE /sandbox-api/v1/sandboxNetworkScenarios/sbx0gt5amu/4g-5g-macro-v2x HTTP/1.1\" 204 0\n",
"2024-10-10 15:29:38,931 DEBUG response body: b''\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"send: b'DELETE /sandbox-api/v1/sandboxNetworkScenarios/sbx0gt5amu/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: Content-Type: application/json; charset=UTF-8\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-10-10 15:29:50,946 - __main__ - DEBUG - >>> process_logout: sandbox=sbx0gt5amu\n",
"2024-10-10 15:29:50,949 DEBUG Resetting dropped connection: mec-platform2.etsi.org\n",
"2024-10-10 15:29:51,097 DEBUG https://mec-platform2.etsi.org:443 \"POST /sandbox-api/v1/logout?sandbox_name=sbx0gt5amu HTTP/1.1\" 204 0\n",
"2024-10-10 15:29:51,098 DEBUG response body: b''\n",
"2024-10-10 15:29:51,098 - __main__ - DEBUG - Stopped at 20241010-152951\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"send: b'POST /sandbox-api/v1/logout?sandbox_name=sbx0gt5amu 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: Content-Type: application/json; charset=UTF-8\n",
"header: Connection: keep-alive\n",
"header: Strict-Transport-Security: max-age=15724800; includeSubDomains\n"
]
}
],
"def process_main():\n",
" \"\"\"\n",
" This is the second sprint of our skeleton of our MEC application:\n",
" - Mec application setup\n",
" - Mec application termination\n",
" \"\"\" \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",
" # QoS Prediction\n",
" (result, status, headers) = get_qos_prediction(sandbox_name)\n",
" if status != 200:\n",
" logger.error('Failed to get UU unicast provisioning information')\n",
" else:\n",
" logger.info('UU unicast provisioning information: result: %s', str(result.data))\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",
" time.sleep(STABLE_TIME_OUT)\n",
"\n",
" # Terminate the MEC application\n",
" mec_app_termination(sandbox_name, app_inst_id, sub_id)\n",
"\n",
" logger.debug('Stopped at ' + time.strftime('%Y%m%d-%H%M%S'))\n",
" # End of function process_main\n",
"\n",
"if __name__ == '__main__':\n",
" process_main()\n"
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Our third MEC application: how to create a new MEC Services\n",
"The purpose of this MEC Service application is to provide a custom MEC service that can be use by other MEC applications. For the purpose of this tutorial, our MEC service is simulating some complex calculation based on a set of data provided by the MEC use. \n",
"We will use a second MEC application to exploit the features of our new MEC services.\n",
"In this clause, we use the following functionalities provided by MEC-011:\n",
"- Register a new service\n",
"- Retrieve the list of the MEC services exposed by the MEC platform\n",
"- Check that our new MEC service is present in the list of the MEC platform services\n",
"- Execute a request to the MEC service\n",
"- Delete the newly created service\n",
"\n",
"<b>Note:</b> We will use a second MEC application to exploit the features of our new MEC services.\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Bases of the creation of a MEC service\n",
"\n",
"#### Introduction\n",
"\n",
"From the user perspective, a MEC service provides a set of endpoints which describe the interface of the MEC service (see [HTTP REST APIs \n",
"concepts](https://blog.postman.com/rest-api-examples/)). These endpoints come usually with a set of data structures used by the one or more endpoints.\n",
"\n",
"Our service is really basic: it provide one endpoint:\n",
"- GET /statistic/v1/quantity: it computes statistical quantities of a set of data (such as average, max, min, standard deviation)\n",
"\n",
"The body of this GET method is a list of datas:\n",
"{\"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]\"}\n",
"```\n",
"\n",
"The response body is the list of statistical quantities:\n",
"```json\n",
"{\"time\":20180124,\"avg\": 0.0,\"max\": 0.0,\"min\": 0.0,\"stddev\": 0.0 }\n",
"```\n",
"\n",
"#### MEC mechanisms to create a new service\n",
"\n",
"As described in ETSI GS MEC 011 Clause 5.2.4 Service availability update and new service registration, to create a new MEC service, the following information is required:\n",
"- A MEC Aplication instance: this is the MEC application providing the new MEC service (ETSI GS MEC 011 V3.2.1 Clause 8.2.6.3.4 POST)\n",
"- A ServiceInfo instance which describe the MEC service (ETSI GS MEC 011 V3.2.1 Clause 8.1.2.2 Type: ServiceInfo)\n",
"- As part of the ServiceInfo instance, a TransportInfo (ETSI GS MEC 011 V3.2.1 Clause 8.1.2.3 Type: TransportInfo) instance descibes the endpoints to use the MEC service\n",
"\n",
"When created and available, all the other MEC applications are notified about the existance of this MEC service."
]
},
{
"cell_type": "code",
"metadata": {},
"outputs": [],
"source": [
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
"class ServiceInfo(object):\n",
" swagger_types = {'ser_instance_id': 'str','ser_name': 'str','ser_category': 'CategoryRef','version': 'str','state': 'str','transport_id': 'str','transport_info': 'TransportInfo','serializer': 'string','scope_of_locality': 'LocalityType','consumed_local_only': 'bool','is_local': 'bool','liveness_interval': 'int','links': 'ServiceInfoLinks'}\n",
" attribute_map = {'ser_instance_id': 'serInstanceId','ser_name': 'serName','ser_category': 'serCategory','version': 'version','state': 'state','transport_id': 'transportId','transport_info': 'transportInfo','serializer': 'serializer','scope_of_locality': 'scopeOfLocality','consumed_local_only': 'consumedLocalOnly','is_local': 'isLocal','liveness_interval': 'livenessInterval','links': '_links'}\n",
" def __init__(self, ser_instance_id=None, ser_name=None, ser_category=None, version=None, state=None, transport_id=None, transport_info=None, serializer=None, scope_of_locality=None, consumed_local_only=None, is_local=None, liveness_interval=None, links=None): # noqa: E501\n",
" self._ser_instance_id = None\n",
" self._ser_name = None\n",
" self._ser_category = None\n",
" self._version = None\n",
" self._state = None\n",
" self._transport_id = None\n",
" self._transport_info = None\n",
" self._serializer = None\n",
" self._scope_of_locality = None\n",
" self._consumed_local_only = None\n",
" self._is_local = None\n",
" self._liveness_interval = None\n",
" self._links = None\n",
" self.discriminator = None\n",
" if ser_instance_id is not None:\n",
" self.ser_instance_id = ser_instance_id\n",
" self.ser_name = ser_name\n",
" if ser_category is not None:\n",
" self.ser_category = ser_category\n",
" self.version = version\n",
" self.state = state\n",
" if transport_id is not None:\n",
" self.transport_id = transport_id\n",
" self.transport_info = transport_info\n",
" self.serializer = serializer\n",
" if scope_of_locality is not None:\n",
" self.scope_of_locality = scope_of_locality\n",
" if consumed_local_only is not None:\n",
" self.consumed_local_only = consumed_local_only\n",
" if is_local is not None:\n",
" self.is_local = is_local\n",
" if liveness_interval is not None:\n",
" self.liveness_interval = liveness_interval\n",
" if links is not None:\n",
" self.links = links\n",
" @property\n",
" def ser_instance_id(self):\n",
" return self._ser_instance_id\n",
" @ser_instance_id.setter\n",
" def ser_instance_id(self, ser_instance_id):\n",
" self._ser_instance_id = ser_instance_id\n",
" @property\n",
" def ser_name(self):\n",
" return self._ser_name\n",
" @ser_name.setter\n",
" def ser_name(self, ser_name):\n",
" if ser_name is None:\n",
" raise ValueError(\"Invalid value for `ser_name`, must not be `None`\") # noqa: E501\n",
" self._ser_name = ser_name\n",
" @property\n",
" def ser_category(self):\n",
" return self._ser_category\n",
" @ser_category.setter\n",
" def ser_category(self, ser_category):\n",
" self._ser_category = ser_category\n",
" @property\n",
" def version(self):\n",
" return self._version\n",
" @version.setter\n",
" def version(self, version):\n",
" if version is None:\n",
" raise ValueError(\"Invalid value for `version`, must not be `None`\") # noqa: E501\n",
" self._version = version\n",
" @property\n",
" def state(self):\n",
" return self._state\n",
" @state.setter\n",
" def state(self, state):\n",
" if state is None:\n",
" raise ValueError(\"Invalid value for `state`, must not be `None`\") # noqa: E501\n",
" self._state = state\n",
" @property\n",
" def transport_id(self):\n",
" return self._transport_id\n",
" @transport_id.setter\n",
" def transport_id(self, transport_id):\n",
" self._transport_id = transport_id\n",
" @property\n",
" def transport_info(self):\n",
" return self._transport_info\n",
" @transport_info.setter\n",
" def transport_info(self, transport_info):\n",
" if transport_info is None:\n",
" raise ValueError(\"Invalid value for `transport_info`, must not be `None`\") # noqa: E501\n",
" self._transport_info = transport_info\n",
" @property\n",
" def serializer(self):\n",
" return self._serializer\n",
" @serializer.setter\n",
" def serializer(self, serializer):\n",
" if serializer is None:\n",
" raise ValueError(\"Invalid value for `serializer`, must not be `None`\") # noqa: E501\n",
" self._serializer = serializer\n",
" @property\n",
" def scope_of_locality(self):\n",
" return self._scope_of_locality\n",
" @scope_of_locality.setter\n",
" def scope_of_locality(self, scope_of_locality):\n",
" self._scope_of_locality = scope_of_locality\n",
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
" def consumed_local_only(self):\n",
" return self._consumed_local_only\n",
" @consumed_local_only.setter\n",
" def consumed_local_only(self, consumed_local_only):\n",
" self._consumed_local_only = consumed_local_only\n",
" @property\n",
" def is_local(self):\n",
" return self._is_local\n",
" @is_local.setter\n",
" def is_local(self, is_local):\n",
" self._is_local = is_local\n",
" @property\n",
" def liveness_interval(self):\n",
" return self._liveness_interval\n",
" @liveness_interval.setter\n",
" def liveness_interval(self, liveness_interval):\n",
" self._liveness_interval = liveness_interval\n",
" @property\n",
" def links(self):\n",
" return self._links\n",
" @links.setter\n",
" def links(self, links):\n",
" self._links = links\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",
" value.items()\n",
" ))\n",
" else:\n",
" result[attr] = value\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",
" return False\n",
" return self.__dict__ == other.__dict__\n",
" def __ne__(self, other):\n",
" return not self == other\n",
"class CategoryRef(object):\n",
" swagger_types = {'href': 'str','id': 'str','name': 'str','version': 'str'}\n",
" attribute_map = {'href': 'href','id': 'id','name': 'name','version': 'version'}\n",
" def __init__(self, href=None, id=None, name=None, version=None): # noqa: E501\n",
" self._href = None\n",
" self._id = None\n",
" self._name = None\n",
" self._version = None\n",
" self.discriminator = None\n",
" self.href = href\n",
" self.id = id\n",
" self.name = name\n",
" self.version = version\n",
" def href(self):\n",
" return self._href\n",
" @href.setter\n",
" def href(self, href):\n",
" if href is None:\n",
" raise ValueError(\"Invalid value for `href`, must not be `None`\") # noqa: E501\n",
" self._href = href\n",
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
" def id(self):\n",
" return self._id\n",
" @id.setter\n",
" def id(self, id):\n",
" if id is None:\n",
" raise ValueError(\"Invalid value for `id`, must not be `None`\") # noqa: E501\n",
" self._id = id\n",
" @property\n",
" def name(self):\n",
" return self._name\n",
" @name.setter\n",
" def name(self, name):\n",
" if name is None:\n",
" raise ValueError(\"Invalid value for `name`, must not be `None`\") # noqa: E501\n",
" self._name = name\n",
" @property\n",
" def version(self):\n",
" return self._version\n",
" @version.setter\n",
" def version(self, version):\n",
" if version is None:\n",
" raise ValueError(\"Invalid value for `version`, must not be `None`\") # noqa: E501\n",
" self._version = version\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",
" value.items()\n",
" ))\n",
" else:\n",
" result[attr] = value\n",
" for key, value in self.items():\n",
" result[key] = value\n",