Skip to content
MEC application.ipynb 187 KiB
Newer Older
Yann Garcia's avatar
Yann Garcia committed
    "        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 function.\n",
    "\n",
    "Reference: ETSI GS MEC 030 V3.2.1 (2024-02) Clause 5.5.5 Sending a request for journey-specific QoS predictions\n"
Yann Garcia's avatar
Yann Garcia committed
   ]
  },
  {
   "cell_type": "code",
Yann Garcia's avatar
Yann Garcia committed
   "metadata": {},
   "outputs": [],
   "source": [
Yann Garcia's avatar
Yann Garcia committed
    "def get_qos_prediction(sandbox_name: str) -> object:\n",
    "    \"\"\"\n",
    "    Request to predictede QoS\n",
    "    :param sandbox_name: The MEC Sandbox instance to use\n",
    "    :return The HTTP response, the HTTP response status and the HTTP response headers on success, None otherwise\n",
    "    :see ETSI GS MEC 030 V3.2.1 (2024-02) Clause 5.5.5 Sending a request for journey-specific QoS predictions\n",
    "    \"\"\"\n",
    "    global MEC_PLTF, logger, service_api\n",
Yann Garcia's avatar
Yann Garcia committed
    "\n",
Yann Garcia's avatar
Yann Garcia committed
    "    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": [
Yann Garcia's avatar
Yann Garcia committed
    "Grouping all together provides the process_main funtion.. The sequence is the following:\n",
    "- Mec application setup\n",
Yann Garcia's avatar
Yann Garcia committed
    "- V2X QoS request\n",
    "- Mec application termination\n",
    "\n",
    "The expected response should be:\n",
    "- RSRP: 55\n",
    "- RSRQ: 13"
Yann Garcia's avatar
Yann Garcia committed
  {
   "cell_type": "code",
Yann Garcia's avatar
Yann Garcia committed
   "source": [
    "def process_main():\n",
    "    \"\"\"\n",
    "    This is the second sprint of our skeleton of our MEC application:\n",
    "        - Mec application setup\n",
Yann Garcia's avatar
Yann Garcia committed
    "        - V2X QoS request\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",
Yann Garcia's avatar
Yann Garcia committed
    "    sandbox_name, app_inst_id, sub_id = mec_app_setup()\n",
Yann Garcia's avatar
Yann Garcia committed
    "    # 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",
Yann Garcia's avatar
Yann Garcia committed
    "        logger.info('UU unicast provisioning information: result: %s', str(result.data))\n",
    "    \n",
    "    # Any processing here\n",
Yann Garcia's avatar
Yann Garcia committed
    "    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": [
Yann Garcia's avatar
Yann Garcia committed
    "## Our third MEC application: how to create a new MEC Services\n",
Yann Garcia's avatar
Yann Garcia committed
    "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",
    "\n",
Yann Garcia's avatar
Yann Garcia committed
    "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",
    "**Note:** We will use a second MEC application to exploit the features of our new MEC services.\n",
    "**Reference:** ETSI GS MEC 011 V3.2.1 (2024-04) Clause 5.2.4 Service availability update and new service registration\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
Yann Garcia's avatar
Yann Garcia committed
    "### 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",
    "```json\n",
Yann Garcia's avatar
Yann Garcia committed
    "{\"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."
   "metadata": {},
   "outputs": [],
   "source": [
Yann Garcia's avatar
Yann Garcia committed
    "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",
    "    @property\n",
Yann Garcia's avatar
Yann Garcia committed
    "    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",
Yann Garcia's avatar
Yann Garcia committed
    "                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",
Yann Garcia's avatar
Yann Garcia committed
    "                    if hasattr(item[1], \"to_dict\") else item,\n",
    "                    value.items()\n",
    "                ))\n",
    "            else:\n",
    "                result[attr] = value\n",
Yann Garcia's avatar
Yann Garcia committed
    "        if issubclass(ServiceInfo, 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",
Yann Garcia's avatar
Yann Garcia committed
    "        if not isinstance(other, ServiceInfo):\n",
    "            return False\n",
    "        return self.__dict__ == other.__dict__\n",
    "    def __ne__(self, other):\n",
    "        return not self == other\n",
Yann Garcia's avatar
Yann Garcia committed
    "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",
    "    @property\n",
Yann Garcia's avatar
Yann Garcia committed
    "    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",
    "    @property\n",
Yann Garcia's avatar
Yann Garcia committed
    "    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",
Yann Garcia's avatar
Yann Garcia committed
    "                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",
Yann Garcia's avatar
Yann Garcia committed
    "                    if hasattr(item[1], \"to_dict\") else item,\n",
    "                    value.items()\n",
    "                ))\n",
    "            else:\n",
    "                result[attr] = value\n",
Yann Garcia's avatar
Yann Garcia committed
    "        if issubclass(CategoryRef, dict):\n",
    "            for key, value in self.items():\n",
    "                result[key] = value\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",
Yann Garcia's avatar
Yann Garcia committed
    "        if not isinstance(other, CategoryRef):\n",
    "            return False\n",
    "        return self.__dict__ == other.__dict__\n",
    "    def __ne__(self, other):\n",
    "        return not self == other\n",
    "\n",
Yann Garcia's avatar
Yann Garcia committed
    "class TransportInfo(object):\n",
    "    swagger_types = {\n",
    "        'id': 'str','name': 'str','description': 'str','type': 'str','protocol': 'str','version': 'str','endpoint': 'OneOfTransportInfoEndpoint','security': 'SecurityInfo','impl_specific_info': 'str'}\n",
    "    attribute_map = {'id': 'id','name': 'name','description': 'description','type': 'type','protocol': 'protocol','version': 'version','endpoint': 'endpoint','security': 'security','impl_specific_info': 'implSpecificInfo'}\n",
    "    def __init__(self, id=None, name=None, description=None, type=None, protocol=None, version=None, endpoint=None, security=None, impl_specific_info=None):  # noqa: E501\n",
    "        self._id = None\n",
    "        self._name = None\n",
    "        self._description = None\n",
    "        self._type = None\n",
    "        self._protocol = None\n",
    "        self._version = None\n",
    "        self._endpoint = None\n",
    "        self._security = None\n",
    "        self._impl_specific_info = None\n",
    "        self.discriminator = None\n",
    "        self.id = id\n",
    "        self.name = name\n",
    "        if description is not None:\n",
    "            self.description = description\n",
    "        self.type = type\n",
    "        self.protocol = protocol\n",
    "        self.version = version\n",
    "        self.endpoint = endpoint\n",
    "        self.security = security\n",
    "        if impl_specific_info is not None:\n",
    "            self.impl_specific_info = impl_specific_info\n",
    "    @property\n",
Yann Garcia's avatar
Yann Garcia committed
    "    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",
Yann Garcia's avatar
Yann Garcia committed
    "    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 description(self):\n",
    "        return self._description\n",
    "    @description.setter\n",
    "    def description(self, description):\n",
    "        self._description = description\n",
    "    @property\n",
    "    def type(self):\n",
    "        return self._type\n",
    "    @type.setter\n",
    "    def type(self, type):\n",
    "        if type is None:\n",
    "            raise ValueError(\"Invalid value for `type`, must not be `None`\")  # noqa: E501\n",
    "        self._type = type\n",
    "    @property\n",
    "    def protocol(self):\n",
    "        return self._protocol\n",
    "    @protocol.setter\n",
    "    def protocol(self, protocol):\n",
    "        if protocol is None:\n",
    "            raise ValueError(\"Invalid value for `protocol`, must not be `None`\")  # noqa: E501\n",
    "        self._protocol = protocol\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 endpoint(self):\n",
    "        return self._endpoint\n",
    "    @endpoint.setter\n",
    "    def endpoint(self, endpoint):\n",
    "        if endpoint is None:\n",
    "            raise ValueError(\"Invalid value for `endpoint`, must not be `None`\")  # noqa: E501\n",
    "        self._endpoint = endpoint\n",
    "    @property\n",
    "    def security(self):\n",
    "        return self._security\n",
    "    @security.setter\n",
    "    def security(self, security):\n",
    "        if security is None:\n",
    "            raise ValueError(\"Invalid value for `security`, must not be `None`\")  # noqa: E501\n",
    "        self._security = security\n",
    "    @property\n",
    "    def impl_specific_info(self):\n",
    "        return self._impl_specific_info\n",
    "    @impl_specific_info.setter\n",
    "    def impl_specific_info(self, impl_specific_info):\n",
    "        self._impl_specific_info = impl_specific_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",
Yann Garcia's avatar
Yann Garcia committed
    "                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",
Yann Garcia's avatar
Yann Garcia committed
    "                    if hasattr(item[1], \"to_dict\") else item,\n",
    "                    value.items()\n",
    "                ))\n",
    "            else:\n",
    "                result[attr] = value\n",
Yann Garcia's avatar
Yann Garcia committed
    "        if issubclass(TransportInfo, 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",
Yann Garcia's avatar
Yann Garcia committed
    "        if not isinstance(other, TransportInfo):\n",
    "            return False\n",
    "        return self.__dict__ == other.__dict__\n",
    "    def __ne__(self, other):\n",
    "        return not self == other\n",
    "\n",
Yann Garcia's avatar
Yann Garcia committed
    "class SecurityInfo(object):\n",
    "    swagger_types = {'o_auth2_info': 'SecurityInfoOAuth2Info'}\n",
    "    attribute_map = {'o_auth2_info': 'oAuth2Info'}\n",
    "    def __init__(self, o_auth2_info=None):  # noqa: E501\n",
    "        self._o_auth2_info = None\n",
    "        self.discriminator = None\n",
    "        if o_auth2_info is not None:\n",
    "            self.o_auth2_info = o_auth2_info\n",
    "    @property\n",
Yann Garcia's avatar
Yann Garcia committed
    "    def o_auth2_info(self):\n",
    "        return self._o_auth2_info\n",
    "    @o_auth2_info.setter\n",
    "    def o_auth2_info(self, o_auth2_info):\n",
    "        self._o_auth2_info = o_auth2_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",
Yann Garcia's avatar
Yann Garcia committed
    "                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",
Yann Garcia's avatar
Yann Garcia committed
    "                    if hasattr(item[1], \"to_dict\") else item,\n",
    "                    value.items()\n",
    "                ))\n",
    "            else:\n",
    "                result[attr] = value\n",
Yann Garcia's avatar
Yann Garcia committed
    "        if issubclass(SecurityInfo, 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",
Yann Garcia's avatar
Yann Garcia committed
    "        if not isinstance(other, SecurityInfo):\n",
    "            return False\n",
    "        return self.__dict__ == other.__dict__\n",
    "    def __ne__(self, other):\n",
    "        return not self == other\n",
    "\n",
Yann Garcia's avatar
Yann Garcia committed
    "class SecurityInfoOAuth2Info(object):\n",
    "    swagger_types = {'grant_types': 'list[str]','token_endpoint': 'str'}\n",
    "    attribute_map = {'grant_types': 'grantTypes','token_endpoint': 'tokenEndpoint'}\n",
    "    def __init__(self, grant_types=None, token_endpoint=None):  # noqa: E501\n",
    "        self._grant_types = None\n",
    "        self._token_endpoint = None\n",
    "        self.discriminator = None\n",
    "        self.grant_types = grant_types\n",
    "        self.token_endpoint = token_endpoint\n",
    "    @property\n",
Yann Garcia's avatar
Yann Garcia committed
    "    def grant_types(self):\n",
    "        return self._grant_types\n",
    "    @grant_types.setter\n",
    "    def grant_types(self, grant_types):\n",
    "        if grant_types is None:\n",
    "            raise ValueError(\"Invalid value for `grant_types`, must not be `None`\")  # noqa: E501\n",
    "        self._grant_types = grant_types\n",
    "    @property\n",
Yann Garcia's avatar
Yann Garcia committed
    "    def token_endpoint(self):\n",
    "        return self._token_endpoint\n",
    "    @token_endpoint.setter\n",
    "    def token_endpoint(self, token_endpoint):\n",
    "        if token_endpoint is None:\n",
    "            raise ValueError(\"Invalid value for `token_endpoint`, must not be `None`\")  # noqa: E501\n",
    "        self._token_endpoint = token_endpoint\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",
Yann Garcia's avatar
Yann Garcia committed
    "                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",
Yann Garcia's avatar
Yann Garcia committed
    "                    if hasattr(item[1], \"to_dict\") else item,\n",
    "                    value.items()\n",
    "                ))\n",
    "            else:\n",
    "                result[attr] = value\n",
Yann Garcia's avatar
Yann Garcia committed
    "        if issubclass(SecurityInfoOAuth2Info, 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",
Yann Garcia's avatar
Yann Garcia committed
    "        if not isinstance(other, SecurityInfoOAuth2Info):\n",
    "            return False\n",
    "        return self.__dict__ == other.__dict__\n",
    "    def __ne__(self, other):\n",
    "        return not self == other\n",
    "\n",
Yann Garcia's avatar
Yann Garcia committed
    "class OneOfTransportInfoEndpoint(object):\n",
    "    swagger_types = {}\n",
    "    attribute_map = {}\n",
    "    def __init__(self):  # noqa: E501\n",
    "        self.discriminator = None\n",
    "    @property\n",
Yann Garcia's avatar
Yann Garcia committed
    "    def uris(self):\n",
    "        return self._uris\n",
    "    @uris.setter\n",
    "    def uris(self, uris):\n",
    "        self._uris = uris\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",
Yann Garcia's avatar
Yann Garcia committed
    "                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",
Yann Garcia's avatar
Yann Garcia committed
    "                    if hasattr(item[1], \"to_dict\") else item,\n",
    "                    value.items()\n",
    "                ))\n",
    "            else:\n",
    "                result[attr] = value\n",
Yann Garcia's avatar
Yann Garcia committed
    "        if issubclass(OneOfappInstanceIdServicesBody, 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",
Yann Garcia's avatar
Yann Garcia committed
    "        if not isinstance(other, OneOfTransportInfoEndpoint):\n",
    "            return False\n",
    "        return self.__dict__ == other.__dict__\n",
    "    def __ne__(self, other):\n",
    "        return not self == other\n",
    "\n",
Yann Garcia's avatar
Yann Garcia committed
    "class EndPointInfoUris(object):\n",
    "    swagger_types = {'_uris': 'list[str]'}\n",
    "    attribute_map = {'_uris': 'uris'}\n",
    "    def __init__(self, uris:list):  # noqa: E501\n",
    "        self._uris = None\n",
    "        self.uris = uris\n",
    "    @property\n",
Yann Garcia's avatar
Yann Garcia committed
    "    def uris(self):\n",
    "        return self._uris\n",
    "    @uris.setter\n",
    "    def uris(self, uris):\n",
    "        self._uris = uris\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",
Yann Garcia's avatar
Yann Garcia committed
    "        if issubclass(EndPointInfoUris, 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",
Yann Garcia's avatar
Yann Garcia committed
    "        if not isinstance(other, EndPointInfoUris):\n",
    "            return False\n",
    "        return self.__dict__ == other.__dict__\n",
    "    def __ne__(self, other):\n",
    "        return not self == other\n",
    "\n",
Yann Garcia's avatar
Yann Garcia committed
    "class EndPointInfoFqdn(object):\n",
    "    swagger_types = {'_fqdn': 'list[str]'}\n",
    "    attribute_map = {'_fqdn': 'fqdn'}\n",
    "    def __init__(self, fqdn:list):  # noqa: E501\n",
    "        self._fqdn = None\n",
    "        self.fqdn = fqdn\n",
    "    @property\n",
Yann Garcia's avatar
Yann Garcia committed
    "    def fqdn(self):\n",
    "        return self._fqdn\n",
    "    @fqdn.setter\n",
    "    def fqdn(self, fqdn):\n",
    "        self._fqdn = fqdn\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",
Yann Garcia's avatar
Yann Garcia committed
    "        if issubclass(EndPointInfoFqdn, 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",
Yann Garcia's avatar
Yann Garcia committed
    "        if not isinstance(other, EndPointInfoFqdn):\n",
    "            return False\n",
    "        return self.__dict__ == other.__dict__\n",
    "    def __ne__(self, other):\n",
    "        return not self == other\n",
    "\n",
Yann Garcia's avatar
Yann Garcia committed
    "class EndPointInfoAddress(object):\n",
    "    swagger_types = {'_host': 'str', '_port': 'int'}\n",
    "    attribute_map = {'_host': 'host', '_port': 'port'}\n",
    "    def __init__(self, host:str, port:list):  # noqa: E501\n",
    "        self._host = None\n",
    "        self._port = None\n",
    "        self.host = host\n",
    "        self.port = port\n",
    "    @property\n",
Yann Garcia's avatar
Yann Garcia committed
    "    def host(self):\n",
    "        return self.host\n",
    "    @host.setter\n",
    "    def host(self, host):\n",
    "        self._host = host\n",
    "    @property\n",
Yann Garcia's avatar
Yann Garcia committed
    "    def port(self):\n",
    "        return self._port\n",
    "    @port.setter\n",
    "    def port(self, port):\n",
    "        self._port = qosport_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",