gRPC API

The PCEService gRPC API served by polad, its semantics, and its errors.

polad serves api.pola.v1.PCEService on global.grpcServer. See api/pola/v1/pola.proto for message and field definitions, pkg.go.dev for generated Go code, and the Go client example.

The API uses plaintext gRPC with no authentication. Expose it only on loopback or a trusted network.

RPCs

RPCDescription
CreateSRPolicySend PCUpd to a matching LSP if one exists; otherwise create the SR Policy with PCInitiate.
DeleteSRPolicyDelete a matching LSP with a PCInitiate carrying the R flag. Requires peer_addr, color, endpoint, and policy_name.
GetSessionListList PCEP sessions with state, timers, and capabilities. Message counters are included when include_stats is set.
GetSRPolicyListList the LSPs reported by each session.
GetTEDReturn the TED. When disabled, enabled is false. When enabled, the node list is empty until initial synchronization completes.
DeleteSessionSend a Close message to a PCEP session and remove it.

CreateSRPolicyRequest fields correspond to the CLI policy file, with the addition of no_sid_validate.

Semantics

  • CreateSRPolicy and DeleteSRPolicy return when the PCEP message is sent, not when the PCC processes it. Subsequent PCErr messages are not returned to the caller and are logged at debug level. Poll GetSRPolicyList to verify the result.
  • Both require the session to be up and LSP-DB synchronization to be complete.
  • An LSP matches by session, color, and endpoint. policy_name is not compared; it is used only as the symbolic name in the PCEP message. If multiple LSPs match, the selection is unspecified.
  • CreateSRPolicy resolves and validates the request against the current TED before looking up the session, so TED errors are reported before PCEP_SESSION_NOT_FOUND.
  • asn is required for the router-ID form and dynamic paths. For dynamic paths, it must match the TED’s AS number. endpoint_family is valid only for the router-ID form.
  • usidMode in polad.yaml applies to SRv6 segments in explicit segment lists; see SRv6.
  • LSP state is held in memory and is not persisted across polad restarts.
  • For v1 compatibility, SID-absent SR-MPLS segments use sid "0", and requests with sid_absent but no data_plane are treated as SR-MPLS. v2 will remove this compatibility behavior: sid must be empty and data_plane must be explicit.
  • DynamicPath.algorithm selects the IGP algorithm: 0 (default SPF) or 128-255 (Flexible Algorithms, RFC 9350). A Flex-Algo request must not set metric. LsNode.sr_algorithms and LsNode.flex_algo_defs expose the Flex-Algo information learned from BGP-LS, and LsLink.asla and LsLink.asla_malformed expose the application-specific link attributes. Optional ASLA metric fields (te_metric, delay, min_delay) distinguish an advertised 0 from an absent metric.

Errors

Failures are gRPC status errors with an ErrorInfo detail whose domain is pola and whose reason is one of:

gRPC codeReasons
InvalidArgumentINVALID_REQUEST
FailedPreconditionTED_DISABLED, TED_NOT_SYNCED, TED_DATA_INCOMPLETE, DESTINATION_UNREACHABLE, METRIC_NOT_CARRIED, PCEP_SESSION_NOT_SYNCED, SID_VALIDATION_FAILED, FLEX_ALGO_DEFINITION_NOT_FOUND, FLEX_ALGO_UNSUPPORTED, FLEX_ALGO_NOT_PARTICIPATING
NotFoundPCEP_SESSION_NOT_FOUND, SR_POLICY_NOT_FOUND
InternalPCEP_REQUEST_FAILED, PATH_COMPUTATION_FAILED

Troubleshooting lists typical causes for each reason.

To change the API, see Changing the gRPC API.

Last modified December 3, 2026: feat: add ASLA (34bd43d)