Commit de7932b1 authored by kharade's avatar kharade Committed by thhung

upf n9 support

parent 265d99ea
......@@ -41,25 +41,41 @@ set -euo pipefail
CONFIG_DIR="/openair-upf/etc"
BIN_DIR="/openair-upf/bin"
INGRESS_INTERFACE=n3
INGRESS_INT=N3
EGRESS_INTERFACE=n6
EGRESS_INT=N6
UPF_TYPE=${UPF_TYPE:-none}
if [[ ${UPF_TYPE} == "A-UPF" ]];then
INGRESS_INTERFACE=n9
INGRESS_INT=N9
fi
if [[ ${UPF_TYPE} == "I-UPF" ]];then
EGRESS_INTERFACE=n9
EGRESS_INT=N9
fi
UUID=$(cat /proc/sys/kernel/random/uuid)
SGI_IPV4=$(ifconfig $INTERFACE_CORE | grep "inet " | awk '{print $2}')
ACCESS_IPV4=$(ifconfig $INTERFACE_ACCESS | grep "inet " | awk '{print $2}')
CORE_IPV4=$(ifconfig $INTERFACE_CP | grep "inet " | awk '{print $2}')
EGRESS_IPV4=$(ifconfig $INTERFACE_CORE | grep "inet " | awk '{print $2}')
INGRESS_IPV4=$(ifconfig $INTERFACE_ACCESS | grep "inet " | awk '{print $2}')
CP_IPV4=$(ifconfig $INTERFACE_CP | grep "inet " | awk '{print $2}')
N3_IPV4_ADDRESS_LOCAL=${N3_IPV4_ADDRESS_LOCAL:-$(ifconfig $INTERFACE_ACCESS | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".202"}
INGRESS_INT_ADDR_LOCAL=${INGRESS_INT_ADDR_LOCAL:-$(ifconfig $INTERFACE_ACCESS | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".202"}
N4_IPV4_ADDRESS_LOCAL=${N4_IPV4_ADDRESS_LOCAL:-$(ifconfig $INTERFACE_CP | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".202"}
N6_IPV4_ADDRESS_LOCAL=${N6_IPV4_ADDRESS_LOCAL:-$(ifconfig $INTERFACE_CORE | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".202"}
EGRESS_INT_ADDR_LOCAL=${EGRESS_INT_ADDR_LOCAL:-$(ifconfig $INTERFACE_CORE | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".202"}
N3_IPV4_ADDRESS_REMOTE=${N3_IPV4_ADDRESS_REMOTE:-$(ifconfig $INTERFACE_ACCESS | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".1"}
INGRESS_INT_ADDR_REMOTE=${INGRESS_INT_ADDR_REMOTE:-$(ifconfig $INTERFACE_ACCESS | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".1"}
N4_IPV4_ADDRESS_REMOTE=${N4_IPV4_ADDRESS_REMOTE:-$(ifconfig $INTERFACE_CP | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".1"}
N6_IPV4_ADDRESS_REMOTE=${N6_IPV4_ADDRESS_REMOTE:-$(ifconfig $INTERFACE_CORE | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".1"}
EGRESS_INT_ADDR_REMOTE=${EGRESS_INT_ADDR_REMOTE:-$(ifconfig $INTERFACE_CORE | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".1"}
###############################
# UPF Config
###############################
array=(${CONFIG_DIR}/*.conf ${CONFIG_DIR}/*.json ${BIN_DIR}/nrf_client.sh)
for c in "${array[@]}"; do
# grep variable names (format: ${VAR}) from template to be rendered
# grep variable names (format: ${VAR}) from tem for plate to be rendered
VARS=$(grep -oP '@[a-zA-Z0-9_]+@' ${c} | sort | uniq | xargs)
# create sed expressions for substituting each occurrence of ${VAR}
# with the value of the environment variable "VAR"
......@@ -89,18 +105,18 @@ done
#
ip link set $INTERFACE_ACCESS down
ip link set $INTERFACE_ACCESS name n3
ip link set n3 up
ip link set $INTERFACE_ACCESS name $INGRESS_INTERFACE
ip link set $INGRESS_INTERFACE up
ip link set $INTERFACE_CP down
ip link set $INTERFACE_CP name n4
ip link set n4 up
ip link set $INTERFACE_CORE down
ip link set $INTERFACE_CORE name n6
ip link set n6 up
ip link set $INTERFACE_CORE name $EGRESS_INTERFACE
ip link set $EGRESS_INTERFACE up
ip route add $NETWORK_UE_IP via $SGI_IPV4 dev n6
ip route add $NETWORK_UE_IP via $EGRESS_IPV4 dev $EGRESS_INTERFACE
echo "Done setting the configuration"
......
ip table add 1
ip table add 2
create host-interface name n6
set interface mtu 1500 host-n6
set interface ip table host-n6 1
set interface ip address host-n6 @N6_IPV4_ADDRESS_LOCAL@/24
set interface state host-n6 up
create host-interface name @EGRESS_INTERFACE@
set interface mtu 1500 host-@EGRESS_INTERFACE@
set interface ip table host-@EGRESS_INTERFACE@ 1
set interface ip address host-@EGRESS_INTERFACE@ @EGRESS_INT_ADDR_LOCAL@/24
set interface state host-@EGRESS_INTERFACE@ up
create host-interface name n4
set interface mtu 1500 host-n4
......@@ -13,22 +13,23 @@ set interface ip table host-n4 0
set interface ip address host-n4 @N4_IPV4_ADDRESS_LOCAL@/24
set interface state host-n4 up
create host-interface name n3
set interface mtu 1500 host-n3
set interface ip table host-n3 2
set interface ip address host-n3 @N3_IPV4_ADDRESS_LOCAL@/24
set interface state host-n3 up
create host-interface name @INGRESS_INTERFACE@
set interface mtu 1500 host-@INGRESS_INTERFACE@
set interface ip table host-@INGRESS_INTERFACE@ 2
set interface ip address host-@INGRESS_INTERFACE@ @INGRESS_INT_ADDR_LOCAL@/24
set interface state host-@INGRESS_INTERFACE@ up
ip route add 0.0.0.0/0 table 2 via @N3_IPV4_ADDRESS_REMOTE@ host-n3
ip route add 0.0.0.0/0 table 2 via @INGRESS_INT_ADDR_REMOTE@ host-@INGRESS_INTERFACE@
ip route add 0.0.0.0/0 table 0 via @N4_IPV4_ADDRESS_REMOTE@ host-n4
ip route add 0.0.0.0/0 table 1 via @N6_IPV4_ADDRESS_REMOTE@ host-n6
ip route add 0.0.0.0/0 table 1 via @EGRESS_INT_ADDR_REMOTE@ host-@EGRESS_INTERFACE@
upf pfcp endpoint ip @N4_IPV4_ADDRESS_LOCAL@ vrf 0
upf node-id fqdn gw@GW_ID@.vppupf.node.5gcn.mnc@MNC03@.mcc@MCC@.@REALM@
upf nwi name @NWI_N3@ vrf 2
upf nwi name @NWI_N6@ vrf 1
upf nwi name @NWI_INGRESS@ vrf 2
upf nwi name @NWI_ENGRESS@ vrf 1
upf specification release 16
upf gtpu endpoint ip @N3_IPV4_ADDRESS_LOCAL@ nwi @NWI_N3@ teid 0x000004d2/2
upf gtpu endpoint ip @INGRESS_INT_ADDR_LOCAL@ nwi @NWI_INGRESS@ teid 0x000004d2/2
......@@ -25,16 +25,17 @@
}
}],
"interfaceUpfInfoList": [{
"endpointFqdn": "@NWI_N3@",
"interfaceType": "N3",
"ipv4EndpointAddresses": ["@ACCESS_IPV4@"],
"networkInstance": "@NWI_N3@"
"endpointFqdn": "@NWI_INGRESS@",
"interfaceType": "@INGRESS_INT@",
"ipv4EndpointAddresses": ["@INGRESS_IPV4@"],
"networkInstance": "@NWI_INGRESS@"
}, {
"endpointFqdn": "@NWI_N6@",
"interfaceType": "N6",
"ipv4EndpointAddresses": ["@SGI_IPV4@"],
"networkInstance": "@NWI_N6@"
"endpointFqdn": "@NWI_ENGRESS@",
"interfaceType": "@EGRESS_INT@",
"ipv4EndpointAddresses": ["@EGRESS_IPV4@"],
"networkInstance": "@NWI_ENGRESS@"
}]
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment