Hung-Wei Chiu | 3713e56 | 2021-02-17 14:14:35 -0800 | [diff] [blame] | 1 | {{/* |
| 2 | # Copyright 2021-present Open Networking Foundation |
| 3 | |
Scott Baker | 4cad5ee | 2022-06-09 14:17:35 -0700 | [diff] [blame^] | 4 | # SPDX-License-Identifier: Apache-2.0 |
Hung-Wei Chiu | 3713e56 | 2021-02-17 14:14:35 -0800 | [diff] [blame] | 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 |
Hung-Wei Chiu | b34d966 | 2021-03-09 19:11:11 -0800 | [diff] [blame] | 26 | echo "Up SR-IOV intercae" |
| 27 | ip link set $DP_INTERFACE up |
Hung-Wei Chiu | 3713e56 | 2021-02-17 14:14:35 -0800 | [diff] [blame] | 28 | echo "Get the IP Address from interface $DP_INTERFACE" |
| 29 | ifconfig $DP_INTERFACE |
| 30 | #IP Address from ifconfig is addr:10.71.126.127, have to cut it off |
| 31 | DP_IP=$(ifconfig $DP_INTERFACE | awk '/inet addr:/ {print $2}' | cut -d':' -f2) |
| 32 | echo "IP Address is $DP_IP" |
| 33 | |
| 34 | echo "Generate the netcfg json" |
| 35 | cat <<EOF > /tmp/netcfg.json |
| 36 | { |
| 37 | "apps": { |
| 38 | "org.omecproject.up4": { |
| 39 | "dbuf": { |
| 40 | "serviceAddr": "$GRPC_SERVICE_NAME.$NAMESPACE:$GRPC_PORT", |
| 41 | "dataplaneAddr": "$DP_IP:$DP_PORT" |
| 42 | } |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | EOF |
| 47 | |
| 48 | cat /tmp/netcfg.json |
| 49 | curl --fail -sSL --user $ONOS_USERNAME:$ONOS_PASSWORD --noproxy $ONOS_SERVER -X POST -H 'Content-Type:application/json' \ |
| 50 | http://$ONOS_SERVER:$ONOS_PORT/onos/v1/network/configuration -d@/tmp/netcfg.json |
| 51 | sleep 1m |
| 52 | done |