From 4b41b857773f48b83549a7234f23a7ec268306de Mon Sep 17 00:00:00 2001 From: Yann Garcia Date: Tue, 16 Jun 2020 07:33:42 +0200 Subject: [PATCH] Big fixed on MEC-011 --- ccsrc/Protocols/Json/json_codec.cc | 12 ++++++-- .../ttcn/AppEnablementAPI_Templates.ttcn | 16 ++++------- .../ttcn/AppEnablementAPI_TypesAndValues.ttcn | 28 +++++++++---------- 3 files changed, 30 insertions(+), 26 deletions(-) diff --git a/ccsrc/Protocols/Json/json_codec.cc b/ccsrc/Protocols/Json/json_codec.cc index 96122b7..3805491 100644 --- a/ccsrc/Protocols/Json/json_codec.cc +++ b/ccsrc/Protocols/Json/json_codec.cc @@ -159,8 +159,8 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy service_info.decode(AppEnablementAPI__TypesAndValues::ServiceInfo_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); msg.serviceInfo() = service_info; } - } else if (it->second.find("\"transportInfoList\"") != std::string::npos) { // Be careful to the order - // TODO To be refined, find("\"accessPointList\"") is not optimal + } else if (it->second.find("\"security\"") != std::string::npos) { // Be careful to the order + // TODO To be refined, find("\"accessPointList\"") is not optimal AppEnablementAPI__TypesAndValues::TransportInfoList transport_info_list; transport_info_list.decode(AppEnablementAPI__TypesAndValues::TransportInfoList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); msg.transportInfoList() = transport_info_list; @@ -188,6 +188,10 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy AppEnablementAPI__TypesAndValues::AppTerminationNotificationSubscription app_term; app_term.decode(AppEnablementAPI__TypesAndValues::AppTerminationNotificationSubscription_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); msg.appTerminationNotificationSubscription() = app_term; + } else if ((it->second.find("\"_links\"") != std::string::npos) && (it->second.find("\"subscriptions\"") != std::string::npos)) { + AppEnablementAPI__TypesAndValues::SubscriptionLinkList sub_link_list; + sub_link_list.decode(AppEnablementAPI__TypesAndValues::SubscriptionLinkList_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); + msg.subscriptionLinkList__app__ens() = sub_link_list; } else if (it->second.find("\"subscriptionType\"") != std::string::npos) { AppEnablementAPI__TypesAndValues::SerAvailabilityNotificationSubscription ser_av; ser_av.decode(AppEnablementAPI__TypesAndValues::SerAvailabilityNotificationSubscription_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); @@ -196,6 +200,10 @@ int json_codec::decode (const OCTETSTRING& p_data, LibItsHttp__JsonMessageBodyTy AppEnablementAPI__TypesAndValues::TimingCaps timing_caps; timing_caps.decode(AppEnablementAPI__TypesAndValues::TimingCaps_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); msg.timingCaps() = timing_caps; + } else if (it->second.find("\"timeSourceStatus\"") != std::string::npos) { + AppEnablementAPI__TypesAndValues::CurrentTime current_time; + current_time.decode(AppEnablementAPI__TypesAndValues::CurrentTime_descr_, decoding_buffer, TTCN_EncDec::CT_JSON); + msg.currentTime() = current_time; } else if (it->second.find("\"CellChangeSubscription\"") != std::string::npos) { // // Replace "type": "1" by type": "EU_IPV4_ADDRESS", "type": "2"... // // TODO Create a method instead of copy/past diff --git a/ttcn/LibMec/AppEna/ttcn/AppEnablementAPI_Templates.ttcn b/ttcn/LibMec/AppEna/ttcn/AppEnablementAPI_Templates.ttcn index 2a9e9fb..eb0d0f1 100644 --- a/ttcn/LibMec/AppEna/ttcn/AppEnablementAPI_Templates.ttcn +++ b/ttcn/LibMec/AppEna/ttcn/AppEnablementAPI_Templates.ttcn @@ -92,20 +92,16 @@ module AppEnablementAPI_Templates { isLocal := * } // End of template mw_service_info - template (omit) SubscriptionLinkList m_subscription_link_list( - in template (value) Links p_links, - in template (omit) Subscriptions p_subscription := omit + template (value) SubscriptionLinkList m_subscription_link_list( + in template (value) Links p_links ) := { - links := p_links, - subscription := p_subscription + links := p_links } // End of template m_subscription_link_list - template SubscriptionLinkList mw_subscription_link_list( - template (present) Links p_links := ?, - template Subscriptions p_subscription := * + template (present) SubscriptionLinkList mw_subscription_link_list( + template (present) Links p_links := ? ) := { - links := p_links, - subscription := p_subscription + links := p_links } // End of template mw_subscription_link_list template (value) Self m_self( diff --git a/ttcn/LibMec/AppEna/ttcn/AppEnablementAPI_TypesAndValues.ttcn b/ttcn/LibMec/AppEna/ttcn/AppEnablementAPI_TypesAndValues.ttcn index da66f8e..79a7b88 100644 --- a/ttcn/LibMec/AppEna/ttcn/AppEnablementAPI_TypesAndValues.ttcn +++ b/ttcn/LibMec/AppEna/ttcn/AppEnablementAPI_TypesAndValues.ttcn @@ -70,7 +70,7 @@ module AppEnablementAPI_TypesAndValues { type JSON.String CategoryRef_Id; /** -SerAvailabilityNotificationSubscription * @desc Name of the category. + * @desc Name of the category. */ type JSON.String Name; @@ -291,7 +291,8 @@ SerAvailabilityNotificationSubscription * @desc Name of the category. } type record Links { - LinkType self_ + LinkType self_, + Subscriptions subscriptions } with { variant (self_) "name as 'self'"; } @@ -300,16 +301,15 @@ SerAvailabilityNotificationSubscription * @desc Name of the category. * @desc This type represents a list of links related to currently existing subscriptions for a MEC application instance. */ type record SubscriptionLinkList { - Links links, - Subscriptions subscription optional + Links links } with { variant (links) "name as '_links'"; } /** - * @desc A link to a subscription - * @member - * @member + * @desc The MEC application instance's subscriptions + * @member href URI referring to the subscription + * @member subscriptionType Type of the subscription */ type record Subscription_ { JSON.AnyURI href, @@ -548,7 +548,6 @@ SerAvailabilityNotificationSubscription * @desc Name of the category. * @desc Time. * @member seconds The seconds part of the time. Time is defined as Unix-time since January 1, 1970, 00:00:00 UTC. * @member nanoSeconds The nanoseconds part of the time. Time is defined as Unix-time since January 1, 1970, 00:00:00 UTC. - * @member timeSourceStatus Platform Time Source status. 1 = TRACEABLE - time source is locked to the UTC time source. 2 = NONTRACEABLE - time source is not locked to the UTC time source. */ type record TimeStamp { Seconds seconds, @@ -579,6 +578,7 @@ SerAvailabilityNotificationSubscription * @desc Name of the category. * @desc Identify the traffic ip address. */ type JSON.String TrafficFilter_Port; + type record length(0..infinity) of TrafficFilter_Port TrafficFilter_PortList; /** * @desc Protocol of the traffic filter. @@ -618,19 +618,19 @@ SerAvailabilityNotificationSubscription * @desc Name of the category. * @desc This type represents the traffic filter. */ type record TrafficFilter { - TrafficFilter_Address srcAddress, + TrafficFilter_AddressList srcAddress, TrafficFilter_AddressList dstAddress, - TrafficFilter_Port srcPort, - TrafficFilter_Port dstPort, + TrafficFilter_PortList srcPort, + TrafficFilter_PortList dstPort, TrafficFilter_ProtocolList protocol, TrafficFilter_TokenList token, TrafficFilter_TunnelAddressList srcTunnelAddress, TrafficFilter_TunnelAddressList tgtTunnelAddress, TrafficFilter_TunnelPortList srcTunnelPort, TrafficFilter_TunnelPortList dstTunnelPort, - TrafficFilter_QCI qCI, - TrafficFilter_DSCP dSCP, - TrafficFilter_TC tC + TrafficFilter_QCI qCI optional, + TrafficFilter_DSCP dSCP optional, + TrafficFilter_TC tC optional } type record of TrafficFilter TrafficFilterList; -- GitLab