A photo of Mitesh Shah

Mitesh Shah

Linux Enthusiast
System Administrator

Email Skype Github Twitter Google+ Resume Hire Me Keybase LinkedIn Stackoverflow


How to Setup Augmented Traffic Control (ATC)

Overview

How to Setup Augmented Traffic Control (ATC)

Installation

# Install Virtual Environment
$ sudo pip install virtualenv
$ mkdir -p ~/dev/atc
$ virtualenv ~/dev/atc/venv
$ source ~/dev/atc/venv/bin/activate

# Package installation
$ pip install atc_thrift atcd django-atc-api django-atc-demo-ui django-atc-profile-storage

# Configuration
$ cd ~/dev/atc
$ django-admin startproject atcui
$ cd atcui/
  • At this stage, we have a brand new django project that needs to be configured.
  • First, let’s enable our django apps by editing atcui/settings.py and adding the following apps to INSTALLED_APPS:
$ vim atcui/settings.py
INSTALLED_APPS = (
    ...
    # Django ATC API
    'rest_framework',
    'atc_api',
    # Django ATC Demo UI
    'bootstrap_themes',
    'django_static_jquery',
    'atc_demo_ui',
    # Django ATC Profile Storage
    'atc_profile_storage',
)
  • Now, we need to route requests to the right django app.
  • This is done by editing atcui/urls.py and adding the routes to urlpatterns:
$ vim atcui/urls.py
...
from django.conf.urls import include
from django.views.generic.base import RedirectView

urlpatterns = [
    ...
    # Django ATC API
    url(r'^api/v1/', include('atc_api.urls')),
    # Django ATC Demo UI
    url(r'^atc_demo_ui/', include('atc_demo_ui.urls')),
    # Django ATC profile storage
    url(r'^api/v1/profiles/', include('atc_profile_storage.urls')),
    url(r'^$', RedirectView.as_view(url='/atc_demo_ui/', permanent=False)),
]
  • Finally, migrate the django DB and run the server locally
$ python manage.py migrate
  • That is it, the UI should be set up. Now let’s run it!

Running it

  • Now that we have configured the UI, let’s run the atcd service and run the UI.
  • You need to make sure that you are using your virtual environment.
Starting atcd service
$ test -z $VIRTUAL_ENV && source ~/dev/atc/venv/bin/activate
$ sudo atcd
Start atc demo ui
$ test -z $VIRTUAL_ENV && source ~/dev/atc/venv/bin/activate
$ cd ~/dev/atc/atcui
$ python manage.py runserver 0.0.0.0:8000
  • You should now be able to access the UI at the following address http://localhost:8000 and get the following page.

atc_demo_ui

NOTE! If you are using Django 1.9 then might me you face stylesheet issue.
Refer: Dirty Fix

Import Network Profiles

$ cd ~/dev/atc/
$ git clone https://github.com/facebook/augmented-traffic-control.git
$ cd augmented-traffic-control/utils/
$  bash restore-profiles.sh localhost:8000
Added profile ~/dev/atc/augmented-traffic-control/utils/profiles/2G-DevelopingRural.json
Added profile ~/dev/atc/augmented-traffic-control/utils/profiles/2G-DevelopingUrban.json
Added profile ~/dev/atc/augmented-traffic-control/utils/profiles/3G-Average.json
Added profile ~/dev/atc/augmented-traffic-control/utils/profiles/3G-Good.json
Added profile ~/dev/atc/augmented-traffic-control/utils/profiles/Cable.json
Added profile ~/dev/atc/augmented-traffic-control/utils/profiles/DSL.json
Added profile ~/dev/atc/augmented-traffic-control/utils/profiles/Edge-Average.json
Added profile ~/dev/atc/augmented-traffic-control/utils/profiles/Edge-Good.json
Added profile ~/dev/atc/augmented-traffic-control/utils/profiles/Edge-Lossy.json
Added profile ~/dev/atc/augmented-traffic-control/utils/profiles/NoConnectivity.json

Test Augmented Traffic Control

  • Open http://localhost:8000
  • Click on Authentication and add your device ip address and access token, click on Authorize button
  • Click on Profiles and select your testing network profile.
  • Now at top of page you will find Update Shaping button click on it.

Test Augmented Traffic Control (ATC)





Post Navigation