Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-UDM
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenXG
OpenXG-UDM
Commits
9ffb4d78
Commit
9ffb4d78
authored
Jul 23, 2021
by
yangjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix BUG: NWDAF data structure
parent
baf935d2
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
79 additions
and
26 deletions
+79
-26
src/api/ContextToNwdafApi.cpp
src/api/ContextToNwdafApi.cpp
+4
-1
src/impl/ContextToNwdafApiImpl.cpp
src/impl/ContextToNwdafApiImpl.cpp
+31
-2
src/impl/ContextToNwdafApiImpl.hpp
src/impl/ContextToNwdafApiImpl.hpp
+3
-1
src/impl/GenerateAuthDataApiImpl.cpp
src/impl/GenerateAuthDataApiImpl.cpp
+16
-8
src/udm_app/CMakeLists.txt
src/udm_app/CMakeLists.txt
+5
-5
src/udm_app/context_udm.cpp
src/udm_app/context_udm.cpp
+9
-4
src/udm_app/context_udm.hpp
src/udm_app/context_udm.hpp
+8
-4
src/udm_app/imsi_context.cpp
src/udm_app/imsi_context.cpp
+1
-1
src/udm_app/main.cpp
src/udm_app/main.cpp
+2
-0
No files found.
src/api/ContextToNwdafApi.cpp
View file @
9ffb4d78
#include "ContextToNwdafApi.hpp"
#include <nlohmann/json.hpp>
namespace
oai
{
namespace
udm
{
namespace
api
{
...
...
src/impl/ContextToNwdafApiImpl.cpp
View file @
9ffb4d78
...
...
@@ -2,18 +2,47 @@
#include "context_udm.hpp"
#include <vector>
#include <nlohmann/json.hpp>
using
namespace
context
;
extern
context_udm
*
udm_context
;
namespace
oai
{
namespace
udm
{
namespace
api
{
using
namespace
context
;
ContextToNwdafApiImpl
::
ContextToNwdafApiImpl
(
std
::
shared_ptr
<
Pistache
::
Rest
::
Router
>
rtr
)
:
ContextToNwdafApi
(
rtr
)
{}
void
ContextToNwdafApiImpl
::
get_context_to_nwdaf
(
Pistache
::
Http
::
ResponseWriter
&
response
)
{
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"Do some magic
\n
"
);
//response.send(Pistache::Http::Code::Ok, "Do some magic\n");
std
::
vector
<
imsi_context
>
list
;
udm_context
->
get_udm_context
(
list
);
nlohmann
::
json
j
,
tmp_j
;
if
(
list
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++
)
{
to_json
(
tmp_j
,
list
[
i
]);
j
+=
tmp_j
;
}
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
j
.
dump
());
}
else
{
response
.
send
(
Pistache
::
Http
::
Code
::
Ok
,
"[]"
);
}
// std::string out = j.dump();
// Logger::udr_server().debug("AuthenticationSubscription PATCH - json:\n\"%s\"",out.c_str());
}
}
// namespace api
...
...
src/impl/ContextToNwdafApiImpl.hpp
View file @
9ffb4d78
...
...
@@ -8,7 +8,9 @@
#include <pistache/optional.h>
#include <string>
#include "ContextToNwdafApi.hpp"
namespace
oai
{
namespace
udm
{
namespace
api
{
...
...
src/impl/GenerateAuthDataApiImpl.cpp
View file @
9ffb4d78
...
...
@@ -13,7 +13,7 @@
#include "GenerateAuthDataApiImpl.h"
#include "comUt.hpp"
#include "
imsi_context
.hpp"
#include "
context_udm
.hpp"
#include <iomanip>
#include <sstream>
...
...
@@ -360,14 +360,22 @@ void GenerateAuthDataApiImpl::generate_auth_data(
//context
imsi_context
ic
;
ic
.
setMessageFlag
(
true
);
ic
.
setImsi
(
supiOrSuci
);
ic
.
setOpType
(
response_data
.
at
(
"encTopcKey"
));
ic
.
setOp
(
response_data
.
at
(
"encOpcKey"
));
ic
.
setK
(
response_data
.
at
(
"encPermanentKey"
));
std
::
shared_ptr
<
imsi_context
>
ic
;
if
(
!
udm_context
->
is_imsi_2_udm_context
(
supiOrSuci
))
{
Logger
::
udm_ueau
().
debug
(
"Create a new context with supiOrSuci 0x%x"
,
supiOrSuci
);
ic
=
std
::
shared_ptr
<
imsi_context
>
(
new
imsi_context
());
udm_context
->
set_imsi_2_udm_context
(
supiOrSuci
,
ic
);
}
else
{
ic
=
udm_context
->
imsi_2_udm_context
(
supiOrSuci
);
}
ic
.
get
()
->
setMessageFlag
(
true
);
ic
.
get
()
->
setImsi
(
supiOrSuci
);
ic
.
get
()
->
setOpType
(
response_data
.
at
(
"encTopcKey"
));
ic
.
get
()
->
setOp
(
response_data
.
at
(
"encOpcKey"
));
ic
.
get
()
->
setK
(
response_data
.
at
(
"encPermanentKey"
));
}
}
// namespace api
...
...
src/udm_app/CMakeLists.txt
View file @
9ffb4d78
...
...
@@ -3,9 +3,9 @@ cmake_minimum_required (VERSION 3.2)
project
(
udm
)
if
(
CMAKE_OPENXGUDM_BUILD_TYPE STREQUAL Debug
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-std=c++1
1
-DDEBUG_IS_ON=1 -DINFO_IS_ON=1 -DTRACE_IS_ON=1"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-std=c++1
7
-DDEBUG_IS_ON=1 -DINFO_IS_ON=1 -DTRACE_IS_ON=1"
)
else
()
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-std=c++1
1
"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-std=c++1
7
"
)
endif
()
set
(
SRC_DIR
${
CMAKE_OPENXGUDM_DIR
}
/src
)
...
...
@@ -22,7 +22,7 @@ include_directories(${SRC_DIR}/5gaka)
include_directories
(
${
SRC_DIR
}
/common
)
include_directories
(
${
SRC_DIR
}
/utils
)
include_directories
(
${
SRC_DIR
}
/asnlib
)
#
include_directories(${SRC_DIR}/udm_app)
include_directories
(
${
SRC_DIR
}
/udm_app
)
##############################################
find_package
(
PkgConfig REQUIRED
)
...
...
@@ -59,7 +59,7 @@ add_definitions("-DNETTLE_VERSION_MAJOR=${NETTLE_VERSION_MAJOR}")
add_definitions
(
"-DNETTLE_VERSION_MINOR=
${
NETTLE_VERSION_MINOR
}
"
)
##############################################
### for log
### for log
add_library
(
LOG STATIC
${
SRC_DIR
}
/common/logger.cpp
)
add_library
(
OPTIONS STATIC
...
...
@@ -80,4 +80,4 @@ file(GLOB SRCS
)
add_executable
(
${
PROJECT_NAME
}
${
SRCS
}
)
target_link_libraries
(
${
PROJECT_NAME
}
LOG OPTIONS pistache pthread gmp config++
${
NETTLE_LIBRARIES
}
curl
)
target_link_libraries
(
${
PROJECT_NAME
}
-Wl,--start-group
LOG OPTIONS pistache pthread gmp config++
${
NETTLE_LIBRARIES
}
curl
)
src/udm_app/context_udm.cpp
View file @
9ffb4d78
#include "context_udm.hpp"
//using namespace context;
namespace
context
{
...
...
@@ -8,16 +7,22 @@ namespace context {
context_udm
::
context_udm
(){}
context_udm
::~
context_udm
(){}
//------------------------------------------------------------------------------
bool
context_udm
::
is_imsi_2_udm_context
(
const
std
::
string
&
imsi
)
const
{
std
::
shared_lock
lock
(
m_imsicontext
);
return
bool
{
imsicontext
.
count
(
imsi
)
>
0
};
}
//------------------------------------------------------------------------------
void
context_udm
::
set_imsi_2_udm_context
(
std
::
string
imsi
,
std
::
shared_ptr
<
imsi_context
>
ic
)
{
void
context_udm
::
set_imsi_2_udm_context
(
const
std
::
string
&
imsi
,
std
::
shared_ptr
<
imsi_context
>
ic
)
{
std
::
shared_lock
lock
(
m_imsicontext
);
imsicontext
[
imsi
]
=
ic
;
}
//------------------------------------------------------------------------------
std
::
shared_ptr
<
imsi_context
>
context_udm
::
imsi_2_udm_context
(
std
::
string
imsi
)
{
std
::
shared_ptr
<
imsi_context
>
context_udm
::
imsi_2_udm_context
(
const
std
::
string
&
imsi
)
{
std
::
shared_lock
lock
(
m_imsicontext
);
return
imsicontext
.
at
(
imsi
);;
...
...
@@ -30,7 +35,7 @@ bool context_udm::get_udm_context(std::vector<imsi_context> &vec) {
std
::
map
<
std
::
string
,
std
::
shared_ptr
<
imsi_context
>>::
reverse_iterator
iter
;
for
(
iter
=
imsicontext
.
rbegin
();
iter
!=
imsicontext
.
rend
();
iter
++
)
{
vec
.
push_back
(
iter
->
second
);
vec
.
push_back
(
*
(
iter
->
second
.
get
())
);
}
return
true
;
...
...
src/udm_app/context_udm.hpp
View file @
9ffb4d78
#ifndef _CONTEXT_H_
#define _CONTEXT_H_
#ifndef _CONTEXT_
UDM_
H_
#define _CONTEXT_
UDM_
H_
#include <map>
#include <memory>
#include <shared_mutex>
#include "imsi_context.hpp"
namespace
context
{
...
...
@@ -12,8 +14,10 @@ public:
context_udm
();
virtual
~
context_udm
();
set_imsi_2_udm_context
(
std
::
string
imsi
,
std
::
shared_ptr
<
imsi_context
>
ic
);
std
::
shared_ptr
<
imsi_context
>
imsi_2_udm_context
(
std
::
string
imsi
);
bool
is_imsi_2_udm_context
(
const
std
::
string
&
imsi
)
const
;
void
set_imsi_2_udm_context
(
const
std
::
string
&
imsi
,
std
::
shared_ptr
<
imsi_context
>
ic
);
std
::
shared_ptr
<
imsi_context
>
imsi_2_udm_context
(
const
std
::
string
&
imsi
);
bool
get_udm_context
(
std
::
vector
<
imsi_context
>
&
vec
);
private:
...
...
src/udm_app/imsi_context.cpp
View file @
9ffb4d78
...
...
@@ -47,7 +47,7 @@ void to_json(nlohmann::json& j, const imsi_context& o) {
j
[
"messageflag"
]
=
o
.
m_messageFlag
;
if
(
o
.
imsiIsSet
())
j
[
"imsi"
]
=
o
.
m_imsi
;
if
(
o
.
opIsSet
())
j
[
"op"
]
=
o
.
m_op
;
if
(
o
.
opTypeIsSet
())
j
[
"optype"
]
=
o
.
m_op
;
if
(
o
.
opTypeIsSet
())
j
[
"optype"
]
=
o
.
m_op
type
;
if
(
o
.
kIsSet
())
j
[
"k"
]
=
o
.
m_k
;
}
void
from_json
(
const
nlohmann
::
json
&
j
,
imsi_context
&
o
)
{
...
...
src/udm_app/main.cpp
View file @
9ffb4d78
...
...
@@ -53,6 +53,8 @@
#include "SMFSmfRegistrationApiImpl.h"
#include "AMFRegistrationFor3GPPAccessApiImpl.h"
#include "ContextToNwdafApiImpl.hpp"
#include "options.hpp"
#include "udm_config.hpp"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment