Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-NRF
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-NRF
Commits
5fc4a166
Commit
5fc4a166
authored
Dec 08, 2020
by
Tien-Thinh Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add nrf_profile
parent
1570e879
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
385 additions
and
29 deletions
+385
-29
src/common/3gpp_23.003.h
src/common/3gpp_23.003.h
+117
-0
src/common/nrf.h
src/common/nrf.h
+71
-0
src/nrf_app/nrf_app.cpp
src/nrf_app/nrf_app.cpp
+42
-4
src/nrf_app/nrf_app.hpp
src/nrf_app/nrf_app.hpp
+33
-1
src/nrf_app/nrf_profile.cpp
src/nrf_app/nrf_profile.cpp
+19
-2
src/nrf_app/nrf_profile.hpp
src/nrf_app/nrf_profile.hpp
+90
-20
yaml/amf_registration.json
yaml/amf_registration.json
+12
-1
yaml/cmd.txt
yaml/cmd.txt
+1
-1
No files found.
src/common/3gpp_23.003.h
0 → 100755
View file @
5fc4a166
/*
* 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
*/
/*! \file 3gpp_23.003.h
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_3GPP_23_003_SEEN
#define FILE_3GPP_23_003_SEEN
#include <stdint.h>
typedef
struct
plmn_s
{
uint8_t
mcc_digit2
:
4
;
uint8_t
mcc_digit1
:
4
;
uint8_t
mcc_digit3
:
4
;
uint8_t
mnc_digit3
:
4
;
uint8_t
mnc_digit2
:
4
;
uint8_t
mnc_digit1
:
4
;
}
plmn_t
;
#define INVALID_TAC_0000 (uint16_t)0x0000
#define INVALID_TAC_FFFE (uint16_t)0xFFFE
#define INVALID_TAC (uint32_t)0x00000000
#define INVALID_TMSI UINT32_MAX
/*!< \brief The network shall not allocate a TMSI with all 32 bits equal to 1
(this is because the TMSI must be stored in the SIM, and the SIM uses 4 octets with all bits
equal to 1 to indicate that no valid TMSI is available). */
typedef
uint16_t
tac_t
;
typedef
struct
tai_s
{
plmn_t
plmn
;
/*!< \brief <MCC> + <MNC> */
tac_t
tac
;
/*!< \brief Tracking Area Code */
}
tai_t
;
typedef
struct
eci_s
{
uint32_t
gnb_id
:
20
;
uint32_t
cell_id
:
8
;
uint32_t
empty
:
4
;
}
ci_t
;
typedef
struct
cgi_s
{
plmn_t
plmn
;
ci_t
cell_identity
;
//28 bits
}
cgi_t
;
typedef
struct
nr_tai_s
/*5G ADD it*/
{
plmn_t
plmn
;
uint32_t
tac
:
24
;
}
nr_tai_t
;
typedef
struct
nr_cell_identity_s
/*5G ADD it */
{
uint32_t
gnb_id
;
uint8_t
cell_id
:
4
;
}
nr_cell_identity_t
;
typedef
struct
nr_cgi_s
/*5G ADD it */
{
plmn_t
plmn
;
nr_cell_identity_t
cell_identity
;
}
nr_cgi_t
;
typedef
struct
fiveG_s_tmsi_s
/*5G ADD it */
{
uint16_t
amf_set_id
:
10
;
uint8_t
amf_pointer
:
6
;
uint32_t
fiveG_s_tmsi
;
//32
}
fiveG_s_tmsi_t
;
typedef
struct
fiveG_s_gua_s
/*5G ADD it */
{
plmn_t
plmn
;
uint8_t
region_id
;
uint16_t
amf_set_id
:
10
;
uint8_t
amf_pointer
:
6
;
}
fiveG_s_gua_t
;
typedef
struct
amf_set_id_s
/*5G ADD it*/
{
uint16_t
amf_set_id
:
10
;
}
amf_set_id_t
;
typedef
struct
allowed_nssai
/*5G ADD it*/
{
uint8_t
sST
;
uint32_t
sD
:
24
;
}
allowed_nssai
;
typedef
struct
allowed_nssai_s
/*5G ADD it*/
{
allowed_nssai
*
s_nssai
;
uint32_t
count
;
}
allowed_nssai_t
;
#endif
src/common/nrf.h
View file @
5fc4a166
...
...
@@ -21,7 +21,78 @@
#ifndef FILE_NRF_SEEN
#define FILE_NRF_SEEN
#include "3gpp_23.003.h"
#define HEART_BEAT_TIMER 10
typedef
enum
nf_type_s
{
NF_TYPE_NRF
=
0
,
NF_TYPE_AMF
=
1
,
NF_TYPE_SMF
=
2
,
NF_TYPE_AUSF
=
3
,
NF_TYPE_NEF
=
4
,
NF_TYPE_PCF
=
5
,
NF_TYPE_SMSF
=
6
,
NF_TYPE_NSSF
=
7
,
NF_TYPE_UDR
=
8
,
NF_TYPE_LMF
=
9
,
NF_TYPE_GMLC
=
10
,
NF_TYPE_5G_EIR
=
11
,
NF_TYPE_SEPP
=
12
,
NF_TYPE_UPF
=
13
,
NF_TYPE_N3IWF
=
14
,
NF_TYPE_AF
=
15
,
NF_TYPE_UDSF
=
16
,
NF_TYPE_BSF
=
17
,
NF_TYPE_CHF
=
18
,
NF_TYPE_NWDAF
=
19
,
NF_TYPE_UNKNOWN
=
20
}
nf_type_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
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
;
std
::
vector
<
guami_t
>
guami_list
;
}
amf_info_t
;
#endif
src/nrf_app/nrf_app.cpp
View file @
5fc4a166
...
...
@@ -43,19 +43,57 @@ nrf_app::nrf_app(const std::string &config_file) {
Logger
::
nrf_app
().
startup
(
"Started"
);
}
//------------------------------------------------------------------------------
void
nrf_app
::
handle_nf_instance_registration_request
(
const
std
::
string
&
nfInstanceID
,
oai
::
nrf
::
model
::
NFProfile
&
nf_profile
,
int
&
http_code
,
const
uint8_t
http_version
)
{
const
std
::
string
&
nf_instance_id
,
oai
::
nrf
::
model
::
NFProfile
&
nf_profile
,
int
&
http_code
,
const
uint8_t
http_version
)
{
Logger
::
nrf_app
().
info
(
"Handle a NF Instance Registration Request (HTTP version %d)"
,
http_version
);
//Check if nfInstanceID is a valid UUID (version 4)
//TODO
//Create NF and store
std
::
shared_ptr
<
amf_profile
>
sa
=
{
};
if
(
find_nf_profile
(
nf_instance_id
,
sa
))
{
//if a profile exist with this ID, return error
}
else
{
//create
Logger
::
nrf_app
().
debug
(
"Create a new NF Profile with ID %s"
,
nf_instance_id
);
sa
=
std
::
shared_ptr
<
amf_profile
>
(
new
amf_profile
(
nf_instance_id
));
//sa.get()->
add_nf_profile
(
nf_instance_id
,
sa
);
}
//location header - URI of created resource: can be used with ID - UUID
}
//------------------------------------------------------------------------------
bool
nrf_app
::
add_nf_profile
(
const
std
::
string
&
profile_id
,
const
std
::
shared_ptr
<
nrf_profile
>
&
p
)
{
return
true
;
}
//------------------------------------------------------------------------------
bool
nrf_app
::
find_nf_profile
(
const
std
::
string
&
profile_id
,
const
std
::
shared_ptr
<
nrf_profile
>
&
snp
)
{
//TODO
return
true
;
}
//------------------------------------------------------------------------------
bool
nrf_app
::
remove_nf_profile
(
std
::
shared_ptr
<
nrf_profile
>
&
snp
)
{
//TODO
return
true
;
}
//------------------------------------------------------------------------------
bool
nrf_app
::
remove_nf_profile
(
std
::
string
&
profile_id
)
{
//TODO
return
true
;
}
src/nrf_app/nrf_app.hpp
View file @
5fc4a166
...
...
@@ -45,11 +45,43 @@ class nrf_app {
void
operator
=
(
nrf_app
const
&
)
=
delete
;
void
handle_nf_instance_registration_request
(
const
std
::
string
&
nf
InstanceID
,
const
std
::
string
&
nf
_instance_id
,
oai
::
nrf
::
model
::
NFProfile
&
nf_profile
,
int
&
http_code
,
const
uint8_t
http_version
);
/*
* Insert a nrf profile
* @param [const std::string &] profile_id: Profile ID
* @param [std::shared_ptr<nrf_profile> &] p: profile to be added
* @return true if successful, otherwise, return false
*/
bool
add_nf_profile
(
const
std
::
string
&
profile_id
,
const
std
::
shared_ptr
<
nrf_profile
>
&
p
);
/*
* Find a nf profile with its ID
* @param [const std::string &] profile_id: Profile ID
* @param [std::shared_ptr<nrf_profile> &] snp: Stored nf profile if found
* @return void
*/
bool
find_nf_profile
(
const
std
::
string
&
profile_id
,
const
std
::
shared_ptr
<
nrf_profile
>
&
snp
);
/*
* Remove a nf profile from the list
* @param [std::shared_ptr<nrf_profile> &] snp: profile to be removed
* @return true if successful, otherwise, return false
*/
bool
remove_nf_profile
(
std
::
shared_ptr
<
nrf_profile
>
&
snp
);
/*
* Remove a nf profile from the list
* @param [std::string &] profile_id: ID of the profile to be removed
* @return true if successful, otherwise, return false
*/
bool
remove_nf_profile
(
std
::
string
&
profile_id
);
private:
std
::
map
<
std
::
string
,
std
::
shared_ptr
<
nrf_profile
>>
instance_id2nrf_profile
;
mutable
std
::
shared_mutex
m_instance_id2nrf_profile
;
...
...
src/nrf_app/nrf_profile.cpp
View file @
5fc4a166
...
...
@@ -29,10 +29,27 @@
#include "nrf_profile.hpp"
using
namespace
std
;
using
namespace
oai
::
nrf
;
//------------------------------------------------------------------------------
void
nrf_profile
::
set_nf_instance_id
(
const
std
::
string
&
instance_id
)
{
nf_instance_id
=
instance_id
;
}
//------------------------------------------------------------------------------
void
nrf_profile
::
get_nf_instance_id
(
std
::
string
&
instance_id
)
const
{
instance_id
=
nf_instance_id
;
}
//------------------------------------------------------------------------------
void
nrf_profile
::
set_nf_instance_name
(
const
std
::
string
&
instance_name
)
{
nf_instance_name
=
instance_name
;
}
//------------------------------------------------------------------------------
void
nrf_profile
::
get_nf_instance_name
(
std
::
string
&
instance_name
)
const
{
instance_name
=
nf_instance_name
;
}
src/nrf_app/nrf_profile.hpp
View file @
5fc4a166
...
...
@@ -30,38 +30,92 @@
#ifndef FILE_NRF_PROFILE_HPP_SEEN
#define FILE_NRF_PROFILE_HPP_SEEN
#include <arpa/inet.h>
#include <netinet/in.h>
#include <map>
//#include <mutex>
#include <shared_mutex>
#include <memory>
#include <utility>
#include <vector>
#include "nrf.h"
namespace
oai
{
namespace
nrf
{
namespace
nrf
{
using
namespace
std
;
class
nrf_profile
:
public
std
::
enable_shared_from_this
<
nrf_profile
>
{
public:
nrf_profile
()
{
nrf_profile
()
=
delete
;
nrf_profile
(
const
nf_type_t
type
)
:
heartBeat_timer
(
0
),
snssais
(),
ipv4_addresses
(),
priority
(
0
),
capacity
(
0
)
{
nf_type
=
type
;
nf_instance_name
=
""
;
nf_status
=
""
;
}
nrf_profile
(
const
std
::
string
&
id
)
:
nf_instance_id
(
id
),
heartBeat_timer
(
0
),
snssais
(),
ipv4_addresses
(),
priority
(
0
),
capacity
(
0
)
{
nf_instance_name
=
""
;
nf_status
=
""
;
nf_type
=
NF_TYPE_UNKNOWN
;
}
nrf_profile
(
nrf_profile
&
b
)
=
delete
;
private:
//lock
mutable
std
::
shared_mutex
m_nrf_profile
;
/*
* Set NF instance ID
* @param [const std::string &] instance_id: instance id
* @return void
*/
void
set_nf_instance_id
(
const
std
::
string
&
instance_id
);
/*
* Get NF instance ID
* @param [std::string &] instance_id: instance id
* @return void:
*/
void
get_nf_instance_id
(
std
::
string
&
instance_id
)
const
;
//From NFProfile (Section 6.1.6.2.2@3GPP TS 29.510 V16.0.0 (2019-06))
std
::
string
nf_instance_id
;
std
::
string
nf_instance_name
;
std
::
string
nf_type
;
std
::
string
nf_status
;
/*
* Set NF instance name
* @param [const std::string &] instance_name: instance name
* @return void
*/
void
set_nf_instance_name
(
const
std
::
string
&
instance_name
);
/*
* Get NF instance ID
* @param [std::string &] instance_name: instance name
* @return void:
*/
void
get_nf_instance_name
(
std
::
string
&
instance_name
)
const
;
/*
private:
//From NFProfile (Section 6.1.6.2.2@3GPP TS 29.510 V16.0.0 (2019-06))
std
::
string
nf_instance_id
;
std
::
string
nf_instance_name
;
nf_type_t
nf_type
;
std
::
string
nf_status
;
int32_t
heartBeat_timer
;
std
::
vector
<
snssai_t
>
snssais
;
std
::
vector
<
struct
in_addr
>
ipv4_addresses
;
uint16_t
priority
;
uint16_t
capacity
;
/*
std::vector<PlmnId> m_PlmnList;
bool m_PlmnListIsSet;
std::vector<Snssai> m_SNssais;
...
...
@@ -72,18 +126,12 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
bool m_NsiListIsSet;
std::string m_Fqdn;
bool m_FqdnIsSet;
std::vector<std::string> m_Ipv4Addresses;
bool m_Ipv4AddressesIsSet;
std::vector<Ipv6Addr> m_Ipv6Addresses;
bool m_Ipv6AddressesIsSet;
int32_t m_Capacity;
bool m_CapacityIsSet;
int32_t m_Load;
bool m_LoadIsSet;
std::string m_Locality;
bool m_LocalityIsSet;
int32_t m_Priority;
bool m_PriorityIsSet;
UdrInfo m_UdrInfo;
bool m_UdrInfoIsSet;
std::vector<UdrInfo> m_UdrInfoExt;
...
...
@@ -130,9 +178,31 @@ class nrf_profile : public std::enable_shared_from_this<nrf_profile> {
bool m_NfServicesIsSet;
std::vector<DefaultNotificationSubscription> m_DefaultNotificationSubscriptions;
bool m_DefaultNotificationSubscriptionsIsSet;
*/
*/
};
class
amf_profile
:
public
nrf_profile
{
public:
amf_profile
()
:
nrf_profile
(
NF_TYPE_AMF
)
{
amf_info
=
{
};
}
amf_profile
(
const
std
::
string
&
id
)
:
nrf_profile
(
id
)
{
amf_info
=
{
};
}
amf_profile
(
amf_profile
&
b
)
=
delete
;
private:
std
::
vector
<
amf_info_t
>
amf_info
;
};
}
}
...
...
yaml/registration.json
→
yaml/
amf_
registration.json
View file @
5fc4a166
{
"_comment"
:
"NRF Profile"
,
"_comment"
:
"NRF Profile
(6.1.6.2.2, 3GPP TS 29.510 V16.0.0 (2019-06)Type: NFProfile)
"
,
"nfInstanceId"
:
"343a924e-6494-4927-860b-d45692c95c2d"
,
"nfType"
:
"AMF"
,
"nfStatus"
:
"REGISTERED"
,
"nfInstanceName"
:
"OAI-AMF"
,
"heartBeatTimer"
:
10
,
"sNssais"
:
[
{
"sst"
:
100
,
"sd"
:
"a0a0a0"
}
],
"ipv4Addresses"
:
[
"10.10.10.1"
,
"10.10.10.2"
]
,
"priority"
:
1
,
"capacity"
:
100
,
"amfInfo"
:
{
"amfSetId"
:
"1a1a"
,
...
...
yaml/cmd.txt
View file @
5fc4a166
curl -X PUT -H "Content-Type: application/json" -d @registration.json http://192.168.1.88/nnrf-nfm/v1/nf-instances/343a924e-6494-4927-860b-d45692c95c2d
curl -X PUT -H "Content-Type: application/json" -d @
amf_
registration.json http://192.168.1.88/nnrf-nfm/v1/nf-instances/343a924e-6494-4927-860b-d45692c95c2d
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