RIC-641 Add client/server model definitions
Change-Id: I8a3228f261dade6b5ac00a8924ad60bbef0de22c
Signed-off-by: Nhat Anh <anh_ng@hcl.com>
diff --git a/src/rest/CMakeLists.txt b/src/rest/CMakeLists.txt
new file mode 100644
index 0000000..282e9b9
--- /dev/null
+++ b/src/rest/CMakeLists.txt
@@ -0,0 +1,27 @@
+# vim: sw=4 ts=4 noet:
+#
+#==================================================================================
+# Copyright (c) 2020 Nokia
+# Copyright (c) 2020 AT&T Intellectual Property.
+#
+# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#==================================================================================
+#
+
+
+# For clarity: this generates object, not a lib as the CM command implies.
+#
+add_subdirectory(./model)
+#add_subdirectory(./clientapi)
+#add_subdirectory(./serverapi)
+
diff --git a/src/rest/model/ActionToBeSetup.h b/src/rest/model/ActionToBeSetup.h
new file mode 100644
index 0000000..6bb8d55
--- /dev/null
+++ b/src/rest/model/ActionToBeSetup.h
@@ -0,0 +1,85 @@
+#ifndef XAPP_MODEL_ActionToBeSetup_H
+#define XAPP_MODEL_ActionToBeSetup_H
+#include "ModelBase.h"
+#include "SubsequentAction.h"
+
+namespace xapp {
+namespace model {
+
+using namespace xapp::model;
+using ActionDefinition = std::vector<int>;
+
+struct ActionToBeSetup: ModelBase {
+ ActionDefinition m_ActionDefinition;
+ int ActionID;
+ std::string ActionType;
+ SubsequentAction m_SubsequentAction;
+
+ json validator_schema = R"(
+ {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "SubsequentAction",
+ "properties": {
+ "ActionDefinition": {
+ "description": "Action Definition",
+ "type": "array",
+ "items": {
+ "type": "integer"
+ }
+ },
+ "ActionID": {
+ "description": "Identification of Action",
+ "type": "integer",
+ "minimum": 0,
+ "maximum": 255
+ },
+ "ActionType": {
+ "description": "Type of Action",
+ "type": "string",
+ "enum": ["policy", "insert", "report"]
+ },
+ "SubsequentAction": {
+ "description": "Subsequent Action",
+ "type": "object"
+ }
+ },
+ "required": [
+ "ActionDefinition",
+ "ActionID",
+ "ActionType",
+ "SubsequentAction"
+ ],
+ "type": "object"
+ })"_json;
+
+ virtual json get_validator_schema() const { return validator_schema; }
+};
+
+void from_json(const json& j, ActionToBeSetup& ref) {
+
+ std::cout << __PRETTY_FUNCTION__ << std::endl;
+ ref.validate_json(j);
+ j.at("ActionDefinition").get_to(ref.m_ActionDefinition);
+ j.at("ActionID").get_to(ref.ActionID);
+ j.at("ActionType").get_to(ref.ActionType);
+ j.at("SubsequentAction").get_to(ref.m_SubsequentAction);
+
+}
+
+void to_json(json& j, const ActionToBeSetup& ref) {
+
+ j = json {
+ {"ActionDefinition", ref.m_ActionDefinition},
+ {"ActionID", ref.ActionID},
+ {"ActionType", ref.ActionType},
+ {"SubsequentAction", ref.m_SubsequentAction}
+ };
+}
+
+using ActionsToBeSetup = std::vector<ActionToBeSetup>;
+
+} /*namespace model*/
+} /*namespace xapp*/
+
+#endif /* XAPP_MODEL_ActionToBeSetup_H */
+
diff --git a/src/rest/model/CMakeLists.txt b/src/rest/model/CMakeLists.txt
new file mode 100644
index 0000000..932a93c
--- /dev/null
+++ b/src/rest/model/CMakeLists.txt
@@ -0,0 +1,30 @@
+# vim: sw=4 ts=4 noet:
+#
+#==================================================================================
+# Copyright (c) 2020 Nokia
+# Copyright (c) 2020 AT&T Intellectual Property.
+#
+# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#==================================================================================
+#
+
+
+# For clarity: this generates object, not a lib as the CM command implies.
+#
+if( DEV_PKG )
+ install(
+ DIRECTORY ./ DESTINATION ${install_inc}
+ FILES_MATCHING PATTERN "*.h"
+ )
+endif()
+
diff --git a/src/rest/model/ConfigMetadata.h b/src/rest/model/ConfigMetadata.h
new file mode 100644
index 0000000..a60bfb5
--- /dev/null
+++ b/src/rest/model/ConfigMetadata.h
@@ -0,0 +1,54 @@
+#ifndef XAPP_MODEL_ConfigMetadata_H
+#define XAPP_MODEL_ConfigMetadata_H
+
+#include "ModelBase.h"
+
+namespace xapp {
+namespace model {
+
+struct ConfigMetadata: ModelBase {
+ std::string ConfigType;
+ std::string XappName;
+ json validator_schema = R"(
+ {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "ConfigMetadata",
+ "properties": {
+ "ConfigType": {
+ "description": "Type of Config",
+ "type": "string",
+ "enum": ["json", "xml", "other"]
+ },
+ "XappName": {
+ "description": "Name of xApp",
+ "type": "string"
+ }
+ },
+ "required": [
+ "ConfigType",
+ "XappName"
+ ],
+ "type": "object"
+ })"_json;
+
+ virtual json get_validator_schema() const { return validator_schema; }
+};
+
+void from_json(const json& j, ConfigMetadata& ref) {
+
+ std::cout << __func__ << " ConfigMetadata " << std::endl;
+ ref.validate_json(j);
+ j.at("ConfigType").get_to(ref.ConfigType);
+ j.at("XappName").get_to(ref.XappName);
+}
+
+void to_json(json& j, const ConfigMetadata& ref) {
+ j = json {
+ {"ConfigType",ref.ConfigType},
+ {"XappName", ref.XappName}
+ };
+}
+
+} /*namespace model*/
+} /*namespace xapp*/
+#endif /*XAPP_MODEL_ConfigMetadata_H*/
diff --git a/src/rest/model/ModelBase.h b/src/rest/model/ModelBase.h
new file mode 100644
index 0000000..159b772
--- /dev/null
+++ b/src/rest/model/ModelBase.h
@@ -0,0 +1,66 @@
+#ifndef XAPP_MODEL_ModelBase_H
+#define XAPP_MODEL_ModelBase_H
+#include <iostream>
+#include <string.h>
+#include <nlohmann/json.hpp>
+#include <nlohmann/json-schema.hpp>
+#include <type_traits>
+
+using nlohmann::json_schema::json_validator;
+using json = nlohmann::json;
+
+namespace xapp {
+namespace model {
+
+std::invalid_argument invalid_parameter("Invalid Json Input");
+
+template<typename ModelType>
+bool _validate(const ModelType model) {
+ json _json = model;
+ json_validator validator;
+ validator.set_root_schema(model.validator_schema);
+
+ try {
+ validator.validate(_json);
+ } catch (const std::exception& e) {
+ std::cerr << "Struct Validation failed, here is why: " << e.what() << "\n";
+ throw;
+ }
+ return true;
+}
+
+struct ModelBase {
+ json validator_schema = R"(
+ {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "ModelBase"
+ })"_json;
+
+ bool validate_() {
+ return _validate(std::move(*this));
+ }
+
+ void validate_json(const json& _json) {
+ json_validator validator;
+ validator.set_root_schema(get_validator_schema());
+ try {
+ validator.validate(_json);
+ } catch (const std::exception& e) {
+ throw;
+ }
+ return;
+ }
+
+ virtual json get_validator_schema() const { return validator_schema; }
+};
+
+void from_json(const json& j, ModelBase& ref) {
+ return;
+}
+void to_json(json& j, const ModelBase& ref) {
+ return;
+}
+
+} /*model*/
+} /*xapp*/
+#endif /*XAPP_MODEL_ModelBase_H*/
diff --git a/src/rest/model/RestModel.h b/src/rest/model/RestModel.h
new file mode 100644
index 0000000..266e221
--- /dev/null
+++ b/src/rest/model/RestModel.h
@@ -0,0 +1,15 @@
+#ifndef XAPP_MODEL_H
+#define XAPP_MODEL_H
+#include "ModelBase.h"
+#include "SubsequentAction.h"
+#include "ActionToBeSetup.h"
+#include "SubscriptionResponse.h"
+#include "ConfigMetadata.h"
+#include "SubscriptionDetail.h"
+#include "SubscriptionParams_ClientEndpoint.h"
+#include "SubscriptionParams_E2SubscriptionDirectives.h"
+#include "SubscriptionParams.h"
+#include "SubscriptionInstance.h"
+#include "SubscriptionData.h"
+
+#endif /*XAPP_MODEL_H*/
diff --git a/src/rest/model/SubscriptionData.h b/src/rest/model/SubscriptionData.h
new file mode 100644
index 0000000..008b72a
--- /dev/null
+++ b/src/rest/model/SubscriptionData.h
@@ -0,0 +1,72 @@
+#ifndef XAPP_MODEL_SubscriptionData_H
+#define XAPP_MODEL_SubscriptionData_H
+#include "ModelBase.h"
+#include "SubscriptionInstance.h"
+namespace xapp {
+namespace model {
+
+struct SubscriptionData: ModelBase {
+ std::vector<std::string> ClientEndpoint;
+ std::string Meid;
+ int SubscriptionID;
+ SubscriptionInstances m_SubscriptionInstances;
+
+ json validator_schema = R"(
+ {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "SubscriptionData",
+ "properties": {
+ "SubscriptionId": {
+ "type": "integer"
+ },
+ "Meid": {
+ "type": "string"
+ },
+ "ClientEndpoint": {
+ "type": "array",
+ "items": {
+ "type": "string"
+ }
+ },
+ "SubscriptionInstances": {
+ "type": "array"
+ }
+ },
+ "required": [
+ "SubscriptionId",
+ "Meid",
+ "ClientEndpoint",
+ "SubscriptionInstances"
+ ],
+ "type": "object"
+ })"_json;
+
+ virtual json get_validator_schema() const { return validator_schema; }
+};
+
+void from_json(const json& j, SubscriptionData& ref) {
+
+ std::cout << __PRETTY_FUNCTION__ << std::endl;
+ ref.validate_json(j);
+
+ j.at("SubscriptionId").get_to(ref.SubscriptionID);
+ j.at("SubscriptionInstances").get_to(ref.m_SubscriptionInstances);
+ j.at("Meid").get_to(ref.Meid);
+ j.at("ClientEndpoint").get_to(ref.ClientEndpoint);
+}
+
+void to_json(json& j, const SubscriptionData& ref) {
+
+ j = json {
+ {"SubscriptionId",ref.SubscriptionID},
+ {"Meid",ref.Meid},
+ {"ClientEndpoint", ref.ClientEndpoint},
+ {"SubscriptionInstances", ref.m_SubscriptionInstances}
+ };
+}
+
+using SubscriptionList = std::vector<SubscriptionData>;
+
+} /*namespace model*/
+} /*namespace xapp*/
+#endif /*XAPP_MODEL_SubscriptionData_H*/
diff --git a/src/rest/model/SubscriptionDetail.h b/src/rest/model/SubscriptionDetail.h
new file mode 100644
index 0000000..1651619
--- /dev/null
+++ b/src/rest/model/SubscriptionDetail.h
@@ -0,0 +1,71 @@
+#ifndef XAPP_MODEL_SubscriptionDetail_H
+#define XAPP_MODEL_SubscriptionDetail_H
+#include "ModelBase.h"
+#include "ActionToBeSetup.h"
+
+namespace xapp {
+namespace model {
+
+using EventTriggerDefinition = std::vector<int>;
+
+struct SubscriptionDetail: ModelBase {
+ ActionsToBeSetup ActionToBeSetupList;
+ EventTriggerDefinition EventTriggers;
+ int XappEventInstanceID;
+ json validator_schema = R"(
+ {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "Subscription detail",
+ "properties": {
+ "XappEventInstanceId": {
+ "type": "integer",
+ "minimum": 0,
+ "maximum": 255
+ },
+ "EventTriggers": {
+ "description": "Identification of Action",
+ "type": "array",
+ "items": {
+ "type": "integer"
+ }
+ },
+ "ActionToBeSetupList": {
+ "type": "array"
+ }
+ },
+ "required": [
+ "XappEventInstanceId",
+ "EventTriggers",
+ "ActionToBeSetupList"
+ ],
+ "type": "object"
+ })"_json;
+
+ virtual json get_validator_schema() const { return validator_schema; }
+
+};
+
+void from_json(const json& j, SubscriptionDetail& ref) {
+
+ std::cout << __PRETTY_FUNCTION__ << std::endl;
+ ref.validate_json(j);
+
+ j.at("XappEventInstanceId").get_to(ref.XappEventInstanceID);
+ j.at("EventTriggers").get_to(ref.EventTriggers);
+ j.at("ActionToBeSetupList").get_to(ref.ActionToBeSetupList);
+}
+
+void to_json(json& j, const SubscriptionDetail& ref) {
+
+ j = json {
+ {"XappEventInstanceId", ref.XappEventInstanceID},
+ {"EventTriggers", ref.EventTriggers},
+ {"ActionToBeSetupList", ref.ActionToBeSetupList},
+ };
+}
+
+using SubscriptionDetailsList = std::vector<SubscriptionDetail>;
+
+} /*namespace model*/
+} /*namespace xapp*/
+#endif /*XAPP_MODEL_SubscriptionDetail_H*/
diff --git a/src/rest/model/SubscriptionInstance.h b/src/rest/model/SubscriptionInstance.h
new file mode 100644
index 0000000..f427e79
--- /dev/null
+++ b/src/rest/model/SubscriptionInstance.h
@@ -0,0 +1,83 @@
+#ifndef XAPP_MODEL_SubscriptionInstance_H
+#define XAPP_MODEL_SubscriptionInstance_H
+#include "ModelBase.h"
+
+namespace xapp {
+namespace model {
+
+struct SubscriptionInstance: ModelBase {
+ int E2EventInstanceID;
+ std::string ErrorCause;
+ std::string ErrorSource;
+ std::string TimeoutType;
+ int XappEventInstanceID;
+
+ json validator_schema = R"(
+ {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "SubscriptionInstance",
+ "description": "xApp service address and port",
+ "properties": {
+ "XappEventInstanceId": {
+ "type": "integer",
+ "minimum": 0,
+ "maximum": 65535
+ },
+ "E2EventInstanceId": {
+ "type": "integer",
+ "minimum": 0,
+ "maximum": 65535
+ },
+ "ErrorCause": {
+ "description": "Descriptive error cause. Empty string when no error.",
+ "type": "string"
+ },
+ "ErrorSource": {
+ "description": "Source of error cause.",
+ "type": "string",
+ "enum": ["SUBMGR", "RTMGR", "DBAAS", "ASN1", "E2Node"]
+ },
+ "TimeoutType": {
+ "description": "Type timeout. xApp should retry if timeout occurs.",
+ "type": "string",
+ "enum": ["E2-Timeout", "RTMGR-Timeout", "DBAAS-Timeout"]
+ }
+ },
+ "required": [
+ "XappEventInstanceId",
+ "E2EventInstanceId"
+ ],
+ "type": "object"
+ })"_json;
+
+ virtual json get_validator_schema() const { return validator_schema; }
+};
+
+void from_json(const json& j, SubscriptionInstance& ref) {
+
+ std::cout << __PRETTY_FUNCTION__ << std::endl;
+ ref.validate_json(j);
+
+ j.at("XappEventInstanceId").get_to(ref.XappEventInstanceID);
+ j.at("E2EventInstanceId").get_to(ref.E2EventInstanceID);
+ j.at("ErrorCause").get_to(ref.ErrorCause);
+ j.at("ErrorSource").get_to(ref.ErrorSource);
+ j.at("TimeoutType").get_to(ref.TimeoutType);
+}
+
+void to_json(json& j, const SubscriptionInstance& ref) {
+
+ j = json {
+ {"XappEventInstanceId", ref.XappEventInstanceID},
+ {"E2EventInstanceId", ref.E2EventInstanceID},
+ {"ErrorCause", ref.ErrorCause},
+ {"ErrorSource", ref.ErrorSource},
+ {"TimeoutType", ref.TimeoutType}
+ };
+}
+
+using SubscriptionInstances = std::vector<SubscriptionInstance>;
+
+} /*namespace model*/
+} /*namespace xapp*/
+#endif /*XAPP_MODEL_SubscriptionInstance_H*/
diff --git a/src/rest/model/SubscriptionParams.h b/src/rest/model/SubscriptionParams.h
new file mode 100644
index 0000000..cc19750
--- /dev/null
+++ b/src/rest/model/SubscriptionParams.h
@@ -0,0 +1,86 @@
+#ifndef XAPP_MODEL_SubscriptionParams_H
+#define XAPP_MODEL_SubscriptionParams_H
+#include "ModelBase.h"
+#include "SubscriptionDetail.h"
+#include "SubscriptionParams_ClientEndpoint.h"
+#include "SubscriptionParams_E2SubscriptionDirectives.h"
+
+namespace xapp {
+namespace model {
+
+struct SubscriptionParams: public ModelBase {
+
+ SubscriptionParams_ClientEndpoint ClientEndpoint;
+ SubscriptionParams_E2SubscriptionDirectives E2SubscriptionDirectives;
+ std::string Meid;
+ int RANFunctionID;
+ std::string SubscriptionID;
+ SubscriptionDetailsList m_SubscriptionDetailsList;
+
+ json validator_schema = R"(
+ {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "SubscriptionParams",
+ "properties": {
+ "SubscriptionId": {
+ "description": "Optional subscription ID '(Submgr allocates if not given)'",
+ "type": "string"
+ },
+ "Meid": {
+ "type": "string"
+ },
+ "RANFunctionId": {
+ "type": "integer",
+ "minimum": 0,
+ "maximum": 4095
+ }
+ },
+ "required": [
+ "ClientEndpoint",
+ "Meid",
+ "RANFunctionId",
+ "SubscriptionDetails"
+ ],
+ "type": "object"
+ })"_json;
+
+ virtual json get_validator_schema() const { return validator_schema; }
+
+};
+
+void from_json(const json& j, SubscriptionParams& ref) {
+
+ std::cout << __PRETTY_FUNCTION__ << std::endl;
+ ref.validate_json(j);
+ j.at("ClientEndpoint").get_to(ref.ClientEndpoint);
+
+ if (j.contains("E2SubscriptionDirectives"))
+ {
+ j.at("E2SubscriptionDirectives").get_to(ref.E2SubscriptionDirectives);
+ }
+
+ if (j.contains("SubscriptionId"))
+ {
+ j.at("SubscriptionId").get_to(ref.SubscriptionID);
+ }
+
+ j.at("Meid").get_to(ref.Meid);
+ j.at("RANFunctionId").get_to(ref.RANFunctionID);
+ j.at("SubscriptionDetails").get_to(ref.m_SubscriptionDetailsList);
+}
+
+void to_json(json& j, const SubscriptionParams& ref) {
+
+ j = json {
+ {"ClientEndpoint", ref.ClientEndpoint},
+ {"E2SubscriptionDirectives", ref.E2SubscriptionDirectives},
+ {"Meid", ref.Meid},
+ {"RANFunctionId", ref.RANFunctionID},
+ {"SubscriptionId", ref.SubscriptionID},
+ {"SubscriptionDetails", ref.m_SubscriptionDetailsList},
+ };
+}
+
+} /*namespace model*/
+} /*namespace xapp*/
+#endif /*XAPP_MODEL_SubscriptionParams_H*/
diff --git a/src/rest/model/SubscriptionParams_ClientEndpoint.h b/src/rest/model/SubscriptionParams_ClientEndpoint.h
new file mode 100644
index 0000000..3d43997
--- /dev/null
+++ b/src/rest/model/SubscriptionParams_ClientEndpoint.h
@@ -0,0 +1,65 @@
+#ifndef XAPP_MODEL_SubscriptionParams_ClientEndpoint_H
+#define XAPP_MODEL_SubscriptionParams_ClientEndpoint_H
+#include "ModelBase.h"
+
+namespace xapp {
+namespace model {
+
+struct SubscriptionParams_ClientEndpoint: ModelBase {
+ int HTTPPort;
+ std::string Host;
+ int RMRPort;
+ json validator_schema = R"(
+ {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "SubscriptionParams_ClientEndpoint",
+ "description": "xApp service address and port",
+ "properties": {
+ "HTTPPort": {
+ "description": "xApp HTTP service address port",
+ "type": "integer",
+ "minimum": 0,
+ "maximum": 65535
+ },
+ "Host": {
+ "description": "xApp service address name like service-ricxapp-xappname-http.ricxapp",
+ "type": "string"
+ },
+ "RMRPort": {
+ "description": "xApp RMR service address port",
+ "type": "integer",
+ "minimum": 0,
+ "maximum": 65535
+ }
+ },
+ "required": [
+ "HTTPPort",
+ "Host",
+ "RMRPort"
+ ],
+ "type": "object"
+ })"_json;
+
+ virtual json get_validator_schema() const { return validator_schema; }
+};
+
+void from_json(const json& j, SubscriptionParams_ClientEndpoint& ref) {
+
+ std::cout << __PRETTY_FUNCTION__ << std::endl;
+ ref.validate_json(j);
+ j.at("HTTPPort").get_to(ref.HTTPPort);
+ j.at("Host").get_to(ref.Host);
+ j.at("RMRPort").get_to(ref.RMRPort);
+}
+
+void to_json(json& j, const SubscriptionParams_ClientEndpoint& ref) {
+ j = json {
+ {"HTTPPort", ref.HTTPPort},
+ {"Host", ref.Host},
+ {"RMRPort", ref.RMRPort},
+ };
+}
+
+} /*namespace model*/
+} /*namespace xapp*/
+#endif /*XAPP_MODEL_SubscriptionParams_ClientEndpoint_H*/
diff --git a/src/rest/model/SubscriptionParams_E2SubscriptionDirectives.h b/src/rest/model/SubscriptionParams_E2SubscriptionDirectives.h
new file mode 100644
index 0000000..a0f783c
--- /dev/null
+++ b/src/rest/model/SubscriptionParams_E2SubscriptionDirectives.h
@@ -0,0 +1,66 @@
+#ifndef XAPP_MODEL_SubscriptionParams_E2SubscriptionDirectives_H
+#define XAPP_MODEL_SubscriptionParams_E2SubscriptionDirectives_H
+#include "ModelBase.h"
+
+namespace xapp {
+namespace model {
+
+struct SubscriptionParams_E2SubscriptionDirectives: ModelBase {
+ int E2RetryCount;
+ int E2TimeoutTimerValue;
+ bool RMRRoutingNeeded;
+ json validator_schema = R"(
+ {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "SubscriptionParams_E2SubscriptionDirectives",
+ "description": "Optional. If not set Submgr uses its default values",
+ "properties": {
+ "E2RetryCount": {
+ "description": "How many times E2 subscription request is retried",
+ "type": "integer",
+ "minimum": 0,
+ "maximum": 10
+ },
+ "E2TimeoutTimerValue": {
+ "description": "How long time response is waited from E2 node",
+ "type": "integer",
+ "minimum": 0,
+ "maximum": 10
+ },
+ "RMRRoutingNeeded": {
+ "description": "Subscription needs RMR route from E2Term to xApp",
+ "type": "boolean"
+ }
+ },
+ "required": [
+ "E2TimeoutTimerValue",
+ "E2RetryCount",
+ "RMRRoutingNeeded"
+ ],
+ "type": "object"
+ })"_json;
+
+ virtual json get_validator_schema() const { return validator_schema; }
+};
+
+void from_json(const json& j, SubscriptionParams_E2SubscriptionDirectives& ref) {
+
+ std::cout << __PRETTY_FUNCTION__ << std::endl;
+
+ j.at("E2RetryCount").get_to(ref.E2RetryCount);
+ j.at("E2TimeoutTimerValue").get_to(ref.E2TimeoutTimerValue);
+ j.at("RMRRoutingNeeded").get_to(ref.RMRRoutingNeeded);
+}
+
+void to_json(json& j, const SubscriptionParams_E2SubscriptionDirectives& ref) {
+
+ j = json {
+ {"E2RetryCount", ref.E2RetryCount},
+ {"E2TimeoutTimerValue", ref.E2TimeoutTimerValue},
+ {"RMRRoutingNeeded", ref.RMRRoutingNeeded},
+ };
+}
+
+} /*namespace model*/
+} /*namespace xapp*/
+#endif /*XAPP_MODEL_SubscriptionParams_ClientEndpoint_H*/
diff --git a/src/rest/model/SubscriptionResponse.h b/src/rest/model/SubscriptionResponse.h
new file mode 100644
index 0000000..3d8e8d4
--- /dev/null
+++ b/src/rest/model/SubscriptionResponse.h
@@ -0,0 +1,56 @@
+#ifndef XAPP_MODEL_SubscriptionResponse_H
+#define XAPP_MODEL_SubscriptionResponse_H
+#include "ModelBase.h"
+#include "SubscriptionInstance.h"
+
+namespace xapp {
+namespace model {
+
+struct SubscriptionResponse: ModelBase {
+ int SubscriptionID;
+ SubscriptionInstances m_SubscriptionInstances;
+
+ json validator_schema = R"(
+ {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "SubscriptionResponse",
+ "properties": {
+ "SubscriptionId": {
+ "description": "Indentification of Subscription",
+ "type": "integer"
+ },
+ "SubscriptionInstances": {
+ "description": "List of Subscription Instance",
+ "type": "array"
+ }
+ },
+ "required": [
+ "SubscriptionId",
+ "SubscriptionInstances"
+ ],
+ "type": "object"
+ })"_json;
+
+ virtual json get_validator_schema() const { return validator_schema; }
+};
+
+void from_json(const json& j, SubscriptionResponse& ref) {
+
+ std::cout << __PRETTY_FUNCTION__ << std::endl;
+ ref.validate_json(j);
+
+ j.at("SubscriptionId").get_to(ref.SubscriptionID);
+ j.at("SubscriptionInstances").get_to(ref.m_SubscriptionInstances);
+}
+
+void to_json(json& j, const SubscriptionResponse& ref) {
+
+ j = json {
+ {"SubscriptionId",ref.SubscriptionID},
+ {"SubscriptionInstances", ref.m_SubscriptionInstances}
+ };
+}
+
+} /*model*/
+} /*xapp*/
+#endif /*XAPP_MODEL_SubscriptionResponse_H*/
diff --git a/src/rest/model/SubsequentAction.h b/src/rest/model/SubsequentAction.h
new file mode 100644
index 0000000..0943579
--- /dev/null
+++ b/src/rest/model/SubsequentAction.h
@@ -0,0 +1,59 @@
+#ifndef XAPP_MODEL_SubsequentAction_H
+#define XAPP_MODEL_SubsequentAction_H
+#include "ModelBase.h"
+
+namespace xapp {
+namespace model {
+
+struct SubsequentAction: ModelBase {
+ std::string SubsequentActionType;
+ std::string TimeToWait;
+ json validator_schema = R"(
+ {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "SubsequentAction",
+ "properties": {
+ "SubsequentActionType": {
+ "description": "Type of Subsequent Action",
+ "type": "string",
+ "enum": ["wait", "continue"]
+
+ },
+ "TimeToWait": {
+ "description": "Time to waiting",
+ "type": "string",
+ "enum": ["zero", "w1ms", "w2ms", "w5ms", "w10ms", "w20ms", "w30ms",
+ "w40ms", "w50ms", "w100ms", "w200ms", "w500ms", "w1s",
+ "w2s", "w5s", "w10s", "w20s", "w60s"]
+ }
+ },
+ "required": [
+ "SubsequentActionType",
+ "TimeToWait"
+ ],
+ "type": "object"
+ })"_json;
+
+ virtual json get_validator_schema() const { return validator_schema; }
+};
+
+void from_json(const json& j, SubsequentAction& ref) {
+
+ std::cout << __PRETTY_FUNCTION__ << "\n";
+ ref.validate_json(j);
+
+ j.at("SubsequentActionType").get_to(ref.SubsequentActionType);
+ j.at("TimeToWait").get_to(ref.TimeToWait);
+}
+
+void to_json(json& j, const SubsequentAction& ref) {
+
+ j = json {
+ {"SubsequentActionType",ref.SubsequentActionType},
+ {"TimeToWait", ref.TimeToWait}
+ };
+}
+
+} /*model*/
+} /*xapp*/
+#endif /*XAPP_MODEL_SubsequentAction_H*/