Adding apnlist option in the mme config.
    Also giving config option in hss to verify subscriber access
    pfcp-spgwc helm chart changes. Override value pfcp = true to pass pfcp config to
    spgwc.

Fixing license issues

Change-Id: If3e862c9825d206c99f817b3c75cfa0035858651
diff --git a/omec/omec-control-plane/Chart.yaml b/omec/omec-control-plane/Chart.yaml
index 7ddbabd..002de3c 100644
--- a/omec/omec-control-plane/Chart.yaml
+++ b/omec/omec-control-plane/Chart.yaml
@@ -11,4 +11,4 @@
 name: omec-control-plane
 icon: https://guide.opencord.org/logos/cord.svg
 
-version: 0.1.31
+version: 0.1.32
diff --git a/omec/omec-control-plane/templates/bin/_spgwc-run.sh.tpl b/omec/omec-control-plane/templates/bin/_spgwc-run.sh.tpl
index 933ca57..9a185e6 100644
--- a/omec/omec-control-plane/templates/bin/_spgwc-run.sh.tpl
+++ b/omec/omec-control-plane/templates/bin/_spgwc-run.sh.tpl
@@ -16,5 +16,11 @@
 cp /etc/cp/config/{adc_rules.cfg,cp_config.cfg,interface.cfg,meter_profile.cfg,pcc_rules.cfg,sdf_rules.cfg,app_config.cfg} .
 sed -i "s/CP_ADDR/$POD_IP/g" interface.cfg
 
+{{- if .Values.config.spgwc.pfcp }}
+cp /etc/cp/config/{cp.cfg,subscriber_mapping.json} .
+sed -i "s/CP_ADDR/$POD_IP/g" cp.cfg
+cat /opt/cp/config/subscriber_mapping.json
+{{- end }}
+
 . cp_config.cfg
 ngic_controlplane $EAL_ARGS -- $APP_ARGS
diff --git a/omec/omec-control-plane/templates/configmap-spgwc.yaml b/omec/omec-control-plane/templates/configmap-spgwc.yaml
index 1602be6..b3a9566 100644
--- a/omec/omec-control-plane/templates/configmap-spgwc.yaml
+++ b/omec/omec-control-plane/templates/configmap-spgwc.yaml
@@ -12,6 +12,44 @@
   labels:
 {{ tuple "spgwc" . | include "omec-control-plane.metadata_labels" | indent 4 }}
 data:
+{{- if .Values.config.spgwc.pfcp }}
+  cp.cfg: |
+    [GLOBAL]
+    CP_TYPE = 03
+    GX_CONFIG = 0
+    S11_IP = CP_ADDR
+    S11_PORT = 2123
+    S5S8_IP = CP_ADDR
+    S5S8_PORT = 2123
+    PFCP_IP = CP_ADDR
+    PFCP_PORT = 8805
+    UPF_PFCP_IP = 127.0.0.1
+    UPF_PFCP_PORT = 8805
+    TRANSMIT_TIMER = 2
+    PERIODIC_TIMER = 10
+    TRANSMIT_COUNT = 5
+    REQUEST_TIMEOUT=1800000
+    REQUEST_TRIES=3
+    CP_LOGGER = 0
+    [NAMESERVER_CONFIG]
+    [CACHE]
+    concurrent=25
+    percentage=80
+    interval_seconds=60
+    query_timeout_ms=1000
+    query_tries=1
+    [APP]
+    frequency_seconds=3
+    filename=appqueries.json
+    nameserver= {{ .Values.config.spgwc.nameserver}}
+    [OPS]
+    frequency_seconds=3
+    filename=opsqueries.json
+    nameserver= {{ .Values.config.spgwc.nameserver}}
+    [IP_POOL_CONFIG]
+    IP_POOL_IP= {{.Values.config.spgwc.ueIpPool.ip }}
+    IP_POOL_MASK= {{ .Values.config.spgwc.ueIpPool.mask }}
+{{- end }}
   cp_config.cfg: |
     if [ ! -d "/dev/hugepages" ]; then
         MEMORY="--no-huge -m $((MEM_LIMIT-1024))"
@@ -50,3 +88,6 @@
   {{ $key }}: |-
 {{ $value | indent 4 }}
 {{- end }}
+{{- range $key, $value := .Values.config.spgwc.jsonCfgFiles }}
+  {{ $key }}: {{ toJson $value | quote }}
+{{- end }}
diff --git a/omec/omec-control-plane/values.yaml b/omec/omec-control-plane/values.yaml
index c074ffb..8e838bf 100644
--- a/omec/omec-control-plane/values.yaml
+++ b/omec/omec-control-plane/values.yaml
@@ -152,6 +152,7 @@
           numworkers: 4
           concurrent: 10
           ossfile: conf/oss.json
+          verifyroamingsubscribers: false
       oss.json:
         option:
           id: url
@@ -204,6 +205,8 @@
             #plmn1 - aether common plmn, plmn2 is for comac-in-box
             plmn1: "mcc=315,mnc=010"
             plmn2: "mcc=208,mnc=01"
+          apnlist:
+            internet: "spgwc-headless"
         s1ap:
           sctp_port: 36412
           sctp_port_external: 36412
@@ -231,6 +234,7 @@
         - imsi: 208014567891201
           phoneType: "iPhone11-Pro"
   spgwc:
+    pfcp: false
     apn: internet
     # ueStaticPool is used only when multiUpfs is not enabled.
     # In case of multiUpfs, use app_config.cfg to provide static pool per DP.
@@ -241,6 +245,8 @@
       mask: 255.255.0.0
     # This address must match to S1U IP address configured in omec-data-plane
     s1uAddr: 192.168.251.3
+    #DNS Server - 3gpp compliant DNS server
+    nameserver: 127.0.0.1
     s11:
       nodePort:
         enabled: false
@@ -263,8 +269,71 @@
     dpComm:
       addr: spgwu
       port: 20
+    jsonCfgFiles:
+      subscriber_mapping.json:
+        subscriber-selection-rules:
+          - priority: 5
+            keys:
+              serving-plmn:
+                mcc: 208
+                mnc: 10
+                tac: 1
+              imsi-range:
+                from: 200000000000000
+                to: 299999999999999
+            selected-apn-profile: apn-profile1
+            selected-qos-profile: qos-profile1
+            selected-access-profile:
+              - access-all
+            selected-user-plane-profile: user-plane1
+          - priority: 10
+            keys:
+              match-all: true
+            selected-apn-profile: apn-profile1
+            selected-qos-profile: qos-profile1
+            selected-access-profile:
+              - access-all
+            selected-user-plane-profile: user-plane1
+        apn-profiles:
+          apn-profile1:
+            apn-name: internet
+            usage: 1
+            network: lbo
+            gx_enabled: true
+            dns_primary: 8.8.8.4
+            dns_secondary: 8.8.8.8
+            mtu: 1460
+        user-plane-profiles:
+          user-plane1:
+            user-plane: spgwu-headless
+            qos-tags:
+              tag1: BW
+            access-tags:
+              tag1: ACC
+        qos-profiles:
+          mobile:
+            apn-ambr:
+              - 12345678
+              - 12345678
+        access-profiles:
+          access-all:
+            type: allow-all
+          internet-only:
+            type: internet-only
+            filter: No_private_network
+          intranet-only:
+            type: intranet-only
+            filter: only_private_network
+          apps-only: 
+            type: specific-network
+            filter: only_apps_network
+          specific-app:
+            type: specific-destination-only
+            filter: allow-app-name
+          excluding-app:
+            type: excluding-this-app
+            filter: exclude-app-name
     cfgFiles:
-      # See https://github.com/omec-project/ngic-rtc/tree/master/config for details
       app_config.cfg: |
         [GLOBAL]
         NUM_DP_SELECTION_RULES = 2