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
| RPC | Description |
|---|---|
CreateSRPolicy | Send PCUpd to a matching LSP if one exists; otherwise create the SR Policy with PCInitiate. |
DeleteSRPolicy | Delete a matching LSP with a PCInitiate carrying the R flag. Requires peer_addr, color, endpoint, and policy_name. |
GetSessionList | List PCEP sessions with state, timers, and capabilities. Message counters are included when include_stats is set. |
GetSRPolicyList | List the LSPs reported by each session. |
GetTED | Return the TED. When disabled, enabled is false. When enabled, the node list is empty until initial synchronization completes. |
DeleteSession | Send 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
CreateSRPolicyandDeleteSRPolicyreturn when the PCEP message is sent, not when the PCC processes it. Subsequent PCErr messages are not returned to the caller and are logged atdebuglevel. PollGetSRPolicyListto verify the result.- Both require the session to be
upand LSP-DB synchronization to be complete. - An LSP matches by session, color, and endpoint.
policy_nameis not compared; it is used only as the symbolic name in the PCEP message. If multiple LSPs match, the selection is unspecified. CreateSRPolicyresolves and validates the request against the current TED before looking up the session, so TED errors are reported beforePCEP_SESSION_NOT_FOUND.asnis required for the router-ID form and dynamic paths. For dynamic paths, it must match the TED’s AS number.endpoint_familyis valid only for the router-ID form.usidModeinpolad.yamlapplies to SRv6 segments in explicit segment lists; see SRv6.- LSP state is held in memory and is not persisted across
poladrestarts. - For v1 compatibility, SID-absent SR-MPLS segments use
sid"0", and requests withsid_absentbut nodata_planeare treated as SR-MPLS. v2 will remove this compatibility behavior:sidmust be empty anddata_planemust be explicit. DynamicPath.algorithmselects the IGP algorithm:0(default SPF) or128-255(Flexible Algorithms, RFC 9350). A Flex-Algo request must not setmetric.LsNode.sr_algorithmsandLsNode.flex_algo_defsexpose the Flex-Algo information learned from BGP-LS, andLsLink.aslaandLsLink.asla_malformedexpose the application-specific link attributes. Optional ASLA metric fields (te_metric,delay,min_delay) distinguish an advertised0from an absent metric.
Errors
Failures are gRPC status errors with an ErrorInfo detail whose domain is pola and whose reason is one of:
| gRPC code | Reasons |
|---|---|
InvalidArgument | INVALID_REQUEST |
FailedPrecondition | TED_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 |
NotFound | PCEP_SESSION_NOT_FOUND, SR_POLICY_NOT_FOUND |
Internal | PCEP_REQUEST_FAILED, PATH_COMPUTATION_FAILED |
Troubleshooting lists typical causes for each reason.
To change the API, see Changing the gRPC API.