PCEP Library

The Go PCEP library in pkg/packet/pcep.

github.com/nttcom/pola/pkg/packet/pcep is a Go library for encoding and decoding PCEP messages. It has no third-party dependencies. The PCInitiate and PCUpd constructors use Pola’s table.SRPolicy type (pkg/table). The API reference is available on pkg.go.dev.

Layout

FileContents
message.goCommon header, PCEP messages (Open, Keepalive, PCErr, Close, PCRpt, PCInitiate, PCUpd), and their constructors.
object.goObjects (OPEN, SRP, LSP, ERO, ASSOCIATION, VENDOR-INFORMATION, and others), timer helpers, and PCC type detection.
tlv.goTLVs, including typed capability TLVs and unknown TLVs.
tlv_common.goLength, padding, and address helpers.
pcep_util.goByte-slice and bit-manipulation helpers.
capability.goCapabilityInterface, the capabilities Pola advertises (DefaultCapabilities), capability negotiation helpers, and FlattenCapabilities.
vendor.goEnterprise numbers (Cisco, Huawei, Juniper) and their names.
reference.goThe Reference type that maps code points to their RFC or draft.

Behavior

  • Capability TLVs in received Open messages are decoded into typed values. Unknown TLVs are preserved as unknown capabilities; other known TLVs are discarded.
  • DeterminePccType identifies legacy Cisco (0x14) and Juniper (0xffe1) peers from ASSOC-TYPE-LIST. Juniper takes precedence if both are present in the same TLV; all other cases are classified as standard (RFCCompliant).
  • NewPCInitiateMessage selects color and preference encoding based on VendorSpecific (PCC type) and SRPolicyAssociation (whether the SR Policy Association was negotiated). pkg/server sets these options as described in What Pola sends.
  • The COLOR TLV is sent only if both Pola and the peer advertise color capability and Pola does not advertise SR Policy Association capability (RFC 9863 Sections 1 and 2). It is never sent with DefaultCapabilities.
  • Vendor-specific ASSOCIATION types are accepted in received messages, but only the standard SR Policy Association is advertised.
Last modified November 20, 2026: docs: modernize documentation site (74dd3de)