Commit c1203c5b authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Fix merge

parents 46930143 2953cfcc
...@@ -94,6 +94,7 @@ install_fb_folly_from_source(){ ...@@ -94,6 +94,7 @@ install_fb_folly_from_source(){
git clone https://github.com/facebook/folly.git git clone https://github.com/facebook/folly.git
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
cd folly cd folly
git checkout -f v2019.11.11.00
mkdir _build && cd _build mkdir _build && cd _build
cmake .. cmake ..
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
......
...@@ -55,6 +55,8 @@ install_fmt() { ...@@ -55,6 +55,8 @@ install_fmt() {
git clone https://github.com/fmtlib/fmt.git git clone https://github.com/fmtlib/fmt.git
ret=$?;[[ $ret -ne 0 ]] && return $ret ret=$?;[[ $ret -ne 0 ]] && return $ret
cd fmt cd fmt
# Looks like since Nov 11 commits, we cannot build
git checkout -f 1936dddc3c53c1c0db55a665cf419dc7a257ba62
cmake -DFMT_TEST=FALSE . cmake -DFMT_TEST=FALSE .
ret=$?;[[ $ret -ne 0 ]] && return $ret ret=$?;[[ $ret -ne 0 ]] && return $ret
make -j `nproc` make -j `nproc`
...@@ -383,15 +385,15 @@ check_install_smf_deps() { ...@@ -383,15 +385,15 @@ check_install_smf_deps() {
ret=$?;[[ $ret -ne 0 ]] && return $ret ret=$?;[[ $ret -ne 0 ]] && return $ret
# Use fmt lib included in spdlog # Use fmt lib included in spdlog
install_fmt $1 #install_fmt $1
ret=$?;[[ $ret -ne 0 ]] && return $ret #ret=$?;[[ $ret -ne 0 ]] && return $ret
install_fb_folly_from_source $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
install_spdlog_from_git $1 $2 install_spdlog_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret ret=$?;[[ $ret -ne 0 ]] && return $ret
install_fb_folly_from_source $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
install_pistache_from_git $1 $2 install_pistache_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret ret=$?;[[ $ret -ne 0 ]] && return $ret
......
...@@ -346,7 +346,7 @@ pipeline { ...@@ -346,7 +346,7 @@ pipeline {
myShCmd('docker run --name ci-test-amf-client -d test-amf-client:test-deploy /bin/bash -c "sleep infinity"', new_host_flag, new_host_user, new_host) myShCmd('docker run --name ci-test-amf-client -d test-amf-client:test-deploy /bin/bash -c "sleep infinity"', new_host_flag, new_host_user, new_host)
myShCmd('docker network connect ci-sbi ci-test-amf-client', new_host_flag, new_host_user, new_host) myShCmd('docker network connect ci-sbi ci-test-amf-client', new_host_flag, new_host_user, new_host)
// SPGWU as UPF // SPGWU as UPF
myShCmd('docker run --privileged --name ci-oai-spgwu -d oai-spgwu-tiny:develop /bin/bash -c "sleep infinity"', new_host_flag, new_host_user, new_host) myShCmd('docker run --privileged --name ci-oai-spgwu --entrypoint "/bin/bash" -d oai-spgwu-tiny:develop -c "sleep infinity"', new_host_flag, new_host_user, new_host)
// N4 --> eth1 // N4 --> eth1
myShCmd('docker network connect ci-n4 ci-oai-spgwu', new_host_flag, new_host_user, new_host) myShCmd('docker network connect ci-n4 ci-oai-spgwu', new_host_flag, new_host_user, new_host)
......
...@@ -104,60 +104,90 @@ class HtmlReport(): ...@@ -104,60 +104,90 @@ class HtmlReport():
self.file.write(' <br>\n') self.file.write(' <br>\n')
# Build Info Summary # Build Info Summary
self.file.write(' <table class="table-bordered" width = "80%" align = "center" border = "1">\n') buildSummary = ''
self.file.write(' <tr>\n') buildSummary += ' <table class="table-bordered" width = "80%" align = "center" border = "1">\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-time"></span> Build Start Time</td>\n') buildSummary += ' <tr>\n'
buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-time"></span> Build Start Time</td>\n'
#date_formatted = re.sub('\..*', '', self.created) #date_formatted = re.sub('\..*', '', self.created)
self.file.write(' <td>' + self.job_start_time + '</td>\n') buildSummary += ' <td>' + self.job_start_time + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-wrench"></span> Build Trigger</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-wrench"></span> Build Trigger</td>\n'
if self.git_pull_request: if self.git_pull_request:
self.file.write(' <td>Pull Request</td>\n') buildSummary += ' <td>Pull Request</td>\n'
else: else:
self.file.write(' <td>Push Event</td>\n') buildSummary += ' <td>Push Event</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-cloud-upload"></span> GIT Repository</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-cloud-upload"></span> GIT Repository</td>\n'
self.file.write(' <td><a href="' + self.git_url + '">' + self.git_url + '</a></td>\n') buildSummary += ' <td><a href="' + self.git_url + '">' + self.git_url + '</a></td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
if self.git_pull_request: if self.git_pull_request:
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-log-out"></span> Source Branch</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-log-out"></span> Source Branch</td>\n'
self.file.write(' <td>' + self.git_src_branch + '</td>\n') buildSummary += ' <td>' + self.git_src_branch + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-tag"></span> Source Commit ID</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-tag"></span> Source Commit ID</td>\n'
self.file.write(' <td>' + self.git_src_commit + '</td>\n') buildSummary += ' <td>' + self.git_src_commit + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
if (self.git_src_commit_msg is not None): if (self.git_src_commit_msg is not None):
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-comment"></span> Source Commit Message</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-comment"></span> Source Commit Message</td>\n'
self.file.write(' <td>' + self.git_src_commit_msg + '</td>\n') buildSummary += ' <td>' + self.git_src_commit_msg + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-log-in"></span> Target Branch</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-log-in"></span> Target Branch</td>\n'
self.file.write(' <td>' + self.git_target_branch + '</td>\n') buildSummary += ' <td>' + self.git_target_branch + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-tag"></span> Target Commit ID</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-tag"></span> Target Commit ID</td>\n'
self.file.write(' <td>' + self.git_target_commit + '</td>\n') buildSummary += ' <td>' + self.git_target_commit + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
else: else:
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-tree-deciduous"></span> Branch</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-tree-deciduous"></span> Branch</td>\n'
self.file.write(' <td>' + self.git_src_branch + '</td>\n') buildSummary += ' <td>' + self.git_src_branch + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-tag"></span> Commit ID</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-tag"></span> Commit ID</td>\n'
self.file.write(' <td>' + self.git_src_commit + '</td>\n') buildSummary += ' <td>' + self.git_src_commit + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
if (self.git_src_commit_msg is not None): if (self.git_src_commit_msg is not None):
self.file.write(' <tr>\n') buildSummary += ' <tr>\n'
self.file.write(' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-comment"></span> Commit Message</td>\n') buildSummary += ' <td bgcolor="lightcyan" > <span class="glyphicon glyphicon-comment"></span> Commit Message</td>\n'
self.file.write(' <td>' + self.git_src_commit_msg + '</td>\n') buildSummary += ' <td>' + self.git_src_commit_msg + '</td>\n'
self.file.write(' </tr>\n') buildSummary += ' </tr>\n'
self.file.write(' </table>\n') buildSummary += ' </table>\n'
self.file.write(' <br>\n') buildSummary += ' <br>\n'
self.file.write(buildSummary)
cwd = os.getcwd()
if os.path.isfile(cwd + '/ds_tester_results_oai_cn5g.html'):
newEpcReport = open(cwd + '/ds_tester_results_oai_cn5g_new.html', 'w')
buildSummaryDone = True
with open(cwd + '/ds_tester_results_oai_cn5g.html', 'r') as originalEpcReport:
for line in originalEpcReport:
result = re.search('DS Tester Summary', line)
if (result is not None) and buildSummaryDone:
newEpcReport.write(buildSummary)
buildSummaryDone = False
newEpcReport.write(line)
originalEpcReport.close()
newEpcReport.close()
os.rename(cwd + '/ds_tester_results_oai_cn5g_new.html', cwd + '/ds_tester_results_oai_cn5g.html')
if os.path.isfile(cwd + '/deploy_results_oai_cn5g.html'):
newEpcReport = open(cwd + '/deploy_results_oai_cn5g_new.html', 'w')
buildSummaryDone = True
with open(cwd + '/deploy_results_oai_cn5g.html', 'r') as originalEpcReport:
for line in originalEpcReport:
result = re.search('Deployment Summary', line)
if (result is not None) and buildSummaryDone:
newEpcReport.write(buildSummary)
buildSummaryDone = False
newEpcReport.write(line)
originalEpcReport.close()
newEpcReport.close()
os.rename(cwd + '/deploy_results_oai_cn5g_new.html', cwd + '/deploy_results_oai_cn5g.html')
def generateFooter(self): def generateFooter(self):
self.file.write(' <div class="well well-lg">End of Build Report -- Copyright <span class="glyphicon glyphicon-copyright-mark"></span> 2020 <a href="http://www.openairinterface.org/">OpenAirInterface</a>. All Rights Reserved.</div>\n') self.file.write(' <div class="well well-lg">End of Build Report -- Copyright <span class="glyphicon glyphicon-copyright-mark"></span> 2020 <a href="http://www.openairinterface.org/">OpenAirInterface</a>. All Rights Reserved.</div>\n')
......
This diff is collapsed.
...@@ -214,6 +214,9 @@ constexpr auto CURL_MIME_BOUNDARY = "----Boundary"; ...@@ -214,6 +214,9 @@ constexpr auto CURL_MIME_BOUNDARY = "----Boundary";
//for PFCP //for PFCP
constexpr uint64_t SECONDS_SINCE_FIRST_EPOCH = 2208988800; constexpr uint64_t SECONDS_SINCE_FIRST_EPOCH = 2208988800;
//8.22 Fully Qualified TEID (F-TEID) - 3GPP TS 29.274 V16.0.0
#define TEID_GRE_KEY_LENGTH 4
......
...@@ -969,6 +969,13 @@ pfcp_ie * pfcp_ie::new_pfcp_ie_from_stream(std::istream& is) { ...@@ -969,6 +969,13 @@ pfcp_ie * pfcp_ie::new_pfcp_ie_from_stream(std::istream& is) {
// return ie; // return ie;
// } // }
// break; // break;
case PFCP_IE_3GPP_INTERFACE_TYPE: {
pfcp_3gpp_interface_type_ie *ie = new pfcp_3gpp_interface_type_ie(tlv);
ie->load_from(is);
return ie;
}
break;
default: default:
Logger::pfcp().error("Unknown PFCP IE type %d (length %d)", tlv.get_type(), tlv.get_length()); Logger::pfcp().error("Unknown PFCP IE type %d (length %d)", tlv.get_type(), tlv.get_length());
return nullptr; return nullptr;
......
...@@ -7782,6 +7782,60 @@ public: ...@@ -7782,6 +7782,60 @@ public:
// } // }
//}; //};
// IE 3gpp_interface_type
class pfcp_3gpp_interface_type_ie : public pfcp_ie {
public:
struct {
uint8_t spare :2;
uint8_t _3gpp_interface_type :6;
} interface_type;
union {
struct {
uint8_t spare :2;
uint8_t _3gpp_interface_type :6;
} bf;
uint8_t b;
} u1;
//--------
explicit pfcp_3gpp_interface_type_ie(const pfcp::_3gpp_interface_type_t& b) : pfcp_ie(PFCP_IE_3GPP_INTERFACE_TYPE){
u1.b = b.interface_type_value;
tlv.set_length(1);
}
//--------
pfcp_3gpp_interface_type_ie() : pfcp_ie(PFCP_IE_3GPP_INTERFACE_TYPE){
}
//--------
pfcp_3gpp_interface_type_ie(const pfcp_tlv& t) : pfcp_ie(t) {
};
//--------
void to_core_type(pfcp::_3gpp_interface_type_t& b) {
b.interface_type_value = u1.bf._3gpp_interface_type;
}
//--------
void dump_to(std::ostream& os) {
tlv.dump_to(os);
os.write(reinterpret_cast<const char*>(&u1.b), sizeof(u1.b));
}
//--------
void load_from(std::istream& is) {
if (tlv.get_length() != sizeof(interface_type)) {
throw pfcp_tlv_bad_length_exception(tlv.type, tlv.get_length(), __FILE__, __LINE__);
}
is.read(reinterpret_cast<char*>(&u1.b), sizeof(u1.b));
}
//--------
void to_core_type(pfcp_ies_container& s) {
pfcp::_3gpp_interface_type_t v = {};
to_core_type(v);
s.set(v);
}
};
//------------------------------------- //-------------------------------------
// IE PDI // IE PDI
class pfcp_pdi_ie : public pfcp_grouped_ie { class pfcp_pdi_ie : public pfcp_grouped_ie {
......
This diff is collapsed.
...@@ -229,8 +229,7 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const pfcp_heartbeat_ ...@@ -229,8 +229,7 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const pfcp_heartbeat_
pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc)); pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number())); trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
//udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest); udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number(); return msg.get_sequence_number();
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -255,11 +254,7 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const pfcp_associatio ...@@ -255,11 +254,7 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const pfcp_associatio
pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc)); pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number())); trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
//TTN: temporary fix to be able to work with UPF from dsTester (should be removed later) udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
//TTN: temporary fix to be able to work with UPF from dsTester (should be removed later)
//udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number(); return msg.get_sequence_number();
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -284,10 +279,7 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const pfcp_associatio ...@@ -284,10 +279,7 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const pfcp_associatio
pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc)); pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number())); trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
//TTN: temporary fix to be able to work with UPF from dsTester (should be removed later) udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
//udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number(); return msg.get_sequence_number();
} }
////------------------------------------------------------------------------------ ////------------------------------------------------------------------------------
...@@ -364,9 +356,7 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid, ...@@ -364,9 +356,7 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid,
pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc)); pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number())); trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
//TTN: temporary fix to be able to work with UPF from dsTester (should be removed later) udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
//udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number(); return msg.get_sequence_number();
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -392,9 +382,7 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid, ...@@ -392,9 +382,7 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid,
pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc)); pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number())); trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
//TTN: temporary fix to be able to work with UPF from dsTester (should be removed later) udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
//udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number(); return msg.get_sequence_number();
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -420,9 +408,7 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid, ...@@ -420,9 +408,7 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid,
pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc)); pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number())); trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
//TTN: temporary fix to be able to work with UPF from dsTester (should be removed later) udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
//udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number(); return msg.get_sequence_number();
} }
////------------------------------------------------------------------------------ ////------------------------------------------------------------------------------
...@@ -474,9 +460,7 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid, ...@@ -474,9 +460,7 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid,
pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc)); pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number())); trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
//TTN: temporary fix to be able to work with UPF from dsTester (should be removed later) udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
//udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number(); return msg.get_sequence_number();
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -502,9 +486,7 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid, ...@@ -502,9 +486,7 @@ uint32_t pfcp_l4_stack::send_request(const endpoint& dest, const uint64_t seid,
pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc)); pending_procedures.insert(std::pair<uint32_t, pfcp_procedure>(msg.get_sequence_number(), proc));
trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number())); trxn_id2seq_num.insert(std::pair<uint64_t, uint32_t>(proc.trxn_id, msg.get_sequence_number()));
//TTN: temporary fix to be able to work with UPF from dsTester (should be removed later) udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
//udp_s_allocated.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
udp_s_8805.async_send_to(reinterpret_cast<const char*>(bstream.c_str()), bstream.length(), dest);
return msg.get_sequence_number(); return msg.get_sequence_number();
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -245,7 +245,8 @@ bool smf_pdu_session::get_default_qos_flow(smf_qos_flow &flow) { ...@@ -245,7 +245,8 @@ bool smf_pdu_session::get_default_qos_flow(smf_qos_flow &flow) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void smf_pdu_session::get_qos_flows(std::vector<smf_qos_flow> &flows) { void smf_pdu_session::get_qos_flows(std::vector<smf_qos_flow> &flows) {
std::unique_lock lock(m_pdu_session_mutex);
std::shared_lock lock(m_pdu_session_mutex);
flows.clear(); flows.clear();
for (auto it : qos_flows) { for (auto it : qos_flows) {
flows.push_back(it.second); flows.push_back(it.second);
...@@ -479,7 +480,7 @@ void smf_pdu_session::update_qos_rule(const QOSRulesIE &qos_rule) { ...@@ -479,7 +480,7 @@ void smf_pdu_session::update_qos_rule(const QOSRulesIE &qos_rule) {
uint8_t rule_id = qos_rule.qosruleidentifer; uint8_t rule_id = qos_rule.qosruleidentifer;
if ((rule_id >= QOS_RULE_IDENTIFIER_FIRST ) if ((rule_id >= QOS_RULE_IDENTIFIER_FIRST )
and (rule_id <= QOS_RULE_IDENTIFIER_LAST )) { and (rule_id <= QOS_RULE_IDENTIFIER_LAST )) {
std::unique_lock lock(m_pdu_session_mutex);
if (qos_rules.count(rule_id) > 0) { if (qos_rules.count(rule_id) > 0) {
lock.lock(); // Lock it here lock.lock(); // Lock it here
qos_rules.erase(rule_id); qos_rules.erase(rule_id);
...@@ -503,6 +504,7 @@ void smf_pdu_session::mark_qos_rule_to_be_synchronised(const uint8_t rule_id) { ...@@ -503,6 +504,7 @@ void smf_pdu_session::mark_qos_rule_to_be_synchronised(const uint8_t rule_id) {
std::unique_lock lock(m_pdu_session_mutex, std::defer_lock); // Do not lock it first std::unique_lock lock(m_pdu_session_mutex, std::defer_lock); // Do not lock it first
if ((rule_id >= QOS_RULE_IDENTIFIER_FIRST ) if ((rule_id >= QOS_RULE_IDENTIFIER_FIRST )
and (rule_id <= QOS_RULE_IDENTIFIER_LAST )) { and (rule_id <= QOS_RULE_IDENTIFIER_LAST )) {
std::unique_lock lock(m_pdu_session_mutex);
if (qos_rules.count(rule_id) > 0) { if (qos_rules.count(rule_id) > 0) {
lock.lock(); // Lock it here lock.lock(); // Lock it here
qos_rules_to_be_synchronised.push_back(rule_id); qos_rules_to_be_synchronised.push_back(rule_id);
...@@ -531,6 +533,7 @@ void smf_pdu_session::add_qos_rule(const QOSRulesIE &qos_rule) { ...@@ -531,6 +533,7 @@ void smf_pdu_session::add_qos_rule(const QOSRulesIE &qos_rule) {
if ((rule_id >= QOS_RULE_IDENTIFIER_FIRST ) if ((rule_id >= QOS_RULE_IDENTIFIER_FIRST )
and (rule_id <= QOS_RULE_IDENTIFIER_LAST )) { and (rule_id <= QOS_RULE_IDENTIFIER_LAST )) {
std::unique_lock lock(m_pdu_session_mutex);
if (qos_rules.count(rule_id) > 0) { if (qos_rules.count(rule_id) > 0) {
Logger::smf_app().error("Failed to add rule (Id %d), rule existed", Logger::smf_app().error("Failed to add rule (Id %d), rule existed",
rule_id); rule_id);
...@@ -2180,25 +2183,24 @@ void smf_context::handle_pdu_session_update_sm_context_request( ...@@ -2180,25 +2183,24 @@ void smf_context::handle_pdu_session_update_sm_context_request(
} }
//store AN Tunnel Info + list of accepted QFIs //store AN Tunnel Info + list of accepted QFIs
fteid_t dl_teid = { }; pfcp::fteid_t dl_teid = { };
memcpy( memcpy(
&dl_teid.teid_gre_key, &dl_teid.teid,
decoded_msg->dLQosFlowPerTNLInformation.uPTransportLayerInformation decoded_msg->dLQosFlowPerTNLInformation.uPTransportLayerInformation
.choice.gTPTunnel->gTP_TEID.buf, .choice.gTPTunnel->gTP_TEID.buf,
sizeof(struct in_addr)); TEID_GRE_KEY_LENGTH);
memcpy( memcpy(
&dl_teid.ipv4_address, &dl_teid.ipv4_address,
decoded_msg->dLQosFlowPerTNLInformation.uPTransportLayerInformation decoded_msg->dLQosFlowPerTNLInformation.uPTransportLayerInformation
.choice.gTPTunnel->transportLayerAddress.buf, .choice.gTPTunnel->transportLayerAddress.buf,
4); 4);
dl_teid.teid_gre_key = ntohl(dl_teid.teid_gre_key); dl_teid.teid = ntohl(dl_teid.teid);
dl_teid.interface_type = S1_U_ENODEB_GTP_U;
dl_teid.v4 = 1; //Only V4 for now dl_teid.v4 = 1; //Only V4 for now
smreq->req.set_dl_fteid(dl_teid); smreq->req.set_dl_fteid(dl_teid);
Logger::smf_app().debug("DL GTP F-TEID (AN F-TEID) " "0x%" PRIx32 " ", Logger::smf_app().debug("DL GTP F-TEID (AN F-TEID) " "0x%" PRIx32 " ",
dl_teid.teid_gre_key); dl_teid.teid);
Logger::smf_app().debug("uPTransportLayerInformation (AN IP Addr) %s", Logger::smf_app().debug("uPTransportLayerInformation (AN IP Addr) %s",
conv::toString(dl_teid.ipv4_address).c_str()); conv::toString(dl_teid.ipv4_address).c_str());
...@@ -2301,20 +2303,19 @@ void smf_context::handle_pdu_session_update_sm_context_request( ...@@ -2301,20 +2303,19 @@ void smf_context::handle_pdu_session_update_sm_context_request(
//see section 8.2.3 (PDU Session Resource Modify) @3GPP TS 38.413 //see section 8.2.3 (PDU Session Resource Modify) @3GPP TS 38.413
//if dL_NGU_UP_TNLInformation is included, it shall be considered as the new DL transport layer addr for the PDU session (should be verified) //if dL_NGU_UP_TNLInformation is included, it shall be considered as the new DL transport layer addr for the PDU session (should be verified)
//TODO: may include uL_NGU_UP_TNLInformation (mapping between each new DL transport layer address and the corresponding UL transport layer address) //TODO: may include uL_NGU_UP_TNLInformation (mapping between each new DL transport layer address and the corresponding UL transport layer address)
fteid_t dl_teid; pfcp::fteid_t dl_teid;
memcpy( memcpy(
&dl_teid.teid_gre_key, &dl_teid.teid,
decoded_msg->dL_NGU_UP_TNLInformation->choice.gTPTunnel->gTP_TEID decoded_msg->dL_NGU_UP_TNLInformation->choice.gTPTunnel->gTP_TEID
.buf, .buf,
sizeof(struct in_addr)); TEID_GRE_KEY_LENGTH);
memcpy( memcpy(
&dl_teid.ipv4_address, &dl_teid.ipv4_address,
decoded_msg->dL_NGU_UP_TNLInformation->choice.gTPTunnel decoded_msg->dL_NGU_UP_TNLInformation->choice.gTPTunnel
->transportLayerAddress.buf, ->transportLayerAddress.buf,
4); 4);
dl_teid.teid_gre_key = ntohl(dl_teid.teid_gre_key); dl_teid.teid = ntohl(dl_teid.teid);
dl_teid.interface_type = S1_U_ENODEB_GTP_U;
dl_teid.v4 = 1; //Only v4 for now dl_teid.v4 = 1; //Only v4 for now
smreq->req.set_dl_fteid(dl_teid); smreq->req.set_dl_fteid(dl_teid);
...@@ -2754,6 +2755,7 @@ void smf_context::insert_dnn_subscription( ...@@ -2754,6 +2755,7 @@ void smf_context::insert_dnn_subscription(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool smf_context::is_dnn_snssai_subscription_data(const std::string &dnn, bool smf_context::is_dnn_snssai_subscription_data(const std::string &dnn,
const snssai_t &snssai) { const snssai_t &snssai) {
std::unique_lock<std::recursive_mutex> lock(m_context);
if (dnn_subscriptions.count((uint8_t) snssai.sST) > 0) { if (dnn_subscriptions.count((uint8_t) snssai.sST) > 0) {
std::shared_ptr<session_management_subscription> ss = dnn_subscriptions.at( std::shared_ptr<session_management_subscription> ss = dnn_subscriptions.at(
(uint8_t) snssai.sST); (uint8_t) snssai.sST);
...@@ -2771,7 +2773,7 @@ bool smf_context::find_dnn_subscription( ...@@ -2771,7 +2773,7 @@ bool smf_context::find_dnn_subscription(
std::shared_ptr<session_management_subscription> &ss) { std::shared_ptr<session_management_subscription> &ss) {
Logger::smf_app().info("Find a DNN Subscription with key: %d, map size %d", Logger::smf_app().info("Find a DNN Subscription with key: %d, map size %d",
(uint8_t) snssai.sST, dnn_subscriptions.size()); (uint8_t) snssai.sST, dnn_subscriptions.size());
//std::unique_lock<std::recursive_mutex> lock(m_context); std::unique_lock<std::recursive_mutex> lock(m_context);
if (dnn_subscriptions.count((uint8_t) snssai.sST) > 0) { if (dnn_subscriptions.count((uint8_t) snssai.sST) > 0) {
ss = dnn_subscriptions.at((uint8_t) snssai.sST); ss = dnn_subscriptions.at((uint8_t) snssai.sST);
return true; return true;
...@@ -2851,6 +2853,7 @@ bool smf_context::find_pdu_session(const pfcp::pdr_id_t &pdr_id, ...@@ -2851,6 +2853,7 @@ bool smf_context::find_pdu_session(const pfcp::pdr_id_t &pdr_id,
pfcp::qfi_t &qfi, pfcp::qfi_t &qfi,
std::shared_ptr<dnn_context> &sd, std::shared_ptr<dnn_context> &sd,
std::shared_ptr<smf_pdu_session> &sp) { std::shared_ptr<smf_pdu_session> &sp) {
std::unique_lock<std::recursive_mutex> lock(m_context);
for (auto it : dnns) { for (auto it : dnns) {
for (auto session : it.get()->pdu_sessions) { for (auto session : it.get()->pdu_sessions) {
smf_qos_flow flow = { }; smf_qos_flow flow = { };
...@@ -2902,7 +2905,6 @@ bool dnn_context::find_pdu_session( ...@@ -2902,7 +2905,6 @@ bool dnn_context::find_pdu_session(
const uint32_t pdu_session_id, const uint32_t pdu_session_id,
std::shared_ptr<smf_pdu_session> &pdu_session) { std::shared_ptr<smf_pdu_session> &pdu_session) {
pdu_session = { }; pdu_session = { };
std::shared_lock lock(m_context); std::shared_lock lock(m_context);
for (auto it : pdu_sessions) { for (auto it : pdu_sessions) {
if (pdu_session_id == it->pdu_session_id) { if (pdu_session_id == it->pdu_session_id) {
......
...@@ -104,8 +104,8 @@ class smf_qos_flow { ...@@ -104,8 +104,8 @@ class smf_qos_flow {
std::string toString() const; std::string toString() const;
pfcp::qfi_t qfi; //QoS Flow Identifier pfcp::qfi_t qfi; //QoS Flow Identifier
fteid_t ul_fteid; //fteid of UPF pfcp::fteid_t ul_fteid; //fteid of UPF
fteid_t dl_fteid; //fteid of AN pfcp::fteid_t dl_fteid; //fteid of AN
pfcp::pdr_id_t pdr_id_ul; // Packet Detection Rule ID, UL pfcp::pdr_id_t pdr_id_ul; // Packet Detection Rule ID, UL
pfcp::pdr_id_t pdr_id_dl; // Packet Detection Rule ID, DL pfcp::pdr_id_t pdr_id_dl; // Packet Detection Rule ID, DL
pfcp::precedence_t precedence; pfcp::precedence_t precedence;
...@@ -434,7 +434,8 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> { ...@@ -434,7 +434,8 @@ class smf_pdu_session : public std::enable_shared_from_this<smf_pdu_session> {
uint8_t number_of_supported_packet_filters; //number_of_supported_packet_filters uint8_t number_of_supported_packet_filters; //number_of_supported_packet_filters
util::uint_generator<uint32_t> qos_rule_id_generator; util::uint_generator<uint32_t> qos_rule_id_generator;
mutable std::shared_mutex m_pdu_session_mutex; // Recursive lock
mutable std::shared_mutex m_pdu_session_mutex;
}; };
...@@ -477,6 +478,8 @@ class session_management_subscription { ...@@ -477,6 +478,8 @@ class session_management_subscription {
private: private:
snssai_t single_nssai; snssai_t single_nssai;
std::map<std::string, std::shared_ptr<dnn_configuration_t>> dnn_configurations; //dnn <->dnn_configuration std::map<std::string, std::shared_ptr<dnn_configuration_t>> dnn_configurations; //dnn <->dnn_configuration
// Recursive lock
mutable std::shared_mutex m_mutex; mutable std::shared_mutex m_mutex;
}; };
......
...@@ -44,12 +44,12 @@ void qos_flow_context_updated::set_qfi(const pfcp::qfi_t &q) { ...@@ -44,12 +44,12 @@ void qos_flow_context_updated::set_qfi(const pfcp::qfi_t &q) {
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void qos_flow_context_updated::set_ul_fteid(const fteid_t &teid) { void qos_flow_context_updated::set_ul_fteid(const pfcp::fteid_t &teid) {
ul_fteid = teid; ul_fteid = teid;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void qos_flow_context_updated::set_dl_fteid(const fteid_t &teid) { void qos_flow_context_updated::set_dl_fteid(const pfcp::fteid_t &teid) {
dl_fteid = teid; dl_fteid = teid;
} }
...@@ -407,12 +407,12 @@ void pdu_session_update_sm_context_request::get_qfis( ...@@ -407,12 +407,12 @@ void pdu_session_update_sm_context_request::get_qfis(
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void pdu_session_update_sm_context_request::set_dl_fteid(const fteid_t &t) { void pdu_session_update_sm_context_request::set_dl_fteid(const pfcp::fteid_t &t) {
dl_fteid = t; dl_fteid = t;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void pdu_session_update_sm_context_request::get_dl_fteid(fteid_t &t) { void pdu_session_update_sm_context_request::get_dl_fteid(pfcp::fteid_t &t) {
t = dl_fteid; t = dl_fteid;
} }
......
...@@ -77,16 +77,16 @@ class qos_flow_context_updated { ...@@ -77,16 +77,16 @@ class qos_flow_context_updated {
void set_cause(const uint8_t cause); void set_cause(const uint8_t cause);
void set_qfi(const pfcp::qfi_t &q); void set_qfi(const pfcp::qfi_t &q);
void set_ul_fteid(const fteid_t &teid); void set_ul_fteid(const pfcp::fteid_t &teid);
void set_dl_fteid(const fteid_t &teid); void set_dl_fteid(const pfcp::fteid_t &teid);
void add_qos_rule(const QOSRulesIE &rule); void add_qos_rule(const QOSRulesIE &rule);
void set_qos_profile(const qos_profile_t &profile); void set_qos_profile(const qos_profile_t &profile);
void set_priority_level(uint8_t p); void set_priority_level(uint8_t p);
uint8_t cause_value; uint8_t cause_value;
pfcp::qfi_t qfi; pfcp::qfi_t qfi;
fteid_t ul_fteid; pfcp::fteid_t ul_fteid;
fteid_t dl_fteid; pfcp::fteid_t dl_fteid;
std::map<uint8_t, QOSRulesIE> qos_rules; std::map<uint8_t, QOSRulesIE> qos_rules;
qos_profile_t qos_profile; qos_profile_t qos_profile;
bool to_be_removed; bool to_be_removed;
...@@ -351,8 +351,8 @@ class pdu_session_update_sm_context_request : ...@@ -351,8 +351,8 @@ class pdu_session_update_sm_context_request :
void add_qfi(const pfcp::qfi_t &qfi); void add_qfi(const pfcp::qfi_t &qfi);
void add_qfi(const uint8_t &qfi); void add_qfi(const uint8_t &qfi);
void get_qfis(std::vector<pfcp::qfi_t> &q); void get_qfis(std::vector<pfcp::qfi_t> &q);
void set_dl_fteid(const fteid_t &t); void set_dl_fteid(const pfcp::fteid_t &t);
void get_dl_fteid(fteid_t &t); void get_dl_fteid(pfcp::fteid_t &t);
void set_upCnx_state(const std::string &value); void set_upCnx_state(const std::string &value);
bool upCnx_state_is_set() const; bool upCnx_state_is_set() const;
void set_rat_type(const std::string &value); void set_rat_type(const std::string &value);
...@@ -364,7 +364,7 @@ class pdu_session_update_sm_context_request : ...@@ -364,7 +364,7 @@ class pdu_session_update_sm_context_request :
private: private:
std::vector<pfcp::qfi_t> qfis; std::vector<pfcp::qfi_t> qfis;
fteid_t dl_fteid; //AN Tunnel Info pfcp::fteid_t dl_fteid; //AN Tunnel Info
std::string m_nf_instanceId; std::string m_nf_instanceId;
std::string m_an_type; std::string m_an_type;
bool m_an_type_is_set; bool m_an_type_is_set;
......
This diff is collapsed.
This diff is collapsed.
...@@ -37,10 +37,10 @@ ...@@ -37,10 +37,10 @@
namespace smf { namespace smf {
#define TASK_SMF_N4_TRIGGER_HEARTBEAT_REQUEST (0) #define TASK_SMF_N4_TRIGGER_HEARTBEAT_REQUEST (0)
#define TASK_SMF_N4_TIMEOUT_HEARTBEAT_REQUEST (1) #define TASK_SMF_N4_TIMEOUT_HEARTBEAT_REQUEST (1)
#define TASK_SMF_N4_TIMEOUT_ASSOCIATION_REQUEST (2) #define TASK_SMF_N4_TIMEOUT_ASSOCIATION_REQUEST (2)
#define TASK_SMF_N4_TIMEOUT_GRACEFUL_RELEASE_PERIOD (3)
class smf_n4 : public pfcp::pfcp_l4_stack { class smf_n4 : public pfcp::pfcp_l4_stack {
private: private:
std::thread::id thread_id; std::thread::id thread_id;
...@@ -142,6 +142,8 @@ class smf_n4 : public pfcp::pfcp_l4_stack { ...@@ -142,6 +142,8 @@ class smf_n4 : public pfcp::pfcp_l4_stack {
void send_heartbeat_response(const endpoint &r_endpoint, void send_heartbeat_response(const endpoint &r_endpoint,
const uint64_t trxn_id); const uint64_t trxn_id);
void send_release_request(std::shared_ptr<pfcp_association> &a);
void handle_receive_pfcp_msg(pfcp::pfcp_msg &msg, const endpoint &r_endpoint); void handle_receive_pfcp_msg(pfcp::pfcp_msg &msg, const endpoint &r_endpoint);
void handle_receive(char *recv_buffer, const std::size_t bytes_transferred, void handle_receive(char *recv_buffer, const std::size_t bytes_transferred,
const endpoint &r_endpoint); const endpoint &r_endpoint);
...@@ -154,7 +156,10 @@ class smf_n4 : public pfcp::pfcp_l4_stack { ...@@ -154,7 +156,10 @@ class smf_n4 : public pfcp::pfcp_l4_stack {
const endpoint &r_endpoint); const endpoint &r_endpoint);
void handle_receive_association_setup_response( void handle_receive_association_setup_response(
pfcp::pfcp_msg &msg, const endpoint &remote_endpoint); pfcp::pfcp_msg &msg, const endpoint &remote_endpoint);
void handle_receive_association_update_request(
pfcp::pfcp_msg &msg, const endpoint &remote_endpoint);
void handle_receive_association_release_response(
pfcp::pfcp_msg &msg, const endpoint &remote_endpoint);
void handle_receive_session_establishment_response( void handle_receive_session_establishment_response(
pfcp::pfcp_msg &msg, const endpoint &r_endpoint); pfcp::pfcp_msg &msg, const endpoint &r_endpoint);
void handle_receive_session_modification_response(pfcp::pfcp_msg &msg, void handle_receive_session_modification_response(pfcp::pfcp_msg &msg,
......
...@@ -58,16 +58,15 @@ void pfcp_association::notify_del_session(const pfcp::fseid_t &cp_fseid) { ...@@ -58,16 +58,15 @@ void pfcp_association::notify_del_session(const pfcp::fseid_t &cp_fseid) {
std::unique_lock<std::mutex> l(m_sessions); std::unique_lock<std::mutex> l(m_sessions);
sessions.erase(cp_fseid); sessions.erase(cp_fseid);
} }
// //------------------------------------------------------------------------------
// void pfcp_association::del_sessions()
// {
// std::unique_lock<std::mutex> l(m_sessions);
// for (std::set<pfcp::fseid_t>::iterator it=sessions.begin(); it!=sessions.end();) {
// ???->remove_pfcp_session(*it);
// sessions.erase(it++);
// }
// }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void pfcp_association::del_sessions()
{
std::unique_lock<std::mutex> l(m_sessions);
sessions.clear();
}
//------------------------------------------------------------------------------
void pfcp_association::restore_n4_sessions() { void pfcp_association::restore_n4_sessions() {
std::unique_lock<std::mutex> l(m_sessions); std::unique_lock<std::mutex> l(m_sessions);
if (sessions.size()) { if (sessions.size()) {
...@@ -136,6 +135,22 @@ bool pfcp_associations::add_association( ...@@ -136,6 +135,22 @@ bool pfcp_associations::add_association(
} }
return true; return true;
} }
//------------------------------------------------------------------------------
bool pfcp_associations::update_association(
pfcp::node_id_t &node_id, pfcp::up_function_features_s &function_features) {
std::shared_ptr<pfcp_association> sa = std::shared_ptr<pfcp_association>(
nullptr);
if (get_association(node_id, sa)) {
sa->function_features.first = true;
sa->function_features.second = function_features;
} else {
return false;
}
return true;
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
bool pfcp_associations::get_association( bool pfcp_associations::get_association(
const pfcp::node_id_t &node_id, const pfcp::node_id_t &node_id,
...@@ -193,6 +208,7 @@ void pfcp_associations::initiate_heartbeat_request(timer_id_t timer_id, ...@@ -193,6 +208,7 @@ void pfcp_associations::initiate_heartbeat_request(timer_id_t timer_id,
smf_n4_inst->send_heartbeat_request(pit->second); smf_n4_inst->send_heartbeat_request(pit->second);
} }
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void pfcp_associations::timeout_heartbeat_request(timer_id_t timer_id, void pfcp_associations::timeout_heartbeat_request(timer_id_t timer_id,
uint64_t arg2_user) { uint64_t arg2_user) {
...@@ -215,6 +231,20 @@ void pfcp_associations::timeout_heartbeat_request(timer_id_t timer_id, ...@@ -215,6 +231,20 @@ void pfcp_associations::timeout_heartbeat_request(timer_id_t timer_id,
} }
} }
} }
//------------------------------------------------------------------------------
void pfcp_associations::timeout_release_request(timer_id_t timer_id,
uint64_t arg2_user) {
size_t hash_node_id = (size_t) arg2_user;
auto pit = associations.find((int32_t) hash_node_id);
if (pit == associations.end())
return;
else {
Logger::smf_n4().info("PFCP RELEASE REQUEST hash %u", hash_node_id);
smf_n4_inst->send_release_request(pit->second);
}
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void pfcp_associations::handle_receive_heartbeat_response( void pfcp_associations::handle_receive_heartbeat_response(
const uint64_t trxn_id) { const uint64_t trxn_id) {
......
...@@ -40,6 +40,8 @@ namespace smf { ...@@ -40,6 +40,8 @@ namespace smf {
#define PFCP_ASSOCIATION_HEARTBEAT_INTERVAL_SEC 10 #define PFCP_ASSOCIATION_HEARTBEAT_INTERVAL_SEC 10
#define PFCP_ASSOCIATION_HEARTBEAT_MAX_RETRIES 2 #define PFCP_ASSOCIATION_HEARTBEAT_MAX_RETRIES 2
#define PFCP_ASSOCIATION_GRACEFUL_RELEASE_PERIOD 5
class pfcp_association { class pfcp_association {
public: public:
pfcp::node_id_t node_id; pfcp::node_id_t node_id;
...@@ -57,6 +59,7 @@ class pfcp_association { ...@@ -57,6 +59,7 @@ class pfcp_association {
bool is_restore_sessions_pending; bool is_restore_sessions_pending;
timer_id_t timer_association; timer_id_t timer_association;
timer_id_t timer_graceful_release;
explicit pfcp_association(const pfcp::node_id_t &node_id) explicit pfcp_association(const pfcp::node_id_t &node_id)
: :
...@@ -71,6 +74,7 @@ class pfcp_association { ...@@ -71,6 +74,7 @@ class pfcp_association {
trxn_id_heartbeat = 0; trxn_id_heartbeat = 0;
is_restore_sessions_pending = false; is_restore_sessions_pending = false;
timer_association = ITTI_INVALID_TIMER_ID; timer_association = ITTI_INVALID_TIMER_ID;
timer_graceful_release = ITTI_INVALID_TIMER_ID;
} }
pfcp_association(const pfcp::node_id_t &node_id, pfcp_association(const pfcp::node_id_t &node_id,
pfcp::recovery_time_stamp_t &recovery_time_stamp) pfcp::recovery_time_stamp_t &recovery_time_stamp)
...@@ -86,6 +90,7 @@ class pfcp_association { ...@@ -86,6 +90,7 @@ class pfcp_association {
trxn_id_heartbeat = 0; trxn_id_heartbeat = 0;
timer_association = ITTI_INVALID_TIMER_ID; timer_association = ITTI_INVALID_TIMER_ID;
is_restore_sessions_pending = false; is_restore_sessions_pending = false;
timer_graceful_release = ITTI_INVALID_TIMER_ID;
} }
pfcp_association(const pfcp::node_id_t &ni, pfcp::recovery_time_stamp_t &rts, pfcp_association(const pfcp::node_id_t &ni, pfcp::recovery_time_stamp_t &rts,
pfcp::up_function_features_s &uff) pfcp::up_function_features_s &uff)
...@@ -102,6 +107,7 @@ class pfcp_association { ...@@ -102,6 +107,7 @@ class pfcp_association {
trxn_id_heartbeat = 0; trxn_id_heartbeat = 0;
is_restore_sessions_pending = false; is_restore_sessions_pending = false;
timer_association = ITTI_INVALID_TIMER_ID; timer_association = ITTI_INVALID_TIMER_ID;
timer_graceful_release = ITTI_INVALID_TIMER_ID;
} }
pfcp_association(pfcp_association const &p) pfcp_association(pfcp_association const &p)
: :
...@@ -113,13 +119,14 @@ class pfcp_association { ...@@ -113,13 +119,14 @@ class pfcp_association {
num_retries_timer_heartbeat(p.num_retries_timer_heartbeat), num_retries_timer_heartbeat(p.num_retries_timer_heartbeat),
trxn_id_heartbeat(p.trxn_id_heartbeat), trxn_id_heartbeat(p.trxn_id_heartbeat),
is_restore_sessions_pending(p.is_restore_sessions_pending), is_restore_sessions_pending(p.is_restore_sessions_pending),
timer_association(0) { timer_association(0),
timer_graceful_release(0) {
} }
void notify_add_session(const pfcp::fseid_t &cp_fseid); void notify_add_session(const pfcp::fseid_t &cp_fseid);
bool has_session(const pfcp::fseid_t &cp_fseid); bool has_session(const pfcp::fseid_t &cp_fseid);
void notify_del_session(const pfcp::fseid_t &cp_fseid); void notify_del_session(const pfcp::fseid_t &cp_fseid);
//void del_sessions(); void del_sessions();
void restore_n4_sessions(); void restore_n4_sessions();
void set(const pfcp::up_function_features_s &ff) { void set(const pfcp::up_function_features_s &ff) {
function_features.first = true; function_features.first = true;
...@@ -168,6 +175,8 @@ class pfcp_associations { ...@@ -168,6 +175,8 @@ class pfcp_associations {
pfcp::recovery_time_stamp_t &recovery_time_stamp, pfcp::recovery_time_stamp_t &recovery_time_stamp,
pfcp::up_function_features_s &function_features, pfcp::up_function_features_s &function_features,
bool &restore_n4_sessions); bool &restore_n4_sessions);
bool update_association(
pfcp::node_id_t &node_id, pfcp::up_function_features_s &function_features);
bool get_association(const pfcp::node_id_t &node_id, bool get_association(const pfcp::node_id_t &node_id,
std::shared_ptr<pfcp_association> &sa) const; std::shared_ptr<pfcp_association> &sa) const;
bool get_association(const pfcp::fseid_t &cp_fseid, bool get_association(const pfcp::fseid_t &cp_fseid,
...@@ -181,6 +190,7 @@ class pfcp_associations { ...@@ -181,6 +190,7 @@ class pfcp_associations {
void initiate_heartbeat_request(timer_id_t timer_id, uint64_t arg2_user); void initiate_heartbeat_request(timer_id_t timer_id, uint64_t arg2_user);
void timeout_heartbeat_request(timer_id_t timer_id, uint64_t arg2_user); void timeout_heartbeat_request(timer_id_t timer_id, uint64_t arg2_user);
void timeout_release_request(timer_id_t timer_id, uint64_t arg2_user);
void handle_receive_heartbeat_response(const uint64_t trxn_id); void handle_receive_heartbeat_response(const uint64_t trxn_id);
bool select_up_node(pfcp::node_id_t &node_id, bool select_up_node(pfcp::node_id_t &node_id,
......
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