blob: 714d79c37840579a7320aee383f7a189bb9a8e89 [file] [log] [blame]
Hyunsun Moon06f98552019-08-15 13:44:47 -06001#!/bin/sh
Hyunsun Moona24d3f92019-06-19 03:04:58 -05002#
3# Copyright 2019-present Open Networking Foundation
4# Copyright 2019 Intel Corporation
5#
6# Licensed under the Apache License, Version 2.0 (the "License");
7# you may not use this file except in compliance with the License.
8# You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing, software
13# distributed under the License is distributed on an "AS IS" BASIS,
14# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15# See the License for the specific language governing permissions and
16# limitations under the License.
17
18set -ex
19
Hyunsun Moon7a921d12019-08-21 20:52:09 -050020UL_IFACE="{{ .Values.config.spgwu.s1u.device }}-veth"
21DL_IFACE="{{ .Values.config.spgwu.sgi.device }}-veth"
Hyunsun Moona24d3f92019-06-19 03:04:58 -050022
23if ! ip link show $UL_IFACE; then
24 s1u_mac=$(ip addr show dev s1u-net | awk '$1=="link/ether"{print $2}')
25 ip link add $UL_IFACE type veth peer name l_$UL_IFACE
26 ip link set $UL_IFACE up
27 ip link set l_$UL_IFACE up
28 ip link set dev $UL_IFACE address $s1u_mac
29fi
30if ! ip link show $DL_IFACE; then
31 sgi_mac=$(ip addr show dev sgi-net | awk '$1=="link/ether"{print $2}')
32 ip link add $DL_IFACE type veth peer name l_$DL_IFACE
33 ip link set $DL_IFACE up
34 ip link set l_$DL_IFACE up
35 ip link set dev $DL_IFACE address $sgi_mac
36fi
37
38if ! ip addr show $UL_IFACE | grep inet; then
39 s1u_ip=$(ip addr show s1u-net | grep inet | grep -v inet6 | awk '{print $2}')
40 ip addr add $s1u_ip dev $UL_IFACE
41fi
42if ! ip addr show $DL_IFACE | grep inet; then
43 sgi_ip=$(ip addr show sgi-net | grep inet | grep -v inet6 | awk '{print $2}')
44 ip addr add $sgi_ip dev $DL_IFACE
45fi
46
47ip a