Skip to content

Code of master thesis project backend and GT demo backend.

Notifications You must be signed in to change notification settings

mpeuster/mt_backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mt_backend

Code of master thesis project (backend part).

Also used for GT demo.

Contact: peuster [at] mail.upb.de

Contents:

  • controller/: Backend controller + API server
  • ap_manager/: UPB Access Point management component (same as MobiMesh's component, but for UPB testbed)
  • misc/: e.g. development client (e.g. for debugging)

User Guide

Tested on: Ubuntu Server 14.04 LTS

Get code from: https://github.com/mpeuster/mt_backend

General

The backend consists of two components, the API server and the controller which are started as Unix daemons (both are placed in the 'controller/' directory):

  • python tlnb_api.py -a start|restart|stop: two layer network backend API
  • python tlnb_ctrl.py -a start|restart|stop: two layer network backend controller

The API server provides the public REST API to all other components of the demo testbed. It receives status updates from UEs and stores them into a central database. It also informs the controller component about changes, by using ZeroMQ messaging. The controller components uses the current system state, stored in the database and runs an optimization algorithm, which decides what APs to switch off or on, and computes the assignment between UEs and APs. These results are then written back into the database and are accessible over the public REST API (e.g. a GET request on the UE endpoint returns to which AP a specific UE is currently assigned).

The controller component also acts as a REST client and communicates with the network controller (provided by MobiMESH). It uses this connection to control the APs (e.g. black and white listing of MAC address to emulate AP switching).

All backend components can run on different physical machines. However, the example configuration file in the repository assumes that all components run on the same machine.

Install required packages and database

  • MongoDB: $ sudo apt-get install mongodb
  • Python PIP: $ sudo apt-get install python-pip
  • ZeroMQ: $ sudo apt-get install python-zmq
  • MongoEngine: $ sudo pip install mongoengine
  • Requests: $ sudo pip install requests
  • Tornado: $ sudo pip install tornado
  • Flask: $ sudo pip install flask
  • FlaskRestful (installed from sources):

Install

Configuration

There is a central configuration file for the management daemon and the API server:

  • controller/config.json

This file can be used e.g. to specify the location of the network management API provided by e.g. MobiMesh's management component. Furthermore, details about used access points (e.g. SSIDs/BSSIDs/Location) can be configured in this file.

Run backend controller without access points

  1. Start management daemon: $ python tlnb_ctrl.py -a start
  2. Start API server: $ python tlnb_api.py -a start

Now the backend API will be available at http://127.0.0.1:6680/.

API description: https://github.com/mobimesh/GTDemo-2015/wiki/Controller-Interface-Description

However, there are no access point definitions in the system since no access point management component is connected.

Run backend controller with access points

  1. Configure network manager API in config.json:

    e.g. for UPB's AP manager component:

    "apmanager": {
    	"host": "127.0.0.1",
    	"port": 6681
    },
  2. Start network manager component

    e.g. UPB's AP manager: $ python upb_apmanager.py -a start

  3. Start management controller: $ python tlnb_ctrl.py -a start

  4. Start API server: $ python tlnb_api.py -a start

Log outputs:

  • /tmp/tlnb_ctrl.log
  • /tmp/tlnb_api.log

Usage

When the controller and the API server are started, you can register an UE with a POST request in the system. After this you can update it's status (context) with PUT requests. During this, the controller will always compute the AP with the smallest distance to the UE and assign this AP to the UE. You can receive this assignment with a GET request on the UE endpoint. At the end the UE can be removed from the system with a DELETE request.

For detailed API documentation see: https://github.com/mobimesh/GTDemo-2015/wiki/Controller-Interface-Description

If something breaks (e.g. a UE is registered and can not be removed) you should simply restart the control daemon:

  • $ python tlnb_ctrl.py -a restart

This will clear the complete database and the whole system is in an empty state again.

Tests

You can run the API test suite with:

  • $ python test.py

This will test most of the API's functionalities. It automatically starts the API and control component and stops them afterwards. However, if you run the system without a connected access point manager, and thus without access point definitions, one of the test cases will fail (assignment test).

About

Code of master thesis project backend and GT demo backend.

Resources

Stars

Watchers

Forks

Packages

No packages published