Commit 245af2d1 authored by Binh Nguyen's avatar Binh Nguyen

Simeca profile PhantomNet

parent 86026f5d
......@@ -3,7 +3,7 @@
source ../simeca_constants.sh
if [ ! -f /var/log/UE_INITED ]; then
if [ ! -f /tmp/UE_INITED ]; then
echo "The UE_ID does not seem to be initialized. Did you forget to run ./init_ue.sh?"
exit 1
fi
......@@ -26,13 +26,13 @@ fi
#Run this on MF (MME) node.
#
echo "==========Starting OVS switches .... ==========="
cd $START_SCRIPTS
bash $START_SCRIPTS/start_switches.sh access1,access2,access3 tor,hsw1
cd $START_SCRIPTS_EPC
bash $START_SCRIPTS_EPC/start_switches.sh access1,access2,access3 tor,hsw1
echo "==========Adding IMSIs to HSS database .... ============"
ssh -o StrictHostKeyChecking=no epc.$domain -t -t "cd $HSS_PROVISION && sudo ./load_clients.sh 1 3"
ssh -o StrictHostKeyChecking=no epc.$domain -t -t "cd $HSS_PROVISION && sudo ./load_1_client.sh 001011234567899 491234567899 100"
ssh -o StrictHostKeyChecking=no epc.$domain -t -t "cd $HSS_PROVISION && sudo ./load_1_client.sh $NEXUS_IMSI $NEXUS_MISDN 200"
ssh -o StrictHostKeyChecking=no epc.$domain "cd $HSS_PROVISION && ./load_clients.sh 1 3"
ssh -o StrictHostKeyChecking=no epc.$domain "cd $HSS_PROVISION && ./load_1_client.sh 001011234567899 491234567899 100"
ssh -o StrictHostKeyChecking=no epc.$domain "cd $HSS_PROVISION && ./load_1_client.sh $NEXUS_IMSI $NEXUS_MISDN 200"
echo $CONF_PATH/P2P_ATTACH.data
......@@ -43,8 +43,9 @@ echo "3,001011234567891,192.168.7.10" >> /tmp/SERVER.data
echo "4,$NEXUS_IMSI,192.168.7.10" >> /tmp/SERVER.data
sudo cp /tmp/P2P_ATTACH.data $CONF_PATH/P2P_ATTACH.data #for P2P HO
sudo cp /tmp/SERVER.data $CONF_PATH/SERVER.data
mkdir -p $DATA
cp /tmp/P2P_ATTACH.data $HOME_DIR/data/P2P_ATTACH.data #for P2P HO
cp /tmp/SERVER.data $HOME_DIR/data/SERVER.data
echo "==========Starting eNBs and MF .... ============"
......@@ -53,10 +54,10 @@ bash $EPC/restart_epc.sh
echo "==========Copying IMSI data into $DATA ==========="
scp -o StrictHostKeyChecking=no "epc.$domain:/tmp/IMSI_*" /tmp/
sudo mkdir -p $DATA
sudo cp /tmp/IMSI_* $DATA/
cp /tmp/IMSI_* $DATA/
echo "==========Starting MC .... ============"
cd $MC_PATH
sudo pip install MySQL-python
#sudo pip install MySQL-python
mkdir /tmp/xml
ryu-manager MC.py
......@@ -13,5 +13,5 @@ bash $EPC/restart_epc.sh
echo "==========Starting MC .... ============"
cd $MC_PATH
ps ax | grep MC | awk '{system("sudo kill "$1)}'
#ps ax | grep MC | awk '{system("sudo kill "$1)}'
ryu-manager MC.py
......@@ -13,6 +13,6 @@ sudo sed -i "s/UE_ID=.*/UE_ID=\"$UE_ID\"/g" $SIMECA_PATH/simeca_constants.sh ||
exit 1
}
sudo touch /var/log/UE_INITED
touch /tmp/UE_INITED
exit 0
......@@ -3,10 +3,17 @@
source ../simeca_constants.sh
#domain=$(hostname | awk '{print $2"."$3"."$4"."$5}')
for i in $HOSTS
#for i in $OVS_HOSTS
#do
# echo "Replacing hostname of host $i"
# ssh -o StrictHostKeyChecking=no $i.$domain "/usr/local/src/simeca/SCRIPTS/replace_host_local.sh"
#done
for i in $EPC_HOSTS
do
echo "Replacing hostname of host $i"
ssh -o StrictHostKeyChecking=no $i.$domain "/usr/local/src/simeca/SCRIPTS/replace_host_local.sh"
ssh -o StrictHostKeyChecking=no $i.$domain -t -t "cd $BIN_DIR; sudo ./replace_host_local.sh"
done
touch /tmp/HOST_REPLACED
......@@ -3,10 +3,10 @@ source ../simeca_constants.sh
for i in enb2 enb3
do
ssh -o StrictHostKeyChecking=no $i.$domain -t -t "cd /usr/local/src/simeca/SCRIPTS; sudo ./set_ip_enb.sh"
ssh -o StrictHostKeyChecking=no $i.$domain -t -t "cd $BIN_DIR; sudo ./set_ip_enb.sh"
done
cd /usr/local/src/simeca/SCRIPTS
cd $BIN_DIR
sudo ./set_ip_mme.sh
touch /tmp/SETIP
#!/bin/bash
echo "normal"
echo xx
echo "with sudo"
sudo bash -c "echo yy"
~
~
......@@ -4,7 +4,7 @@ source ../simeca_constants.sh
domain=$(hostname | awk -F'.' '{print $2"."$3"."$4"."$5}')
ssh -o StrictHostKeyChecking=no sgw.$domain -t -t "cd $EPC; sudo $EPC/start_mme.sh; echo mme.flush | nc -q 1 -u 192.168.254.80 10000" || {
ssh -o StrictHostKeyChecking=no sgw.$domain -t -t "cd $EPC; sudo $BIN_DIR/start_mme.sh; echo mme.flush | nc -q 1 -u 192.168.254.80 10000" || {
echo "Could not restart mme!"
exit 1
}
......@@ -15,15 +15,15 @@ i=1
for e in enb2
do
let enb_offset=90+$i
ssh -o StrictHostKeyChecking=no $e.$domain -t -t "cd $EPC; sudo $EPC/start_enb.sh; echo enodeb.flush | nc -q 1 -u 192.168.254.$enb_offset 10000" || {
ssh -o StrictHostKeyChecking=no $e.$domain -t -t "cd $EPC; sudo $BIN_DIR/start_enb.sh; echo enodeb.flush | nc -q 1 -u 192.168.254.$enb_offset 10000" || {
echo "Could not restart $e!"
exit 1
}
let i+=1
done
#Emualted client
ssh -o StrictHostKeyChecking=no client1.$domain -t -t "cd $EPC; sudo $EPC/start_mm.sh" || {
#Emulated client
ssh -o StrictHostKeyChecking=no client1.$domain -t -t "cd $EPC; sudo $BIN_DIR/start_mm.sh" || {
echo "Could not restart mm client $client!"
exit 1
}
......
#!/bin/bash
source ../simeca_constants.sh
source /opt/simeca/simeca_constants.sh
if [ $(whoami) != "root" ]; then
echo "This must be run as root"
......@@ -23,7 +23,7 @@ let mgn_ip=$OFFSET_MGN_IP+$enb_id
an_lte_ip="192.168.3.$ip"
mgn="192.168.254.$mgn_ip"
sudo cp $XML/enodeb-ip-template.xml /opt/OpenEPC/etc/enodeb-ip.xml
cp $XML/enodeb-ip-template.xml /opt/OpenEPC/etc/enodeb-ip.xml
net_c=$($START_SCRIPTS/get_interface_map.pl | grep an-lte | awk '{print $3}' )
if [ "$enb" == "enb" ]; then
......@@ -40,8 +40,19 @@ sudo sed -i "s/CELLID/$cellid/g" /opt/OpenEPC/etc/enodeb-ip.xml
sudo sed -i "s/eNodeB/$enb_name/g" /opt/OpenEPC/etc/enodeb-ip.xml
sudo sed -i "s/MGN/$mgn/g" /opt/OpenEPC/etc/enodeb-ip.xml
#sed -i "s/NET_C_IP/$net_c_ip/g" /tmp/enodeb-ip.xml
#sed -i "s/NET_C/$net_c/g" /tmp/enodeb-ip.xml
#sed -i "s/NET_D_IP/$net_d_ip/g" /tmp/enodeb-ip.xml
#sed -i "s/NET_D/$net_d/g" /tmp/enodeb-ip.xml
#sed -i "s/CELLID/$cellid/g" /tmp/enodeb-ip.xml
#sed -i "s/eNodeB/$enb_name/g" /tmp/enodeb-ip.xml
#sed -i "s/MGN/$mgn/g" /tmp/enodeb-ip.xml
sudo cp /opt/OpenEPC/etc/enodeb.xml /opt/OpenEPC/etc/enodeb.bk.xml
sudo cp /opt/OpenEPC/etc/enodeb-ip.xml /opt/OpenEPC/etc/enodeb.xml
sudo cp /tmp/enodeb-ip.xml /opt/OpenEPC/etc/enodeb.xml
#cd $BIN_DIR
#sudo $BIN_DIR/config_enb.sh
cd $SIMECA_EPC/wharf
screen -S enodeb -L -d -m -h 10000 /bin/bash -c "./wharf -f /opt/OpenEPC/etc/enodeb.xml"
......
#!/bin/bash
source ../simeca_constants.sh
source /opt/simeca/simeca_constants.sh
if [ $(whoami) != "root" ]; then
echo "This must be run as root"
......@@ -11,26 +11,10 @@ cd $EPC
sudo /opt/OpenEPC/bin/mm.kill.sh
#imsi="001011234567890"
#client_name=$(hostname | cut -d"." -f1)
imsi="001011234567890"
client_name=$(hostname | cut -d"." -f1)
case $client_name in
alice)
imsi="001011234567890"
c_name="Alice"
;;
bob)
imsi="001011234567891"
c_name="Bob"
;;
charlie)
imsi="001011234567892"
c_name="Charlie"
;;
*)
echo "Client name unknown!"
;;
esac
c_name="Alice"
sudo cp $XML/mm.xml /opt/OpenEPC/etc/
sudo cp $XML/mm_network.xml /opt/OpenEPC/etc/
......
#!/bin/bash
source ../simeca_constants.sh
source /opt/simeca/simeca_constants.sh
if [ $(whoami) != "root" ]; then
echo "This must be run as root"
......@@ -9,7 +9,7 @@ fi
cd $EPC
sudo /opt/OpenEPC/bin/mme.kill.sh
sudo cp $XML/mme.xml /opt/OpenEPC/etc/
#sudo cp $XML/mme.xml /opt/OpenEPC/etc/
cd $SIMECA_EPC/wharf
......
......@@ -9,7 +9,7 @@ IMSI=$1
MSISDN=$2
ID=$3
SQL_FILE=ue$IMSI-tmp.sql
SQL_FILE=/tmp/ue$IMSI-tmp.sql
echo "/*-------HSS database generated for IMSI $IMSI, MSISDN $MSISDN, ID $ID------*/" > $SQL_FILE
echo "delete from imsu where id=$ID;" >> $SQL_FILE
......
......@@ -2,11 +2,11 @@
source ../simeca_constants.sh
E_PATH="$HSS_PROVISION"
SQL="$E_PATH/load_clients.sql"
SQL="/tmp/load_clients.sql"
CLEAN_SQL="$E_PATH/clear_db.sql"
USER_DATA="$SIMECA_PATH/data/user.dat"
USER_DATA="$HOME_DIR/data/user.dat"
sudo mkdir -p $SIMECA_PATH/data
mkdir -p $HOME_DIR/data
if [ $# -lt 2 ]; then
echo "Usage: <Starting ID> <Number of IMSI entries>"
exit 1
......
#!/bin/bash
###############MODIFY THIS FIRST!##################
UE_ID="306"
UE_ID="304"
###################################################
NEXUS_IMSI="001011234560$UE_ID"
NEXUS_MISDN="491234567$UE_ID"
domain=$(hostname | awk -F'.' '{print $2"."$3"."$4"."$5}')
BIN_DIR="/opt/OpenEPC/bin"
HOME_DIR="$HOME"
#SIMECA_PATH="/usr/local/src/simeca"
SIMECA_PATH="/opt/OpenEPC/bin/simeca"
#SIMECA_PATH="/opt/OpenEPC/bin/simeca"
SIMECA_PATH="/opt/simeca" #EPC nodes scripts are in here
SCRIPTS="$SIMECA_PATH/script"
#SIMECA_SCRIPTS="/opt/OpenEPC/bin/simeca_scripts"
SIMECA_SCRIPTS="/opt/OpenEPC/bin/simeca_scripts"
MC_PATH="$SIMECA_PATH/simeca_controller"
CONF_PATH="$SIMECA_PATH/CONF"
#SIMECA_EPC="/proj/PhantomNet/binh/openepc-att-demo/" #Todo: package this
SIMECA_EPC="/opt/OpenEPC/" #Todo: package this
START_SCRIPTS="/usr/local/src/simeca/start_scripts"
START_SCRIPTS="/opt/simeca/start_scripts"
START_SCRIPTS_OVS="/usr/local/src/simeca/start_scripts" #OVS start scripts
START_SCRIPTS_EPC="/opt/simeca/start_scripts" #EPC start scripts
HSS_PROVISION="$SIMECA_PATH/hss_provision"
EPC="$SIMECA_PATH/epc"
XML="$SIMECA_PATH/xml"
DATA="$SIMECA_PATH/data"
HOSTS="enb2 enb3 epc access1 access2 access3 tor hsw1 server1"
DATA="$HOME_DIR/data"
EPC_HOSTS="enb2 enb3 epc client1"
OVS_HOSTS="access1 access2 access3 tor hsw1 server1"
......@@ -49,6 +49,7 @@ from ryu import cfg
import subprocess
import xml.etree.ElementTree as ET
import os
from ofctl_rest_listener import RestIoTApi
#whether to use encap/decap at ovs or pure IP.
......@@ -57,7 +58,7 @@ ENABLE_OVS_GTP = 0
class SMORE_controller(app_manager.RyuApp):
_SCRIPTS = "/usr/local/src/simeca/start_scripts"
XML = "/usr/local/src/simeca/xml"
XML = "/opt/simeca/xml"
XML_TEMPLATE = "%s/input-template-penb.xml" % (XML)
OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]
#OFP_VERSIONS = [ofproto_v1_0.OFP_VERSION]
......@@ -248,8 +249,8 @@ class SMORE_controller(app_manager.RyuApp):
def _write_dpid_to_xml(self, xml_file):
#Replace HARDCODED dpid with new dpid
print "Replace input-template.xml with %s" % xml_file
subprocess.check_output(['sudo cp %s %s/%s'%(self.XML_TEMPLATE,self.XML, xml_file)], shell=True)
tree = ET.parse("%s/%s" % (self.XML,xml_file)) #hardcoding file name for now
subprocess.check_output(['cp %s /tmp/%s'%(self.XML_TEMPLATE, xml_file)], shell=True)
tree = ET.parse("/tmp/%s" % (xml_file)) #hardcoding file name for now
xmlroot = tree.getroot()
name_to_olddpid = {}
name_to_newdpid = {}
......@@ -266,10 +267,10 @@ class SMORE_controller(app_manager.RyuApp):
#replace dpid
for name in name_to_olddpid:
subprocess.check_output(['sudo sed -i \'s/>%s</>%s</\' %s/%s'%(name_to_olddpid[name],name_to_newdpid[name], self.XML, xml_file)], shell=True)
subprocess.check_output(['sed -i \'s/>%s</>%s</\' /tmp/%s'%(name_to_olddpid[name],name_to_newdpid[name], xml_file)], shell=True)
#replace portnumber
for interfacename in self.interface_to_portnumber:
subprocess.check_output(['sudo sed -i \'s/>%s</>%s</\' %s/%s'%(interfacename, self.interface_to_portnumber[interfacename], self.XML, xml_file)], shell=True)
subprocess.check_output(['sed -i \'s/>%s</>%s</\' /tmp/%s'%(interfacename, self.interface_to_portnumber[interfacename], xml_file)], shell=True)
......
......@@ -43,7 +43,7 @@ LOG.setLevel(logging.INFO)
ENABLE_OVS_GTP = 0
class LocationRouting:
XML="/usr/local/src/simeca/xml"
XML="/tmp/"
switch_server_port = {}
access_switches = {}
switchname_to_dpid = {}
......
......@@ -17,6 +17,7 @@ import logging
import json
import ast
import os
from webob import Response
from ryu.base import app_manager
......@@ -65,9 +66,9 @@ supported_ofctl = {
class RestIoTApi(app_manager.RyuApp):
SIMECA = "/opt/OpenEPC/bin"
SIMECA = "/opt/"
_SCRIPTS = "%s/simeca" % SIMECA
DATA="%s/simeca/data" % SIMECA
DATA="%s/data" % (os.environ['HOME'])
_CONF = "%s/simeca/CONF" % SIMECA
OFP_VERSIONS = [ofproto_v1_0.OFP_VERSION,
ofproto_v1_2.OFP_VERSION,
......@@ -189,9 +190,9 @@ class RestIoTApi(app_manager.RyuApp):
Dispatcher.get_enb_location_ip_map('%s/ENB.data' % self._CONF)
Dispatcher.ue_to_p2p_destinations = {}
Dispatcher.get_p2p_attach_destination('%s/P2P_ATTACH.data' % self._CONF)
Dispatcher.get_p2p_attach_destination('%s/P2P_ATTACH.data' % self.DATA)
#LOG.debug(Dispatcher.enb_location_ip_map)
Dispatcher.get_imsi_server_name_map('%s/SERVER.data' % self._CONF)
Dispatcher.get_imsi_server_name_map('%s/SERVER.data' % self.DATA)
LOG.debug("Imsi-server map:" % Dispatcher.imsi_server_name_map)
#LOG.debug("Access switches %s" % Dispatcher.access_switches)
Dispatcher.locationrouting = LocationRouting(Dispatcher.dpset, Dispatcher.access_switches, Dispatcher.switchname_to_dpid)
......
#!/bin/bash
source /opt/simeca/simeca_constants.sh
controller_ip=$($START_SCRIPTS_EPC/get_interface_map.pl | grep mgmt | awk '{print $5}')
mgmt_inf=$($START_SCRIPTS_EPC/get_interface_map.pl | grep mgmt | awk '{print $3}')
subnet=$(echo $controller_ip | awk -F'.' '{print $1"."$2"."$3".0/24"}')
#echo "mgmt = $mgmt_inf, controller_ip = $controller_ip, subnet = $subnet"
sudo ip addr add dev $mgmt_inf $controller_ip
sudo ip route add $subnet dev $mgmt_inf
echo "controller $controller_ip"
exit 0
......@@ -7,25 +7,31 @@ if [ $# -lt 2 ]; then
exit 1
fi
sudo pip install networkx
#sudo pip install networkx
IFS=',' read -a access_switch_list <<< "$1"
IFS=',' read -a intermediary_switch_list <<< "$2"
controller_ip=$($START_SCRIPTS/get_interface_map.pl | grep mgmt | awk '{print $5}')
mgmt_inf=$($START_SCRIPTS/get_interface_map.pl | grep mgmt | awk '{print $3}')
#controller_ip=$($START_SCRIPTS/get_interface_map.pl | grep mgmt | awk '{print $5}')
#cd $BIN_DIR
controller_ip=$(sudo $BIN_DIR/set_controller_ip.sh | grep controller | awk '{print $2}')
#source ../simeca_constants.sh
#controller_ip=$($START_SCRIPTS/get_interface_map.pl | grep mgmt | awk '{print $5}')
#mgmt_inf=$($START_SCRIPTS/get_interface_map.pl | grep mgmt | awk '{print $3}')
domain=$(hostname | awk -F'.' '{print $2"."$3"."$4"."$5}')
subnet=$(echo $controller_ip | awk -F'.' '{print $1"."$2"."$3".0/24"}')
echo "mgmt = $mgmt_inf, controller_ip = $controller_ip, subnet = $subnet"
sudo ip addr add dev $mgmt_inf $controller_ip
sudo ip route add $subnet dev $mgmt_inf
sudo apt-get install tshark
#subnet=$(echo $controller_ip | awk -F'.' '{print $1"."$2"."$3".0/24"}')
#echo "mgmt = $mgmt_inf, controller_ip = $controller_ip, subnet = $subnet"
echo "SDN Controller IP = $controller_ip"
#sudo ip addr add dev $mgmt_inf $controller_ip
#sudo ip route add $subnet dev $mgmt_inf
#sudo apt-get install tshark
for a in "${access_switch_list[@]}"
do
echo "Starting switch $a.$domain, Controller IP = $controller_ip"
ssh -o StrictHostKeyChecking=no $a.$domain "cd $START_SCRIPTS && sudo ./start_access_switch_with_controller.sh $controller_ip" || {
ssh -o StrictHostKeyChecking=no $a.$domain "cd $START_SCRIPTS_OVS && sudo ./start_access_switch_with_controller.sh $controller_ip" || {
echo "Could not start Access switch $a!"
exit 1
}
......@@ -34,7 +40,7 @@ done
for s in "${intermediary_switch_list[@]}"
do
echo "Starting switch $s.$domain, Controller IP = $controller_ip"
ssh -o StrictHostKeyChecking=no $s.$domain "cd $START_SCRIPTS && sudo ./start_intermediary_switch_with_controller.sh $controller_ip" || {
ssh -o StrictHostKeyChecking=no $s.$domain "cd $START_SCRIPTS_OVS && sudo ./start_intermediary_switch_with_controller.sh $controller_ip" || {
echo "Could not start Intermediary switch $s!"
exit 1
}
......
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