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
| File | Contents |
|---|---|
message.go | Common header, PCEP messages (Open, Keepalive, PCErr, Close, PCRpt, PCInitiate, PCUpd), and their constructors. |
object.go | Objects (OPEN, SRP, LSP, ERO, ASSOCIATION, VENDOR-INFORMATION, and others), timer helpers, and PCC type detection. |
tlv.go | TLVs, including typed capability TLVs and unknown TLVs. |
tlv_common.go | Length, padding, and address helpers. |
pcep_util.go | Byte-slice and bit-manipulation helpers. |
capability.go | CapabilityInterface, the capabilities Pola advertises (DefaultCapabilities), capability negotiation helpers, and FlattenCapabilities. |
vendor.go | Enterprise numbers (Cisco, Huawei, Juniper) and their names. |
reference.go | The 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.
DeterminePccTypeidentifies 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).NewPCInitiateMessageselects color and preference encoding based onVendorSpecific(PCC type) andSRPolicyAssociation(whether the SR Policy Association was negotiated).pkg/serversets 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.