Hung-Wei Chiu | 3713e56 | 2021-02-17 14:14:35 -0800 | [diff] [blame] | 1 | {{/* |
| 2 | # Copyright 2021-present Open Networking Foundation |
| 3 | |
| 4 | # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0 |
| 5 | */}} |
| 6 | |
| 7 | apiVersion: v1 |
| 8 | kind: ConfigMap |
| 9 | metadata: |
| 10 | name: {{ include "dbuf.fullname" . }} |
| 11 | labels: |
| 12 | {{- include "dbuf.labels" . | nindent 4 }} |
| 13 | data: |
Hung-Wei Chiu | 8bc0756 | 2021-02-24 18:19:36 -0800 | [diff] [blame] | 14 | config: | |
Hung-Wei Chiu | 3713e56 | 2021-02-17 14:14:35 -0800 | [diff] [blame] | 15 | #!/bin/sh |
Hung-Wei Chiu | 8bc0756 | 2021-02-24 18:19:36 -0800 | [diff] [blame] | 16 | set -x |
Hung-Wei Chiu | 3713e56 | 2021-02-17 14:14:35 -0800 | [diff] [blame] | 17 | env |
Hung-Wei Chiu | 8bc0756 | 2021-02-24 18:19:36 -0800 | [diff] [blame] | 18 | export IFS=',' |
| 19 | for r in $STATIC_ROUTES; do |
| 20 | ip route add $r dev $DP_INTERFACE |
| 21 | done |
| 22 | unset IFS |
Hung-Wei Chiu | 3713e56 | 2021-02-17 14:14:35 -0800 | [diff] [blame] | 23 | 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 |