예제 #1
0
int olg_config(char * g_log_level) {

 //initialize the log generator 
  logInit(map_str_to_int(log_level_names, g_log_level));
  set_glog(LOG_DEBUG, LOG_MED); //g_glog
  set_comp_log(OCG,  LOG_INFO, LOG_LOW, 10);
  set_comp_log(OMG,  LOG_INFO, LOG_LOW, 10);
  set_comp_log(EMU,  LOG_INFO, LOG_LOW, 10);
  
  LOG_T(LOG,"global log level is set to %s \n",g_log_level );
  return 1; 
}
예제 #2
0
static void debug_init(void) {

    // log initialization
    logInit();
    set_glog(glog_level,  glog_verbosity);

    set_comp_log(RRH,     rrh_log_level,   rrh_log_verbosity, 1);
    //set_comp_log(ENB_LOG, enb_log_level,   enb_log_verbosity, 1);
    //set_comp_log(UE_LOG,  ue_log_level,    ue_log_verbosity,  1);

    // vcd initialization
    if (ouput_vcd) {
        vcd_signal_dumper_init("/tmp/openair_dump_rrh.vcd");

    }
}
예제 #3
0
int main (int argc, char **argv)
{

  args_t args;
  LTE_DL_FRAME_PARMS frame_parms0;
  LTE_DL_FRAME_PARMS *frame_parms=&frame_parms;
  char sdu0[16],sdu1[64],sdu2[1024],sdu3[1024],sdu4[1024];
  unsigned short sdu_len0,sdu_len1,sdu_len2,sdu_len3,sdu_len4;
  char ulsch_buffer[1024],dlsch_buffer[1024];
  u8 lcid;
  u8 payload_offset;
  int i,comp;

  logInit();

  NB_UE_INST  = 1;
  NB_eNB_INST = 1;
  NB_INST=2;

  // Parse arguments
  if(parse_args(argc, argv, &args) > 0) {
    print_usage(argv[0]);
    exit(1);
  }

  set_taus_seed(0);
  logInit();
  set_glog(LOG_TRACE, 1);

  for (comp = PHY; comp < MAX_LOG_COMPONENTS ; comp++)
    set_comp_log(comp,
                 LOG_TRACE,
                 LOG_NONE,
                 1);

  /*
  set_log(OMG,  LOG_INFO, 20);
   set_log(EMU,  LOG_INFO, 10);
   set_log(OCG,  LOG_INFO, 1);
   set_log(MAC,  LOG_TRACE, 1);
   set_log(RLC,  LOG_TRACE, 1);
   set_log(PHY,  LOG_DEBUG, 1);
   set_log(PDCP, LOG_TRACE, 1);
   set_log(RRC,  LOG_TRACE, 1);
  */
  mac_xface = (MAC_xface *)malloc(sizeof(MAC_xface));
  init_lte_vars (&frame_parms, 0, 1, 0, 0, 25, 0, 0, 1, 1);
  l2_init(frame_parms);

  // Generate eNB SI
  if (args.input_sib == 0) {
    openair_rrc_lite_eNB_init(0);
  } else {
    printf("Got SI from files (%d,%d,%d,%d,%d)\n",args.input_sib,args.input1_sdu_flag,args.input2_sdu_flag);
  }

  openair_rrc_on(0,0);
  openair_rrc_lite_ue_init(0,0);

  switch (args.SDUsource) {
  case eNB_RRC:
    if (args.RRCmessage == RRCSIB1) {
      if (args.input1_sdu_flag == 1) {
        for (i=0; i<args.input1_sdu_len; i++)
          printf("%02x",args.input1_sdu[i]);

        printf("\n");
        ue_decode_si(0,142,0,args.input1_sdu,args.input1_sdu_len);
      } else {
        printf("\n\nSIB1\n\n");

        for (i=0; i<eNB_rrc_inst[0].sizeof_SIB1; i++)
          printf("%02x",eNB_rrc_inst[0].SIB1[i]);

        printf("\n");
      }
    } else if (args.RRCmessage == RRCSIB2_3) {
      if (args.input1_sdu_flag == 1) {
        for (i=0; i<args.input2_sdu_len; i++)
          printf("%02x",args.input2_sdu[i]);

        printf("\n");
        ue_decode_si(0,149,0,args.input1_sdu,args.input1_sdu_len);
      } else {
        printf("\n\nSIB2_3\n\n");

        for (i=0; i<eNB_rrc_inst[0].sizeof_SIB23; i++)
          printf("%02x",eNB_rrc_inst[0].SIB23[i]);

        printf("\n");
      }
    } else if ((args.input1_sdu_flag == 1)&&
               ((args.RRCmessage == RRCConnectionSetup) ||
                (args.RRCmessage == RRCConnectionReconfiguration))) {
      sdu_len0 = attach_ue0(sdu0);
      ue_send_sdu(0,143,args.input1_sdu,args.input1_sdu_len,0);

      if (args.RRCmessage == RRCConnectionReconfiguration)
        ue_send_sdu(0,144,args.input2_sdu,args.input2_sdu_len,0);
    } else {
      switch (args.RRCmessage) {

      case RRCConnectionSetup:
        printf("Doing eNB RRCConnectionSetup\n");
        sdu_len0 = attach_ue0(sdu0);
        sdu_len1 = attach_ue1(sdu1);
        lcid = 0;
        payload_offset = generate_dlsch_header(dlsch_buffer,
                                               1,              //num_sdus
                                               &sdu_len1,      //
                                               &lcid,          // sdu_lcid
                                               255,                                   // no drx
                                               0,                                   // no timing advance
                                               sdu0,        // contention res id
                                               0,0);
        memcpy(&dlsch_buffer[payload_offset],sdu1,sdu_len1);
        printf("\nRRCConnectionSetup (DLSCH input / MAC output)\n\n");

        for (i=0; i<sdu_len1+payload_offset; i++)
          printf("%02x ",(unsigned char)sdu1[i]);

        printf("\n");

        break;

      case RRCConnectionReconfiguration:
        printf("Doing eNB RRCConnectionReconfiguration\n");
        sdu_len0 = attach_ue0(sdu0);
        sdu_len1 = attach_ue1(sdu1);
        sdu_len2 = attach_ue2(sdu1,sdu_len1,sdu2);
        sdu_len3 = attach_ue3(sdu2,sdu_len2,sdu3);

        lcid=1;
        payload_offset = generate_dlsch_header(dlsch_buffer,
                                               // offset = generate_dlsch_header((unsigned char*)eNB_mac_inst[0].DLSCH_pdu[0][0].payload[0],
                                               1,              //num_sdus
                                               &sdu_len3,  //
                                               &lcid,
                                               255,                                   // no drx
                                               1,      // timing advance
                                               NULL,                                  // contention res idk
                                               0,0);
        memcpy(&dlsch_buffer[payload_offset],sdu3,sdu_len3);
        printf("\nRRCConnectionReconfiguration (DLSCH input / MAC output)\n\n");

        for (i=0; i<sdu_len3+payload_offset; i++)
          printf("%02x ",(unsigned char)dlsch_buffer[i]);

        printf("\n");

        break;

      default:
        printf("Unknown eNB_RRC SDU (%d), exiting\n",args.RRCmessage);
        break;
      }

      break;
    }

    break;

  case eNB_MAC:
    sdu_len0 = attach_ue0(sdu0);
    ue_send_sdu(0,143,args.input1_sdu,args.input1_sdu_len,0);
    break;

  case UE_RRC:
    switch (args.RRCmessage) {

    case RRCConnectionRequest:

      sdu_len0 = attach_ue0(sdu0);
      printf("\n\nRRCConnectionRequest\n\n");

      for (i=0; i<sdu_len0; i++)
        printf("%02x ",(unsigned char)sdu0[i]);

      printf("\n");

      break;

    case RRCConnectionSetupComplete:

      sdu_len0=attach_ue0(sdu0);
      sdu_len1 = attach_ue1(sdu1);
      sdu_len2 = attach_ue2(sdu1,sdu_len1,sdu2);


      lcid=1;
      printf("Got sdu of length %d\n",sdu_len2);
      payload_offset = generate_ulsch_header((u8*)ulsch_buffer,  // mac header
                                             1,      // num sdus
                                             0,            // short pading
                                             &sdu_len2,  // sdu length
                                             &lcid,    // sdu lcid
                                             NULL,  // power headroom
                                             NULL,  // crnti
                                             NULL,  // truncated bsr
                                             NULL, // short bsr
                                             NULL, // long_bsr
                                             0);
      printf("Got MAC header of length %d\n",payload_offset);
      memcpy(&ulsch_buffer[payload_offset],sdu2,sdu_len2);

      printf("\n\nRRCConnectionSetupComplete (ULSCH input / MAC output)\n\n");

      for (i=0; i<sdu_len2+payload_offset; i++)
        printf("%02x ",(unsigned char)ulsch_buffer[i]);

      printf("\n");
      break;

    case RRCConnectionReconfigurationComplete:

      sdu_len0=attach_ue0(sdu0);
      sdu_len1=attach_ue1(sdu1);
      sdu_len2 = attach_ue2(sdu1,sdu_len1,sdu2);
      sdu_len3 = attach_ue3(sdu2,sdu_len2,sdu3);
      sdu_len4 = attach_ue4(sdu3,sdu_len3,sdu4);

      lcid=1;
      printf("Got sdu of length %d\n",sdu_len4);
      payload_offset = generate_ulsch_header((u8*)ulsch_buffer,  // mac header
                                             1,      // num sdus
                                             0,            // short pading
                                             &sdu_len4,  // sdu length
                                             &lcid,    // sdu lcid
                                             NULL,  // power headroom
                                             NULL,  // crnti
                                             NULL,  // truncated bsr
                                             NULL, // short bsr
                                             NULL, // long_bsr
                                             0);
      printf("Got MAC header of length %d\n",payload_offset);
      memcpy(&ulsch_buffer[payload_offset],sdu4,sdu_len4);

      printf("\n\nRRCConnectionReconfigurationComplete (ULSCH input / MAC output)\n\n");

      for (i=0; i<sdu_len4+payload_offset; i++)
        printf("%02x ",(unsigned char)ulsch_buffer[i]);

      printf("\n");

      break;

    default:
      printf("Unknown UE_RRC SDU (%d), exiting\n",args.RRCmessage);
      break;
    }

    break;
  }


  free(mac_xface);

  return(0);
}
예제 #4
0
int test_log(void)
{
  LOG_ENTER(MAC); // because the default level is DEBUG
  LOG_I(EMU, "1 Starting OAI logs version %s Build date: %s on %s\n",
        BUILD_VERSION, BUILD_DATE, BUILD_HOST);
  LOG_D(MAC, "1 debug  MAC \n");
  LOG_N(MAC, "1 notice MAC \n");
  LOG_W(MAC, "1 warning MAC \n");

  set_comp_log(EMU, LOG_INFO, FLAG_ONLINE);
  set_comp_log(MAC, LOG_WARNING, 0);

  LOG_I(EMU, "2 Starting OAI logs version %s Build date: %s on %s\n",
        BUILD_VERSION, BUILD_DATE, BUILD_HOST);
  LOG_E(MAC, "2 emerge MAC\n");
  LOG_D(MAC, "2 debug  MAC \n");
  LOG_N(MAC, "2 notice MAC \n");
  LOG_W(MAC, "2 warning MAC \n");
  LOG_I(MAC, "2 info MAC \n");


  set_comp_log(MAC, LOG_NOTICE, 1);

  LOG_ENTER(MAC);
  LOG_I(EMU, "3 Starting OAI logs version %s Build date: %s on %s\n",
        BUILD_VERSION, BUILD_DATE, BUILD_HOST);
  LOG_D(MAC, "3 debug  MAC \n");
  LOG_N(MAC, "3 notice MAC \n");
  LOG_W(MAC, "3 warning MAC \n");
  LOG_I(MAC, "3 info MAC \n");

  set_comp_log(MAC, LOG_DEBUG,1);
  set_comp_log(EMU, LOG_DEBUG,1);

  LOG_ENTER(MAC);
  LOG_I(EMU, "4 Starting OAI logs version %s Build date: %s on %s\n",
        BUILD_VERSION, BUILD_DATE, BUILD_HOST);
  LOG_D(MAC, "4 debug  MAC \n");
  LOG_N(MAC, "4 notice MAC \n");
  LOG_W(MAC, "4 warning MAC \n");
  LOG_I(MAC, "4 info MAC \n");


  set_comp_log(MAC, LOG_DEBUG,0);
  set_comp_log(EMU, LOG_DEBUG,0);

  LOG_I(LOG, "5 Starting OAI logs version %s Build date: %s on %s\n",
        BUILD_VERSION, BUILD_DATE, BUILD_HOST);
  LOG_D(MAC, "5 debug  MAC \n");
  LOG_N(MAC, "5 notice MAC \n");
  LOG_W(MAC, "5 warning MAC \n");
  LOG_I(MAC, "5 info MAC \n");


  set_comp_log(MAC, LOG_TRACE,0X07F);
  set_comp_log(EMU, LOG_TRACE,0X07F);

  LOG_ENTER(MAC);
  LOG_I(LOG, "6 Starting OAI logs version %s Build date: %s on %s\n",
        BUILD_VERSION, BUILD_DATE, BUILD_HOST);
  LOG_D(MAC, "6 debug  MAC \n");
  LOG_N(MAC, "6 notice MAC \n");
  LOG_W(MAC, "6 warning MAC \n");
  LOG_I(MAC, "6 info MAC \n");
  LOG_EXIT(MAC);

  return 0;
}