diff --git a/srsue/test/ttcn3/hdr/ttcn3_helpers.h b/srsue/test/ttcn3/hdr/ttcn3_helpers.h index 22333c20f..19ed29c87 100644 --- a/srsue/test/ttcn3/hdr/ttcn3_helpers.h +++ b/srsue/test/ttcn3/hdr/ttcn3_helpers.h @@ -29,7 +29,6 @@ #include "rapidjson/document.h" // rapidjson's DOM-style API #include "rapidjson/prettywriter.h" // for stringify JSON -#include "ttcn3_interfaces.h" #include #include #include @@ -43,12 +42,18 @@ using namespace rapidjson; class ttcn3_helpers { public: + typedef struct { + bool now; ///< If set to false, the TTI field contains a valid TTI + uint32_t tti; + } timing_info_t; + typedef struct { bool rb_is_srb; uint8_t rb_id; - uint32_t ul_value; - uint32_t dl_value; + uint16_t ul_value; + uint16_t dl_value; } pdcp_count_t; + typedef std::vector pdcp_count_map_t; static std::string get_ctrl_cnf(const std::string protocol_, const std::string version_, const std::string addr_) { @@ -66,7 +71,6 @@ public: conn_id.AddMember("Protocol", protocol, resp.GetAllocator()); // Version - Value ipAddr(kObjectType); Value version(version_.c_str(), resp.GetAllocator()); Value addr(addr_.c_str(), resp.GetAllocator()); diff --git a/srsue/test/ttcn3/hdr/ttcn3_interfaces.h b/srsue/test/ttcn3/hdr/ttcn3_interfaces.h index 2a8bd98fe..624215af8 100644 --- a/srsue/test/ttcn3/hdr/ttcn3_interfaces.h +++ b/srsue/test/ttcn3/hdr/ttcn3_interfaces.h @@ -24,11 +24,7 @@ #include "srslte/common/common.h" #include "srslte/interfaces/ue_interfaces.h" - -typedef struct { - bool now; ///< If set to false, the TTI field contains a valid TTI - uint32_t tti; -} timing_info_t; +#include "ttcn3_helpers.h" // Interfaces used by system interface to communicate with main component class ss_ut_interface @@ -48,32 +44,37 @@ class ss_sys_interface public: virtual void add_bcch_dlsch_pdu(const std::string cell_name, srslte::unique_byte_buffer_t pdu) = 0; virtual void add_pch_pdu(srslte::unique_byte_buffer_t pdu) = 0; + virtual void set_cell_attenuation(const ttcn3_helpers::timing_info_t timing, + const std::string cell_name, + const float attenuation) = 0; + virtual void set_cell_config(const ttcn3_helpers::timing_info_t timing, + const std::string cell_name, + const uint32_t earfcn, + const srslte_cell_t cell, + const float power) = 0; virtual void - set_cell_attenuation(const timing_info_t timing, const std::string cell_name, const float attenuation) = 0; - virtual void set_cell_config(const timing_info_t timing, - const std::string cell_name, - const uint32_t earfcn, - const srslte_cell_t cell, - const float power) = 0; - virtual void add_srb(const timing_info_t timing, const uint32_t lcid, const srslte::pdcp_config_t pdcp_config) = 0; - virtual void del_srb(const timing_info_t timing, const uint32_t lcid) = 0; + add_srb(const ttcn3_helpers::timing_info_t timing, const uint32_t lcid, const srslte::pdcp_config_t pdcp_config) = 0; + virtual void del_srb(const ttcn3_helpers::timing_info_t timing, const uint32_t lcid) = 0; virtual uint32_t get_tti() = 0; - virtual void set_as_security(const timing_info_t timing, - const uint32_t lcid, - const std::array k_rrc_enc, - const std::array k_rrc_int, - const std::array k_up_enc, - const srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo, - const srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo) = 0; - virtual void release_as_security(const timing_info_t timing) = 0; + virtual void set_as_security(const ttcn3_helpers::timing_info_t timing, + const uint32_t lcid, + const std::array k_rrc_enc, + const std::array k_rrc_int, + const std::array k_up_enc, + const srslte::CIPHERING_ALGORITHM_ID_ENUM cipher_algo, + const srslte::INTEGRITY_ALGORITHM_ID_ENUM integ_algo) = 0; + virtual void release_as_security(const ttcn3_helpers::timing_info_t timing) = 0; + virtual ttcn3_helpers::pdcp_count_map_t get_pdcp_count() = 0; }; class ss_srb_interface { public: - virtual void add_ccch_pdu(const timing_info_t timing, srslte::unique_byte_buffer_t pdu) = 0; - virtual void - add_dcch_pdu(const timing_info_t timing, uint32_t lcid, srslte::unique_byte_buffer_t pdu, bool follow_on_flag) = 0; + virtual void add_ccch_pdu(const ttcn3_helpers::timing_info_t timing, srslte::unique_byte_buffer_t pdu) = 0; + virtual void add_dcch_pdu(const ttcn3_helpers::timing_info_t timing, + uint32_t lcid, + srslte::unique_byte_buffer_t pdu, + bool follow_on_flag) = 0; virtual void reestablish_bearer(uint32_t lcid) = 0; }; diff --git a/srsue/test/ttcn3/hdr/ttcn3_sys_interface.h b/srsue/test/ttcn3/hdr/ttcn3_sys_interface.h index 43f8f23ba..4aa10f492 100644 --- a/srsue/test/ttcn3/hdr/ttcn3_sys_interface.h +++ b/srsue/test/ttcn3/hdr/ttcn3_sys_interface.h @@ -387,16 +387,7 @@ private: const Value& get = pdcp_count["Get"]; assert(get.HasMember("AllRBs")); - // prepare response to SS - std::vector bearers; - ttcn3_helpers::pdcp_count_t srb1; - srb1.rb_is_srb = true; - srb1.rb_id = 1; - srb1.dl_value = 0; - srb1.ul_value = 1; - bearers.push_back(srb1); - - std::string resp = ttcn3_helpers::get_pdcp_count_response(cell_id.GetString(), bearers); + std::string resp = ttcn3_helpers::get_pdcp_count_response(cell_id.GetString(), syssim->get_pdcp_count()); log->info("Sending %s to tester (%zd B)\n", resp.c_str(), resp.length()); send((const uint8_t*)resp.c_str(), resp.length()); diff --git a/srsue/test/ttcn3/hdr/ttcn3_syssim.h b/srsue/test/ttcn3/hdr/ttcn3_syssim.h index 1d3d3338e..10d9b8c09 100644 --- a/srsue/test/ttcn3/hdr/ttcn3_syssim.h +++ b/srsue/test/ttcn3/hdr/ttcn3_syssim.h @@ -705,11 +705,11 @@ public: void process_pdu(uint8_t* buff, uint32_t len, pdu_queue::channel_t channel) {} - void set_cell_config(const timing_info_t timing, - const std::string cell_name, - const uint32_t earfcn, - const srslte_cell_t cell, - const float power) + void set_cell_config(const ttcn3_helpers::timing_info_t timing, + const std::string cell_name, + const uint32_t earfcn, + const srslte_cell_t cell, + const float power) { if (timing.now) { set_cell_config_impl(cell_name, earfcn, cell, power); @@ -754,7 +754,7 @@ public: return false; } - void set_cell_attenuation(const timing_info_t timing, const std::string cell_name, const float value) + void set_cell_attenuation(const ttcn3_helpers::timing_info_t timing, const std::string cell_name, const float value) { if (timing.now) { set_cell_attenuation_impl(cell_name, value); @@ -818,7 +818,7 @@ public: } } - void add_ccch_pdu(const timing_info_t timing, unique_byte_buffer_t pdu) + void add_ccch_pdu(const ttcn3_helpers::timing_info_t timing, unique_byte_buffer_t pdu) { if (timing.now) { // Add to SRB0 Tx queue @@ -830,7 +830,8 @@ public: } } - void add_dcch_pdu(const timing_info_t timing, uint32_t lcid, unique_byte_buffer_t pdu, bool follow_on_flag) + void + add_dcch_pdu(const ttcn3_helpers::timing_info_t timing, uint32_t lcid, unique_byte_buffer_t pdu, bool follow_on_flag) { if (timing.now) { add_dcch_pdu_impl(lcid, std::move(pdu), follow_on_flag); @@ -865,7 +866,7 @@ public: void step_timer() { timers.step_all(); } - void add_srb(const timing_info_t timing, const uint32_t lcid, const pdcp_config_t pdcp_config) + void add_srb(const ttcn3_helpers::timing_info_t timing, const uint32_t lcid, const pdcp_config_t pdcp_config) { if (timing.now) { add_srb_impl(lcid, pdcp_config); @@ -897,7 +898,7 @@ public: rlc.reestablish(lcid); } - void del_srb(const timing_info_t timing, const uint32_t lcid) + void del_srb(const ttcn3_helpers::timing_info_t timing, const uint32_t lcid) { if (timing.now) { del_srb_impl(lcid); @@ -993,7 +994,7 @@ public: bool rb_is_um(uint32_t lcid) { return false; } - void set_as_security(const timing_info_t timing, + void set_as_security(const ttcn3_helpers::timing_info_t timing, const uint32_t lcid, std::array k_rrc_enc_, std::array k_rrc_int_, @@ -1040,7 +1041,7 @@ public: integ_algo = integ_algo_; } - void release_as_security(const timing_info_t timing) + void release_as_security(const ttcn3_helpers::timing_info_t timing) { if (timing.now) { release_as_security_impl(); @@ -1068,6 +1069,24 @@ public: } } + ttcn3_helpers::pdcp_count_map_t get_pdcp_count() + { + // prepare response to SS + std::vector bearers; + for (uint32_t i = 0; i < rb_id_vec.size(); i++) { + if (pdcp.is_lcid_enabled(i)) { + ttcn3_helpers::pdcp_count_t bearer; + uint16_t tmp; // not handling HFN + pdcp.get_bearer_status(i, &bearer.dl_value, &tmp, &bearer.ul_value, &tmp); + bearer.rb_is_srb = i <= 2; + bearer.rb_id = i; + log.info("PDCP count lcid=%d, dl=%d, ul=%d\n", bearer.rb_id, bearer.dl_value, bearer.ul_value); + bearers.push_back(bearer); + } + } + return bearers; + } + private: // SYS interface ttcn3_ut_interface ut;