Commit f9ea9c5d authored by kharade's avatar kharade

added files for snap conf, removed unused vars

parent 86e21f2c
......@@ -44,8 +44,6 @@ BIN_DIR="/openair-upf/bin"
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}')
N3_IPV4_ADDRESS_LOCAL=${N3_IPV4_ADDRESS_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"}
......
#!/bin/bash
#"""
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this
# * file except in compliance with the License. You may obtain a copy of the
# * License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
#
#/*! \file nrf_client.py
# \author Rohan KHARADE
# \date 2021
# \email: rohan.kharade@openairinterface.org
#*/
#"""
if [ $(id -u) -ne 0 ]; then
exec sudo -E "$0" "$@"
fi
base=$(dirname $0)
APP="$base/bin/vpp"
ARGS="-c $base/etc/startup_debug.conf"
USAGE="Usage: run.sh [-r] [ debug ]
debug: executes vpp under gdb"
while getopts ":r" opt; do
case $opt in
r)
APP="$base/bin/vpp"
ARGS="-c $base/etc/startup.conf"
;;
\?)
echo "Invalid option: -$OPTARG\n" >&2
echo "$USAGE" >&2
exit 1
;;
esac
done
shift $((OPTIND-1))
if test -z "$1"; then
$APP $ARGS &
elif test "$1" = "debug"; then
shift
gdb -ex 'set print pretty on' -ex 'run' --args $APP $ARGS $@
else
echo "$USAGE" >&2
exit 1
fi
while :
do
echo "waiting for vpp-upf service"
RES=$(bin/vppctl sh upf specification release | awk {'print $3'})
echo $RES
if [[ $RES =~ 16 ]]; then
echo "vpp-upf service is running now"
break
fi
sleep 3
done
if [[ ${REGISTER_NRF} == "yes" ]];then
$base/bin/nrf_client.sh
fi
sleep infinity
ip table add 1
ip table add 2
create host-interface name @INTERFACE_CORE@
set interface mtu 1500 host-@INTERFACE_CORE@
set interface ip table host-@INTERFACE_CORE@ 1
set interface ip address host-@INTERFACE_CORE@ @INTERFACE_CORE@/24
set interface state host-@INTERFACE_CORE@ up
create host-interface name @INTERFACE_CP@
set interface mtu 1500 host-@INTERFACE_CP@
set interface ip table host-@INTERFACE_CP@ 0
set interface ip address host-@INTERFACE_CP@ @INTERFACE_CP@/24
set interface state host-@INTERFACE_CP@ up
create host-interface name @INTERFACE_ACCESS@
set interface mtu 1500 host-@INTERFACE_ACCESS@
set interface ip table host-@INTERFACE_ACCESS@ 2
set interface ip address host-@INTERFACE_ACCESS@ @INTERFACE_ACCESS@/24
set interface state host-@INTERFACE_ACCESS@ 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 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
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 specification release 16
upf gtpu endpoint ip @N3_IPV4_ADDRESS_LOCAL@ nwi @NWI_N3@ teid 0x000004d2/2
#!/bin/bash
#"""
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements. See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.1 (the "License"); you may not use this
# * file except in compliance with the License. You may obtain a copy of the
# * License at
# *
# * http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# * contact@openairinterface.org
# */
#
#/*! \file nrf_client.py
# \author Rohan KHARADE
# \date 2021
# \email: rohan.kharade@openairinterface.org
#*/
#"""
trigger_nf_registration() {
UUID=9614ea76-2e95-4f01-ad57-e7abbf251820
CONFIG_DIR=/openair-upf/etc
NRF_URL=$NRF_IP_ADDR:$NRF_PORT/nnrf-nfm/v1/nf-instances/$UUID
##### Variables #####
DUMP_STATUS_CODE=$(echo '--write-out %{http_code} --silent --output /dev/null')
PATCH_DATA=$(echo '[{"op":"replace","path":"/nfStatus","value":"REGISTERED"}]')
CONTENT_TYPE=$(echo 'Content-Type: application/json')
HTTP2=--http2-prior-knowledge
UPF_PROFILE=$CONFIG_DIR/upf_profile.json
NF_HEARTBEAT_TIMER=10
NF_HEARTBEAT_START=5
##### NF Registration #####
echo "Sending NF Registration Request (HTTP Version $HTTP_VERSION)"
if [[ ${HTTP_VERSION} == 2 ]];then
response=$(curl $HTTP2 $DUMP_STATUS_CODE -X PUT $NRF_URL -d @$UPF_PROFILE -H "$CONTENT_TYPE")
else
response=$(curl $DUMP_STATUS_CODE -X PUT $NRF_URL -d @$UPF_PROFILE -H "$CONTENT_TYPE")
fi
##### NF Heartbeat #####
if [[ ${response} == 201 || ${response} == 200 ]];then
echo -e "Received NF registration response (HTTP_STATUS_CODE_200/201)\n"
sleep $NF_HEARTBEAT_START
while true
do
echo "Sending NF heartbeat request"
if [[ ${HTTP_VERSION} == 2 ]]; then
response=$(curl $HTTP2 $DUMP_STATUS_CODE -X PATCH $NRF_URL -d $PATCH_DATA -H "$CONTENT_TYPE")
else
response=$(curl $DUMP_STATUS_CODE -X PATCH $NRF_URL -d $PATCH_DATA -H "$CONTENT_TYPE")
fi
if [[ ${response} == 204 ]];then
echo -e "Received NF heartbeat response (HTTP_STATUS_CODE_204)\n"
fi
sleep $NF_HEARTBEAT_TIMER
done
else
echo -e "\nNF Registration Procedure Failed ........!!!!"
fi
}
if [ $(id -u) -ne 0 ]; then
exec sudo -E "$0" "$@"
fi
base=$(dirname $0)
APP="$base/bin/vpp"
ARGS="-c $base/etc/startup_debug.conf"
$APP $ARGS &
while :
do
echo "waiting for vpp-upf service"
RES=$(bin/vppctl sh upf specification release | awk {'print $3'})
echo $RES
if [[ $RES =~ 16 ]]; then
echo "vpp-upf service is running now"
break
fi
sleep 3
done
if [[ ${REGISTER_NRF} == "yes" ]];then
trigger_nf_registration
fi
sleep infinity
unix {
nodaemon
log /tmp/vpp.log
full-coredump
gid vpp
interactive
cli-listen /run/vpp/cli.sock
exec @INIT_CONF_PATH@
}
api-trace {
on
}
cpu {
main-core 0
corelist-workers 1
}
api-segment {
gid vpp
}
plugins {
path @VPP_PLUGIN_PATH@
plugin dpdk_plugin.so { disable }
plugin gtpu_plugin.so { disable }
plugin upf_plugin.so { enable }
}
#!/usr/bin/env bash
NWI_N3=access.oai.org
NWI_N6=core.oai.org
GW_ID=1
MNC03=95
MCC=208
REALM=3gppnetwork.org
NETWORK_UE_IP=12.2.1.0/24
INIT_CONF_PATH=
VPP_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/vpp_plugins/ # Ubntu18.04
INTERFACE_ACCESS=cn5g-access # N3
INTERFACE_CORE=cn5g-core # N6
INTERFACE_CP=demo-oai # N4
NSSAI_SD_0=123
SST=222
DNN=default
REGISTER_NRF=yes
NRF_IP_ADDR=192.168.70.130
NRF_PORT=8080
UUID=0beafa60-8211-4774-b54f-2a8a35a721fe #$(cat /proc/sys/kernel/random/uuid)
HTTP_VERSION=2
################ Gateway for N3(Gnb), N4(SMF), N6(DN/NAT Gateway) ################
#N3_IPV4_ADDRESS_REMOTE=${N3_IPV4_ADDRESS_REMOTE:-$(ifconfig $INTERFACE_ACCESS | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".1"}
N3_IPV4_ADDRESS_REMOTE=192.168.70.1
#N4_IPV4_ADDRESS_REMOTE=${N4_IPV4_ADDRESS_REMOTE:-$(ifconfig $INTERFACE_CP | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".1"}
N4_IPV4_ADDRESS_REMOTE=192.168.72.1
#N6_IPV4_ADDRESS_REMOTE=${N6_IPV4_ADDRESS_REMOTE:-$(ifconfig $INTERFACE_CORE | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".1"}
N6_IPV4_ADDRESS_REMOTE=192.168.73.135
################ Veth Pair IP in the VPP switch ################
#N3_IPV4_ADDRESS_LOCAL=${N3_IPV4_ADDRESS_LOCAL:-$(ifconfig $INTERFACE_ACCESS | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".202"}
N3_IPV4_ADDRESS_LOCAL=192.168.72.202
#N4_IPV4_ADDRESS_LOCAL=${N4_IPV4_ADDRESS_LOCAL:-$(ifconfig $INTERFACE_CP | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".202"}
N4_IPV4_ADDRESS_LOCAL=192.168.70.202
#N6_IPV4_ADDRESS_LOCAL=${N6_IPV4_ADDRESS_LOCAL:-$(ifconfig $INTERFACE_CORE | grep "inet " | awk '{print $2}' | cut -d"." -f1-3)".202"}
N6_IPV4_ADDRESS_LOCAL=192.168.73.202
{
"nfInstanceId": "@UUID@",
"capacity": 100,
"fqdn": "gw@GW_ID@.vppupf.node.5gcn.mnc@MNC03@.mcc@MCC@.@REALM@",
"heartBeatTimer": 10,
"ipv4Addresses": ["@N4_IPV4_ADDRESS_LOCAL@"],
"json_data": null,
"nfInstanceName": "OAI-UPF-VPP",
"nfServices": [],
"nfStatus": "REGISTERED",
"nfType": "UPF",
"priority": 1,
"sNssais": [{
"sd": "@NSSAI_SD_0@",
"sst": @SST@
}],
"upfInfo": {
"sNssaiUpfInfoList": [{
"dnnUpfInfoList": [{
"dnn": "@DNN@"
}],
"sNssai": {
"sd": "@NSSAI_SD_0@",
"sst": @SST@
}
}],
"interfaceUpfInfoList": [{
"endpointFqdn": "@NWI_N3@",
"interfaceType": "N3",
"ipv4EndpointAddresses": ["@N3_IPV4_ADDRESS_LOCAL@"],
"networkInstance": "@NWI_N3@"
}, {
"endpointFqdn": "@NWI_N6@",
"interfaceType": "N6",
"ipv4EndpointAddresses": ["@N6_IPV4_ADDRESS_LOCAL@"],
"networkInstance": "@NWI_N6@"
}]
}
}
......@@ -27,12 +27,12 @@
"interfaceUpfInfoList": [{
"endpointFqdn": "@NWI_N3@",
"interfaceType": "N3",
"ipv4EndpointAddresses": ["@ACCESS_IPV4@"],
"ipv4EndpointAddresses": ["@N3_IPV4_ADDRESS_LOCAL@"],
"networkInstance": "@NWI_N3@"
}, {
"endpointFqdn": "@NWI_N6@",
"interfaceType": "N6",
"ipv4EndpointAddresses": ["@SGI_IPV4@"],
"ipv4EndpointAddresses": ["@N6_IPV4_ADDRESS_LOCAL@"],
"networkInstance": "@NWI_N6@"
}]
......
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