Commit 9f3364f0 authored by Florian Kaltenberger's avatar Florian Kaltenberger

moving project SPECTRA to extras

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7400 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 847a4203
This diff is collapsed.
########################################
#
# SPECTRA DEMO INSTALLATION AND RUN
#
#
#
# Rui Costa <ferreira@eurecom.fr>
#
# v1.13 (15 Oct 2014)
#
########################################
########################################
1. REQUIREMENTS
To properly run the demo these are the main pieces of software
that are required:
- OPENAIR4G (checkout the main trunk from the EURECOM SVN).
- ODTONE (Open 802.21 protocol from ITAveiro git server).
- Boost C++ Libraries are requested by ODTONE (v1.48 or higher)
- REST Toolkit (Codename "Casablanca")
- Adequate shell/bash start-up scripts for both eNB and UE.
BEFORE attempting any installation YOU MUST check your system for
any required software that these components require, as for
instance, a compatible GCC/G++ compiler, build tools, etc.
NOTES BEFORE INSTALLATION:
N1. Installation SHOULD NOT be done as ROOT. IF and WHEN super
user permissions are required you will be prompted for them.
N2. You MUST have a valid EURECOM SVN-enabled account for the
Openair4G code.
N3. For ODTONE software, you MUST have installed the ITAveiro
SSL/TLS certificates available at their webserver.
N4. You MUST have Internet access in order to properly build and
deploy the software, as some of the software is fetched online.
########################################
2. BUILD & INSTALL
2.1. PREPARATION
Start by creating a folder on a non-root directory, preferably
your home folder. Copy the <spectra_demo_prepare.sh> script into
the newly created folder, henceforth referred to as
<spectra_root_folder>.
2.2. INSTALLATION
There are two ways of processing the installation:
- If you already have performed a checkout of the OpenAir svn.
(Aimed at single installations for OAI developers.)
- If you only have the demonstration source code & scripts.
(To allow easier deployment over several machines, just copy
the demo's source folder, including the prepare and install
scripts to which ever machine you need and let the scripts do
the work for you)
2.2.1 From the OPENAIR SVN
Go to the folder:
<openair_root_folder>/trunk/targets/PROJECTS/SPECTRA/DEMO_SPECTRA
and run the installation script with the node type to install:
# ./spectra_demo_install.sh -oai_svn <node_type>
2.2.2 From the demo's source code and scripts.
Go to the <spectra_root_folder> and run:
# ./spectra_demo_install.sh -full <node_type>
If the previous step has been well performed, you should now have
a local working copy of the OpenAir SVN on your local machine, along
with additional code required for the demo.
2.3. CRM
This component of the demo MUST be compiled and installed separately.
Check <spectra_root_folder>/CRM/ for more details.
There is a google app that must be running in the google cloud,
and it's url configured in the source code. The local client is based
on the C++ REST framework codenamed "Casablanca".
Furthermore you need to compile the local client components
(CRMClient and CRMMain).
In the CRM client you will find a folder <tosend> which includes some
basic scripts that populate the google app database, and show how to
interact with it.
2.4. TVWS Sensing Measurements
There is a server and client for simulating the TVWS measurements and
run the cognitive algorithm to activate the required actions on the
LTE link. (this is the goal of the demo)
Copy the client & server located at <spectra_root_folder>/clientSensing/
into the ENB2 startup folder (<openair_root_folder>/targets/PROJECTS/SPECTRA)
2.5. TROUBLESHOOTING
If for some reason the installation does not run as expected, check
for permission-related issues or missing software packages.
Otherwise, try to install the components one by one, as defined in
the installation scripts.
(see <spectra_demo_prepare.sh> and <spectra_demo_install.sh> for
compilation and configuration details).
The preparation script will automatically call the installation
script, but in case it does not, run it manually, it is located at:
<spectra_root_folder>/openair4G/targets/PROJECTS/SPECTRA/
NOTE: During installation we apply a patch to ODTONE, due to the
lack of a definition for LTE links and their attributes.
However, as new versions are released the patch may need to
be adapted. Therefore, be aware of compilation issues
originating from the compilation of the ODTONE core functions.
########################################
3. CONFIGURATION
You MUST make sure that the configuration of your physical and
logical interfaces matches with your Open Air and ODTONE
configuration files. Take all parameters into account while
checking the configuration files and launch scripts, located in:
<spectra_root_folder>/openair4G/targets/PROJECTS/SPECTRA/
<spectra_root_folder>/ODTONE/dist/
3.1 Base Configuration
This is the network configuration on the config files:
UE1
eth0 (192.168.13.2) - oai0 (10.0.0.2) (LTE emulated link)
ENB1
eth0 (192.168.12.122) internet access gw (192.168.12.100)
eth1 (192.168.13.1) - oai0 (10.0.0.1) (LTE emulated link)
eth2 (192.168.14.3) (Internal Relay Connection)
UE2
eth0 (192.168.14.4) (Internal Relay Connection)
eth1 (192.168.15.5) - oai0 (10.0.2.3) (LTE emulated link)
ENB2
eth0 (192.168.15.6) - oai0 (10.0.2.4) (LTE emulated link)
########################################
4. RUNNING THE DEMO
1. We advise you to turn off the network manager service in order
for the startup script configuration to be effective and final.
This can be achieved by executing:
# sudo service network-manager stop
2. (On all machines) Go to OpenAir Launch folder:
<spectra_root_folder>/openair4G/targets/PROJECTS/SPECTRA/
3. Launch the eNB1 on eNB1 machine:
# sudo ./start_enb.bash
Wait for eNB1 to reach stand by mode.
4. Launch the UE1 on UE1 machine:
# sudo ./start_ue.bash
5. Launch the eNB2 on eNB2 machine:
# sudo ./start_enb.bash
Wait for eNB2 to reach stand by mode.
6. Launch the UE2 on UE2 machine:
# sudo ./start_ue.bash
7. Any other modules will be launched automatically
if present. (CRM client, TVWS sensing, MIHF, MIH Users, etc.)
Enjoy the demo!
################################################################################
CHANGELOG
v0.99 (03/09/2014)
- First <spectra_demo_prepare.sh> script and <README> file.
v1.00 (04/09/2014)
- Added compartmentalization for each sw component
- Added full installation procedure from scratch
- Fetching sw from repositories, compilation & installation
- Revisioned output
v1.01 (05/09/2014)
- Added OpenAir conf files <spectra_demo_src/openair_conf>
- Added MIHF Users <spectra_demo_src/mih_users>
- Reduced printed output
v1.02 (08/09/2014)
- Bug correcting on installation and configuration paths & scripts
- Patched Open Air script <targets/PROJECTS/SPECTRA/build_all.sh>
v1.03 (09/09/2014)
- Patched MIHF to support LTE link based on previous code
- Added <spectra_demo_src/mihf/>
with patch files: <link.hpp> <bin_query.hpp>
- Revisioned <spectra_demo_prepare.sh>
v1.04 (11/09/2014)
- Corrected MIHF patch bugs
- Added patch file <archive.hpp>
- Corrected path and filename bugs on <spectra_demo_prepare.sh>
v1.05 (15/09/2014)
- Corrected MIHF patch bugs
- Added a number of patch files
- Adjusted patch execution on <spectra_demo_prepare.sh>
v1.06 (17/09/2014)
- Working demo 1 eNB 1 UE
- Modified configuration files for UE and eNB
- Substituted overwrite of files into a Git patch for SPECTRA
v1.07 (19/09/2014)
- Expanded demo to 4 machines:
- 2 real: ue1, eNB1
- 2 virtual: eNB2, ue2 (both hosted by eNB1)
v1.08 (23/09/2014)
- Included CRM client and TVWS sensing modules.
v1.09 (24/09/2014)
- Final Demo setup ready.
v1.10 (29/09/2014)
- Updated RRC code for OpenAir.
- Code commit to OpenAir SVN trunk.
v1.11 (01/10/2014)
- Restructure of source code tree and installation files to
include the full demo (2 eNB and 2 ue)
- Splitted prepare and install scripts.
- Added colour coded steps and error stoppage on install script.
v1.12 (13/10/2014)
- Added bug fixes on launch and install scripts
- Added final version to openair svn
- Reworked README file.
v1.13 (15/10/2014)
- Polishing of the demo
- Added bug fixes on launch scripts for enb1
- Added feature to put measurements on CRM from enb1
- Changed readable output of received measurement reports on enb2
- Added more informative output on the sensingClient (TVWS)
- Demonstration now stops at end of MIH_Link_Actions.confirm
message on MIH_User of enb2
- Added info on sensing client and CRM
- Reworked README file.
################################################################################ EOF
#!/bin/bash
########################################
#
# SPECTRA DEMO PREPARATION
#
#
#
SCRIPT_VERSION="v1.12"
DATE="13 Oct 2014"
AUTHOR="Rui Costa"
EMAIL="ferreira@eurecom.fr"
########################################
OWN_TAG=$0
INSTALL_PATH=$PWD
OPENAIR_PATH=$INSTALL_PATH/openair4G
ODTONE_PATH=$INSTALL_PATH/ODTONE
BOOST_PATH=$INSTALL_PATH/boost_1_49_0
SPECTRA_SRC_PATH=$INSTALL_PATH/spectra_demo_src
SPECTRA_OAI_PATH=$OPENAIR_PATH/targets/PROJECTS/SPECTRA/
########################################################################################### UTILS
function util_echo {
# return value passed in $1 (usually $?)
# return value = 0 - OK - Light green
if [ $1 -eq 0 ] ; then
echo -e "\e[92m\e[1m[$OWN_TAG]\e[0m $2"
# return value != 0 - ERROR
else
# return value -gt 255 - WARNING - Light Yellow
if [ $1 -gt 255 ] ; then
echo -e "\e[93m\e[1m[$OWN_TAG]\e[0m $2"
else
# return value 1 to 255 - ERROR - Light RED
echo -e "\e[91m\e[1m[$OWN_TAG]\e[0m $2"
exit
fi
fi
}
########################################################################################### OPENAIR
function fetch_openair {
mkdir $OPENAIR_PATH
cd $INSTALL_PATH
util_echo $? "-------------------------------------------------"
util_echo $? "OPENAIR EURECOM ..."
sleep 2
svn co http://svn.eurecom.fr/openair/openair4G/trunk $OPENAIR_PATH
util_echo $? "Checked Out openair4G/trunk from EURECOM SVN..."
}
########################################################################################### MAIN
clear
# Starting...
util_echo $? " -------------------------------------------------"
util_echo $? " SPECTRA DEMO "
util_echo $? " Prepararation Script"
util_echo $? " "
util_echo $? " $SCRIPT_VERSION $DATE"
util_echo $? " "
util_echo $? " Author: $AUTHOR <$EMAIL> "
util_echo $? " -------------------------------------------------"
util_echo $? " "
sleep 3
util_echo $? " -------------------------------------------------"
util_echo $? " >> Fetching sources"
util_echo $? " -------------------------------------------------"
fetch_openair
cd $SPECTRA_OAI_PATH/
util_echo $? " >> Finished Prepare Script!!"
util_echo $? " >> Entering Install Script!!"
./spectra_demo_install.sh -oai_svn $1
########################################################################################### EOF
#include <cpprest/http_client.h>
#include <cpprest/json.h>
#include <iostream>
#include <ostream>
#include <sstream>
#include <fstream>
#include "cpprest/basic_types.h"
#include "cpprest/asyncrt_utils.h"
#include "cpprest/uri.h"
#include <string>
#include "CRMClient.hpp"
using namespace std;
using namespace web;
using namespace web::http;
using namespace web::http::client;
using namespace utility;
// namespace odtone {
CRMClient::CRMClient(char* url)
{
m_url = (char*) (malloc (200* sizeof (char)));
m_url = url;
}
CRMClient::CRMClient()
{
}
CRMClient::~CRMClient()
{
}
void CRMClient::SetUrl(char* url)
{
m_url = url;
}
// Retrieves a JSON value from an HTTP request.
pplx::task<void> CRMClient::RequestJSONValueAsync()
{
http_client client (U(m_url));
return client.request(methods::GET).then([](http_response response) -> pplx::task<json::value>
{
if(response.status_code() == status_codes::OK)
{
return response.extract_json();
}
return pplx::task_from_result(json::value());
})
.then([](pplx::task<json::value> previousTask)
{
try
{
ofstream myfile;
myfile.open ("outputGET.txt");
const json::value& v = previousTask.get();
string_t jsonString = v.to_string();
cout << U("Response...") << jsonString <<endl;
//Parsing Begin
cout << U("Start Parsing...") << endl;
for(auto iterArray = v.cbegin(); iterArray != v.cend(); ++iterArray)
{
const json::value &arrayValue = iterArray->second;
for(auto iterInner = arrayValue.cbegin(); iterInner != arrayValue.cend(); ++iterInner)
{
const json::value &propertyValue = iterInner->second;
for(auto iterlast = propertyValue.cbegin(); iterlast != propertyValue.cend(); ++iterlast)
{
const json::value &Name = iterlast->first;
const json::value &Value = iterlast->second;
cout<< U("Parameter: ") << Name.to_string()<<endl;
cout<< U("Value: ") << Value.to_string()<< std::endl;
}
}
cout << std::endl;
}
//parsing End
myfile << jsonString.c_str();
myfile.close();
}
catch (const http_exception& e)
{
wostringstream ss;
ss << e.what() << endl;
wcout << ss.str();
}
});
}
// Stores a JSON value (a Policy) from an HTTP request.
pplx::task<void> CRMClient::StoreJSONValuePolicies(char * param1, char * param2, char * param3, char * param4)
{
http_client client (U(m_url));
json::value::field_map putvalue;
putvalue.push_back(make_pair(json::value("pid"), json::value(param1)));
putvalue.push_back(make_pair(json::value("name"), json::value(param2)));
putvalue.push_back(make_pair(json::value("description"), json::value(param3)));
putvalue.push_back(make_pair(json::value("value"), json::value(param4)));
const string_t& s = "/";
json::value object = json::value::object(putvalue);
return client.request(methods::PUT, s, object).then([](http_response response)-> pplx::task<json::value>
{
if(response.status_code() == status_codes::OK)
{
return response.extract_json();
}
return pplx::task_from_result(json::value());
})
.then([](pplx::task<json::value> previousTask)
{
try
{
const json::value& v = previousTask.get();
string_t jsonString = v.to_string();
cout << U("Response...") << jsonString <<endl;
}
catch (const http_exception& e)
{
wostringstream ss;
ss << e.what() << endl;
wcout << ss.str();
}
});
}
// Stores a JSON value (a Measurement) from an HTTP request.
pplx::task<void> CRMClient::StoreJSONValuemeasurements(char * param1, char * param2, char * param3, char * param4, char * param5, char * param6)
{
http_client client (U(m_url));
json::value::field_map putvalue;
putvalue.push_back(make_pair(json::value("key"), json::value(param1)));
putvalue.push_back(make_pair(json::value("name"), json::value(param2)));
putvalue.push_back(make_pair(json::value("type"), json::value(param3)));
putvalue.push_back(make_pair(json::value("unit"), json::value(param4)));
putvalue.push_back(make_pair(json::value("value"), json::value(param5)));
putvalue.push_back(make_pair(json::value("time"), json::value(param6)));
const string_t& s = "/";
json::value object = json::value::object(putvalue);
return client.request(methods::PUT, s, object).then([](http_response response)-> pplx::task<json::value>
{
if(response.status_code() == status_codes::OK)
{
return response.extract_json();
}
return pplx::task_from_result(json::value());
})
.then([](pplx::task<json::value> previousTask)
{
try
{
const json::value& v = previousTask.get();
string_t jsonString = v.to_string();
cout << U("Response...") << jsonString <<endl;
}
catch (const http_exception& e)
{
wostringstream ss;
ss << e.what() << endl;
wcout << ss.str();
}
});
}
// Stores a JSON value (a Decision) from an HTTP request.
pplx::task<void> CRMClient::StoreJSONValuedecisions(char * param1, char * param2, char * param3, char * param4, char * param5)
{
http_client client (U(m_url));
json::value::field_map putvalue;
putvalue.push_back(make_pair(json::value("did"), json::value(param1)));
putvalue.push_back(make_pair(json::value("name"), json::value(param2)));
putvalue.push_back(make_pair(json::value("description"), json::value(param3)));
putvalue.push_back(make_pair(json::value("value"), json::value(param4)));
putvalue.push_back(make_pair(json::value("time"), json::value(param5)));
const string_t& s = "/";
json::value object = json::value::object(putvalue);
return client.request(methods::PUT, s, object).then([](http_response response)-> pplx::task<json::value>
{
if(response.status_code() == status_codes::OK)
{
return response.extract_json();
}
return pplx::task_from_result(json::value());
})
.then([](pplx::task<json::value> previousTask)
{
try
{
const json::value& v = previousTask.get();
string_t jsonString = v.to_string();
cout << U("Response...") << jsonString <<endl;
}
catch (const http_exception& e)
{
wostringstream ss;
ss << e.what() << endl;
wcout << ss.str();
}
});
}
pplx::task<void> CRMClient::Delete()
{