blob: 764ed543194a4fd819d3a8dd0df9a708ee116c29 [file] [log] [blame]
Hung-Wei Chiu3713e562021-02-17 14:14:35 -08001{{/*
2# Copyright 2021-present Open Networking Foundation
3
Scott Baker4cad5ee2022-06-09 14:17:35 -07004# SPDX-License-Identifier: Apache-2.0
Hung-Wei Chiu3713e562021-02-17 14:14:35 -08005*/}}
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
Hung-Wei Chiub34d9662021-03-09 19:11:11 -080026 echo "Up SR-IOV intercae"
27 ip link set $DP_INTERFACE up
Hung-Wei Chiu3713e562021-02-17 14:14:35 -080028 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