Skip to content

Repository files navigation

PiCN

CI

PiCN is a:

  • prototyping-friendly, modular library for Information-Centric Networking (ICN / CCN)
  • set of tools and network nodes (forwarder, repository, fetch, management)
  • platform for Named Function Networking (NFN)
  • simple simulation system for ICN and NFN

PiCN supports Python 3.14 and includes an asyncio runtime alongside the original multiprocessing-per-layer path (--runtime sync|async, default sync, so existing workflows keep working unchanged). See docs/modernization.md for how the migration got here and docs/design-adrs/ for the design rationale behind the dual runtime.

Topic Doc
Architecture (layers + dual runtime) docs/architecture.md
Package layout docs/project_structure.md
Design decisions (ADRs) docs/design-adrs/
Contributor conventions AGENTS.md

Features

Library

  • Link Layer (UDP faces, simulation bus)
  • Packet Encoding Layer (NDN TLV + simple string format)
  • ICN Layer (forwarding, CS / FIB / PIT)
  • Chunking, repository, NFN / thunk / routing / autoconfig layers
  • Management interface (sync process or async TCP task)

Tools (starter/)

  • picn-relay — ICN forwarder (--runtime sync|async)
  • picn-nfn — NFN forwarder (--runtime sync|async)
  • picn-repo / picn-pushrepo — content repositories
  • picn-fetch / picn-peek — fetch tools (picn-fetch supports --runtime)
  • picn-mgmt — management client
  • picn-setup — multi-node setup helper

Requirements

  • Python ≥ 3.14 (see pyproject.toml)
  • No hard runtime dependencies for the default CLI path
  • Optional: pip install "PiCN[dev]" for pytest; pip install "PiCN[config]" for picn-relay -c TOML configs (pytoml)

Setup

git clone https://github.com/cn-uofbasel/PiCN.git
cd PiCN
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
export PATH="$PATH:$(pwd)/starter"
# starter scripts also set PYTHONPATH to the repo root

Alternatively without editable install: export PYTHONPATH=$(pwd) and put starter/ on your PATH.

Getting Started (ICN)

Set up a repository and a forwarding node:

Hands On: Topology

Prepare content:

mkdir -p /tmp/repo
echo "HELLO WORLD" > /tmp/repo/example

Start a repository and a forwarder (default sync runtime):

picn-repo --format ndntlv /tmp/repo /the/prefix 10000 &
picn-relay --format ndntlv --port 9000 &

Configure a face and forwarding rule:

picn-mgmt --ip 127.0.0.1 --port 9000 newface 127.0.0.1:10000:0
picn-mgmt --ip 127.0.0.1 --port 9000 newforwardingrule /the:0

You can also install a rule that fans out to multiple faces (e.g. face-ids 0 and 1):

picn-mgmt --ip 127.0.0.1 --port 9000 newforwardingrule /prefix:0,1

Fetch content via the forwarder:

picn-fetch --format ndntlv 127.0.0.1 9000 /the/prefix/example
HELLO WORLD

Async runtime (optional)

Relay and fetch accept --runtime async (one event loop per node instead of one process per layer). Example:

picn-relay --format ndntlv --port 9000 --runtime async &
picn-fetch --format ndntlv --runtime async 127.0.0.1 9000 /the/prefix/example

Details: docs/architecture.md.

Getting Started with NFN

NFN is a computation engine for ICN: express how data should be transformed; the network finds where to compute. Tutorial: docs/nfn.md.

Minimal sketch (commands unchanged; add --runtime async on picn-nfn / picn-fetch if desired):

picn-nfn --port 9000 --format ndntlv -l debug &
picn-nfn --port 9001 --format ndntlv -l debug &
picn-mgmt --port 9000 newface 127.0.0.1:9001:0
picn-mgmt --port 9000 newforwardingrule /data:0
# … install function + data via picn-mgmt newcontent, then:
picn-fetch 127.0.0.1 9000 '/func/combine("Hello",/data/obj1)/NFN'

Tests and CI

python -m pytest PiCN/ --ignore=PiCN/Simulations -q --timeout=90

GitHub Actions (this branch): fast suite on every push; full suite (Ubuntu + macOS) on pull requests and workflow_dispatch. Simulations are excluded from CI (slow / environment-sensitive).

More about…

Operational

Internals

Migration history

The asyncio/Python 3.14 migration is complete. Its rationale and verification record are kept for reference: plan and current-state audit · per-phase test evidence.

The project