Aehter-1255 - Add a new container to push the netcfg to ONOS
- Change the apiversion to v2. (v1 for Helmv2, v2 for Helmv3).
Change-Id: Ia1d4a4662ca55d97196ff63d5874a83b03432e04
diff --git a/apps/dbuf/templates/configmap-config.yaml b/apps/dbuf/templates/configmap-config.yaml
new file mode 100644
index 0000000..2df6d11
--- /dev/null
+++ b/apps/dbuf/templates/configmap-config.yaml
@@ -0,0 +1,45 @@
+{{/*
+# Copyright 2021-present Open Networking Foundation
+
+# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
+*/}}
+
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ include "dbuf.fullname" . }}
+ labels:
+ {{- include "dbuf.labels" . | nindent 4 }}
+data:
+ push-onos: |
+ #!/bin/sh
+ set -e -x
+ env
+ ifconfig
+ while true
+ do
+ echo "Get the IP Address from interface $DP_INTERFACE"
+ ifconfig $DP_INTERFACE
+ #IP Address from ifconfig is addr:10.71.126.127, have to cut it off
+ DP_IP=$(ifconfig $DP_INTERFACE | awk '/inet addr:/ {print $2}' | cut -d':' -f2)
+ echo "IP Address is $DP_IP"
+
+ echo "Generate the netcfg json"
+ cat <<EOF > /tmp/netcfg.json
+ {
+ "apps": {
+ "org.omecproject.up4": {
+ "dbuf": {
+ "serviceAddr": "$GRPC_SERVICE_NAME.$NAMESPACE:$GRPC_PORT",
+ "dataplaneAddr": "$DP_IP:$DP_PORT"
+ }
+ }
+ }
+ }
+ EOF
+
+ cat /tmp/netcfg.json
+ curl --fail -sSL --user $ONOS_USERNAME:$ONOS_PASSWORD --noproxy $ONOS_SERVER -X POST -H 'Content-Type:application/json' \
+ http://$ONOS_SERVER:$ONOS_PORT/onos/v1/network/configuration -d@/tmp/netcfg.json
+ sleep 1m
+ done