Commit f1068f14 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen
Browse files

Get API version from configuration file

parent bcec69f5
......@@ -35,6 +35,9 @@
#include "Helpers.h"
#include "logger.hpp"
#include "udr_config.hpp"
extern oai::udr::config::udr_config udr_cfg;
namespace oai::udr::api {
......@@ -52,17 +55,23 @@ void AMF3GPPAccessRegistrationDocumentApi::setupRoutes() {
using namespace Pistache::Rest;
Routes::Patch(
*router, base + "/subscription-data/:ueId/context-data/amf-3gpp-access",
*router,
base + udr_cfg.nudr.api_version +
"/subscription-data/:ueId/context-data/amf-3gpp-access",
Routes::bind(
&AMF3GPPAccessRegistrationDocumentApi::amf_context3gpp_handler,
this));
Routes::Put(
*router, base + "/subscription-data/:ueId/context-data/amf-3gpp-access",
*router,
base + udr_cfg.nudr.api_version +
"/subscription-data/:ueId/context-data/amf-3gpp-access",
Routes::bind(
&AMF3GPPAccessRegistrationDocumentApi::create_amf_context3gpp_handler,
this));
Routes::Get(
*router, base + "/subscription-data/:ueId/context-data/amf-3gpp-access",
*router,
base + udr_cfg.nudr.api_version +
"/subscription-data/:ueId/context-data/amf-3gpp-access",
Routes::bind(
&AMF3GPPAccessRegistrationDocumentApi::query_amf_context3gpp_handler,
this));
......@@ -186,4 +195,4 @@ void AMF3GPPAccessRegistrationDocumentApi::
"The requested method does not exist");
}
} // namespace oai::udr::api
} // namespace oai::udr::api
......@@ -57,14 +57,14 @@ namespace oai::udr::api {
using namespace oai::udr::model;
class AMF3GPPAccessRegistrationDocumentApi {
public:
public:
AMF3GPPAccessRegistrationDocumentApi(std::shared_ptr<Pistache::Rest::Router>);
virtual ~AMF3GPPAccessRegistrationDocumentApi() {}
void init();
const std::string base = "/nudr-dr/v2";
private:
private:
void setupRoutes();
void amf_context3gpp_handler(const Pistache::Rest::Request &request,
......@@ -89,11 +89,10 @@ private:
/// <param name="patchItem"></param>
/// <param name="supportedFeatures">Features required to be supported by the
/// target NF (optional, default to &quot;&quot;)</param>
virtual void
amf_context3gpp(const std::string &ueId,
const std::vector<PatchItem> &patchItem,
const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response) = 0;
virtual void amf_context3gpp(
const std::string &ueId, const std::vector<PatchItem> &patchItem,
const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// To store the AMF context data of a UE using 3gpp access in the UDR
......@@ -103,10 +102,10 @@ private:
/// </remarks>
/// <param name="ueId">UE id</param>
/// <param name="amf3GppAccessRegistration"> (optional)</param>
virtual void
create_amf_context3gpp(const std::string &ueId,
Amf3GppAccessRegistration &amf3GppAccessRegistration,
Pistache::Http::ResponseWriter &response) = 0;
virtual void create_amf_context3gpp(
const std::string &ueId,
Amf3GppAccessRegistration &amf3GppAccessRegistration,
Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Retrieves the AMF context data of a UE using 3gpp access
......@@ -126,6 +125,6 @@ private:
Pistache::Http::ResponseWriter &response) = 0;
};
} // namespace oai::udr::api
} // namespace oai::udr::api
#endif /* AMF3GPPAccessRegistrationDocumentApi_H_ */
......@@ -34,6 +34,9 @@
#include "AMFNon3GPPAccessRegistrationDocumentApi.h"
#include "Helpers.h"
#include "udr_config.hpp"
extern oai::udr::config::udr_config udr_cfg;
namespace oai::udr::api {
......@@ -53,18 +56,19 @@ void AMFNon3GPPAccessRegistrationDocumentApi::setupRoutes() {
Routes::Patch(
*router,
base + "/subscription-data/:ueId/context-data/amf-non-3gpp-access",
base + udr_cfg.nudr.api_version +
"/subscription-data/:ueId/context-data/amf-non-3gpp-access",
Routes::bind(
&AMFNon3GPPAccessRegistrationDocumentApi::amf_context_non3gpp_handler,
this));
Routes::Put(*router,
base +
base + udr_cfg.nudr.api_version +
"/subscription-data/:ueId/context-data/amf-non-3gpp-access",
Routes::bind(&AMFNon3GPPAccessRegistrationDocumentApi::
create_amf_context_non3gpp_handler,
this));
Routes::Get(*router,
base +
base + udr_cfg.nudr.api_version +
"/subscription-data/:ueId/context-data/amf-non-3gpp-access",
Routes::bind(&AMFNon3GPPAccessRegistrationDocumentApi::
query_amf_context_non3gpp_handler,
......@@ -188,4 +192,4 @@ void AMFNon3GPPAccessRegistrationDocumentApi::
"The requested method does not exist");
}
} // namespace oai::udr::api
} // namespace oai::udr::api
......@@ -58,7 +58,7 @@ namespace oai::udr::api {
using namespace oai::udr::model;
class AMFNon3GPPAccessRegistrationDocumentApi {
public:
public:
AMFNon3GPPAccessRegistrationDocumentApi(
std::shared_ptr<Pistache::Rest::Router>);
virtual ~AMFNon3GPPAccessRegistrationDocumentApi() {}
......@@ -66,17 +66,17 @@ public:
const std::string base = "/nudr-dr/v2";
private:
private:
void setupRoutes();
void amf_context_non3gpp_handler(const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response);
void
create_amf_context_non3gpp_handler(const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response);
void
query_amf_context_non3gpp_handler(const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response);
void create_amf_context_non3gpp_handler(
const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response);
void query_amf_context_non3gpp_handler(
const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response);
void amf_non3_gpp_access_registration_document_api_default_handler(
const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response);
......@@ -93,11 +93,10 @@ private:
/// <param name="patchItem"></param>
/// <param name="supportedFeatures">Features required to be supported by the
/// target NF (optional, default to &quot;&quot;)</param>
virtual void
amf_context_non3gpp(const std::string &ueId,
const std::vector<PatchItem> &patchItem,
const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response) = 0;
virtual void amf_context_non3gpp(
const std::string &ueId, const std::vector<PatchItem> &patchItem,
const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// To store the AMF context data of a UE using non-3gpp access in the UDR
......@@ -130,6 +129,6 @@ private:
Pistache::Http::ResponseWriter &response) = 0;
};
} // namespace oai::udr::api
} // namespace oai::udr::api
#endif /* AMFNon3GPPAccessRegistrationDocumentApi_H_ */
......@@ -34,6 +34,9 @@
#include "AccessAndMobilityDataApi.h"
#include "Helpers.h"
#include "udr_config.hpp"
extern oai::udr::config::udr_config udr_cfg;
namespace oai::udr::api {
......@@ -51,22 +54,30 @@ void AccessAndMobilityDataApi::setupRoutes() {
using namespace Pistache::Rest;
Routes::Put(
*router, base + "/exposure-data/:ueId/access-and-mobility-data",
*router,
base + udr_cfg.nudr.api_version +
"/exposure-data/:ueId/access-and-mobility-data",
Routes::bind(&AccessAndMobilityDataApi::
create_or_replace_access_and_mobility_data_handler,
this));
Routes::Delete(
*router, base + "/exposure-data/:ueId/access-and-mobility-data",
*router,
base + udr_cfg.nudr.api_version +
"/exposure-data/:ueId/access-and-mobility-data",
Routes::bind(
&AccessAndMobilityDataApi::delete_access_and_mobility_data_handler,
this));
Routes::Get(
*router, base + "/exposure-data/:ueId/access-and-mobility-data",
*router,
base + udr_cfg.nudr.api_version +
"/exposure-data/:ueId/access-and-mobility-data",
Routes::bind(
&AccessAndMobilityDataApi::query_access_and_mobility_data_handler,
this));
Routes::Patch(
*router, base + "/exposure-data/:ueId/access-and-mobility-data",
*router,
base + udr_cfg.nudr.api_version +
"/exposure-data/:ueId/access-and-mobility-data",
Routes::bind(
&AccessAndMobilityDataApi::update_access_and_mobility_data_handler,
this));
......@@ -191,4 +202,4 @@ void AccessAndMobilityDataApi::access_and_mobility_data_api_default_handler(
"The requested method does not exist");
}
} // namespace oai::udr::api
} // namespace oai::udr::api
......@@ -54,14 +54,14 @@ namespace oai::udr::api {
using namespace oai::udr::model;
class AccessAndMobilityDataApi {
public:
public:
AccessAndMobilityDataApi(std::shared_ptr<Pistache::Rest::Router>);
virtual ~AccessAndMobilityDataApi() {}
void init();
const std::string base = "/nudr-dr/v2";
const std::string base = "/nudr-dr/";
private:
private:
void setupRoutes();
void create_or_replace_access_and_mobility_data_handler(
......@@ -102,9 +102,8 @@ private:
///
/// </remarks>
/// <param name="ueId">UE id</param>
virtual void
delete_access_and_mobility_data(const std::string &ueId,
Pistache::Http::ResponseWriter &response) = 0;
virtual void delete_access_and_mobility_data(
const std::string &ueId, Pistache::Http::ResponseWriter &response) = 0;
/// <summary>
/// Retrieves the access and mobility exposure data for a UE
......@@ -133,6 +132,6 @@ private:
Pistache::Http::ResponseWriter &response) = 0;
};
} // namespace oai::udr::api
} // namespace oai::udr::api
#endif /* AccessAndMobilityDataApi_H_ */
......@@ -34,6 +34,9 @@
#include "AccessAndMobilityPolicyDataDocumentApi.h"
#include "Helpers.h"
#include "udr_config.hpp"
extern oai::udr::config::udr_config udr_cfg;
namespace oai::udr::api {
......@@ -50,10 +53,12 @@ void AccessAndMobilityPolicyDataDocumentApi::init() { setupRoutes(); }
void AccessAndMobilityPolicyDataDocumentApi::setupRoutes() {
using namespace Pistache::Rest;
Routes::Get(*router, base + "/policy-data/ues/:ueId/am-data",
Routes::bind(&AccessAndMobilityPolicyDataDocumentApi::
read_access_and_mobility_policy_data_handler,
this));
Routes::Get(
*router,
base + udr_cfg.nudr.api_version + "/policy-data/ues/:ueId/am-data",
Routes::bind(&AccessAndMobilityPolicyDataDocumentApi::
read_access_and_mobility_policy_data_handler,
this));
// Default handler, called when a route is not found
router->addCustomHandler(Routes::bind(
......@@ -93,4 +98,4 @@ void AccessAndMobilityPolicyDataDocumentApi::
"The requested method does not exist");
}
} // namespace oai::udr::api
} // namespace oai::udr::api
......@@ -54,7 +54,7 @@ namespace oai::udr::api {
using namespace oai::udr::model;
class AccessAndMobilityPolicyDataDocumentApi {
public:
public:
AccessAndMobilityPolicyDataDocumentApi(
std::shared_ptr<Pistache::Rest::Router>);
virtual ~AccessAndMobilityPolicyDataDocumentApi() {}
......@@ -62,7 +62,7 @@ public:
const std::string base = "/nudr-dr/v2";
private:
private:
void setupRoutes();
void read_access_and_mobility_policy_data_handler(
......@@ -85,6 +85,6 @@ private:
const std::string &ueId, Pistache::Http::ResponseWriter &response) = 0;
};
} // namespace oai::udr::api
} // namespace oai::udr::api
#endif /* AccessAndMobilityPolicyDataDocumentApi_H_ */
......@@ -35,6 +35,9 @@
#include "Helpers.h"
#include "logger.hpp"
#include "udr_config.hpp"
extern oai::udr::config::udr_config udr_cfg;
namespace oai::udr::api {
......@@ -54,7 +57,8 @@ void AccessAndMobilitySubscriptionDataDocumentApi::setupRoutes() {
Routes::Get(
*router,
base + "/subscription-data/:ueId/:servingPlmnId/provisioned-data/am-data",
base + udr_cfg.nudr.api_version +
"/subscription-data/:ueId/:servingPlmnId/provisioned-data/am-data",
Routes::bind(
&AccessAndMobilitySubscriptionDataDocumentApi::query_am_data_handler,
this));
......@@ -121,4 +125,4 @@ void AccessAndMobilitySubscriptionDataDocumentApi::
"The requested method does not exist");
}
} // namespace oai::udr::api
} // namespace oai::udr::api
......@@ -53,7 +53,7 @@ namespace oai::udr::api {
using namespace oai::udr::model;
class AccessAndMobilitySubscriptionDataDocumentApi {
public:
public:
AccessAndMobilitySubscriptionDataDocumentApi(
std::shared_ptr<Pistache::Rest::Router>);
virtual ~AccessAndMobilitySubscriptionDataDocumentApi() {}
......@@ -61,7 +61,7 @@ public:
const std::string base = "/nudr-dr/v2";
private:
private:
void setupRoutes();
void query_am_data_handler(const Pistache::Rest::Request &request,
......@@ -97,6 +97,6 @@ private:
Pistache::Http::ResponseWriter &response) = 0;
};
} // namespace oai::udr::api
} // namespace oai::udr::api
#endif /* AccessAndMobilitySubscriptionDataDocumentApi_H_ */
......@@ -34,6 +34,9 @@
#include "AmfSubscriptionInfoDocumentApi.h"
#include "Helpers.h"
#include "udr_config.hpp"
extern oai::udr::config::udr_config udr_cfg;
namespace oai::udr::api {
......@@ -52,8 +55,9 @@ void AmfSubscriptionInfoDocumentApi::setupRoutes() {
Routes::Patch(
*router,
base + "/subscription-data/:ueId/context-data/ee-subscriptions/:subsId/"
"amf-subscriptions",
base + udr_cfg.nudr.api_version +
"/subscription-data/:ueId/context-data/ee-subscriptions/:subsId/"
"amf-subscriptions",
Routes::bind(
&AmfSubscriptionInfoDocumentApi::modify_amf_subscription_info_handler,
this));
......@@ -111,4 +115,4 @@ void AmfSubscriptionInfoDocumentApi::
"The requested method does not exist");
}
} // namespace oai::udr::api
} // namespace oai::udr::api
......@@ -56,19 +56,19 @@ namespace oai::udr::api {
using namespace oai::udr::model;
class AmfSubscriptionInfoDocumentApi {
public:
public:
AmfSubscriptionInfoDocumentApi(std::shared_ptr<Pistache::Rest::Router>);
virtual ~AmfSubscriptionInfoDocumentApi() {}
void init();
const std::string base = "/nudr-dr/v2";
private:
private:
void setupRoutes();
void
modify_amf_subscription_info_handler(const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response);
void modify_amf_subscription_info_handler(
const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response);
void amf_subscription_info_document_api_default_handler(
const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response);
......@@ -93,6 +93,6 @@ private:
Pistache::Http::ResponseWriter &response) = 0;
};
} // namespace oai::udr::api
} // namespace oai::udr::api
#endif /* AmfSubscriptionInfoDocumentApi_H_ */
......@@ -34,6 +34,9 @@
#include "ApplicationDataSubscriptionsCollectionApi.h"
#include "Helpers.h"
#include "udr_config.hpp"
extern oai::udr::config::udr_config udr_cfg;
namespace oai::udr::api {
......@@ -52,12 +55,14 @@ void ApplicationDataSubscriptionsCollectionApi::setupRoutes() {
using namespace Pistache::Rest;
Routes::Post(
*router, base + "/application-data/subs-to-notify",
*router,
base + udr_cfg.nudr.api_version + "/application-data/subs-to-notify",
Routes::bind(&ApplicationDataSubscriptionsCollectionApi::
create_individual_application_data_subscription_handler,
this));
Routes::Get(
*router, base + "/application-data/subs-to-notify",
*router,
base + udr_cfg.nudr.api_version + "/application-data/subs-to-notify",
Routes::bind(&ApplicationDataSubscriptionsCollectionApi::
read_application_data_change_subscriptions_handler,
this));
......@@ -132,4 +137,4 @@ void ApplicationDataSubscriptionsCollectionApi::
"The requested method does not exist");
}
} // namespace oai::udr::api
} // namespace oai::udr::api
......@@ -53,7 +53,7 @@ namespace oai::udr::api {
using namespace oai::udr::model;
class ApplicationDataSubscriptionsCollectionApi {
public:
public:
ApplicationDataSubscriptionsCollectionApi(
std::shared_ptr<Pistache::Rest::Router>);
virtual ~ApplicationDataSubscriptionsCollectionApi() {}
......@@ -61,7 +61,7 @@ public:
const std::string base = "/nudr-dr/v2";
private:
private:
void setupRoutes();
void create_individual_application_data_subscription_handler(
......@@ -100,6 +100,6 @@ private:
Pistache::Http::ResponseWriter &response) = 0;
};
} // namespace oai::udr::api
} // namespace oai::udr::api
#endif /* ApplicationDataSubscriptionsCollectionApi_H_ */
......@@ -34,6 +34,9 @@
#include "AuthenticationSoRDocumentApi.h"
#include "Helpers.h"
#include "udr_config.hpp"
extern oai::udr::config::udr_config udr_cfg;
namespace oai::udr::api {
......@@ -52,13 +55,15 @@ void AuthenticationSoRDocumentApi::setupRoutes() {
Routes::Put(
*router,
base + "/subscription-data/:ueId/ue-update-confirmation-data/sor-data",
base + udr_cfg.nudr.api_version +
"/subscription-data/:ueId/ue-update-confirmation-data/sor-data",
Routes::bind(
&AuthenticationSoRDocumentApi::create_authentication_so_r_handler,
this));
Routes::Get(
*router,
base + "/subscription-data/:ueId/ue-update-confirmation-data/sor-data",
base + udr_cfg.nudr.api_version +
"/subscription-data/:ueId/ue-update-confirmation-data/sor-data",
Routes::bind(&AuthenticationSoRDocumentApi::query_auth_so_r_handler,
this));
......@@ -146,4 +151,4 @@ void AuthenticationSoRDocumentApi::
"The requested method does not exist");
}
} // namespace oai::udr::api
} // namespace oai::udr::api
......@@ -53,19 +53,19 @@ namespace oai::udr::api {
using namespace oai::udr::model;
class AuthenticationSoRDocumentApi {
public:
public:
AuthenticationSoRDocumentApi(std::shared_ptr<Pistache::Rest::Router>);
virtual ~AuthenticationSoRDocumentApi() {}
void init();
const std::string base = "/nudr-dr/v2";
private:
private:
void setupRoutes();
void
create_authentication_so_r_handler(const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response);
void create_authentication_so_r_handler(
const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response);
void query_auth_so_r_handler(const Pistache::Rest::Request &request,
Pistache::Http::ResponseWriter response);
void authentication_so_r_document_api_default_handler(
......@@ -97,12 +97,12 @@ private:
/// <param name="ueId">UE id</param>
/// <param name="supportedFeatures">Supported Features (optional, default to
/// &quot;&quot;)</param>
virtual void
query_auth_so_r(const std::string &ueId,
const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response) = 0;
virtual void query_auth_so_r(
const std::string &ueId,
const Pistache::Optional<std::string> &supportedFeatures,
Pistache::Http::ResponseWriter &response) = 0;
};
} // namespace oai::udr::api
} // namespace oai::udr::api
#endif /* AuthenticationSoRDocumentApi_H_ */
......@@ -35,6 +35,9 @@
#include "Helpers.h"
#include "logger.hpp"
#include "udr_config.hpp"
extern oai::udr::config::udr_config udr_cfg;
namespace oai::udr::api {
......@@ -53,7 +56,7 @@ void AuthenticationStatusDocumentApi::setupRoutes() {
Routes::Put(
*router,
base +
base + udr_cfg.nudr.api_version +