blob: 764ed543194a4fd819d3a8dd0df9a708ee116c29 [file] [log] [blame]
Yi Tseng32561422021-10-07 15:03:21 -07001{{/*
2# Copyright 2021-present Open Networking Foundation
3
Charles Chand1b4bf92022-02-02 16:27:10 -08004# SPDX-License-Identifier: Apache-2.0
Yi Tseng32561422021-10-07 15:03:21 -07005*/}}
6
7apiVersion: v1
8kind: ConfigMap
9metadata:
10 name: {{ include "dbuf.fullname" . }}
11 labels:
12 {{- include "dbuf.labels" . | nindent 4 }}
13data:
14 config: |
15 #!/bin/sh
16 set -x
17 env
18 export IFS=','
19 for r in $STATIC_ROUTES; do
20 ip route add $r dev $DP_INTERFACE
21 done
22 unset IFS
23 ifconfig
24 while true
25 do
26 echo "Up SR-IOV intercae"
27 ip link set $DP_INTERFACE up
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