{"id":13470700,"url":"https://github.com/stratum/fabric-tna","last_synced_at":"2026-01-18T06:20:01.939Z","repository":{"id":37714380,"uuid":"266338238","full_name":"stratum/fabric-tna","owner":"stratum","description":"The SD-Fabric data plane","archived":false,"fork":false,"pushed_at":"2023-01-09T15:14:56.000Z","size":3139,"stargazers_count":30,"open_issues_count":41,"forks_count":15,"subscribers_count":16,"default_branch":"main","last_synced_at":"2024-08-01T16:21:40.576Z","etag":null,"topics":["onos","p4","sdfabric","stratum","upf"],"latest_commit_sha":null,"homepage":"https://docs.sd-fabric.org/","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stratum.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSES/Apache-2.0.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-23T13:05:03.000Z","updated_at":"2024-05-10T07:42:20.000Z","dependencies_parsed_at":"2023-02-08T12:31:16.462Z","dependency_job_id":null,"html_url":"https://github.com/stratum/fabric-tna","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stratum%2Ffabric-tna","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stratum%2Ffabric-tna/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stratum%2Ffabric-tna/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stratum%2Ffabric-tna/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stratum","download_url":"https://codeload.github.com/stratum/fabric-tna/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222138883,"owners_count":16937422,"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":["onos","p4","sdfabric","stratum","upf"],"created_at":"2024-07-31T16:00:34.458Z","updated_at":"2026-01-18T06:20:01.924Z","avatar_url":"https://github.com/stratum.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":"\u003c!--\nCopyright 2020-present Open Networking Foundation\nSPDX-License-Identifier: Apache-2.0\n--\u003e\n\n# Fabric-TNA\n\n[![Build Status](https://jenkins.onosproject.org/buildStatus/icon?job=postmerge-fabric-tna\u0026subject=Fabric-tna)](https://jenkins.onosproject.org/view/fabric-tna/job/postmerge-fabric-tna/)\n[![Build Status](https://jenkins.onosproject.org/buildStatus/icon?job=postmerge-fabric-int-tna\u0026subject=Fabric-int-tna)](https://jenkins.onosproject.org/view/fabric-tna/job/postmerge-fabric-int-tna/)\n[![Build Status](https://jenkins.onosproject.org/buildStatus/icon?Subject=postmerge\u0026job=postmerge-fabric-upf-int-tna\u0026subject=Fabric-upf-int-tna)](https://jenkins.onosproject.org/view/fabric-tna/job/postmerge-fabric-upf-int-tna/)\n[![Build Status](https://jenkins.onosproject.org/buildStatus/icon?job=postmerge-fabric-upf-tna\u0026subject=Fabric-upf-tna)](https://jenkins.onosproject.org/view/fabric-tna/job/postmerge-fabric-upf-tna/)\n[![Build Status](https://jenkins.onosproject.org/buildStatus/icon?job=postmerge-fabric-v1model\u0026subject=Fabric-v1model)](https://jenkins.onosproject.org/view/fabric-tna/job/postmerge-fabric-v1model/)\n[![Build Status](https://jenkins.onosproject.org/buildStatus/icon?job=postmerge-fabric-upf-v1model\u0026subject=Fabric-upf-v1model)](https://jenkins.onosproject.org/view/fabric-tna/job/postmerge-fabric-upf-v1model/)\n[![Build Status](https://jenkins.onosproject.org/buildStatus/icon?job=postmerge-fabric-int-v1model\u0026subject=Fabric-int-v1model)](https://jenkins.onosproject.org/view/fabric-tna/job/postmerge-fabric-int-v1model/)\n[![Build Status](https://jenkins.onosproject.org/buildStatus/icon?job=postmerge-fabric-upf-int-v1model\u0026subject=Fabric-upf-int-v1model)](https://jenkins.onosproject.org/job/postmerge-fabric-upf-int-v1model/1/)\n\n[![Build Status](https://jenkins.onosproject.org/buildStatus/icon?job=fabric-tna-linerate-tests\u0026subject=Line-Rate+Tests)](https://jenkins.onosproject.org/job/fabric-tna-linerate-tests/)\n\n`fabric-tna` is a P4 program that realizes the data plane of [SD-Fabric], an\nSDN-enabled programmable network fabric tailored for 5G-connected edge clouds,\nwith a focus on enterprise and Industry 4.0 use cases.\n\n`fabric-tna` is based on the Tofino Native Architecture (TNA), hence it can be\nused to program any switch based on the Intel Tofino ASIC. The P4 program is\nspecifically designed to run on [Stratum]-enabled switches controlled by the\n[ONOS] SDN controller.\n\n`fabric-tna.p4` is not to be confused with [fabric.p4], an older P4 program\nhosted in the ONOS repository originally designed to support [Trellis].\n`fabric-tna.p4` follows a similar design to `fabric.p4`, but has evolved\nsignificantly to provide more advanced capabilities for 4G/5G mobile user plane\nfunction (UPF), In-band Network Telemetry (INT), slicing, and QoS.\n\nFor up-to-date documentation on the architecture, capabilities, and\ninstructions to deploy and use SD-Fabric, please refer to the official\ndocumentation:\n\n\u003chttps://docs.sd-fabric.org/\u003e\n\n## Content\n\n### P4 Program\n\nThe directory `p4src/tna` contains the P4 program for the TNA architecture.\n`p4src/v1model` contains an equivalent version of the same program based on the\nV1Model architecture, to be used for development and testing together with the\nBMv2 software switch.\n\n### ONOS Pipeconf\n\n`src/` contains the Java implementation and tests for the ONOS pipeconf, which\nis essentially a set of drivers enabling ONOS to control different aspects of\nthe switch pipeline defined by the P4 program.\n\n### PTF Tests\n\n`ptf/` contains an extensive suite of test cases  for the P4 program, based on\nthe Packet Test Framework (PTF). These tests are used to validate the forwarding\nbehavior of the switch. We provide scripts and instructions to run tests on\nmultiple targets:\n\n* Tofino-Model (ASIC emulator)\n* HW switch\n* BMv2 software switch\n\n## Requirements\n\nTo build and test this project you will need the following software:\n\n* Barefoot SDE (a.k.a. Intel P4 Studio) = 9.7.0\n* ONOS \u003e= 2.5.8\n* Docker (to run the build scripts without worrying about dependencies)\n* cURL (to interact with the ONOS REST APIs)\n\n### Intel P4 Studio (SDE) Docker Image\n\nTo facilitate managing different versions of the Intel P4 Studio (SDE), the build\nscripts expect the Barefoot SDE to be provided as a Docker image. We do not provide\nsuch image, but one can be easily generated by:\n\n* executing the regular SDE install instructions inside a Dockerfile\n* making sure executables such as `bf-p4c` and `tofino-model` are on `$PATH`\n\nOnce you obtain such Docker image, set the following environment variables:\n\n```bash\nexport SDE_VERSION=9.7.0\nexport SDE_DOCKER_IMG=my-docker-repo/bf-sde:9.7.0\n```\n\n## Quick steps\n\nTo compile the P4 program with a given `\u003cprofile\u003e`:\n\n```bash\nmake \u003cprofile\u003e\n```\n\nThe available profiles are:\n\n| Profile name     | Description                          |\n|------------------|--------------------------------------|\n| `fabric`         | Basic L2/L3 forwarding capabilities  |\n| `fabric-upf`     | With 4G/5G mobile user plane support |\n| `fabric-int`     | With INT support                     |\n| `fabric-upf-int` | WITH UPF and INT support             |\n\nTo run PTF tests on Stratum using Tofino Model:\n\n```bash\n./ptf/run/tm/run \u003cprofile\u003e\n```\n\nFor more information about running PTF tests, check [ptf/README.md](ptf/README.md).\n\nIf you want to test the pipeline manually with an interactive P4Runtime shell:\n\n```bash\n./ptf/run/tm/p4rt-shell \u003cprofile\u003e\n```\n\nThis command will start Tofino Model with Stratum and a P4Runtime Shell attached\nto it. For more information about using P4Runtime Shell, check\n[p4lang/p4runtime-shell](https://github.com/p4lang/p4runtime-shell).\n\nAlso, check [p4rt_shell_snippets.md](p4rt_shell_snippets.md) for some examples\nof how to program tables in fabric-tna.\n\nTo build the ONOS pipeconf `.oar` package which includes the compiled P4\nartifacts for the previously built profile(s):\n\n```bash\nmake pipeconf\n```\n\nTo learn more about pipeconfs, keep reading.\n\n## Detailed steps to build the fabric-tna pipeconf\n\nONOS uses \"pipeconfs\" to deploy and manage a given P4 program on a device.\nPipeconfs include mainly two things:\n\n1. the P4 compiled artifacts (e.g., `tofino.bin`, `context.json`, etc.) to\ndeploy on devices.\n2. Java classes implementing ONOS driver behaviors to control capabilities of\nthe particular P4 program.\n\nPipeconfs are distributed as ONOS applications, hence using the `.oar`\npackaging. The following steps provide instructions on how to generate an oar\npackage that includes one or more profiles.\n\nTo learn more about pipeconfs and how ONOS supports P4-programmable devices:\n\u003chttps://github.com/opennetworkinglab/ngsdn-tutorial\u003e\n\nTo build `fabric-tna.p4` using the Barefoot compiler and to create the pipeconf\n`.oar` package in one command:\n\n```bash\nmake build [PROFILES=...]\n```\n\nThis command will build the `fabric-tna.p4` profiles specified in the `PROFILES` argument.\n\nTo build all profiles, leave `PROFILES` unset.\n\nTo build a subset of the available profiles separate them with spaces:\n`PROFILES=\"fabric fabric-int\"`\n\nThe P4 compiler outputs to include in the `.oar` package will be placed under\n`src/main/resources/p4c-out`.\n\nWhen done, the pipeconf `.oar` package can be found in\n`target/fabric-tna-\u003cVERSION\u003e.oar`\n\n## Steps to use the fabric-tna pipeconf with ONOS\n\n### 1 - Get and run ONOS\n\nYou can either build from sources or run one the released versions:\n\u003chttps://wiki.onosproject.org/display/ONOS/Downloads\u003e\n\nPre-built ONOS Docker images are available here:\n\u003chttps://hub.docker.com/r/onosproject/onos/tags\u003e\n\nFor more information on how to get and run ONOS:\n\u003chttps://wiki.onosproject.org/display/ONOS/Guides\u003e\n\n### 2 - Start Stratum on your switch\n\nTo run Stratum on a Tofino-based switch, please follow instructions in this document:\n\u003chttps://github.com/stratum/stratum/blob/main/stratum/hal/bin/barefoot/README.run.md\u003e\n\nNote that `fabric-tna` uses the `@p4runtime_translation` annotation for certain\nP4 tables, you must enable P4Runtime translation with the following flags when starting\nStratum:\n\n```text\n-experimental_enable_p4runtime_translation\n-incompatible_enable_bfrt_legacy_bytestring_responses\n```\n\n### 3 - Install pipeconf app in ONOS\n\nTo install the pipeconf app built in the previous step, assuming ONOS is\nrunning on the local machine:\n\n```bash\nmake pipeconf-install ONOS_HOST=localhost\n```\n\nUse the `ONOS_HOST` argument to specify the hostname/IP address of the machine\nwhere ONOS is running.\n\nThis command is a wrapper to a `curl` command that uses the ONOS REST API to\nupload and activate the `.oar` package previously built.\n\nYou should see the ONOS log updating with messages notifying the registration of\nnew pipeconfs in the system, depending on the profiles compiled before, and the\nBarefoot SDE version:\n\n```text\nNew pipeconf registered: org.stratumproject.fabric.mavericks_sde_9_7_0 (fingerprint=...)\nNew pipeconf registered: org.stratumproject.fabric.montara_sde_9_7_0 (fingerprint=...)\n...\n```\n\n**NOTE: it might take up to one minute for the pipeconfs to be registered.**\n\nTo check all pipeconfs registered in the system, use the ONOS CLI:\n\n```text\nonos\u003e pipeconfs\n```\n\n### 4 - Connect ONOS to a Stratum switch\n\nActivate the Barefoot drivers in ONOS:\n\n```text\nonos\u003e app activate org.onosproject.drivers.barefoot\n```\n\nThis command will register a new driver named `stratum-tofino`. As the name\nsuggests, this driver allows ONOS to control Tofino switches running Stratum.\n\nFor ONOS to be able to discover your switch, you need to push a JSON file,\nusually referred to as the \"netcfg\" file. We provide an example of such\n`tofino-netcfg.json` file in this repository. Make sure to modify the following\nvalues:\n\n* `managementAddress` is expected to contain a valid URI with host and port of\n  the Stratum gRPC server running on the switch;\n* The `device_id` URI query parameter is the P4Runtime-internal `device_id`,\n  also known as the Stratum \"Node ID\". Usually, you can leave this value set to\n  `1`;\n* Use the `pipeconf` field to specify which pipeconf/fabric profile to deploy on\n  the switch.\n\nPush the `tofino-netcfg.json` to ONOS using the command:\n\n```bash\nmake netcfg ONOS_HOST=localhost\n```\n\nLike before, this command is a wrapper to a `curl` command that uses the ONOS\nREST API to push the `tofino-netcfg.json` file.\n\nCheck the ONOS log for potential errors.\n\n## Using SD-Fabric with Stratum+Tofino switches\n\nCheck the official SD-Fabric documentation here:\n\u003chttps://docs.sd-fabric.org\u003e\n\nIn the \"Network Configuration\" section:\n\u003chttps://docs.sd-fabric.org/master/configuration/network.html\u003e\n\n## Support\n\nTo report issues when compiling `fabric-tna.p4` for Tofino (i.e., P4 compiler\nerrors), please contact Intel support.\n\nTo report any other kind of problem, feel free to open a GitHub Issue or reach\nout to the project maintainers on the ONF Community Slack.\n\n[ONOS]: https://opennetworking.org/onos/\n[Stratum]: https://github.com/stratum/stratum\n[Trellis]: https://www.opennetworking.org/trellis\n[SD-Fabric]: https://opennetworking.org/sd-fabric/\n[fabric.p4]: https://github.com/opennetworkinglab/onos/tree/master/pipelines/fabric/impl/src/main/resources\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstratum%2Ffabric-tna","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstratum%2Ffabric-tna","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstratum%2Ffabric-tna/lists"}