N2 handover intra-AMF 2Gnb 1ue
This commit is contained in:
46
test_container_size.cpp
Normal file
46
test_container_size.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
#include "src/lib/rrc/encode.hpp"
|
||||
#include "src/asn/rrc/ASN_RRC_RRCReconfiguration.h"
|
||||
#include "src/asn/asn_utils.hpp"
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
// 测试我们当前的容器生成逻辑
|
||||
auto *rrcReconfig = asn::New<ASN_RRC_RRCReconfiguration>();
|
||||
rrcReconfig->rrc_TransactionIdentifier = 1;
|
||||
|
||||
rrcReconfig->criticalExtensions.present = ASN_RRC_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration;
|
||||
auto *rrcReconfigIes = asn::New<ASN_RRC_RRCReconfiguration_IEs>();
|
||||
rrcReconfig->criticalExtensions.choice.rrcReconfiguration = rrcReconfigIes;
|
||||
|
||||
// 使用与我们代码中相同的CellGroupConfig数据
|
||||
uint8_t cellGroupConfigData[] = {
|
||||
0x00, 0x01, 0x40, 0x02, 0x01, 0x80, 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02,
|
||||
0x04, 0x40, 0x01, 0x20, 0x00, 0x01, 0x20, 0x10, 0x08, 0x00, 0x08, 0x04, 0x02, 0x01,
|
||||
0x10, 0x08, 0x04, 0x02, 0x01, 0x08, 0x04, 0x02, 0x01,
|
||||
0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01,
|
||||
0xF0, 0xE0, 0xD0, 0xC0, 0xB0, 0xA0, 0x90, 0x80,
|
||||
0x70, 0x60, 0x50, 0x40, 0x30, 0x20, 0x10, 0x00,
|
||||
0xFF, 0xEE, 0xDD, 0xCC, 0xBB, 0xAA, 0x99, 0x88,
|
||||
0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00
|
||||
};
|
||||
|
||||
rrcReconfigIes->secondaryCellGroup = asn::New<OCTET_STRING_t>();
|
||||
asn::SetOctetString(*rrcReconfigIes->secondaryCellGroup,
|
||||
OctetString::FromArray(cellGroupConfigData, sizeof(cellGroupConfigData)));
|
||||
|
||||
OctetString container = rrc::encode::EncodeS(asn_DEF_ASN_RRC_RRCReconfiguration, rrcReconfig);
|
||||
|
||||
std::cout << "Container size: " << container.length() << " bytes" << std::endl;
|
||||
std::cout << "Expected size: >= 50 bytes for free5gc compatibility" << std::endl;
|
||||
std::cout << "Status: " << (container.length() >= 50 ? "PASS" : "FAIL") << std::endl;
|
||||
|
||||
// 输出前32字节的十六进制
|
||||
std::cout << "Hex dump: ";
|
||||
for (size_t i = 0; i < std::min(32UL, container.length()); i++) {
|
||||
printf("%02x ", static_cast<unsigned char>(container.data()[i]));
|
||||
}
|
||||
std::cout << std::endl;
|
||||
|
||||
asn::Free(asn_DEF_ASN_RRC_RRCReconfiguration, rrcReconfig);
|
||||
return container.length() >= 50 ? 0 : 1;
|
||||
}
|
||||
Reference in New Issue
Block a user