[WIP] Enable user to set up a second UPF

Change-Id: Ie2e2d7bc21aab9462cab413e3c8c6235939345fd
diff --git a/Makefile b/Makefile
index f53a80f..37b5790 100644
--- a/Makefile
+++ b/Makefile
@@ -13,6 +13,7 @@
 
 4G_CORE_VALUES       ?= $(MAKEDIR)/sd-core-4g-values.yaml
 5G_CORE_VALUES       ?= $(MAKEDIR)/sd-core-5g-values.yaml
+5G_UPF2_VALUES       ?= $(MAKEDIR)/upf2-5g-values.yaml
 OAISIM_VALUES        ?= $(MAKEDIR)/oaisim-values.yaml
 ROC_VALUES           ?= $(MAKEDIR)/roc-values.yaml
 ROC_DEFAULTENT_MODEL ?= $(MAKEDIR)/roc-defaultent-model.json
@@ -345,6 +346,17 @@
 		$(SD_CORE_CHART)
 	touch $@
 
+# Install second UPF
+5g-upf2: $(M)/5g-upf2
+$(M)/5g-upf2:
+	NODE_IP=${NODE_IP} DATA_IFACE=${DATA_IFACE} RAN_SUBNET=${RAN_SUBNET} envsubst < $(5G_UPF2_VALUES) | \
+	helm upgrade --create-namespace --install --wait $(HELM_GLOBAL_ARGS) \
+		--namespace upf2 \
+		--values - \
+		bess-upf \
+		$(UPF_CHART)
+	touch $@
+
 # UE images includes kernel module, ue_ip.ko
 # which should be built in the exactly same kernel version of the host machine
 $(BUILD)/openairinterface: | $(M)/setup
diff --git a/configs/latest b/configs/latest
index 93361a1..082e0e1 100644
--- a/configs/latest
+++ b/configs/latest
@@ -3,6 +3,7 @@
 # SPDX-License-Identifier: Apache-2.0
 
 SD_CORE_CHART            := aether/sd-core
+UPF_CHART                := aether/bess-upf
 
 # For installing the ROC
 AETHER_ROC_UMBRELLA_CHART := aether/aether-roc-umbrella
diff --git a/sd-core-5g-values.yaml b/sd-core-5g-values.yaml
index 77eb1bc..b60f3b0 100644
--- a/sd-core-5g-values.yaml
+++ b/sd-core-5g-values.yaml
@@ -254,8 +254,10 @@
         subnet: ${RAN_SUBNET} #this is your gNB network
       access:
         iface: ${DATA_IFACE}
+        # ip: 192.168.252.3/24   # this is the default in the Helm chart
       core:
         iface: ${DATA_IFACE}
+        # ip: 192.168.250.3/24   # this is the default in the Helm chart
       cfgFiles:
         upf.json:
           mode: af_packet  #this mode means no dpdk
@@ -282,6 +284,9 @@
     #  gnbsim: 5gc-gnbsim:0.0.1-dev-local5
   config:
     gnbsim:
+      networkTopo:
+        - upfAddr: "192.168.252.0/24"
+          upfGw: "192.168.251.1"
       singleInterface: false #default multiInterface. Works well for AIAB
       execInParallel: false #run all profiles in parallel
       goProfile:
diff --git a/upf2-5g-values.yaml b/upf2-5g-values.yaml
new file mode 100644
index 0000000..4e37d72
--- /dev/null
+++ b/upf2-5g-values.yaml
@@ -0,0 +1,47 @@
+# Copyright 2021-present Open Networking Foundation
+#
+# SPDX-License-Identifier: Apache-2.0
+
+
+enable: true
+resources:
+  enabled: false
+images:
+  repository: "registry.opennetworking.org/docker.io/"
+  # uncomment below section to add update bess image tag
+  #tags:
+  #  bess: <bess image tag>
+  #  pfcpiface: <pfcp image tag>
+config:
+  upf:
+    name: "oaisim"
+    sriov:
+      enabled: false #default sriov is disabled in AIAB setup
+    hugepage:
+      enabled: false #should be enabled if dpdk is enabled
+    #can be any other plugin as well, remember this plugin dictates how IP address are assigned.
+    cniPlugin: macvlan
+    ipam: static
+    routes:
+      - to: ${NODE_IP}
+        via: 169.254.1.1
+    enb:
+      subnet: ${RAN_SUBNET} #this is your gNB network
+    access:
+      iface: ${DATA_IFACE}
+      ip: 192.168.252.4/24
+    core:
+      iface: ${DATA_IFACE}
+      ip: 192.168.250.4/24
+    cfgFiles:
+      upf.json:
+        mode: af_packet #this mode means no dpdk
+        hwcksum: true
+        log_level: "trace"
+        gtppsc: true #extension header is enabled in 5G. Sending QFI in pdu session extension header
+        cpiface:
+          dnn: "internet" #keep it matching with Slice dnn
+          hostname: "upf"
+          #http_port: "8080"
+          enable_ue_ip_alloc: false # if true then it means UPF allocates address from below pool
+          ue_ip_pool: "172.250.0.0/16" # UE ip pool is used if enable_ue_ip_alloc is set to true