COMAC-8 add ability to disable sriov for mcord-services

Add option to enable/disable sriov. PTP plugin can be used in case
sriov is disabled. Basically all kind of plugin can be used,
but may need some manual steps.
Also, refactor spgwu to make it more configurable and conventional.

Change-Id: I62d5d41cbd27b53b9c66dfad55123ba7bc340482
diff --git a/mcord-release/mcord-services/Chart.yaml b/mcord-release/mcord-services/Chart.yaml
index 6a92698..d6207da 100644
--- a/mcord-release/mcord-services/Chart.yaml
+++ b/mcord-release/mcord-services/Chart.yaml
@@ -18,4 +18,4 @@
 appVersion: "1.0"
 description: M-CORD services with OMEC inside
 name: mcord-services
-version: 0.1.0
+version: 0.1.1
diff --git a/mcord-release/mcord-services/templates/_helpers.tpl b/mcord-release/mcord-services/templates/_helpers.tpl
index 449fce3..5e5718b 100644
--- a/mcord-release/mcord-services/templates/_helpers.tpl
+++ b/mcord-release/mcord-services/templates/_helpers.tpl
@@ -47,3 +47,14 @@
 {{- define "mcord-services.chart" -}}
 {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
 {{- end -}}
+
+{{/*
+Render the given template.
+*/}}
+{{- define "mcord-services.template" -}}
+{{- $name := index . 0 -}}
+{{- $context := index . 1 -}}
+{{- $last := base $context.Template.Name }}
+{{- $wtf := $context.Template.Name | replace $last $name -}}
+{{ include $wtf $context }}
+{{- end -}}
diff --git a/mcord-release/mcord-services/templates/bin/_spgwu-launch.sh.tpl b/mcord-release/mcord-services/templates/bin/_spgwu-launch.sh.tpl
new file mode 100644
index 0000000..c795c01
--- /dev/null
+++ b/mcord-release/mcord-services/templates/bin/_spgwu-launch.sh.tpl
@@ -0,0 +1,30 @@
+#!/bin/bash
+#
+# Copyright 2019-present Open Networking Foundation
+# Copyright 2019 Intel Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -ex
+
+RUN_DIR=${RUN_DIR:-"/opt/dp"}
+mkdir -p $RUN_DIR/config
+cd $RUN_DIR/config
+cp /etc/dp/config/{cdr.cfg,dp_config.cfg,interface.cfg} .
+
+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/bin/_spgwu-setup-af-iface.sh.tpl b/mcord-release/mcord-services/templates/bin/_spgwu-setup-af-iface.sh.tpl
new file mode 100644
index 0000000..3266da8
--- /dev/null
+++ b/mcord-release/mcord-services/templates/bin/_spgwu-setup-af-iface.sh.tpl
@@ -0,0 +1,47 @@
+#!/bin/bash
+#
+# Copyright 2019-present Open Networking Foundation
+# Copyright 2019 Intel Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -ex
+
+UL_IFACE="{{- .Values.spgwu.conf.dp.s1u_af_dev -}}"
+DL_IFACE="{{- .Values.spgwu.conf.dp.sgi_af_dev -}}"
+
+if ! ip link show $UL_IFACE; then
+    s1u_mac=$(ip addr show dev s1u-net | awk '$1=="link/ether"{print $2}')
+    ip link add $UL_IFACE type veth peer name l_$UL_IFACE
+    ip link set $UL_IFACE up
+    ip link set l_$UL_IFACE up
+    ip link set dev $UL_IFACE address $s1u_mac
+fi
+if ! ip link show $DL_IFACE; then
+    sgi_mac=$(ip addr show dev sgi-net | awk '$1=="link/ether"{print $2}')
+    ip link add $DL_IFACE type veth peer name l_$DL_IFACE
+    ip link set $DL_IFACE up
+    ip link set l_$DL_IFACE up
+    ip link set dev $DL_IFACE address $sgi_mac
+fi
+
+if ! ip addr show $UL_IFACE | grep inet; then
+    s1u_ip=$(ip addr show s1u-net | grep inet | grep -v inet6 | awk '{print $2}')
+    ip addr add $s1u_ip dev $UL_IFACE
+fi
+if ! ip addr show $DL_IFACE | grep inet; then
+    sgi_ip=$(ip addr show sgi-net | grep inet | grep -v inet6 | awk '{print $2}')
+    ip addr add $sgi_ip dev $DL_IFACE
+fi
+
+ip a
diff --git a/mcord-release/mcord-services/templates/configmap-spgwu.yaml b/mcord-release/mcord-services/templates/configmap-spgwu.yaml
new file mode 100644
index 0000000..895bf6c
--- /dev/null
+++ b/mcord-release/mcord-services/templates/configmap-spgwu.yaml
@@ -0,0 +1,53 @@
+---
+# Copyright 2019-present Open Networking Foundation
+# Copyright 2019 Intel Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: {{ .Values.spgwu.name }}
+data:
+  dp_config.cfg: |
+    if [ ! -d "/dev/hugepages" ]; then
+        MEMORY="--no-huge -m $((MEM_LIMIT-1024))"
+    fi
+
+    CORES="-c $(taskset -p $$ | awk '{print $NF}')"
+    EAL_ARGS="${CORES} ${MEMORY} ${DEVICES}"
+
+    SPGW_CFG="--spgw_cfg 03"
+    S1U_IP=$(ip -4 addr show dev ${S1U_DEVNAME} | grep -oP '(?<=inet\s)\d+(\.\d+){3}')
+    SGI_IP=$(ip -4 addr show dev ${SGI_DEVNAME} | grep -oP '(?<=inet\s)\d+(\.\d+){3}')
+    S1U_MAC=$(ip addr show dev ${S1U_DEVNAME} | awk '$1=="link/ether"{print $2}')
+    SGI_MAC=$(ip addr show dev ${SGI_DEVNAME} | awk '$1=="link/ether"{print $2}')
+    S1U="--s1u_ip ${S1U_IP} --s1u_mac ${S1U_MAC} --ul_iface ${S1U_DEVNAME}"
+    SGI="--sgi_ip ${SGI_IP} --sgi_mac ${SGI_MAC} --dl_iface ${SGI_DEVNAME} --sgi_gw_ip ${RTR_SGI_IP} --sgi_mask ${SGI_MASK}"
+    MISC="--log 1"
+    APP_ARGS="${S1U} ${SGI} ${MISC} ${SPGW_CFG}"
+  cdr.cfg: |
+    CDR_PATH=./cdr
+    MASTER_CDR=./cdr/master.csv
+  interface.cfg: |
+    [0]
+    dp_comm_ip = DP_ADDR
+    dp_comm_port = 20
+    cp_comm_ip = CP_ADDR
+    cp_comm_port = 21
+{{- if not .Values.network.sriov.enabled }}
+  setup-af-iface.sh: |
+{{ tuple "bin/_spgwu-setup-af-iface.sh.tpl" . | include "mcord-services.template" | indent 4 }}
+{{- end }}
+  launch.sh: |
+{{ tuple "bin/_spgwu-launch.sh.tpl" . | include "mcord-services.template" | indent 4 }}
diff --git a/mcord-release/mcord-services/templates/networks.yaml b/mcord-release/mcord-services/templates/networks.yaml
index b483fb1..0cecc3a 100644
--- a/mcord-release/mcord-services/templates/networks.yaml
+++ b/mcord-release/mcord-services/templates/networks.yaml
@@ -14,28 +14,29 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-{{- range .Values.networks }}
+{{- range .Values.network.networks }}
 ---
 apiVersion: "k8s.cni.cncf.io/v1"
 kind: NetworkAttachmentDefinition
 metadata:
   name: {{ .name }}
+{{- if $.Values.network.sriov.enabled }}
   annotations:
     k8s.v1.cni.cncf.io/resourceName: intel.com/sriov
+{{- end }}
 spec:
   config: '{
-    "type": {{ .sriovtype | quote }},
-    "name": {{ .name | quote }},
+    "type": {{ .type | quote }},
     "ipam": {
-        "type": {{ .ipamtype | quote }},
-    {{- if eq .ipamtype "host-local" }}
+        "type": {{ .ipam | quote }},
+    {{- if eq .ipam "host-local" }}
         "subnet": {{ .subnet | quote }},
         "gateway": {{ .gateway | quote }}
-    {{- else if eq .ipamtype "centralip" }}
+    {{- else if eq .ipam "centralip" }}
         "ipType": "cluster",
         "network": {{ .subnet | quote }},
         "etcdURL": {{ $.Values.global.etcdurl | quote }}
     {{- end }}
     }
-}'
+  }'
 {{- end }}
diff --git a/mcord-release/mcord-services/templates/service-spgwu.yaml b/mcord-release/mcord-services/templates/service-spgwu.yaml
new file mode 100644
index 0000000..927c20b
--- /dev/null
+++ b/mcord-release/mcord-services/templates/service-spgwu.yaml
@@ -0,0 +1,28 @@
+---
+# Copyright 2019-present Open Networking Foundation
+# Copyright 2019 Intel Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+---
+apiVersion: v1
+kind: Service
+metadata:
+  name: {{ .Values.spgwu.name }}
+spec:
+  selector:
+    app: {{ .Values.spgwu.name }}
+  clusterIP: None
+  ports:
+  - name: cpdp
+    port: 20
+    protocol: UDP
diff --git a/mcord-release/mcord-services/templates/spgwu.yaml b/mcord-release/mcord-services/templates/spgwu.yaml
deleted file mode 100644
index 1c0c038..0000000
--- a/mcord-release/mcord-services/templates/spgwu.yaml
+++ /dev/null
@@ -1,169 +0,0 @@
----
-# Copyright 2018-present Open Networking Foundation
-# Copyright 2018 Intel Corporation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
----
-apiVersion: v1
-kind: ConfigMap
-metadata:
-  name: {{ .Values.spgwu.name }}
-data:
-  launch.sh: |
-    #!/bin/bash -xe
-
-    RUN_DIR=${RUN_DIR:-"/opt/dp"}
-    mkdir -p $RUN_DIR/config
-    cd $RUN_DIR/config
-    cp /etc/dp/config/{cdr.cfg,dp_config.cfg,interface.cfg} .
-    sed -i "s/CP_ADDR/$CP_ADDR/g" interface.cfg
-    sed -i "s/DP_ADDR/$DP_ADDR/g" interface.cfg
-    . dp_config.cfg
-    ngic_dataplane $EAL_ARGS -- $APP_ARGS
-  dp_config.cfg: |
-    if [ ! -d "/dev/hugepages" ]; then
-        MEMORY="--no-huge -m $((MEM_LIMIT-1024))"
-    fi
-
-    CORES="-c $(taskset -p $$ | awk '{print $NF}')"
-    EAL_ARGS="${CORES} ${MEMORY} ${DEVICES}"
-
-    SPGW_CFG="--spgw_cfg 03"
-    S1U_IP=$(ip -4 addr show dev ${S1U_DEVNAME} | grep -oP '(?<=inet\s)\d+(\.\d+){3}')
-    SGI_IP=$(ip -4 addr show dev ${SGI_DEVNAME} | grep -oP '(?<=inet\s)\d+(\.\d+){3}')
-    S1U_MAC=$(ip addr show dev ${S1U_DEVNAME} | awk '$1=="link/ether"{print $2}')
-    SGI_MAC=$(ip addr show dev ${SGI_DEVNAME} | awk '$1=="link/ether"{print $2}')
-    S1U="--s1u_ip ${S1U_IP} --s1u_mac ${S1U_MAC} --ul_iface ${S1U_DEVNAME}"
-    SGI="--sgi_ip ${SGI_IP} --sgi_mac ${SGI_MAC} --dl_iface ${SGI_DEVNAME} --sgi_gw_ip ${RTR_SGI_IP} --sgi_mask ${SGI_MASK}"
-    MISC="--log 1"
-    APP_ARGS="${S1U} ${SGI} ${MISC} ${SPGW_CFG}"
-  cdr.cfg: |
-    CDR_PATH=./cdr
-    MASTER_CDR=./cdr/master.csv
-  interface.cfg: |
-    [0]
-    dp_comm_ip = DP_ADDR
-    dp_comm_port = 20
-    cp_comm_ip = CP_ADDR
-    cp_comm_port = 21
----
-apiVersion: v1
-kind: Service
-metadata:
-  name: {{ .Values.spgwu.name }}
-spec:
-  selector:
-    app: {{ .Values.spgwu.name }}
-  clusterIP: None
-  ports:
-  - name: cpdp
-    port: 20
-    protocol: UDP
----
-apiVersion: apps/v1
-kind: StatefulSet
-metadata:
-  name: {{ .Values.spgwu.name }}
-  labels:
-    app: {{ .Values.spgwu.name }}
-spec:
-  replicas: 1
-  selector:
-    matchLabels:
-      app: {{ .Values.spgwu.name }}
-  serviceName: {{ .Values.spgwu.name | quote }}
-  template:
-    metadata:
-      labels:
-        app: {{ .Values.spgwu.name }}
-      annotations:
-        k8s.v1.cni.cncf.io/networks: '[
-                { "name": "s1u-net", "interface": "s1u-net" },
-                { "name": "sgi-net", "interface": "sgi-net" }
-        ]'
-    spec:
-      # Required if working with Linux bound devices so that kernel does not
-      # reply to GTP-U packets
-      #initContainers:
-      #- name: init
-      #  image: "ngick8stesting/c3po-init"
-      #  command: [ "sh", "-xec"]
-      #  securityContext:
-      #    capabilities:
-      #      add:
-      #        - NET_ADMIN
-      #  args:
-      #  - iptables -I OUTPUT -p icmp --icmp-type destination-unreachable -j DROP;
-      containers:
-      - name: {{ .Values.spgwu.name }}
-        image: {{ .Values.spgwu.image }}
-        imagePullPolicy: {{ .Values.global.imagepullpolicy }}
-        stdin: true
-        tty: true
-        env:
-        - name: MEM_LIMIT
-          valueFrom:
-            resourceFieldRef:
-              containerName: {{ .Values.spgwu.name }}
-              resource: limits.memory
-              divisor: 1Mi
-        - name: S1U_DEVNAME
-          value: s1u-net
-        - name: SGI_DEVNAME
-          value: sgi-net
-        - name: DEVICES
-          value: ""  # "--no-pci --vdev eth_af_packet0,iface=s1u-net --vdev eth_af_packet1,iface=sgi-net"
-        - name: CP_ADDR
-          value: spgwc-0.{{ .Values.spgwc.name }}.{{ .Values.global.namespace }}.{{ .Values.global.fqdn }}
-        - name: DP_ADDR
-          valueFrom:
-            fieldRef:
-              fieldPath: status.podIP
-        - name: RTR_SGI_IP
-          value: "13.1.1.254"
-        - name: SGI_MASK
-          value: "255.255.255.0"
-        command: ["bash", "-xc"]
-        args:
-        - ip a;
-          /opt/dp/scripts/launch.sh;
-        volumeMounts:
-        - name: dp-script
-          mountPath: /opt/dp/scripts/launch.sh
-          subPath: launch.sh
-        - name: dp-config
-          mountPath: /etc/dp/config
-        #- name: hugepage
-        #  mountPath: /dev/hugepages
-        resources:
-          limits:
-            #hugepages-1Gi: 8Gi
-            cpu: {{ .Values.spgwu.cpu | quote }}
-            memory: {{ .Values.spgwu.memory }}
-            intel.com/sriov: 2
-        securityContext:
-          capabilities:
-            add:
-              - IPC_LOCK
-      volumes:
-      - name: dp-script
-        configMap:
-          name: {{ .Values.spgwu.name }}
-          defaultMode: 493
-      - name: dp-config
-        configMap:
-          name: {{ .Values.spgwu.name }}
-          defaultMode: 420
-      #- name: hugepage
-      #  emptyDir:
-      #    medium: HugePages
diff --git a/mcord-release/mcord-services/templates/statefulset-spgwu.yaml b/mcord-release/mcord-services/templates/statefulset-spgwu.yaml
new file mode 100644
index 0000000..49a2ee6
--- /dev/null
+++ b/mcord-release/mcord-services/templates/statefulset-spgwu.yaml
@@ -0,0 +1,137 @@
+---
+# Copyright 2018-present Open Networking Foundation
+# Copyright 2018 Intel Corporation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+---
+apiVersion: apps/v1
+kind: StatefulSet
+metadata:
+  name: {{ .Values.spgwu.name }}
+  labels:
+    app: {{ .Values.spgwu.name }}
+spec:
+  replicas: 1
+  selector:
+    matchLabels:
+      app: {{ .Values.spgwu.name }}
+  serviceName: {{ .Values.spgwu.name | quote }}
+  template:
+    metadata:
+      labels:
+        app: {{ .Values.spgwu.name }}
+      annotations:
+        k8s.v1.cni.cncf.io/networks: '[
+                { "name": "s1u-net", "interface": "s1u-net" },
+                { "name": "sgi-net", "interface": "sgi-net" }
+        ]'
+    spec:
+{{- if not .Values.network.sriov.enabled }}
+      initContainers:
+        - name: spgwu-iptables-init
+          image: {{ .Values.spgwu.images.tags.init | quote }}
+          imagePullPolicy: {{ .Values.spgwu.images.pullPolicy | quote }}
+          command: [ "sh", "-xec"]
+          securityContext:
+            capabilities:
+              add:
+                - NET_ADMIN
+          args:
+            - iptables -I OUTPUT -p icmp --icmp-type destination-unreachable -j DROP;
+        - name: spgwu-af-iface-init
+          image: {{ .Values.spgwu.images.tags.spgwu | quote }}
+          imagePullPolicy: {{ .Values.spgwu.images.pullPolicy | quote }}
+          securityContext:
+            capabilities:
+              add:
+                - NET_ADMIN
+          command:
+            - /opt/dp/scripts/setup-af-iface.sh
+          volumeMounts:
+            - name: dp-script
+              mountPath: /opt/dp/scripts/setup-af-iface.sh
+              subPath: setup-af-iface.sh
+{{- end }}
+      containers:
+      - name: {{ .Values.spgwu.name }}
+        image: {{ .Values.spgwu.images.tags.spgwu | quote }}
+        imagePullPolicy: {{ .Values.spgwu.images.pullPolicy | quote }}
+        stdin: true
+        tty: true
+        env:
+        - name: MEM_LIMIT
+          valueFrom:
+            resourceFieldRef:
+              containerName: {{ .Values.spgwu.name }}
+              resource: limits.memory
+              divisor: 1Mi
+        - name: S1U_DEVNAME
+          {{- if .Values.network.sriov.enabled }}
+          value: s1u-net
+          {{- else }}
+          value: {{ .Values.spgwu.conf.dp.s1u_af_dev | quote }}
+          {{- end }}
+        - name: SGI_DEVNAME
+          {{- if .Values.network.sriov.enabled }}
+          value: sgi-net
+          {{- else }}
+          value: {{ .Values.spgwu.conf.dp.sgi_af_dev | quote }}
+          {{- end }}
+        - name: DEVICES
+          value: {{ .Values.spgwu.conf.dp.devices | quote }}
+        - name: CP_ADDR
+          value: spgwc-0.{{ .Values.spgwc.name }}
+        - name: DP_ADDR
+          valueFrom:
+            fieldRef:
+              fieldPath: status.podIP
+        - name: RTR_SGI_IP
+          value: {{ .Values.spgwu.conf.dp.rtr_sgi_ip | quote }}
+        - name: SGI_MASK
+          value: {{ .Values.spgwu.conf.dp.sgi_mask | quote }}
+        command: ["bash", "-xc"]
+        args:
+        - ip a;
+          /opt/dp/scripts/launch.sh;
+        volumeMounts:
+        - name: dp-script
+          mountPath: /opt/dp/scripts/launch.sh
+          subPath: launch.sh
+        - name: dp-config
+          mountPath: /etc/dp/config
+        #- name: hugepage
+        #  mountPath: /dev/hugepages
+        resources:
+          limits:
+            #hugepages-1Gi: 8Gi
+            cpu: {{ .Values.spgwu.resources.cpu | quote }}
+            memory: {{ .Values.spgwu.resources.memory }}
+            {{- if .Values.network.sriov.enabled }}
+            intel.com/sriov: 2
+            {{- end }}
+        securityContext:
+          capabilities:
+            add:
+              - IPC_LOCK
+      volumes:
+      - name: dp-script
+        configMap:
+          name: {{ .Values.spgwu.name }}
+          defaultMode: 493
+      - name: dp-config
+        configMap:
+          name: {{ .Values.spgwu.name }}
+          defaultMode: 420
+      #- name: hugepage
+      #  emptyDir:
+      #    medium: HugePages
diff --git a/mcord-release/mcord-services/values.yaml b/mcord-release/mcord-services/values.yaml
index 65fab56..8008899 100644
--- a/mcord-release/mcord-services/values.yaml
+++ b/mcord-release/mcord-services/values.yaml
@@ -56,27 +56,53 @@
 
 spgwu:
   name: spgwu
-  image: krsna1729/ngic-dp
-  cpu: 4
-  memory: 8Gi
+  images:
+    tags:
+      init: ngick8stesting/c3po-init:latest
+      spgwu: krsna1729/ngic-dp:latest
+    pullPolicy: IfNotPresent
+  resources:
+    cpu: 4
+    memory: 8Gi
+  conf:
+    dp:
+      # s1u and sgi interfaces are fixed to "s1u-net" and "sgi-net"
+      # Note that s1u_af_dev and sgi_af_dev are valid only when sriov is disabled
+      # setup-af-iface.sh script creates additional veth pair with the names here
+      s1u_af_dev: s1u-veth
+      sgi_af_dev: sgi-veth
+      # set "--no-pci --vdev eth_af_packet0,iface=s1u-dev --vdev eth_af_packet1,iface=sgi-net"
+      # when sriov is disabled
+      devices: ""
+      rtr_sgi_ip: 13.1.1.254
+      sgi_mask: 255.255.255.0
 
 enb:
   host: 10.1.11.3
   port: 36412
 
-# Network block defines the network used by SR-IOV pods
-# ipamtype: defined the prefered IP management plugin (only support host-local or centralip)
-# subnet: defined the customized network subnet range
-# gateway: defined the default gateway for pod which attaches to current network
-#          this option will be ignored when using centralip as ipam plugin
-networks:
-  - name: s1u-net
-    sriovtype: vfioveth
-    ipamtype: centralip
-    subnet: 119.0.0.0/24
-    gateway: 119.0.0.254
-  - name: sgi-net
-    sriovtype: vfioveth
-    ipamtype: centralip
-    subnet: 13.1.1.0/24
-    gateway: 13.1.1.254
+# Network block defines the networks
+# Note that currently we use fixed list of networks, s1u-net and sgi-net
+# type: provide what type of cni will be used
+#       possible options are vfioveth and ptp
+#       use vfioveth when sriov enabled, and ptp otherwise
+# ipam: provide what type of ipam will be used
+#       possible options are centralip and host-local
+#       note that centralip requires etcd cluster
+# subnet: provide subnet range to be assigned to the pod
+# gateway: provide default gateway of the network
+#          valid only when centralip is used
+network:
+  sriov:
+    enabled: true
+  networks:
+    - name: s1u-net
+      type: vfioveth
+      ipam: centralip
+      subnet: 119.0.0.0/24
+      gateway: 119.0.0.254
+    - name: sgi-net
+      type: vfioveth
+      ipam: centralip
+      subnet: 13.1.1.0/24
+      gateway: 13.1.1.254