blob: 2df6d1137a0d11e8386110912ce866b2b721ee39 [file] [log] [blame]
Hung-Wei Chiu3713e562021-02-17 14:14:35 -08001{{/*
2# Copyright 2021-present Open Networking Foundation
3
4# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
5*/}}
6
7apiVersion: v1
8kind: ConfigMap
9metadata:
10 name: {{ include "dbuf.fullname" . }}
11 labels:
12 {{- include "dbuf.labels" . | nindent 4 }}
13data:
14 push-onos: |
15 #!/bin/sh
16 set -e -x
17 env
18 ifconfig
19 while true
20 do
21 echo "Get the IP Address from interface $DP_INTERFACE"
22 ifconfig $DP_INTERFACE
23 #IP Address from ifconfig is addr:10.71.126.127, have to cut it off
24 DP_IP=$(ifconfig $DP_INTERFACE | awk '/inet addr:/ {print $2}' | cut -d':' -f2)
25 echo "IP Address is $DP_IP"
26
27 echo "Generate the netcfg json"
28 cat <<EOF > /tmp/netcfg.json
29 {
30 "apps": {
31 "org.omecproject.up4": {
32 "dbuf": {
33 "serviceAddr": "$GRPC_SERVICE_NAME.$NAMESPACE:$GRPC_PORT",
34 "dataplaneAddr": "$DP_IP:$DP_PORT"
35 }
36 }
37 }
38 }
39 EOF
40
41 cat /tmp/netcfg.json
42 curl --fail -sSL --user $ONOS_USERNAME:$ONOS_PASSWORD --noproxy $ONOS_SERVER -X POST -H 'Content-Type:application/json' \
43 http://$ONOS_SERVER:$ONOS_PORT/onos/v1/network/configuration -d@/tmp/netcfg.json
44 sleep 1m
45 done