blob: e41a9ae1819d7a6059bdba94acc3bd8b1bdca5a2 [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:
Hung-Wei Chiu8bc07562021-02-24 18:19:36 -080014 config: |
Hung-Wei Chiu3713e562021-02-17 14:14:35 -080015 #!/bin/sh
Hung-Wei Chiu8bc07562021-02-24 18:19:36 -080016 set -x
Hung-Wei Chiu3713e562021-02-17 14:14:35 -080017 env
Hung-Wei Chiu8bc07562021-02-24 18:19:36 -080018 export IFS=','
19 for r in $STATIC_ROUTES; do
20 ip route add $r dev $DP_INTERFACE
21 done
22 unset IFS
Hung-Wei Chiu3713e562021-02-17 14:14:35 -080023 ifconfig
24 while true
25 do
26 echo "Get the IP Address from interface $DP_INTERFACE"
27 ifconfig $DP_INTERFACE
28 #IP Address from ifconfig is addr:10.71.126.127, have to cut it off
29 DP_IP=$(ifconfig $DP_INTERFACE | awk '/inet addr:/ {print $2}' | cut -d':' -f2)
30 echo "IP Address is $DP_IP"
31
32 echo "Generate the netcfg json"
33 cat <<EOF > /tmp/netcfg.json
34 {
35 "apps": {
36 "org.omecproject.up4": {
37 "dbuf": {
38 "serviceAddr": "$GRPC_SERVICE_NAME.$NAMESPACE:$GRPC_PORT",
39 "dataplaneAddr": "$DP_IP:$DP_PORT"
40 }
41 }
42 }
43 }
44 EOF
45
46 cat /tmp/netcfg.json
47 curl --fail -sSL --user $ONOS_USERNAME:$ONOS_PASSWORD --noproxy $ONOS_SERVER -X POST -H 'Content-Type:application/json' \
48 http://$ONOS_SERVER:$ONOS_PORT/onos/v1/network/configuration -d@/tmp/netcfg.json
49 sleep 1m
50 done