/* ltemme configuration file for ims
 * version 2021-09-18
 * Copyright (C) 2015-2021 Amarisoft
 */
{
  /* Log filter: syntax: layer.field=value[,...]
  
     Possible layers are nas, ip, s1ap, gtpu and all. The 'all' layer
     is used to address all the layers at the same time.

     field values:

     - 'level': the log level of each layer can be set to 'none',
     'error', 'info' or 'debug'. Use 'debug' to log all the messages.
     
     - 'max_size': set the maximum size of the hex dump. 0 means no
       hex dump. -1 means no limit.
  */
  log_options: "all.level=debug,all.max_size=32",
  log_filename: "{{ directory['log'] }}/mme.log",

  /* Enable remote API and Web interface */
  com_addr: "[{{ slap_configuration['ipv6-random'] }}]:{{ slap_configuration['configuration.mme_ws_port'] }}",

  /* bind address for GTP-U. Normally = address of the PC, here bound
    on local interface to be able to run ltemme on the same PC as
    lteenb. By default, the S1AP SCTP connection is bound on the same
    address. */
  gtp_addr: "127.0.1.100",

  plmn: "00101",
  mme_group_id: 32769,
  mme_code: 1,

  ims_vops_eps: true, /* IMS supported */
  ims_vops_5gs_3gpp: true, /* IMS supported */
  ims_vops_5gs_n3gpp: true, /* IMS supported */
  //emc_bs: true, /* emergency calls supported */
  //emc: 3, /* NR/E-UTRA connected to 5GCN emergency calls supported */
  //emc_n3gpp: true, /* non-3GPP emergency calls supported */
  emergency_number_list: [
      /* Category bits: (Table 10.5.135d/3GPP TS 24.008)
         Bit 1 Police
         Bit 2 Ambulance
         Bit 3 Fire Brigade
         Bit 4 Marine Guard
         Bit 5 Mountain Rescue
      */    
    { category: 0x1f, digits: "911" },
    { category: 0x1f, digits: "112" },
  ],

  rx: {
    qci: {audio: 1, video: 2},
  },

  /* network name and network short name sent in the EMM information
     message to the UE */
  network_name: "{{ slap_configuration['configuration.network_name'] }}",
  network_short_name: "{{ slap_configuration['configuration.network_name'] }}",

  /* Control Plane Cellular IoT EPS optimization support */
  cp_ciot_opt: true,

  /* DCNR support */
  nr_support: true,

  eps_5gs_interworking: "with_n26",


  /* 15 bearers support */
  fifteen_bearers: false,

  ims_list: [
    {
      ims_addr: "{{ slap_configuration['configuration.ims_addr'] }}",
      bind_addr: "{{  slap_configuration['configuration.ims_bind'] }}"
    }
  ],

  /* AMF slices configuration */
  /*nssai: [
   {
    sst: 1,
   },
   {
    sst: 2,
   },
   {
    sst: 3,
    sd: 50,
   }
  ],*/

  /* ePDG configuration */
  //epdg: {
  //  bind_addr: "127.0.1.100:500",
  //  esp_duration: 900,
  //  certificate: "epdg.pem",
  //  /* required for some buggy Mediatek phones */
  //  //omit_auth_in_first_auth_rsp: true
  //},

  /* Public Data Networks. The first one is the default. */
  pdn_list: [
    {
      pdn_type: "ipv4",
      tun_ifname: "{{ slap_configuration['tun-name'] }}",
      access_point_name: ["default", "internet", "ims", "sos"],
      first_ip_addr: "{{ netaddr.IPAddress(netaddr.IPNetwork(slap_configuration['tun-ipv4-network']).first) + 2 }}",
      last_ip_addr: "{{ netaddr.IPAddress(netaddr.IPNetwork(slap_configuration['tun-ipv4-network']).last) - 1 }}",
      ip_addr_shift: 2, /* difference between allocated IP addresses is 4 */
      dns_addr: "8.8.8.8", /* Google DNS address */
      // TODO: enable this instead of Google's DNS above
      // dns_addr: "{{ slap_configuration['tun-ipv4-addr'] }}",
      p_cscf_addr: ["{{ slap_configuration['tun-ipv4-addr'] }}"],

      erabs: [
        {
          qci: 9,
          priority_level: 15,
          pre_emption_capability: "shall_not_trigger_pre_emption",
          pre_emption_vulnerability: "not_pre_emptable",
        },
      ],
    },
  ],

  /* Setup script for the network interface.
     If no script is given, no network interface is created.
     Script is called for each PDN with following parameters:
        1) Interface name
        2) PDN index
        3) Access Point Name
        4) IP version: 'ipv4' or 'ipv6'
        5) IP address: first IP address for ipv4 and link local address for IPv6
        6) First IP address
        7) Last IP address
  
  SlapOS: We suplement the script by preparing the TUN interface in slapos format phase.
  Gotcha: The script has to be presented
  */
  tun_setup_script: "{{ ifup_empty }}",
  /* If true, inter-UE routing is done inside the MME (hence no IP
     packet is output to the virtual network interface in case of
     inter-UE communication). Otherwise, it is done by the Linux IP
     layer. */
  ue_to_ue_forwarding: false,

  /* NAS ciphering algorithm preference. EEA0 is always the last. */
  nas_cipher_algo_pref: [ ],
  /* NAS integrity algorithm preference. EIA0 is always the last. */
  nas_integ_algo_pref: [ 2, 1 ],

  include "{{ slap_configuration['ue_db_path'] }}",

  /* persistent user database */
  ue_db_filename: "{{ directory['var'] }}/lte_ue.db"
}
