Commit 8f498109 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Polish the code/remove unnecessary files

parent e16571b4
......@@ -27,17 +27,18 @@
*/
#include "amf_app.hpp"
#include <stdexcept>
#include <iostream>
#include <cstdlib>
#include "itti.hpp"
#include "ngap_app.hpp"
#include "amf_config.hpp"
#include "amf_n2.hpp"
#include "amf_n1.hpp"
#include "amf_n11.hpp"
#include <stdexcept>
#include <iostream>
#include <cstdlib>
#include "amf_statistics.hpp"
#include "DLNASTransport.hpp"
using namespace ngap;
......
......@@ -27,13 +27,17 @@
*/
#include "amf_config.hpp"
#include "logger.hpp"
#include <iostream>
#include <libconfig.h++>
#include "string.hpp"
#include "thread_sched.hpp"
#include "logger.hpp"
#include "amf_app.hpp"
#include "if.hpp"
#include "3gpp_ts24501.hpp"
extern "C" {
#include <arpa/inet.h>
#include <stdbool.h>
......@@ -44,8 +48,6 @@ extern "C" {
#include "common_defs.h"
}
#include <iostream>
using namespace libconfig;
using namespace amf_application;
......
......@@ -29,22 +29,21 @@
#ifndef _AMF_CONFIG_H_
#define _AMF_CONFIG_H_
#include "amf_config.hpp"
#include <arpa/inet.h>
#include <libconfig.h++>
#include <netinet/in.h>
#include <sys/socket.h>
#include <mutex>
#include <vector>
#include <string>
#include "thread_sched.hpp"
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>
#include "amf_config.hpp"
#include "thread_sched.hpp"
#define AMF_CONFIG_STRING_AMF_CONFIG "AMF"
#define AMF_CONFIG_STRING_PID_DIRECTORY "PID_DIRECTORY"
#define AMF_CONFIG_STRING_INSTANCE_ID "INSTANCE_ID"
......
......@@ -27,10 +27,12 @@
*/
#include "amf_module_from_config.hpp"
#include "logger.hpp"
#include <iostream>
#include <string>
#include "logger.hpp"
namespace config {
//------------------------------------------------------------------------------
......
......@@ -27,6 +27,7 @@
*/
#include "amf_n1.hpp"
#include "amf_n11.hpp"
#include "amf_app.hpp"
#include "itti.hpp"
......
......@@ -31,14 +31,6 @@
#include <map>
#include <shared_mutex>
#include "nas_context.hpp"
#include "pdu_session_context.hpp"
#include "itti_msg_n1.hpp"
#include "bstrlib.h"
#include "3gpp_ts24501.hpp"
#include "amf_statistics.hpp"
#include "amf.hpp"
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
......@@ -50,6 +42,13 @@
#include <inttypes.h>
#include <mysql/mysql.h>
#include "nas_context.hpp"
#include "pdu_session_context.hpp"
#include "itti_msg_n1.hpp"
#include "bstrlib.h"
#include "3gpp_ts24501.hpp"
#include "amf_statistics.hpp"
#include "amf.hpp"
#include "mysql_db.hpp"
namespace amf_application {
......
......@@ -27,23 +27,23 @@
*/
#include "amf_n11.hpp"
#include <curl/curl.h>
#include <nlohmann/json.hpp>
#include "amf_n1.hpp"
#include "itti.hpp"
#include "itti_msg_amf_app.hpp"
#include "amf_config.hpp"
#include "nas_context.hpp"
#include "amf.hpp"
#include <curl/curl.h>
#include <nlohmann/json.hpp>
#include "3gpp_ts24501.hpp"
// For smf_client
#include "SmContextCreateData.h"
#include "SMContextsCollectionApi.h"
#include "ApiConfiguration.h"
#include "ApiClient.h"
#include "3gpp_ts24501.hpp"
using namespace oai::smf::model;
using namespace oai::smf::api;
using namespace web;
......
......@@ -28,12 +28,14 @@
#ifndef _AMF_N11_H_
#define _AMF_N11_H_
#include "itti_msg_n11.hpp"
#include <map>
#include <shared_mutex>
#include "pdu_session_context.hpp"
#include <string>
#include "itti_msg_n11.hpp"
#include "pdu_session_context.hpp"
namespace amf_application {
class amf_n11 {
......
......@@ -27,6 +27,7 @@
*/
#include "amf_n2.hpp"
#include "amf_n1.hpp"
#include "amf_app.hpp"
#include "logger.hpp"
......
......@@ -40,7 +40,6 @@ class amf_n2 : public ngap::ngap_app{
public:
amf_n2(const std::string &address, const uint16_t port_num);
~amf_n2();
//void handle_receive(bstring payload, sctp_assoc_id_t assoc_id, sctp_stream_id_t stream, sctp_stream_id_t instreams, sctp_stream_id_t outstreams);
void handle_itti_message(itti_new_sctp_association &new_assoc);
void handle_itti_message(itti_ng_setup_request &ngsetupreq);
void handle_itti_message(itti_initial_ue_message &init_ue_msg);
......
......@@ -27,9 +27,11 @@
*/
#include "amf_statistics.hpp"
#include "logger.hpp"
#include <iostream>
#include "logger.hpp"
//------------------------------------------------------------------------------
void statistics::display() {
Logger::amf_app().info("");
......
......@@ -34,6 +34,7 @@
#include <stdint.h>
#include <vector>
#include <string>
#include "amf.hpp"
#include "ngap_app.hpp"
......
......@@ -29,6 +29,7 @@
#include "amf_n1.hpp"
#include "logger.hpp"
#include "amf_config.hpp"
using namespace amf_application;
using namespace config;
......
......@@ -32,8 +32,10 @@
#include <stdint.h>
#include <string>
#include <vector>
#include "sctp_server.hpp"
#include "NgapIEsStruct.hpp"
extern "C" {
#include "Ngap_PagingDRX.h"
#include "bstrlib.h"
......
......@@ -30,12 +30,13 @@
#define _AMF_NAS_CONTEXT_H_
#include <stdint.h>
#include "security_def.hpp"
#include "authentication_algorithms_with_5gaka.hpp"
#include <string>
#include "nas_security_context.hpp"
#include "struct.hpp"
#include "nas_security_context.hpp"
#include "security_def.hpp"
#include "authentication_algorithms_with_5gaka.hpp"
class nas_context {
public:
nas_context();
......
......@@ -31,9 +31,10 @@
#include <stdint.h>
#include <map>
#include "NgapIEsStruct.hpp"
#include <shared_mutex>
#include "NgapIEsStruct.hpp"
extern "C" {
#include "Ngap_RRCEstablishmentCause.h"
}
......
......@@ -31,9 +31,10 @@
#include <stdint.h>
#include <map>
#include "gNB_context.hpp"
#include <shared_mutex>
#include "gNB_context.hpp"
using namespace sctp;
typedef enum {
NGAP_UE_INVALID_STATE,
......
......@@ -329,7 +329,6 @@ include_directories(${SRC_TOP_DIR}/sbi/amf_server/impl)
include_directories(${SRC_TOP_DIR}/sbi/amf_server/model)
include_directories(${SRC_TOP_DIR}/sbi/smf_client)
include_directories(${SRC_TOP_DIR}/sbi/smf_client/api)
include_directories(${SRC_TOP_DIR}/sbi/smf_client/inputs)
include_directories(${SRC_TOP_DIR}/sbi/smf_client/model)
include_directories(${SRC_TOP_DIR}/sctp)
include_directories(${SRC_TOP_DIR}/secu_algorithms/5gaka)
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* 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 more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <iostream>
#include <thread>
#include <signal.h>
......@@ -19,9 +40,6 @@
#include "amf_module_from_config.hpp"
#include "amf_statistics.hpp"
#include "SMFClientApi.hpp"
#include "smf-client.hpp"
#include <string>
#include <cstring>
#include "normalizer.hh"
......@@ -58,7 +76,6 @@ if (!Options::parse(argc, argv)) {
itti_inst = new itti_mw();
itti_inst->start(amf_cfg.itti.itti_timer_sched_params);
//itti_inst->start();
amf_app_inst = new amf_app(amf_cfg);
amf_app_inst->allRegistredModulesInit(modules);
......
......@@ -28,7 +28,6 @@ include_directories(${SRC_TOP_DIR}/utils)
include_directories(${SRC_TOP_DIR}/utils/bstr)
include_directories(${SRC_TOP_DIR}/sbi/smf_client)
include_directories(${SRC_TOP_DIR}/sbi/smf_client/api)
include_directories(${SRC_TOP_DIR}/sbi/smf_client/inputs)
include_directories(${SRC_TOP_DIR}/sbi/smf_client/model)
add_library (AMF_SBI_CLIENT STATIC
......@@ -40,6 +39,5 @@ add_library (AMF_SBI_CLIENT STATIC
${CMAKE_CURRENT_SOURCE_DIR}/ModelBase.cpp
${CMAKE_CURRENT_SOURCE_DIR}/MultipartFormData.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Object.cpp
${CMAKE_CURRENT_SOURCE_DIR}/SMFClientApi.cpp
)
#include "SMFClientApi.hpp"
#include "IndividualPDUSessionHSMFApi.h"
#include "IndividualSMContextApi.h"
#include "PDUSessionsCollectionApi.h"
#include "SMContextsCollectionApi.h"
#include "ApiConfiguration.h"
#include "ApiClient.h"
#include "nlohmann/json.hpp"
#include "logger.hpp"
#include <cpprest/http_client.h>
#include <cpprest/filestream.h>
#define DEFAULT_JSON_FILE "/home/oai/oai-5g-amf/src/sbi/smf_client/inputs/SmContextCreateData.json"
using namespace utility; // Common utilities like string conversions
using namespace web; // Common features like URIs.
using namespace web::http; // Common HTTP functionality
using namespace web::http::client; // HTTP client features
using namespace concurrency::streams; // Asynchronous streams // JSON library
using namespace oai::smf::api;
using namespace oai::smf::model;
//using json = nlohmann::json;
int smf_client_test()
{
// create ApiConfiguration
std::shared_ptr <ApiConfiguration> apiConfiguration (new ApiConfiguration);
apiConfiguration->setBaseUrl(utility::conversions::to_string_t("http://10.103.238.82:8889/nsmf-pdusession/v2"));
//apiConfiguration->setBaseUrl(utility::conversions::to_string_t("http://192.168.2.189:8889/nsmf-pdusession/v2"));
std::shared_ptr <ApiClient> apiClient(new ApiClient (apiConfiguration));
std::shared_ptr<SmContextMessage> smContextMessage (new SmContextMessage);
//fill the content of smContextMessage
//TODO:
std::shared_ptr<SmContextCreateData> smContextCreateData (new SmContextCreateData);
Logger::amf_app().debug("starting test smf_client");
json::value jv; // JSON read from input file
try {
Logger::amf_app().debug("try to get smcontextcreatedata json(%s)", DEFAULT_JSON_FILE);
string_t importFile = DEFAULT_JSON_FILE; // extract filename
ifstream_t f(importFile); // filestream of working file
stringstream_t s; // string stream for holding JSON read from file
if (f) {
s << f.rdbuf(); // stream results of reading from file stream into string stream
f.close(); // close the filestream
jv = json::value::parse(s); // parse the resultant string stream.
std::cout << "file" << DEFAULT_JSON_FILE<<std::endl;
}else{
Logger::amf_app().error("no json file");
}
}
catch (web::json::json_exception excep) {
//std::cout << "ERROR Parsing JSON: ";
//std::cout << excep.what();
Logger::amf_app().error("error!");
}
//auto supi = jv.at(U("supi"));
//std::cout << supi <<std::endl;
smContextCreateData->fromJson(jv);
smContextMessage->setJsonData(smContextCreateData);
std::shared_ptr<HttpContent> n1sm(new HttpContent);
//n1sm->setName("\\\"n1SmMsg\\\"");
//n1sm->setContentDisposition("attachment");
n1sm->setContentType("application/vnd.3gpp.5gnas");
//uint8_t buf[18] = {0x2e, 0x05, 0x1e, 0xc1, 0xff, 0xff, 0x91, 0xa1, 0x7b, 0x00, 0x07, 0x80, 0x00, 0xa0, 0x00, 0x00, 0x0d, 0x00};
uint8_t buf[8] = {0x2e, 0x05, 0x1e, 0xc1, 0xff, 0xff, 0x91, 0xa1};
char test[8];
for(int i=0; i<8; i++)
test[i] = (char)buf[i];
printf("%s\n", test);
std::string value = test;
n1sm->setData( std::shared_ptr<std::istream>( new std::stringstream( utility::conversions::to_utf8string(value) ) ) );
//n1sm->setData( std::shared_ptr<std::istream>( new std::stringstream( "2e051ec1ffff91a17b00078000a00000d00" ) ) );
//n1sm->setData( std::shared_ptr<std::istream>(test));
smContextMessage->setBinaryDataN1SmMessage(n1sm);
std::shared_ptr<SMContextsCollectionApi> smContextsCollectionApi (new SMContextsCollectionApi (apiClient));
smContextsCollectionApi->postSmContexts (smContextMessage);
return 0;
}
#include "IndividualPDUSessionHSMFApi.h"
#include "IndividualSMContextApi.h"
#include "PDUSessionsCollectionApi.h"
#include "SMContextsCollectionApi.h"
#include "ApiConfiguration.h"
#include "ApiClient.h"
#include "nlohmann/json.hpp"
#include "logger.hpp"
#include <cpprest/http_client.h>
#include <cpprest/filestream.h>
#define DEFAULT_JSON_FILE "/home/oai/oai-5g-amf/src/sbi/smf_client/inputs/SmContextCreateData.json"
using namespace utility; // Common utilities like string conversions
using namespace web; // Common features like URIs.
using namespace web::http; // Common HTTP functionality
using namespace web::http::client; // HTTP client features
using namespace concurrency::streams; // Asynchronous streams // JSON library
using namespace oai::smf::api;
using namespace oai::smf::model;
//using json = nlohmann::json;
int smf_client_test();
{
"supi": "supi",
"pei": "pei",
"gpsi": "gpsi",
"pduSessionId": 1,
"dnn": "dnn",
"sNssai": {"sst":1, "sd":"sd"},
"hplmnSnssai": {"sst":1, "sd":"sd"},
"servingNfId": "",
"guami": {"plmnId": {"mcc": "122", "mnc":"13"}, "amfId":"2"},
"serviceName": "",
"servingNetwork": {"mcc": "122", "mnc":"13"},
"requestType": "",
"anType": "",
"secondAnType": "",
"ratType": "",
"presenceInLadn": "",
"ueTimeZone": "",
"smContextStatusUri": "",
"hSmfUri": "",
"additionalHsmfUri": [],
"oldPduSessionId": 1,
"pduSessionsActivateList": [1,2],
"ueEpsPdnConnection": "",
"hoState": "",
"pcfId": "",
"nrfUi": "",
"supportedFeatures": "",
"selMode": "",
"udmGroupId": "",
"routingIndicator": "",
"epsBearerCtxStatus": "",
"cpCiotEnabled": true,
"invokeNef": true,
"maPduIndication": false,
"smContextRef": "",
"n2SmInfo": {"contentId":"n2SmInfo"},
"n1SmMsg": {"contentId":"n1SmMsg"}
}
This diff is collapsed.
This diff is collapsed.
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