Merge "COMAC-97 Apply the latest changes to comac-in-a-box"
diff --git a/comac-in-a-box/Makefile b/comac-in-a-box/Makefile
index c163e8a..6e1fb1a 100644
--- a/comac-in-a-box/Makefile
+++ b/comac-in-a-box/Makefile
@@ -8,10 +8,10 @@
 VENV		?= $(BUILD)/venv/ciab
 CIABVALUES	?= $(MAKEDIR)/comac-in-a-box-values.yaml
 
-KUBESPRAY_VERSION ?= release-2.10
-DOCKER_VERSION	?= 18.06
-K8S_VERSION	?= v1.14.3
-HELM_VERSION	?= v2.13.1
+KUBESPRAY_VERSION ?= release-2.11
+DOCKER_VERSION	?= 18.09
+K8S_VERSION	?= v1.15.3
+HELM_VERSION	?= v2.14.2
 
 # used to start logging/monitoring and other infrastructure charts
 INFRA_CHARTS	?=
@@ -32,14 +32,14 @@
 os_vendor	:= $(shell lsb_release -i -s)
 os_release	:= $(shell lsb_release -r -s)
 
-ciab: $(M)/system_check $(M)/omec $(M)/oaisim $(M)/comac-platform
+ciab: $(M)/system-check $(M)/omec $(M)/oaisim
 
 .PHONY: ciab run-test reset-test clean
 
 $(M):
 	mkdir -p $(M)
 
-$(M)/system_check: | $(M)
+$(M)/system-check: | $(M)
 	@if [[ $(cpu_family) -eq 6 ]]; then \
 		if [[ $(cpu_model) -lt 60 ]]; then \
 			echo "FATAL: haswell CPU or newer is required."; \
@@ -149,9 +149,18 @@
 /opt/cni/bin/simpleovs: | $(M)/k8s-ready
 	sudo cp $(RESOURCEDIR)/simpleovs /opt/cni/bin/
 
-$(M)/omec: | $(M)/ovs-setup $(M)/helm-ready $(WORKSPACE)/cord/helm-charts /opt/cni/bin/simpleovs
-	cd $(WORKSPACE)/cord/helm-charts/mcord-release; \
-	helm upgrade --install $(HELM_GLOBAL_ARGS) mcord-services mcord-services -f $(CIABVALUES)
+/opt/cni/bin/static: | $(M)/k8s-ready
+	mkdir -p $(BUILD)/cni-plugins; cd $(BUILD)/cni-plugins; \
+	wget https://github.com/containernetworking/plugins/releases/download/v0.8.2/cni-plugins-linux-amd64-v0.8.2.tgz && \
+	tar xvfz cni-plugins-linux-amd64-v0.8.2.tgz
+	sudo cp $(BUILD)/cni-plugins/static /opt/cni/bin/
+
+$(M)/omec: | $(M)/ovs-setup $(M)/helm-ready $(WORKSPACE)/cord/helm-charts /opt/cni/bin/simpleovs /opt/cni/bin/static
+	cd $(WORKSPACE)/cord/helm-charts/omec; \
+	helm dep up omec-data-plane && \
+	helm dep up omec-control-plane && \
+	helm upgrade --install $(HELM_GLOBAL_ARGS) omec-data-plane omec-data-plane -f $(CIABVALUES) && \
+	helm upgrade --install $(HELM_GLOBAL_ARGS) omec-control-plane omec-control-plane -f $(CIABVALUES)
 	$(WORKSPACE)/cord/helm-charts/scripts/wait_for_pods.sh default
 	touch $@
 
@@ -174,7 +183,7 @@
 	$(eval mme_iface=$(shell ip -4 route list default | awk -F 'dev' '{ print $$2; exit }' | awk '{ print $$1 }'))
 	cd $(WORKSPACE)/cord/helm-charts; \
 	helm upgrade --install $(HELM_GLOBAL_ARGS) oaisim oaisim -f $(CIABVALUES) \
-		--set conf.enb.networks.s1_mme.interface=$(mme_iface)
+		--set config.enb.networks.s1_mme.interface=$(mme_iface)
 	$(WORKSPACE)/cord/helm-charts/scripts/wait_for_pods.sh default
 	@timeout 60s bash -c \
 	"until ip addr show oip1 | grep -q inet; \
@@ -186,15 +195,15 @@
 
 $(M)/router: | /opt/cni/bin/simpleovs $(M)/ovs-setup
 	kubectl apply -f $(RESOURCEDIR)/quagga.yaml
-	kubectl wait pod --for=condition=Ready -l app=quagga
+	kubectl wait pod --for=condition=Ready -l app=quagga --timeout=60s
 	$(eval spgwu_ip=$(shell kubectl get pod -ojson spgwu-0 2>/dev/null | \
 		jq -r '.metadata.annotations["k8s.v1.cni.cncf.io/networks-status"]' | \
 		jq -r '.[] | select(.name=="sgi-net") | .ips[0]'))
 	kubectl exec router ip route add 16.0.0.0/8 via $(spgwu_ip)
 	touch $@
 
-test: | $(M)/router
-	@timeout 60s bash -c \
+test: | $(M)/omec $(M)/oaisim $(M)/router
+	@timeout 120s bash -c \
 	"until timeout 3 ping -I oip1 13.1.1.254 -c 1 > /dev/null 2>&1; do \
 		echo 'Waiting for DP to be ready'; \
 	done"
@@ -203,7 +212,8 @@
 reset-test:
 	kubectl delete po router || true
 	helm delete --purge oaisim || true
-	helm delete --purge mcord-services || true
+	helm delete --purge omec-control-plane || true
+	helm delete --purge omec-data-plane || true
 	cd $(M); rm -f router oaisim omec
 
 clean: reset-test
diff --git a/comac-in-a-box/comac-in-a-box-values.yaml b/comac-in-a-box/comac-in-a-box-values.yaml
index 06c1518..785790a 100644
--- a/comac-in-a-box/comac-in-a-box-values.yaml
+++ b/comac-in-a-box/comac-in-a-box-values.yaml
@@ -12,44 +12,18 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
----
-# etcd-cluster
-etcdNodePort: 32379
-clusterSize: 1
+resources:
+  enabled: false
 
-# mcord-services values
-hssdb:
-  cpu: 1
-hss:
-  cpu: 0.5
-spgwc:
-  image: omecproject/ngic-cp:0.1.0-dev-debug
-  cpu: 0.5
-spgwu:
-  images:
-    tags:
-      spgwu: omecproject/ngic-dp:0.1.0-dev-debug
-  resources:
-    cpu: 1
-  conf:
-    dp:
-      devices: "--no-pci --vdev eth_af_packet0,iface=s1u-net --vdev eth_af_packet1,iface=sgi-net"
-mme:
-  type: openmme
-  resources:
-    cpu: 0.5
-network:
+cassandra:
+  config:
+    cluster_size: 1
+
+config:
   sriov:
     enabled: false
-  s1u:
-    cni_plugin: simpleovs
-    ipam: host-local
-  sgi:
-    cni_plugin: simpleovs
-    ipam: host-local
-
-# oaisim values
-conf:
+  spgwu:
+    devices: "--no-pci --vdev eth_af_packet0,iface=s1u-net --vdev eth_af_packet1,iface=sgi-net"
   plmn:
     name: "COMAC Test Network"
     short_name: "COMAC"
@@ -70,6 +44,10 @@
       opc: "d4416644f6154936193433dd20a0ace0"
       msisdn: "1122334456"
 
+networks:
+  cniPlugin: simpleovs
+  ipam: static
+
 # cord-platform values
 etcd-operator:
   enabled: false
diff --git a/comac-in-a-box/resources/quagga.yaml b/comac-in-a-box/resources/quagga.yaml
index 63f87f5..130fb1a 100644
--- a/comac-in-a-box/resources/quagga.yaml
+++ b/comac-in-a-box/resources/quagga.yaml
@@ -22,7 +22,7 @@
     app: quagga
   annotations:
     k8s.v1.cni.cncf.io/networks: '[
-            { "name": "sgi-net", "interface": "sgi-rtr", "interfaceRequest": "sgi-rtr" }
+            { "name": "sgi-net", "interface": "sgi-rtr", "ips": "13.1.1.254/24" }
     ]'
 spec:
   containers:
@@ -30,9 +30,7 @@
     command: ["/bin/bash", "-c"]
     args:
       - >
-        ip addr flush sgi-rtr;
         ip link set sgi-rtr address 0e:00:00:00:00:01;
-        ip addr add 13.1.1.254/24 dev sgi-rtr;
         trap : TERM INT; sleep infinity & wait
     image: opencord/quagga
     securityContext: