blob: 5cc1f98712f5fc9cb390504a15b4829f054a75ea [file] [log] [blame]
Jeremy Ronquillo223db002020-06-05 10:28:22 -07001#!/bin/sh
Jeremy Ronquilloec2d3e42020-06-05 11:33:39 -07002
Jeremy Ronquillo223db002020-06-05 10:28:22 -07003# Copyright 2019 Intel Corporation
Jeremy Ronquilloec2d3e42020-06-05 11:33:39 -07004# Copyright 2019-present Open Networking Foundation
Jeremy Ronquillo223db002020-06-05 10:28:22 -07005#
Jeremy Ronquilloec2d3e42020-06-05 11:33:39 -07006# SPDX-License-Identifier: Apache-2.0
Jeremy Ronquillo6046ce32020-06-18 11:06:29 -07007# SPDX-License-Identifier: LicenseRef-ONF-Member-Only-1.0
Jeremy Ronquillo223db002020-06-05 10:28:22 -07008
9set -ex
10
11UL_IFACE="{{ .Values.config.spgwu.s1u.device }}-veth"
12DL_IFACE="{{ .Values.config.spgwu.sgi.device }}-veth"
13
14if ! 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
20fi
21if ! 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
27fi
28
29if ! 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
32fi
33if ! 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
36fi
37
38ip a