Introduce support for AmarisoftEPC

* A new abstract generic base class EPC is created
* srsEPC and AmarisoftEPC inherit from that class
* options are loaded from defaults.conf in cascade. First generic "epc",
  afterwards the specific enb type.
* A new scenario is added to select the EPC type to use. srsEPC is the
  default unless stated by an scenario.
* AmarisoftEPC delegates setup of the tun IP address to an "ifup"
  script. As a result, since we run without root permissions (ony with
  CAP_NET_ADMIN), the ifup script itself is unablet o set the IP
  address. To solve this, we introduce a new osmo-gsm-tester helper
  script which must be installed in the slave node which can be called
  through sudo to increase privileges to do so.

With this commit, I can already get srsUE<->amarisoftENB<->amarisoftEPC
to pass ping and iperf3 4g tests.

Change-Id: Ia50ea6a74b63b2d688c8d683aea11416ad40a6d3
diff --git a/src/osmo_gsm_tester/templates/amarisoft_ltemme.cfg.tmpl b/src/osmo_gsm_tester/templates/amarisoft_ltemme.cfg.tmpl
new file mode 100644
index 0000000..a2af69a
--- /dev/null
+++ b/src/osmo_gsm_tester/templates/amarisoft_ltemme.cfg.tmpl
@@ -0,0 +1,116 @@
+/* ltemme configuration file
+ * version 2018-10-18
+ * Copyright (C) 2015-2018 Amarisoft
+ */
+{
+
+  license_server: {
+    server_addr: "${epc.license_server_addr}",
+    name: "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_options: "all.level=error,all.max_size=0,nas.level=debug,nas.max_size=1,s1ap.level=debug,s1ap.max_size=1",
+  log_filename: "${epc.log_filename}",
+
+  /* Enable remote API and Web interface */
+  com_addr: "${epc.run_addr}:9000",
+
+  /* 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: "${epc.run_addr}",
+
+  s1ap_bind_addr: "${epc.run_addr}",
+
+  plmn: "${epc.mcc}${epc.mnc}",
+  mme_group_id: 32769,
+  mme_code: 1,
+
+  /* network name and network short name sent in the EMM information
+     message to the UE */
+  network_name: "Amarisoft Network",
+  network_short_name: "Amarisoft",
+
+  /* Control Plane Cellular IoT EPS optimization support */
+  cp_ciot_opt: true,
+
+  /* Public Data Networks. The first one is the default. */
+  pdn_list: [
+    {
+      /* Some UE requires a specific PDN for data access */
+      pdn_type: "ipv4",
+      access_point_name: "internet",
+      first_ip_addr: "192.168.4.2",
+      last_ip_addr: "192.168.4.254",
+      ip_addr_shift: 2,
+      dns_addr: "8.8.8.8", /* Google DNS address */
+      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
+  */
+  tun_setup_script: "${epc.ifup_filename}",
+
+  /* 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 ],
+
+  /* user data base */
+  ue_db: [
+%for sub in epc.hss.subscribers:
+    {
+      sim_algo: "${sub.auth_algo}", /* USIM authentication algorithm: xor, milenage or tuak */
+      imsi: "${sub.imsi}", /* Anritsu Test USIM */
+      amf: 0x9001, /* Authentication Management Field */
+      sqn: "000000000000", /* Sequence Number */
+      K: "${sub.ki}", /* Anritsu Test USIM */
+      /* if true, allow several UEs to have the same IMSI (useful
+         with test SIM cards). They are distinguished with their
+         IMEI. default = false. */
+      multi_sim: true,
+    },
+%endfor
+    /* Add new entries for each IMSI/K */
+  ],
+
+  /* persistent user database */
+  //ue_db_filename: "lte_ue.db",
+}