Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 1 | #!/bin/sh |
Jeremy Ronquillo | ec2d3e4 | 2020-06-05 11:33:39 -0700 | [diff] [blame] | 2 | |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 3 | # Copyright 2019 Intel Corporation |
Jeremy Ronquillo | ec2d3e4 | 2020-06-05 11:33:39 -0700 | [diff] [blame] | 4 | # Copyright 2019-present Open Networking Foundation |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 5 | # |
Jeremy Ronquillo | ec2d3e4 | 2020-06-05 11:33:39 -0700 | [diff] [blame] | 6 | # SPDX-License-Identifier: Apache-2.0 |
Jeremy Ronquillo | 6046ce3 | 2020-06-18 11:06:29 -0700 | [diff] [blame] | 7 | # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0 |
Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame] | 8 | |
| 9 | set -ex |
| 10 | |
| 11 | UL_IFACE="{{ .Values.config.spgwu.s1u.device }}-veth" |
| 12 | DL_IFACE="{{ .Values.config.spgwu.sgi.device }}-veth" |
| 13 | |
| 14 | if ! ip link show $UL_IFACE; then |
| 15 | s1u_mac=$(ip addr show dev s1u-net | awk '$1=="link/ether"{print $2}') |
| 16 | ip link add $UL_IFACE type veth peer name l_$UL_IFACE |
| 17 | ip link set $UL_IFACE up |
| 18 | ip link set l_$UL_IFACE up |
| 19 | ip link set dev $UL_IFACE address $s1u_mac |
| 20 | fi |
| 21 | if ! ip link show $DL_IFACE; then |
| 22 | sgi_mac=$(ip addr show dev sgi-net | awk '$1=="link/ether"{print $2}') |
| 23 | ip link add $DL_IFACE type veth peer name l_$DL_IFACE |
| 24 | ip link set $DL_IFACE up |
| 25 | ip link set l_$DL_IFACE up |
| 26 | ip link set dev $DL_IFACE address $sgi_mac |
| 27 | fi |
| 28 | |
| 29 | if ! ip addr show $UL_IFACE | grep inet; then |
| 30 | s1u_ip=$(ip addr show s1u-net | grep inet | grep -v inet6 | awk '{print $2}') |
| 31 | ip addr add $s1u_ip dev $UL_IFACE |
| 32 | fi |
| 33 | if ! ip addr show $DL_IFACE | grep inet; then |
| 34 | sgi_ip=$(ip addr show sgi-net | grep inet | grep -v inet6 | awk '{print $2}') |
| 35 | ip addr add $sgi_ip dev $DL_IFACE |
| 36 | fi |
| 37 | |
| 38 | ip a |