Skip to content

Implement KNE Packet Bridge daemon and CLI subcommand - #762

Open
kraney wants to merge 16 commits into
openconfig:mainfrom
kraney:feat/packet-bridge
Open

Implement KNE Packet Bridge daemon and CLI subcommand#762
kraney wants to merge 16 commits into
openconfig:mainfrom
kraney:feat/packet-bridge

Conversation

@kraney

@kraney kraney commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds Kubernetes TCP socket readiness probes across network device pods based on configured node services, and improves Cisco node lifecycle and status handling.

Key Changes

  1. Dynamic Service Readiness Probes (topo/node/node.go):
    - Added node.ServiceReadinessProbe(pb) which automatically configures a TCP socket ReadinessProbe on device containers based on defined node services (prioritizing ssh on port 22, then gnmi).
    - Sorted service keys prior to map iteration to guarantee deterministic probe port selection.
    - Updated node implementations across vendors (Arista, Ciena, Cisco, Juniper, Nokia, SONiC) to attach readiness probes to created pods.

  2. Cisco Status and Readiness Checking (topo/node/cisco/cisco.go):
    - Updated Status() to inspect PodStatus.Conditions for corev1.PodReady == ConditionTrue before declaring a pod StatusRunning. This prevents XRD (and 8000e) pods from prematurely reporting ready in the 1–2 seconds before control-plane processes boot and listen on ports.
    - Optimized 8000e log checking during status polling to stream and buffer pod logs once per check cycle rather than making duplicate
    API calls for success and failure regex checks.
    - Added fatal boot error detection (Router failed to come up, FATAL sim:, LoginTimeoutError) to report StatusFailed.
    - Fixed variable shadowing of the Go built-in len.

  3. Testing:
    - topo/node/cisco/cisco_test.go: Added unit tests for isNode8000eFailed and isNode8000eUp, expanded TestNodeStatus with Ready/NotReady/Failed conditions and failure log matching, and verified ReadinessProbe generation in TestCreate.
    - topo/node/juniper/juniper_test.go, topo/node/sonic/sonic_test.go, topo/node/ciena/ciena_test.go: Verified
    container ReadinessProbe expectations in TestCreate.
    - topo/node/node_test.go: Added test coverage for ServiceReadinessProbe service matching and precedence.

The bridge subcommand sets up a daemon process that will forward
packets into / out of the KNE cluster over a gRPC streaming service.
An external client can use this service to inject or receive packets
to/from a particular interface defined in the topology.
This makes bridge usable in KNE-only situations, to link two separate
clusters (like if one cluster has access another doesn't.) More
importantly, it facilitates easy testing of the feature.
* use a pool for packet buffers
* use cancel so waiting goroutines are freed if readLoop exits on a
  socket error
* use signal.NotifyContext()
* Make sure kne bridge runs root handlers
* distinguish between normal and unexpected stream closure in the client
* Better test coverage
@kraney
kraney force-pushed the feat/packet-bridge branch from b16dcb0 to e6328da Compare September 8, 2026 21:19
@kraney
kraney requested review from bstoll and manizzzz September 11, 2026 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant