Badhrinath Pa | 3a3088a | 2020-07-28 18:37:16 -0700 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # Copyright 2019 Intel Corporation |
| 4 | # Copyright 2019-present Open Networking Foundation |
| 5 | # |
| 6 | # SPDX-License-Identifier: Apache-2.0 |
| 7 | # SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0 |
| 8 | |
| 9 | set -ex |
| 10 | |
| 11 | UL_IFACE="{{ .Values.config.pfcpAgent.s1u.device }}-veth" |
| 12 | DL_IFACE="{{ .Values.config.pfcpAgent.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 |