{"id":49088334,"url":"https://github.com/zhh2001/p4runtime-go-controller","last_synced_at":"2026-04-26T23:00:35.707Z","repository":{"id":352653643,"uuid":"1216042254","full_name":"zhh2001/p4runtime-go-controller","owner":"zhh2001","description":"Production-grade Go SDK and p4ctl CLI for building P4Runtime controllers — works with BMv2, Stratum, Tofino, and any   P4Runtime 1.3.0+ target.","archived":false,"fork":false,"pushed_at":"2026-04-21T02:58:15.000Z","size":152,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-23T20:27:55.655Z","etag":null,"topics":["bmv2","cli","data-plane","go-sdk","golang","grpc","network-automation","networking","p4","p4lang","p4runtime","programmable-data-plane","sdn","sdn-controller","stratum","tofino"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/zhh2001/p4runtime-go-controller","language":"Go","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/zhh2001.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":"SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE","maintainers":"MAINTAINERS.md","copyright":null,"agents":null,"dco":null,"cla":null},"funding":null},"created_at":"2026-04-20T14:03:43.000Z","updated_at":"2026-04-22T13:23:09.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/zhh2001/p4runtime-go-controller","commit_stats":null,"previous_names":["zhh2001/p4runtime-go-controller"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/zhh2001/p4runtime-go-controller","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhh2001%2Fp4runtime-go-controller","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhh2001%2Fp4runtime-go-controller/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhh2001%2Fp4runtime-go-controller/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhh2001%2Fp4runtime-go-controller/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhh2001","download_url":"https://codeload.github.com/zhh2001/p4runtime-go-controller/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhh2001%2Fp4runtime-go-controller/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32240613,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"ssl_error","status_checked_at":"2026-04-24T13:21:15.005Z","response_time":64,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["bmv2","cli","data-plane","go-sdk","golang","grpc","network-automation","networking","p4","p4lang","p4runtime","programmable-data-plane","sdn","sdn-controller","stratum","tofino"],"created_at":"2026-04-20T17:05:42.230Z","updated_at":"2026-04-24T21:00:45.503Z","avatar_url":"https://github.com/zhh2001.png","language":"Go","readme":"# p4runtime-go-controller\n\n[![CI](https://github.com/zhh2001/p4runtime-go-controller/actions/workflows/ci.yml/badge.svg)](https://github.com/zhh2001/p4runtime-go-controller/actions/workflows/ci.yml)\n[![CodeQL](https://github.com/zhh2001/p4runtime-go-controller/actions/workflows/codeql.yml/badge.svg)](https://github.com/zhh2001/p4runtime-go-controller/actions/workflows/codeql.yml)\n[![govulncheck](https://github.com/zhh2001/p4runtime-go-controller/actions/workflows/govulncheck.yml/badge.svg)](https://github.com/zhh2001/p4runtime-go-controller/actions/workflows/govulncheck.yml)\n[![codecov](https://codecov.io/gh/zhh2001/p4runtime-go-controller/branch/main/graph/badge.svg)](https://codecov.io/gh/zhh2001/p4runtime-go-controller)\n[![Go Reference](https://pkg.go.dev/badge/github.com/zhh2001/p4runtime-go-controller.svg)](https://pkg.go.dev/github.com/zhh2001/p4runtime-go-controller)\n[![Go Report Card](https://goreportcard.com/badge/github.com/zhh2001/p4runtime-go-controller)](https://goreportcard.com/report/github.com/zhh2001/p4runtime-go-controller)\n[![Go Version](https://img.shields.io/github/go-mod/go-version/zhh2001/p4runtime-go-controller)](go.mod)\n[![Latest Release](https://img.shields.io/github/v/release/zhh2001/p4runtime-go-controller?sort=semver)](https://github.com/zhh2001/p4runtime-go-controller/releases/latest)\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://www.conventionalcommits.org)\n\nA production-grade Go SDK for writing P4Runtime controllers.\n\n- Works against any P4Runtime 1.3.0+ target (BMv2, Stratum, Tofino-based\n  switches, custom ASIC agents).\n- Zero hard dependency beyond `google.golang.org/grpc`,\n  `google.golang.org/protobuf`, and the official P4Runtime proto stubs.\n- Structured logging through `log/slog`, pluggable metrics, pluggable tracing.\n\n\u003e The public API is stable as of `v1.0.0` and follows the\n\u003e [Go 1 compatibility promise](https://go.dev/doc/go1compat). Every change is\n\u003e documented in the [CHANGELOG](CHANGELOG.md).\n\n## Install\n\n```sh\ngo get github.com/zhh2001/p4runtime-go-controller@latest\n```\n\n## Quickstart\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"log\"\n    \"time\"\n\n    \"github.com/zhh2001/p4runtime-go-controller/client\"\n)\n\nfunc main() {\n    ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n    defer cancel()\n\n    c, err := client.Dial(ctx, \"127.0.0.1:9559\",\n        client.WithDeviceID(1),\n        client.WithElectionID(client.ElectionID{High: 0, Low: 1}),\n    )\n    if err != nil {\n        log.Fatalf(\"dial: %v\", err)\n    }\n    defer c.Close()\n\n    if err := c.BecomePrimary(ctx); err != nil {\n        log.Fatalf(\"arbitration: %v\", err)\n    }\n    log.Println(\"primary controller for device 1\")\n}\n```\n\nSee [`examples/`](examples/) for full end-to-end walkthroughs, including\nconnection, pipeline push, L2 learning switch, packet I/O, and counter reads.\n\n## Feature Matrix\n\n| Capability | Status |\n| --- | --- |\n| Connection management (TLS, keepalive, reconnect) | ready |\n| Mastership / arbitration (128-bit election ID) | ready |\n| Pipeline configuration (VERIFY / RECONCILE / COMMIT with fallback) | ready |\n| P4Info by-name / by-ID index | ready |\n| Table entry insert / modify / delete (EXACT / LPM / TERNARY / RANGE / OPTIONAL) | ready |\n| Counters, Meters, Registers (direct and indirect) | ready |\n| PacketIn / PacketOut with metadata encode/decode | ready |\n| Digest subscribe and ack | ready |\n| Packet Replication Engine (multicast groups, clone sessions) | ready (v1.1) |\n| Reference CLI (`p4ctl`) | ready |\n| Prometheus adapter | planned |\n| OpenTelemetry gRPC interceptors | planned |\n\n## P4Runtime Compatibility\n\n| Controller version | P4Runtime spec |\n| --- | --- |\n| `v1.x` | 1.3.0+ |\n\n## Documentation\n\n- [`ARCHITECTURE.md`](ARCHITECTURE.md) — layered design and data-flow.\n- [`DESIGN_NOTES.md`](DESIGN_NOTES.md) — architectural decisions and open\n  questions.\n- [`docs/quickstart.md`](docs/quickstart.md) — run your first controller.\n- [`docs/troubleshooting.md`](docs/troubleshooting.md) — common issues.\n- [`docs/glossary.md`](docs/glossary.md) — P4, P4Runtime, PDPI, pipeline, etc.\n- [`docs/i18n/README.zh-CN.md`](docs/i18n/README.zh-CN.md) — 中文版本.\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md). Please read the\n[Code of Conduct](CODE_OF_CONDUCT.md) before opening a pull request.\n\n## Security\n\nTo report a vulnerability, follow the instructions in [SECURITY.md](SECURITY.md).\nDo not open a public issue for anything that could affect deployed controllers.\n\n## License\n\nLicensed under the [Apache License, Version 2.0](LICENSE). See [NOTICE](NOTICE)\nfor third-party attribution.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhh2001%2Fp4runtime-go-controller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhh2001%2Fp4runtime-go-controller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhh2001%2Fp4runtime-go-controller/lists"}