{"id":25495964,"url":"https://github.com/opennetworkinglab/p4mn-docker","last_synced_at":"2025-11-09T21:30:22.156Z","repository":{"id":40645840,"uuid":"187118831","full_name":"opennetworkinglab/p4mn-docker","owner":"opennetworkinglab","description":"P4Runtime-enabled Mininet Docker image that uses BMv2 simple_switch_grpc as the default switch","archived":false,"fork":false,"pushed_at":"2022-06-27T12:57:49.000Z","size":45,"stargazers_count":19,"open_issues_count":1,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-03-26T18:02:32.586Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opennetworkinglab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-17T00:21:27.000Z","updated_at":"2023-12-12T21:45:41.000Z","dependencies_parsed_at":"2022-08-27T01:52:05.245Z","dependency_job_id":null,"html_url":"https://github.com/opennetworkinglab/p4mn-docker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opennetworkinglab%2Fp4mn-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opennetworkinglab%2Fp4mn-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opennetworkinglab%2Fp4mn-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opennetworkinglab%2Fp4mn-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opennetworkinglab","download_url":"https://codeload.github.com/opennetworkinglab/p4mn-docker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239576797,"owners_count":19662113,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-19T00:52:49.526Z","updated_at":"2025-11-09T21:30:22.107Z","avatar_url":"https://github.com/opennetworkinglab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# P4Runtime-enabled Mininet Docker Image\n\nDocker image that can execute a Mininet-emulated network of BMv2 virtual\nswitches, controlled by an external SDN controller via P4Runtime.\n\nThis image was created to facilitate testing of P4Runtime support in the ONOS\ncontroller, but you can use it without ONOS.\n\nTo obtain the image:\n\n    docker pull opennetworking/p4mn:\u003ctag\u003e\n\n## Tags\n\nThe image comes in two versions (tags):\n\n* `opennetworking/p4mn:latest` Updated daily and built from the master branch of\n  the [BMv2][BMv2] and [PI][PI] (P4Runtime server implementation) repositories;\n* `opennetworking/p4mn:stable` Built using selected BMv2 and PI versions that\n  are known to work well with ONOS master.\n\nMoreover, each tag is available in a \"no-logging\" version with disabled logging\nmacros in BMv2 to improve packet forwarding performance:\n\n* `opennetworking/p4mn:latest-no-logging`\n* `opennetworking/p4mn:stable-no-logging`\n\n## Status [![Build Status](https://github.com/opennetworkinglab/p4mn-docker/actions/workflows/main.yml/badge.svg)](https://github.com/opennetworkinglab/p4mn-docker/actions/workflows/main.yml)\n\nImages are built daily using [Github Actions][GH Actions] and pushed to\n[Docker Hub][Docker Hub].\n\n## Steps to run p4mn\n\nTo run the container:\n\n    docker run --privileged --rm -it opennetworking/p4mn [MININET ARGS]\n\nAfter running this command, you should see the mininet CLI (`mininet\u003e`).\n\nIt is important to run this container in privileged mode (`--privileged`) so\nmininet can modify the network interfaces and properties to emulate the desired\ntopology.\n\nThe image defines as entry point the mininet executable configured to use BMv2\n`simple_switch_grpc` as the default switch. Options to the docker run command\n(`[MININET ARGS]`) are passed as parameters to the mininet process. For more\ninformation on the supported mininet options, please check the official mininet\ndocumentation.\n\nFor example, to run a linear topology with 3 switches:\n\n    docker run --privileged --rm -it opennetworking/p4mn --topo linear,3\n\n### P4Runtime server ports\n\nEach switch starts a P4Runtime server which is bound to a different port,\nstarting from 50001 and increasing. To connect an external P4Runtime client\n(e.g. an SDN controller) to the switches, you have to publish the corresponding\nports.\n\nFor example, when running a topology with 3 switches:\n\n     docker run --privileged --rm -it -p 50001-50003:50001-50003 opennetworking/p4mn --topo linear,3\n\n### BMv2 logs and other temporary files\n\nTo allow easier access to BMv2 logs and other files, we suggest sharing the\n`/tmp` directory inside the container on the host system using the docker run\n`-v` option, for example:\n\n    docker run ... -v /tmp/p4mn:/tmp ... opennetworking/p4mn ...\n\nBy using this option, during the container execution, a number of files related\nto the execution of the BMv2 switches will be available under `/tmp/p4mn` in the\nhost system. The name of these files depends on the switch name used in Mininet,\ne.g. s1, s2, etc.\n\nExample of these files are:\n\n* `bmv2-s1-grpc-port`: contains the port used for the P4Runtime server executed\n  by the switch instance named `s1`;\n* `bmv2-s1-log`: contains the BMv2 log;\n* `bmv2-s1-netcfg.json`: ONOS netcfg JSON file that can be pushed to ONOS\n  to discover this switch instance. This file assumes that ONOS is running on\n  the same host as the container. If this is not the case, you will need to\n  modify the `managementAddress` property in the JSON file, replacing\n  `localhost` with the IP address of the host system of the `p4mn` container.\n\n### Bash alias\n\nA convenient way to quickly start the p4mn container is to create an alias in\nyour bash profile file (`.bashrc`, `.bash_aliases`, or `.bash_profile`) . For\nexample:\n\n    alias p4mn=\"rm -rf /tmp/p4mn \u0026\u0026 docker run --privileged --rm -it -v /tmp/p4mn:/tmp -p50001-50030:50001-50030 --name p4mn --hostname p4mn opennetworking/p4mn\"\n\nThen, to run a a simple 1-switch 2-host topology:\n\n    $ p4mn\n    *** Creating network\n    *** Adding controller\n    *** Adding hosts:\n    h1 h2\n    *** Adding switches:\n    s1\n    *** Adding links:\n    (h1, s1) (h2, s1)\n    *** Configuring hosts\n    h1 h2\n    *** Starting controller\n    \n    *** Starting 1 switches\n    s1 ....⚡️ simple_switch_grpc @ 50001\n    \n    *** Starting CLI:\n    mininet\u003e\n\nOr a linear one with 3 switches and 3 hosts:\n\n    $ p4mn --topo linear,3\n    *** Creating network\n    *** Adding controller\n    *** Adding hosts:\n    h1 h2 h3\n    *** Adding switches:\n    s1 s2 s3\n    *** Adding links:\n    (h1, s1) (h2, s2) (h3, s3) (s2, s1) (s3, s2)\n    *** Configuring hosts\n    h1 h2 h3\n    *** Starting controller\n    \n    *** Starting 3 switches\n    s1 .....⚡️ simple_switch_grpc @ 50001\n    s2 .....⚡️ simple_switch_grpc @ 50002\n    s3 .....⚡️ simple_switch_grpc @ 50003\n    \n    *** Starting CLI:\n    mininet\u003e\n\n[Travis]: https://travis-ci.org/opennetworkinglab/p4mn-docker\n[Docker Hub]: https://hub.docker.com/r/opennetworking/p4mn\n[BMv2]: https://github.com/p4lang/behavioral-model\n[PI]: https://github.com/p4lang/PI\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopennetworkinglab%2Fp4mn-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopennetworkinglab%2Fp4mn-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopennetworkinglab%2Fp4mn-docker/lists"}