Add static_arp config for sriov diabled mode

Also change network configs from list to dict to make it easier to override.

Change-Id: I03f193ab7fdaa91ac8e35f4e2d8d2a5a9f17baa0
diff --git a/mcord-release/mcord-services/templates/bin/_spgwu-launch.sh.tpl b/mcord-release/mcord-services/templates/bin/_spgwu-launch.sh.tpl
index c795c01..99ff9ea 100644
--- a/mcord-release/mcord-services/templates/bin/_spgwu-launch.sh.tpl
+++ b/mcord-release/mcord-services/templates/bin/_spgwu-launch.sh.tpl
@@ -21,10 +21,12 @@
 mkdir -p $RUN_DIR/config
 cd $RUN_DIR/config
 cp /etc/dp/config/{cdr.cfg,dp_config.cfg,interface.cfg} .
+{{- if not .Values.network.sriov.enabled }}
+cp /etc/dp/config/static_arp.cfg .
+{{- end }}
 
 sed -i "s/CP_ADDR/$CP_ADDR/g" interface.cfg
 sed -i "s/DP_ADDR/$DP_ADDR/g" interface.cfg
 
 source dp_config.cfg
-
 ngic_dataplane $EAL_ARGS -- $APP_ARGS
diff --git a/mcord-release/mcord-services/templates/configmap-spgwu.yaml b/mcord-release/mcord-services/templates/configmap-spgwu.yaml
index 895bf6c..a984e23 100644
--- a/mcord-release/mcord-services/templates/configmap-spgwu.yaml
+++ b/mcord-release/mcord-services/templates/configmap-spgwu.yaml
@@ -46,6 +46,15 @@
     cp_comm_ip = CP_ADDR
     cp_comm_port = 21
 {{- if not .Values.network.sriov.enabled }}
+  static_arp.cfg: |
+    [sgi]
+{{- range .Values.network.sgi.static_arp }}
+    {{ .ip }}   = {{ .mac }}
+{{- end }}
+    [s1u]
+{{- range .Values.network.s1u.static_arp }}
+    {{ .ip }}   = {{ .mac }}
+{{- end }}
   setup-af-iface.sh: |
 {{ tuple "bin/_spgwu-setup-af-iface.sh.tpl" . | include "mcord-services.template" | indent 4 }}
 {{- end }}
diff --git a/mcord-release/mcord-services/templates/networks.yaml b/mcord-release/mcord-services/templates/networks.yaml
index 8ea9d8e..856345d 100644
--- a/mcord-release/mcord-services/templates/networks.yaml
+++ b/mcord-release/mcord-services/templates/networks.yaml
@@ -14,29 +14,51 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-{{- range .Values.network.networks }}
 ---
 apiVersion: "k8s.cni.cncf.io/v1"
 kind: NetworkAttachmentDefinition
 metadata:
-  name: {{ .name }}
+  name: s1u-net
 {{- if $.Values.network.sriov.enabled }}
   annotations:
     k8s.v1.cni.cncf.io/resourceName: intel.com/sriov_vfio
 {{- end }}
 spec:
   config: '{
-    "type": {{ .type | quote }},
+    "type": {{ .Values.network.s1u.cni_plugin | quote }},
     "ipam": {
-        "type": {{ .ipam | quote }},
-    {{- if eq .ipam "host-local" }}
-        "subnet": {{ .subnet | quote }},
-        "gateway": {{ .gateway | quote }}
-    {{- else if eq .ipam "centralip" }}
+        "type": {{ .Values.network.s1u.ipam | quote }},
+    {{- if eq .Values.network.s1u.ipam "host-local" }}
+        "subnet": {{ .Values.network.s1u.subnet | quote }},
+        "gateway": {{ .Values.network.s1u.gateway | quote }}
+    {{- else if eq .Values.network.s1u.ipam "centralip" }}
         "ipType": "cluster",
-        "network": {{ .subnet | quote }},
-        "etcdURL": {{ $.Values.global.etcdurl | quote }}
+        "network": {{ .Values.network.s1u.subnet | quote }},
+        "etcdURL": {{ .Values.global.etcdurl | quote }}
     {{- end }}
     }
   }'
+---
+apiVersion: "k8s.cni.cncf.io/v1"
+kind: NetworkAttachmentDefinition
+metadata:
+  name: sgi-net
+{{- if $.Values.network.sriov.enabled }}
+  annotations:
+    k8s.v1.cni.cncf.io/resourceName: intel.com/sriov_vfio
 {{- end }}
+spec:
+  config: '{
+    "type": {{ .Values.network.sgi.cni_plugin | quote }},
+    "ipam": {
+        "type": {{ .Values.network.sgi.ipam | quote }},
+    {{- if eq .Values.network.sgi.ipam "host-local" }}
+        "subnet": {{ .Values.network.sgi.subnet | quote }},
+        "gateway": {{ .Values.network.sgi.gateway | quote }}
+    {{- else if eq .Values.network.sgi.ipam "centralip" }}
+        "ipType": "cluster",
+        "network": {{ .Values.network.sgi.subnet | quote }},
+        "etcdURL": {{ .Values.global.etcdurl | quote }}
+    {{- end }}
+    }
+  }'