Jeremy Ronquillo | 223db00 | 2020-06-05 10:28:22 -0700 | [diff] [blame^] | 1 | #!/bin/sh |
| 2 | # |
| 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 | |
| 18 | set -ex |
| 19 | |
| 20 | UL_IFACE="{{ .Values.config.spgwu.s1u.device }}-veth" |
| 21 | DL_IFACE="{{ .Values.config.spgwu.sgi.device }}-veth" |
| 22 | |
| 23 | if ! 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 |
| 29 | fi |
| 30 | if ! 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 |
| 36 | fi |
| 37 | |
| 38 | if ! 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 |
| 41 | fi |
| 42 | if ! 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 |
| 45 | fi |
| 46 | |
| 47 | ip a |