p4net 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. p4net-0.2.0/.editorconfig +15 -0
  2. p4net-0.2.0/.github/ISSUE_TEMPLATE/bug_report.md +26 -0
  3. p4net-0.2.0/.github/ISSUE_TEMPLATE/config.yml +5 -0
  4. p4net-0.2.0/.github/ISSUE_TEMPLATE/feature_request.md +22 -0
  5. p4net-0.2.0/.github/PULL_REQUEST_TEMPLATE.md +22 -0
  6. p4net-0.2.0/.github/dependabot.yml +16 -0
  7. p4net-0.2.0/.github/workflows/ci.yml +56 -0
  8. p4net-0.2.0/.gitignore +38 -0
  9. p4net-0.2.0/.pre-commit-config.yaml +23 -0
  10. p4net-0.2.0/CHANGELOG.md +69 -0
  11. p4net-0.2.0/CODE_OF_CONDUCT.md +83 -0
  12. p4net-0.2.0/CONTRIBUTING.md +36 -0
  13. p4net-0.2.0/LICENSE +201 -0
  14. p4net-0.2.0/PKG-INFO +149 -0
  15. p4net-0.2.0/README.md +114 -0
  16. p4net-0.2.0/SECURITY.md +13 -0
  17. p4net-0.2.0/docs/architecture.md +218 -0
  18. p4net-0.2.0/docs/cli.md +338 -0
  19. p4net-0.2.0/docs/releasing.md +158 -0
  20. p4net-0.2.0/docs/roadmap.md +75 -0
  21. p4net-0.2.0/docs/tutorial.md +190 -0
  22. p4net-0.2.0/examples/README.md +12 -0
  23. p4net-0.2.0/examples/asymmetric_link/README.md +46 -0
  24. p4net-0.2.0/examples/asymmetric_link/asymmetric.p4 +51 -0
  25. p4net-0.2.0/examples/asymmetric_link/topology.py +74 -0
  26. p4net-0.2.0/examples/cpu_punt/README.md +73 -0
  27. p4net-0.2.0/examples/cpu_punt/cpu_punt.p4 +94 -0
  28. p4net-0.2.0/examples/cpu_punt/topology.py +39 -0
  29. p4net-0.2.0/examples/dual_stack/README.md +47 -0
  30. p4net-0.2.0/examples/dual_stack/dual_stack.p4 +51 -0
  31. p4net-0.2.0/examples/dual_stack/topology.py +112 -0
  32. p4net-0.2.0/examples/ipv6_lpm/README.md +54 -0
  33. p4net-0.2.0/examples/ipv6_lpm/ipv6_lpm.p4 +99 -0
  34. p4net-0.2.0/examples/ipv6_lpm/topology.py +84 -0
  35. p4net-0.2.0/examples/l3_forwarding/README.md +57 -0
  36. p4net-0.2.0/examples/l3_forwarding/ipv4_lpm.p4 +97 -0
  37. p4net-0.2.0/examples/l3_forwarding/topology.py +82 -0
  38. p4net-0.2.0/examples/quick_start/README.md +63 -0
  39. p4net-0.2.0/examples/quick_start/quick_start.p4 +51 -0
  40. p4net-0.2.0/examples/quick_start/quick_start.py +80 -0
  41. p4net-0.2.0/pyproject.toml +86 -0
  42. p4net-0.2.0/src/p4net/__init__.py +6 -0
  43. p4net-0.2.0/src/p4net/__main__.py +6 -0
  44. p4net-0.2.0/src/p4net/cli/__init__.py +13 -0
  45. p4net-0.2.0/src/p4net/cli/completers.py +46 -0
  46. p4net-0.2.0/src/p4net/cli/dispatcher.py +940 -0
  47. p4net-0.2.0/src/p4net/cli/exceptions.py +17 -0
  48. p4net-0.2.0/src/p4net/cli/formatting.py +56 -0
  49. p4net-0.2.0/src/p4net/cli/main.py +163 -0
  50. p4net-0.2.0/src/p4net/cli/shell.py +80 -0
  51. p4net-0.2.0/src/p4net/compiler/__init__.py +11 -0
  52. p4net-0.2.0/src/p4net/compiler/exceptions.py +38 -0
  53. p4net-0.2.0/src/p4net/compiler/p4c.py +284 -0
  54. p4net-0.2.0/src/p4net/control/__init__.py +82 -0
  55. p4net-0.2.0/src/p4net/control/client.py +891 -0
  56. p4net-0.2.0/src/p4net/control/codec.py +237 -0
  57. p4net-0.2.0/src/p4net/control/exceptions.py +45 -0
  58. p4net-0.2.0/src/p4net/control/p4info_index.py +360 -0
  59. p4net-0.2.0/src/p4net/log/__init__.py +0 -0
  60. p4net-0.2.0/src/p4net/network/__init__.py +20 -0
  61. p4net-0.2.0/src/p4net/network/_cleanup.py +84 -0
  62. p4net-0.2.0/src/p4net/network/exceptions.py +21 -0
  63. p4net-0.2.0/src/p4net/network/nodes.py +201 -0
  64. p4net-0.2.0/src/p4net/network/orchestrator.py +562 -0
  65. p4net-0.2.0/src/p4net/runtime/__init__.py +34 -0
  66. p4net-0.2.0/src/p4net/runtime/bmv2.py +305 -0
  67. p4net-0.2.0/src/p4net/runtime/exceptions.py +33 -0
  68. p4net-0.2.0/src/p4net/runtime/link.py +235 -0
  69. p4net-0.2.0/src/p4net/runtime/netns.py +229 -0
  70. p4net-0.2.0/src/p4net/runtime/sysctl.py +76 -0
  71. p4net-0.2.0/src/p4net/runtime/tc.py +122 -0
  72. p4net-0.2.0/src/p4net/topo/__init__.py +16 -0
  73. p4net-0.2.0/src/p4net/topo/exceptions.py +9 -0
  74. p4net-0.2.0/src/p4net/topo/host.py +70 -0
  75. p4net-0.2.0/src/p4net/topo/link.py +105 -0
  76. p4net-0.2.0/src/p4net/topo/switch.py +62 -0
  77. p4net-0.2.0/src/p4net/topo/topology.py +589 -0
  78. p4net-0.2.0/tests/__init__.py +0 -0
  79. p4net-0.2.0/tests/_artifact_patterns.py +39 -0
  80. p4net-0.2.0/tests/cli/__init__.py +0 -0
  81. p4net-0.2.0/tests/cli/test_dispatcher_integration.py +269 -0
  82. p4net-0.2.0/tests/cli/test_dispatcher_switch_unit.py +555 -0
  83. p4net-0.2.0/tests/cli/test_dispatcher_unit.py +643 -0
  84. p4net-0.2.0/tests/cli/test_main_unit.py +227 -0
  85. p4net-0.2.0/tests/cli/test_shell_completer_unit.py +113 -0
  86. p4net-0.2.0/tests/compiler/__init__.py +0 -0
  87. p4net-0.2.0/tests/compiler/test_p4c_integration.py +96 -0
  88. p4net-0.2.0/tests/compiler/test_p4c_unit.py +390 -0
  89. p4net-0.2.0/tests/conftest.py +145 -0
  90. p4net-0.2.0/tests/control/__init__.py +0 -0
  91. p4net-0.2.0/tests/control/test_client_decode_unit.py +233 -0
  92. p4net-0.2.0/tests/control/test_client_integration.py +247 -0
  93. p4net-0.2.0/tests/control/test_client_packet_unit.py +210 -0
  94. p4net-0.2.0/tests/control/test_client_unit.py +716 -0
  95. p4net-0.2.0/tests/control/test_codec.py +464 -0
  96. p4net-0.2.0/tests/control/test_p4info_index.py +599 -0
  97. p4net-0.2.0/tests/control/test_packet_integration.py +391 -0
  98. p4net-0.2.0/tests/fixtures/p4/__init__.py +0 -0
  99. p4net-0.2.0/tests/fixtures/p4/forward.p4 +51 -0
  100. p4net-0.2.0/tests/fixtures/p4/simple_routing.p4 +97 -0
  101. p4net-0.2.0/tests/fixtures/p4/syntax_error.p4 +2 -0
  102. p4net-0.2.0/tests/fixtures/p4/two_port_swap.p4 +51 -0
  103. p4net-0.2.0/tests/network/__init__.py +0 -0
  104. p4net-0.2.0/tests/network/test_asymmetric_impairment_integration.py +134 -0
  105. p4net-0.2.0/tests/network/test_ipv6_integration.py +238 -0
  106. p4net-0.2.0/tests/network/test_nodes_unit.py +129 -0
  107. p4net-0.2.0/tests/network/test_orchestrator_integration.py +375 -0
  108. p4net-0.2.0/tests/network/test_orchestrator_unit.py +877 -0
  109. p4net-0.2.0/tests/network/test_phase13_integration.py +235 -0
  110. p4net-0.2.0/tests/runtime/__init__.py +0 -0
  111. p4net-0.2.0/tests/runtime/test_bmv2_integration.py +214 -0
  112. p4net-0.2.0/tests/runtime/test_bmv2_unit.py +471 -0
  113. p4net-0.2.0/tests/runtime/test_link_unit.py +262 -0
  114. p4net-0.2.0/tests/runtime/test_netns_unit.py +274 -0
  115. p4net-0.2.0/tests/runtime/test_runtime_integration.py +174 -0
  116. p4net-0.2.0/tests/runtime/test_sysctl_unit.py +80 -0
  117. p4net-0.2.0/tests/runtime/test_tc_unit.py +140 -0
  118. p4net-0.2.0/tests/test_cleanup_fixture_smoke.py +54 -0
  119. p4net-0.2.0/tests/test_smoke.py +7 -0
  120. p4net-0.2.0/tests/topo/__init__.py +0 -0
  121. p4net-0.2.0/tests/topo/test_host.py +121 -0
  122. p4net-0.2.0/tests/topo/test_link.py +191 -0
  123. p4net-0.2.0/tests/topo/test_switch.py +89 -0
  124. p4net-0.2.0/tests/topo/test_topology.py +659 -0
  125. p4net-0.2.0/tests/topo/test_topology_graphviz_integration.py +53 -0
@@ -0,0 +1,15 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ end_of_line = lf
6
+ trim_trailing_whitespace = true
7
+ insert_final_newline = true
8
+
9
+ [*.py]
10
+ indent_style = space
11
+ indent_size = 4
12
+
13
+ [*.{yaml,yml,toml,json,md}]
14
+ indent_style = space
15
+ indent_size = 2
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: Bug report
3
+ about: Report a defect in p4net
4
+ title: ""
5
+ labels: bug
6
+ ---
7
+
8
+ ## Description
9
+
10
+ What happened, and what did you expect to happen?
11
+
12
+ ## Reproduction
13
+
14
+ Minimal steps to reproduce. Include the topology (or a link to a repo / gist) and the exact `p4net` invocation.
15
+
16
+ ## Environment
17
+
18
+ - p4net version: (output of `python -c "import p4net; print(p4net.__version__)"`)
19
+ - Python version: (output of `python --version`)
20
+ - OS / kernel: (output of `uname -a`)
21
+ - p4c version: (output of `p4c --version`)
22
+ - BMv2 version: (output of `simple_switch_grpc --version`)
23
+
24
+ ## Logs
25
+
26
+ Relevant excerpts from `<log_dir>/<switch>.log` and from `pytest` / `p4net` stderr.
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Question or discussion
4
+ url: https://github.com/zhh2001/p4net/discussions
5
+ about: Open-ended questions and design discussion belong in Discussions, not Issues.
@@ -0,0 +1,22 @@
1
+ ---
2
+ name: Feature request
3
+ about: Propose a new feature or capability
4
+ title: ""
5
+ labels: enhancement
6
+ ---
7
+
8
+ ## Problem
9
+
10
+ What can't you do today, or what's painful about how it works now?
11
+
12
+ ## Proposal
13
+
14
+ What would you like p4net to do? Sketch the API or the command-line if you have one in mind.
15
+
16
+ ## Alternatives considered
17
+
18
+ Other approaches you've thought about, and why they don't fit.
19
+
20
+ ## References
21
+
22
+ Links to relevant P4Runtime spec sections, BMv2 docs, prior art in other projects, etc.
@@ -0,0 +1,22 @@
1
+ ## Summary
2
+
3
+ What does this PR change?
4
+
5
+ ## Why
6
+
7
+ Link to the issue this addresses, or describe the problem if there's no issue yet.
8
+
9
+ ## How
10
+
11
+ Brief description of the approach. Note any design decisions worth flagging for review.
12
+
13
+ ## Testing
14
+
15
+ - [ ] `ruff check . && ruff format --check . && mypy src/p4net && pytest` all pass.
16
+ - [ ] If this touches integration code paths, the relevant marker suite (`integration`, `requires_p4c`, `requires_bmv2`) was run locally.
17
+ - [ ] New code has unit tests; coverage on touched modules has not regressed.
18
+ - [ ] CHANGELOG `[Unreleased]` updated if user-visible.
19
+
20
+ ## Notes for the reviewer
21
+
22
+ Anything specific you want eyes on.
@@ -0,0 +1,16 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "pip"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ open-pull-requests-limit: 5
8
+ commit-message:
9
+ prefix: "chore(deps)"
10
+ - package-ecosystem: "github-actions"
11
+ directory: "/"
12
+ schedule:
13
+ interval: "weekly"
14
+ open-pull-requests-limit: 5
15
+ commit-message:
16
+ prefix: "chore(ci)"
@@ -0,0 +1,56 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ lint-and-test:
11
+ runs-on: ubuntu-24.04
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Set up Python ${{ matrix.python-version }}
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+ cache: pip
24
+
25
+ - name: Install package
26
+ run: pip install -e '.[dev]'
27
+
28
+ - name: Ruff lint
29
+ run: ruff check .
30
+
31
+ - name: Ruff format check
32
+ run: ruff format --check .
33
+
34
+ - name: Mypy
35
+ run: mypy src/p4net
36
+
37
+ - name: Pytest
38
+ run: pytest
39
+
40
+ integration-test:
41
+ runs-on: ubuntu-24.04
42
+ needs: lint-and-test
43
+ steps:
44
+ - uses: actions/checkout@v4
45
+
46
+ - name: Set up Python 3.12
47
+ uses: actions/setup-python@v5
48
+ with:
49
+ python-version: "3.12"
50
+ cache: pip
51
+
52
+ - name: Install package
53
+ run: pip install -e '.[dev]'
54
+
55
+ - name: Run integration tests as root
56
+ run: sudo "$(which pytest)" -m integration --run-integration
p4net-0.2.0/.gitignore ADDED
@@ -0,0 +1,38 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # Distribution / packaging
7
+ *.egg-info/
8
+ dist/
9
+ build/
10
+
11
+ # Test / type-check / lint caches
12
+ .pytest_cache/
13
+ .mypy_cache/
14
+ .ruff_cache/
15
+ .tox/
16
+
17
+ # Coverage
18
+ .coverage
19
+ coverage.xml
20
+ htmlcov/
21
+
22
+ # Virtual environments
23
+ .venv/
24
+ venv/
25
+ env/
26
+
27
+ # Editor / OS
28
+ .idea/
29
+ .vscode/
30
+ .DS_Store
31
+ Thumbs.db
32
+
33
+ # Project runtime artifacts
34
+ *.log
35
+ *.pcap
36
+ pcaps/
37
+ logs/
38
+ build-bmv2/
@@ -0,0 +1,23 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v6.0.0
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: end-of-file-fixer
7
+ - id: check-yaml
8
+ - id: check-toml
9
+ - id: check-merge-conflict
10
+
11
+ - repo: https://github.com/astral-sh/ruff-pre-commit
12
+ rev: v0.15.12
13
+ hooks:
14
+ - id: ruff-check
15
+ args: [--fix]
16
+ - id: ruff-format
17
+
18
+ - repo: https://github.com/pre-commit/mirrors-mypy
19
+ rev: v2.0.0
20
+ hooks:
21
+ - id: mypy
22
+ files: ^src/p4net/
23
+ additional_dependencies: []
@@ -0,0 +1,69 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.2.0] - 2026-05-10
11
+
12
+ ### Added
13
+
14
+ - P4Runtime CPU-port packet I/O: `P4RuntimeClient.send_packet_out`,
15
+ `on_packet_in`, `expect_packet_in`.
16
+ - `P4InfoIndex.packet_in_metadata_schema`,
17
+ `packet_out_metadata_schema`, `encode_packet_out_metadata`,
18
+ `decode_packet_in_metadata` for controller-header encoding/decoding.
19
+ - IPv6 host addressing: `Host.ip6`, `Host.default_route6`,
20
+ `LinkEndpoint.ip6`, with per-interface IPv6 sysctl gating
21
+ (disabled by default; enabled when `ip6` is set, with `accept_ra=0`
22
+ and `autoconf=0` to suppress SLAAC).
23
+ - Asymmetric link impairment: per-direction `bandwidth`, `delay`,
24
+ `jitter`, `loss_pct` fields on `Link` (`*_a_to_b` / `*_b_to_a`).
25
+ - IPv6 codec helper `decode_ipv6` and 128-bit-field support in
26
+ `P4InfoIndex.decode_match`, so `<switch> table dump` renders
27
+ IPv6 LPM matches as `fd00::1/128` instead of raw byte tuples.
28
+ - `Network.xterm(host)` and CLI `<host> xterm` for spawning an
29
+ interactive terminal in a host's namespace (requires `$DISPLAY`).
30
+ - `Network.pingall6()` and CLI `pingall6` for an IPv6 connectivity matrix.
31
+ - `Topology.to_graphviz()` and `Topology.render_graphviz(path, format=...)`,
32
+ with CLI command `topology graph [path] [layout=...] [format=...]`.
33
+ - CLI commands `<switch> packet send` and `<switch> packet listen`.
34
+ - CLI command `<host> ping6` for explicit IPv6 ping.
35
+ - Python 3.13 added to package classifiers.
36
+ - New examples: `cpu_punt`, `dual_stack`, `asymmetric_link`, `ipv6_lpm`.
37
+
38
+ ### Changed
39
+
40
+ - `RunningHost.ping` auto-selects IPv4 vs IPv6 based on the target
41
+ string (presence of `:` selects IPv6). Pass `force_ipv6=True` to
42
+ override.
43
+ - `<switch> table dump` action parameters now render with width-aware
44
+ decoding (e.g. a 9-bit `port` shows as `'2'`, not `b'\x02'`).
45
+ - CLI `hosts` output gains a `primary_ip6` column.
46
+ - `topology graph` now calls `Topology.validate()` before rendering;
47
+ malformed topologies surface a clear error instead of silently
48
+ producing misleading DOT.
49
+
50
+ ## [0.1.0] - 2026-05-10
51
+
52
+ ### Added
53
+
54
+ - Linux network-namespace and veth primitives (p4net.runtime).
55
+ - BMv2 simple_switch_grpc process lifecycle wrapper (p4net.runtime.bmv2).
56
+ - Topology DSL with Host, P4Switch, Link, and Topology validation (p4net.topo).
57
+ - p4c wrapper with content-addressed compile cache (p4net.compiler).
58
+ - P4Runtime gRPC client with master arbitration, pipeline config, table CRUD,
59
+ counter reads, and multicast group management (p4net.control).
60
+ - P4InfoIndex with encode_match / decode_match for human-readable table dumps,
61
+ plus codec helpers (encode_value, parse_lpm/ternary/range, decode_ipv4,
62
+ decode_mac, format_lpm/ternary/range/exact).
63
+ - Network orchestrator with start/stop, validate-on-start, atexit and signal
64
+ cleanup, and a working with-statement (p4net.network).
65
+ - Interactive shell (p4net.cli.P4NetShell) and `p4net` console script for
66
+ running topology files.
67
+ - Examples: quick_start (port-swap pipeline) and l3_forwarding (programmed
68
+ ipv4_lpm with static ARP).
69
+ - Documentation: architecture, tutorial, CLI reference.
@@ -0,0 +1,83 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or advances of any kind
22
+ * Trolling, insulting or derogatory comments, and personal or political attacks
23
+ * Public or private harassment
24
+ * Publishing others' private information, such as a physical or email address, without their explicit permission
25
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
26
+
27
+ ## Enforcement Responsibilities
28
+
29
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
32
+
33
+ ## Scope
34
+
35
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
36
+
37
+ ## Enforcement
38
+
39
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at 1652709417@qq.com. All complaints will be reviewed and investigated promptly and fairly.
40
+
41
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
42
+
43
+ ## Enforcement Guidelines
44
+
45
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
46
+
47
+ ### 1. Correction
48
+
49
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
50
+
51
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
52
+
53
+ ### 2. Warning
54
+
55
+ **Community Impact**: A violation through a single incident or series of actions.
56
+
57
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
58
+
59
+ ### 3. Temporary Ban
60
+
61
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
62
+
63
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
64
+
65
+ ### 4. Permanent Ban
66
+
67
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
68
+
69
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
70
+
71
+ ## Attribution
72
+
73
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
74
+
75
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
76
+
77
+ For answers to common questions about this code of conduct, see the FAQ at [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at [https://www.contributor-covenant.org/translations][translations].
78
+
79
+ [homepage]: https://www.contributor-covenant.org
80
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
81
+ [Mozilla CoC]: https://github.com/mozilla/diversity
82
+ [FAQ]: https://www.contributor-covenant.org/faq
83
+ [translations]: https://www.contributor-covenant.org/translations
@@ -0,0 +1,36 @@
1
+ # Contributing to p4net
2
+
3
+ Thanks for your interest in contributing.
4
+
5
+ ## Discussion first
6
+
7
+ For non-trivial changes, please open an issue to discuss the design before
8
+ sending a large pull request. Small fixes and clearly-scoped improvements can
9
+ go straight to a PR.
10
+
11
+ ## Development setup
12
+
13
+ After cloning the repository:
14
+
15
+ ```
16
+ pip install -e '.[dev]' && pre-commit install
17
+ ```
18
+
19
+ ## Before submitting
20
+
21
+ Run the full local check suite and make sure it is clean:
22
+
23
+ ```
24
+ ruff check . && ruff format --check . && mypy src/p4net && pytest
25
+ ```
26
+
27
+ ## Commit messages
28
+
29
+ Conventional-commit style subjects are preferred:
30
+
31
+ ```
32
+ type: subject
33
+ ```
34
+
35
+ Allowed types: `feat`, `fix`, `chore`, `docs`, `test`, `refactor`, `ci`,
36
+ `build`.
p4net-0.2.0/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Support. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or support.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright (c) 2026 The p4net Authors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.