Compare commits
14 Commits
ns-o-ran-x
...
cf8cd37685
Author | SHA1 | Date | |
---|---|---|---|
cf8cd37685 | |||
f2e465c33e | |||
178ec65486 | |||
a09d784d52 | |||
45fa45ee2c | |||
887f0d180a | |||
93d45e3c58 | |||
a34e83b524 | |||
290e030071 | |||
|
e3161c1f4c | ||
|
54fee7c1d0 | ||
|
4f46bbf4b1 | ||
|
b65e2a4a1f | ||
|
edf7fe9e8d |
@@ -14,17 +14,6 @@ do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# get RIC interface from cli arguments
|
|
||||||
if [ $# -eq 0 ] || [ "$import" = false ] ; then
|
|
||||||
RIC_INTERFACE="col0"
|
|
||||||
else
|
|
||||||
if [ "$arena" = true ]; then
|
|
||||||
RIC_INTERFACE="brric"
|
|
||||||
else
|
|
||||||
RIC_INTERFACE=$1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
export SRC=`dirname $0`
|
export SRC=`dirname $0`
|
||||||
. $SRC/setup-lib.sh
|
. $SRC/setup-lib.sh
|
||||||
|
|
||||||
@@ -175,9 +164,6 @@ EOF
|
|||||||
fi
|
fi
|
||||||
E2TERM_CONFIG_BIND="--mount type=bind,source=$E2TERMCONFFILE,destination=/opt/e2/config/config.conf,ro"
|
E2TERM_CONFIG_BIND="--mount type=bind,source=$E2TERMCONFFILE,destination=/opt/e2/config/config.conf,ro"
|
||||||
|
|
||||||
export RIC_IP=`ifconfig ${RIC_INTERFACE} | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*'`
|
|
||||||
|
|
||||||
|
|
||||||
if [ "$arena" = true ]; then
|
if [ "$arena" = true ]; then
|
||||||
echo 'Starting local setup'
|
echo 'Starting local setup'
|
||||||
# if both RIC and DU are executed on the same machine, do not set Docker NAT rules
|
# if both RIC and DU are executed on the same machine, do not set Docker NAT rules
|
||||||
|
@@ -104,7 +104,7 @@ std::string find_agent_ip_from_gnb(unsigned char* gnb_id_trans) {
|
|||||||
|
|
||||||
|
|
||||||
// send through socket
|
// send through socket
|
||||||
int send_socket(char* buf, std::string dest_ip) {
|
int send_socket(char* buf, size_t payload_size, std::string dest_ip) {
|
||||||
|
|
||||||
int control_sckfd = -1;
|
int control_sckfd = -1;
|
||||||
|
|
||||||
@@ -126,8 +126,7 @@ int send_socket(char* buf, std::string dest_ip) {
|
|||||||
|
|
||||||
// const size_t max_size = 512;
|
// const size_t max_size = 512;
|
||||||
// char buf[max_size] = "Hello, Server!"; // store the data in a buffer
|
// char buf[max_size] = "Hello, Server!"; // store the data in a buffer
|
||||||
size_t data_size = strlen(buf);
|
int sent_size = send(control_sckfd, buf, payload_size, 0);
|
||||||
int sent_size = send(control_sckfd ,buf, data_size, 0);
|
|
||||||
|
|
||||||
if(sent_size < 0) { // the send returns a size of -1 in case of errors
|
if(sent_size < 0) { // the send returns a size of -1 in case of errors
|
||||||
std::cout << "ERROR: SEND to agent " << dest_ip << std::endl;
|
std::cout << "ERROR: SEND to agent " << dest_ip << std::endl;
|
||||||
|
@@ -27,6 +27,6 @@ extern std::map<std::string, std::string> agentIp_gnbId;
|
|||||||
int open_control_socket_agent(const char* dest_ip, const int dest_port);
|
int open_control_socket_agent(const char* dest_ip, const int dest_port);
|
||||||
void close_control_socket_agent(void);
|
void close_control_socket_agent(void);
|
||||||
std::string find_agent_ip_from_gnb(unsigned char* gnb_id);
|
std::string find_agent_ip_from_gnb(unsigned char* gnb_id);
|
||||||
int send_socket(char* buf, std::string dest_ip);
|
int send_socket(char* buf, size_t payload_size, std::string dest_ip);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -30,6 +30,7 @@ void signalHandler( int signum ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]){
|
int main(int argc, char *argv[]){
|
||||||
|
std::cout << "hw_xapp_main Running";
|
||||||
|
|
||||||
// Get the thread id
|
// Get the thread id
|
||||||
std::thread::id my_id = std::this_thread::get_id();
|
std::thread::id my_id = std::this_thread::get_id();
|
||||||
@@ -71,7 +72,9 @@ int main(int argc, char *argv[]){
|
|||||||
|
|
||||||
sleep(1);
|
sleep(1);
|
||||||
//Startup E2 subscription and A1 policy
|
//Startup E2 subscription and A1 policy
|
||||||
//hw_xapp->startup(std::ref(*sub_handler));
|
std::cout << "Startup E2 subscription and A1 policy";
|
||||||
|
|
||||||
|
hw_xapp->startup(std::ref(*sub_handler));
|
||||||
|
|
||||||
//start listener threads and register message handlers.
|
//start listener threads and register message handlers.
|
||||||
int num_threads = std::stoi(config[XappSettings::SettingName::THREADS]);
|
int num_threads = std::stoi(config[XappSettings::SettingName::THREADS]);
|
||||||
|
@@ -271,7 +271,7 @@ uint8_t procRicIndication(E2AP_PDU_t *e2apMsg, transaction_identifier gnb_id)
|
|||||||
}
|
}
|
||||||
case 26: // RIC indication message
|
case 26: // RIC indication message
|
||||||
{
|
{
|
||||||
int payload_size = ricIndication->protocolIEs.list.array[idx]-> \
|
size_t payload_size = ricIndication->protocolIEs.list.array[idx]-> \
|
||||||
value.choice.RICindicationMessage.size;
|
value.choice.RICindicationMessage.size;
|
||||||
|
|
||||||
|
|
||||||
@@ -283,7 +283,7 @@ uint8_t procRicIndication(E2AP_PDU_t *e2apMsg, transaction_identifier gnb_id)
|
|||||||
|
|
||||||
// send payload to agent
|
// send payload to agent
|
||||||
std::string agent_ip = find_agent_ip_from_gnb(gnb_id);
|
std::string agent_ip = find_agent_ip_from_gnb(gnb_id);
|
||||||
send_socket(payload, agent_ip);
|
send_socket(payload, payload_size, agent_ip);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -87,6 +87,8 @@ void Xapp::stop(void){
|
|||||||
|
|
||||||
void Xapp::startup(SubscriptionHandler &sub_ref) {
|
void Xapp::startup(SubscriptionHandler &sub_ref) {
|
||||||
|
|
||||||
|
std::cout << "Startup beeing called";
|
||||||
|
|
||||||
subhandler_ref = &sub_ref;
|
subhandler_ref = &sub_ref;
|
||||||
|
|
||||||
if (GNB_ID == "") {
|
if (GNB_ID == "") {
|
||||||
@@ -118,7 +120,15 @@ void Xapp::startup(SubscriptionHandler &sub_ref) {
|
|||||||
std::cout << "Querying target gNB" << std::endl;
|
std::cout << "Querying target gNB" << std::endl;
|
||||||
rnib_gnblist.push_back(GNB_ID);
|
rnib_gnblist.push_back(GNB_ID);
|
||||||
}
|
}
|
||||||
|
while (
|
||||||
|
true
|
||||||
|
)
|
||||||
|
{
|
||||||
|
std::cout << "Send sub. req.";
|
||||||
|
std::cout << "yeet";
|
||||||
|
|
||||||
|
startup_subscribe_requests();
|
||||||
|
}
|
||||||
// open external control socket in thread and wait for message
|
// open external control socket in thread and wait for message
|
||||||
ext_control_thr_rx = std::unique_ptr<std::thread>(new std::thread{&Xapp::handle_external_control_message, this, SOCKET_PORT_EXT});
|
ext_control_thr_rx = std::unique_ptr<std::thread>(new std::thread{&Xapp::handle_external_control_message, this, SOCKET_PORT_EXT});
|
||||||
|
|
||||||
@@ -135,7 +145,16 @@ void Xapp::startup(SubscriptionHandler &sub_ref) {
|
|||||||
// send_socket("Hello, Server!", AGENT_1);
|
// send_socket("Hello, Server!", AGENT_1);
|
||||||
|
|
||||||
//send subscriptions.
|
//send subscriptions.
|
||||||
|
while (
|
||||||
|
true
|
||||||
|
)
|
||||||
|
{
|
||||||
|
std::cout << "Send sub. req.";
|
||||||
|
std::cout << "yeet";
|
||||||
|
|
||||||
startup_subscribe_requests();
|
startup_subscribe_requests();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//read A1 policies
|
//read A1 policies
|
||||||
// startup_get_policies();
|
// startup_get_policies();
|
||||||
@@ -417,7 +436,7 @@ void Xapp::send_ric_control_request(char* payload, std::string gnb_id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Xapp::startup_subscribe_requests(void ){
|
void Xapp::startup_subscribe_requests(void ){
|
||||||
|
std::cout << "Startup subscribe request \n";
|
||||||
bool res;
|
bool res;
|
||||||
size_t data_size = ASN_BUFF_MAX_SIZE;
|
size_t data_size = ASN_BUFF_MAX_SIZE;
|
||||||
unsigned char data[data_size];
|
unsigned char data[data_size];
|
||||||
@@ -432,11 +451,12 @@ void Xapp::startup_subscribe_requests(void ){
|
|||||||
|
|
||||||
if(sz <= 0)
|
if(sz <= 0)
|
||||||
mdclog_write(MDCLOG_INFO,"Subscriptions cannot be sent as GNBList in RNIB is NULL");
|
mdclog_write(MDCLOG_INFO,"Subscriptions cannot be sent as GNBList in RNIB is NULL");
|
||||||
|
std::cout << "pre for loop \n";
|
||||||
for(int i = 0; i<sz; i++){
|
for(int i = 0; i<sz; i++){
|
||||||
std::cout << "Sending subscriptions to: " << gnblist[i] << std::endl;
|
std::cout << "Sending subscriptions to: " << gnblist[i] << std::endl;
|
||||||
|
|
||||||
// give the message to subscription handler, along with the transmitter.
|
// give the message to subscription handler, along with the transmitter.
|
||||||
|
|
||||||
strcpy((char*)meid,gnblist[i].c_str());
|
strcpy((char*)meid,gnblist[i].c_str());
|
||||||
|
|
||||||
// char *strMsg = "Subscription Request from HelloWorld XApp\0";
|
// char *strMsg = "Subscription Request from HelloWorld XApp\0";
|
||||||
@@ -483,6 +503,7 @@ void Xapp::startup_subscribe_requests(void ){
|
|||||||
mdclog_write(MDCLOG_INFO,"Subscription SUCCESSFUL in file= %s, line=%d for MEID %s",__FILE__,__LINE__, meid);
|
mdclog_write(MDCLOG_INFO,"Subscription SUCCESSFUL in file= %s, line=%d for MEID %s",__FILE__,__LINE__, meid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
std::cout << "Finisched subscribe request \n";
|
||||||
}
|
}
|
||||||
|
|
||||||
void Xapp::startup_get_policies(void){
|
void Xapp::startup_get_policies(void){
|
||||||
|
Reference in New Issue
Block a user