blob: bd65a237fce781046cf7e040186763a019bfc3b3 [file] [log] [blame]
Badhrinath Pa3a3088a2020-07-28 18:37:16 -07001#!/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
9set -ex
10
11UL_IFACE="{{ .Values.config.pfcpAgent.s1u.device }}-veth"
12DL_IFACE="{{ .Values.config.pfcpAgent.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