/******************************************************************************/
// @copyright   Copyright Notification
//   No part may be reproduced except as authorized by written permission.
//   The copyright and the foregoing restriction extend to reproduction in all media.
//   (c) 2023, 3GPP Organizational Partners (ARIB, ATIS, CCSA, ETSI, TSDSI, TTA, TTC).
//   All rights reserved.
// @version: IWD_23wk37
// $Date: 2021-03-20 15:05:59 +0100 (Sat, 20 Mar 2021) $
// $Rev: 30244 $
/******************************************************************************/

module NasEmu5G_Component_NRNG {
  import from NG_NasEmu_CtrlAspTypes all;
  import from NasEmu5G_Component_NR_BASE all;
  import from NR_Component_NR5GC all;
  import from NasEmu_Common4G5G all;

  //----------------------------------------------------------------------------
  // Component definition:
  type component NASEMU_NRNG_PTC extends NASEMU_NR_BASE_PTC {  /* @status    APPROVED (IMS, NR5GC, NR5GC_IRAT, POS) */
    port NG_NASEMU_CTRL_PORT      CTRL;
    port NASEMU5G_CO_ORD_PORT     EPS;
  };

  //----------------------------------------------------------------------------
  /*
   * @desc      Create NASEMU, connect it with NR5G PTC and map the system ports
   * @param     p_System
   * @param     p_Nr
   * @return    NASEMU_NRNG_PTC
   * @status    APPROVED (IMS, NR5GC, NR5GC_IRAT, POS)
   */
  function f_NasEmu5G_CreateConnectAndMap_NRNG(NASEMU_NR_SYSTEM p_System,
                                               NR5GC_PTC p_Nr) return NASEMU_NRNG_PTC
  {
    var NASEMU_NRNG_PTC v_NASEMU_NRNG_PTC := null;
    
    if (p_Nr != null) {
      
      // create NAS emulation:
      v_NASEMU_NRNG_PTC := NASEMU_NRNG_PTC.create("NASEMU_NRNG") alive;  // @sic R5s210270 sic@
      
      // connect NAS emulation:
      connect(p_Nr:NASCTRL,  v_NASEMU_NRNG_PTC:CTRL);
      connect(p_Nr:SRB,      v_NASEMU_NRNG_PTC:TC_SRB);
      
      // map NASEMU system ports:
      map(v_NASEMU_NRNG_PTC:SYS_SRB, p_System:NR_SRB);
    }
    return v_NASEMU_NRNG_PTC;
  }

}
