Skip to content

Masshiro/PyRTC-dev

Repository files navigation

PyRTC-dev

Prerequisites

To fully utilize this repository, make sure that Ubuntu 20.04 is running and following tools are installed.

The more detailed installation steps could be found at Installation Guide.

Usage

Get things ready

Firstly, you may want to clone this repo and initialize the submodule AlphaRTC:

git clone --recurse-submodules https://github.com/Masshiro/PyRTC-dev.git

or update the cloned repo using

git submodule update --init --recursive

To build AlphaRTC and make it function, you may need to get depot_tools:

git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
# Add depot_tools to the front of your PATH
export PATH=/path/to/depot_tools:$PATH

After doing that, use the build script at the root directory of this repository. Note that pkg-config and ninja-build should be installed to ensure the building process go smoothly:

sudo ln -s $(which python3) /usr/bin/python
. build.sh

Then you can create docker image named pyrtc_image:latest by default along with the docker network which would be used in following trace-driven simulation and named rtcnet by default:

make setup
  • or you can create image or network separately by using either make build or make network.

For the test media, choose one and download from this site, then name the file as test.y4m and move into share/input/testmedia

Now we can install Containernet by doing the following steps, more details can be found at here:

sudo ansible-playbook -i "localhost," -c local modules/containernet/ansible/install.yml
python -m venv modules/containernet/venv
source modules/containernet/venv/bin/activate
pip install modules/containernet/
deactivate

Demonstration

To quickly demonstrate the functionality of trace-driven simulation, run:

python demo.py

Trace-driven simulation

Since the default subnet of rtcnet is 192.168.2.0/24, two containers can be started with specific IP addresses accordingly.

For receiver container, run:

docker run -it --rm --privileged -v $(pwd)/share:/app/share --network rtcnet --ip 192.168.2.102 --name rtc_c2 pyrtc_image
  • then in the bash shell of it, run python run.py

For sender container, run:

docker run -it --rm --privileged -v $(pwd)/share:/app/share --network rtcnet --ip 192.168.2.101 --name rtc_c1 pyrtc_image
  • then in the bash shell of it, CMD=$(python3 utils/mahi_helpers.py) && $CMD -- python run.py --sender

Or you can run the sender and receiver processes automatically via Docker Compose:

docker compose up
  • when the simulation finished, run docker compose down

Topology-based simulation

In addtion to the trace-driven simulation, we further construct two kind of topologies for the tests, which are dumbbell and parking-lot, respectively. They are formed using Containernet, a extension of the Mininet, with traditional nodes being replaced by Docker containers. The details of both topologies' defination can be found at former work's repository.

Suppose Containernet has been installed as described above, you may first start the virtual Python environment in which containernet was maintained:

source modules/containernet/venv/bin/activate

then run either simulation by:

  • sudo -E env PATH=$PATH python topo/topo_dumbbell.py
  • sudo -E env PATH=$PATH python topo/topo_parkinglot.py

To simply visualize the results, you may deactivate the venv virtual environment first, and then run:

python topo/visual.py

Installation Guide

Docker: (more explanation at here)

# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# Manage Docker as non-root user:
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker

Docker Compose Plugin: (more explanation at here)

sudo apt-get update
sudo apt-get install docker-compose-plugin

Containernet: (more explanation at here)

sudo apt-get install ansible
git clone https://github.com/containernet/containernet.git
sudo ansible-playbook -i "localhost," -c local containernet/ansible/install.yml
python3 -m venv venv
source venv/bin/activate
pip install .

Mahimahi: (more explanation at here)

# If Ubuntu 20.04 is used
sudo apt-get install mahimahi

# Otherwise
git clone https://github.com/ravinet/mahimahi
cd mahimahi
./autogen.sh
./configure
make
sudo make install

To prevent unexpected changes to AlphaRTC source, you may want to run:

git config submodule.alphartc.ignore all
git update-index --assume-unchanged .gclient_previous_sync_commits

Resources

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages