Giter Site home page Giter Site logo

p4ml's Introduction

Runtime Verification of P4 Switches with Reinforcement Learning

Getting Started

These instructions will help you to get the project up and running on your local machine.

Prerequisites

In order to run the project, make sure to have VirtualBox installed. If not already install go to VirtualBox Website and follow the instructions to install it. Also make sure to download the P4 Tutorial VM for VirtualBox from here. Clone the project by running:

git clone https://gitlab.inet.tu-berlin.de/apoorv/P4ML.git

Installing

The following describes how to install necessary Python packages for running the project. The list of dependecies is provided with the requirements.txt file. In order to install the packages create a virtualenv and install the packages by running the following:

$ python3.6 -m venv PATH-WHERE-VENV-SHOULD-BE-PLACED/
$ PATH-TO-VENV/bin/pip3.6 install -r ./requirements.txt

Running an example

For running the examples it is necessary to run the P4 tutorial VM and enable port forwarding for port 2222 to port 22 on the VM as described e.g. here. Now copy the contents of P4ML/P4/ folder to the VM by using e.g. SCP:

Hint: the password to the VM is: p4

$ scp -P 2222 ./P4/* [email protected]:~/tutorials/exercises/basic

In addition, login to the VM and edit the basic.p4 in ~/tutorials/exercises/basic directory. Add the following lines to the apply block in ingress control block (after the existing if statement):

else {
	mark_to_drop();
	exit;
}

Before proceeding, create necessary folders for the results of the P4RL Agent, e.g., for the default locations execute: Note: if the folders are created in another directory than P4ML/ adjust the paths in net_agent.py accordingly.

$ cd PATH-TO-P4ML
$ mkdir results
$ mkdir model_save
$ mkdir figures

For execution of a training run of P4RL Agent, the switch placed in ~/tutorials/exercises/basic/ on the virtual box VM must be executed by running the following in a terminal of the VM.

$ cd ~/tutorials/exercises/basic
$ make run

This will create a Mininet environment with the topology described in P4ML/P4/topology.json using the switch defined by P4ML/P4/basic.p4.

In another terminal on the VM run: Note: change the IP and Interface names to match your environments parameters.

$ cd ~/tutorials/exercises/basic
$ sudo ./receive_h1.py '192.168.102.224' 'enp0s3'

In another terminal on the VM run: Note: change the IP and Interface names to match your environments parameters.

$ cd ~/tutorials/exercises/basic
$ sudo ./receive_h2.py '192.168.102.224' 'enp0s3'

In another terminal on the VM run: Note: change the IP and Interface names to match your environments parameters.

$ cd ~/tutorials/exercises/basic
$ sudo ./receive_h3.py '192.168.102.224' 'enp0s3'

In another terminal on the VM run:

$ cd ~/tutorials/exercises/basic
$ ./mycontroller_l3switch.py

Before starting the net_env.py, the host IP has to be placed in variable Host_IP of the code in line 23. E.g.

Host_IP = '192.168.102.224'

Now the net_agent.py can be executed on the host machine.

$ PATH-TO-VENV/bin/python3.6 ./net_agent.py

p4ml's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.