Commit cf3c819d authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

add Subscription cond

parent dae46503
......@@ -36,10 +36,10 @@ void from_json(const nlohmann::json &j, ServiceNameCond &o) {
j.at("serviceName").get_to(o.m_ServiceName);
}
ServiceName ServiceNameCond::getServiceName() const {
std::string ServiceNameCond::getServiceName() const {
return m_ServiceName;
}
void ServiceNameCond::setServiceName(ServiceName const &value) {
void ServiceNameCond::setServiceName(std::string const &value) {
m_ServiceName = value;
}
......
......@@ -41,13 +41,13 @@ class ServiceNameCond {
/// <summary>
///
/// </summary>
ServiceName getServiceName() const;
void setServiceName(ServiceName const &value);
std::string getServiceName() const;
void setServiceName(std::string const &value);
friend void to_json(nlohmann::json &j, const ServiceNameCond &o);
friend void from_json(const nlohmann::json &j, ServiceNameCond &o);
protected:
ServiceName m_ServiceName;
std::string m_ServiceName;
};
......
......@@ -47,9 +47,8 @@ void to_json(nlohmann::json &j, const SubscriptionData &o) {
j["nfStatusNotificationUri"] = o.m_NfStatusNotificationUri;
if (o.reqNfInstanceIdIsSet())
j["reqNfInstanceId"] = o.m_ReqNfInstanceId;
/* if(o.subscrCondIsSet())
if(o.subscrCondIsSet())
j["subscrCond"] = o.m_SubscrCond;
*/
j["subscriptionId"] = o.m_SubscriptionId;
if (o.validityTimeIsSet())
j["validityTime"] = o.m_ValidityTime;
......@@ -73,14 +72,13 @@ void from_json(const nlohmann::json &j, SubscriptionData &o) {
j.at("reqNfInstanceId").get_to(o.m_ReqNfInstanceId);
o.m_ReqNfInstanceIdIsSet = true;
}
/*
if(j.find("subscrCond") != j.end())
{
j.at("subscrCond").get_to(o.m_SubscrCond);
o.m_SubscrCondIsSet = true;
}
*/
// j.at("subscriptionId").get_to(o.m_SubscriptionId);
// j.at("subscriptionId").get_to(o.m_SubscriptionId);
if (j.find("subscriptionId") != j.end()) {
j.at("subscriptionId").get_to(o.m_SubscriptionId);
......@@ -135,19 +133,19 @@ bool SubscriptionData::reqNfInstanceIdIsSet() const {
void SubscriptionData::unsetReqNfInstanceId() {
m_ReqNfInstanceIdIsSet = false;
}
/*
m_SubscrCond SubscriptionData::getSubscrCond() const
subscription_condition_api_t SubscriptionData::getSubscrCond() const
{
return m_SubscrCond;
return m_SubscrCond;
}
*/
/*
void SubscriptionData::setSubscrCond(m_SubscrCond const& value)
void SubscriptionData::setSubscrCond(subscription_condition_api_t const& value)
{
m_SubscrCond = value;
m_SubscrCondIsSet = true;
m_SubscrCond = value;
m_SubscrCondIsSet = true;
}
*/
bool SubscriptionData::subscrCondIsSet() const {
return m_SubscrCondIsSet;
......
/**
* NRF NFManagement Service
* NRF NFManagement Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
* NRF NFManagement Service. © 2019, 3GPP Organizational Partners (ARIB, ATIS,
* CCSA, ETSI, TSDSI, TTA, TTC). All rights reserved.
*
* The version of the OpenAPI document: 1.1.0.alpha-1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*
* NOTE: This class is auto generated by OpenAPI Generator
* (https://openapi-generator.tech). https://openapi-generator.tech Do not edit
* the class manually.
*/
/*
* SubscriptionData.h
*
*
*
*/
#ifndef SubscriptionData_H_
#define SubscriptionData_H_
//#include "OneOfNfInstanceIdCondNfTypeCondServiceNameCondAmfCondGuamiListCondNetworkSliceCondNfGroupCond.h"
//#include
//"OneOfNfInstanceIdCondNfTypeCondServiceNameCondAmfCondGuamiListCondNetworkSliceCondNfGroupCond.h"
#include <nlohmann/json.hpp>
#include <string>
#include <vector>
#include "NotifCondition.h"
#include "NotificationEventType.h"
#include "PlmnId.h"
#include "Snssai.h"
#include <vector>
#include "NotifCondition.h"
#include <nlohmann/json.hpp>
#include "NfInstanceIdCond.h"
#include "NfTypeCond.h"
#include "ServiceNameCond.h"
#include "AmfCond.h"
#include "GuamiListCond.h"
#include "NetworkSliceCond.h"
#include "NfGroupCond.h"
#include "NfInstanceIdCond.h"
#include "NfTypeCond.h"
#include "ServiceNameCond.h"
namespace oai {
namespace nrf {
namespace model {
typedef struct subscription_condition_s {
typedef struct subscription_condition_api_s {
uint8_t type;
union {
NfInstanceIdCond nfInstanceIdCond;
......@@ -51,32 +53,126 @@ typedef struct subscription_condition_s {
NfGroupCond nfGroupCond;
};
subscription_condition_s()
:
type(0) {
subscription_condition_api_s() : type(0) {
nfInstanceIdCond = {};
nfTypeCond = {};
serviceNameCond = {};
amfCond = {};
guamiListCond = {};
networkSliceCond = {};
nfGroupCond = {};
}
subscription_condition_s(uint8_t t)
:
type(t) {
subscription_condition_api_s(subscription_condition_api_s const &s) {
nfInstanceIdCond = s.nfInstanceIdCond;
// nfInstanceIdCond.setNfInstanceId(s.nfInstanceIdCond.getNfInstanceId());
nfTypeCond = s.nfTypeCond;
serviceNameCond = s.serviceNameCond;
amfCond = s.amfCond;
guamiListCond = s.guamiListCond;
networkSliceCond = s.networkSliceCond;
nfGroupCond = s.nfGroupCond;
}
bool operator==(const struct subscription_condition_s &s) const {
subscription_condition_api_s(uint8_t t) : type(t) {
nfInstanceIdCond = {};
nfTypeCond = {};
serviceNameCond = {};
amfCond = {};
guamiListCond = {};
networkSliceCond = {};
nfGroupCond = {};
}
bool operator==(const struct subscription_condition_api_s &s) const {
return (s.type == type);
}
//------------------------------------------------------------------------------
bool operator==(const uint8_t &t) const {
return (t == type);
bool operator==(const uint8_t &t) const { return (t == type); }
subscription_condition_api_s &operator=(subscription_condition_api_s s) {
nfInstanceIdCond = s.nfInstanceIdCond;
// nfInstanceIdCond.setNfInstanceId(s.nfInstanceIdCond.getNfInstanceId());
nfTypeCond = s.nfTypeCond;
serviceNameCond = s.serviceNameCond;
amfCond = s.amfCond;
guamiListCond = s.guamiListCond;
networkSliceCond = s.networkSliceCond;
nfGroupCond = s.nfGroupCond;
return *this;
}
virtual ~subscription_condition_s() {
friend void to_json(nlohmann::json &j,
const subscription_condition_api_s &o) {
switch (o.type) {
case 1:
j["NfInstanceIdCond"] = o.nfInstanceIdCond;
break;
case 2:
j["NfTypeCond"] = o.nfTypeCond;
break;
case 3:
j["ServiceNameCond"] = o.serviceNameCond;
break;
case 4:
j["AmfCond"] = o.amfCond;
break;
case 5:
j["GuamiListCond"] = o.guamiListCond;
break;
case 6:
j["NetworkSliceCond"] = o.networkSliceCond;
break;
case 7:
j["NfGroupCond"] = o.nfGroupCond;
break;
default: {}
}
}
;
} subscription_condition_t;
friend void from_json(const nlohmann::json &j,
subscription_condition_api_s &o) {
if (j.find("NfInstanceIdCond") != j.end()) {
j.at("NfInstanceIdCond").get_to(o.nfInstanceIdCond);
o.type = 1;
}
if (j.find("NfTypeCond") != j.end()) {
j.at("NfTypeCond").get_to(o.nfTypeCond);
o.type = 2;
}
if (j.find("ServiceNameCond") != j.end()) {
j.at("ServiceNameCond").get_to(o.serviceNameCond);
o.type = 3;
}
if (j.find("AmfCond") != j.end()) {
j.at("AmfCond").get_to(o.amfCond);
o.type = 4;
}
if (j.find("GuamiListCond") != j.end()) {
j.at("GuamiListCond").get_to(o.guamiListCond);
o.type = 5;
}
if (j.find("NetworkSliceCond") != j.end()) {
j.at("NetworkSliceCond").get_to(o.networkSliceCond);
o.type = 6;
}
if (j.find("NfGroupCond") != j.end()) {
j.at("NfGroupCond").get_to(o.nfGroupCond);
o.type = 7;
}
}
virtual ~subscription_condition_api_s(){};
} subscription_condition_api_t;
/// <summary>
///
///
/// </summary>
class SubscriptionData {
public:
......@@ -89,91 +185,94 @@ class SubscriptionData {
/// SubscriptionData members
/// <summary>
///
///
/// </summary>
std::string getNfStatusNotificationUri() const;
void setNfStatusNotificationUri(std::string const &value);
/// <summary>
///
///
/// </summary>
std::string getReqNfInstanceId() const;
void setReqNfInstanceId(std::string const &value);
bool reqNfInstanceIdIsSet() const;
void unsetReqNfInstanceId();
/// <summary>
///
///
/// </summary>
//OneOfNfInstanceIdCondNfTypeCondServiceNameCondAmfCondGuamiListCondNetworkSliceCondNfGroupCond getSubscrCond() const;
subscription_condition_t getSubscrCond() const;
// OneOfNfInstanceIdCondNfTypeCondServiceNameCondAmfCondGuamiListCondNetworkSliceCondNfGroupCond
// getSubscrCond() const;
subscription_condition_api_t getSubscrCond() const;
void setSubscrCond(subscription_condition_t const &value);
void setSubscrCond(subscription_condition_api_t const &value);
bool subscrCondIsSet() const;
void unsetSubscrCond();
/// <summary>
///
///
/// </summary>
std::string getSubscriptionId() const;
void setSubscriptionId(std::string const &value);
/// <summary>
///
///
/// </summary>
std::string getValidityTime() const;
void setValidityTime(std::string const &value);
bool validityTimeIsSet() const;
void unsetValidityTime();
/// <summary>
///
///
/// </summary>
std::vector<NotificationEventType>& getReqNotifEvents();
std::vector<NotificationEventType> &getReqNotifEvents();
void setReqNotifEvents(std::vector<NotificationEventType> const &value);
bool reqNotifEventsIsSet() const;
void unsetReqNotifEvents();
/// <summary>
///
///
/// </summary>
PlmnId getPlmnId() const;
void setPlmnId(PlmnId const &value);
bool plmnIdIsSet() const;
void unsetPlmnId();
/// <summary>
///
///
/// </summary>
NotifCondition getNotifCondition() const;
void setNotifCondition(NotifCondition const &value);
bool notifConditionIsSet() const;
void unsetNotifCondition();
/// <summary>
///
///
/// </summary>
std::string getReqNfType() const;
void setReqNfType(std::string const &value);
bool reqNfTypeIsSet() const;
void unsetReqNfType();
/// <summary>
///
///
/// </summary>
std::string getReqNfFqdn() const;
void setReqNfFqdn(std::string const &value);
bool reqNfFqdnIsSet() const;
void unsetReqNfFqdn();
/// <summary>
///
///
/// </summary>
std::vector<Snssai>& getReqSnssais();
std::vector<Snssai> &getReqSnssais();
void setReqSnssais(std::vector<Snssai> const &value);
bool reqSnssaisIsSet() const;
void unsetReqSnssais();
friend void to_json(nlohmann::json &j, const SubscriptionData &o);
friend void from_json(const nlohmann::json &j, SubscriptionData &o);
protected:
std::string m_NfStatusNotificationUri;
std::string m_ReqNfInstanceId;
bool m_ReqNfInstanceIdIsSet;
//OneOfNfInstanceIdCondNfTypeCondServiceNameCondAmfCondGuamiListCondNetworkSliceCondNfGroupCond m_SubscrCond;
subscription_condition_t m_SubscrCond;
// OneOfNfInstanceIdCondNfTypeCondServiceNameCondAmfCondGuamiListCondNetworkSliceCondNfGroupCond
// m_SubscrCond;
subscription_condition_api_t m_SubscrCond;
bool m_SubscrCondIsSet;
std::string m_SubscriptionId;
......@@ -193,8 +292,8 @@ class SubscriptionData {
bool m_ReqSnssaisIsSet;
};
}
}
}
} // namespace model
} // namespace nrf
} // namespace oai
#endif /* SubscriptionData_H_ */
......@@ -39,6 +39,36 @@ typedef struct plmn_s {
uint8_t mnc_digit1 :4;
} plmn_t;
*/
typedef struct s_nssai // section 28.4, TS23.003
{
uint8_t sST;
//uint32_t sD:24;
std::string sD;
//s_nssai(const uint8_t& sst, const uint32_t sd) : sST(sst), sD(sd) {}
s_nssai(const uint8_t &sst, const std::string sd)
:
sST(sst),
sD(sd) {
}
s_nssai()
:
sST(),
sD() {
}
s_nssai(const s_nssai &p)
:
sST(p.sST),
sD(p.sD) {
}
bool operator==(const struct s_nssai &s) const {
if ((s.sST == this->sST) && (s.sD.compare(this->sD) == 0)) {
return true;
} else {
return false;
}
}
} snssai_t;
typedef struct plmn_s {
std::string mcc;
......@@ -121,4 +151,10 @@ typedef struct allowed_nssai_s /*5G ADD it*/
uint32_t count;
} allowed_nssai_t;
typedef struct guami_s {
plmn_t plmn;
std::string amf_id;
} guami_t;
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
*file except in compliance with the License. You may obtain a copy of the
*License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -22,12 +22,64 @@
#ifndef FILE_3GPP_29_510_NRF_SEEN
#define FILE_3GPP_29_510_NRF_SEEN
enum class nf_status_e {
REGISTERED = 0,
SUSPENDED = 1,
UNDISCOVERABLE = 2
#include "3gpp_23.003.h"
enum class nf_status_e { REGISTERED = 0, SUSPENDED = 1, UNDISCOVERABLE = 2 };
static const std::vector<std::string> nf_status_e2str = {
"REGISTERED", "SUSPENDED", "UNDISCOVERABLE"};
enum subscription_condition_type {
UNKNOWN_CONDITION = 0,
NF_INSTANCE_ID_COND = 1,
NF_TYPE_COND = 2,
SERVICE_NAME_COND = 3,
AMF_COND = 4,
GUAMI_LIST_COND = 5,
NETWOTK_SLICE_COND = 6,
NF_GROUP_COND = 7
};
static const std::vector<std::string> nf_status_e2str = { "REGISTERED",
"SUSPENDED", "UNDISCOVERABLE" };
typedef struct amf_cond_s {
std::string amf_set_id;
std::string amf_region_id;
} amf_cond_t;
typedef struct network_slice_cond_s {
std::vector<snssai_t> snssai_list;
std::vector<std::string> nsi_list;
} network_slice_cond_t;
typedef struct nf_group_cond_s {
std::string nf_type;
std::string nf_group_id;
} nf_group_cond_t;
typedef struct subscription_condition_s {
uint8_t type;
union {
std::string nf_instance_id;
std::string nf_type;
std::string service_name;
amf_cond_t amf_info;
std::vector<guami_t> guami_list;
network_slice_cond_t network_slice;
nf_group_cond_t nf_group;
};
subscription_condition_s() : type(0) {}
subscription_condition_s(uint8_t t) : type(t) {}
bool operator==(const struct subscription_condition_s &s) const {
return (s.type == type);
}
bool operator==(const uint8_t &t) const { return (t == type); }
virtual ~subscription_condition_s(){};
} subscription_condition_t;
#endif
......@@ -70,42 +70,6 @@ typedef enum patch_op_type_s {
static const std::vector<std::string> patch_op_type_e2str = { "ADD", "REMOVE",
"REPLACE", "MOVE", "COPY", "TEST", "UNKNOWN" };
typedef struct s_nssai // section 28.4, TS23.003
{
uint8_t sST;
//uint32_t sD:24;
std::string sD;
//s_nssai(const uint8_t& sst, const uint32_t sd) : sST(sst), sD(sd) {}
s_nssai(const uint8_t &sst, const std::string sd)
:
sST(sst),
sD(sd) {
}
s_nssai()
:
sST(),
sD() {
}
s_nssai(const s_nssai &p)
:
sST(p.sST),
sD(p.sD) {
}
bool operator==(const struct s_nssai &s) const {
if ((s.sST == this->sST) && (s.sD.compare(this->sD) == 0)) {
return true;
} else {
return false;
}
}
} snssai_t;
typedef struct guami_s {
plmn_t plmn;
std::string amf_id;
} guami_t;
typedef struct amf_info_s {
std::string amf_set_id;
std::string amf_region_id;
......@@ -126,7 +90,6 @@ typedef struct smf_info_s {
std::vector<snssai_smf_info_item_t> snssai_smf_info_list;
} smf_info_t;
// Event Subscription IDs)
typedef uint32_t evsub_id_t;
#define EVSUB_ID_FMT "0x%" PRIx32
......
......@@ -37,6 +37,7 @@
#include <boost/algorithm/string/split.hpp>
#include <regex>
#include "3gpp_29.510.h"
#include "AmfInfo.h"
#include "api_conversions.hpp"
#include "logger.hpp"
......@@ -167,7 +168,51 @@ bool api_conv::subscription_api_to_nrf_subscription(
Logger::nrf_app().debug(
"Convert a json-type Subscription data a NRF subscription data");
sub.get()->set_notification_uri(api_sub.getNfStatusNotificationUri());
//TODO:
subscription_condition_t sub_condition = {};
if (api_sub.subscrCondIsSet()) {
subscription_condition_api_t sub_condition_api = api_sub.getSubscrCond();
switch (sub_condition_api.type) {
case NF_INSTANCE_ID_COND: {
sub_condition.type = NF_INSTANCE_ID_COND;
sub_condition.nf_instance_id =
sub_condition_api.nfInstanceIdCond.getNfInstanceId();
} break;
case NF_TYPE_COND: {
sub_condition.type = NF_TYPE_COND;
sub_condition.nf_type = sub_condition_api.nfTypeCond.getNfType();
} break;
case SERVICE_NAME_COND: {
sub_condition.type = SERVICE_NAME_COND;
sub_condition.service_name =
sub_condition_api.serviceNameCond.getServiceName();
} break;
case AMF_COND: {
sub_condition.type = AMF_COND;
sub_condition.amf_info.amf_set_id =
sub_condition_api.amfCond.getAmfSetId();
sub_condition.amf_info.amf_region_id =
sub_condition_api.amfCond.getAmfRegionId();
} break;
case GUAMI_LIST_COND: {
sub_condition.type = GUAMI_LIST_COND;
// TODO:
} break;
case NETWOTK_SLICE_COND: {
sub_condition.type = NETWOTK_SLICE_COND;
// TODO:
} break;
case NF_GROUP_COND: {
sub_condition.type = NF_GROUP_COND;
// TODO:
} break;
default: {
return false;
}
}
}
// TODO:
return true;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment