From 4e1a077877bef3501d272d7435e2f41e2d1e3153 Mon Sep 17 00:00:00 2001
From: k1yoto
Date: Tue, 8 Apr 2025 12:13:12 +0000
Subject: [PATCH 01/87] fix(getLsNodeNLRI): add srCapabilies length in error
message
---
internal/pkg/gobgp/interface.go | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/internal/pkg/gobgp/interface.go b/internal/pkg/gobgp/interface.go
index 3867dbff..9d4153af 100644
--- a/internal/pkg/gobgp/interface.go
+++ b/internal/pkg/gobgp/interface.go
@@ -159,10 +159,11 @@ func getLsNodeNLRI(typedLinkStateNlri *api.LsNodeNLRI, pathAttrs []*anypb.Any) (
srCapabilities := bgplsAttr.GetNode().GetSrCapabilities().GetRanges()
if len(srCapabilities) != 1 {
- return nil, errors.New("invalid SR Capability TLV")
+ return nil, fmt.Errorf("expected 1 SR Capability TLV, got: %d", len(srCapabilities))
+ } else {
+ lsNode.SrgbBegin = srCapabilities[0].GetBegin()
+ lsNode.SrgbEnd = srCapabilities[0].GetEnd()
}
- lsNode.SrgbBegin = srCapabilities[0].GetBegin()
- lsNode.SrgbEnd = srCapabilities[0].GetEnd()
}
return lsNode, nil
From e6c159f11d2e029f6ffbf2d2be4e25f7cc2b154c Mon Sep 17 00:00:00 2001
From: Motok1
Date: Wed, 27 Aug 2025 15:12:39 +0900
Subject: [PATCH 02/87] feat(gobgp,ted): add LsSRv6SIDNLRI for BGP-LS as
defined in RFC9154
---
cmd/pola/ted.go | 11 ++++++
internal/pkg/gobgp/interface.go | 65 ++++++++++++++++++++++++++++++++-
internal/pkg/table/ted.go | 42 ++++++++++++++++++++-
3 files changed, 116 insertions(+), 2 deletions(-)
diff --git a/cmd/pola/ted.go b/cmd/pola/ted.go
index d8a4c4cc..fa20ffaf 100644
--- a/cmd/pola/ted.go
+++ b/cmd/pola/ted.go
@@ -86,6 +86,17 @@ func print(jsonFlag bool) error {
}
tmpNode["prefixes"] = prefixes
+ srv6SIDs := []map[string]interface{}{}
+ for _, srv6SID := range node.SRv6SIDs {
+ tmpSrv6SID := map[string]interface{}{
+ "sids": srv6SID.Sids,
+ "endpointBehavior": srv6SID.EndpointBehavior,
+ "multiTopoIDs": srv6SID.MultiTopoIDs,
+ }
+ srv6SIDs = append(srv6SIDs, tmpSrv6SID)
+ }
+ tmpNode["srv6SIDs"] = srv6SIDs
+
nodes = append(nodes, tmpNode)
}
}
diff --git a/internal/pkg/gobgp/interface.go b/internal/pkg/gobgp/interface.go
index 9d4153af..15713c16 100644
--- a/internal/pkg/gobgp/interface.go
+++ b/internal/pkg/gobgp/interface.go
@@ -72,7 +72,6 @@ func GetBgplsNlris(serverAddr string, serverPort string) ([]table.TedElem, error
}
return nil, fmt.Errorf("error receiving stream data: %v", err)
}
-
convertedElems, err := ConvertToTedElem(r.Destination)
if err != nil {
return nil, fmt.Errorf("failed to convert path to TED element: %v", err)
@@ -120,6 +119,15 @@ func ConvertToTedElem(dst *api.Destination) ([]table.TedElem, error) {
return nil, fmt.Errorf("failed to process LS Prefix V4 NLRI: %v", err)
}
return lsPrefixV4List, nil
+ case *api.LsSrv6SIDNLRI:
+ lsSrv6SIDList, err := getLsSrv6SIDNLRIList(linkStateNlri, path.GetPattrs())
+ if err != nil {
+ return nil, err
+ }
+ return lsSrv6SIDList, nil
+ // TODO: Implement LsPrefixV6NLRI handling
+ case *api.LsPrefixV6NLRI:
+ return nil, nil
default:
return nil, errors.New("invalid LS Link State NLRI type")
}
@@ -275,3 +283,58 @@ func getLsPrefixV4(lsNlri *api.LsAddrPrefix, sidIndex uint32) (*table.LsPrefixV4
return lsPrefixV4, nil
}
+
+func getLsSrv6SIDNLRIList(lsSRv6SIDNlri *api.LsSrv6SIDNLRI, pathAttrs []*anypb.Any) ([]table.TedElem, error) {
+ var lsSrv6SIDList []table.TedElem
+ var endpointBehavior uint32
+
+ for _, pathAttr := range pathAttrs {
+ typedPathAttr, err := pathAttr.UnmarshalNew()
+ if err != nil {
+ return nil, err
+ }
+
+ switch typedPathAttr := typedPathAttr.(type) {
+ case *api.SRv6EndPointBehavior:
+ endpointBehavior = uint32(typedPathAttr.GetBehavior())
+ case *api.MpReachNLRIAttribute:
+ for _, nlri := range typedPathAttr.GetNlris() {
+ typedNlri, err := nlri.UnmarshalNew()
+ if err != nil {
+ return nil, err
+ }
+ if lsNlri, ok := typedNlri.(*api.LsAddrPrefix); ok {
+ lsSrv6SID, err := getLsSrv6SIDNLRI(lsNlri, endpointBehavior)
+ if err != nil {
+ return nil, err
+ }
+ lsSrv6SIDList = append(lsSrv6SIDList, lsSrv6SID)
+ }
+ }
+ }
+ }
+ return lsSrv6SIDList, nil
+}
+
+func getLsSrv6SIDNLRI(lsNlri *api.LsAddrPrefix, endpointBehavior uint32) (*table.LsSrv6SID, error) {
+ srv6Nlri, err := lsNlri.GetNlri().UnmarshalNew()
+ if err != nil {
+ return nil, err
+ }
+ srv6SIDNlri, ok := srv6Nlri.(*api.LsSrv6SIDNLRI)
+ if !ok {
+ return nil, errors.New("invalid LS SRv6 SID NLRI type")
+ }
+ localNodeID := srv6SIDNlri.GetLocalNode().GetIgpRouterId()
+ localNodeAsn := srv6SIDNlri.GetLocalNode().GetAsn()
+ srv6SIDs := srv6SIDNlri.GetSrv6SidInformation().GetSids()
+ multiTopoIDs := srv6SIDNlri.GetMultiTopoId().GetMultiTopoIds()
+
+ localNode := table.NewLsNode(localNodeAsn, localNodeID)
+ lsSrv6SID := table.NewLsSrv6SID(localNode)
+ lsSrv6SID.EndpointBehavior = endpointBehavior
+ lsSrv6SID.Sids = srv6SIDs
+ lsSrv6SID.MultiTopoIDs = multiTopoIDs
+
+ return lsSrv6SID, nil
+}
diff --git a/internal/pkg/table/ted.go b/internal/pkg/table/ted.go
index da278ea8..c84eee0f 100644
--- a/internal/pkg/table/ted.go
+++ b/internal/pkg/table/ted.go
@@ -39,7 +39,6 @@ func (ted *LsTed) Print() {
fmt.Printf(" index: %d\n", prefix.SidIndex)
}
}
-
fmt.Printf(" Links:\n")
for _, link := range node.Links {
fmt.Printf(" Local: %s Remote: %s\n", link.LocalIP.String(), link.RemoteIP.String())
@@ -50,6 +49,13 @@ func (ted *LsTed) Print() {
}
fmt.Printf(" Adj-SID: %d\n", link.AdjSid)
}
+ fmt.Printf(" SRv6 SIDs:\n")
+ for _, srv6SID := range node.SRv6SIDs {
+ fmt.Printf(" SIDs: %v\n", srv6SID.Sids)
+ fmt.Printf(" EndpointBehavior: %d\n", srv6SID.EndpointBehavior)
+ fmt.Printf(" MultiTopoIDs: %v\n", srv6SID.MultiTopoIDs)
+ }
+
nodeCnt++
fmt.Printf("\n")
}
@@ -69,6 +75,7 @@ type LsNode struct {
SrgbEnd uint32 // in BGP-LS Attr
Links []*LsLink
Prefixes []*LsPrefixV4
+ SRv6SIDs []*LsSrv6SID
}
func NewLsNode(asn uint32, nodeID string) *LsNode {
@@ -205,6 +212,39 @@ func (lp *LsPrefixV4) UpdateTed(ted *LsTed) {
localNode.Prefixes = append(localNode.Prefixes, lp)
}
+type LsSrv6SID struct {
+ LocalNode *LsNode // primary key, in MP_REACH_NLRI Attr
+ Sids []string // in LsSrv6SID Attr
+ EndpointBehavior uint32 // in srv6EndpointBehavior Attr
+ MultiTopoIDs []uint32 // in LsSrv6SID Attr
+}
+
+func NewLsSrv6SID(node *LsNode) *LsSrv6SID {
+ return &LsSrv6SID{
+ LocalNode: node,
+ }
+}
+
+func (s *LsSrv6SID) UpdateTed(ted *LsTed) {
+ nodes, asn := ted.Nodes, s.LocalNode.Asn
+
+ if _, ok := nodes[asn]; !ok {
+ nodes[asn] = make(map[string]*LsNode)
+ }
+
+ if _, ok := nodes[asn][s.LocalNode.RouterID]; !ok {
+ nodes[asn][s.LocalNode.RouterID] = NewLsNode(s.LocalNode.Asn, s.LocalNode.RouterID)
+ }
+
+ s.LocalNode = nodes[asn][s.LocalNode.RouterID]
+
+ s.LocalNode.AddSrv6SID(s)
+}
+
+func (n *LsNode) AddSrv6SID(s *LsSrv6SID) {
+ n.SRv6SIDs = append(n.SRv6SIDs, s)
+}
+
type Metric struct {
Type MetricType
Value uint32
From b34d5a5299cbc3f897c10b2281baca62a0b270fa Mon Sep 17 00:00:00 2001
From: watal
Date: Thu, 10 Apr 2025 17:34:20 +0900
Subject: [PATCH 03/87] refactor(gobgp): remove redundant argument and struct
---
internal/pkg/gobgp/interface.go | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/internal/pkg/gobgp/interface.go b/internal/pkg/gobgp/interface.go
index 15713c16..9609138a 100644
--- a/internal/pkg/gobgp/interface.go
+++ b/internal/pkg/gobgp/interface.go
@@ -22,11 +22,6 @@ import (
"google.golang.org/protobuf/types/known/anypb"
)
-type GobgpOptions struct {
- GobgpAddr string
- GobgpPort string
-}
-
func GetBgplsNlris(serverAddr string, serverPort string) ([]table.TedElem, error) {
gobgpAddress := serverAddr + ":" + serverPort
@@ -120,7 +115,7 @@ func ConvertToTedElem(dst *api.Destination) ([]table.TedElem, error) {
}
return lsPrefixV4List, nil
case *api.LsSrv6SIDNLRI:
- lsSrv6SIDList, err := getLsSrv6SIDNLRIList(linkStateNlri, path.GetPattrs())
+ lsSrv6SIDList, err := getLsSrv6SIDNLRIList(path.GetPattrs())
if err != nil {
return nil, err
}
@@ -284,7 +279,7 @@ func getLsPrefixV4(lsNlri *api.LsAddrPrefix, sidIndex uint32) (*table.LsPrefixV4
return lsPrefixV4, nil
}
-func getLsSrv6SIDNLRIList(lsSRv6SIDNlri *api.LsSrv6SIDNLRI, pathAttrs []*anypb.Any) ([]table.TedElem, error) {
+func getLsSrv6SIDNLRIList(pathAttrs []*anypb.Any) ([]table.TedElem, error) {
var lsSrv6SIDList []table.TedElem
var endpointBehavior uint32
From 4385f853bc8d00c5a746bb7c473b6bc8e251d18e Mon Sep 17 00:00:00 2001
From: watal
Date: Fri, 11 Apr 2025 17:38:31 +0900
Subject: [PATCH 04/87] refactor(gobgp): simplify address format and comment
---
internal/pkg/gobgp/interface.go | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/internal/pkg/gobgp/interface.go b/internal/pkg/gobgp/interface.go
index 9609138a..bcdd9fc9 100644
--- a/internal/pkg/gobgp/interface.go
+++ b/internal/pkg/gobgp/interface.go
@@ -23,9 +23,9 @@ import (
)
func GetBgplsNlris(serverAddr string, serverPort string) ([]table.TedElem, error) {
- gobgpAddress := serverAddr + ":" + serverPort
+ gobgpAddress := fmt.Sprintf("%s:%s", serverAddr, serverPort)
- // Get connection
+ // Establish gRPC connection
cc, err := grpc.NewClient(
gobgpAddress,
grpc.WithTransportCredentials(insecure.NewCredentials()),
@@ -120,9 +120,8 @@ func ConvertToTedElem(dst *api.Destination) ([]table.TedElem, error) {
return nil, err
}
return lsSrv6SIDList, nil
- // TODO: Implement LsPrefixV6NLRI handling
case *api.LsPrefixV6NLRI:
- return nil, nil
+ return nil, nil // TODO: Implement LsPrefixV6NLRI handling
default:
return nil, errors.New("invalid LS Link State NLRI type")
}
From 1690050daf8aa0caa53173af1d9707c158c478dd Mon Sep 17 00:00:00 2001
From: Motok1
Date: Thu, 28 Aug 2025 02:38:23 +0900
Subject: [PATCH 05/87] refactor(gobgp): improve error wrapping and context
---
internal/pkg/gobgp/interface.go | 64 ++++++++++++++++++---------------
1 file changed, 35 insertions(+), 29 deletions(-)
diff --git a/internal/pkg/gobgp/interface.go b/internal/pkg/gobgp/interface.go
index bcdd9fc9..bb831ed2 100644
--- a/internal/pkg/gobgp/interface.go
+++ b/internal/pkg/gobgp/interface.go
@@ -31,11 +31,11 @@ func GetBgplsNlris(serverAddr string, serverPort string) ([]table.TedElem, error
grpc.WithTransportCredentials(insecure.NewCredentials()),
)
if err != nil {
- return nil, fmt.Errorf("failed to create gRPC client: %v", err)
+ return nil, fmt.Errorf("failed to create gRPC client (address: %s): %w", gobgpAddress, err)
}
defer func() {
if err := cc.Close(); err != nil {
- fmt.Fprintf(os.Stderr, "warning: failed to close gRPC client connection: %v\n", err)
+ fmt.Fprintf(os.Stderr, "failed to close gRPC client connection: %v\n", err)
}
}()
@@ -55,7 +55,7 @@ func GetBgplsNlris(serverAddr string, serverPort string) ([]table.TedElem, error
stream, err := client.ListPath(ctx, req)
if err != nil {
- return nil, fmt.Errorf("failed to retrieve paths: %v", err)
+ return nil, fmt.Errorf("failed to retrieve paths from gRPC server: %w", err)
}
var tedElems []table.TedElem
@@ -65,15 +65,17 @@ func GetBgplsNlris(serverAddr string, serverPort string) ([]table.TedElem, error
if err == io.EOF {
break
}
- return nil, fmt.Errorf("error receiving stream data: %v", err)
+ return nil, fmt.Errorf("error receiving stream data: %w", err)
}
+
convertedElems, err := ConvertToTedElem(r.Destination)
if err != nil {
- return nil, fmt.Errorf("failed to convert path to TED element: %v", err)
+ return nil, fmt.Errorf("failed to convert path to TED element (destination: %v): %w", r.Destination, err)
}
tedElems = append(tedElems, convertedElems...)
}
+
return tedElems, nil
}
@@ -85,48 +87,48 @@ func ConvertToTedElem(dst *api.Destination) ([]table.TedElem, error) {
path := dst.GetPaths()[0]
nlri, err := path.GetNlri().UnmarshalNew()
if err != nil {
- return nil, fmt.Errorf("failed to unmarshal NLRI: %v", err)
+ return nil, fmt.Errorf("failed to unmarshal NLRI: %w", err)
}
switch nlri := nlri.(type) {
case *api.LsAddrPrefix:
linkStateNlri, err := nlri.GetNlri().UnmarshalNew()
if err != nil {
- return nil, fmt.Errorf("failed to unmarshal LS Address Prefix: %v", err)
+ return nil, fmt.Errorf("failed to unmarshal LS Address Prefix: %w", err)
}
switch linkStateNlri := linkStateNlri.(type) {
case *api.LsNodeNLRI:
lsNode, err := getLsNodeNLRI(linkStateNlri, path.GetPattrs())
if err != nil {
- return nil, fmt.Errorf("failed to process LS Node NLRI: %v", err)
+ return nil, fmt.Errorf("failed to process LS Node NLRI: %w", err)
}
return []table.TedElem{lsNode}, nil
case *api.LsLinkNLRI:
lsLink, err := getLsLinkNLRI(linkStateNlri, path.GetPattrs())
if err != nil {
- return nil, fmt.Errorf("failed to process LS Link NLRI: %v", err)
+ return nil, fmt.Errorf("failed to process LS Link NLRI: %w", err)
}
return []table.TedElem{lsLink}, nil
case *api.LsPrefixV4NLRI:
lsPrefixV4List, err := getLsPrefixV4List(path.GetPattrs())
if err != nil {
- return nil, fmt.Errorf("failed to process LS Prefix V4 NLRI: %v", err)
+ return nil, fmt.Errorf("failed to process LS Prefix V4 NLRI: %w", err)
}
return lsPrefixV4List, nil
case *api.LsSrv6SIDNLRI:
lsSrv6SIDList, err := getLsSrv6SIDNLRIList(path.GetPattrs())
if err != nil {
- return nil, err
+ return nil, fmt.Errorf("failed to process LS SRv6 SID NLRI: %w", err)
}
return lsSrv6SIDList, nil
case *api.LsPrefixV6NLRI:
return nil, nil // TODO: Implement LsPrefixV6NLRI handling
default:
- return nil, errors.New("invalid LS Link State NLRI type")
+ return nil, fmt.Errorf("invalid LS Link State NLRI type: %T", linkStateNlri)
}
default:
- return nil, errors.New("invalid NLRI type")
+ return nil, fmt.Errorf("invalid NLRI type: %T", nlri)
}
}
@@ -139,7 +141,7 @@ func getLsNodeNLRI(typedLinkStateNlri *api.LsNodeNLRI, pathAttrs []*anypb.Any) (
for _, pathAttr := range pathAttrs {
typedPathAttr, err := pathAttr.UnmarshalNew()
if err != nil {
- return nil, fmt.Errorf("failed to unmarshal path attribute: %v", err)
+ return nil, fmt.Errorf("failed to unmarshal path attribute: %w", err)
}
bgplsAttr, ok := typedPathAttr.(*api.LsAttribute)
@@ -177,12 +179,12 @@ func getLsLinkNLRI(typedLinkStateNlri *api.LsLinkNLRI, pathAttrs []*anypb.Any) (
localIP, err := netip.ParseAddr(typedLinkStateNlri.GetLinkDescriptor().GetInterfaceAddrIpv4())
if err != nil {
- return nil, fmt.Errorf("failed to parse local IP address: %v", err)
+ return nil, fmt.Errorf("failed to parse local IP address %q: %v", typedLinkStateNlri.GetLinkDescriptor().GetInterfaceAddrIpv4(), err)
}
remoteIP, err := netip.ParseAddr(typedLinkStateNlri.GetLinkDescriptor().GetNeighborAddrIpv4())
if err != nil {
- return nil, fmt.Errorf("failed to parse remote IP address: %v", err)
+ return nil, fmt.Errorf("failed to parse remote IP address %q: %v", typedLinkStateNlri.GetLinkDescriptor().GetNeighborAddrIpv4(), err)
}
lsLink := table.NewLsLink(localNode, remoteNode)
@@ -192,7 +194,7 @@ func getLsLinkNLRI(typedLinkStateNlri *api.LsLinkNLRI, pathAttrs []*anypb.Any) (
for _, pathAttr := range pathAttrs {
typedPathAttr, err := pathAttr.UnmarshalNew()
if err != nil {
- return nil, fmt.Errorf("failed to unmarshal path attribute: %v", err)
+ return nil, fmt.Errorf("failed to unmarshal path attribute %v: %v", pathAttr, err)
}
bgplsAttr, ok := typedPathAttr.(*api.LsAttribute)
@@ -220,7 +222,7 @@ func getLsPrefixV4List(pathAttrs []*anypb.Any) ([]table.TedElem, error) {
for _, pathAttr := range pathAttrs {
typedPathAttr, err := pathAttr.UnmarshalNew()
if err != nil {
- return nil, fmt.Errorf("failed to unmarshal path attribute: %v", err)
+ return nil, fmt.Errorf("failed to unmarshal path attribute: %w", err)
}
switch typedPathAttr := typedPathAttr.(type) {
@@ -231,15 +233,17 @@ func getLsPrefixV4List(pathAttrs []*anypb.Any) ([]table.TedElem, error) {
for _, nlri := range typedPathAttr.GetNlris() {
typedNlri, err := nlri.UnmarshalNew()
if err != nil {
- return nil, fmt.Errorf("failed to unmarshal NLRI: %v", err)
+ return nil, fmt.Errorf("failed to unmarshal NLRI: %w", err)
}
if lsNlri, ok := typedNlri.(*api.LsAddrPrefix); ok {
lsPrefixV4, err := getLsPrefixV4(lsNlri, sidIndex)
if err != nil {
- return nil, fmt.Errorf("failed to get LS Prefix V4: %v", err)
+ return nil, fmt.Errorf("failed to get LS Prefix V4: %w", err)
}
lsPrefixV4List = append(lsPrefixV4List, lsPrefixV4)
+ } else {
+ return nil, fmt.Errorf("unexpected NLRI type: %T", typedNlri)
}
}
}
@@ -251,11 +255,11 @@ func getLsPrefixV4List(pathAttrs []*anypb.Any) ([]table.TedElem, error) {
func getLsPrefixV4(lsNlri *api.LsAddrPrefix, sidIndex uint32) (*table.LsPrefixV4, error) {
prefNlri, err := lsNlri.GetNlri().UnmarshalNew()
if err != nil {
- return nil, fmt.Errorf("failed to unmarshal LS Prefix V4: %v", err)
+ return nil, fmt.Errorf("failed to unmarshal LS Prefix V4: %w", err)
}
prefv4Nlri, ok := prefNlri.(*api.LsPrefixV4NLRI)
if !ok {
- return nil, errors.New("invalid LS prefix v4 NLRI type")
+ return nil, fmt.Errorf("invalid LS prefix v4 NLRI type: %T", prefNlri)
}
localNodeID := prefv4Nlri.GetLocalNode().GetIgpRouterId()
@@ -267,12 +271,12 @@ func getLsPrefixV4(lsNlri *api.LsAddrPrefix, sidIndex uint32) (*table.LsPrefixV4
lsPrefixV4.SidIndex = sidIndex
if len(prefixV4) != 1 {
- return nil, errors.New("invalid prefix length: expected 1 prefix")
+ return nil, fmt.Errorf("invalid prefix length: expected 1, got %d", len(prefixV4))
}
lsPrefixV4.Prefix, err = netip.ParsePrefix(prefixV4[0])
if err != nil {
- return nil, fmt.Errorf("failed to parse prefix: %v", err)
+ return nil, fmt.Errorf("failed to parse prefix %q: %w", prefixV4[0], err)
}
return lsPrefixV4, nil
@@ -285,7 +289,7 @@ func getLsSrv6SIDNLRIList(pathAttrs []*anypb.Any) ([]table.TedElem, error) {
for _, pathAttr := range pathAttrs {
typedPathAttr, err := pathAttr.UnmarshalNew()
if err != nil {
- return nil, err
+ return nil, fmt.Errorf("failed to unmarshal path attribute: %w", err)
}
switch typedPathAttr := typedPathAttr.(type) {
@@ -295,14 +299,16 @@ func getLsSrv6SIDNLRIList(pathAttrs []*anypb.Any) ([]table.TedElem, error) {
for _, nlri := range typedPathAttr.GetNlris() {
typedNlri, err := nlri.UnmarshalNew()
if err != nil {
- return nil, err
+ return nil, fmt.Errorf("failed to unmarshal NLRI: %w", err)
}
if lsNlri, ok := typedNlri.(*api.LsAddrPrefix); ok {
lsSrv6SID, err := getLsSrv6SIDNLRI(lsNlri, endpointBehavior)
if err != nil {
- return nil, err
+ return nil, fmt.Errorf("failed to process LS SRv6 SID NLRI: %w", err)
}
lsSrv6SIDList = append(lsSrv6SIDList, lsSrv6SID)
+ } else {
+ return nil, fmt.Errorf("unexpected NLRI type: %T", typedNlri)
}
}
}
@@ -313,11 +319,11 @@ func getLsSrv6SIDNLRIList(pathAttrs []*anypb.Any) ([]table.TedElem, error) {
func getLsSrv6SIDNLRI(lsNlri *api.LsAddrPrefix, endpointBehavior uint32) (*table.LsSrv6SID, error) {
srv6Nlri, err := lsNlri.GetNlri().UnmarshalNew()
if err != nil {
- return nil, err
+ return nil, fmt.Errorf("failed to unmarshal LS NLRI: %w", err)
}
srv6SIDNlri, ok := srv6Nlri.(*api.LsSrv6SIDNLRI)
if !ok {
- return nil, errors.New("invalid LS SRv6 SID NLRI type")
+ return nil, fmt.Errorf("invalid LS SRv6 SID NLRI type: %T", srv6Nlri)
}
localNodeID := srv6SIDNlri.GetLocalNode().GetIgpRouterId()
localNodeAsn := srv6SIDNlri.GetLocalNode().GetAsn()
From 40d49ada33c4b9ad17d4d5f43a44f9b93c4381db Mon Sep 17 00:00:00 2001
From: watal
Date: Fri, 11 Apr 2025 17:44:54 +0900
Subject: [PATCH 06/87] refactor(gobgp) use context.WithCancel to prepare for
future cancellation support
---
internal/pkg/gobgp/interface.go | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/internal/pkg/gobgp/interface.go b/internal/pkg/gobgp/interface.go
index bb831ed2..6522eed2 100644
--- a/internal/pkg/gobgp/interface.go
+++ b/internal/pkg/gobgp/interface.go
@@ -41,7 +41,8 @@ func GetBgplsNlris(serverAddr string, serverPort string) ([]table.TedElem, error
// Create gRPC client
client := api.NewGobgpApiClient(cc)
- ctx := context.Background()
+ ctx, cancel := context.WithCancel(context.Background())
+ defer cancel()
req := &api.ListPathRequest{
TableType: api.TableType_GLOBAL,
From a64011ce3c8fe883f485afa46c4d3c68a7477176 Mon Sep 17 00:00:00 2001
From: watal
Date: Fri, 11 Apr 2025 17:45:54 +0900
Subject: [PATCH 07/87] refactor(gobgp): ISIS Area ID formatting into helper
function
---
internal/pkg/gobgp/interface.go | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/internal/pkg/gobgp/interface.go b/internal/pkg/gobgp/interface.go
index 6522eed2..f2acf3d0 100644
--- a/internal/pkg/gobgp/interface.go
+++ b/internal/pkg/gobgp/interface.go
@@ -133,6 +133,19 @@ func ConvertToTedElem(dst *api.Destination) ([]table.TedElem, error) {
}
}
+// formatIsisAreaID formats the ISIS Area ID into a human-readable string.
+func formatIsisAreaID(isisArea []byte) string {
+ tmpIsisArea := hex.EncodeToString(isisArea)
+ var strIsisArea strings.Builder
+ for i, s := range strings.Split(tmpIsisArea, "") {
+ if (len(tmpIsisArea)-i)%4 == 0 && i != 0 {
+ strIsisArea.WriteString(".")
+ }
+ strIsisArea.WriteString(s)
+ }
+ return strIsisArea.String()
+}
+
func getLsNodeNLRI(typedLinkStateNlri *api.LsNodeNLRI, pathAttrs []*anypb.Any) (*table.LsNode, error) {
asn := typedLinkStateNlri.GetLocalNode().GetAsn()
routerID := typedLinkStateNlri.GetLocalNode().GetIgpRouterId()
@@ -151,24 +164,14 @@ func getLsNodeNLRI(typedLinkStateNlri *api.LsNodeNLRI, pathAttrs []*anypb.Any) (
}
isisArea := bgplsAttr.GetNode().GetIsisArea()
- tmpIsisArea := hex.EncodeToString(isisArea)
- strIsisArea := ""
- for i, s := range strings.Split(tmpIsisArea, "") {
- if (len(tmpIsisArea)-i)%4 == 0 {
- strIsisArea += "."
- }
- strIsisArea += s
- }
- lsNode.IsisAreaID = strIsisArea
+ lsNode.IsisAreaID = formatIsisAreaID(isisArea)
lsNode.Hostname = bgplsAttr.GetNode().GetName()
-
srCapabilities := bgplsAttr.GetNode().GetSrCapabilities().GetRanges()
if len(srCapabilities) != 1 {
return nil, fmt.Errorf("expected 1 SR Capability TLV, got: %d", len(srCapabilities))
- } else {
- lsNode.SrgbBegin = srCapabilities[0].GetBegin()
- lsNode.SrgbEnd = srCapabilities[0].GetEnd()
}
+ lsNode.SrgbBegin = srCapabilities[0].GetBegin()
+ lsNode.SrgbEnd = srCapabilities[0].GetEnd()
}
return lsNode, nil
From 14b8c63521510416cd9dec8ba461b34ca02cefe9 Mon Sep 17 00:00:00 2001
From: watal
Date: Mon, 7 Apr 2025 12:30:21 +0900
Subject: [PATCH 08/87] refactor(pcep): rename const/variable to follow Go
naming conventions and reorder functions
---
internal/pkg/table/sr_policy.go | 8 +-
pkg/packet/pcep/capability.go | 14 +-
pkg/packet/pcep/message.go | 213 +++++----
pkg/packet/pcep/object.go | 757 +++++++++++++++++++-------------
pkg/packet/pcep/tlv.go | 581 ++++++++++++++----------
pkg/server/grpc_server.go | 17 +-
pkg/server/session.go | 72 +--
7 files changed, 994 insertions(+), 668 deletions(-)
diff --git a/internal/pkg/table/sr_policy.go b/internal/pkg/table/sr_policy.go
index dd02a3c1..17f7898f 100644
--- a/internal/pkg/table/sr_policy.go
+++ b/internal/pkg/table/sr_policy.go
@@ -29,7 +29,7 @@ type SRPolicy struct {
DstAddr netip.Addr
Color uint32
Preference uint32
- LspID uint16
+ LSPID uint16
State PolicyState
}
@@ -52,7 +52,7 @@ func NewSRPolicy(
DstAddr: dstAddr,
Color: color,
Preference: preference,
- LspID: lspID,
+ LSPID: lspID,
State: state,
}
@@ -65,13 +65,13 @@ type PolicyDiff struct {
Color *uint32
Preference *uint32
SegmentList []Segment
- LspID uint16
+ LSPID uint16
State PolicyState
}
func (p *SRPolicy) Update(df PolicyDiff) {
p.State = df.State
- p.LspID = df.LspID
+ p.LSPID = df.LSPID
if df.Name != nil {
p.Name = *df.Name
}
diff --git a/pkg/packet/pcep/capability.go b/pkg/packet/pcep/capability.go
index aad3ffd4..b948021d 100644
--- a/pkg/packet/pcep/capability.go
+++ b/pkg/packet/pcep/capability.go
@@ -16,17 +16,17 @@ func PolaCapability(caps []CapabilityInterface) []CapabilityInterface {
switch tlv := cap.(type) {
case *StatefulPceCapability:
tlv = &StatefulPceCapability{
- LspUpdateCapability: true,
+ LSPUpdateCapability: true,
IncludeDBVersion: false,
- LspInstantiationCapability: true,
+ LSPInstantiationCapability: true,
TriggeredResync: false,
- DeltaLspSyncCapability: false,
+ DeltaLSPSyncCapability: false,
TriggeredInitialSync: false,
P2mpCapability: false,
- P2mpLspUpdateCapability: false,
- P2mpLspInstantiationCapability: false,
- LspSchedulingCapability: false,
- PdLspCapability: false,
+ P2mpLSPUpdateCapability: false,
+ P2mpLSPInstantiationCapability: false,
+ LSPSchedulingCapability: false,
+ PdLSPCapability: false,
ColorCapability: true,
PathRecomputationCapability: false,
StrictPathCapability: false,
diff --git a/pkg/packet/pcep/message.go b/pkg/packet/pcep/message.go
index 21efd114..c81888c0 100644
--- a/pkg/packet/pcep/message.go
+++ b/pkg/packet/pcep/message.go
@@ -14,37 +14,72 @@ import (
"github.com/nttcom/pola/internal/pkg/table"
)
-const COMMON_HEADER_LENGTH uint16 = 4
-
-const ( // PCEP Message-Type (1byte)
- MT_RESERVED uint8 = 0x00 // RFC5440
- MT_OPEN uint8 = 0x01 // RFC5440
- MT_KEEPALIVE uint8 = 0x02 // RFC5440
- MT_PCREQ uint8 = 0x03 // RFC5440
- MT_PCREP uint8 = 0x04 // RFC5440
- MT_NOTIFICATION uint8 = 0x05 // RFC5440
- MT_ERROR uint8 = 0x06 // RFC5440
- MT_CLOSE uint8 = 0x07 // RFC5440
- MT_PCMONREQ uint8 = 0x08 // RFC5886
- MT_PCMONREP uint8 = 0x09 // RFC5886
- MT_REPORT uint8 = 0x0a // RFC8231
- MT_UPDATE uint8 = 0x0b // RFC8281
- MT_LSPINITREQ uint8 = 0x0c // RFC8281
- MT_STARTTLS uint8 = 0x0d // RFC8253
+const CommonHeaderLength uint16 = 4
+
+// PCEP Message-Type (1 byte)
+type MessageType uint8
+
+const (
+ MessageTypeOpen MessageType = 0x01
+ MessageTypeKeepalive MessageType = 0x02
+ MessageTypePcreq MessageType = 0x03
+ MessageTypePcrep MessageType = 0x04
+ MessageTypeNotification MessageType = 0x05
+ MessageTypeError MessageType = 0x06
+ MessageTypeClose MessageType = 0x07
+ MessageTypePcmReq MessageType = 0x08
+ MessageTypePcmRep MessageType = 0x09
+ MessageTypeReport MessageType = 0x0a
+ MessageTypeUpdate MessageType = 0x0b
+ MessageTypeLSPInitReq MessageType = 0x0c
+ MessageTypeStartTLS MessageType = 0x0d
)
+var messageTypeDescriptions = map[MessageType]struct {
+ Description string
+ Reference string
+}{
+ MessageTypeOpen: {"Open", "RFC5440"},
+ MessageTypeKeepalive: {"Keepalive", "RFC5440"},
+ MessageTypePcreq: {"Path Computation Request", "RFC5440"},
+ MessageTypePcrep: {"Path Computation Reply", "RFC5440"},
+ MessageTypeNotification: {"Notification", "RFC5440"},
+ MessageTypeError: {"Error", "RFC5440"},
+ MessageTypeClose: {"Close", "RFC5440"},
+ MessageTypePcmReq: {"Path Computation Monitoring Request", "RFC5886"},
+ MessageTypePcmRep: {"Path Computation Monitoring Reply", "RFC5886"},
+ MessageTypeReport: {"Report", "RFC8231"},
+ MessageTypeUpdate: {"Update", "RFC8281"},
+ MessageTypeLSPInitReq: {"LSP Initiate Request", "RFC8281"},
+ MessageTypeStartTLS: {"StartTLS", "RFC8253"},
+}
+
+func (t MessageType) String() string {
+ if desc, ok := messageTypeDescriptions[t]; ok {
+ return fmt.Sprintf("%s (0x%02x)", desc.Description, uint8(t))
+ }
+ return fmt.Sprintf("Unknown MessageType (0x%02x)", uint8(t))
+}
+
+func (t MessageType) StringWithReference() string {
+ if desc, ok := messageTypeDescriptions[t]; ok {
+ return fmt.Sprintf("%s (0x%02x) [%s]", desc.Description, uint8(t), desc.Reference)
+ }
+ return fmt.Sprintf("Unknown MessageType (0x%02x)", uint8(t))
+}
+
// Common header of PCEP Message
type CommonHeader struct { // RFC5440 6.1
Version uint8 // Current version is 1
Flag uint8
- MessageType uint8
+ MessageType MessageType
MessageLength uint16
}
func (h *CommonHeader) DecodeFromBytes(header []uint8) error {
h.Version = uint8(header[0] >> 5)
h.Flag = uint8(header[0] & 0x1f)
- h.MessageType = uint8(header[1])
+ h.MessageType = MessageType(header[1])
h.MessageLength = binary.BigEndian.Uint16(header[2:4])
return nil
}
@@ -53,14 +88,14 @@ func (h *CommonHeader) Serialize() []uint8 {
buf := make([]uint8, 0, 4)
verFlag := uint8(h.Version<<5 | h.Flag)
buf = append(buf, verFlag)
- buf = append(buf, h.MessageType)
+ buf = append(buf, uint8(h.MessageType))
messageLength := make([]uint8, 2)
binary.BigEndian.PutUint16(messageLength, h.MessageLength)
buf = append(buf, messageLength...)
return buf
}
-func NewCommonHeader(messageType uint8, messageLength uint16) *CommonHeader {
+func NewCommonHeader(messageType MessageType, messageLength uint16) *CommonHeader {
h := &CommonHeader{
Version: uint8(1),
Flag: uint8(0),
@@ -82,20 +117,19 @@ type OpenMessage struct {
func (m *OpenMessage) DecodeFromBytes(messageBody []uint8) error {
var commonObjectHeader CommonObjectHeader
if err := commonObjectHeader.DecodeFromBytes(messageBody); err != nil {
- return err
+ return fmt.Errorf("failed to decode common object header: %w", err)
}
- if commonObjectHeader.ObjectClass != OC_OPEN {
+ if commonObjectHeader.ObjectClass != ObjectClassOpen {
return fmt.Errorf("unsupported ObjectClass: %d", commonObjectHeader.ObjectClass)
}
- if commonObjectHeader.ObjectType != OT_OPEN_OPEN {
+ if commonObjectHeader.ObjectType != ObjectTypeOpenOpen {
return fmt.Errorf("unsupported ObjectType: %d", commonObjectHeader.ObjectType)
}
openObject := &OpenObject{}
- err := openObject.DecodeFromBytes(commonObjectHeader.ObjectType, messageBody[COMMON_OBJECT_HEADER_LENGTH:commonObjectHeader.ObjectLength])
- if err != nil {
- return err
+ if err := openObject.DecodeFromBytes(commonObjectHeader.ObjectType, messageBody[commonObjectHeaderLength:commonObjectHeader.ObjectLength]); err != nil {
+ return fmt.Errorf("failed to decode OpenObject: %w", err)
}
m.OpenObject = openObject
@@ -104,8 +138,8 @@ func (m *OpenMessage) DecodeFromBytes(messageBody []uint8) error {
func (m *OpenMessage) Serialize() ([]uint8, error) {
byteOpenObject := m.OpenObject.Serialize()
- openMessageLength := COMMON_HEADER_LENGTH + m.OpenObject.Len()
- openHeader := NewCommonHeader(MT_OPEN, openMessageLength)
+ openMessageLength := CommonHeaderLength + m.OpenObject.Len()
+ openHeader := NewCommonHeader(MessageTypeOpen, openMessageLength)
byteOpenHeader := openHeader.Serialize()
byteOpenMessage := AppendByteSlices(byteOpenHeader, byteOpenObject)
return byteOpenMessage, nil
@@ -127,8 +161,8 @@ type KeepaliveMessage struct {
}
func (m *KeepaliveMessage) Serialize() ([]uint8, error) {
- keepaliveMessageLength := COMMON_HEADER_LENGTH
- keepaliveHeader := NewCommonHeader(MT_KEEPALIVE, keepaliveMessageLength)
+ keepaliveMessageLength := CommonHeaderLength
+ keepaliveHeader := NewCommonHeader(MessageTypeKeepalive, keepaliveMessageLength)
byteKeepaliveHeader := keepaliveHeader.Serialize()
byteKeepaliveMessage := byteKeepaliveHeader
return byteKeepaliveMessage, nil
@@ -150,7 +184,7 @@ func (m *PCErrMessage) DecodeFromBytes(messageBody []uint8) error {
return err
}
pcepErrorObject := &PcepErrorObject{}
- if err := pcepErrorObject.DecodeFromBytes(commonObjectHeader.ObjectType, messageBody[COMMON_OBJECT_HEADER_LENGTH:commonObjectHeader.ObjectLength]); err != nil {
+ if err := pcepErrorObject.DecodeFromBytes(commonObjectHeader.ObjectType, messageBody[commonObjectHeaderLength:commonObjectHeader.ObjectLength]); err != nil {
return err
}
m.PcepErrorObject = pcepErrorObject
@@ -158,8 +192,8 @@ func (m *PCErrMessage) DecodeFromBytes(messageBody []uint8) error {
}
func (m *PCErrMessage) Serialize() []uint8 {
- pcerrMessageLength := COMMON_HEADER_LENGTH + m.PcepErrorObject.Len()
- pcerrHeader := NewCommonHeader(MT_ERROR, pcerrMessageLength)
+ pcerrMessageLength := CommonHeaderLength + m.PcepErrorObject.Len()
+ pcerrHeader := NewCommonHeader(MessageTypeError, pcerrMessageLength)
bytePCErrHeader := pcerrHeader.Serialize()
bytePcepErrorObject := m.PcepErrorObject.Serialize()
bytePCErrMessage := AppendByteSlices(bytePCErrHeader, bytePcepErrorObject)
@@ -188,7 +222,7 @@ func (m *CloseMessage) DecodeFromBytes(messageBody []uint8) error {
return err
}
closeObject := &CloseObject{}
- if err := closeObject.DecodeFromBytes(commonObjectHeader.ObjectType, messageBody[COMMON_OBJECT_HEADER_LENGTH:commonObjectHeader.ObjectLength]); err != nil {
+ if err := closeObject.DecodeFromBytes(commonObjectHeader.ObjectType, messageBody[commonObjectHeaderLength:commonObjectHeader.ObjectLength]); err != nil {
return err
}
m.CloseObject = closeObject
@@ -196,15 +230,15 @@ func (m *CloseMessage) DecodeFromBytes(messageBody []uint8) error {
}
func (m *CloseMessage) Serialize() []uint8 {
- closeMessageLength := COMMON_HEADER_LENGTH + m.CloseObject.Len()
- closeHeader := NewCommonHeader(MT_CLOSE, closeMessageLength)
+ closeMessageLength := CommonHeaderLength + m.CloseObject.Len()
+ closeHeader := NewCommonHeader(MessageTypeClose, closeMessageLength)
byteCloseHeader := closeHeader.Serialize()
byteCloseObject := m.CloseObject.Serialize()
byteCloseMessage := AppendByteSlices(byteCloseHeader, byteCloseObject)
return byteCloseMessage
}
-func NewCloseMessage(reason uint8) (*CloseMessage, error) {
+func NewCloseMessage(reason CloseReason) (*CloseMessage, error) {
o, err := NewCloseObject(reason)
if err != nil {
return nil, err
@@ -217,9 +251,9 @@ func NewCloseMessage(reason uint8) (*CloseMessage, error) {
type StateReport struct {
SrpObject *SrpObject
- LspObject *LspObject
+ LSPObject *LSPObject
EroObject *EroObject
- LspaObject *LspaObject
+ LSPAObject *LSPAObject
MetricObjects []*MetricObject
BandwidthObjects []*BandwidthObject
AssociationObject *AssociationObject
@@ -229,9 +263,9 @@ type StateReport struct {
func NewStateReport() (*StateReport, error) {
sr := &StateReport{
SrpObject: &SrpObject{},
- LspObject: &LspObject{},
+ LSPObject: &LSPObject{},
EroObject: &EroObject{},
- LspaObject: &LspaObject{},
+ LSPAObject: &LSPAObject{},
MetricObjects: []*MetricObject{},
BandwidthObjects: []*BandwidthObject{},
AssociationObject: &AssociationObject{},
@@ -240,7 +274,7 @@ func NewStateReport() (*StateReport, error) {
return sr, nil
}
-func (r *StateReport) decodeBandwidthObject(objectType uint8, objectBody []uint8) error {
+func (r *StateReport) decodeBandwidthObject(objectType ObjectType, objectBody []uint8) error {
bandwidthObject := &BandwidthObject{}
if err := bandwidthObject.DecodeFromBytes(objectType, objectBody); err != nil {
return err
@@ -249,7 +283,7 @@ func (r *StateReport) decodeBandwidthObject(objectType uint8, objectBody []uint8
return nil
}
-func (r *StateReport) decodeMetricObject(objectType uint8, objectBody []uint8) error {
+func (r *StateReport) decodeMetricObject(objectType ObjectType, objectBody []uint8) error {
metricObject := &MetricObject{}
if err := metricObject.DecodeFromBytes(objectType, objectBody); err != nil {
return err
@@ -258,19 +292,19 @@ func (r *StateReport) decodeMetricObject(objectType uint8, objectBody []uint8) e
return nil
}
-func (r *StateReport) decodeEroObject(objectType uint8, objectBody []uint8) error {
+func (r *StateReport) decodeEroObject(objectType ObjectType, objectBody []uint8) error {
return r.EroObject.DecodeFromBytes(objectType, objectBody)
}
-func (r *StateReport) decodeLspaObject(objectType uint8, objectBody []uint8) error {
- return r.LspaObject.DecodeFromBytes(objectType, objectBody)
+func (r *StateReport) decodeLSPAObject(objectType ObjectType, objectBody []uint8) error {
+ return r.LSPAObject.DecodeFromBytes(objectType, objectBody)
}
-func (r *StateReport) decodeLspObject(objectType uint8, objectBody []uint8) error {
- return r.LspObject.DecodeFromBytes(objectType, objectBody)
+func (r *StateReport) decodeLSPObject(objectType ObjectType, objectBody []uint8) error {
+ return r.LSPObject.DecodeFromBytes(objectType, objectBody)
}
-func (r *StateReport) decodeSrpObject(objectType uint8, objectBody []uint8) error {
+func (r *StateReport) decodeSrpObject(objectType ObjectType, objectBody []uint8) error {
srpObject := &SrpObject{}
if err := srpObject.DecodeFromBytes(objectType, objectBody); err != nil {
return err
@@ -279,11 +313,11 @@ func (r *StateReport) decodeSrpObject(objectType uint8, objectBody []uint8) erro
return nil
}
-func (r *StateReport) decodeAssociationObject(objectType uint8, objectBody []uint8) error {
+func (r *StateReport) decodeAssociationObject(objectType ObjectType, objectBody []uint8) error {
return r.AssociationObject.DecodeFromBytes(objectType, objectBody)
}
-func (r *StateReport) decodeVendorInformationObject(objectType uint8, objectBody []uint8) error {
+func (r *StateReport) decodeVendorInformationObject(objectType ObjectType, objectBody []uint8) error {
return r.VendorInformationObject.DecodeFromBytes(objectType, objectBody)
}
@@ -292,20 +326,20 @@ type PCRptMessage struct {
StateReports []*StateReport
}
-var decodeFuncs = map[uint8]func(*StateReport, uint8, []uint8) error{
- OC_BANDWIDTH: (*StateReport).decodeBandwidthObject,
- OC_METRIC: (*StateReport).decodeMetricObject,
- OC_ERO: (*StateReport).decodeEroObject,
- OC_LSPA: (*StateReport).decodeLspaObject,
- OC_LSP: (*StateReport).decodeLspObject,
- OC_SRP: (*StateReport).decodeSrpObject,
- OC_ASSOCIATION: (*StateReport).decodeAssociationObject,
- OC_VENDOR_INFORMATION: (*StateReport).decodeVendorInformationObject,
+var decodeFuncs = map[ObjectClass]func(*StateReport, ObjectType, []uint8) error{
+ ObjectClassBandwidth: (*StateReport).decodeBandwidthObject,
+ ObjectClassMetric: (*StateReport).decodeMetricObject,
+ ObjectClassERO: (*StateReport).decodeEroObject,
+ ObjectClassLSPA: (*StateReport).decodeLSPAObject,
+ ObjectClassLSP: (*StateReport).decodeLSPObject,
+ ObjectClassSRP: (*StateReport).decodeSrpObject,
+ ObjectClassAssociation: (*StateReport).decodeAssociationObject,
+ ObjectClassVendorInformation: (*StateReport).decodeVendorInformationObject,
}
func (m *PCRptMessage) DecodeFromBytes(messageBody []uint8) error {
- // previousOC: To determine the delimitation of StateReports from the order of object classes
- var previousOC uint8
+ // previousObjectClass: To track the object class and handle the delimitation of StateReports
+ var previousObjectClass ObjectClass
var sr *StateReport
for len(messageBody) > 0 {
var commonObjectHeader CommonObjectHeader
@@ -314,30 +348,31 @@ func (m *PCRptMessage) DecodeFromBytes(messageBody []uint8) error {
}
decodeFunc, ok := decodeFuncs[commonObjectHeader.ObjectClass]
if !ok {
- // Skip if object class not registered in decodeFunc
+ // Skip the current object if the object class is not registered in decodeFuncs
messageBody = messageBody[commonObjectHeader.ObjectLength:]
continue
}
- if (previousOC != OC_SRP && commonObjectHeader.ObjectClass == OC_LSP) || commonObjectHeader.ObjectClass == OC_SRP {
- // If sr is not zero value, this StateReport is already updated.
- var err error
+ if (previousObjectClass != ObjectClassSRP && commonObjectHeader.ObjectClass == ObjectClassLSP) || commonObjectHeader.ObjectClass == ObjectClassSRP {
if sr != nil {
m.StateReports = append(m.StateReports, sr)
}
+
+ var err error
sr, err = NewStateReport()
if err != nil {
return err
}
}
- if err := decodeFunc(sr, commonObjectHeader.ObjectType, messageBody[COMMON_OBJECT_HEADER_LENGTH:commonObjectHeader.ObjectLength]); err != nil {
+ if err := decodeFunc(sr, commonObjectHeader.ObjectType, messageBody[commonObjectHeaderLength:commonObjectHeader.ObjectLength]); err != nil {
return err
}
- previousOC = commonObjectHeader.ObjectClass
+ previousObjectClass = commonObjectHeader.ObjectClass
messageBody = messageBody[commonObjectHeader.ObjectLength:]
}
if sr != nil {
m.StateReports = append(m.StateReports, sr)
}
+
return nil
}
@@ -350,7 +385,7 @@ func NewPCRptMessage() *PCRptMessage {
// PCInitiate Message
type PCInitiateMessage struct {
SrpObject *SrpObject
- LspObject *LspObject
+ LSPObject *LSPObject
EndpointsObject *EndpointsObject
EroObject *EroObject
AssociationObject *AssociationObject
@@ -374,14 +409,14 @@ func (m *PCInitiateMessage) Serialize() ([]uint8, error) {
return nil, err
}
}
- pcinitiateMessageLength := COMMON_HEADER_LENGTH +
+ pcinitiateMessageLength := CommonHeaderLength +
m.SrpObject.Len() +
- m.LspObject.Len() +
+ m.LSPObject.Len() +
endpointsObjectLength +
eroObjectLength
byteSrpObject := m.SrpObject.Serialize()
- byteLspObject := m.LspObject.Serialize()
+ byteLSPObject := m.LSPObject.Serialize()
byteEndpointsObject := []uint8{}
if m.EndpointsObject != nil {
@@ -417,17 +452,17 @@ func (m *PCInitiateMessage) Serialize() ([]uint8, error) {
pcinitiateMessageLength += m.VendorInformationObject.Len()
}
- pcinitiateHeader := NewCommonHeader(MT_LSPINITREQ, pcinitiateMessageLength)
+ pcinitiateHeader := NewCommonHeader(MessageTypeLSPInitReq, pcinitiateMessageLength)
bytePCInitiateHeader := pcinitiateHeader.Serialize()
bytePCInitiateMessage := AppendByteSlices(
- bytePCInitiateHeader, byteSrpObject, byteLspObject, byteEndpointsObject, byteEroObject, byteAssociationObject, byteVendorInformationObject,
+ bytePCInitiateHeader, byteSrpObject, byteLSPObject, byteEndpointsObject, byteEroObject, byteAssociationObject, byteVendorInformationObject,
)
return bytePCInitiateMessage, nil
}
func NewPCInitiateMessage(srpID uint32, lspName string, lspDelete bool, plspID uint32, segmentList []table.Segment, color uint32, preference uint32, srcAddr netip.Addr, dstAddr netip.Addr, opt ...Opt) (*PCInitiateMessage, error) {
opts := optParams{
- pccType: RFC_COMPLIANT,
+ pccType: RFCCompliant,
}
for _, o := range opt {
@@ -441,12 +476,12 @@ func NewPCInitiateMessage(srpID uint32, lspName string, lspDelete bool, plspID u
}
if lspDelete {
- if m.LspObject, err = NewLspObject(lspName, &color, plspID); err != nil {
+ if m.LSPObject, err = NewLSPObject(lspName, &color, plspID); err != nil {
return nil, err
}
return m, nil
} else {
- if m.LspObject, err = NewLspObject(lspName, &color, 0); err != nil {
+ if m.LSPObject, err = NewLSPObject(lspName, &color, 0); err != nil {
return nil, err
}
}
@@ -459,20 +494,20 @@ func NewPCInitiateMessage(srpID uint32, lspName string, lspDelete bool, plspID u
}
switch opts.pccType {
- case JUNIPER_LEGACY:
+ case JuniperLegacy:
if m.AssociationObject, err = NewAssociationObject(srcAddr, dstAddr, color, preference, VendorSpecific(opts.pccType)); err != nil {
return nil, err
}
- case CISCO_LEGACY:
- if m.VendorInformationObject, err = NewVendorInformationObject(CISCO_LEGACY, color, preference); err != nil {
+ case CiscoLegacy:
+ if m.VendorInformationObject, err = NewVendorInformationObject(CiscoLegacy, color, preference); err != nil {
return nil, err
}
- case RFC_COMPLIANT:
+ case RFCCompliant:
if m.AssociationObject, err = NewAssociationObject(srcAddr, dstAddr, color, preference); err != nil {
return nil, err
}
// FRRouting is considered RFC compliant
- if m.VendorInformationObject, err = NewVendorInformationObject(CISCO_LEGACY, color, preference); err != nil {
+ if m.VendorInformationObject, err = NewVendorInformationObject(CiscoLegacy, color, preference); err != nil {
return nil, err
}
default:
@@ -485,13 +520,13 @@ func NewPCInitiateMessage(srpID uint32, lspName string, lspDelete bool, plspID u
// PCUpdate Message
type PCUpdMessage struct {
SrpObject *SrpObject
- LspObject *LspObject
+ LSPObject *LSPObject
EroObject *EroObject
}
func (m *PCUpdMessage) Serialize() ([]uint8, error) {
byteSrpObject := m.SrpObject.Serialize()
- byteLspObject := m.LspObject.Serialize()
+ byteLSPObject := m.LSPObject.Serialize()
byteEroObject, err := m.EroObject.Serialize()
if err != nil {
return nil, err
@@ -501,10 +536,10 @@ func (m *PCUpdMessage) Serialize() ([]uint8, error) {
if err != nil {
return nil, err
}
- pcupdMessageLength := COMMON_HEADER_LENGTH + m.SrpObject.Len() + m.LspObject.Len() + eroObjectLength
- pcupdHeader := NewCommonHeader(MT_UPDATE, pcupdMessageLength)
+ pcupdMessageLength := CommonHeaderLength + m.SrpObject.Len() + m.LSPObject.Len() + eroObjectLength
+ pcupdHeader := NewCommonHeader(MessageTypeUpdate, pcupdMessageLength)
bytePCUpdHeader := pcupdHeader.Serialize()
- bytePCUpdMessage := AppendByteSlices(bytePCUpdHeader, byteSrpObject, byteLspObject, byteEroObject)
+ bytePCUpdMessage := AppendByteSlices(bytePCUpdHeader, byteSrpObject, byteLSPObject, byteEroObject)
return bytePCUpdMessage, err
}
@@ -515,7 +550,7 @@ func NewPCUpdMessage(srpID uint32, lspName string, plspID uint32, segmentList []
if m.SrpObject, err = NewSrpObject(segmentList, srpID, false); err != nil {
return nil, err
}
- if m.LspObject, err = NewLspObject(lspName, nil, plspID); err != nil {
+ if m.LSPObject, err = NewLSPObject(lspName, nil, plspID); err != nil {
return nil, err
}
if m.EroObject, err = NewEroObject(segmentList); err != nil {
diff --git a/pkg/packet/pcep/object.go b/pkg/packet/pcep/object.go
index ea6e9e43..485c1081 100644
--- a/pkg/packet/pcep/object.go
+++ b/pkg/packet/pcep/object.go
@@ -8,6 +8,7 @@ package pcep
import (
"encoding/binary"
"errors"
+ "fmt"
"math"
"net/netip"
@@ -17,21 +18,21 @@ import (
type PccType int
const (
- CISCO_LEGACY PccType = iota
- JUNIPER_LEGACY
- RFC_COMPLIANT
+ CiscoLegacy PccType = iota
+ JuniperLegacy
+ RFCCompliant
)
// Determine PCC type from capability
func DeterminePccType(caps []CapabilityInterface) (pccType PccType) {
- pccType = RFC_COMPLIANT
+ pccType = RFCCompliant
for _, cap := range caps {
if t, ok := cap.(*AssocTypeList); ok {
for _, v := range t.AssocTypes {
- if v == AssocType(20) { // Cisco specific Assoc-Type
- pccType = CISCO_LEGACY
- } else if v == AssocType(65505) { // Juniper specific Assoc-Type
- pccType = JUNIPER_LEGACY
+ if v == AssociationTypeSRPolicyAssociationCisco {
+ pccType = CiscoLegacy
+ } else if v == AssociationTypeSRPolicyAssociationJuniper {
+ pccType = JuniperLegacy
break
}
}
@@ -40,95 +41,170 @@ func DeterminePccType(caps []CapabilityInterface) (pccType PccType) {
return
}
-const COMMON_OBJECT_HEADER_LENGTH uint16 = 4
-
-const ( // PCEP Object-Class (1 byte) Ref: https://www.iana.org/assignments/pcep/pcep.xhtml#pcep-objects
- OC_RESERVED uint8 = 0x00 // RFC5440
- OC_OPEN uint8 = 0x01 // RFC5440
- OC_RP uint8 = 0x02 // RFC5440
- OC_NO_PATH uint8 = 0x03 // RFC5440
- OC_END_POINTS uint8 = 0x04 // RFC5440
- OC_BANDWIDTH uint8 = 0x05 // RFC5440
- OC_METRIC uint8 = 0x06 // RFC5440
- OC_ERO uint8 = 0x07 // RFC5440
- OC_RRO uint8 = 0x08 // RFC5440
- OC_LSPA uint8 = 0x09 // RFC5440
- OC_IRO uint8 = 0x0a // RFC5440
- OC_SVRC uint8 = 0x0b // RFC5440
- OC_NOTIFICATION uint8 = 0x0c // RFC5440
- OC_PCEP_ERROR uint8 = 0x0d // RFC5440
- OC_LOAD_BALANCING uint8 = 0x0e // RFC5440
- OC_CLOSE uint8 = 0x0f // RFC5440
- OC_PATH_KEY uint8 = 0x10 // RFC5520
- OC_XRO uint8 = 0x11 // RFC5521
- OC_MONITORING uint8 = 0x13 // RFC5886
- OC_PCC_REQ_ID uint8 = 0x14 // RFC5886
- OC_OF uint8 = 0x15 // RFC5541
- OC_CLASSTYPE uint8 = 0x16 // RFC5455
- OC_GLOBAL_CONSTRAINTS uint8 = 0x18 // RFC5557
- OC_PCE_ID uint8 = 0x19 // RFC5886
- OC_PROC_TIME uint8 = 0x1a // RFC5886
- OC_OVERLOAD uint8 = 0x1b // RFC5886
- OC_UNREACH_DESTINATION uint8 = 0x1c // RFC8306
- OC_SERO uint8 = 0x1d // RFC8306
- OC_SRRO uint8 = 0x1e // RFC8306
- OC_BNC uint8 = 0x1f // RFC8306
- OC_LSP uint8 = 0x20 // RFC8231
- OC_SRP uint8 = 0x21 // RFC8231
- OC_VENDOR_INFORMATION uint8 = 0x22 // RFC7470
- OC_BU uint8 = 0x23 // RFC8233
- OC_INTER_LAYER uint8 = 0x24 // RFC8282
- OC_SWITCH_LAYER uint8 = 0x25 // RFC8282
- OC_REQ_ADAP_CAP uint8 = 0x26 // RFC8282
- OC_SERVER_INDICATION uint8 = 0x27 // RFC8282
- OC_ASSOCIATION uint8 = 0x28 // RFC8697
- OC_S2LS uint8 = 0x29 // RFC8623
- OC_WA uint8 = 0x2a // RFC8780
- OC_FLOWSPEC uint8 = 0x2b // RFC9168
- OC_CCI_OBJECT_TYPE uint8 = 0x2c // RFC9050
- OC_PATH_ATTRIB uint8 = 0x2d // draft-ietf-pce-multipath-07
- OC_BGP_PEER_INFO_OBJECT_TYPE uint8 = 0x2c // RFC9757
- OC_EXPLICIT_PEER_ROUTE_OBJECT_TYPE uint8 = 0x2d // RFC9757
- OC_PEER_PREFIX_ADVERTISEMENT_OBJECT_TYPE uint8 = 0x2e // RFC9757
+const commonObjectHeaderLength uint16 = 4
+
+// PCEP Object-Class (1 byte) Ref: https://www.iana.org/assignments/pcep/pcep.xhtml#pcep-objects
+type ObjectClass uint8
+type ObjectType uint8
+type SubObjectType uint8
+
+const (
+ ObjectClassOpen ObjectClass = 0x01
+ ObjectClassRP ObjectClass = 0x02
+ ObjectClassNoPath ObjectClass = 0x03
+ ObjectClassEndpoints ObjectClass = 0x04
+ ObjectClassBandwidth ObjectClass = 0x05
+ ObjectClassMetric ObjectClass = 0x06
+ ObjectClassERO ObjectClass = 0x07
+ ObjectClassRRO ObjectClass = 0x08
+ ObjectClassLSPA ObjectClass = 0x09
+ ObjectClassIRO ObjectClass = 0x0a
+ ObjectClassSVEC ObjectClass = 0x0b
+ ObjectClassNotification ObjectClass = 0x0c
+ ObjectClassPCEPError ObjectClass = 0x0d
+ ObjectClassLoadBalancing ObjectClass = 0x0e
+ ObjectClassClose ObjectClass = 0x0f
+ ObjectClassPathKey ObjectClass = 0x10
+ ObjectClassXRO ObjectClass = 0x11
+ ObjectClassMonitoring ObjectClass = 0x13
+ ObjectClassPCCReqID ObjectClass = 0x14
+ ObjectClassOF ObjectClass = 0x15
+ ObjectClassClassType ObjectClass = 0x16
+ ObjectClassGlobalConstraints ObjectClass = 0x18
+ ObjectClassPCEID ObjectClass = 0x19
+ ObjectClassProcTime ObjectClass = 0x1a
+ ObjectClassOverload ObjectClass = 0x1b
+ ObjectClassUnreachDestination ObjectClass = 0x1c
+ ObjectClassSERO ObjectClass = 0x1d
+ ObjectClassSRRO ObjectClass = 0x1e
+ ObjectClassBNC ObjectClass = 0x1f
+ ObjectClassLSP ObjectClass = 0x20
+ ObjectClassSRP ObjectClass = 0x21
+ ObjectClassVendorInformation ObjectClass = 0x22
+ ObjectClassBU ObjectClass = 0x23
+ ObjectClassInterLayer ObjectClass = 0x24
+ ObjectClassSwitchLayer ObjectClass = 0x25
+ ObjectClassReqAdapCap ObjectClass = 0x26
+ ObjectClassServerIndication ObjectClass = 0x27
+ ObjectClassAssociation ObjectClass = 0x28
+ ObjectClassS2LS ObjectClass = 0x29
+ ObjectClassWA ObjectClass = 0x2a
+ ObjectClassFlowSpec ObjectClass = 0x2b
+ ObjectClassCCIObjectType ObjectClass = 0x2c
+ ObjectClassPathAttrib ObjectClass = 0x2d
+ ObjectClassBGPPeerInfoObjectType ObjectClass = 0x2e
+ ObjectClassExplicitPeerRouteObjectType ObjectClass = 0x2f
+ ObjectClassPeerPrefixAdvertisementObjectType ObjectClass = 0x30
)
+var objectClassDescriptions = map[ObjectClass]struct {
+ Description string
+ Reference string
+}{
+ ObjectClassOpen: {"Open", "RFC5440"},
+ ObjectClassRP: {"RP", "RFC5440"},
+ ObjectClassNoPath: {"NO-PATH", "RFC5440"},
+ ObjectClassEndpoints: {"END-POINTS", "RFC5440"},
+ ObjectClassBandwidth: {"BANDWIDTH", "RFC5440"},
+ ObjectClassMetric: {"METRIC", "RFC5440"},
+ ObjectClassERO: {"ERO", "RFC5440"},
+ ObjectClassRRO: {"RRO", "RFC5440"},
+ ObjectClassLSPA: {"LSPA", "RFC5440"},
+ ObjectClassIRO: {"IRO", "RFC5440"},
+ ObjectClassSVEC: {"SVEC", "RFC5440"},
+ ObjectClassNotification: {"NOTIFICATION", "RFC5440"},
+ ObjectClassPCEPError: {"PCEP-ERROR", "RFC5440"},
+ ObjectClassLoadBalancing: {"LOAD-BALANCING", "RFC5440"},
+ ObjectClassClose: {"CLOSE", "RFC5440"},
+ ObjectClassPathKey: {"PATH-KEY", "RFC5520"},
+ ObjectClassXRO: {"XRO", "RFC5521"},
+ ObjectClassMonitoring: {"MONITORING", "RFC5886"},
+ ObjectClassPCCReqID: {"PCC-REQ-ID", "RFC5886"},
+ ObjectClassOF: {"OF", "RFC5541"},
+ ObjectClassClassType: {"CLASSTYPE", "RFC5455"},
+ ObjectClassGlobalConstraints: {"GLOBAL-CONSTRAINTS", "RFC5557"},
+ ObjectClassPCEID: {"PCE-ID", "RFC5886"},
+ ObjectClassProcTime: {"PROC-TIME", "RFC5886"},
+ ObjectClassOverload: {"OVERLOAD", "RFC5886"},
+ ObjectClassUnreachDestination: {"UNREACH-DESTINATION", "RFC8306"},
+ ObjectClassSERO: {"SERO", "RFC8306"},
+ ObjectClassSRRO: {"SRRO", "RFC8306"},
+ ObjectClassBNC: {"BNC", "RFC8306"},
+ ObjectClassLSP: {"LSP", "RFC8231"},
+ ObjectClassSRP: {"SRP", "RFC8231"},
+ ObjectClassVendorInformation: {"VENDOR-INFORMATION", "RFC7470"},
+ ObjectClassBU: {"BU", "RFC8233"},
+ ObjectClassInterLayer: {"INTER-LAYER", "RFC8282"},
+ ObjectClassSwitchLayer: {"SWITCH-LAYER", "RFC8282"},
+ ObjectClassReqAdapCap: {"REQ-ADAP-CAP", "RFC8282"},
+ ObjectClassServerIndication: {"SERVER-INDICATION", "RFC8282"},
+ ObjectClassAssociation: {"ASSOCIATION", "RFC8697"},
+ ObjectClassS2LS: {"S2LS", "RFC8623"},
+ ObjectClassWA: {"WA", "RFC8780"},
+ ObjectClassFlowSpec: {"FLOWSPEC", "RFC9168"},
+ ObjectClassCCIObjectType: {"CCI", "RFC9050"},
+ ObjectClassPathAttrib: {"PATH-ATTRIB", "draft-ietf-pce-multipath-07"},
+ ObjectClassBGPPeerInfoObjectType: {"BGP-PEER-INFO", "RFC9757"},
+ ObjectClassExplicitPeerRouteObjectType: {"EXPLICIT-PEER-ROUTE", "RFC9757"},
+ ObjectClassPeerPrefixAdvertisementObjectType: {"PEER-PREFIX-ADVERTISEMENT", "RFC9757"},
+}
+
+func (c ObjectClass) String() string {
+ if desc, ok := objectClassDescriptions[c]; ok {
+ return fmt.Sprintf("%s (0x%02x)", desc.Description, uint8(c))
+ }
+ return fmt.Sprintf("Unknown Object Class (0x%02x)", uint8(c))
+}
+
+func (c ObjectClass) StringWithReference() string {
+ if desc, ok := objectClassDescriptions[c]; ok {
+ return fmt.Sprintf("%s (0x%02x) [%s]", desc.Description, c, desc.Reference)
+ }
+ return fmt.Sprintf("Unknown Object Class (0x%02x)", uint8(c))
+}
+
type CommonObjectHeader struct { // RFC5440 7.2
- ObjectClass uint8
- ObjectType uint8
+ ObjectClass ObjectClass
+ ObjectType ObjectType
ResFlags uint8 // MUST be set to zero
PFlag bool // 0: optional, 1: MUST
IFlag bool // 0: processed, 1: ignored
ObjectLength uint16
}
+const (
+ IFlagMask uint8 = 0x01
+ PFlagMask uint8 = 0x02
+)
+
func (h *CommonObjectHeader) DecodeFromBytes(objectHeader []uint8) error {
- h.ObjectClass = uint8(objectHeader[0])
- h.ObjectType = uint8(objectHeader[1] & 0xf0 >> 4)
- h.ResFlags = uint8(objectHeader[1] & 0x0c >> 2)
- h.PFlag = (objectHeader[1] & 0x02) != 0
- h.IFlag = (objectHeader[1] & 0x01) != 0
+ h.ObjectClass = ObjectClass(objectHeader[0])
+ h.ObjectType = ObjectType((objectHeader[1] & 0xf0) >> 4)
+ h.ResFlags = uint8((objectHeader[1] & 0x0c) >> 2)
+ h.PFlag = (objectHeader[1] & PFlagMask) != 0
+ h.IFlag = (objectHeader[1] & IFlagMask) != 0
h.ObjectLength = binary.BigEndian.Uint16(objectHeader[2:4])
return nil
}
func (h *CommonObjectHeader) Serialize() []uint8 {
buf := make([]uint8, 0, 4)
- buf = append(buf, h.ObjectClass)
- otFlags := uint8(h.ObjectType<<4 | h.ResFlags<<2)
+ buf = append(buf, uint8(h.ObjectClass))
+ Flagbyte := uint8(h.ObjectType)<<4 | uint8(h.ResFlags)<<2
if h.PFlag {
- otFlags = otFlags | 0x02
+ Flagbyte = Flagbyte | PFlagMask
}
if h.IFlag {
- otFlags = otFlags | 0x01
+ Flagbyte = Flagbyte | IFlagMask
}
- buf = append(buf, otFlags)
+ buf = append(buf, Flagbyte)
objectLength := make([]uint8, 2)
binary.BigEndian.PutUint16(objectLength, h.ObjectLength)
buf = append(buf, objectLength...)
return buf
}
-func NewCommonObjectHeader(objectClass uint8, objectType uint8, messageLength uint16) *CommonObjectHeader {
+func NewCommonObjectHeader(objectClass ObjectClass, objectType ObjectType, messageLength uint16) *CommonObjectHeader {
h := &CommonObjectHeader{
ObjectClass: objectClass,
ObjectType: objectType,
@@ -140,25 +216,13 @@ func NewCommonObjectHeader(objectClass uint8, objectType uint8, messageLength ui
return h
}
-type optParams struct {
- pccType PccType
-}
-
-type Opt func(*optParams)
-
-func VendorSpecific(pt PccType) Opt {
- return func(op *optParams) {
- op.pccType = pt
- }
-}
-
// OPEN Object (RFC5440 7.3)
const (
- OT_OPEN_OPEN uint8 = 0x01
+ ObjectTypeOpenOpen ObjectType = 0x01
)
type OpenObject struct {
- ObjectType uint8
+ ObjectType ObjectType
Version uint8
Flag uint8
Keepalive uint8
@@ -167,7 +231,7 @@ type OpenObject struct {
Caps []CapabilityInterface
}
-func (o *OpenObject) DecodeFromBytes(typ uint8, objectBody []uint8) error {
+func (o *OpenObject) DecodeFromBytes(typ ObjectType, objectBody []uint8) error {
o.ObjectType = typ
o.Version = uint8(objectBody[0] >> 5)
o.Flag = uint8(objectBody[0] & 0x1f)
@@ -188,7 +252,7 @@ func (o *OpenObject) DecodeFromBytes(typ uint8, objectBody []uint8) error {
}
func (o *OpenObject) Serialize() []uint8 {
- openObjectHeader := NewCommonObjectHeader(OC_OPEN, o.ObjectType, o.Len())
+ openObjectHeader := NewCommonObjectHeader(ObjectClassOpen, o.ObjectType, o.Len())
byteOpenObjectHeader := openObjectHeader.Serialize()
buf := make([]uint8, 4)
buf[0] = o.Version << 5
@@ -212,12 +276,12 @@ func (o *OpenObject) Len() uint16 {
}
// TODO: Calculate TLV length and record in open_object_length
// CommonObjectHeader(4byte) + openObject(4byte) + tlvslength(valiable)
- return COMMON_OBJECT_HEADER_LENGTH + 4 + tlvsByteLength
+ return commonObjectHeaderLength + 4 + tlvsByteLength
}
func NewOpenObject(sessionID uint8, keepalive uint8, capabilities []CapabilityInterface) (*OpenObject, error) {
o := &OpenObject{
- ObjectType: OT_OPEN_OPEN,
+ ObjectType: ObjectTypeOpenOpen,
Version: uint8(1), // PCEP version. Current version is 1
Flag: uint8(0),
Keepalive: keepalive,
@@ -230,26 +294,26 @@ func NewOpenObject(sessionID uint8, keepalive uint8, capabilities []CapabilityIn
// BANDWIDTH Object (RFC5440 7.7)
type BandwidthObject struct {
- ObjectType uint8
+ ObjectType ObjectType
Bandwidth uint32
}
-func (o *BandwidthObject) DecodeFromBytes(typ uint8, objectBody []uint8) error {
- o.ObjectType = typ
+func (o *BandwidthObject) DecodeFromBytes(objectType ObjectType, objectBody []uint8) error {
+ o.ObjectType = objectType
o.Bandwidth = binary.BigEndian.Uint32(objectBody[:])
return nil
}
// METRIC Object (RFC5440 7.8)
type MetricObject struct {
- ObjectType uint8
+ ObjectType ObjectType
CFlag bool
BFlag bool
MetricType uint8
MetricValue uint32
}
-func (o *MetricObject) DecodeFromBytes(typ uint8, objectBody []uint8) error {
+func (o *MetricObject) DecodeFromBytes(typ ObjectType, objectBody []uint8) error {
o.ObjectType = typ
o.CFlag = (objectBody[2] & 0x02) != 0
o.BFlag = (objectBody[2] & 0x01) != 0
@@ -259,7 +323,7 @@ func (o *MetricObject) DecodeFromBytes(typ uint8, objectBody []uint8) error {
}
func (o *MetricObject) Serialize() []uint8 {
- metricObjectHeader := NewCommonObjectHeader(OC_METRIC, o.ObjectType, o.Len())
+ metricObjectHeader := NewCommonObjectHeader(ObjectClassMetric, o.ObjectType, o.Len())
byteMetricObjectHeader := metricObjectHeader.Serialize()
buf := make([]uint8, 8)
@@ -278,12 +342,12 @@ func (o *MetricObject) Serialize() []uint8 {
func (o *MetricObject) Len() uint16 {
// CommonObjectHeader(4byte) + Flags, SRP-ID(8byte)
- return COMMON_OBJECT_HEADER_LENGTH + 8
+ return commonObjectHeaderLength + 8
}
func NewMetricObject() (*MetricObject, error) {
o := &MetricObject{
- ObjectType: uint8(1),
+ ObjectType: ObjectType(1),
MetricType: uint8(2),
MetricValue: uint32(30),
}
@@ -291,8 +355,8 @@ func NewMetricObject() (*MetricObject, error) {
}
// LSPA Object (RFC5440 7.11)
-type LspaObject struct {
- ObjectType uint8
+type LSPAObject struct {
+ ObjectType ObjectType
ExcludeAny uint32
IncludeAny uint32
IncludeAll uint32
@@ -301,7 +365,7 @@ type LspaObject struct {
LFlag bool
}
-func (o *LspaObject) DecodeFromBytes(typ uint8, objectBody []uint8) error {
+func (o *LSPAObject) DecodeFromBytes(typ ObjectType, objectBody []uint8) error {
o.ObjectType = typ
o.ExcludeAny = binary.BigEndian.Uint32(objectBody[0:4])
o.IncludeAny = binary.BigEndian.Uint32(objectBody[4:8])
@@ -312,9 +376,9 @@ func (o *LspaObject) DecodeFromBytes(typ uint8, objectBody []uint8) error {
return nil
}
-func (o *LspaObject) Serialize() []uint8 {
- lspaObjectHeader := NewCommonObjectHeader(OC_LSPA, o.ObjectType, o.Len())
- byteLspaObjectHeader := lspaObjectHeader.Serialize()
+func (o *LSPAObject) Serialize() []uint8 {
+ lspaObjectHeader := NewCommonObjectHeader(ObjectClassLSPA, o.ObjectType, o.Len())
+ byteLSPAObjectHeader := lspaObjectHeader.Serialize()
buf := make([]uint8, 16)
binary.BigEndian.PutUint32(buf[0:4], o.ExcludeAny)
@@ -326,18 +390,18 @@ func (o *LspaObject) Serialize() []uint8 {
buf[14] = buf[14] | 0x01
}
- byteLspaObject := AppendByteSlices(byteLspaObjectHeader, buf)
- return byteLspaObject
+ byteLSPAObject := AppendByteSlices(byteLSPAObjectHeader, buf)
+ return byteLSPAObject
}
-func (o *LspaObject) Len() uint16 {
+func (o *LSPAObject) Len() uint16 {
// CommonObjectHeader(4byte) + Flags, SRP-ID(8byte)
- return COMMON_OBJECT_HEADER_LENGTH + 16
+ return commonObjectHeaderLength + 16
}
-func NewLspaObject() (*LspaObject, error) {
- o := &LspaObject{
- ObjectType: uint8(1),
+func NewLSPAObject() (*LSPAObject, error) {
+ o := &LSPAObject{
+ ObjectType: ObjectType(1),
SetupPriority: uint8(7),
HoldingPriority: uint8(7),
LFlag: true,
@@ -347,17 +411,17 @@ func NewLspaObject() (*LspaObject, error) {
// PCEP Error Object (RFC5440 7.15)
const (
- OT_ERROR_ERROR uint8 = 0x01
+ ObjectTypeErrorError ObjectType = 0x01
)
type PcepErrorObject struct {
- ObjectType uint8
+ ObjectType ObjectType
ErrorType uint8
ErrorValue uint8
Tlvs []TLVInterface
}
-func (o *PcepErrorObject) DecodeFromBytes(typ uint8, objectBody []uint8) error {
+func (o *PcepErrorObject) DecodeFromBytes(typ ObjectType, objectBody []uint8) error {
o.ObjectType = typ
o.ErrorType = objectBody[2]
o.ErrorValue = objectBody[3]
@@ -372,7 +436,7 @@ func (o *PcepErrorObject) DecodeFromBytes(typ uint8, objectBody []uint8) error {
}
func (o *PcepErrorObject) Serialize() []uint8 {
- pcepErrorObjectHeader := NewCommonObjectHeader(OC_PCEP_ERROR, o.ObjectType, o.Len())
+ pcepErrorObjectHeader := NewCommonObjectHeader(ObjectClassPCEPError, o.ObjectType, o.Len())
bytePcepErrorObjectHeader := pcepErrorObjectHeader.Serialize()
buf := make([]uint8, 4)
@@ -389,12 +453,12 @@ func (o *PcepErrorObject) Len() uint16 {
tlvsByteLength += tlv.Len()
}
// CommonObjectHeader(4byte) + Flags,Error-Type,Error-value(4byte) + tlvslength(valiable)
- return COMMON_OBJECT_HEADER_LENGTH + 4 + tlvsByteLength
+ return commonObjectHeaderLength + 4 + tlvsByteLength
}
func NewPcepErrorObject(errorType uint8, errorValue uint8, tlvs []TLVInterface) (*PcepErrorObject, error) {
o := &PcepErrorObject{
- ObjectType: OT_ERROR_ERROR,
+ ObjectType: ObjectTypeErrorError,
ErrorType: errorType,
ErrorValue: errorValue,
Tlvs: tlvs,
@@ -404,45 +468,74 @@ func NewPcepErrorObject(errorType uint8, errorValue uint8, tlvs []TLVInterface)
// Close Object (RFC5440 7.17)
const (
- OT_CLOSE_CLOSE uint8 = 0x01
+ ObjectTypeCloseClose ObjectType = 0x01
)
+type CloseReason uint8
+
const (
- R_NO_EXPLANATION_PROVIDED uint8 = 0x01
- R_DEADTIMER_EXPIRED uint8 = 0x02
- R_RECEPTION_OF_A_MALFORMED_PCEP_MESSAGE uint8 = 0x03
+ CloseReasonNoExplanationProvided CloseReason = 0x01
+ CloseReasonDeadTimerExpired CloseReason = 0x02
+ CloseReasonMalformedPCEPMessage CloseReason = 0x03
+ CloseReasonTooManyUnknownRequestsReplies CloseReason = 0x04
+ CloseReasonTooManyUnrecognizedPCEPMessages CloseReason = 0x05
)
+var closeReasonDescriptions = map[CloseReason]struct {
+ Description string
+ Reference string
+}{
+ CloseReasonNoExplanationProvided: {"No explanation provided", "RFC5440"},
+ CloseReasonDeadTimerExpired: {"DeadTimer expired", "RFC5440"},
+ CloseReasonMalformedPCEPMessage: {"Reception of a malformed PCEP message", "RFC5440"},
+ CloseReasonTooManyUnknownRequestsReplies: {"Reception of an unacceptable number of unknown requests/replies", "RFC5440"},
+ CloseReasonTooManyUnrecognizedPCEPMessages: {"Reception of an unacceptable number of unrecognized PCEP messages", "RFC5440"},
+}
+
+func (r CloseReason) String() string {
+ if desc, ok := closeReasonDescriptions[r]; ok {
+ return fmt.Sprintf("%s (0x%02x)", desc.Description, uint8(r))
+ }
+ return fmt.Sprintf("Unknown Close Reason (0x%02x)", uint8(r))
+}
+
+func (r CloseReason) StringWithReference() string {
+ if desc, ok := closeReasonDescriptions[r]; ok {
+ return fmt.Sprintf("%s (0x%02x) [%s]", desc.Description, r, desc.Reference)
+ }
+ return fmt.Sprintf("Unknown Close Reason (0x%02x)", uint8(r))
+}
+
type CloseObject struct {
- ObjectType uint8
- Reason uint8
+ ObjectType ObjectType
+ Reason CloseReason
}
-func (o *CloseObject) DecodeFromBytes(typ uint8, objectBody []uint8) error {
+func (o *CloseObject) DecodeFromBytes(typ ObjectType, objectBody []uint8) error {
o.ObjectType = typ
- o.Reason = objectBody[3]
+ o.Reason = CloseReason(objectBody[3])
return nil
}
func (o *CloseObject) Serialize() []uint8 {
- closeObjectHeader := NewCommonObjectHeader(OC_CLOSE, o.ObjectType, o.Len())
+ closeObjectHeader := NewCommonObjectHeader(ObjectClassClose, o.ObjectType, o.Len())
byteCloseObjectHeader := closeObjectHeader.Serialize()
buf := make([]uint8, 4)
- buf[3] = o.Reason
+ buf[3] = uint8(o.Reason)
byteCloseObject := AppendByteSlices(byteCloseObjectHeader, buf)
return byteCloseObject
}
func (o *CloseObject) Len() uint16 {
// CommonObjectHeader(4byte) + CloseObjectBody(4byte)
- return COMMON_OBJECT_HEADER_LENGTH + 4
+ return commonObjectHeaderLength + 4
}
-func NewCloseObject(reason uint8) (*CloseObject, error) {
+func NewCloseObject(reason CloseReason) (*CloseObject, error) {
o := &CloseObject{
- ObjectType: OT_CLOSE_CLOSE,
+ ObjectType: ObjectTypeCloseClose,
Reason: reason,
}
return o, nil
@@ -450,17 +543,17 @@ func NewCloseObject(reason uint8) (*CloseObject, error) {
// SRP Object (RFC8231 7.2)
const (
- OT_SRP_SRP uint8 = 0x01
+ ObjectTypeSRPSRP ObjectType = 0x01
)
type SrpObject struct {
- ObjectType uint8
+ ObjectType ObjectType
RFlag bool
SrpID uint32 // 0x00000000 and 0xFFFFFFFF are reserved.
TLVs []TLVInterface
}
-func (o *SrpObject) DecodeFromBytes(typ uint8, objectBody []uint8) error {
+func (o *SrpObject) DecodeFromBytes(typ ObjectType, objectBody []uint8) error {
o.ObjectType = typ
o.RFlag = (objectBody[3] & 0x01) != 0
o.SrpID = binary.BigEndian.Uint32(objectBody[4:8])
@@ -468,7 +561,7 @@ func (o *SrpObject) DecodeFromBytes(typ uint8, objectBody []uint8) error {
}
func (o *SrpObject) Serialize() []uint8 {
- srpObjectHeader := NewCommonObjectHeader(OC_SRP, o.ObjectType, o.Len())
+ srpObjectHeader := NewCommonObjectHeader(ObjectClassSRP, o.ObjectType, o.Len())
byteSrpObjectHeader := srpObjectHeader.Serialize()
byteFlags := make([]uint8, 4)
@@ -492,12 +585,12 @@ func (o *SrpObject) Len() uint16 {
tlvsByteLength += tlv.Len()
}
// CommonObjectHeader(4byte) + Flags, SRP-ID(8byte)
- return COMMON_OBJECT_HEADER_LENGTH + 8 + tlvsByteLength
+ return commonObjectHeaderLength + 8 + tlvsByteLength
}
func NewSrpObject(segs []table.Segment, srpID uint32, isRemove bool) (*SrpObject, error) {
o := &SrpObject{
- ObjectType: OT_SRP_SRP,
+ ObjectType: ObjectTypeSRPSRP,
RFlag: isRemove, // RFC8281 5.2
SrpID: srpID,
TLVs: []TLVInterface{},
@@ -506,9 +599,9 @@ func NewSrpObject(segs []table.Segment, srpID uint32, isRemove bool) (*SrpObject
return o, nil
}
if _, ok := segs[0].(table.SegmentSRMPLS); ok {
- o.TLVs = append(o.TLVs, &PathSetupType{PathSetupType: PST_SR_TE})
+ o.TLVs = append(o.TLVs, &PathSetupType{PathSetupType: PathSetupTypeSRTE})
} else if _, ok := segs[0].(table.SegmentSRv6); ok {
- o.TLVs = append(o.TLVs, &PathSetupType{PathSetupType: PST_SRV6_TE})
+ o.TLVs = append(o.TLVs, &PathSetupType{PathSetupType: PathSetupTypeSRv6TE})
} else {
return nil, errors.New("invalid Segment type")
}
@@ -517,16 +610,16 @@ func NewSrpObject(segs []table.Segment, srpID uint32, isRemove bool) (*SrpObject
// LSP Object (RFC8281 5.3.1)
const (
- OT_LSP_LSP uint8 = 0x01
+ ObjectTypeLSPLSP ObjectType = 0x01
)
-type LspObject struct {
- ObjectType uint8
+type LSPObject struct {
+ ObjectType ObjectType
Name string
SrcAddr netip.Addr
DstAddr netip.Addr
PlspID uint32
- LspID uint16
+ LSPID uint16
CFlag bool
OFlag uint8
AFlag bool
@@ -536,7 +629,7 @@ type LspObject struct {
TLVs []TLVInterface
}
-func (o *LspObject) DecodeFromBytes(typ uint8, objectBody []uint8) error {
+func (o *LSPObject) DecodeFromBytes(typ ObjectType, objectBody []uint8) error {
o.ObjectType = typ
o.PlspID = uint32(binary.BigEndian.Uint32(objectBody[0:4]) >> 12) // 20 bits from top
o.OFlag = uint8(objectBody[3] & 0x0070 >> 4)
@@ -556,24 +649,24 @@ func (o *LspObject) DecodeFromBytes(typ uint8, objectBody []uint8) error {
if t, ok := tlv.(*SymbolicPathName); ok {
o.Name = t.Name
}
- if t, ok := tlv.(*IPv4LspIdentifiers); ok {
+ if t, ok := tlv.(*IPv4LSPIdentifiers); ok {
o.SrcAddr = t.IPv4TunnelSenderAddress
o.DstAddr = t.IPv4TunnelEndpointAddress
- o.LspID = t.LspID
+ o.LSPID = t.LSPID
}
- if t, ok := tlv.(*IPv6LspIdentifiers); ok {
+ if t, ok := tlv.(*IPv6LSPIdentifiers); ok {
o.SrcAddr = t.IPv6TunnelSenderAddress
o.DstAddr = t.IPv6TunnelEndpointAddress
- o.LspID = t.LspID
+ o.LSPID = t.LSPID
}
}
}
return nil
}
-func (o *LspObject) Serialize() []uint8 {
- lspObjectHeader := NewCommonObjectHeader(OC_LSP, o.ObjectType, o.Len())
- byteLspObjectHeader := lspObjectHeader.Serialize()
+func (o *LSPObject) Serialize() []uint8 {
+ lspObjectHeader := NewCommonObjectHeader(ObjectClassLSP, o.ObjectType, o.Len())
+ byteLSPObjectHeader := lspObjectHeader.Serialize()
buf := make([]uint8, 4)
binary.BigEndian.PutUint32(buf, uint32(o.PlspID<<12)+uint32(o.OFlag<<4))
@@ -597,11 +690,11 @@ func (o *LspObject) Serialize() []uint8 {
byteTLVs = AppendByteSlices(byteTLVs, tlv.Serialize())
}
- byteLspObject := AppendByteSlices(byteLspObjectHeader, buf, byteTLVs)
- return byteLspObject
+ byteLSPObject := AppendByteSlices(byteLSPObjectHeader, buf, byteTLVs)
+ return byteLSPObject
}
-func (o *LspObject) Len() uint16 {
+func (o *LSPObject) Len() uint16 {
tlvsByteLength := uint16(0)
for _, tlv := range o.TLVs {
tlvsByteLength += tlv.Len()
@@ -609,12 +702,12 @@ func (o *LspObject) Len() uint16 {
// Flags, SRP-ID (4byte)
lspObjectBodyLength := uint16(4) + tlvsByteLength
// CommonObjectHeader(4byte) + Flags, SRP-ID
- return uint16(COMMON_OBJECT_HEADER_LENGTH) + lspObjectBodyLength
+ return uint16(commonObjectHeaderLength) + lspObjectBodyLength
}
-func NewLspObject(lspName string, color *uint32, plspID uint32) (*LspObject, error) {
- o := &LspObject{
- ObjectType: OT_LSP_LSP,
+func NewLSPObject(lspName string, color *uint32, plspID uint32) (*LSPObject, error) {
+ o := &LSPObject{
+ ObjectType: ObjectTypeLSPLSP,
Name: lspName,
PlspID: plspID,
CFlag: true, // (RFC8281 5.3.1)
@@ -644,7 +737,7 @@ func NewLspObject(lspName string, color *uint32, plspID uint32) (*LspObject, err
}
// (I.D.draft-ietf-pce-pcep-color-12)
-func (o *LspObject) Color() uint32 {
+func (o *LSPObject) Color() uint32 {
for _, tlv := range o.TLVs {
if t, ok := tlv.(*Color); ok {
return t.Color
@@ -656,23 +749,23 @@ func (o *LspObject) Color() uint32 {
// ERO Object (RFC5440 7.9)
const (
- OT_ERO_EXPLICIT_ROUTE uint8 = 0x01
+ ObjectTypeEROExplicitRoute ObjectType = 0x01
)
type EroObject struct {
- ObjectType uint8
+ ObjectType ObjectType
EroSubobjects []EroSubobject
}
-func (o *EroObject) DecodeFromBytes(typ uint8, objectBody []uint8) error {
+func (o *EroObject) DecodeFromBytes(typ ObjectType, objectBody []uint8) error {
o.ObjectType = typ
if len(objectBody) == 0 {
return nil
}
for {
var eroSubobj EroSubobject
- switch objectBody[0] & 0x7f {
- case OT_ERO_SR:
+ switch SubObjectType(objectBody[0] & 0x7f) {
+ case SubObjectTypeEROSR:
eroSubobj = &SREroSubobject{}
case OT_ERO_SRV6:
eroSubobj = &SRv6EroSubobject{}
@@ -701,7 +794,7 @@ func (o EroObject) Serialize() ([]uint8, error) {
if err != nil {
return nil, err
}
- eroObjectHeader := NewCommonObjectHeader(OC_ERO, o.ObjectType, eroObjectLength)
+ eroObjectHeader := NewCommonObjectHeader(ObjectClassERO, o.ObjectType, eroObjectLength)
byteEroObjectHeader := eroObjectHeader.Serialize()
byteEroObject := byteEroObjectHeader
@@ -722,12 +815,12 @@ func (o EroObject) Len() (uint16, error) {
eroSubobjByteLength += objByteLength
}
// CommonObjectHeader(4byte) + eroSubobjects(valiable)
- return uint16(COMMON_OBJECT_HEADER_LENGTH) + eroSubobjByteLength, nil
+ return uint16(commonObjectHeaderLength) + eroSubobjByteLength, nil
}
func NewEroObject(segmentList []table.Segment) (*EroObject, error) {
o := &EroObject{
- ObjectType: OT_ERO_EXPLICIT_ROUTE,
+ ObjectType: ObjectTypeEROExplicitRoute,
EroSubobjects: []EroSubobject{},
}
err := o.AddEroSubobjects(segmentList)
@@ -786,58 +879,87 @@ func NewEroSubobject(seg table.Segment) (EroSubobject, error) {
// SR-ERO Subobject (RFC8664 4.3.1)
const (
- OT_ERO_SR uint8 = 0x24
+ SubObjectTypeEROSR SubObjectType = 0x24
)
+type NAITypeSR uint8
+
const (
- NT_ABSENT uint8 = 0x00 // RFC 8664 4.3.1
- NT_IPV4_NODE uint8 = 0x01 // RFC 8664 4.3.1
- NT_IPV6_NODE uint8 = 0x02 // RFC 8664 4.3.1
- NT_IPV4_ADJACENCY uint8 = 0x03 // RFC 8664 4.3.1
- NT_IPV6_ADJACENCY_GLOBAL uint8 = 0x04 // RFC 8664 4.3.1
- NT_UNNUMBERED_ADJACENCY uint8 = 0x05 // RFC 8664 4.3.1
- NT_IPV6_ADJACENCY_LINKLOCAL uint8 = 0x06 // RFC 8664 4.3.1
+ NAITypeSRAbsent NAITypeSR = 0x00
+ NAITypeSRIPv4Node NAITypeSR = 0x01
+ NAITypeSRIPv6Node NAITypeSR = 0x02
+ NAITypeSRIPv4Adjacency NAITypeSR = 0x03
+ NAITypeSRIPv6AdjacencyGlobal NAITypeSR = 0x04
+ NAITypeSRUnnumberedAdjacency NAITypeSR = 0x05
+ NAITypeSRIPv6AdjacencyLinkLocal NAITypeSR = 0x06
)
+var naiTypeSRDescriptions = map[NAITypeSR]struct {
+ Description string
+ Reference string
+}{
+ NAITypeSRAbsent: {"NAI is absent", "RFC8664"},
+ NAITypeSRIPv4Node: {"NAI is an IPv4 node ID", "RFC8664"},
+ NAITypeSRIPv6Node: {"NAI is an IPv6 node ID", "RFC8664"},
+ NAITypeSRIPv4Adjacency: {"NAI is an IPv4 adjacency", "RFC8664"},
+ NAITypeSRIPv6AdjacencyGlobal: {"NAI is an IPv6 adjacency with global IPv6 addresses", "RFC8664"},
+ NAITypeSRUnnumberedAdjacency: {"NAI is an unnumbered adjacency with IPv4 node IDs", "RFC8664"},
+ NAITypeSRIPv6AdjacencyLinkLocal: {"NAI is an IPv6 adjacency with link-local IPv6 addresses", "RFC8664"},
+}
+
+func (nt NAITypeSR) String() string {
+ if desc, ok := naiTypeSRDescriptions[nt]; ok {
+ return fmt.Sprintf("%s (0x%02x)", desc.Description, uint8(nt))
+ }
+ return fmt.Sprintf("Unknown NAI Type (0x%02x)", uint8(nt))
+}
+
+func (nt NAITypeSR) StringWithReference() string {
+ if desc, ok := naiTypeSRDescriptions[nt]; ok {
+ return fmt.Sprintf("%s (0x%02x) [%s]", desc.Description, uint8(nt), desc.Reference)
+ }
+ return fmt.Sprintf("Unknown NAI Type (0x%02x)", uint8(nt))
+}
+
type SREroSubobject struct {
LFlag bool
- SubobjectType uint8
+ SubobjectType SubObjectType
Length uint8
- NaiType uint8
+ NAIType NAITypeSR
FFlag bool
SFlag bool
CFlag bool
MFlag bool
Segment table.SegmentSRMPLS
- Nai netip.Addr
+ NAI netip.Addr
}
-func (o *SREroSubobject) DecodeFromBytes(subObj []uint8) error {
- o.LFlag = (subObj[0] & 0x80) != 0
- o.SubobjectType = subObj[0] & 0x7f
- o.Length = subObj[1]
- o.NaiType = subObj[2] >> 4
- o.FFlag = (subObj[3] & 0x08) != 0
- o.SFlag = (subObj[3] & 0x04) != 0
- o.CFlag = (subObj[3] & 0x02) != 0
- o.MFlag = (subObj[3] & 0x01) != 0
+func (o *SREroSubobject) DecodeFromBytes(subObject []uint8) error {
+ o.LFlag = (subObject[0] & 0x80) != 0
+ o.SubobjectType = SubObjectType(subObject[0] & 0x7f)
+ o.Length = subObject[1]
+ o.NAIType = NAITypeSR(subObject[2] >> 4)
+ o.FFlag = (subObject[3] & 0x08) != 0
+ o.SFlag = (subObject[3] & 0x04) != 0
+ o.CFlag = (subObject[3] & 0x02) != 0
+ o.MFlag = (subObject[3] & 0x01) != 0
- sid := binary.BigEndian.Uint32(subObj[4:8]) >> 12
+ sid := binary.BigEndian.Uint32(subObject[4:8]) >> 12
o.Segment = table.NewSegmentSRMPLS(sid)
- if o.NaiType == 1 {
- o.Nai, _ = netip.AddrFromSlice(subObj[8:12])
+ if o.NAIType == NAITypeSRIPv4Node {
+ o.NAI, _ = netip.AddrFromSlice(subObject[8:12])
}
return nil
}
func (o *SREroSubobject) Serialize() []uint8 {
buf := make([]uint8, 4)
- buf[0] = o.SubobjectType
+ buf[0] = uint8(o.SubobjectType)
if o.LFlag {
buf[0] = buf[0] | 0x80
}
buf[1] = o.Length
- buf[2] = o.NaiType * 16
+ buf[2] = uint8(o.NAIType) * 16
if o.FFlag {
buf[3] = buf[3] | 0x08
}
@@ -858,15 +980,15 @@ func (o *SREroSubobject) Serialize() []uint8 {
}
func (o *SREroSubobject) Len() (uint16, error) {
- switch o.NaiType {
- case NT_ABSENT:
+ switch o.NAIType {
+ case NAITypeSRAbsent:
// Type, Length, Flags (4byte) + SID (4byte)
return uint16(8), nil
- case NT_IPV4_NODE:
- // Type, Length, Flags (4byte) + SID (4byte) + Nai (4byte)
+ case NAITypeSRIPv4Node:
+ // Type, Length, Flags (4byte) + SID (4byte) + NAI (4byte)
return uint16(12), nil
- case NT_IPV6_NODE:
- // Type, Length, Flags (4byte) + SID (4byte) + Nai (16byte)
+ case NAITypeSRIPv6Node:
+ // Type, Length, Flags (4byte) + SID (4byte) + NAI (16byte)
return uint16(24), nil
default:
return uint16(0), errors.New("unsupported naitype")
@@ -876,9 +998,9 @@ func (o *SREroSubobject) Len() (uint16, error) {
func NewSREroSubObject(seg table.SegmentSRMPLS) (*SREroSubobject, error) {
subo := &SREroSubobject{
LFlag: false,
- SubobjectType: OT_ERO_SR,
- NaiType: NT_ABSENT,
- FFlag: true, // Nai is absent
+ SubobjectType: SubObjectTypeEROSR,
+ NAIType: NAITypeSRAbsent,
+ FFlag: true, // NAI is absent
SFlag: false,
CFlag: false,
MFlag: true, // TODO: Determine either MPLS label or index
@@ -898,21 +1020,47 @@ func (o *SREroSubobject) ToSegment() table.Segment {
// SRv6-ERO Subobject (RFC9603 4.3.1)
const (
- OT_ERO_SRV6 uint8 = 0x28
+ OT_ERO_SRV6 SubObjectType = 0x28
)
+type NAITypeSRv6 uint8
+
const (
- NT_MUST_NOT_BE_INCLUDED uint8 = 0x00 // draft-ietf-pce-segment-routing-ipv6 4.3.1
- NT_SRV6_NODE uint8 = 0x02 // draft-ietf-pce-segment-routing-ipv6 4.3.1
- NT_SRV6_ADJACENCY_GLOBAL uint8 = 0x04 // draft-ietf-pce-segment-routing-ipv6 4.3.1
- NT_SRV6_ADJACENCY_LINKLOCAL uint8 = 0x06 // draft-ietf-pce-segment-routing-ipv6 4.3.1
+ NAITypeSRv6Absent NAITypeSRv6 = 0x00
+ NAITypeSRv6IPv6Node NAITypeSRv6 = 0x02
+ NAITypeSRv6IPv6AdjacencyGlobal NAITypeSRv6 = 0x04
+ NAITypeSRv6IPv6AdjacencyLinkLocal NAITypeSRv6 = 0x06
)
+var naiTypeSRv6Descriptions = map[NAITypeSRv6]struct {
+ Description string
+ Reference string
+}{
+ NAITypeSRv6Absent: {"NAI is absent", "RFC9603"},
+ NAITypeSRv6IPv6Node: {"NAI is an IPv6 node ID", "RFC9603"},
+ NAITypeSRv6IPv6AdjacencyGlobal: {"NAI is an IPv6 adjacency with global IPv6 addresses", "RFC9603"},
+ NAITypeSRv6IPv6AdjacencyLinkLocal: {"NAI is an IPv6 adjacency with link-local IPv6 addresses", "RFC9603"},
+}
+
+func (nt NAITypeSRv6) String() string {
+ if desc, ok := naiTypeSRv6Descriptions[nt]; ok {
+ return fmt.Sprintf("%s (0x%02x)", desc.Description, uint8(nt))
+ }
+ return fmt.Sprintf("Unknown NAI Type (0x%02x)", uint8(nt))
+}
+
+func (nt NAITypeSRv6) StringWithReference() string {
+ if desc, ok := naiTypeSRv6Descriptions[nt]; ok {
+ return fmt.Sprintf("%s (0x%02x) [%s]", desc.Description, uint8(nt), desc.Reference)
+ }
+ return fmt.Sprintf("Unknown NAI Type (0x%02x)", uint8(nt))
+}
+
type SRv6EroSubobject struct {
LFlag bool
- SubobjectType uint8
+ SubobjectType SubObjectType
Length uint8
- NaiType uint8
+ NAIType NAITypeSRv6
VFlag bool
TFlag bool
FFlag bool
@@ -920,36 +1068,36 @@ type SRv6EroSubobject struct {
Segment table.SegmentSRv6
}
-func (o *SRv6EroSubobject) DecodeFromBytes(subObj []uint8) error {
- o.LFlag = (subObj[0] & 0x80) != 0
- o.SubobjectType = subObj[0] & 0x7f
- o.Length = subObj[1]
- o.NaiType = subObj[2] >> 4
- o.VFlag = (subObj[3] & 0x08) != 0
- o.TFlag = (subObj[3] & 0x04) != 0
- o.FFlag = (subObj[3] & 0x02) != 0
- o.SFlag = (subObj[3] & 0x01) != 0
+func (o *SRv6EroSubobject) DecodeFromBytes(subObject []uint8) error {
+ o.LFlag = (subObject[0] & 0x80) != 0
+ o.SubobjectType = SubObjectType(subObject[0] & 0x7f)
+ o.Length = subObject[1]
+ o.NAIType = NAITypeSRv6(subObject[2] >> 4)
+ o.VFlag = (subObject[3] & 0x08) != 0
+ o.TFlag = (subObject[3] & 0x04) != 0
+ o.FFlag = (subObject[3] & 0x02) != 0
+ o.SFlag = (subObject[3] & 0x01) != 0
- sid, _ := netip.AddrFromSlice(subObj[8:24])
+ sid, _ := netip.AddrFromSlice(subObject[8:24])
o.Segment = table.NewSegmentSRv6(sid)
- if o.NaiType == NT_SRV6_NODE {
- o.Segment.LocalAddr, _ = netip.AddrFromSlice(subObj[24:40])
+ if o.NAIType == NAITypeSRv6IPv6Node {
+ o.Segment.LocalAddr, _ = netip.AddrFromSlice(subObject[24:40])
}
- if o.NaiType == NT_SRV6_ADJACENCY_GLOBAL {
- o.Segment.LocalAddr, _ = netip.AddrFromSlice(subObj[24:40])
- o.Segment.RemoteAddr, _ = netip.AddrFromSlice(subObj[40:56])
+ if o.NAIType == NAITypeSRv6IPv6AdjacencyGlobal {
+ o.Segment.LocalAddr, _ = netip.AddrFromSlice(subObject[24:40])
+ o.Segment.RemoteAddr, _ = netip.AddrFromSlice(subObject[40:56])
}
return nil
}
func (o *SRv6EroSubobject) Serialize() []uint8 {
buf := make([]uint8, 4)
- buf[0] = o.SubobjectType
+ buf[0] = uint8(o.SubobjectType)
if o.LFlag {
buf[0] = buf[0] | 0x80
}
buf[1] = o.Length
- buf[2] = o.NaiType * 16
+ buf[2] = uint8(o.NAIType) * 16
if o.VFlag {
buf[3] = buf[3] | 0x08
}
@@ -967,11 +1115,11 @@ func (o *SRv6EroSubobject) Serialize() []uint8 {
binary.BigEndian.PutUint16(behavior, o.Segment.Behavior())
byteSid := o.Segment.Sid.AsSlice()
- byteNai := []uint8{}
+ byteNAI := []uint8{}
if o.Segment.LocalAddr.IsValid() {
- byteNai = append(byteNai, o.Segment.LocalAddr.AsSlice()...)
+ byteNAI = append(byteNAI, o.Segment.LocalAddr.AsSlice()...)
if o.Segment.RemoteAddr.IsValid() {
- byteNai = append(byteNai, o.Segment.RemoteAddr.AsSlice()...)
+ byteNAI = append(byteNAI, o.Segment.RemoteAddr.AsSlice()...)
}
}
@@ -981,7 +1129,7 @@ func (o *SRv6EroSubobject) Serialize() []uint8 {
byteSidStructure = append(byteSidStructure, make([]uint8, 4)...)
}
- byteSRv6EroSubobject := AppendByteSlices(buf, reserved, behavior, byteSid, byteNai, byteSidStructure)
+ byteSRv6EroSubobject := AppendByteSlices(buf, reserved, behavior, byteSid, byteNAI, byteSidStructure)
return byteSRv6EroSubobject
}
@@ -997,14 +1145,14 @@ func (o *SRv6EroSubobject) Len() (uint16, error) {
}
// NAI value in the subobject body is NOT absent
if !o.FFlag {
- switch o.NaiType {
- case NT_IPV6_NODE:
+ switch o.NAIType {
+ case NAITypeSRv6IPv6Node:
length += 16
- case NT_SRV6_ADJACENCY_GLOBAL:
+ case NAITypeSRv6IPv6AdjacencyGlobal:
length += 32
- case NT_SRV6_ADJACENCY_LINKLOCAL:
+ case NAITypeSRv6IPv6AdjacencyLinkLocal:
length += 40
- case NT_MUST_NOT_BE_INCLUDED:
+ case NAITypeSRv6Absent:
return uint16(0), errors.New("when naitype is 0 then FFlag must be 1")
default:
return uint16(0), errors.New("unsupported naitype")
@@ -1031,18 +1179,18 @@ func NewSRv6EroSubObject(seg table.SegmentSRv6) (*SRv6EroSubobject, error) {
subo.TFlag = false
}
if seg.LocalAddr.IsValid() {
- subo.FFlag = false // Nai is present
+ subo.FFlag = false // NAI is present
if seg.RemoteAddr.IsValid() {
// End.X or uA
- subo.NaiType = NT_SRV6_ADJACENCY_GLOBAL
+ subo.NAIType = NAITypeSRv6IPv6AdjacencyGlobal
} else {
// End or uN
- subo.NaiType = NT_SRV6_NODE
+ subo.NAIType = NAITypeSRv6IPv6Node
}
} else {
subo.FFlag = true // SID is absent
- subo.NaiType = NT_MUST_NOT_BE_INCLUDED
+ subo.NAIType = NAITypeSRv6Absent
}
length, err := subo.Len()
@@ -1059,12 +1207,12 @@ func (o *SRv6EroSubobject) ToSegment() table.Segment {
// END-POINTS Object (RFC5440 7.6)
const (
- OT_EP_IPV4 uint8 = 1
- OT_EP_IPV6 uint8 = 2
+ ObjectTypeEndpointIPv4 ObjectType = 0x01
+ ObjectTypeEndpointIPv6 ObjectType = 0x02
)
type EndpointsObject struct {
- ObjectType uint8
+ ObjectType ObjectType
SrcAddr netip.Addr
DstAddr netip.Addr
}
@@ -1074,7 +1222,7 @@ func (o *EndpointsObject) Serialize() ([]uint8, error) {
if err != nil {
return nil, err
}
- endpointsObjectHeader := NewCommonObjectHeader(OC_END_POINTS, o.ObjectType, endpointsObjectLength)
+ endpointsObjectHeader := NewCommonObjectHeader(ObjectClassEndpoints, o.ObjectType, endpointsObjectLength)
byteEroObjectHeader := endpointsObjectHeader.Serialize()
byteEndpointsObject := AppendByteSlices(byteEroObjectHeader, o.SrcAddr.AsSlice(), o.DstAddr.AsSlice())
@@ -1085,10 +1233,10 @@ func (o EndpointsObject) Len() (uint16, error) {
var length uint16
if o.SrcAddr.Is4() && o.DstAddr.Is4() {
// CommonObjectHeader(4byte) + srcIPv4 (4byte) + dstIPv4 (4byte)
- length = COMMON_OBJECT_HEADER_LENGTH + 4 + 4
+ length = commonObjectHeaderLength + 4 + 4
} else if o.SrcAddr.Is6() && o.DstAddr.Is6() {
// CommonObjectHeader(4byte) + srcIPv4 (16byte) + dstIPv4 (16byte)
- length = COMMON_OBJECT_HEADER_LENGTH + 16 + 16
+ length = commonObjectHeaderLength + 16 + 16
} else {
return uint16(0), errors.New("invalid endpoints address")
}
@@ -1096,17 +1244,17 @@ func (o EndpointsObject) Len() (uint16, error) {
}
func NewEndpointsObject(dstAddr netip.Addr, srcAddr netip.Addr) (*EndpointsObject, error) {
- var objType uint8
+ var objectType ObjectType
if dstAddr.Is4() && srcAddr.Is4() {
- objType = OT_EP_IPV4
+ objectType = ObjectTypeEndpointIPv4
} else if dstAddr.Is6() && srcAddr.Is6() {
- objType = OT_EP_IPV6
+ objectType = ObjectTypeEndpointIPv6
} else {
return nil, errors.New("invalid endpoints address")
}
o := &EndpointsObject{
- ObjectType: objType,
+ ObjectType: objectType,
DstAddr: dstAddr,
SrcAddr: srcAddr,
}
@@ -1115,40 +1263,33 @@ func NewEndpointsObject(dstAddr netip.Addr, srcAddr netip.Addr) (*EndpointsObjec
// ASSOCIATION Object (RFC8697 6.)
const (
- OT_ASSOC_IPV4 uint8 = 1
- OT_ASSOC_IPV6 uint8 = 2
+ ObjectTypeAssociationIPv4 ObjectType = 0x01
+ ObjectTypeAssociationIPv6 ObjectType = 0x02
)
const (
- ASSOC_TYPE_SR_POLICY_ASSOCIATION uint16 = 0x06
-)
-
-// Juniper specific TLV (deprecated)
-const (
- JUNIPER_SPEC_TLV_EXTENDED_ASSOCIATION_ID uint16 = 65507
- JUNIPER_SPEC_TLV_SRPOLICY_CPATH_ID uint16 = 65508
- JUNIPER_SPEC_TLV_SRPOLICY_CPATH_PREFERENCE uint16 = 65509
-
- JUNIPER_SPEC_ASSOC_TYPE_SR_POLICY_ASSOCIATION uint16 = 65505
+ AssociationTypeSRPolicyAssociation AssocType = 0x06
+ AssociationTypeSRPolicyAssociationCisco AssocType = 0x14
+ AssociationTypeSRPolicyAssociationJuniper AssocType = 0xffe1 // Juniper specific TLV (deprecated)
)
type AssociationObject struct {
- ObjectType uint8
+ ObjectType ObjectType
RFlag bool
- AssocType uint16
+ AssocType AssocType
AssocID uint16
AssocSrc netip.Addr
TLVs []TLVInterface
}
-func (o *AssociationObject) DecodeFromBytes(typ uint8, objectBody []uint8) error {
+func (o *AssociationObject) DecodeFromBytes(typ ObjectType, objectBody []uint8) error {
o.ObjectType = typ
o.RFlag = (objectBody[3] & 0x01) != 0
- o.AssocType = uint16(binary.BigEndian.Uint16(objectBody[4:6]))
+ o.AssocType = AssocType(binary.BigEndian.Uint16(objectBody[4:6]))
o.AssocID = uint16(binary.BigEndian.Uint16(objectBody[6:8]))
switch o.ObjectType {
- case OT_ASSOC_IPV4:
+ case ObjectTypeAssociationIPv4:
assocSrcBytes, _ := netip.AddrFromSlice(objectBody[8:12])
o.AssocSrc = assocSrcBytes
if len(objectBody) > 12 {
@@ -1158,7 +1299,7 @@ func (o *AssociationObject) DecodeFromBytes(typ uint8, objectBody []uint8) error
return err
}
}
- case OT_ASSOC_IPV6:
+ case ObjectTypeAssociationIPv6:
o.AssocSrc, _ = netip.AddrFromSlice(objectBody[8:24])
if len(objectBody) > 24 {
byteTLVs := objectBody[24:]
@@ -1179,7 +1320,7 @@ func (o *AssociationObject) Serialize() ([]uint8, error) {
if err != nil {
return nil, err
}
- associationObjectHeader := NewCommonObjectHeader(OC_ASSOCIATION, o.ObjectType, associationObjectLength)
+ associationObjectHeader := NewCommonObjectHeader(ObjectClassAssociation, o.ObjectType, associationObjectLength)
byteAssociationObjectHeader := associationObjectHeader.Serialize()
@@ -1189,7 +1330,7 @@ func (o *AssociationObject) Serialize() ([]uint8, error) {
buf[4] = buf[4] | 0x01
}
- assocType := Uint16ToByteSlice(o.AssocType)
+ assocType := Uint16ToByteSlice(uint16(o.AssocType))
assocID := Uint16ToByteSlice(o.AssocID)
byteTLVs := []uint8{}
@@ -1218,45 +1359,45 @@ func (o AssociationObject) Len() (uint16, error) {
} else {
return uint16(0), errors.New("invalid association source address")
}
- return (COMMON_OBJECT_HEADER_LENGTH + associationObjectBodyLength), nil
+ return (commonObjectHeaderLength + associationObjectBodyLength), nil
}
func NewAssociationObject(srcAddr netip.Addr, dstAddr netip.Addr, color uint32, preference uint32, opt ...Opt) (*AssociationObject, error) {
opts := optParams{
- pccType: RFC_COMPLIANT,
+ pccType: RFCCompliant,
}
for _, o := range opt {
o(&opts)
}
- var objType uint8
+ var objectType ObjectType
if dstAddr.Is4() && srcAddr.Is4() {
- objType = OT_EP_IPV4
+ objectType = ObjectTypeEndpointIPv4
} else if dstAddr.Is6() && srcAddr.Is6() {
- objType = OT_EP_IPV6
+ objectType = ObjectTypeEndpointIPv6
} else {
return nil, errors.New("invalid endpoints address")
}
o := &AssociationObject{
- ObjectType: objType,
+ ObjectType: objectType,
RFlag: false,
TLVs: []TLVInterface{},
AssocSrc: srcAddr,
}
- if opts.pccType == JUNIPER_LEGACY {
+ if opts.pccType == JuniperLegacy {
o.AssocID = 0
- o.AssocType = JUNIPER_SPEC_ASSOC_TYPE_SR_POLICY_ASSOCIATION
+ o.AssocType = AssociationTypeSRPolicyAssociationJuniper
associationObjectTLVs := []TLVInterface{
&UndefinedTLV{
- Typ: JUNIPER_SPEC_TLV_EXTENDED_ASSOCIATION_ID,
- Length: TLV_EXTENDED_ASSOCIATION_ID_IPV4_LENGTH, // JUNIPER_LEGACY has only IPv4 implementation
+ Typ: TLVExtendedAssociationIDIPv4Juniper,
+ Length: TLVExtendedAssociationIDIPv4ValueLength, // JuniperLegacy has only IPv4 implementation
Value: AppendByteSlices(
Uint32ToByteSlice(color), dstAddr.AsSlice(),
),
},
&UndefinedTLV{
- Typ: JUNIPER_SPEC_TLV_SRPOLICY_CPATH_ID,
- Length: TLV_SRPOLICY_CPATH_ID_LENGTH,
+ Typ: TLVSRPolicyCPathIDJuniper,
+ Length: TLVSRPolicyCPathIDValueLength,
Value: []uint8{
0x00, // protocol origin
0x00, 0x00, 0x00, // mbz
@@ -1266,15 +1407,15 @@ func NewAssociationObject(srcAddr netip.Addr, dstAddr netip.Addr, color uint32,
},
},
&UndefinedTLV{
- Typ: JUNIPER_SPEC_TLV_SRPOLICY_CPATH_PREFERENCE,
- Length: TLV_SRPOLICY_CPATH_PREFERENCE_LENGTH,
+ Typ: TLVSRPolicyCPathPreferenceJuniper,
+ Length: TLVSRPolicyCPathPreferenceValueLength,
Value: Uint32ToByteSlice(preference),
},
}
o.TLVs = append(o.TLVs, associationObjectTLVs...)
} else {
- o.AssocID = 1 // (I.D. pce-segment-routing-policy-cp-07 5.1)
- o.AssocType = ASSOC_TYPE_SR_POLICY_ASSOCIATION // (I.D. pce-segment-routing-policy-cp-07 5.1)
+ o.AssocID = 1 // (I.D. pce-segment-routing-policy-cp-07 5.1)
+ o.AssocType = AssociationTypeSRPolicyAssociation // (I.D. pce-segment-routing-policy-cp-07 5.1)
associationObjectTLVs := []TLVInterface{
&ExtendedAssociationID{
Color: color,
@@ -1297,7 +1438,7 @@ func NewAssociationObject(srcAddr netip.Addr, dstAddr netip.Addr, color uint32,
func (o *AssociationObject) Color() uint32 {
for _, tlv := range o.TLVs {
if t, ok := tlv.(*UndefinedTLV); ok {
- if t.Type() == JUNIPER_SPEC_TLV_EXTENDED_ASSOCIATION_ID {
+ if t.Type() == TLVExtendedAssociationIDIPv4Juniper {
return uint32(binary.BigEndian.Uint32(t.Value[:4]))
}
} else if t, ok := tlv.(*ExtendedAssociationID); ok {
@@ -1312,7 +1453,7 @@ func (o *AssociationObject) Color() uint32 {
func (o *AssociationObject) Preference() uint32 {
for _, tlv := range o.TLVs {
if t, ok := tlv.(*UndefinedTLV); ok {
- if t.Type() == JUNIPER_SPEC_TLV_SRPOLICY_CPATH_PREFERENCE {
+ if t.Type() == TLVSRPolicyCPathPreferenceJuniper {
return uint32(binary.BigEndian.Uint32(t.Value))
}
} else if t, ok := tlv.(*SRPolicyCandidatePathPreference); ok {
@@ -1333,26 +1474,20 @@ func (o *AssociationObject) Endpoint() netip.Addr {
// VENDOR-INFORMATION Object (RFC7470 4)
const (
- OT_VENDOR_SPECIFIC_CONSTRAINTS uint8 = 1
+ ObjectTypeVendorSpecificConstraints ObjectType = 0x01
)
const (
- EN_CISCO uint32 = 9
-
- CISCO_SPEC_TLV_COLOR uint16 = 1
- CISCO_SPEC_TLV_PREFERENCE uint16 = 3
-
- CISCO_SPEC_TLV_COLOR_LENGTH uint16 = 4
- CISCO_SPEC_TLV_PREFERENCE_LENGTH uint16 = 4
+ EnterpriseNumberCisco uint32 = 9
)
type VendorInformationObject struct {
- ObjectType uint8 // vendor specific constraints: 1
+ ObjectType ObjectType // vendor specific constraints: 1
EnterpriseNumber uint32
TLVs []TLVInterface
}
-func (o *VendorInformationObject) DecodeFromBytes(typ uint8, objectBody []uint8) error {
+func (o *VendorInformationObject) DecodeFromBytes(typ ObjectType, objectBody []uint8) error {
o.ObjectType = typ
o.EnterpriseNumber = binary.BigEndian.Uint32(objectBody[0:4])
if len(objectBody) > 4 {
@@ -1367,7 +1502,7 @@ func (o *VendorInformationObject) DecodeFromBytes(typ uint8, objectBody []uint8)
}
func (o *VendorInformationObject) Serialize() []uint8 {
- vendorInformationObjectHeader := NewCommonObjectHeader(OC_VENDOR_INFORMATION, o.ObjectType, o.Len())
+ vendorInformationObjectHeader := NewCommonObjectHeader(ObjectClassVendorInformation, o.ObjectType, o.Len())
byteVendorInformationObjectHeader := vendorInformationObjectHeader.Serialize()
enterpriseNumber := Uint32ToByteSlice(o.EnterpriseNumber)
@@ -1386,27 +1521,27 @@ func (o *VendorInformationObject) Serialize() []uint8 {
func (o VendorInformationObject) Len() uint16 {
// TODO: Expantion for IPv6 Endpoint
// CommonObjectHeader(4byte) + Enterprise Number (4byte) + colorTLV (8byte) + preferenceTLV (8byte)
- return uint16(COMMON_OBJECT_HEADER_LENGTH + 4 + 8 + 8)
+ return uint16(commonObjectHeaderLength + 4 + 8 + 8)
}
func NewVendorInformationObject(vendor PccType, color uint32, preference uint32) (*VendorInformationObject, error) {
o := &VendorInformationObject{ // for Cisco PCC
- ObjectType: OT_VENDOR_SPECIFIC_CONSTRAINTS, // (RFC7470 4)
+ ObjectType: ObjectTypeVendorSpecificConstraints, // (RFC7470 4)
TLVs: []TLVInterface{},
}
- if vendor == CISCO_LEGACY {
- o.EnterpriseNumber = EN_CISCO
+ if vendor == CiscoLegacy {
+ o.EnterpriseNumber = EnterpriseNumberCisco
vendorInformationObjectTLVs := []TLVInterface{
&UndefinedTLV{
- Typ: CISCO_SPEC_TLV_COLOR,
- Length: CISCO_SPEC_TLV_COLOR_LENGTH, // TODO: 20 if ipv6 endpoint
+ Typ: SubTLVColorCisco,
+ Length: SubTLVColorCiscoValueLength, // TODO: 20 if ipv6 endpoint
Value: AppendByteSlices(
Uint32ToByteSlice(color),
),
},
&UndefinedTLV{
- Typ: CISCO_SPEC_TLV_PREFERENCE,
- Length: CISCO_SPEC_TLV_PREFERENCE_LENGTH,
+ Typ: SubTLVPreferenceCisco,
+ Length: SubTLVPreferenceCiscoValueLength,
Value: Uint32ToByteSlice(preference),
},
}
@@ -1420,7 +1555,7 @@ func NewVendorInformationObject(vendor PccType, color uint32, preference uint32)
func (o *VendorInformationObject) Color() uint32 {
for _, tlv := range o.TLVs {
if t, ok := tlv.(*UndefinedTLV); ok {
- if t.Type() == CISCO_SPEC_TLV_COLOR {
+ if t.Type() == SubTLVColorCisco {
return uint32(binary.BigEndian.Uint32(t.Value))
}
}
@@ -1431,10 +1566,22 @@ func (o *VendorInformationObject) Color() uint32 {
func (o *VendorInformationObject) Preference() uint32 {
for _, tlv := range o.TLVs {
if t, ok := tlv.(*UndefinedTLV); ok {
- if t.Type() == CISCO_SPEC_TLV_PREFERENCE {
+ if t.Type() == SubTLVPreferenceCisco {
return uint32(binary.BigEndian.Uint32(t.Value))
}
}
}
return 0
}
+
+type optParams struct {
+ pccType PccType
+}
+
+type Opt func(*optParams)
+
+func VendorSpecific(pt PccType) Opt {
+ return func(op *optParams) {
+ op.pccType = pt
+ }
+}
diff --git a/pkg/packet/pcep/tlv.go b/pkg/packet/pcep/tlv.go
index b9494421..6673c98a 100644
--- a/pkg/packet/pcep/tlv.go
+++ b/pkg/packet/pcep/tlv.go
@@ -17,130 +17,234 @@ import (
"go.uber.org/zap/zapcore"
)
+type TLVType uint16
+
const ( // PCEP TLV
- TLV_RESERVED uint16 = 0x00 // RFC5440
- TLV_NO_PATH_VECTOR uint16 = 0x01 // RFC5440
- TLV_OVERLOAD_DURATION uint16 = 0x02 // RFC5440
- TLV_REQ_MISSING uint16 = 0x03 // RFC5440
- TLV_OF_LIST uint16 = 0x04 // RFC5541
- TLV_ORDER uint16 = 0x05 // RFC5557
- TLV_P2MP_CAPABLE uint16 = 0x06 // RFC8306
- TLV_VENDOR_INFORMATION uint16 = 0x07 // RFC7470
- TLV_WAVELENGTH_SELECTION uint16 = 0x08 // RFC8780
- TLV_WAVELENGTH_RESTRICTION uint16 = 0x09 // RFC8780
- TLV_WAVELENGTH_ALLOCATION uint16 = 0x0a // RFC8780
- TLV_OPTICAL_INTERFACE_CLASS_LIST uint16 = 0x0b // RFC8780
- TLV_CLIENT_SIGNAL_INFORMATION uint16 = 0x0c // RFC8780
- TLV_H_PCE_CAPABILITY uint16 = 0x0d // RFC8685
- TLV_DOMAIN_ID uint16 = 0x0e // RFC8685
- TLV_H_PCE_FLAG uint16 = 0x0f // RFC8685
- TLV_STATEFUL_PCE_CAPABILITY uint16 = 0x10 // RFC8231
- TLV_SYMBOLIC_PATH_NAME uint16 = 0x11 // RFC8231
- TLV_IPV4_LSP_IDENTIFIERS uint16 = 0x12 // RFC8231
- TLV_IPV6_LSP_IDENTIFIERS uint16 = 0x13 // RFC8231
- TLV_LSP_ERROR_CODE uint16 = 0x14 // RFC8231
- TLV_RSVP_ERROR_SPEC uint16 = 0x15 // RFC8231
- TLV_LSP_DB_VERSION uint16 = 0x17 // RFC8232
- TLV_SPEAKER_ENTITY_ID uint16 = 0x18 // RFC8232
- TLV_SR_PCE_CAPABILITY uint16 = 0x1a // RFC8664
- TLV_PATH_SETUP_TYPE uint16 = 0x1c // RFC8408
- TLV_OPERATOR_CONFIGURED_ASSOCIATION_RANGE uint16 = 0x1d // RFC8697
- TLV_GLOBAL_ASSOCIATION_SOURCE uint16 = 0x1e // RFC8697
- TLV_EXTENDED_ASSOCIATION_ID uint16 = 0x1f // RFC8697
- TLV_P2MP_IPV4_LSP_IDENTIFIERS uint16 = 0x20 // RFC8623
- TLV_P2MP_IPV6_LSP_IDENTIFIERS uint16 = 0x21 // RFC8623
- TLV_PATH_SETUP_TYPE_CAPABILITY uint16 = 0x22 // RFC8408
- TLV_ASSOC_TYPE_LIST uint16 = 0x23 // RFC8697
- TLV_AUTO_BANDWIDTH_CAPABILITY uint16 = 0x24 // RFC8733
- TLV_AUTO_BANDWIDTH_ATTRIBUTES uint16 = 0x25 // RFC8733
- TLV_PATH_PROTECTION_ASSOCIATION_GROUP_TLV uint16 = 0x26 // RFC8745
- TLV_IPV4_ADDRESS uint16 = 0x27 // RFC8779
- TLV_IPV6_ADDRESS uint16 = 0x28 // RFC8779
- TLV_UNNUMBERED_ENDPOINT uint16 = 0x29 // RFC8779
- TLV_LABEL_REQUEST uint16 = 0x2a // RFC8779
- TLV_LABEL_SET uint16 = 0x2b // RFC8779
- TLV_PROTECTION_ATTRIBUTE uint16 = 0x2c // RFC8779
- TLV_GMPLS_CAPABILITY uint16 = 0x2d // RFC8779
- TLV_DISJOINTNESS_CONFIGURATION uint16 = 0x2e // RFC8800
- TLV_DISJOINTNESS_STATUS uint16 = 0x2f // RFC8800
- TLV_POLICY_PARAMETERSjTLV uint16 = 0x30 // RFC9005
- TLV_SCHED_LSP_ATTRIBUTE uint16 = 0x31 // RFC8934
- TLV_SCHED_PD_LSP_ATTRIBUTE uint16 = 0x32 // RFC8934
- TLV_PCE_FLOWSPEC_CAPABILITY uint16 = 0x33 // RFC9168
- TLV_FLOW_FILTER uint16 = 0x34 // RFC9168
- TLV_BIDIRECTIONAL_LSP_ASSOCIATION_GROUP uint16 = 0x36 // RFC9059
- TLV_TE_PATH_BINDING uint16 = 0x37 // RFC9604
- TLV_SRPOLICY_POL_NAME uint16 = 0x38 // ietf-pce-segment-routing-policy-cp-07
- TLV_SRPOLICY_CPATH_ID uint16 = 0x39 // ietf-pce-segment-routing-policy-cp-07
- TLV_SRPOLICY_CPATH_NAME uint16 = 0x3a // ietf-pce-segment-routing-policy-cp-07
- TLV_SRPOLICY_CPATH_PREFERENCE uint16 = 0x3b // ietf-pce-segment-routing-policy-cp-07
- TLV_MULTIPATH_CAP uint16 = 0x3c // ietf-pce-pcep-multipath-07
- TLV_MULTIPATH_WIGHT uint16 = 0x3d // ietf-pce-pcep-multipath-07
- TLV_MULTIPATH_BACKUP uint16 = 0x3e // ietf-pce-pcep-multipath-07
- TLV_LSP_EXTENDED_FLAG uint16 = 0x3f // RFC9357
- TLV_VIRTUAL_NETWORK_TLV uint16 = 0x41 // RFC9358
- TLV_SR_ALGORITHM uint16 = 0x42 // ietf-pce-sid-algo-12
- TLV_COLOR uint16 = 0x43 // ietf-pce-pcep-color-06
- TLV_COMPUTATION_PRIORITY uint16 = 0x44 // ietf-pce-segment-routing-policy-cp-14
- TLV_EXPLICIT_NULL_LABEL_POLICY uint16 = 0x45 // draft-ietf-pce-segment-routing-policy-cp-14
- TLV_INVALIDATION uint16 = 0x4c // draft-ietf-pce-segment-routing-policy-cp-14
- TLV_SRPOLICY_CAPABILITY uint16 = 0x4d // draft-ietf-pce-segment-routing-policy-cp-14
- TLV_PATH_RECOMPUTATION uint16 = 0x4e // draft-ietf-pce-circuit-style-pcep-extensions-03
- TLV_SR_P2MP_POLICY_CAPABILITY uint16 = 0x4f // draft-ietf-pce-sr-p2mp-policy-09
- TLV_IPV4_SR_P2MP_INSTANCE_ID uint16 = 0x50 // draft-ietf-pce-sr-p2mp-policy-09
- TLV_IPV6_SR_P2MP_INSTANCE_ID uint16 = 0x51 // draft-ietf-pce-sr-p2mp-policy-09
+ TLVNoPathVector TLVType = 0x01
+ TLVOverloadDuration TLVType = 0x02
+ TLVReqMissing TLVType = 0x03
+ TLVOFList TLVType = 0x04
+ TLVOrder TLVType = 0x05
+ TLVP2MPCapable TLVType = 0x06
+ TLVVendorInformation TLVType = 0x07
+ TLVWavelengthSelection TLVType = 0x08
+ TLVWavelengthRestriction TLVType = 0x09
+ TLVWavelengthAllocation TLVType = 0x0a
+ TLVOpticalInterfaceClassList TLVType = 0x0b
+ TLVClientSignalInformation TLVType = 0x0c
+ TLVHPceCapability TLVType = 0x0d
+ TLVDomainID TLVType = 0x0e
+ TLVHPceFlag TLVType = 0x0f
+ TLVStatefulPceCapability TLVType = 0x10
+ TLVSymbolicPathName TLVType = 0x11
+ TLVIPv4LSPIdentifiers TLVType = 0x12
+ TLVIPv6LSPIdentifiers TLVType = 0x13
+ TLVLSPErrorCode TLVType = 0x14
+ TLVRsvpErrorSpec TLVType = 0x15
+ TLVLSPDBVersion TLVType = 0x17
+ TLVSpeakerEntityID TLVType = 0x18
+ TLVSRPceCapability TLVType = 0x1a
+ TLVPathSetupType TLVType = 0x1c
+ TLVOperatorConfiguredAssociationRange TLVType = 0x1d
+ TLVGlobalAssociationSource TLVType = 0x1e
+ TLVExtendedAssociationID TLVType = 0x1f
+ TLVP2MPIPv4LSPIdentifiers TLVType = 0x20
+ TLVP2MPIPv6LSPIdentifiers TLVType = 0x21
+ TLVPathSetupTypeCapability TLVType = 0x22
+ TLVAssocTypeList TLVType = 0x23
+ TLVAutoBandwidthCapability TLVType = 0x24
+ TLVAutoBandwidthAttributes TLVType = 0x25
+ TLVPathProtectionAssociationGroupTLV TLVType = 0x26
+ TLVIPv4Address TLVType = 0x27
+ TLVIPv6Address TLVType = 0x28
+ TLVUnnumberedEndpoint TLVType = 0x29
+ TLVLabelRequest TLVType = 0x2a
+ TLVLabelSet TLVType = 0x2b
+ TLVProtectionAttribute TLVType = 0x2c
+ TLVGmplsCapability TLVType = 0x2d
+ TLVDisjointnessConfiguration TLVType = 0x2e
+ TLVDisjointnessStatus TLVType = 0x2f
+ TLVPolicyParameters TLVType = 0x30
+ TLVSchedLSPAttribute TLVType = 0x31
+ TLVSchedPdLSPAttribute TLVType = 0x32
+ TLVPceFlowspecCapability TLVType = 0x33
+ TLVFlowFilter TLVType = 0x34
+ TLVBidirectionalLSPAssociationGroup TLVType = 0x36
+ TLVTePathBinding TLVType = 0x37
+ TLVSRPolicyPolName TLVType = 0x38
+ TLVSRPolicyCPathID TLVType = 0x39
+ TLVSRPolicyCPathName TLVType = 0x3a
+ TLVSRPolicyCPathPreference TLVType = 0x3b
+ TLVMultipathCap TLVType = 0x3c
+ TLVMultipathWeight TLVType = 0x3d
+ TLVMultipathBackup TLVType = 0x3e
+ TLVMultipathOppdirPath TLVType = 0x3f
+ TLVLSPExtendedFlag TLVType = 0x40
+ TLVVirtualNetwork TLVType = 0x41
+ TLVSrAlgorithm TLVType = 0x42
+ TLVColor TLVType = 0x43
+ TLVComputationPriority TLVType = 0x44
+ TLVExplicitNullLabelPolicy TLVType = 0x45
+ TLVInvalidation TLVType = 0x46
+ TLVSRPolicyCapability TLVType = 0x47
+ TLVPathRecomputation TLVType = 0x48
+ TLVSRP2MPPolicyCapability TLVType = 0x49
+ TLVIPv4SrP2MPInstanceID TLVType = 0x4a
+ TLVIPv6SrP2MPInstanceID TLVType = 0x4b
)
-var tlvMap = map[uint16]func() TLVInterface{
- TLV_STATEFUL_PCE_CAPABILITY: func() TLVInterface { return &StatefulPceCapability{} },
- TLV_SYMBOLIC_PATH_NAME: func() TLVInterface { return &SymbolicPathName{} },
- TLV_IPV4_LSP_IDENTIFIERS: func() TLVInterface { return &IPv4LspIdentifiers{} },
- TLV_IPV6_LSP_IDENTIFIERS: func() TLVInterface { return &IPv6LspIdentifiers{} },
- TLV_LSP_DB_VERSION: func() TLVInterface { return &LSPDBVersion{} },
- TLV_SR_PCE_CAPABILITY: func() TLVInterface { return &SRPceCapability{} },
- TLV_PATH_SETUP_TYPE: func() TLVInterface { return &PathSetupType{} },
- TLV_EXTENDED_ASSOCIATION_ID: func() TLVInterface { return &ExtendedAssociationID{} },
- TLV_PATH_SETUP_TYPE_CAPABILITY: func() TLVInterface { return &PathSetupTypeCapability{} },
- TLV_ASSOC_TYPE_LIST: func() TLVInterface { return &AssocTypeList{} },
- TLV_COLOR: func() TLVInterface { return &Color{} },
+var tlvDescriptions = map[TLVType]struct {
+ Description string
+ Reference string
+}{
+ TLVNoPathVector: {"NO-PATH-VECTOR", "RFC5440"},
+ TLVOverloadDuration: {"OVERLOAD-DURATION", "RFC5440"},
+ TLVReqMissing: {"REQ-MISSING", "RFC5440"},
+ TLVOFList: {"OF-LIST", "RFC5541"},
+ TLVOrder: {"ORDER", "RFC5557"},
+ TLVP2MPCapable: {"P2MP-CAPABLE", "RFC8306"},
+ TLVVendorInformation: {"VENDOR-INFORMATION", "RFC7470"},
+ TLVWavelengthSelection: {"WAVELENGTH-SELECTION", "RFC8780"},
+ TLVWavelengthRestriction: {"WAVELENGTH-RESTRICTION", "RFC8780"},
+ TLVWavelengthAllocation: {"WAVELENGTH-ALLOCATION", "RFC8780"},
+ TLVOpticalInterfaceClassList: {"OPTICAL-INTERFACE-CLASS-LIST", "RFC8780"},
+ TLVClientSignalInformation: {"CLIENT-SIGNAL-INFORMATION", "RFC8780"},
+ TLVHPceCapability: {"H-PCE-CAPABILITY", "RFC8685"},
+ TLVDomainID: {"DOMAIN-ID", "RFC8685"},
+ TLVHPceFlag: {"H-PCE-FLAG", "RFC8685"},
+ TLVStatefulPceCapability: {"STATEFUL-PCE-CAPABILITY", "RFC8231"},
+ TLVSymbolicPathName: {"SYMBOLIC-PATH-NAME", "RFC8231"},
+ TLVIPv4LSPIdentifiers: {"IPV4-LSP-IDENTIFIERS", "RFC8231"},
+ TLVIPv6LSPIdentifiers: {"IPV6-LSP-IDENTIFIERS", "RFC8231"},
+ TLVLSPErrorCode: {"LSP-ERROR-CODE", "RFC8231"},
+ TLVRsvpErrorSpec: {"RSVP-ERROR-SPEC", "RFC8231"},
+ TLVLSPDBVersion: {"LSP-DB-VERSION", "RFC8232"},
+ TLVSpeakerEntityID: {"SPEAKER-ENTITY-ID", "RFC8232"},
+ TLVSRPceCapability: {"SR-PCE-CAPABILITY", "RFC8664"},
+ TLVPathSetupType: {"PATH-SETUP-TYPE", "RFC8408"},
+ TLVOperatorConfiguredAssociationRange: {"OPERATOR-CONFIGURED-ASSOCIATION-RANGE", "RFC8697"},
+ TLVGlobalAssociationSource: {"GLOBAL-ASSOCIATION-SOURCE", "RFC8697"},
+ TLVExtendedAssociationID: {"EXTENDED-ASSOCIATION-ID", "RFC8697"},
+ TLVP2MPIPv4LSPIdentifiers: {"P2MP-IPV4-LSP-IDENTIFIERS", "RFC8623"},
+ TLVP2MPIPv6LSPIdentifiers: {"P2MP-IPV6-LSP-IDENTIFIERS", "RFC8623"},
+ TLVPathSetupTypeCapability: {"PATH-SETUP-TYPE-CAPABILITY", "RFC8408"},
+ TLVAssocTypeList: {"ASSOC-TYPE-LIST", "RFC8697"},
+ TLVAutoBandwidthCapability: {"AUTO-BANDWIDTH-CAPABILITY", "RFC8733"},
+ TLVAutoBandwidthAttributes: {"AUTO-BANDWIDTH-ATTRIBUTES", "RFC8733"},
+ TLVPathProtectionAssociationGroupTLV: {"PATH-PROTECTION-ASSOCIATION-GROUP", "RFC8745"},
+ TLVIPv4Address: {"IPV4-ADDRESS", "RFC8779"},
+ TLVIPv6Address: {"IPV6-ADDRESS", "RFC8779"},
+ TLVUnnumberedEndpoint: {"UNNUMBERED-ENDPOINT", "RFC8779"},
+ TLVLabelRequest: {"LABEL-REQUEST", "RFC8779"},
+ TLVLabelSet: {"LABEL-SET", "RFC8779"},
+ TLVProtectionAttribute: {"PROTECTION-ATTRIBUTE", "RFC8779"},
+ TLVGmplsCapability: {"GMPLS-CAPABILITY", "RFC8779"},
+ TLVDisjointnessConfiguration: {"DISJOINTNESS-CONFIGURATION", "RFC8800"},
+ TLVDisjointnessStatus: {"DISJOINTNESS-STATUS", "RFC8800"},
+ TLVPolicyParameters: {"POLICY-PARAMETERS-TLV", "RFC9005"},
+ TLVSchedLSPAttribute: {"SCHED-LSP-ATTRIBUTE", "RFC8934"},
+ TLVSchedPdLSPAttribute: {"SCHED-PD-LSP-ATTRIBUTE", "RFC8934"},
+ TLVPceFlowspecCapability: {"PCE-FLOWSPEC-CAPABILITY TLV", "RFC9168"},
+ TLVFlowFilter: {"FLOW-FILTER-TLV", "RFC9168"},
+ TLVBidirectionalLSPAssociationGroup: {"BIDIRECTIONAL-LSP Association Group TLV", "RFC9059"},
+ TLVTePathBinding: {"TE-PATH-BINDING", "RFC9604"},
+ TLVSRPolicyPolName: {"SRPOLICY-POL-NAME", "draft-ietf-pce-segment-routing-policy-cp-14"},
+ TLVSRPolicyCPathID: {"SRPOLICY-CPATH-ID", "draft-ietf-pce-segment-routing-policy-cp-14"},
+ TLVSRPolicyCPathName: {"SRPOLICY-CPATH-NAME", "draft-ietf-pce-segment-routing-policy-cp-14"},
+ TLVSRPolicyCPathPreference: {"SRPOLICY-CPATH-PREFERENCE", "draft-ietf-pce-segment-routing-policy-cp-14"},
+ TLVMultipathCap: {"MULTIPATH-CAP", "draft-ietf-pce-multipath-07"},
+ TLVMultipathWeight: {"MULTIPATH-WEIGHT", "draft-ietf-pce-multipath-07"},
+ TLVMultipathBackup: {"MULTIPATH-BACKUP", "draft-ietf-pce-multipath-07"},
+ TLVMultipathOppdirPath: {"MULTIPATH-OPPDIR-PATH", "draft-ietf-pce-multipath-07"},
+ TLVLSPExtendedFlag: {"LSP-EXTENDED-FLAG", "RFC9357"},
+ TLVVirtualNetwork: {"VIRTUAL-NETWORK", "RFC9358"},
+ TLVSrAlgorithm: {"SR-ALGORITHM", "draft-ietf-pce-sid-algo-12"},
+ TLVColor: {"COLOR", "RFC-ietf-pce-pcep-color-12"},
+ TLVComputationPriority: {"COMPUTATION-PRIORITY", "draft-ietf-pce-segment-routing-policy-cp-14"},
+ TLVExplicitNullLabelPolicy: {"EXPLICIT-NULL-LABEL-POLICY", "draft-ietf-pce-segment-routing-policy-cp-14"},
+ TLVInvalidation: {"INVALIDATION", "draft-ietf-pce-segment-routing-policy-cp-14"},
+ TLVSRPolicyCapability: {"SRPOLICY-CAPABILITY", "draft-ietf-pce-segment-routing-policy-cp-14"},
+ TLVPathRecomputation: {"PATH-RECOMPUTATION", "draft-ietf-pce-circuit-style-pcep-extensions-03"},
+ TLVSRP2MPPolicyCapability: {"SRP2MP-POLICY-CAPABILITY", "draft-ietf-pce-sr-p2mp-policy-09"},
+ TLVIPv4SrP2MPInstanceID: {"IPV4-SR-P2MP-INSTANCE-ID", "draft-ietf-pce-sr-p2mp-policy-09"},
+ TLVIPv6SrP2MPInstanceID: {"IPV6-SR-P2MP-INSTANCE-ID", "draft-ietf-pce-sr-p2mp-policy-09"},
+}
+
+func (t TLVType) String() string {
+ if desc, ok := tlvDescriptions[t]; ok {
+ return fmt.Sprintf("%s (%s)", desc.Description, desc.Reference)
+ }
+ return fmt.Sprintf("Unknown TLV (0x%04x)", uint16(t))
+}
+
+var tlvMap = map[TLVType]func() TLVInterface{
+ TLVStatefulPceCapability: func() TLVInterface { return &StatefulPceCapability{} },
+ TLVSymbolicPathName: func() TLVInterface { return &SymbolicPathName{} },
+ TLVIPv4LSPIdentifiers: func() TLVInterface { return &IPv4LSPIdentifiers{} },
+ TLVIPv6LSPIdentifiers: func() TLVInterface { return &IPv6LSPIdentifiers{} },
+ TLVLSPDBVersion: func() TLVInterface { return &LSPDBVersion{} },
+ TLVSRPceCapability: func() TLVInterface { return &SRPceCapability{} },
+ TLVPathSetupType: func() TLVInterface { return &PathSetupType{} },
+ TLVExtendedAssociationID: func() TLVInterface { return &ExtendedAssociationID{} },
+ TLVPathSetupTypeCapability: func() TLVInterface { return &PathSetupTypeCapability{} },
+ TLVAssocTypeList: func() TLVInterface { return &AssocTypeList{} },
+ TLVColor: func() TLVInterface { return &Color{} },
}
const (
- TLV_STATEFUL_PCE_CAPABILITY_LENGTH uint16 = 4
- TLV_LSP_DB_VERSION_LENGTH uint16 = 8
- TLV_SR_PCE_CAPABILITY_LENGTH uint16 = 4
- TLV_PATH_SETUP_TYPE_LENGTH uint16 = 4
- TLV_EXTENDED_ASSOCIATION_ID_IPV4_LENGTH uint16 = 8
- TLV_EXTENDED_ASSOCIATION_ID_IPV6_LENGTH uint16 = 20
- TLV_IPV4_LSP_IDENTIFIERS_LENGTH uint16 = 16
- TLV_IPV6_LSP_IDENTIFIERS_LENGTH uint16 = 52
- TLV_SRPOLICY_CPATH_ID_LENGTH uint16 = 28
- TLV_SRPOLICY_CPATH_PREFERENCE_LENGTH uint16 = 4
- TLV_COLOR_LENGTH uint16 = 4
+ TLVStatefulPceCapabilityValueLength uint16 = 4
+ TLVLSPDBVersionValueLength uint16 = 8
+ TLVSRPceCapabilityValueLength uint16 = 4
+ TLVPathSetupTypeValueLength uint16 = 4
+ TLVExtendedAssociationIDIPv4ValueLength uint16 = 8
+ TLVExtendedAssociationIDIPv6ValueLength uint16 = 20
+ TLVIPv4LSPIdentifiersValueLength uint16 = 16
+ TLVIPv6LSPIdentifiersValueLength uint16 = 52
+ TLVSRPolicyCPathIDValueLength uint16 = 28
+ TLVSRPolicyCPathPreferenceValueLength uint16 = 4
+ TLVColorValueLength uint16 = 4
+)
+
+// Juniper specific TLV (deprecated)
+const (
+ TLVExtendedAssociationIDIPv4Juniper TLVType = 0xffe3
+ TLVSRPolicyCPathIDJuniper TLVType = 0xffe4
+ TLVSRPolicyCPathPreferenceJuniper TLVType = 0xffe5
+)
+
+// Cisco specific SubTLV
+const (
+ SubTLVColorCisco TLVType = 0x01
+ SubTLVPreferenceCisco TLVType = 0x03
)
-const TL_LENGTH = 4
+const (
+ SubTLVColorCiscoValueLength uint16 = 4
+ SubTLVPreferenceCiscoValueLength uint16 = 4
+)
+
+const TLVHeaderLength = 4
type TLVInterface interface {
DecodeFromBytes(data []uint8) error
Serialize() []uint8
MarshalLogObject(enc zapcore.ObjectEncoder) error
- Type() uint16
+ Type() TLVType
Len() uint16 // Total length of Type, Length, and Value
}
type StatefulPceCapability struct {
- LspUpdateCapability bool // 31
+ LSPUpdateCapability bool // 31
IncludeDBVersion bool // 30
- LspInstantiationCapability bool // 29
+ LSPInstantiationCapability bool // 29
TriggeredResync bool // 28
- DeltaLspSyncCapability bool // 27
+ DeltaLSPSyncCapability bool // 27
TriggeredInitialSync bool // 26
P2mpCapability bool // 25
- P2mpLspUpdateCapability bool // 24
- P2mpLspInstantiationCapability bool // 23
- LspSchedulingCapability bool // 22
- PdLspCapability bool // 21
+ P2mpLSPUpdateCapability bool // 24
+ P2mpLSPInstantiationCapability bool // 23
+ LSPSchedulingCapability bool // 22
+ PdLSPCapability bool // 21
ColorCapability bool // 20
PathRecomputationCapability bool // 19
StrictPathCapability bool // 18
@@ -157,17 +261,17 @@ func (tlv *StatefulPceCapability) DecodeFromBytes(flags []uint8) error {
mask uint8
index int
}{
- {&tlv.LspUpdateCapability, 0x01, 3},
+ {&tlv.LSPUpdateCapability, 0x01, 3},
{&tlv.IncludeDBVersion, 0x02, 3},
- {&tlv.LspInstantiationCapability, 0x04, 3},
+ {&tlv.LSPInstantiationCapability, 0x04, 3},
{&tlv.TriggeredResync, 0x08, 3},
- {&tlv.DeltaLspSyncCapability, 0x10, 3},
+ {&tlv.DeltaLSPSyncCapability, 0x10, 3},
{&tlv.TriggeredInitialSync, 0x20, 3},
{&tlv.P2mpCapability, 0x40, 3},
- {&tlv.P2mpLspUpdateCapability, 0x80, 3},
- {&tlv.P2mpLspInstantiationCapability, 0x01, 2},
- {&tlv.LspSchedulingCapability, 0x02, 2},
- {&tlv.PdLspCapability, 0x04, 2},
+ {&tlv.P2mpLSPUpdateCapability, 0x80, 3},
+ {&tlv.P2mpLSPInstantiationCapability, 0x01, 2},
+ {&tlv.LSPSchedulingCapability, 0x02, 2},
+ {&tlv.PdLSPCapability, 0x04, 2},
{&tlv.ColorCapability, 0x08, 2},
{&tlv.PathRecomputationCapability, 0x10, 2},
{&tlv.StrictPathCapability, 0x20, 2},
@@ -191,26 +295,26 @@ func (tlv *StatefulPceCapability) Serialize() []uint8 {
buf := []uint8{}
typ := make([]uint8, 2)
- binary.BigEndian.PutUint16(typ, tlv.Type())
+ binary.BigEndian.PutUint16(typ, uint16(tlv.Type()))
buf = append(buf, typ...)
length := make([]uint8, 2)
- binary.BigEndian.PutUint16(length, TLV_STATEFUL_PCE_CAPABILITY_LENGTH)
+ binary.BigEndian.PutUint16(length, TLVStatefulPceCapabilityValueLength)
buf = append(buf, length...)
- flags := make([]uint8, TLV_STATEFUL_PCE_CAPABILITY_LENGTH)
+ flags := make([]uint8, TLVStatefulPceCapabilityValueLength)
- setFlag(flags, 3, 0x01, tlv.LspUpdateCapability)
+ setFlag(flags, 3, 0x01, tlv.LSPUpdateCapability)
setFlag(flags, 3, 0x02, tlv.IncludeDBVersion)
- setFlag(flags, 3, 0x04, tlv.LspInstantiationCapability)
+ setFlag(flags, 3, 0x04, tlv.LSPInstantiationCapability)
setFlag(flags, 3, 0x08, tlv.TriggeredResync)
- setFlag(flags, 3, 0x10, tlv.DeltaLspSyncCapability)
+ setFlag(flags, 3, 0x10, tlv.DeltaLSPSyncCapability)
setFlag(flags, 3, 0x20, tlv.TriggeredInitialSync)
setFlag(flags, 3, 0x40, tlv.P2mpCapability)
- setFlag(flags, 3, 0x80, tlv.P2mpLspUpdateCapability)
- setFlag(flags, 2, 0x01, tlv.P2mpLspInstantiationCapability)
- setFlag(flags, 2, 0x02, tlv.LspSchedulingCapability)
- setFlag(flags, 2, 0x04, tlv.PdLspCapability)
+ setFlag(flags, 3, 0x80, tlv.P2mpLSPUpdateCapability)
+ setFlag(flags, 2, 0x01, tlv.P2mpLSPInstantiationCapability)
+ setFlag(flags, 2, 0x02, tlv.LSPSchedulingCapability)
+ setFlag(flags, 2, 0x04, tlv.PdLSPCapability)
setFlag(flags, 2, 0x08, tlv.ColorCapability)
setFlag(flags, 2, 0x10, tlv.PathRecomputationCapability)
setFlag(flags, 2, 0x20, tlv.StrictPathCapability)
@@ -225,30 +329,30 @@ func (tlv *StatefulPceCapability) MarshalLogObject(enc zapcore.ObjectEncoder) er
return nil
}
-func (tlv *StatefulPceCapability) Type() uint16 {
- return TLV_STATEFUL_PCE_CAPABILITY
+func (tlv *StatefulPceCapability) Type() TLVType {
+ return TLVStatefulPceCapability
}
func (tlv *StatefulPceCapability) Len() uint16 {
- return TL_LENGTH + TLV_STATEFUL_PCE_CAPABILITY_LENGTH
+ return TLVHeaderLength + TLVStatefulPceCapabilityValueLength
}
func (tlv *StatefulPceCapability) CapStrings() []string {
ret := []string{}
ret = append(ret, "Stateful")
- if tlv.LspUpdateCapability {
+ if tlv.LSPUpdateCapability {
ret = append(ret, "Update")
}
if tlv.IncludeDBVersion {
ret = append(ret, "Include-DB-Ver")
}
- if tlv.LspInstantiationCapability {
+ if tlv.LSPInstantiationCapability {
ret = append(ret, "Initiate")
}
if tlv.TriggeredResync {
ret = append(ret, "Triggerd-Resync")
}
- if tlv.DeltaLspSyncCapability {
+ if tlv.DeltaLSPSyncCapability {
ret = append(ret, "Delta-LSP-Sync")
}
if tlv.TriggeredInitialSync {
@@ -274,7 +378,7 @@ func (tlv *SymbolicPathName) Serialize() []uint8 {
buf := []uint8{}
typ := make([]uint8, 2)
- binary.BigEndian.PutUint16(typ, tlv.Type())
+ binary.BigEndian.PutUint16(typ, uint16(tlv.Type()))
buf = append(buf, typ...)
l := uint16(len(tlv.Name))
@@ -295,8 +399,8 @@ func (tlv *SymbolicPathName) MarshalLogObject(enc zapcore.ObjectEncoder) error {
return nil
}
-func (tlv *SymbolicPathName) Type() uint16 {
- return TLV_SYMBOLIC_PATH_NAME
+func (tlv *SymbolicPathName) Type() TLVType {
+ return TLVSymbolicPathName
}
func (tlv *SymbolicPathName) Len() uint16 {
@@ -305,72 +409,72 @@ func (tlv *SymbolicPathName) Len() uint16 {
if l%4 != 0 {
padding = (4 - l%4)
}
- return TL_LENGTH + l + padding
+ return TLVHeaderLength + l + padding
}
-type IPv4LspIdentifiers struct {
+type IPv4LSPIdentifiers struct {
IPv4TunnelSenderAddress netip.Addr
IPv4TunnelEndpointAddress netip.Addr
- LspID uint16
+ LSPID uint16
TunnelID uint16
}
-func (tlv *IPv4LspIdentifiers) DecodeFromBytes(data []uint8) error {
+func (tlv *IPv4LSPIdentifiers) DecodeFromBytes(data []uint8) error {
var ok bool
if tlv.IPv4TunnelSenderAddress, ok = netip.AddrFromSlice(data[12:16]); !ok {
tlv.IPv4TunnelSenderAddress, _ = netip.AddrFromSlice(data[4:8])
}
- tlv.LspID = binary.BigEndian.Uint16(data[8:10])
+ tlv.LSPID = binary.BigEndian.Uint16(data[8:10])
tlv.TunnelID = binary.BigEndian.Uint16(data[10:12])
tlv.IPv4TunnelEndpointAddress, _ = netip.AddrFromSlice(data[16:20])
return nil
}
-func (tlv *IPv4LspIdentifiers) Serialize() []uint8 {
+func (tlv *IPv4LSPIdentifiers) Serialize() []uint8 {
return nil
}
-func (tlv *IPv4LspIdentifiers) MarshalLogObject(enc zapcore.ObjectEncoder) error {
+func (tlv *IPv4LSPIdentifiers) MarshalLogObject(enc zapcore.ObjectEncoder) error {
return nil
}
-func (tlv *IPv4LspIdentifiers) Type() uint16 {
- return TLV_IPV4_LSP_IDENTIFIERS
+func (tlv *IPv4LSPIdentifiers) Type() TLVType {
+ return TLVIPv4LSPIdentifiers
}
-func (tlv *IPv4LspIdentifiers) Len() uint16 {
- return TL_LENGTH + TLV_IPV4_LSP_IDENTIFIERS_LENGTH
+func (tlv *IPv4LSPIdentifiers) Len() uint16 {
+ return TLVHeaderLength + TLVIPv4LSPIdentifiersValueLength
}
-type IPv6LspIdentifiers struct {
+type IPv6LSPIdentifiers struct {
IPv6TunnelSenderAddress netip.Addr
IPv6TunnelEndpointAddress netip.Addr
- LspID uint16
+ LSPID uint16
TunnelID uint16
}
-func (tlv *IPv6LspIdentifiers) DecodeFromBytes(data []uint8) error {
+func (tlv *IPv6LSPIdentifiers) DecodeFromBytes(data []uint8) error {
tlv.IPv6TunnelSenderAddress, _ = netip.AddrFromSlice(data[4:20])
- tlv.LspID = binary.BigEndian.Uint16(data[20:22])
+ tlv.LSPID = binary.BigEndian.Uint16(data[20:22])
tlv.TunnelID = binary.BigEndian.Uint16(data[22:24])
tlv.IPv6TunnelEndpointAddress, _ = netip.AddrFromSlice(data[40:56])
return nil
}
-func (tlv *IPv6LspIdentifiers) Serialize() []uint8 {
+func (tlv *IPv6LSPIdentifiers) Serialize() []uint8 {
return nil
}
-func (tlv *IPv6LspIdentifiers) MarshalLogObject(enc zapcore.ObjectEncoder) error {
+func (tlv *IPv6LSPIdentifiers) MarshalLogObject(enc zapcore.ObjectEncoder) error {
return nil
}
-func (tlv *IPv6LspIdentifiers) Type() uint16 {
- return TLV_IPV6_LSP_IDENTIFIERS
+func (tlv *IPv6LSPIdentifiers) Type() TLVType {
+ return TLVIPv6LSPIdentifiers
}
-func (tlv *IPv6LspIdentifiers) Len() uint16 {
- return TL_LENGTH + TLV_IPV6_LSP_IDENTIFIERS_LENGTH
+func (tlv *IPv6LSPIdentifiers) Len() uint16 {
+ return TLVHeaderLength + TLVIPv6LSPIdentifiersValueLength
}
type LSPDBVersion struct {
@@ -386,14 +490,14 @@ func (tlv *LSPDBVersion) Serialize() []uint8 {
buf := []uint8{}
typ := make([]uint8, 2)
- binary.BigEndian.PutUint16(typ, tlv.Type())
+ binary.BigEndian.PutUint16(typ, uint16(tlv.Type()))
buf = append(buf, typ...)
length := make([]uint8, 2)
- binary.BigEndian.PutUint16(length, TLV_LSP_DB_VERSION_LENGTH)
+ binary.BigEndian.PutUint16(length, TLVLSPDBVersionValueLength)
buf = append(buf, length...)
- val := make([]uint8, TLV_LSP_DB_VERSION_LENGTH)
+ val := make([]uint8, TLVLSPDBVersionValueLength)
binary.BigEndian.PutUint64(val, tlv.VersionNumber)
buf = append(buf, val...)
@@ -404,12 +508,12 @@ func (tlv *LSPDBVersion) MarshalLogObject(enc zapcore.ObjectEncoder) error {
return nil
}
-func (tlv *LSPDBVersion) Type() uint16 {
- return TLV_LSP_DB_VERSION
+func (tlv *LSPDBVersion) Type() TLVType {
+ return TLVLSPDBVersion
}
func (tlv *LSPDBVersion) Len() uint16 {
- return TL_LENGTH + TLV_LSP_DB_VERSION_LENGTH
+ return TLVHeaderLength + TLVLSPDBVersionValueLength
}
func (tlv *LSPDBVersion) CapStrings() []string {
@@ -433,14 +537,14 @@ func (tlv *SRPceCapability) Serialize() []uint8 {
buf := []uint8{}
typ := make([]uint8, 2)
- binary.BigEndian.PutUint16(typ, tlv.Type())
+ binary.BigEndian.PutUint16(typ, uint16(tlv.Type()))
buf = append(buf, typ...)
length := make([]uint8, 2)
- binary.BigEndian.PutUint16(length, TLV_SR_PCE_CAPABILITY_LENGTH)
+ binary.BigEndian.PutUint16(length, TLVSRPceCapabilityValueLength)
buf = append(buf, length...)
- val := make([]uint8, TLV_SR_PCE_CAPABILITY_LENGTH)
+ val := make([]uint8, TLVSRPceCapabilityValueLength)
if tlv.UnlimitedMSD {
val[2] = val[2] | 0x01
}
@@ -457,12 +561,12 @@ func (tlv *SRPceCapability) MarshalLogObject(enc zapcore.ObjectEncoder) error {
return nil
}
-func (tlv *SRPceCapability) Type() uint16 {
- return TLV_SR_PCE_CAPABILITY
+func (tlv *SRPceCapability) Type() TLVType {
+ return TLVSRPceCapability
}
func (tlv *SRPceCapability) Len() uint16 {
- return TL_LENGTH + TLV_SR_PCE_CAPABILITY_LENGTH
+ return TLVHeaderLength + TLVSRPceCapabilityValueLength
}
func (tlv *SRPceCapability) CapStrings() []string {
@@ -472,12 +576,31 @@ func (tlv *SRPceCapability) CapStrings() []string {
type Pst uint8
const (
- PST_RSVP_TE Pst = 0x0
- PST_SR_TE Pst = 0x1
- PST_PCECC_TE Pst = 0x2
- PST_SRV6_TE Pst = 0x3
+ PathSetupTypeRSVPTE Pst = 0x0
+ PathSetupTypeSRTE Pst = 0x1
+ PathSetupTypePCECCTE Pst = 0x2
+ PathSetupTypeSRv6TE Pst = 0x3
+ PathSetupTypeIPTE Pst = 0x4
)
+var pathSetupDescriptions = map[Pst]struct {
+ Description string
+ Reference string
+}{
+ PathSetupTypeRSVPTE: {"Path is set up using the RSVP-TE signaling protocol", "RFC8408"},
+ PathSetupTypeSRTE: {"Traffic engineering path is set up using Segment Routing", "RFC8664"},
+ PathSetupTypePCECCTE: {"Traffic engineering path is set up using PCECC mode", "RFC9050"},
+ PathSetupTypeSRv6TE: {"Traffic engineering path is set up using SRv6", "RFC9603"},
+ PathSetupTypeIPTE: {"Native IP TE Path", "RFC9757"},
+}
+
+func (pst Pst) String() string {
+ if desc, found := pathSetupDescriptions[pst]; found {
+ return fmt.Sprintf("%s (%s)", desc.Description, desc.Reference)
+ }
+ return fmt.Sprintf("Unknown PathSetupType (0x%02x)", uint16(pst))
+}
+
type Psts []Pst
func (ts Psts) MarshalJSON() ([]byte, error) {
@@ -503,14 +626,14 @@ func (tlv *PathSetupType) Serialize() []uint8 {
buf := []uint8{}
typ := make([]uint8, 2)
- binary.BigEndian.PutUint16(typ, tlv.Type())
+ binary.BigEndian.PutUint16(typ, uint16(tlv.Type()))
buf = append(buf, typ...)
length := make([]uint8, 2)
- binary.BigEndian.PutUint16(length, TLV_PATH_SETUP_TYPE_LENGTH)
+ binary.BigEndian.PutUint16(length, TLVPathSetupTypeValueLength)
buf = append(buf, length...)
- val := make([]uint8, TLV_PATH_SETUP_TYPE_LENGTH)
+ val := make([]uint8, TLVPathSetupTypeValueLength)
val[3] = uint8(tlv.PathSetupType)
buf = append(buf, val...)
@@ -521,12 +644,12 @@ func (tlv *PathSetupType) MarshalLogObject(enc zapcore.ObjectEncoder) error {
return nil
}
-func (tlv *PathSetupType) Type() uint16 {
- return TLV_PATH_SETUP_TYPE
+func (tlv *PathSetupType) Type() TLVType {
+ return TLVPathSetupType
}
func (tlv *PathSetupType) Len() uint16 {
- return TL_LENGTH + TLV_PATH_SETUP_TYPE_LENGTH
+ return TLVHeaderLength + TLVPathSetupTypeValueLength
}
type ExtendedAssociationID struct {
@@ -540,9 +663,9 @@ func (tlv *ExtendedAssociationID) DecodeFromBytes(data []uint8) error {
tlv.Color = binary.BigEndian.Uint32(data[4:8])
switch l {
- case TLV_EXTENDED_ASSOCIATION_ID_IPV4_LENGTH:
+ case TLVExtendedAssociationIDIPv4ValueLength:
tlv.Endpoint, _ = netip.AddrFromSlice(data[8:12])
- case TLV_EXTENDED_ASSOCIATION_ID_IPV6_LENGTH:
+ case TLVExtendedAssociationIDIPv6ValueLength:
tlv.Endpoint, _ = netip.AddrFromSlice(data[8:24])
}
@@ -553,14 +676,14 @@ func (tlv *ExtendedAssociationID) Serialize() []uint8 {
buf := []uint8{}
typ := make([]uint8, 2)
- binary.BigEndian.PutUint16(typ, tlv.Type())
+ binary.BigEndian.PutUint16(typ, uint16(tlv.Type()))
buf = append(buf, typ...)
length := make([]uint8, 2)
if tlv.Endpoint.Is4() {
- binary.BigEndian.PutUint16(length, TLV_EXTENDED_ASSOCIATION_ID_IPV4_LENGTH)
+ binary.BigEndian.PutUint16(length, TLVExtendedAssociationIDIPv4ValueLength)
} else if tlv.Endpoint.Is6() {
- binary.BigEndian.PutUint16(length, TLV_EXTENDED_ASSOCIATION_ID_IPV6_LENGTH)
+ binary.BigEndian.PutUint16(length, TLVExtendedAssociationIDIPv6ValueLength)
}
buf = append(buf, length...)
@@ -576,15 +699,15 @@ func (tlv *ExtendedAssociationID) MarshalLogObject(enc zapcore.ObjectEncoder) er
return nil
}
-func (tlv *ExtendedAssociationID) Type() uint16 {
- return TLV_EXTENDED_ASSOCIATION_ID
+func (tlv *ExtendedAssociationID) Type() TLVType {
+ return TLVExtendedAssociationID
}
func (tlv *ExtendedAssociationID) Len() uint16 {
if tlv.Endpoint.Is4() {
- return TL_LENGTH + TLV_EXTENDED_ASSOCIATION_ID_IPV4_LENGTH
+ return TLVHeaderLength + TLVExtendedAssociationIDIPv4ValueLength
} else if tlv.Endpoint.Is6() {
- return TL_LENGTH + TLV_EXTENDED_ASSOCIATION_ID_IPV6_LENGTH
+ return TLVHeaderLength + TLVExtendedAssociationIDIPv6ValueLength
}
return 0
@@ -607,7 +730,7 @@ func (tlv *PathSetupTypeCapability) DecodeFromBytes(data []uint8) error {
pstNum += 4 - (pstNum % 4) // padding byte
}
var err error
- tlv.SubTLVs, err = DecodeTLVs(data[8+pstNum : TL_LENGTH+l]) // 8 byte: Type&Length (4 byte) + Reserve&pstNum (4 byte)
+ tlv.SubTLVs, err = DecodeTLVs(data[8+pstNum : TLVHeaderLength+l]) // 8 byte: Type&Length (4 byte) + Reserve&pstNum (4 byte)
if err != nil {
return err
}
@@ -618,7 +741,7 @@ func (tlv *PathSetupTypeCapability) Serialize() []uint8 {
buf := []uint8{}
typ := make([]uint8, 2)
- binary.BigEndian.PutUint16(typ, tlv.Type())
+ binary.BigEndian.PutUint16(typ, uint16(tlv.Type()))
buf = append(buf, typ...)
numOfPst := uint16(len(tlv.PathSetupTypes))
@@ -659,8 +782,8 @@ func (tlv *PathSetupTypeCapability) MarshalLogObject(enc zapcore.ObjectEncoder)
return nil
}
-func (tlv *PathSetupTypeCapability) Type() uint16 {
- return TLV_PATH_SETUP_TYPE_CAPABILITY
+func (tlv *PathSetupTypeCapability) Type() TLVType {
+ return TLVPathSetupTypeCapability
}
func (tlv *PathSetupTypeCapability) Len() uint16 {
@@ -673,15 +796,15 @@ func (tlv *PathSetupTypeCapability) Len() uint16 {
for _, subTLV := range tlv.SubTLVs {
l += subTLV.Len()
}
- return TL_LENGTH + l
+ return TLVHeaderLength + l
}
func (tlv *PathSetupTypeCapability) CapStrings() []string {
ret := []string{}
- if slices.Contains(tlv.PathSetupTypes, PST_SR_TE) {
+ if slices.Contains(tlv.PathSetupTypes, PathSetupTypeSRTE) {
ret = append(ret, "SR-TE")
}
- if slices.Contains(tlv.PathSetupTypes, PST_SRV6_TE) {
+ if slices.Contains(tlv.PathSetupTypes, PathSetupTypeSRv6TE) {
ret = append(ret, "SRv6-TE")
}
return ret
@@ -690,16 +813,32 @@ func (tlv *PathSetupTypeCapability) CapStrings() []string {
type AssocType uint16
const (
- AT_RESERVED AssocType = 0x00
- AT_PATH_PROTECTION_ASSOCIATION AssocType = 0x01
- AT_DISCOINT_ASSOCIATION AssocType = 0x02
- AT_POLICY_ASSOCIATION AssocType = 0x03
- AT_SINGLE_SIDED_BIDIRECTIONAL_LSP_ASSOCIATION AssocType = 0x04
- AT_DOUBLE_SIDED_BIDIRECTIONAL_LSP_ASSOCIATION AssocType = 0x05
- AT_SR_POLICY_ASSOCIATION AssocType = 0x06
- AT_VN_ASSOCIATION_TYPE AssocType = 0x07
+ AssocTypePathProtectionAssociation AssocType = 0x01
+ AssocTypeDisjointAssociation AssocType = 0x02
+ AssocTypePolicyAssociation AssocType = 0x03
+ AssocTypeSingleSidedBidirectionalLSPAssociation AssocType = 0x04
+ AssocTypeDoubleSidedBidirectionalLSPAssociation AssocType = 0x05
+ AssocTypeSrPolicyAssociation AssocType = 0x06
+ AssocTypeVnAssociationType AssocType = 0x07
)
+var assocTypeNames = map[AssocType]string{
+ AssocTypePathProtectionAssociation: "Path Protection Association",
+ AssocTypeDisjointAssociation: "Disjoint Association",
+ AssocTypePolicyAssociation: "Policy Association",
+ AssocTypeSingleSidedBidirectionalLSPAssociation: "Single Sided Bidirectional LSP Association",
+ AssocTypeDoubleSidedBidirectionalLSPAssociation: "Double Sided Bidirectional LSP Association",
+ AssocTypeSrPolicyAssociation: "SR Policy Association",
+ AssocTypeVnAssociationType: "VN Association Type",
+}
+
+func (at AssocType) String() string {
+ if name, ok := assocTypeNames[at]; ok {
+ return name
+ }
+ return fmt.Sprintf("Unknown AssocType (0x%04x)", uint16(at))
+}
+
type AssocTypeList struct {
AssocTypes []AssocType
}
@@ -717,7 +856,7 @@ func (tlv *AssocTypeList) Serialize() []uint8 {
buf := []uint8{}
typ := make([]uint8, 2)
- binary.BigEndian.PutUint16(typ, tlv.Type())
+ binary.BigEndian.PutUint16(typ, uint16(tlv.Type()))
buf = append(buf, typ...)
l := uint16(len(tlv.AssocTypes)) * 2
@@ -741,8 +880,8 @@ func (tlv *AssocTypeList) MarshalLogObject(enc zapcore.ObjectEncoder) error {
return nil
}
-func (tlv *AssocTypeList) Type() uint16 {
- return TLV_ASSOC_TYPE_LIST
+func (tlv *AssocTypeList) Type() TLVType {
+ return TLVAssocTypeList
}
func (tlv *AssocTypeList) Len() uint16 {
@@ -751,7 +890,7 @@ func (tlv *AssocTypeList) Len() uint16 {
if l%4 != 0 {
padding = 2
}
- return TL_LENGTH + l + padding
+ return TLVHeaderLength + l + padding
}
func (tlv *AssocTypeList) CapStrings() []string {
@@ -771,11 +910,11 @@ func (tlv *SRPolicyCandidatePathIdentifier) Serialize() []uint8 {
buf := []uint8{}
typ := make([]uint8, 2)
- binary.BigEndian.PutUint16(typ, tlv.Type())
+ binary.BigEndian.PutUint16(typ, uint16(tlv.Type()))
buf = append(buf, typ...)
length := make([]uint8, 2)
- binary.BigEndian.PutUint16(length, TLV_SRPOLICY_CPATH_ID_LENGTH)
+ binary.BigEndian.PutUint16(length, TLVSRPolicyCPathIDValueLength)
buf = append(buf, length...)
buf = append(buf, 0x0a) // protocol origin, PCEP = 10
@@ -797,12 +936,12 @@ func (tlv *SRPolicyCandidatePathIdentifier) MarshalLogObject(enc zapcore.ObjectE
return nil
}
-func (tlv *SRPolicyCandidatePathIdentifier) Type() uint16 {
- return TLV_SRPOLICY_CPATH_ID
+func (tlv *SRPolicyCandidatePathIdentifier) Type() TLVType {
+ return TLVSRPolicyCPathID
}
func (tlv *SRPolicyCandidatePathIdentifier) Len() uint16 {
- return TL_LENGTH + TLV_SRPOLICY_CPATH_ID_LENGTH
+ return TLVHeaderLength + TLVSRPolicyCPathIDValueLength
}
type SRPolicyCandidatePathPreference struct {
@@ -818,11 +957,11 @@ func (tlv *SRPolicyCandidatePathPreference) Serialize() []uint8 {
buf := []uint8{}
typ := make([]uint8, 2)
- binary.BigEndian.PutUint16(typ, tlv.Type())
+ binary.BigEndian.PutUint16(typ, uint16(tlv.Type()))
buf = append(buf, typ...)
length := make([]uint8, 2)
- binary.BigEndian.PutUint16(length, TLV_SRPOLICY_CPATH_PREFERENCE_LENGTH)
+ binary.BigEndian.PutUint16(length, TLVSRPolicyCPathPreferenceValueLength)
buf = append(buf, length...)
preference := make([]uint8, 4)
@@ -836,12 +975,12 @@ func (tlv *SRPolicyCandidatePathPreference) MarshalLogObject(enc zapcore.ObjectE
return nil
}
-func (tlv *SRPolicyCandidatePathPreference) Type() uint16 {
- return TLV_SRPOLICY_CPATH_PREFERENCE
+func (tlv *SRPolicyCandidatePathPreference) Type() TLVType {
+ return TLVSRPolicyCPathPreference
}
func (tlv *SRPolicyCandidatePathPreference) Len() uint16 {
- return TL_LENGTH + TLV_SRPOLICY_CPATH_PREFERENCE_LENGTH
+ return TLVHeaderLength + TLVSRPolicyCPathPreferenceValueLength
}
type Color struct {
@@ -857,11 +996,11 @@ func (tlv *Color) Serialize() []uint8 {
buf := []uint8{}
typ := make([]uint8, 2)
- binary.BigEndian.PutUint16(typ, tlv.Type())
+ binary.BigEndian.PutUint16(typ, uint16(tlv.Type()))
buf = append(buf, typ...)
length := make([]uint8, 2)
- binary.BigEndian.PutUint16(length, TLV_COLOR)
+ binary.BigEndian.PutUint16(length, uint16(TLVColor))
buf = append(buf, length...)
color := make([]uint8, 4)
@@ -875,22 +1014,22 @@ func (tlv *Color) MarshalLogObject(enc zapcore.ObjectEncoder) error {
return nil
}
-func (tlv *Color) Type() uint16 {
- return TLV_COLOR
+func (tlv *Color) Type() TLVType {
+ return TLVColor
}
func (tlv *Color) Len() uint16 {
- return TL_LENGTH + TLV_COLOR_LENGTH
+ return TLVHeaderLength + TLVColorValueLength
}
type UndefinedTLV struct {
- Typ uint16
+ Typ TLVType
Length uint16
Value []uint8
}
func (tlv *UndefinedTLV) DecodeFromBytes(data []uint8) error {
- tlv.Typ = binary.BigEndian.Uint16(data[0:2])
+ tlv.Typ = TLVType(binary.BigEndian.Uint16(data[0:2]))
tlv.Length = binary.BigEndian.Uint16(data[2:4])
tlv.Value = data[4 : 4+tlv.Length]
@@ -901,7 +1040,7 @@ func (tlv *UndefinedTLV) Serialize() []uint8 {
bytePcepTLV := []uint8{}
byteTLVType := make([]uint8, 2)
- binary.BigEndian.PutUint16(byteTLVType, tlv.Typ)
+ binary.BigEndian.PutUint16(byteTLVType, uint16(tlv.Typ))
bytePcepTLV = append(bytePcepTLV, byteTLVType...) // Type (2byte)
byteTLVLength := make([]uint8, 2)
@@ -920,7 +1059,7 @@ func (tlv *UndefinedTLV) MarshalLogObject(enc zapcore.ObjectEncoder) error {
return nil
}
-func (tlv *UndefinedTLV) Type() uint16 {
+func (tlv *UndefinedTLV) Type() TLVType {
return tlv.Typ
}
@@ -929,7 +1068,7 @@ func (tlv *UndefinedTLV) Len() uint16 {
if tlv.Length%4 != 0 {
padding = (4 - tlv.Length%4)
}
- return TL_LENGTH + tlv.Length + padding
+ return TLVHeaderLength + tlv.Length + padding
}
func (tlv *UndefinedTLV) CapStrings() []string {
@@ -948,7 +1087,7 @@ func DecodeTLV(data []uint8) (TLVInterface, error) {
tlvType := binary.BigEndian.Uint16(data[0:2])
- if createTLV, found := tlvMap[tlvType]; found {
+ if createTLV, found := tlvMap[TLVType(tlvType)]; found {
tlv := createTLV()
if err := tlv.DecodeFromBytes(data); err != nil {
return nil, fmt.Errorf("error decoding TLV type %x: %w", tlvType, err)
diff --git a/pkg/server/grpc_server.go b/pkg/server/grpc_server.go
index 743ee213..f8c3d2cd 100644
--- a/pkg/server/grpc_server.go
+++ b/pkg/server/grpc_server.go
@@ -441,16 +441,21 @@ func (s *APIServer) GetTed(context.Context, *empty.Empty) (*pb.Ted, error) {
}
func (c *APIServer) DeleteSession(ctx context.Context, input *pb.Session) (*pb.RequestStatus, error) {
- ssAddr, _ := netip.AddrFromSlice(input.GetAddr())
+ ssAddr, ok := netip.AddrFromSlice(input.GetAddr())
+ if !ok {
+ return nil, fmt.Errorf("invalid address: %v", input.GetAddr())
+ }
s := c.pce
- var ss *Session
- if ss = s.SearchSession(ssAddr, false); ss == nil {
- return nil, fmt.Errorf("no session with %s", ssAddr)
+ ss := s.SearchSession(ssAddr, false)
+ if ss == nil {
+ return nil, fmt.Errorf("no session with address %s found", ssAddr)
}
- if err := ss.SendClose(pcep.R_NO_EXPLANATION_PROVIDED); err != nil {
- return &pb.RequestStatus{IsSuccess: false}, err
+
+ if err := ss.SendClose(pcep.CloseReasonNoExplanationProvided); err != nil {
+ return &pb.RequestStatus{IsSuccess: false}, fmt.Errorf("failed to send close message: %v", err)
}
+
// Remove session info from PCE server
s.closeSession(ss)
diff --git a/pkg/server/session.go b/pkg/server/session.go
index 1026a348..79d51e48 100644
--- a/pkg/server/session.go
+++ b/pkg/server/session.go
@@ -36,7 +36,7 @@ func NewSession(sessionID uint8, peerAddr netip.Addr, tcpConn *net.TCPConn, logg
isSynced: false,
srpIDHead: uint32(1),
logger: logger.With(zap.String("server", "pcep"), zap.String("session", peerAddr.String())),
- pccType: pcep.RFC_COMPLIANT,
+ pccType: pcep.RFCCompliant,
peerAddr: peerAddr,
tcpConn: tcpConn,
}
@@ -102,7 +102,7 @@ func (ss *Session) Open() error {
}
func (ss *Session) parseOpenMessage() (*pcep.OpenMessage, error) {
- byteOpenHeader := make([]uint8, pcep.COMMON_HEADER_LENGTH)
+ byteOpenHeader := make([]uint8, pcep.CommonHeaderLength)
if _, err := ss.tcpConn.Read(byteOpenHeader); err != nil {
return nil, err
}
@@ -115,11 +115,11 @@ func (ss *Session) parseOpenMessage() (*pcep.OpenMessage, error) {
if openHeader.Version != 1 {
return nil, fmt.Errorf("PCEP version mismatch (receive version: %d)", openHeader.Version)
}
- if openHeader.MessageType != pcep.MT_OPEN {
- return nil, fmt.Errorf("this peer has not been opened (messageType: %d)", openHeader.MessageType)
+ if openHeader.MessageType != pcep.MessageTypeOpen {
+ return nil, fmt.Errorf("this peer has not been opened (messageType: %s)", openHeader.MessageType.String())
}
- byteOpenObject := make([]uint8, openHeader.MessageLength-pcep.COMMON_HEADER_LENGTH)
+ byteOpenObject := make([]uint8, openHeader.MessageLength-pcep.CommonHeaderLength)
if _, err := ss.tcpConn.Read(byteOpenObject); err != nil {
return nil, err
}
@@ -159,7 +159,7 @@ func (ss *Session) SendKeepalive() error {
return ss.sendPcepMessage(keepaliveMessage)
}
-func (ss *Session) SendClose(reason uint8) error {
+func (ss *Session) SendClose(reason pcep.CloseReason) error {
closeMessage, err := pcep.NewCloseMessage(reason)
if err != nil {
return err
@@ -167,7 +167,7 @@ func (ss *Session) SendClose(reason uint8) error {
byteCloseMessage := closeMessage.Serialize()
ss.logger.Debug("Send Close Message",
- zap.Uint8("reason", closeMessage.CloseObject.Reason),
+ zap.Uint8("reason", uint8(closeMessage.CloseObject.Reason)),
zap.String("detail", "See https://www.iana.org/assignments/pcep/pcep.xhtml#close-object-reason-field"))
if _, err := ss.tcpConn.Write(byteCloseMessage); err != nil {
return err
@@ -185,15 +185,15 @@ func (ss *Session) ReceivePcepMessage() error {
time.Sleep(10 * time.Millisecond)
switch commonHeader.MessageType {
- case pcep.MT_KEEPALIVE:
+ case pcep.MessageTypeKeepalive:
ss.logger.Debug("Received Keepalive")
- case pcep.MT_REPORT:
+ case pcep.MessageTypeReport:
err = ss.handlePCRpt(commonHeader.MessageLength)
if err != nil {
return err
}
- case pcep.MT_ERROR:
- bytePCErrMessageBody := make([]uint8, commonHeader.MessageLength-pcep.COMMON_HEADER_LENGTH)
+ case pcep.MessageTypeError:
+ bytePCErrMessageBody := make([]uint8, commonHeader.MessageLength-pcep.CommonHeaderLength)
if _, err := ss.tcpConn.Read(bytePCErrMessageBody); err != nil {
return err
}
@@ -206,8 +206,8 @@ func (ss *Session) ReceivePcepMessage() error {
zap.Uint8("error-Type", pcerrMessage.PcepErrorObject.ErrorType),
zap.Uint8("error-value", pcerrMessage.PcepErrorObject.ErrorValue),
zap.String("detail", "See https://www.iana.org/assignments/pcep/pcep.xhtml#pcep-error-object"))
- case pcep.MT_CLOSE:
- byteCloseMessageBody := make([]uint8, commonHeader.MessageLength-pcep.COMMON_HEADER_LENGTH)
+ case pcep.MessageTypeClose:
+ byteCloseMessageBody := make([]uint8, commonHeader.MessageLength-pcep.CommonHeaderLength)
if _, err := ss.tcpConn.Read(byteCloseMessageBody); err != nil {
return err
}
@@ -216,19 +216,19 @@ func (ss *Session) ReceivePcepMessage() error {
return err
}
ss.logger.Debug("Received Close",
- zap.Uint8("reason", closeMessage.CloseObject.Reason),
+ zap.String("reason", closeMessage.CloseObject.Reason.String()),
zap.String("detail", "See https://www.iana.org/assignments/pcep/pcep.xhtml#close-object-reason-field"))
// Close session if get Close Message
return nil
default:
ss.logger.Debug("Received unsupported MessageType",
- zap.Uint8("MessageType", commonHeader.MessageType))
+ zap.String("MessageType", commonHeader.MessageType.String()))
}
}
}
func (ss *Session) readCommonHeader() (*pcep.CommonHeader, error) {
- commonHeaderBytes := make([]uint8, pcep.COMMON_HEADER_LENGTH)
+ commonHeaderBytes := make([]uint8, pcep.CommonHeaderLength)
if _, err := ss.tcpConn.Read(commonHeaderBytes); err != nil {
return nil, err
}
@@ -244,7 +244,7 @@ func (ss *Session) readCommonHeader() (*pcep.CommonHeader, error) {
func (ss *Session) handlePCRpt(length uint16) error {
ss.logger.Debug("Received PCRpt Message")
- messageBodyBytes := make([]uint8, length-pcep.COMMON_HEADER_LENGTH)
+ messageBodyBytes := make([]uint8, length-pcep.CommonHeaderLength)
if _, err := ss.tcpConn.Read(messageBodyBytes); err != nil {
return err
}
@@ -256,26 +256,26 @@ func (ss *Session) handlePCRpt(length uint16) error {
for _, sr := range message.StateReports {
// synchronization
- if sr.LspObject.SFlag {
+ if sr.LSPObject.SFlag {
ss.logger.Debug("Synchronize SR Policy information", zap.Any("Message", message))
ss.RegisterSRPolicy(*sr)
- } else if !sr.LspObject.SFlag {
+ } else if !sr.LSPObject.SFlag {
switch {
// finish synchronization
- case sr.LspObject.PlspID == 0:
+ case sr.LSPObject.PlspID == 0:
ss.logger.Debug("Finish PCRpt state synchronization")
ss.isSynced = true
// response to request from PCE
case sr.SrpObject.SrpID != 0:
ss.logger.Debug("Finish Stateful PCE request", zap.Uint32("srpID", sr.SrpObject.SrpID))
- if sr.LspObject.RFlag {
+ if sr.LSPObject.RFlag {
ss.DeleteSRPolicy(*sr)
} else {
ss.RegisterSRPolicy(*sr)
}
default:
- if sr.LspObject.RFlag {
+ if sr.LSPObject.RFlag {
ss.DeleteSRPolicy(*sr)
} else {
ss.RegisterSRPolicy(*sr)
@@ -338,7 +338,7 @@ func (ss *Session) RegisterSRPolicy(sr pcep.StateReport) {
var color uint32 = 0 // Default color value (RFC does not specify a default)
var preference uint32 = 0 // Default preference value (RFC does not specify a default)
- if ss.pccType == pcep.CISCO_LEGACY {
+ if ss.pccType == pcep.CiscoLegacy {
// In Cisco legacy mode, get color and preference from Vendor Information Object
color = sr.VendorInformationObject.Color()
preference = sr.VendorInformationObject.Preference()
@@ -359,16 +359,16 @@ func (ss *Session) RegisterSRPolicy(sr pcep.StateReport) {
if sr.AssociationObject.Color() != 0 {
color = sr.AssociationObject.Color()
} else if hasColorCapability {
- color = sr.LspObject.Color()
+ color = sr.LSPObject.Color()
}
preference = sr.AssociationObject.Preference()
}
- lspID := sr.LspObject.LspID
+ lspID := sr.LSPObject.LSPID
var state table.PolicyState
- switch sr.LspObject.OFlag {
+ switch sr.LSPObject.OFlag {
case uint8(0x00):
state = table.POLICY_DOWN
case uint8(0x01):
@@ -379,17 +379,17 @@ func (ss *Session) RegisterSRPolicy(sr pcep.StateReport) {
state = table.POLICY_UNKNOWN
}
- if p, ok := ss.SearchSRPolicy(sr.LspObject.PlspID); ok {
+ if p, ok := ss.SearchSRPolicy(sr.LSPObject.PlspID); ok {
// update
// If the LSP ID is old, it is not the latest data update.
- if p.LspID <= lspID {
+ if p.LSPID <= lspID {
p.Update(
table.PolicyDiff{
- Name: &sr.LspObject.Name,
+ Name: &sr.LSPObject.Name,
Color: &color,
Preference: &preference,
SegmentList: sr.EroObject.ToSegmentList(),
- LspID: lspID,
+ LSPID: lspID,
State: state,
},
)
@@ -397,15 +397,15 @@ func (ss *Session) RegisterSRPolicy(sr pcep.StateReport) {
} else {
// create
var src, dst netip.Addr
- if src = sr.LspObject.SrcAddr; !src.IsValid() {
+ if src = sr.LSPObject.SrcAddr; !src.IsValid() {
src = sr.AssociationObject.AssocSrc
}
- if dst = sr.LspObject.DstAddr; !dst.IsValid() {
+ if dst = sr.LSPObject.DstAddr; !dst.IsValid() {
dst = sr.AssociationObject.Endpoint()
}
p := table.NewSRPolicy(
- sr.LspObject.PlspID,
- sr.LspObject.Name,
+ sr.LSPObject.PlspID,
+ sr.LSPObject.Name,
sr.EroObject.ToSegmentList(),
src,
dst,
@@ -419,10 +419,10 @@ func (ss *Session) RegisterSRPolicy(sr pcep.StateReport) {
}
func (ss *Session) DeleteSRPolicy(sr pcep.StateReport) {
- lspID := sr.LspObject.LspID
+ lspID := sr.LSPObject.LSPID
for i, v := range ss.srPolicies {
// If the LSP ID is old, it is not the latest data update.
- if v.PlspID == sr.LspObject.PlspID && v.LspID <= lspID {
+ if v.PlspID == sr.LSPObject.PlspID && v.LSPID <= lspID {
ss.srPolicies[i] = ss.srPolicies[len(ss.srPolicies)-1]
ss.srPolicies = ss.srPolicies[:len(ss.srPolicies)-1]
break
From 644cb7d69de9b722fa62a01a9c4e31fc5cc6861b Mon Sep 17 00:00:00 2001
From: watal
Date: Mon, 14 Apr 2025 21:24:43 +0900
Subject: [PATCH 09/87] refactor(polad): rename constant
---
cmd/polad/main.go | 4 ++--
internal/pkg/version/version.go | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/cmd/polad/main.go b/cmd/polad/main.go
index 96d4f162..b56f6033 100644
--- a/cmd/polad/main.go
+++ b/cmd/polad/main.go
@@ -22,7 +22,7 @@ import (
"github.com/nttcom/pola/pkg/server"
)
-const TED_UPDATE_INTERVAL = 1 // (min)
+const TEDUpdateInterval = 1 // (min)
type flags struct {
configFile string
@@ -118,7 +118,7 @@ func startGobgpUpdate(c *config.Config, logger *zap.Logger) chan []table.TedElem
} else {
tedElemsChan <- tedElems
}
- time.Sleep(TED_UPDATE_INTERVAL * time.Minute)
+ time.Sleep(TEDUpdateInterval * time.Minute)
}
}()
diff --git a/internal/pkg/version/version.go b/internal/pkg/version/version.go
index 4cf922ea..f88dc4be 100644
--- a/internal/pkg/version/version.go
+++ b/internal/pkg/version/version.go
@@ -7,10 +7,10 @@ package version
import "fmt"
-const MAJOR uint = 1
-const MINOR uint = 3
-const PATCH uint = 0
+const Major uint = 1
+const Minor uint = 3
+const Patch uint = 0
func Version() string {
- return fmt.Sprintf("%d.%d.%d", MAJOR, MINOR, PATCH)
+ return fmt.Sprintf("%d.%d.%d", Major, Minor, Patch)
}
From 08531c1a31f0ca67e1ddef32513e0927c3ca7e8e Mon Sep 17 00:00:00 2001
From: watal
Date: Tue, 15 Apr 2025 09:53:57 +0900
Subject: [PATCH 10/87] refactor: rename acronym variables to follow Go naming
conventions
---
api/grpc/pola.pb.go | 577 ++++++------------
api/grpc/pola.proto | 21 +-
api/grpc/pola.zap.go | 6 +-
api/grpc/pola_grpc.pb.go | 218 +++----
cmd/pola/grpc/grpc_client.go | 54 +-
cmd/pola/root.go | 6 +-
cmd/pola/sr_policy_add.go | 14 +-
cmd/pola/sr_policy_delete.go | 6 +-
cmd/pola/ted.go | 6 +-
cmd/polad/main.go | 32 +-
examples/tinet/sr-mpls_te_l3vpn/README.md | 43 +-
internal/config/config.go | 20 +-
internal/pkg/cspf/cspf.go | 2 +-
internal/pkg/gobgp/interface.go | 106 ++--
internal/pkg/table/sr_policy.go | 50 +-
internal/pkg/table/ted.go | 60 +-
pkg/packet/pcep/capability.go | 4 +-
pkg/packet/pcep/message.go | 24 +-
pkg/packet/pcep/object.go | 25 +-
pkg/packet/pcep/tlv.go | 84 +--
pkg/server/error.go | 2 +-
pkg/server/grpc_server.go | 56 +-
pkg/server/server.go | 32 +-
pkg/server/session.go | 28 +-
tools/grpc/go/add_sr-policy/add_sr-policy.go | 4 +-
.../add_sr-policy_no_ls.go | 4 +-
tools/grpc/go/del_session/del_session.go | 2 +-
tools/grpc/go/show_session/show_session.go | 2 +-
.../go/show_sr-policy/show_sr-policy_list.go | 4 +-
tools/grpc/go/show_ted/show_ted.go | 4 +-
30 files changed, 641 insertions(+), 855 deletions(-)
diff --git a/api/grpc/pola.pb.go b/api/grpc/pola.pb.go
index 060773f3..cfb7533e 100644
--- a/api/grpc/pola.pb.go
+++ b/api/grpc/pola.pb.go
@@ -5,18 +5,19 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
-// protoc-gen-go v1.34.1
-// protoc v3.12.4
+// protoc-gen-go v1.36.5
+// protoc v5.29.3
// source: pola.proto
package grpc
import (
- empty "github.com/golang/protobuf/ptypes/empty"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ emptypb "google.golang.org/protobuf/types/known/emptypb"
reflect "reflect"
sync "sync"
+ unsafe "unsafe"
)
const (
@@ -171,23 +172,20 @@ func (MetricType) EnumDescriptor() ([]byte, []int) {
}
type Segment struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Sid string `protobuf:"bytes,1,opt,name=sid,proto3" json:"sid,omitempty"`
+ SidStructure string `protobuf:"bytes,2,opt,name=sidStructure,proto3" json:"sidStructure,omitempty"`
+ LocalAddr string `protobuf:"bytes,3,opt,name=localAddr,proto3" json:"localAddr,omitempty"`
+ RemoteAddr string `protobuf:"bytes,4,opt,name=remoteAddr,proto3" json:"remoteAddr,omitempty"`
unknownFields protoimpl.UnknownFields
-
- Sid string `protobuf:"bytes,1,opt,name=sid,proto3" json:"sid,omitempty"`
- SidStructure string `protobuf:"bytes,2,opt,name=sidStructure,proto3" json:"sidStructure,omitempty"`
- LocalAddr string `protobuf:"bytes,3,opt,name=localAddr,proto3" json:"localAddr,omitempty"`
- RemoteAddr string `protobuf:"bytes,4,opt,name=remoteAddr,proto3" json:"remoteAddr,omitempty"`
+ sizeCache protoimpl.SizeCache
}
func (x *Segment) Reset() {
*x = Segment{}
- if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[0]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
+ mi := &file_pola_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
}
func (x *Segment) String() string {
@@ -198,7 +196,7 @@ func (*Segment) ProtoMessage() {}
func (x *Segment) ProtoReflect() protoreflect.Message {
mi := &file_pola_proto_msgTypes[0]
- if protoimpl.UnsafeEnabled && x != nil {
+ if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -242,30 +240,27 @@ func (x *Segment) GetRemoteAddr() string {
}
type SRPolicy struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- PcepSessionAddr []byte `protobuf:"bytes,1,opt,name=pcepSessionAddr,proto3" json:"pcepSessionAddr,omitempty"`
- SrcAddr []byte `protobuf:"bytes,2,opt,name=srcAddr,proto3" json:"srcAddr,omitempty"`
- DstAddr []byte `protobuf:"bytes,3,opt,name=dstAddr,proto3" json:"dstAddr,omitempty"`
- SrcRouterID string `protobuf:"bytes,4,opt,name=srcRouterID,proto3" json:"srcRouterID,omitempty"`
- DstRouterID string `protobuf:"bytes,5,opt,name=dstRouterID,proto3" json:"dstRouterID,omitempty"`
- Color uint32 `protobuf:"varint,6,opt,name=color,proto3" json:"color,omitempty"`
- Preference uint32 `protobuf:"varint,7,opt,name=preference,proto3" json:"preference,omitempty"`
- PolicyName string `protobuf:"bytes,8,opt,name=policyName,proto3" json:"policyName,omitempty"`
- Type SRPolicyType `protobuf:"varint,9,opt,name=type,proto3,enum=pb.SRPolicyType" json:"type,omitempty"`
- SegmentList []*Segment `protobuf:"bytes,10,rep,name=segmentList,proto3" json:"segmentList,omitempty"`
- Metric MetricType `protobuf:"varint,11,opt,name=metric,proto3,enum=pb.MetricType" json:"metric,omitempty"`
+ state protoimpl.MessageState `protogen:"open.v1"`
+ PCEPSessionAddr []byte `protobuf:"bytes,1,opt,name=PCEPSessionAddr,proto3" json:"PCEPSessionAddr,omitempty"`
+ SrcAddr []byte `protobuf:"bytes,2,opt,name=srcAddr,proto3" json:"srcAddr,omitempty"`
+ DstAddr []byte `protobuf:"bytes,3,opt,name=dstAddr,proto3" json:"dstAddr,omitempty"`
+ SrcRouterID string `protobuf:"bytes,4,opt,name=srcRouterID,proto3" json:"srcRouterID,omitempty"`
+ DstRouterID string `protobuf:"bytes,5,opt,name=dstRouterID,proto3" json:"dstRouterID,omitempty"`
+ Color uint32 `protobuf:"varint,6,opt,name=color,proto3" json:"color,omitempty"`
+ Preference uint32 `protobuf:"varint,7,opt,name=preference,proto3" json:"preference,omitempty"`
+ PolicyName string `protobuf:"bytes,8,opt,name=policyName,proto3" json:"policyName,omitempty"`
+ Type SRPolicyType `protobuf:"varint,9,opt,name=type,proto3,enum=pb.SRPolicyType" json:"type,omitempty"`
+ SegmentList []*Segment `protobuf:"bytes,10,rep,name=segmentList,proto3" json:"segmentList,omitempty"`
+ Metric MetricType `protobuf:"varint,11,opt,name=metric,proto3,enum=pb.MetricType" json:"metric,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
}
func (x *SRPolicy) Reset() {
*x = SRPolicy{}
- if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[1]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
+ mi := &file_pola_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
}
func (x *SRPolicy) String() string {
@@ -276,7 +271,7 @@ func (*SRPolicy) ProtoMessage() {}
func (x *SRPolicy) ProtoReflect() protoreflect.Message {
mi := &file_pola_proto_msgTypes[1]
- if protoimpl.UnsafeEnabled && x != nil {
+ if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -291,9 +286,9 @@ func (*SRPolicy) Descriptor() ([]byte, []int) {
return file_pola_proto_rawDescGZIP(), []int{1}
}
-func (x *SRPolicy) GetPcepSessionAddr() []byte {
+func (x *SRPolicy) GetPCEPSessionAddr() []byte {
if x != nil {
- return x.PcepSessionAddr
+ return x.PCEPSessionAddr
}
return nil
}
@@ -369,21 +364,18 @@ func (x *SRPolicy) GetMetric() MetricType {
}
type CreateSRPolicyInput struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
+ state protoimpl.MessageState `protogen:"open.v1"`
+ SRPolicy *SRPolicy `protobuf:"bytes,1,opt,name=SRPolicy,proto3" json:"SRPolicy,omitempty"`
+ Asn uint32 `protobuf:"varint,2,opt,name=asn,proto3" json:"asn,omitempty"`
unknownFields protoimpl.UnknownFields
-
- SRPolicy *SRPolicy `protobuf:"bytes,1,opt,name=SRPolicy,proto3" json:"SRPolicy,omitempty"`
- Asn uint32 `protobuf:"varint,2,opt,name=asn,proto3" json:"asn,omitempty"`
+ sizeCache protoimpl.SizeCache
}
func (x *CreateSRPolicyInput) Reset() {
*x = CreateSRPolicyInput{}
- if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[2]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
+ mi := &file_pola_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
}
func (x *CreateSRPolicyInput) String() string {
@@ -394,7 +386,7 @@ func (*CreateSRPolicyInput) ProtoMessage() {}
func (x *CreateSRPolicyInput) ProtoReflect() protoreflect.Message {
mi := &file_pola_proto_msgTypes[2]
- if protoimpl.UnsafeEnabled && x != nil {
+ if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -424,21 +416,18 @@ func (x *CreateSRPolicyInput) GetAsn() uint32 {
}
type DeleteSRPolicyInput struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
+ state protoimpl.MessageState `protogen:"open.v1"`
+ SRPolicy *SRPolicy `protobuf:"bytes,1,opt,name=SRPolicy,proto3" json:"SRPolicy,omitempty"`
+ Asn uint32 `protobuf:"varint,2,opt,name=asn,proto3" json:"asn,omitempty"`
unknownFields protoimpl.UnknownFields
-
- SRPolicy *SRPolicy `protobuf:"bytes,1,opt,name=SRPolicy,proto3" json:"SRPolicy,omitempty"`
- Asn uint32 `protobuf:"varint,2,opt,name=asn,proto3" json:"asn,omitempty"`
+ sizeCache protoimpl.SizeCache
}
func (x *DeleteSRPolicyInput) Reset() {
*x = DeleteSRPolicyInput{}
- if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[3]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
+ mi := &file_pola_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
}
func (x *DeleteSRPolicyInput) String() string {
@@ -449,7 +438,7 @@ func (*DeleteSRPolicyInput) ProtoMessage() {}
func (x *DeleteSRPolicyInput) ProtoReflect() protoreflect.Message {
mi := &file_pola_proto_msgTypes[3]
- if protoimpl.UnsafeEnabled && x != nil {
+ if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -479,20 +468,17 @@ func (x *DeleteSRPolicyInput) GetAsn() uint32 {
}
type RequestStatus struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
+ state protoimpl.MessageState `protogen:"open.v1"`
+ IsSuccess bool `protobuf:"varint,1,opt,name=isSuccess,proto3" json:"isSuccess,omitempty"`
unknownFields protoimpl.UnknownFields
-
- IsSuccess bool `protobuf:"varint,1,opt,name=isSuccess,proto3" json:"isSuccess,omitempty"`
+ sizeCache protoimpl.SizeCache
}
func (x *RequestStatus) Reset() {
*x = RequestStatus{}
- if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[4]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
+ mi := &file_pola_proto_msgTypes[4]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
}
func (x *RequestStatus) String() string {
@@ -503,7 +489,7 @@ func (*RequestStatus) ProtoMessage() {}
func (x *RequestStatus) ProtoReflect() protoreflect.Message {
mi := &file_pola_proto_msgTypes[4]
- if protoimpl.UnsafeEnabled && x != nil {
+ if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -526,23 +512,20 @@ func (x *RequestStatus) GetIsSuccess() bool {
}
type Session struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Addr []byte `protobuf:"bytes,1,opt,name=Addr,proto3" json:"Addr,omitempty"`
+ State SessionState `protobuf:"varint,2,opt,name=State,proto3,enum=pb.SessionState" json:"State,omitempty"`
+ Caps []string `protobuf:"bytes,3,rep,name=Caps,proto3" json:"Caps,omitempty"`
+ IsSynced bool `protobuf:"varint,4,opt,name=IsSynced,proto3" json:"IsSynced,omitempty"`
unknownFields protoimpl.UnknownFields
-
- Addr []byte `protobuf:"bytes,1,opt,name=Addr,proto3" json:"Addr,omitempty"`
- State SessionState `protobuf:"varint,2,opt,name=State,proto3,enum=pb.SessionState" json:"State,omitempty"`
- Caps []string `protobuf:"bytes,3,rep,name=Caps,proto3" json:"Caps,omitempty"`
- IsSynced bool `protobuf:"varint,4,opt,name=IsSynced,proto3" json:"IsSynced,omitempty"`
+ sizeCache protoimpl.SizeCache
}
func (x *Session) Reset() {
*x = Session{}
- if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[5]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
+ mi := &file_pola_proto_msgTypes[5]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
}
func (x *Session) String() string {
@@ -553,7 +536,7 @@ func (*Session) ProtoMessage() {}
func (x *Session) ProtoReflect() protoreflect.Message {
mi := &file_pola_proto_msgTypes[5]
- if protoimpl.UnsafeEnabled && x != nil {
+ if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -597,20 +580,17 @@ func (x *Session) GetIsSynced() bool {
}
type SessionList struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Sessions []*Session `protobuf:"bytes,1,rep,name=Sessions,proto3" json:"Sessions,omitempty"`
unknownFields protoimpl.UnknownFields
-
- Sessions []*Session `protobuf:"bytes,1,rep,name=Sessions,proto3" json:"Sessions,omitempty"`
+ sizeCache protoimpl.SizeCache
}
func (x *SessionList) Reset() {
*x = SessionList{}
- if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[6]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
+ mi := &file_pola_proto_msgTypes[6]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
}
func (x *SessionList) String() string {
@@ -621,7 +601,7 @@ func (*SessionList) ProtoMessage() {}
func (x *SessionList) ProtoReflect() protoreflect.Message {
mi := &file_pola_proto_msgTypes[6]
- if protoimpl.UnsafeEnabled && x != nil {
+ if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -644,20 +624,17 @@ func (x *SessionList) GetSessions() []*Session {
}
type SRPolicyList struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
+ state protoimpl.MessageState `protogen:"open.v1"`
+ SRPolicies []*SRPolicy `protobuf:"bytes,1,rep,name=SRPolicies,proto3" json:"SRPolicies,omitempty"`
unknownFields protoimpl.UnknownFields
-
- SRPolicies []*SRPolicy `protobuf:"bytes,1,rep,name=SRPolicies,proto3" json:"SRPolicies,omitempty"`
+ sizeCache protoimpl.SizeCache
}
func (x *SRPolicyList) Reset() {
*x = SRPolicyList{}
- if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[7]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
+ mi := &file_pola_proto_msgTypes[7]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
}
func (x *SRPolicyList) String() string {
@@ -668,7 +645,7 @@ func (*SRPolicyList) ProtoMessage() {}
func (x *SRPolicyList) ProtoReflect() protoreflect.Message {
mi := &file_pola_proto_msgTypes[7]
- if protoimpl.UnsafeEnabled && x != nil {
+ if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -691,21 +668,18 @@ func (x *SRPolicyList) GetSRPolicies() []*SRPolicy {
}
type LsPrefix struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Prefix string `protobuf:"bytes,1,opt,name=prefix,proto3" json:"prefix,omitempty"`
+ SidIndex uint32 `protobuf:"varint,2,opt,name=sidIndex,proto3" json:"sidIndex,omitempty"`
unknownFields protoimpl.UnknownFields
-
- Prefix string `protobuf:"bytes,1,opt,name=prefix,proto3" json:"prefix,omitempty"`
- SidIndex uint32 `protobuf:"varint,2,opt,name=sidIndex,proto3" json:"sidIndex,omitempty"`
+ sizeCache protoimpl.SizeCache
}
func (x *LsPrefix) Reset() {
*x = LsPrefix{}
- if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[8]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
+ mi := &file_pola_proto_msgTypes[8]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
}
func (x *LsPrefix) String() string {
@@ -716,7 +690,7 @@ func (*LsPrefix) ProtoMessage() {}
func (x *LsPrefix) ProtoReflect() protoreflect.Message {
mi := &file_pola_proto_msgTypes[8]
- if protoimpl.UnsafeEnabled && x != nil {
+ if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -746,21 +720,18 @@ func (x *LsPrefix) GetSidIndex() uint32 {
}
type Metric struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Type MetricType `protobuf:"varint,1,opt,name=type,proto3,enum=pb.MetricType" json:"type,omitempty"`
+ Value uint32 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"`
unknownFields protoimpl.UnknownFields
-
- Type MetricType `protobuf:"varint,1,opt,name=type,proto3,enum=pb.MetricType" json:"type,omitempty"`
- Value uint32 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"`
+ sizeCache protoimpl.SizeCache
}
func (x *Metric) Reset() {
*x = Metric{}
- if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[9]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
+ mi := &file_pola_proto_msgTypes[9]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
}
func (x *Metric) String() string {
@@ -771,7 +742,7 @@ func (*Metric) ProtoMessage() {}
func (x *Metric) ProtoReflect() protoreflect.Message {
mi := &file_pola_proto_msgTypes[9]
- if protoimpl.UnsafeEnabled && x != nil {
+ if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -801,27 +772,24 @@ func (x *Metric) GetValue() uint32 {
}
type LsLink struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- LocalRouterID string `protobuf:"bytes,1,opt,name=localRouterID,proto3" json:"localRouterID,omitempty"`
- LocalAsn uint32 `protobuf:"varint,2,opt,name=localAsn,proto3" json:"localAsn,omitempty"`
- LocalIP string `protobuf:"bytes,3,opt,name=localIP,proto3" json:"localIP,omitempty"`
- RemoteRouterID string `protobuf:"bytes,4,opt,name=remoteRouterID,proto3" json:"remoteRouterID,omitempty"`
- RemoteAsn uint32 `protobuf:"varint,5,opt,name=remoteAsn,proto3" json:"remoteAsn,omitempty"`
- RemoteIP string `protobuf:"bytes,6,opt,name=remoteIP,proto3" json:"remoteIP,omitempty"`
- Metrics []*Metric `protobuf:"bytes,7,rep,name=metrics,proto3" json:"metrics,omitempty"`
- AdjSid uint32 `protobuf:"varint,8,opt,name=adjSid,proto3" json:"adjSid,omitempty"`
+ state protoimpl.MessageState `protogen:"open.v1"`
+ LocalRouterID string `protobuf:"bytes,1,opt,name=localRouterID,proto3" json:"localRouterID,omitempty"`
+ LocalASN uint32 `protobuf:"varint,2,opt,name=localASN,proto3" json:"localASN,omitempty"`
+ LocalIP string `protobuf:"bytes,3,opt,name=localIP,proto3" json:"localIP,omitempty"`
+ RemoteRouterID string `protobuf:"bytes,4,opt,name=remoteRouterID,proto3" json:"remoteRouterID,omitempty"`
+ RemoteASN uint32 `protobuf:"varint,5,opt,name=remoteASN,proto3" json:"remoteASN,omitempty"`
+ RemoteIP string `protobuf:"bytes,6,opt,name=remoteIP,proto3" json:"remoteIP,omitempty"`
+ Metrics []*Metric `protobuf:"bytes,7,rep,name=metrics,proto3" json:"metrics,omitempty"`
+ AdjSID uint32 `protobuf:"varint,8,opt,name=adjSID,proto3" json:"adjSID,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
}
func (x *LsLink) Reset() {
*x = LsLink{}
- if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[10]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
+ mi := &file_pola_proto_msgTypes[10]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
}
func (x *LsLink) String() string {
@@ -832,7 +800,7 @@ func (*LsLink) ProtoMessage() {}
func (x *LsLink) ProtoReflect() protoreflect.Message {
mi := &file_pola_proto_msgTypes[10]
- if protoimpl.UnsafeEnabled && x != nil {
+ if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -854,9 +822,9 @@ func (x *LsLink) GetLocalRouterID() string {
return ""
}
-func (x *LsLink) GetLocalAsn() uint32 {
+func (x *LsLink) GetLocalASN() uint32 {
if x != nil {
- return x.LocalAsn
+ return x.LocalASN
}
return 0
}
@@ -875,9 +843,9 @@ func (x *LsLink) GetRemoteRouterID() string {
return ""
}
-func (x *LsLink) GetRemoteAsn() uint32 {
+func (x *LsLink) GetRemoteASN() uint32 {
if x != nil {
- return x.RemoteAsn
+ return x.RemoteASN
}
return 0
}
@@ -896,35 +864,32 @@ func (x *LsLink) GetMetrics() []*Metric {
return nil
}
-func (x *LsLink) GetAdjSid() uint32 {
+func (x *LsLink) GetAdjSID() uint32 {
if x != nil {
- return x.AdjSid
+ return x.AdjSID
}
return 0
}
type LsNode struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Asn uint32 `protobuf:"varint,1,opt,name=asn,proto3" json:"asn,omitempty"`
+ RouterID string `protobuf:"bytes,2,opt,name=routerID,proto3" json:"routerID,omitempty"`
+ IsisAreaID string `protobuf:"bytes,3,opt,name=isisAreaID,proto3" json:"isisAreaID,omitempty"`
+ Hostname string `protobuf:"bytes,4,opt,name=hostname,proto3" json:"hostname,omitempty"`
+ SrgbBegin uint32 `protobuf:"varint,5,opt,name=srgbBegin,proto3" json:"srgbBegin,omitempty"`
+ SrgbEnd uint32 `protobuf:"varint,6,opt,name=srgbEnd,proto3" json:"srgbEnd,omitempty"`
+ LsLinks []*LsLink `protobuf:"bytes,7,rep,name=lsLinks,proto3" json:"lsLinks,omitempty"`
+ LsPrefixes []*LsPrefix `protobuf:"bytes,8,rep,name=lsPrefixes,proto3" json:"lsPrefixes,omitempty"`
unknownFields protoimpl.UnknownFields
-
- Asn uint32 `protobuf:"varint,1,opt,name=asn,proto3" json:"asn,omitempty"`
- RouterID string `protobuf:"bytes,2,opt,name=routerID,proto3" json:"routerID,omitempty"`
- IsisAreaID string `protobuf:"bytes,3,opt,name=isisAreaID,proto3" json:"isisAreaID,omitempty"`
- Hostname string `protobuf:"bytes,4,opt,name=hostname,proto3" json:"hostname,omitempty"`
- SrgbBegin uint32 `protobuf:"varint,5,opt,name=srgbBegin,proto3" json:"srgbBegin,omitempty"`
- SrgbEnd uint32 `protobuf:"varint,6,opt,name=srgbEnd,proto3" json:"srgbEnd,omitempty"`
- LsLinks []*LsLink `protobuf:"bytes,7,rep,name=lsLinks,proto3" json:"lsLinks,omitempty"`
- LsPrefixes []*LsPrefix `protobuf:"bytes,8,rep,name=lsPrefixes,proto3" json:"lsPrefixes,omitempty"`
+ sizeCache protoimpl.SizeCache
}
func (x *LsNode) Reset() {
*x = LsNode{}
- if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[11]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
+ mi := &file_pola_proto_msgTypes[11]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
}
func (x *LsNode) String() string {
@@ -935,7 +900,7 @@ func (*LsNode) ProtoMessage() {}
func (x *LsNode) ProtoReflect() protoreflect.Message {
mi := &file_pola_proto_msgTypes[11]
- if protoimpl.UnsafeEnabled && x != nil {
+ if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -1006,33 +971,30 @@ func (x *LsNode) GetLsPrefixes() []*LsPrefix {
return nil
}
-type Ted struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
+type TED struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Enable bool `protobuf:"varint,1,opt,name=enable,proto3" json:"enable,omitempty"`
+ LsNodes []*LsNode `protobuf:"bytes,2,rep,name=lsNodes,proto3" json:"lsNodes,omitempty"`
unknownFields protoimpl.UnknownFields
-
- Enable bool `protobuf:"varint,1,opt,name=enable,proto3" json:"enable,omitempty"`
- LsNodes []*LsNode `protobuf:"bytes,2,rep,name=lsNodes,proto3" json:"lsNodes,omitempty"`
+ sizeCache protoimpl.SizeCache
}
-func (x *Ted) Reset() {
- *x = Ted{}
- if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[12]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
+func (x *TED) Reset() {
+ *x = TED{}
+ mi := &file_pola_proto_msgTypes[12]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
}
-func (x *Ted) String() string {
+func (x *TED) String() string {
return protoimpl.X.MessageStringOf(x)
}
-func (*Ted) ProtoMessage() {}
+func (*TED) ProtoMessage() {}
-func (x *Ted) ProtoReflect() protoreflect.Message {
+func (x *TED) ProtoReflect() protoreflect.Message {
mi := &file_pola_proto_msgTypes[12]
- if protoimpl.UnsafeEnabled && x != nil {
+ if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
@@ -1042,19 +1004,19 @@ func (x *Ted) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
-// Deprecated: Use Ted.ProtoReflect.Descriptor instead.
-func (*Ted) Descriptor() ([]byte, []int) {
+// Deprecated: Use TED.ProtoReflect.Descriptor instead.
+func (*TED) Descriptor() ([]byte, []int) {
return file_pola_proto_rawDescGZIP(), []int{12}
}
-func (x *Ted) GetEnable() bool {
+func (x *TED) GetEnable() bool {
if x != nil {
return x.Enable
}
return false
}
-func (x *Ted) GetLsNodes() []*LsNode {
+func (x *TED) GetLsNodes() []*LsNode {
if x != nil {
return x.LsNodes
}
@@ -1063,7 +1025,7 @@ func (x *Ted) GetLsNodes() []*LsNode {
var File_pola_proto protoreflect.FileDescriptor
-var file_pola_proto_rawDesc = []byte{
+var file_pola_proto_rawDesc = string([]byte{
0x0a, 0x0a, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62,
0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x7d, 0x0a,
@@ -1075,9 +1037,9 @@ var file_pola_proto_rawDesc = []byte{
0x09, 0x52, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x12, 0x1e, 0x0a, 0x0a,
0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x64, 0x64, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0a, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x64, 0x64, 0x72, 0x22, 0xff, 0x02, 0x0a,
- 0x08, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x28, 0x0a, 0x0f, 0x70, 0x63, 0x65,
- 0x70, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01,
- 0x28, 0x0c, 0x52, 0x0f, 0x70, 0x63, 0x65, 0x70, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x41,
+ 0x08, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x28, 0x0a, 0x0f, 0x50, 0x43, 0x45,
+ 0x50, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x0c, 0x52, 0x0f, 0x50, 0x43, 0x45, 0x50, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x41,
0x64, 0x64, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x72, 0x63, 0x41, 0x64, 0x64, 0x72, 0x18, 0x02,
0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x72, 0x63, 0x41, 0x64, 0x64, 0x72, 0x12, 0x18, 0x0a,
0x07, 0x64, 0x73, 0x74, 0x41, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07,
@@ -1138,20 +1100,20 @@ var file_pola_proto_rawDesc = []byte{
0x61, 0x6c, 0x75, 0x65, 0x22, 0x84, 0x02, 0x0a, 0x06, 0x4c, 0x73, 0x4c, 0x69, 0x6e, 0x6b, 0x12,
0x24, 0x0a, 0x0d, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x49, 0x44,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x52, 0x6f, 0x75,
- 0x74, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x41, 0x73,
- 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x41, 0x73,
- 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x49, 0x50, 0x18, 0x03, 0x20, 0x01,
+ 0x74, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x41, 0x53,
+ 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x41, 0x53,
+ 0x4e, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x49, 0x50, 0x18, 0x03, 0x20, 0x01,
0x28, 0x09, 0x52, 0x07, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x49, 0x50, 0x12, 0x26, 0x0a, 0x0e, 0x72,
0x65, 0x6d, 0x6f, 0x74, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x49, 0x44, 0x18, 0x04, 0x20,
0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65,
- 0x72, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x73, 0x6e,
- 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x73,
- 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x49, 0x50, 0x18, 0x06, 0x20,
+ 0x72, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x53, 0x4e,
+ 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x53,
+ 0x4e, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x49, 0x50, 0x18, 0x06, 0x20,
0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x49, 0x50, 0x12, 0x24, 0x0a,
0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a,
0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x72,
- 0x69, 0x63, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x64, 0x6a, 0x53, 0x69, 0x64, 0x18, 0x08, 0x20,
- 0x01, 0x28, 0x0d, 0x52, 0x06, 0x61, 0x64, 0x6a, 0x53, 0x69, 0x64, 0x22, 0xfe, 0x01, 0x0a, 0x06,
+ 0x69, 0x63, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x64, 0x6a, 0x53, 0x49, 0x44, 0x18, 0x08, 0x20,
+ 0x01, 0x28, 0x0d, 0x52, 0x06, 0x61, 0x64, 0x6a, 0x53, 0x49, 0x44, 0x22, 0xfe, 0x01, 0x0a, 0x06,
0x4c, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x73, 0x6e, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0d, 0x52, 0x03, 0x61, 0x73, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x6f, 0x75, 0x74,
0x65, 0x72, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x6f, 0x75, 0x74,
@@ -1168,7 +1130,7 @@ var file_pola_proto_rawDesc = []byte{
0x0a, 0x0a, 0x6c, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78,
0x52, 0x0a, 0x6c, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x65, 0x73, 0x22, 0x43, 0x0a, 0x03,
- 0x54, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20,
+ 0x54, 0x45, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x08, 0x52, 0x06, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x24, 0x0a, 0x07, 0x6c,
0x73, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70,
0x62, 0x2e, 0x4c, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x07, 0x6c, 0x73, 0x4e, 0x6f, 0x64, 0x65,
@@ -1180,7 +1142,7 @@ var file_pola_proto_rawDesc = []byte{
0x0a, 0x0a, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a, 0x03,
0x49, 0x47, 0x50, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x54, 0x45, 0x10, 0x01, 0x12, 0x09, 0x0a,
0x05, 0x44, 0x45, 0x4c, 0x41, 0x59, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x48, 0x4f, 0x50, 0x43,
- 0x4f, 0x55, 0x4e, 0x54, 0x10, 0x03, 0x32, 0x88, 0x04, 0x0a, 0x0a, 0x50, 0x63, 0x65, 0x53, 0x65,
+ 0x4f, 0x55, 0x4e, 0x54, 0x10, 0x03, 0x32, 0x88, 0x04, 0x0a, 0x0a, 0x50, 0x43, 0x45, 0x53, 0x65,
0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3e, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53,
0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65,
0x61, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x49, 0x6e, 0x70, 0x75, 0x74,
@@ -1207,32 +1169,32 @@ var file_pola_proto_rawDesc = []byte{
0x79, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x10, 0x2e,
0x70, 0x62, 0x2e, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x22,
- 0x00, 0x12, 0x2b, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x54, 0x65, 0x64, 0x12, 0x16, 0x2e, 0x67, 0x6f,
+ 0x00, 0x12, 0x2b, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x54, 0x45, 0x44, 0x12, 0x16, 0x2e, 0x67, 0x6f,
0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d,
- 0x70, 0x74, 0x79, 0x1a, 0x07, 0x2e, 0x70, 0x62, 0x2e, 0x54, 0x65, 0x64, 0x22, 0x00, 0x12, 0x31,
+ 0x70, 0x74, 0x79, 0x1a, 0x07, 0x2e, 0x70, 0x62, 0x2e, 0x54, 0x45, 0x44, 0x22, 0x00, 0x12, 0x31,
0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12,
0x0b, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x1a, 0x11, 0x2e, 0x70,
0x62, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22,
0x00, 0x42, 0x21, 0x5a, 0x1f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
0x6e, 0x74, 0x74, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6f, 0x6c, 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f,
0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
-}
+})
var (
file_pola_proto_rawDescOnce sync.Once
- file_pola_proto_rawDescData = file_pola_proto_rawDesc
+ file_pola_proto_rawDescData []byte
)
func file_pola_proto_rawDescGZIP() []byte {
file_pola_proto_rawDescOnce.Do(func() {
- file_pola_proto_rawDescData = protoimpl.X.CompressGZIP(file_pola_proto_rawDescData)
+ file_pola_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_pola_proto_rawDesc), len(file_pola_proto_rawDesc)))
})
return file_pola_proto_rawDescData
}
var file_pola_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
var file_pola_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
-var file_pola_proto_goTypes = []interface{}{
+var file_pola_proto_goTypes = []any{
(SRPolicyType)(0), // 0: pb.SRPolicyType
(SessionState)(0), // 1: pb.SessionState
(MetricType)(0), // 2: pb.MetricType
@@ -1248,8 +1210,8 @@ var file_pola_proto_goTypes = []interface{}{
(*Metric)(nil), // 12: pb.Metric
(*LsLink)(nil), // 13: pb.LsLink
(*LsNode)(nil), // 14: pb.LsNode
- (*Ted)(nil), // 15: pb.Ted
- (*empty.Empty)(nil), // 16: google.protobuf.Empty
+ (*TED)(nil), // 15: pb.TED
+ (*emptypb.Empty)(nil), // 16: google.protobuf.Empty
}
var file_pola_proto_depIdxs = []int32{
0, // 0: pb.SRPolicy.type:type_name -> pb.SRPolicyType
@@ -1264,23 +1226,23 @@ var file_pola_proto_depIdxs = []int32{
12, // 9: pb.LsLink.metrics:type_name -> pb.Metric
13, // 10: pb.LsNode.lsLinks:type_name -> pb.LsLink
11, // 11: pb.LsNode.lsPrefixes:type_name -> pb.LsPrefix
- 14, // 12: pb.Ted.lsNodes:type_name -> pb.LsNode
- 5, // 13: pb.PceService.CreateSRPolicy:input_type -> pb.CreateSRPolicyInput
- 5, // 14: pb.PceService.CreateSRPolicyWithoutLinkState:input_type -> pb.CreateSRPolicyInput
- 6, // 15: pb.PceService.DeleteSRPolicy:input_type -> pb.DeleteSRPolicyInput
- 6, // 16: pb.PceService.DeleteSRPolicyWithoutLinkState:input_type -> pb.DeleteSRPolicyInput
- 16, // 17: pb.PceService.GetSessionList:input_type -> google.protobuf.Empty
- 16, // 18: pb.PceService.GetSRPolicyList:input_type -> google.protobuf.Empty
- 16, // 19: pb.PceService.GetTed:input_type -> google.protobuf.Empty
- 8, // 20: pb.PceService.DeleteSession:input_type -> pb.Session
- 7, // 21: pb.PceService.CreateSRPolicy:output_type -> pb.RequestStatus
- 7, // 22: pb.PceService.CreateSRPolicyWithoutLinkState:output_type -> pb.RequestStatus
- 7, // 23: pb.PceService.DeleteSRPolicy:output_type -> pb.RequestStatus
- 7, // 24: pb.PceService.DeleteSRPolicyWithoutLinkState:output_type -> pb.RequestStatus
- 9, // 25: pb.PceService.GetSessionList:output_type -> pb.SessionList
- 10, // 26: pb.PceService.GetSRPolicyList:output_type -> pb.SRPolicyList
- 15, // 27: pb.PceService.GetTed:output_type -> pb.Ted
- 7, // 28: pb.PceService.DeleteSession:output_type -> pb.RequestStatus
+ 14, // 12: pb.TED.lsNodes:type_name -> pb.LsNode
+ 5, // 13: pb.PCEService.CreateSRPolicy:input_type -> pb.CreateSRPolicyInput
+ 5, // 14: pb.PCEService.CreateSRPolicyWithoutLinkState:input_type -> pb.CreateSRPolicyInput
+ 6, // 15: pb.PCEService.DeleteSRPolicy:input_type -> pb.DeleteSRPolicyInput
+ 6, // 16: pb.PCEService.DeleteSRPolicyWithoutLinkState:input_type -> pb.DeleteSRPolicyInput
+ 16, // 17: pb.PCEService.GetSessionList:input_type -> google.protobuf.Empty
+ 16, // 18: pb.PCEService.GetSRPolicyList:input_type -> google.protobuf.Empty
+ 16, // 19: pb.PCEService.GetTED:input_type -> google.protobuf.Empty
+ 8, // 20: pb.PCEService.DeleteSession:input_type -> pb.Session
+ 7, // 21: pb.PCEService.CreateSRPolicy:output_type -> pb.RequestStatus
+ 7, // 22: pb.PCEService.CreateSRPolicyWithoutLinkState:output_type -> pb.RequestStatus
+ 7, // 23: pb.PCEService.DeleteSRPolicy:output_type -> pb.RequestStatus
+ 7, // 24: pb.PCEService.DeleteSRPolicyWithoutLinkState:output_type -> pb.RequestStatus
+ 9, // 25: pb.PCEService.GetSessionList:output_type -> pb.SessionList
+ 10, // 26: pb.PCEService.GetSRPolicyList:output_type -> pb.SRPolicyList
+ 15, // 27: pb.PCEService.GetTED:output_type -> pb.TED
+ 7, // 28: pb.PCEService.DeleteSession:output_type -> pb.RequestStatus
21, // [21:29] is the sub-list for method output_type
13, // [13:21] is the sub-list for method input_type
13, // [13:13] is the sub-list for extension type_name
@@ -1293,169 +1255,11 @@ func file_pola_proto_init() {
if File_pola_proto != nil {
return
}
- if !protoimpl.UnsafeEnabled {
- file_pola_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*Segment); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_pola_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*SRPolicy); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_pola_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*CreateSRPolicyInput); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_pola_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*DeleteSRPolicyInput); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_pola_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*RequestStatus); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_pola_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*Session); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_pola_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*SessionList); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_pola_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*SRPolicyList); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_pola_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*LsPrefix); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_pola_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*Metric); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_pola_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*LsLink); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_pola_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*LsNode); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_pola_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*Ted); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- }
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
- RawDescriptor: file_pola_proto_rawDesc,
+ RawDescriptor: unsafe.Slice(unsafe.StringData(file_pola_proto_rawDesc), len(file_pola_proto_rawDesc)),
NumEnums: 3,
NumMessages: 13,
NumExtensions: 0,
@@ -1467,7 +1271,6 @@ func file_pola_proto_init() {
MessageInfos: file_pola_proto_msgTypes,
}.Build()
File_pola_proto = out.File
- file_pola_proto_rawDesc = nil
file_pola_proto_goTypes = nil
file_pola_proto_depIdxs = nil
}
diff --git a/api/grpc/pola.proto b/api/grpc/pola.proto
index 3b91ed9e..ee42958a 100644
--- a/api/grpc/pola.proto
+++ b/api/grpc/pola.proto
@@ -11,21 +11,14 @@ option go_package = "github.com/nttcom/pola/api/grpc";
import "google/protobuf/empty.proto";
-service PceService {
+service PCEService {
rpc CreateSRPolicy (CreateSRPolicyInput) returns (RequestStatus) {};
-
rpc CreateSRPolicyWithoutLinkState (CreateSRPolicyInput) returns (RequestStatus) {};
-
rpc DeleteSRPolicy (DeleteSRPolicyInput) returns (RequestStatus) {};
-
rpc DeleteSRPolicyWithoutLinkState (DeleteSRPolicyInput) returns (RequestStatus) {};
-
rpc GetSessionList (google.protobuf.Empty) returns (SessionList) {};
-
rpc GetSRPolicyList (google.protobuf.Empty) returns (SRPolicyList) {};
-
- rpc GetTed (google.protobuf.Empty) returns (Ted) {};
-
+ rpc GetTED (google.protobuf.Empty) returns (TED) {};
rpc DeleteSession (Session) returns (RequestStatus) {};
}
@@ -42,7 +35,7 @@ enum SRPolicyType {
}
message SRPolicy {
- bytes pcepSessionAddr = 1;
+ bytes PCEPSessionAddr = 1;
bytes srcAddr = 2;
bytes dstAddr = 3;
string srcRouterID = 4;
@@ -108,13 +101,13 @@ message Metric {
message LsLink {
string localRouterID = 1;
- uint32 localAsn = 2;
+ uint32 localASN = 2;
string localIP = 3;
string remoteRouterID = 4;
- uint32 remoteAsn = 5;
+ uint32 remoteASN = 5;
string remoteIP = 6;
repeated Metric metrics = 7;
- uint32 adjSid = 8;
+ uint32 adjSID = 8;
}
message LsNode {
@@ -129,7 +122,7 @@ message LsNode {
}
-message Ted {
+message TED {
bool enable = 1;
repeated LsNode lsNodes = 2;
}
diff --git a/api/grpc/pola.zap.go b/api/grpc/pola.zap.go
index b4c360b9..135393a6 100644
--- a/api/grpc/pola.zap.go
+++ b/api/grpc/pola.zap.go
@@ -14,8 +14,8 @@ import (
// Implements zapcore.ObjectMarshaler interface for SRPolicy
func (x *SRPolicy) MarshalLogObject(enc zapcore.ObjectEncoder) error {
// Convert IP address slices to netip.Addr
- ssAddr, _ := netip.AddrFromSlice(x.GetPcepSessionAddr())
- enc.AddString("PcepSessionAddr", ssAddr.String())
+ ssAddr, _ := netip.AddrFromSlice(x.GetPCEPSessionAddr())
+ enc.AddString("PCEPSessionAddr", ssAddr.String())
srcAddr, _ := netip.AddrFromSlice(x.GetSrcAddr())
enc.AddString("SrcAddr", srcAddr.String())
dstAddr, _ := netip.AddrFromSlice(x.GetDstAddr())
@@ -43,6 +43,6 @@ func (x *SRPolicy) MarshalLogObject(enc zapcore.ObjectEncoder) error {
// Implements zapcore.ObjectMarshaler interface for Segment
func (x *Segment) MarshalLogObject(enc zapcore.ObjectEncoder) error {
- enc.AddString("Sid", x.GetSid())
+ enc.AddString("SID", x.GetSid())
return nil
}
diff --git a/api/grpc/pola_grpc.pb.go b/api/grpc/pola_grpc.pb.go
index 85236891..366e2ffa 100644
--- a/api/grpc/pola_grpc.pb.go
+++ b/api/grpc/pola_grpc.pb.go
@@ -1,22 +1,13 @@
-// Copyright (c) 2022 NTT Communications Corporation
-//
-// This software is released under the MIT License.
-// see https://github.com/nttcom/pola/blob/main/LICENSE
-
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
-// versions:
-// - protoc-gen-go-grpc v1.3.0
-// - protoc v3.12.4
-// source: pola.proto
package grpc
import (
context "context"
- empty "github.com/golang/protobuf/ptypes/empty"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
+ emptypb "google.golang.org/protobuf/types/known/emptypb"
)
// This is a compile-time assertion to ensure that this generated file
@@ -24,349 +15,338 @@ import (
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
-const (
- PceService_CreateSRPolicy_FullMethodName = "/pb.PceService/CreateSRPolicy"
- PceService_CreateSRPolicyWithoutLinkState_FullMethodName = "/pb.PceService/CreateSRPolicyWithoutLinkState"
- PceService_DeleteSRPolicy_FullMethodName = "/pb.PceService/DeleteSRPolicy"
- PceService_DeleteSRPolicyWithoutLinkState_FullMethodName = "/pb.PceService/DeleteSRPolicyWithoutLinkState"
- PceService_GetSessionList_FullMethodName = "/pb.PceService/GetSessionList"
- PceService_GetSRPolicyList_FullMethodName = "/pb.PceService/GetSRPolicyList"
- PceService_GetTed_FullMethodName = "/pb.PceService/GetTed"
- PceService_DeleteSession_FullMethodName = "/pb.PceService/DeleteSession"
-)
-
-// PceServiceClient is the client API for PceService service.
+// PCEServiceClient is the client API for PCEService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
-type PceServiceClient interface {
+type PCEServiceClient interface {
CreateSRPolicy(ctx context.Context, in *CreateSRPolicyInput, opts ...grpc.CallOption) (*RequestStatus, error)
CreateSRPolicyWithoutLinkState(ctx context.Context, in *CreateSRPolicyInput, opts ...grpc.CallOption) (*RequestStatus, error)
DeleteSRPolicy(ctx context.Context, in *DeleteSRPolicyInput, opts ...grpc.CallOption) (*RequestStatus, error)
DeleteSRPolicyWithoutLinkState(ctx context.Context, in *DeleteSRPolicyInput, opts ...grpc.CallOption) (*RequestStatus, error)
- GetSessionList(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*SessionList, error)
- GetSRPolicyList(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*SRPolicyList, error)
- GetTed(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Ted, error)
+ GetSessionList(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*SessionList, error)
+ GetSRPolicyList(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*SRPolicyList, error)
+ GetTED(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*TED, error)
DeleteSession(ctx context.Context, in *Session, opts ...grpc.CallOption) (*RequestStatus, error)
}
-type pceServiceClient struct {
+type pCEServiceClient struct {
cc grpc.ClientConnInterface
}
-func NewPceServiceClient(cc grpc.ClientConnInterface) PceServiceClient {
- return &pceServiceClient{cc}
+func NewPCEServiceClient(cc grpc.ClientConnInterface) PCEServiceClient {
+ return &pCEServiceClient{cc}
}
-func (c *pceServiceClient) CreateSRPolicy(ctx context.Context, in *CreateSRPolicyInput, opts ...grpc.CallOption) (*RequestStatus, error) {
+func (c *pCEServiceClient) CreateSRPolicy(ctx context.Context, in *CreateSRPolicyInput, opts ...grpc.CallOption) (*RequestStatus, error) {
out := new(RequestStatus)
- err := c.cc.Invoke(ctx, PceService_CreateSRPolicy_FullMethodName, in, out, opts...)
+ err := c.cc.Invoke(ctx, "/pb.PCEService/CreateSRPolicy", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
-func (c *pceServiceClient) CreateSRPolicyWithoutLinkState(ctx context.Context, in *CreateSRPolicyInput, opts ...grpc.CallOption) (*RequestStatus, error) {
+func (c *pCEServiceClient) CreateSRPolicyWithoutLinkState(ctx context.Context, in *CreateSRPolicyInput, opts ...grpc.CallOption) (*RequestStatus, error) {
out := new(RequestStatus)
- err := c.cc.Invoke(ctx, PceService_CreateSRPolicyWithoutLinkState_FullMethodName, in, out, opts...)
+ err := c.cc.Invoke(ctx, "/pb.PCEService/CreateSRPolicyWithoutLinkState", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
-func (c *pceServiceClient) DeleteSRPolicy(ctx context.Context, in *DeleteSRPolicyInput, opts ...grpc.CallOption) (*RequestStatus, error) {
+func (c *pCEServiceClient) DeleteSRPolicy(ctx context.Context, in *DeleteSRPolicyInput, opts ...grpc.CallOption) (*RequestStatus, error) {
out := new(RequestStatus)
- err := c.cc.Invoke(ctx, PceService_DeleteSRPolicy_FullMethodName, in, out, opts...)
+ err := c.cc.Invoke(ctx, "/pb.PCEService/DeleteSRPolicy", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
-func (c *pceServiceClient) DeleteSRPolicyWithoutLinkState(ctx context.Context, in *DeleteSRPolicyInput, opts ...grpc.CallOption) (*RequestStatus, error) {
+func (c *pCEServiceClient) DeleteSRPolicyWithoutLinkState(ctx context.Context, in *DeleteSRPolicyInput, opts ...grpc.CallOption) (*RequestStatus, error) {
out := new(RequestStatus)
- err := c.cc.Invoke(ctx, PceService_DeleteSRPolicyWithoutLinkState_FullMethodName, in, out, opts...)
+ err := c.cc.Invoke(ctx, "/pb.PCEService/DeleteSRPolicyWithoutLinkState", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
-func (c *pceServiceClient) GetSessionList(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*SessionList, error) {
+func (c *pCEServiceClient) GetSessionList(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*SessionList, error) {
out := new(SessionList)
- err := c.cc.Invoke(ctx, PceService_GetSessionList_FullMethodName, in, out, opts...)
+ err := c.cc.Invoke(ctx, "/pb.PCEService/GetSessionList", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
-func (c *pceServiceClient) GetSRPolicyList(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*SRPolicyList, error) {
+func (c *pCEServiceClient) GetSRPolicyList(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*SRPolicyList, error) {
out := new(SRPolicyList)
- err := c.cc.Invoke(ctx, PceService_GetSRPolicyList_FullMethodName, in, out, opts...)
+ err := c.cc.Invoke(ctx, "/pb.PCEService/GetSRPolicyList", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
-func (c *pceServiceClient) GetTed(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*Ted, error) {
- out := new(Ted)
- err := c.cc.Invoke(ctx, PceService_GetTed_FullMethodName, in, out, opts...)
+func (c *pCEServiceClient) GetTED(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*TED, error) {
+ out := new(TED)
+ err := c.cc.Invoke(ctx, "/pb.PCEService/GetTED", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
-func (c *pceServiceClient) DeleteSession(ctx context.Context, in *Session, opts ...grpc.CallOption) (*RequestStatus, error) {
+func (c *pCEServiceClient) DeleteSession(ctx context.Context, in *Session, opts ...grpc.CallOption) (*RequestStatus, error) {
out := new(RequestStatus)
- err := c.cc.Invoke(ctx, PceService_DeleteSession_FullMethodName, in, out, opts...)
+ err := c.cc.Invoke(ctx, "/pb.PCEService/DeleteSession", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
-// PceServiceServer is the server API for PceService service.
-// All implementations must embed UnimplementedPceServiceServer
+// PCEServiceServer is the server API for PCEService service.
+// All implementations must embed UnimplementedPCEServiceServer
// for forward compatibility
-type PceServiceServer interface {
+type PCEServiceServer interface {
CreateSRPolicy(context.Context, *CreateSRPolicyInput) (*RequestStatus, error)
CreateSRPolicyWithoutLinkState(context.Context, *CreateSRPolicyInput) (*RequestStatus, error)
DeleteSRPolicy(context.Context, *DeleteSRPolicyInput) (*RequestStatus, error)
DeleteSRPolicyWithoutLinkState(context.Context, *DeleteSRPolicyInput) (*RequestStatus, error)
- GetSessionList(context.Context, *empty.Empty) (*SessionList, error)
- GetSRPolicyList(context.Context, *empty.Empty) (*SRPolicyList, error)
- GetTed(context.Context, *empty.Empty) (*Ted, error)
+ GetSessionList(context.Context, *emptypb.Empty) (*SessionList, error)
+ GetSRPolicyList(context.Context, *emptypb.Empty) (*SRPolicyList, error)
+ GetTED(context.Context, *emptypb.Empty) (*TED, error)
DeleteSession(context.Context, *Session) (*RequestStatus, error)
- mustEmbedUnimplementedPceServiceServer()
+ mustEmbedUnimplementedPCEServiceServer()
}
-// UnimplementedPceServiceServer must be embedded to have forward compatible implementations.
-type UnimplementedPceServiceServer struct {
+// UnimplementedPCEServiceServer must be embedded to have forward compatible implementations.
+type UnimplementedPCEServiceServer struct {
}
-func (UnimplementedPceServiceServer) CreateSRPolicy(context.Context, *CreateSRPolicyInput) (*RequestStatus, error) {
+func (UnimplementedPCEServiceServer) CreateSRPolicy(context.Context, *CreateSRPolicyInput) (*RequestStatus, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateSRPolicy not implemented")
}
-func (UnimplementedPceServiceServer) CreateSRPolicyWithoutLinkState(context.Context, *CreateSRPolicyInput) (*RequestStatus, error) {
+func (UnimplementedPCEServiceServer) CreateSRPolicyWithoutLinkState(context.Context, *CreateSRPolicyInput) (*RequestStatus, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateSRPolicyWithoutLinkState not implemented")
}
-func (UnimplementedPceServiceServer) DeleteSRPolicy(context.Context, *DeleteSRPolicyInput) (*RequestStatus, error) {
+func (UnimplementedPCEServiceServer) DeleteSRPolicy(context.Context, *DeleteSRPolicyInput) (*RequestStatus, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteSRPolicy not implemented")
}
-func (UnimplementedPceServiceServer) DeleteSRPolicyWithoutLinkState(context.Context, *DeleteSRPolicyInput) (*RequestStatus, error) {
+func (UnimplementedPCEServiceServer) DeleteSRPolicyWithoutLinkState(context.Context, *DeleteSRPolicyInput) (*RequestStatus, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteSRPolicyWithoutLinkState not implemented")
}
-func (UnimplementedPceServiceServer) GetSessionList(context.Context, *empty.Empty) (*SessionList, error) {
+func (UnimplementedPCEServiceServer) GetSessionList(context.Context, *emptypb.Empty) (*SessionList, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetSessionList not implemented")
}
-func (UnimplementedPceServiceServer) GetSRPolicyList(context.Context, *empty.Empty) (*SRPolicyList, error) {
+func (UnimplementedPCEServiceServer) GetSRPolicyList(context.Context, *emptypb.Empty) (*SRPolicyList, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetSRPolicyList not implemented")
}
-func (UnimplementedPceServiceServer) GetTed(context.Context, *empty.Empty) (*Ted, error) {
- return nil, status.Errorf(codes.Unimplemented, "method GetTed not implemented")
+func (UnimplementedPCEServiceServer) GetTED(context.Context, *emptypb.Empty) (*TED, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetTED not implemented")
}
-func (UnimplementedPceServiceServer) DeleteSession(context.Context, *Session) (*RequestStatus, error) {
+func (UnimplementedPCEServiceServer) DeleteSession(context.Context, *Session) (*RequestStatus, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteSession not implemented")
}
-func (UnimplementedPceServiceServer) mustEmbedUnimplementedPceServiceServer() {}
+func (UnimplementedPCEServiceServer) mustEmbedUnimplementedPCEServiceServer() {}
-// UnsafePceServiceServer may be embedded to opt out of forward compatibility for this service.
-// Use of this interface is not recommended, as added methods to PceServiceServer will
+// UnsafePCEServiceServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to PCEServiceServer will
// result in compilation errors.
-type UnsafePceServiceServer interface {
- mustEmbedUnimplementedPceServiceServer()
+type UnsafePCEServiceServer interface {
+ mustEmbedUnimplementedPCEServiceServer()
}
-func RegisterPceServiceServer(s grpc.ServiceRegistrar, srv PceServiceServer) {
- s.RegisterService(&PceService_ServiceDesc, srv)
+func RegisterPCEServiceServer(s grpc.ServiceRegistrar, srv PCEServiceServer) {
+ s.RegisterService(&PCEService_ServiceDesc, srv)
}
-func _PceService_CreateSRPolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+func _PCEService_CreateSRPolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateSRPolicyInput)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
- return srv.(PceServiceServer).CreateSRPolicy(ctx, in)
+ return srv.(PCEServiceServer).CreateSRPolicy(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: PceService_CreateSRPolicy_FullMethodName,
+ FullMethod: "/pb.PCEService/CreateSRPolicy",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(PceServiceServer).CreateSRPolicy(ctx, req.(*CreateSRPolicyInput))
+ return srv.(PCEServiceServer).CreateSRPolicy(ctx, req.(*CreateSRPolicyInput))
}
return interceptor(ctx, in, info, handler)
}
-func _PceService_CreateSRPolicyWithoutLinkState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+func _PCEService_CreateSRPolicyWithoutLinkState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateSRPolicyInput)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
- return srv.(PceServiceServer).CreateSRPolicyWithoutLinkState(ctx, in)
+ return srv.(PCEServiceServer).CreateSRPolicyWithoutLinkState(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: PceService_CreateSRPolicyWithoutLinkState_FullMethodName,
+ FullMethod: "/pb.PCEService/CreateSRPolicyWithoutLinkState",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(PceServiceServer).CreateSRPolicyWithoutLinkState(ctx, req.(*CreateSRPolicyInput))
+ return srv.(PCEServiceServer).CreateSRPolicyWithoutLinkState(ctx, req.(*CreateSRPolicyInput))
}
return interceptor(ctx, in, info, handler)
}
-func _PceService_DeleteSRPolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+func _PCEService_DeleteSRPolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteSRPolicyInput)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
- return srv.(PceServiceServer).DeleteSRPolicy(ctx, in)
+ return srv.(PCEServiceServer).DeleteSRPolicy(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: PceService_DeleteSRPolicy_FullMethodName,
+ FullMethod: "/pb.PCEService/DeleteSRPolicy",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(PceServiceServer).DeleteSRPolicy(ctx, req.(*DeleteSRPolicyInput))
+ return srv.(PCEServiceServer).DeleteSRPolicy(ctx, req.(*DeleteSRPolicyInput))
}
return interceptor(ctx, in, info, handler)
}
-func _PceService_DeleteSRPolicyWithoutLinkState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+func _PCEService_DeleteSRPolicyWithoutLinkState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteSRPolicyInput)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
- return srv.(PceServiceServer).DeleteSRPolicyWithoutLinkState(ctx, in)
+ return srv.(PCEServiceServer).DeleteSRPolicyWithoutLinkState(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: PceService_DeleteSRPolicyWithoutLinkState_FullMethodName,
+ FullMethod: "/pb.PCEService/DeleteSRPolicyWithoutLinkState",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(PceServiceServer).DeleteSRPolicyWithoutLinkState(ctx, req.(*DeleteSRPolicyInput))
+ return srv.(PCEServiceServer).DeleteSRPolicyWithoutLinkState(ctx, req.(*DeleteSRPolicyInput))
}
return interceptor(ctx, in, info, handler)
}
-func _PceService_GetSessionList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(empty.Empty)
+func _PCEService_GetSessionList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(emptypb.Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
- return srv.(PceServiceServer).GetSessionList(ctx, in)
+ return srv.(PCEServiceServer).GetSessionList(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: PceService_GetSessionList_FullMethodName,
+ FullMethod: "/pb.PCEService/GetSessionList",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(PceServiceServer).GetSessionList(ctx, req.(*empty.Empty))
+ return srv.(PCEServiceServer).GetSessionList(ctx, req.(*emptypb.Empty))
}
return interceptor(ctx, in, info, handler)
}
-func _PceService_GetSRPolicyList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(empty.Empty)
+func _PCEService_GetSRPolicyList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(emptypb.Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
- return srv.(PceServiceServer).GetSRPolicyList(ctx, in)
+ return srv.(PCEServiceServer).GetSRPolicyList(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: PceService_GetSRPolicyList_FullMethodName,
+ FullMethod: "/pb.PCEService/GetSRPolicyList",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(PceServiceServer).GetSRPolicyList(ctx, req.(*empty.Empty))
+ return srv.(PCEServiceServer).GetSRPolicyList(ctx, req.(*emptypb.Empty))
}
return interceptor(ctx, in, info, handler)
}
-func _PceService_GetTed_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(empty.Empty)
+func _PCEService_GetTED_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(emptypb.Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
- return srv.(PceServiceServer).GetTed(ctx, in)
+ return srv.(PCEServiceServer).GetTED(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: PceService_GetTed_FullMethodName,
+ FullMethod: "/pb.PCEService/GetTED",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(PceServiceServer).GetTed(ctx, req.(*empty.Empty))
+ return srv.(PCEServiceServer).GetTED(ctx, req.(*emptypb.Empty))
}
return interceptor(ctx, in, info, handler)
}
-func _PceService_DeleteSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+func _PCEService_DeleteSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(Session)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
- return srv.(PceServiceServer).DeleteSession(ctx, in)
+ return srv.(PCEServiceServer).DeleteSession(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: PceService_DeleteSession_FullMethodName,
+ FullMethod: "/pb.PCEService/DeleteSession",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(PceServiceServer).DeleteSession(ctx, req.(*Session))
+ return srv.(PCEServiceServer).DeleteSession(ctx, req.(*Session))
}
return interceptor(ctx, in, info, handler)
}
-// PceService_ServiceDesc is the grpc.ServiceDesc for PceService service.
+// PCEService_ServiceDesc is the grpc.ServiceDesc for PCEService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
-var PceService_ServiceDesc = grpc.ServiceDesc{
- ServiceName: "pb.PceService",
- HandlerType: (*PceServiceServer)(nil),
+var PCEService_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "pb.PCEService",
+ HandlerType: (*PCEServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "CreateSRPolicy",
- Handler: _PceService_CreateSRPolicy_Handler,
+ Handler: _PCEService_CreateSRPolicy_Handler,
},
{
MethodName: "CreateSRPolicyWithoutLinkState",
- Handler: _PceService_CreateSRPolicyWithoutLinkState_Handler,
+ Handler: _PCEService_CreateSRPolicyWithoutLinkState_Handler,
},
{
MethodName: "DeleteSRPolicy",
- Handler: _PceService_DeleteSRPolicy_Handler,
+ Handler: _PCEService_DeleteSRPolicy_Handler,
},
{
MethodName: "DeleteSRPolicyWithoutLinkState",
- Handler: _PceService_DeleteSRPolicyWithoutLinkState_Handler,
+ Handler: _PCEService_DeleteSRPolicyWithoutLinkState_Handler,
},
{
MethodName: "GetSessionList",
- Handler: _PceService_GetSessionList_Handler,
+ Handler: _PCEService_GetSessionList_Handler,
},
{
MethodName: "GetSRPolicyList",
- Handler: _PceService_GetSRPolicyList_Handler,
+ Handler: _PCEService_GetSRPolicyList_Handler,
},
{
- MethodName: "GetTed",
- Handler: _PceService_GetTed_Handler,
+ MethodName: "GetTED",
+ Handler: _PCEService_GetTED_Handler,
},
{
MethodName: "DeleteSession",
- Handler: _PceService_DeleteSession_Handler,
+ Handler: _PCEService_DeleteSession_Handler,
},
},
Streams: []grpc.StreamDesc{},
diff --git a/cmd/pola/grpc/grpc_client.go b/cmd/pola/grpc/grpc_client.go
index ebd115f9..010f3852 100644
--- a/cmd/pola/grpc/grpc_client.go
+++ b/cmd/pola/grpc/grpc_client.go
@@ -27,7 +27,7 @@ type Session struct {
IsSynced bool
}
-func GetSessions(client pb.PceServiceClient) ([]Session, error) {
+func GetSessions(client pb.PCEServiceClient) ([]Session, error) {
ctx, cancel := withTimeout()
defer cancel()
@@ -52,7 +52,7 @@ func GetSessions(client pb.PceServiceClient) ([]Session, error) {
return sessions, nil
}
-func DeleteSession(client pb.PceServiceClient, session *pb.Session) error {
+func DeleteSession(client pb.PCEServiceClient, session *pb.Session) error {
ctx, cancel := withTimeout()
defer cancel()
_, err := client.DeleteSession(ctx, session)
@@ -62,7 +62,7 @@ func DeleteSession(client pb.PceServiceClient, session *pb.Session) error {
return nil
}
-func GetSRPolicyList(client pb.PceServiceClient) (map[netip.Addr][]table.SRPolicy, error) {
+func GetSRPolicyList(client pb.PCEServiceClient) (map[netip.Addr][]table.SRPolicy, error) {
ctx, cancel := withTimeout()
defer cancel()
@@ -74,7 +74,7 @@ func GetSRPolicyList(client pb.PceServiceClient) (map[netip.Addr][]table.SRPolic
policies := make(map[netip.Addr][]table.SRPolicy, len(ret.GetSRPolicies()))
for _, p := range ret.GetSRPolicies() {
- peerAddr, _ := netip.AddrFromSlice(p.PcepSessionAddr)
+ peerAddr, _ := netip.AddrFromSlice(p.PCEPSessionAddr)
srcAddr, _ := netip.AddrFromSlice(p.SrcAddr)
dstAddr, _ := netip.AddrFromSlice(p.DstAddr)
var segmentList []table.Segment
@@ -99,7 +99,7 @@ func GetSRPolicyList(client pb.PceServiceClient) (map[netip.Addr][]table.SRPolic
return policies, nil
}
-func CreateSRPolicy(client pb.PceServiceClient, input *pb.CreateSRPolicyInput) error {
+func CreateSRPolicy(client pb.PCEServiceClient, input *pb.CreateSRPolicyInput) error {
ctx, cancel := withTimeout()
defer cancel()
@@ -107,7 +107,7 @@ func CreateSRPolicy(client pb.PceServiceClient, input *pb.CreateSRPolicyInput) e
return err
}
-func CreateSRPolicyWithoutLinkState(client pb.PceServiceClient, input *pb.CreateSRPolicyInput) error {
+func CreateSRPolicyWithoutLinkState(client pb.PCEServiceClient, input *pb.CreateSRPolicyInput) error {
ctx, cancel := withTimeout()
defer cancel()
@@ -115,7 +115,7 @@ func CreateSRPolicyWithoutLinkState(client pb.PceServiceClient, input *pb.Create
return err
}
-func DeleteSRPolicy(client pb.PceServiceClient, input *pb.DeleteSRPolicyInput) error {
+func DeleteSRPolicy(client pb.PCEServiceClient, input *pb.DeleteSRPolicyInput) error {
ctx, cancel := withTimeout()
defer cancel()
@@ -123,11 +123,11 @@ func DeleteSRPolicy(client pb.PceServiceClient, input *pb.DeleteSRPolicyInput) e
return err
}
-func GetTed(client pb.PceServiceClient) (*table.LsTed, error) {
+func GetTED(client pb.PCEServiceClient) (*table.LsTED, error) {
ctx, cancel := withTimeout()
defer cancel()
- ret, err := client.GetTed(ctx, &empty.Empty{})
+ ret, err := client.GetTED(ctx, &empty.Empty{})
if err != nil {
return nil, err
}
@@ -136,7 +136,7 @@ func GetTed(client pb.PceServiceClient) (*table.LsTed, error) {
return nil, errors.New("ted is disabled")
}
- ted := &table.LsTed{
+ ted := &table.LsTED{
ID: 1,
Nodes: make(map[uint32]map[string]*table.LsNode),
}
@@ -152,8 +152,8 @@ func GetTed(client pb.PceServiceClient) (*table.LsTed, error) {
return ted, nil
}
-// initializeLsNodes initializes LsNodes in the LsTed table using the given array of nodes
-func initializeLsNodes(ted *table.LsTed, nodes []*pb.LsNode) {
+// initializeLsNodes initializes LsNodes in the LsTED table using the given array of nodes
+func initializeLsNodes(ted *table.LsTED, nodes []*pb.LsNode) {
for _, node := range nodes {
lsNode := table.NewLsNode(node.GetAsn(), node.GetRouterID())
lsNode.Hostname = node.GetHostname()
@@ -161,17 +161,17 @@ func initializeLsNodes(ted *table.LsTed, nodes []*pb.LsNode) {
lsNode.SrgbBegin = node.GetSrgbBegin()
lsNode.SrgbEnd = node.GetSrgbEnd()
- if _, ok := ted.Nodes[lsNode.Asn]; !ok {
- ted.Nodes[lsNode.Asn] = map[string]*table.LsNode{}
+ if _, ok := ted.Nodes[lsNode.ASN]; !ok {
+ ted.Nodes[lsNode.ASN] = map[string]*table.LsNode{}
}
- ted.Nodes[lsNode.Asn][lsNode.RouterID] = lsNode
+ ted.Nodes[lsNode.ASN][lsNode.RouterID] = lsNode
}
}
-func addLsNode(ted *table.LsTed, node *pb.LsNode) error {
+func addLsNode(ted *table.LsTED, node *pb.LsNode) error {
for _, link := range node.GetLsLinks() {
- localNode := ted.Nodes[link.LocalAsn][link.LocalRouterID]
- remoteNode := ted.Nodes[link.RemoteAsn][link.RemoteRouterID]
+ localNode := ted.Nodes[link.LocalASN][link.LocalRouterID]
+ remoteNode := ted.Nodes[link.RemoteASN][link.RemoteRouterID]
lsLink, err := createLsLink(localNode, remoteNode, link)
if err != nil {
return err
@@ -206,7 +206,7 @@ func createLsLink(localNode, remoteNode *table.LsNode, link *pb.LsLink) (*table.
lsLink := &table.LsLink{
LocalNode: localNode,
RemoteNode: remoteNode,
- AdjSid: link.GetAdjSid(),
+ AdjSid: link.GetAdjSID(),
}
var err error
lsLink.LocalIP, err = netip.ParseAddr(link.GetLocalIP())
@@ -229,14 +229,14 @@ func createLsLink(localNode, remoteNode *table.LsNode, link *pb.LsLink) (*table.
func createMetric(metricInfo *pb.Metric) (*table.Metric, error) {
switch metricInfo.GetType() {
- case pb.MetricType_IGP:
- return table.NewMetric(table.IGP_METRIC, metricInfo.GetValue()), nil
- case pb.MetricType_TE:
- return table.NewMetric(table.TE_METRIC, metricInfo.GetValue()), nil
- case pb.MetricType_DELAY:
- return table.NewMetric(table.DELAY_METRIC, metricInfo.GetValue()), nil
- case pb.MetricType_HOPCOUNT:
- return table.NewMetric(table.HOPCOUNT_METRIC, metricInfo.GetValue()), nil
+ case pb.MetricType_METRIC_TYPE_IGP:
+ return table.NewMetric(table.IGPMetric, metricInfo.GetValue()), nil
+ case pb.MetricType_METRIC_TYPE_TE:
+ return table.NewMetric(table.TEMetric, metricInfo.GetValue()), nil
+ case pb.MetricType_METRIC_TYPE_DELAY:
+ return table.NewMetric(table.DelayMetric, metricInfo.GetValue()), nil
+ case pb.MetricType_METRIC_TYPE_HOPCOUNT:
+ return table.NewMetric(table.HopcountMetric, metricInfo.GetValue()), nil
default:
return nil, errors.New("unknown metric type")
}
diff --git a/cmd/pola/root.go b/cmd/pola/root.go
index 27d97149..b4203bd6 100644
--- a/cmd/pola/root.go
+++ b/cmd/pola/root.go
@@ -16,7 +16,7 @@ import (
)
var (
- client pb.PceServiceClient
+ client pb.PCEServiceClient
jsonFmt bool
)
@@ -28,7 +28,7 @@ func newRootCmd() *cobra.Command {
rootCmd.PersistentFlags().String("host", "127.0.0.1", "polad connection address")
rootCmd.PersistentFlags().StringP("port", "p", "50051", "polad connection port")
- rootCmd.AddCommand(newSessionCmd(), newSRPolicyCmd(), newTedCmd())
+ rootCmd.AddCommand(newSessionCmd(), newSRPolicyCmd(), newTEDCmd())
rootCmd.PersistentPreRunE = persistentPreRunE
rootCmd.Run = runRootCmd
@@ -44,7 +44,7 @@ func persistentPreRunE(cmd *cobra.Command, args []string) error {
return fmt.Errorf("failed to dial polad connection: %v", err)
}
- client = pb.NewPceServiceClient(conn)
+ client = pb.NewPCEServiceClient(conn)
return nil
}
diff --git a/cmd/pola/sr_policy_add.go b/cmd/pola/sr_policy_add.go
index 5a142b2d..40f93c6a 100644
--- a/cmd/pola/sr_policy_add.go
+++ b/cmd/pola/sr_policy_add.go
@@ -73,7 +73,7 @@ type Segment struct {
// Unify with table.SRPolciy
type SRPolicy struct {
- PcepSessionAddr netip.Addr `yaml:"pcepSessionAddr"`
+ PCEPSessionAddr netip.Addr `yaml:"pcepSessionAddr"`
SrcAddr netip.Addr `yaml:"srcAddr"`
DstAddr netip.Addr `yaml:"dstAddr"`
SrcRouterID string `yaml:"srcRouterID"`
@@ -87,7 +87,7 @@ type SRPolicy struct {
type InputFormat struct {
SRPolicy SRPolicy `yaml:"srPolicy"`
- Asn uint32 `yaml:"asn"`
+ ASN uint32 `yaml:"asn"`
}
func addSRPolicy(input InputFormat, jsonFlag bool, noLinkStateFlag bool) error {
@@ -110,7 +110,7 @@ func addSRPolicy(input InputFormat, jsonFlag bool, noLinkStateFlag bool) error {
}
func addSRPolicyNoLinkState(input InputFormat) error {
- if !input.SRPolicy.PcepSessionAddr.IsValid() || input.SRPolicy.Color == 0 || !input.SRPolicy.SrcAddr.IsValid() || !input.SRPolicy.DstAddr.IsValid() || len(input.SRPolicy.SegmentList) == 0 {
+ if !input.SRPolicy.PCEPSessionAddr.IsValid() || input.SRPolicy.Color == 0 || !input.SRPolicy.SrcAddr.IsValid() || !input.SRPolicy.DstAddr.IsValid() || len(input.SRPolicy.SegmentList) == 0 {
sampleInput := "srPolicy:\n" +
" pcepSessionAddr: 192.0.2.1\n" +
" srcAddr: 192.0.2.1\n" +
@@ -138,7 +138,7 @@ func addSRPolicyNoLinkState(input InputFormat) error {
segmentList = append(segmentList, pbSeg)
}
srPolicy := &pb.SRPolicy{
- PcepSessionAddr: input.SRPolicy.PcepSessionAddr.AsSlice(),
+ PCEPSessionAddr: input.SRPolicy.PCEPSessionAddr.AsSlice(),
SrcAddr: input.SRPolicy.SrcAddr.AsSlice(),
DstAddr: input.SRPolicy.DstAddr.AsSlice(),
SegmentList: segmentList,
@@ -179,7 +179,7 @@ func addSRPolicyLinkState(input InputFormat) error {
" segmentList:\n" +
" - sid: 16003\n" +
" - sid: 16002\n"
- if input.Asn == 0 || !input.SRPolicy.PcepSessionAddr.IsValid() || input.SRPolicy.Color == 0 || input.SRPolicy.SrcRouterID == "" || input.SRPolicy.DstRouterID == "" {
+ if input.ASN == 0 || !input.SRPolicy.PCEPSessionAddr.IsValid() || input.SRPolicy.Color == 0 || input.SRPolicy.SrcRouterID == "" || input.SRPolicy.DstRouterID == "" {
errMsg := "invalid input\n" +
"input example is below\n\n" +
sampleInputDynamic +
@@ -228,7 +228,7 @@ func addSRPolicyLinkState(input InputFormat) error {
}
srPolicy := &pb.SRPolicy{
- PcepSessionAddr: input.SRPolicy.PcepSessionAddr.AsSlice(),
+ PCEPSessionAddr: input.SRPolicy.PCEPSessionAddr.AsSlice(),
SrcRouterID: input.SRPolicy.SrcRouterID,
DstRouterID: input.SRPolicy.DstRouterID,
Color: input.SRPolicy.Color,
@@ -239,7 +239,7 @@ func addSRPolicyLinkState(input InputFormat) error {
}
inputData := &pb.CreateSRPolicyInput{
SRPolicy: srPolicy,
- Asn: input.Asn,
+ Asn: input.ASN,
}
if err := grpc.CreateSRPolicy(client, inputData); err != nil {
return fmt.Errorf("gRPC Server Error: %s", err.Error())
diff --git a/cmd/pola/sr_policy_delete.go b/cmd/pola/sr_policy_delete.go
index a0389cf2..5bf780c8 100644
--- a/cmd/pola/sr_policy_delete.go
+++ b/cmd/pola/sr_policy_delete.go
@@ -57,7 +57,7 @@ func newSRPolicyDeleteCmd() *cobra.Command {
}
func deleteSRPolicy(input InputFormat, jsonFlag bool) error {
- if !input.SRPolicy.PcepSessionAddr.IsValid() || input.SRPolicy.Color == 0 || !input.SRPolicy.DstAddr.IsValid() || input.SRPolicy.Name == "" {
+ if !input.SRPolicy.PCEPSessionAddr.IsValid() || input.SRPolicy.Color == 0 || !input.SRPolicy.DstAddr.IsValid() || input.SRPolicy.Name == "" {
sampleInput := "srPolicy:\n" +
" pcepSessionAddr: 192.0.2.1\n" +
" dstAddr: 192.0.2.2\n" +
@@ -70,14 +70,14 @@ func deleteSRPolicy(input InputFormat, jsonFlag bool) error {
}
srPolicy := &pb.SRPolicy{
- PcepSessionAddr: input.SRPolicy.PcepSessionAddr.AsSlice(),
+ PCEPSessionAddr: input.SRPolicy.PCEPSessionAddr.AsSlice(),
DstAddr: input.SRPolicy.DstAddr.AsSlice(),
Color: input.SRPolicy.Color,
PolicyName: input.SRPolicy.Name,
}
inputData := &pb.DeleteSRPolicyInput{
SRPolicy: srPolicy,
- Asn: input.Asn,
+ Asn: input.ASN,
}
if err := grpc.DeleteSRPolicy(client, inputData); err != nil {
return fmt.Errorf("gRPC Server Error: %s", err.Error())
diff --git a/cmd/pola/ted.go b/cmd/pola/ted.go
index fa20ffaf..0136ee9d 100644
--- a/cmd/pola/ted.go
+++ b/cmd/pola/ted.go
@@ -13,7 +13,7 @@ import (
"github.com/spf13/cobra"
)
-func newTedCmd() *cobra.Command {
+func newTEDCmd() *cobra.Command {
return &cobra.Command{
Use: "ted",
RunE: func(cmd *cobra.Command, args []string) error {
@@ -26,7 +26,7 @@ func newTedCmd() *cobra.Command {
}
func print(jsonFlag bool) error {
- ted, err := grpc.GetTed(client)
+ ted, err := grpc.GetTED(client)
if err != nil {
return err
}
@@ -42,7 +42,7 @@ func print(jsonFlag bool) error {
for _, as := range ted.Nodes {
for _, node := range as {
tmpNode := map[string]interface{}{ // TODO: Fix format according to readme
- "asn": node.Asn,
+ "asn": node.ASN,
"routerID": node.RouterID,
"isisAreaID": node.IsisAreaID,
"hostname": node.Hostname,
diff --git a/cmd/polad/main.go b/cmd/polad/main.go
index b56f6033..537d86ba 100644
--- a/cmd/polad/main.go
+++ b/cmd/polad/main.go
@@ -72,11 +72,11 @@ func main() {
}()
// Prepare TED update tools
- var tedElemsChan chan []table.TedElem
- if c.Global.Ted.Enable {
- switch c.Global.Ted.Source {
+ var tedElemsChan chan []table.TEDElem
+ if c.Global.TED.Enable {
+ switch c.Global.TED.Source {
case "gobgp":
- tedElemsChan = startGobgpUpdate(&c, logger)
+ tedElemsChan = startGoBGPUpdate(&c, logger)
if tedElemsChan == nil {
logger.Panic("GoBGP update channel is nil")
log.Panic("GoBGP update channel is nil")
@@ -88,31 +88,31 @@ func main() {
}
// Start PCE server
- o := &server.PceOptions{
- PcepAddr: c.Global.Pcep.Address,
- PcepPort: c.Global.Pcep.Port,
- GrpcAddr: c.Global.GrpcServer.Address,
- GrpcPort: c.Global.GrpcServer.Port,
- TedEnable: c.Global.Ted.Enable,
+ o := &server.PCEOptions{
+ PCEPAddr: c.Global.PCEP.Address,
+ PCEPPort: c.Global.PCEP.Port,
+ GRPCAddr: c.Global.GRPCServer.Address,
+ GRPCPort: c.Global.GRPCServer.Port,
+ TEDEnable: c.Global.TED.Enable,
USidMode: c.Global.USidMode,
}
- if serverErr := server.NewPce(o, logger, tedElemsChan); serverErr.Error != nil {
+ if serverErr := server.NewPCE(o, logger, tedElemsChan); serverErr.Error != nil {
logger.Panic("Failed to start new server", zap.String("server", serverErr.Server), zap.Error(serverErr.Error))
log.Panicf("failed to start new server: %v", serverErr.Error)
}
}
-func startGobgpUpdate(c *config.Config, logger *zap.Logger) chan []table.TedElem {
- if c.Global.Ted == nil {
+func startGoBGPUpdate(c *config.Config, logger *zap.Logger) chan []table.TEDElem {
+ if c.Global.TED == nil {
logger.Error("TED does not exist")
return nil
}
- tedElemsChan := make(chan []table.TedElem)
+ tedElemsChan := make(chan []table.TEDElem)
go func() {
for {
- tedElems, err := gobgp.GetBgplsNlris(c.Global.Gobgp.GrpcClient.Address, c.Global.Gobgp.GrpcClient.Port)
- logger.Debug("Request TED update", zap.String("source", "GoBGP"), zap.String("session", c.Global.Gobgp.GrpcClient.Address+":"+c.Global.Gobgp.GrpcClient.Port))
+ tedElems, err := gobgp.GetBGPlsNLRIs(c.Global.GoBGP.GRPCClient.Address, c.Global.GoBGP.GRPCClient.Port)
+ logger.Debug("Request TED update", zap.String("source", "GoBGP"), zap.String("session", c.Global.GoBGP.GRPCClient.Address+":"+c.Global.GoBGP.GRPCClient.Port))
if err != nil {
logger.Error("Failed session with GoBGP", zap.Error(err))
} else {
diff --git a/examples/tinet/sr-mpls_te_l3vpn/README.md b/examples/tinet/sr-mpls_te_l3vpn/README.md
index ea1c3d30..042df9d8 100644
--- a/examples/tinet/sr-mpls_te_l3vpn/README.md
+++ b/examples/tinet/sr-mpls_te_l3vpn/README.md
@@ -2,37 +2,43 @@
Example topology powered by [Tinet](https://github.com/tinynetwork/tinet)
-
+
## Usage
### Install Tinet
+
Install Open vSwitch
+
```bash
-$ sudo apt update
-$ sudo apt install openvswitch-switch openvswitch-common
+sudo apt update
+sudo apt install openvswitch-switch openvswitch-common
```
Install Tinet
+
```bash
-$ curl -Lo /usr/bin/tinet https://github.com/tinynetwork/tinet/releases/download/v0.0.2/tinet
-$ chmod +x /usr/bin/tinet
-$ tinet --version
+curl -Lo /usr/bin/tinet https://github.com/tinynetwork/tinet/releases/download/v0.0.2/tinet
+chmod +x /usr/bin/tinet
+tinet --version
```
### Building a Lab Network
+
Get spec.yaml, and start Docker network
+
```bash
-$ git clone https://github.com/nttcom/pola
-$ cd pola/examples/tinet/sr-mpls_te_l3vpn
+git clone https://github.com/nttcom/pola
+cd pola/examples/tinet/sr-mpls_te_l3vpn
-$ tinet upconf | sudo sh -x
-$ docker ps
+tinet upconf | sudo sh -x
+docker ps
```
Connect to PCEP container, check PCEP session and SR policy
+
```bash
-$ docker exec -it pola /bin/bash
+docker exec -it pola /bin/bash
# pola session
peerAddr(0): 10.0.255.1
@@ -40,10 +46,13 @@ peerAddr(0): 10.0.255.1
```
### Apply SR Policy
+
Create policy1.yaml (Explicit SR Policy: Segment List 16002/16004/16003 to pe01)
+
```bash
# vi policy1.yaml
```
+
```yaml
srPolicy:
name: policy1
@@ -61,13 +70,14 @@ srPolicy:
```
Apply and check SR Policy
+
```bash
# pola sr-policy add -f policy1.yaml --no-link-state
success!
# pola sr-policy list
LSP(0):
- PcepSessionAddr: 10.0.255.1
+ PCEPSessionAddr: 10.0.255.1
PolicyName: policy1
SrcAddr: 10.0.255.1
DstAddr: 10.255.0.3
@@ -79,9 +89,10 @@ LSP(0):
```
Enter container pe01 and check SR Policy
+
```bash
# exit
-$ docker exec -it pe01 /bin/bash
+docker exec -it pe01 /bin/bash
root@pe01:/# vtysh
Hello, this is FRRouting (version 8.2.2).
@@ -105,12 +116,14 @@ Endpoint: 10.255.0.3 Color: 1 Name: name BSID: - Status: Active
```
Add Color setting
+
```bash
-$ docker exec -it pe01 /bin/bash
-$ vtysh -c 'conf t' -c 'router bgp 65000' -c 'address-family ipv4 vpn' -c 'neighbor 10.255.0.3 route-map color1 in'
+docker exec -it pe01 /bin/bash
+vtysh -c 'conf t' -c 'router bgp 65000' -c 'address-family ipv4 vpn' -c 'neighbor 10.255.0.3 route-map color1 in'
```
Check SR header with tcpdump
+
```bash
root@host01:/# ping 192.168.1.2
PING 192.168.1.2 (192.168.1.2) 56(84) bytes of data.
diff --git a/internal/config/config.go b/internal/config/config.go
index 263f118e..6e5b9474 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -12,17 +12,17 @@ import (
"gopkg.in/yaml.v3"
)
-type Pcep struct {
+type PCEP struct {
Address string `yaml:"address"`
Port string `yaml:"port"`
}
-type GrpcServer struct {
+type GRPCServer struct {
Address string `yaml:"address"`
Port string `yaml:"port"`
}
-type GrpcClient struct {
+type GRPCClient struct {
Address string `yaml:"address"`
Port string `yaml:"port"`
}
@@ -33,21 +33,21 @@ type Log struct {
Debug bool `yaml:"debug"`
}
-type Gobgp struct {
- GrpcClient GrpcClient `yaml:"grpc-client"`
+type GoBGP struct {
+ GRPCClient GRPCClient `yaml:"grpc-client"`
}
-type Ted struct {
+type TED struct {
Enable bool `yaml:"enable"`
Source string `yaml:"source"`
}
type Global struct {
- Pcep Pcep `yaml:"pcep"`
- GrpcServer GrpcServer `yaml:"grpc-server"`
+ PCEP PCEP `yaml:"pcep"`
+ GRPCServer GRPCServer `yaml:"grpc-server"`
Log Log `yaml:"log"`
- Ted *Ted `yaml:"ted"`
- Gobgp Gobgp `yaml:"gobgp"`
+ TED *TED `yaml:"ted"`
+ GoBGP GoBGP `yaml:"gobgp"`
USidMode bool `yaml:"usid-mode"`
}
diff --git a/internal/pkg/cspf/cspf.go b/internal/pkg/cspf/cspf.go
index 3709a038..88ac1d4d 100644
--- a/internal/pkg/cspf/cspf.go
+++ b/internal/pkg/cspf/cspf.go
@@ -27,7 +27,7 @@ func newNode(id string, cost uint32, nodeSeg table.Segment) *node {
}
}
-func Cspf(srcRouterID string, dstRouterID string, as uint32, metric table.MetricType, ted *table.LsTed) ([]table.Segment, error) {
+func Cspf(srcRouterID string, dstRouterID string, as uint32, metric table.MetricType, ted *table.LsTED) ([]table.Segment, error) {
network := ted.Nodes[as]
// TODO: update network information according to constraints
segmentList, err := spf(srcRouterID, dstRouterID, metric, network)
diff --git a/internal/pkg/gobgp/interface.go b/internal/pkg/gobgp/interface.go
index f2acf3d0..d190020c 100644
--- a/internal/pkg/gobgp/interface.go
+++ b/internal/pkg/gobgp/interface.go
@@ -22,7 +22,7 @@ import (
"google.golang.org/protobuf/types/known/anypb"
)
-func GetBgplsNlris(serverAddr string, serverPort string) ([]table.TedElem, error) {
+func GetBGPlsNLRIs(serverAddr string, serverPort string) ([]table.TEDElem, error) {
gobgpAddress := fmt.Sprintf("%s:%s", serverAddr, serverPort)
// Establish gRPC connection
@@ -59,7 +59,7 @@ func GetBgplsNlris(serverAddr string, serverPort string) ([]table.TedElem, error
return nil, fmt.Errorf("failed to retrieve paths from gRPC server: %w", err)
}
- var tedElems []table.TedElem
+ var tedElems []table.TEDElem
for {
r, err := stream.Recv()
if err != nil {
@@ -69,7 +69,7 @@ func GetBgplsNlris(serverAddr string, serverPort string) ([]table.TedElem, error
return nil, fmt.Errorf("error receiving stream data: %w", err)
}
- convertedElems, err := ConvertToTedElem(r.Destination)
+ convertedElems, err := ConvertToTEDElem(r.Destination)
if err != nil {
return nil, fmt.Errorf("failed to convert path to TED element (destination: %v): %w", r.Destination, err)
}
@@ -80,7 +80,7 @@ func GetBgplsNlris(serverAddr string, serverPort string) ([]table.TedElem, error
return tedElems, nil
}
-func ConvertToTedElem(dst *api.Destination) ([]table.TedElem, error) {
+func ConvertToTEDElem(dst *api.Destination) ([]table.TEDElem, error) {
if len(dst.GetPaths()) != 1 {
return nil, errors.New("invalid path length: expected 1 path")
}
@@ -93,24 +93,24 @@ func ConvertToTedElem(dst *api.Destination) ([]table.TedElem, error) {
switch nlri := nlri.(type) {
case *api.LsAddrPrefix:
- linkStateNlri, err := nlri.GetNlri().UnmarshalNew()
+ linkStateNLRI, err := nlri.GetNlri().UnmarshalNew()
if err != nil {
return nil, fmt.Errorf("failed to unmarshal LS Address Prefix: %w", err)
}
- switch linkStateNlri := linkStateNlri.(type) {
+ switch linkStateNLRI := linkStateNLRI.(type) {
case *api.LsNodeNLRI:
- lsNode, err := getLsNodeNLRI(linkStateNlri, path.GetPattrs())
+ lsNode, err := getLsNodeNLRI(linkStateNLRI, path.GetPattrs())
if err != nil {
return nil, fmt.Errorf("failed to process LS Node NLRI: %w", err)
}
- return []table.TedElem{lsNode}, nil
+ return []table.TEDElem{lsNode}, nil
case *api.LsLinkNLRI:
- lsLink, err := getLsLinkNLRI(linkStateNlri, path.GetPattrs())
+ lsLink, err := getLsLinkNLRI(linkStateNLRI, path.GetPattrs())
if err != nil {
return nil, fmt.Errorf("failed to process LS Link NLRI: %w", err)
}
- return []table.TedElem{lsLink}, nil
+ return []table.TEDElem{lsLink}, nil
case *api.LsPrefixV4NLRI:
lsPrefixV4List, err := getLsPrefixV4List(path.GetPattrs())
if err != nil {
@@ -126,7 +126,7 @@ func ConvertToTedElem(dst *api.Destination) ([]table.TedElem, error) {
case *api.LsPrefixV6NLRI:
return nil, nil // TODO: Implement LsPrefixV6NLRI handling
default:
- return nil, fmt.Errorf("invalid LS Link State NLRI type: %T", linkStateNlri)
+ return nil, fmt.Errorf("invalid LS Link State NLRI type: %T", linkStateNLRI)
}
default:
return nil, fmt.Errorf("invalid NLRI type: %T", nlri)
@@ -146,9 +146,9 @@ func formatIsisAreaID(isisArea []byte) string {
return strIsisArea.String()
}
-func getLsNodeNLRI(typedLinkStateNlri *api.LsNodeNLRI, pathAttrs []*anypb.Any) (*table.LsNode, error) {
- asn := typedLinkStateNlri.GetLocalNode().GetAsn()
- routerID := typedLinkStateNlri.GetLocalNode().GetIgpRouterId()
+func getLsNodeNLRI(typedLinkStateNLRI *api.LsNodeNLRI, pathAttrs []*anypb.Any) (*table.LsNode, error) {
+ asn := typedLinkStateNLRI.GetLocalNode().GetAsn()
+ routerID := typedLinkStateNLRI.GetLocalNode().GetIgpRouterId()
lsNode := table.NewLsNode(asn, routerID)
@@ -177,18 +177,18 @@ func getLsNodeNLRI(typedLinkStateNlri *api.LsNodeNLRI, pathAttrs []*anypb.Any) (
return lsNode, nil
}
-func getLsLinkNLRI(typedLinkStateNlri *api.LsLinkNLRI, pathAttrs []*anypb.Any) (*table.LsLink, error) {
- localNode := table.NewLsNode(typedLinkStateNlri.GetLocalNode().GetAsn(), typedLinkStateNlri.GetLocalNode().GetIgpRouterId())
- remoteNode := table.NewLsNode(typedLinkStateNlri.GetRemoteNode().GetAsn(), typedLinkStateNlri.GetRemoteNode().GetIgpRouterId())
+func getLsLinkNLRI(typedLinkStateNLRI *api.LsLinkNLRI, pathAttrs []*anypb.Any) (*table.LsLink, error) {
+ localNode := table.NewLsNode(typedLinkStateNLRI.GetLocalNode().GetAsn(), typedLinkStateNLRI.GetLocalNode().GetIgpRouterId())
+ remoteNode := table.NewLsNode(typedLinkStateNLRI.GetRemoteNode().GetAsn(), typedLinkStateNLRI.GetRemoteNode().GetIgpRouterId())
- localIP, err := netip.ParseAddr(typedLinkStateNlri.GetLinkDescriptor().GetInterfaceAddrIpv4())
+ localIP, err := netip.ParseAddr(typedLinkStateNLRI.GetLinkDescriptor().GetInterfaceAddrIpv4())
if err != nil {
- return nil, fmt.Errorf("failed to parse local IP address %q: %v", typedLinkStateNlri.GetLinkDescriptor().GetInterfaceAddrIpv4(), err)
+ return nil, fmt.Errorf("failed to parse local IP address %q: %v", typedLinkStateNLRI.GetLinkDescriptor().GetInterfaceAddrIpv4(), err)
}
- remoteIP, err := netip.ParseAddr(typedLinkStateNlri.GetLinkDescriptor().GetNeighborAddrIpv4())
+ remoteIP, err := netip.ParseAddr(typedLinkStateNLRI.GetLinkDescriptor().GetNeighborAddrIpv4())
if err != nil {
- return nil, fmt.Errorf("failed to parse remote IP address %q: %v", typedLinkStateNlri.GetLinkDescriptor().GetNeighborAddrIpv4(), err)
+ return nil, fmt.Errorf("failed to parse remote IP address %q: %v", typedLinkStateNLRI.GetLinkDescriptor().GetNeighborAddrIpv4(), err)
}
lsLink := table.NewLsLink(localNode, remoteNode)
@@ -206,11 +206,11 @@ func getLsLinkNLRI(typedLinkStateNlri *api.LsLinkNLRI, pathAttrs []*anypb.Any) (
continue
}
- lsLink.Metrics = append(lsLink.Metrics, table.NewMetric(table.MetricType(table.IGP_METRIC), bgplsAttr.GetLink().GetIgpMetric()))
+ lsLink.Metrics = append(lsLink.Metrics, table.NewMetric(table.MetricType(table.IGPMetric), bgplsAttr.GetLink().GetIgpMetric()))
teMetric := bgplsAttr.GetLink().GetDefaultTeMetric()
if teMetric != 0 {
- lsLink.Metrics = append(lsLink.Metrics, table.NewMetric(table.MetricType(table.TE_METRIC), teMetric))
+ lsLink.Metrics = append(lsLink.Metrics, table.NewMetric(table.MetricType(table.TEMetric), teMetric))
}
lsLink.AdjSid = bgplsAttr.GetLink().GetSrAdjacencySid()
@@ -219,8 +219,8 @@ func getLsLinkNLRI(typedLinkStateNlri *api.LsLinkNLRI, pathAttrs []*anypb.Any) (
return lsLink, nil
}
-func getLsPrefixV4List(pathAttrs []*anypb.Any) ([]table.TedElem, error) {
- var lsPrefixV4List []table.TedElem
+func getLsPrefixV4List(pathAttrs []*anypb.Any) ([]table.TEDElem, error) {
+ var lsPrefixV4List []table.TEDElem
var sidIndex uint32
for _, pathAttr := range pathAttrs {
@@ -235,19 +235,19 @@ func getLsPrefixV4List(pathAttrs []*anypb.Any) ([]table.TedElem, error) {
case *api.MpReachNLRIAttribute:
for _, nlri := range typedPathAttr.GetNlris() {
- typedNlri, err := nlri.UnmarshalNew()
+ typedNLRI, err := nlri.UnmarshalNew()
if err != nil {
return nil, fmt.Errorf("failed to unmarshal NLRI: %w", err)
}
- if lsNlri, ok := typedNlri.(*api.LsAddrPrefix); ok {
- lsPrefixV4, err := getLsPrefixV4(lsNlri, sidIndex)
+ if lsNLRI, ok := typedNLRI.(*api.LsAddrPrefix); ok {
+ lsPrefixV4, err := getLsPrefixV4(lsNLRI, sidIndex)
if err != nil {
return nil, fmt.Errorf("failed to get LS Prefix V4: %w", err)
}
lsPrefixV4List = append(lsPrefixV4List, lsPrefixV4)
} else {
- return nil, fmt.Errorf("unexpected NLRI type: %T", typedNlri)
+ return nil, fmt.Errorf("unexpected NLRI type: %T", typedNLRI)
}
}
}
@@ -256,21 +256,21 @@ func getLsPrefixV4List(pathAttrs []*anypb.Any) ([]table.TedElem, error) {
return lsPrefixV4List, nil
}
-func getLsPrefixV4(lsNlri *api.LsAddrPrefix, sidIndex uint32) (*table.LsPrefixV4, error) {
- prefNlri, err := lsNlri.GetNlri().UnmarshalNew()
+func getLsPrefixV4(lsNLRI *api.LsAddrPrefix, sidIndex uint32) (*table.LsPrefixV4, error) {
+ prefixNLRI, err := lsNLRI.GetNlri().UnmarshalNew()
if err != nil {
return nil, fmt.Errorf("failed to unmarshal LS Prefix V4: %w", err)
}
- prefv4Nlri, ok := prefNlri.(*api.LsPrefixV4NLRI)
+ prefixv4NLRI, ok := prefixNLRI.(*api.LsPrefixV4NLRI)
if !ok {
- return nil, fmt.Errorf("invalid LS prefix v4 NLRI type: %T", prefNlri)
+ return nil, fmt.Errorf("invalid LS prefix v4 NLRI type: %T", prefixNLRI)
}
- localNodeID := prefv4Nlri.GetLocalNode().GetIgpRouterId()
- localNodeAsn := prefv4Nlri.GetLocalNode().GetAsn()
- prefixV4 := prefv4Nlri.GetPrefixDescriptor().GetIpReachability()
+ localNodeID := prefixv4NLRI.GetLocalNode().GetIgpRouterId()
+ localNodeASN := prefixv4NLRI.GetLocalNode().GetAsn()
+ prefixV4 := prefixv4NLRI.GetPrefixDescriptor().GetIpReachability()
- localNode := table.NewLsNode(localNodeAsn, localNodeID)
+ localNode := table.NewLsNode(localNodeASN, localNodeID)
lsPrefixV4 := table.NewLsPrefixV4(localNode)
lsPrefixV4.SidIndex = sidIndex
@@ -286,8 +286,8 @@ func getLsPrefixV4(lsNlri *api.LsAddrPrefix, sidIndex uint32) (*table.LsPrefixV4
return lsPrefixV4, nil
}
-func getLsSrv6SIDNLRIList(pathAttrs []*anypb.Any) ([]table.TedElem, error) {
- var lsSrv6SIDList []table.TedElem
+func getLsSrv6SIDNLRIList(pathAttrs []*anypb.Any) ([]table.TEDElem, error) {
+ var lsSrv6SIDList []table.TEDElem
var endpointBehavior uint32
for _, pathAttr := range pathAttrs {
@@ -301,18 +301,18 @@ func getLsSrv6SIDNLRIList(pathAttrs []*anypb.Any) ([]table.TedElem, error) {
endpointBehavior = uint32(typedPathAttr.GetBehavior())
case *api.MpReachNLRIAttribute:
for _, nlri := range typedPathAttr.GetNlris() {
- typedNlri, err := nlri.UnmarshalNew()
+ typedNLRI, err := nlri.UnmarshalNew()
if err != nil {
return nil, fmt.Errorf("failed to unmarshal NLRI: %w", err)
}
- if lsNlri, ok := typedNlri.(*api.LsAddrPrefix); ok {
- lsSrv6SID, err := getLsSrv6SIDNLRI(lsNlri, endpointBehavior)
+ if lsNLRI, ok := typedNLRI.(*api.LsAddrPrefix); ok {
+ lsSrv6SID, err := getLsSrv6SIDNLRI(lsNLRI, endpointBehavior)
if err != nil {
return nil, fmt.Errorf("failed to process LS SRv6 SID NLRI: %w", err)
}
lsSrv6SIDList = append(lsSrv6SIDList, lsSrv6SID)
} else {
- return nil, fmt.Errorf("unexpected NLRI type: %T", typedNlri)
+ return nil, fmt.Errorf("unexpected NLRI type: %T", typedNLRI)
}
}
}
@@ -320,21 +320,23 @@ func getLsSrv6SIDNLRIList(pathAttrs []*anypb.Any) ([]table.TedElem, error) {
return lsSrv6SIDList, nil
}
-func getLsSrv6SIDNLRI(lsNlri *api.LsAddrPrefix, endpointBehavior uint32) (*table.LsSrv6SID, error) {
- srv6Nlri, err := lsNlri.GetNlri().UnmarshalNew()
+// getLsSrv6SIDNLRI processes the LS SRv6 SID NLRI and returns a corresponding LsSrv6SID.
+func getLsSrv6SIDNLRI(lsNLRI *api.LsAddrPrefix, endpointBehavior uint32) (*table.LsSrv6SID, error) {
+ srv6NLRI, err := lsNLRI.GetNlri().UnmarshalNew()
if err != nil {
return nil, fmt.Errorf("failed to unmarshal LS NLRI: %w", err)
}
- srv6SIDNlri, ok := srv6Nlri.(*api.LsSrv6SIDNLRI)
+ srv6SIDNLRI, ok := srv6NLRI.(*api.LsSrv6SIDNLRI)
if !ok {
- return nil, fmt.Errorf("invalid LS SRv6 SID NLRI type: %T", srv6Nlri)
+ return nil, fmt.Errorf("invalid LS SRv6 SID NLRI type: %T", srv6NLRI)
}
- localNodeID := srv6SIDNlri.GetLocalNode().GetIgpRouterId()
- localNodeAsn := srv6SIDNlri.GetLocalNode().GetAsn()
- srv6SIDs := srv6SIDNlri.GetSrv6SidInformation().GetSids()
- multiTopoIDs := srv6SIDNlri.GetMultiTopoId().GetMultiTopoIds()
- localNode := table.NewLsNode(localNodeAsn, localNodeID)
+ localNodeID := srv6SIDNLRI.GetLocalNode().GetIgpRouterId()
+ localNodeASN := srv6SIDNLRI.GetLocalNode().GetAsn()
+ srv6SIDs := srv6SIDNLRI.GetSrv6SidInformation().GetSids()
+ multiTopoIDs := srv6SIDNLRI.GetMultiTopoId().GetMultiTopoIds()
+
+ localNode := table.NewLsNode(localNodeASN, localNodeID)
lsSrv6SID := table.NewLsSrv6SID(localNode)
lsSrv6SID.EndpointBehavior = endpointBehavior
lsSrv6SID.Sids = srv6SIDs
diff --git a/internal/pkg/table/sr_policy.go b/internal/pkg/table/sr_policy.go
index 17f7898f..6c834e45 100644
--- a/internal/pkg/table/sr_policy.go
+++ b/internal/pkg/table/sr_policy.go
@@ -15,10 +15,10 @@ import (
type PolicyState string
const (
- POLICY_DOWN = PolicyState("down")
- POLICY_UP = PolicyState("up")
- POLICY_ACTIVE = PolicyState("active")
- POLICY_UNKNOWN = PolicyState("unknown")
+ PolicyDown = PolicyState("down")
+ PolicyUp = PolicyState("up")
+ PolicyActive = PolicyState("active")
+ PolicyUnknown = PolicyState("unknown")
)
type SRPolicy struct {
@@ -34,7 +34,7 @@ type SRPolicy struct {
}
func NewSRPolicy(
- plspId uint32,
+ plspID uint32,
name string,
segmentList []Segment,
srcAddr netip.Addr,
@@ -45,7 +45,7 @@ func NewSRPolicy(
state PolicyState,
) *SRPolicy {
p := &SRPolicy{
- PlspID: plspId,
+ PlspID: plspID,
Name: name,
SegmentList: segmentList,
SrcAddr: srcAddr,
@@ -86,7 +86,7 @@ func (p *SRPolicy) Update(df PolicyDiff) {
}
}
-const SRV6_SID_BIT_LENGTH = 128
+const SRv6SIDBitLength = 128
type Segment interface {
SidString() string
@@ -107,11 +107,11 @@ func NewSegment(sid string) (Segment, error) {
}
const (
- BEHAVIOR_RESERVED uint16 = 0x0000
- BEHAVIOR_END uint16 = 0x0001
- BEHAVIOR_END_X uint16 = 0x0005
- BEHAVIOR_UN uint16 = 0x0030
- BEHAVIOR_UA uint16 = 0x0039
+ BehaviorReserved uint16 = 0x0000
+ BehaviorEND uint16 = 0x0001
+ BehaviorENDX uint16 = 0x0005
+ BehaviorUN uint16 = 0x0030
+ BehaviorUA uint16 = 0x0039
)
type SegmentSRv6 struct {
@@ -127,23 +127,19 @@ func (seg SegmentSRv6) SidString() string {
}
func (seg SegmentSRv6) Behavior() uint16 {
- if seg.LocalAddr.IsValid() {
- if seg.USid {
- if seg.RemoteAddr.IsValid() {
- return BEHAVIOR_UA
- } else {
- return BEHAVIOR_UN
- }
- } else {
- if seg.RemoteAddr.IsValid() {
- return BEHAVIOR_END_X
- } else {
- return BEHAVIOR_END
- }
+ if !seg.LocalAddr.IsValid() {
+ return BehaviorReserved
+ }
+ if seg.USid {
+ if seg.RemoteAddr.IsValid() {
+ return BehaviorUA
}
- } else {
- return BEHAVIOR_RESERVED
+ return BehaviorUN
+ }
+ if seg.RemoteAddr.IsValid() {
+ return BehaviorENDX
}
+ return BehaviorEND
}
func NewSegmentSRv6(sid netip.Addr) SegmentSRv6 {
diff --git a/internal/pkg/table/ted.go b/internal/pkg/table/ted.go
index c84eee0f..51bd705f 100644
--- a/internal/pkg/table/ted.go
+++ b/internal/pkg/table/ted.go
@@ -12,18 +12,18 @@ import (
"strconv"
)
-type LsTed struct {
+type LsTED struct {
ID int
Nodes map[uint32]map[string]*LsNode // { ASN1: {"NodeID1": node1, "NodeID2": node2}, ASN2: {"NodeID3": node3, "NodeID4": node4}}
}
-func (ted *LsTed) Update(tedElems []TedElem) {
+func (ted *LsTED) Update(tedElems []TEDElem) {
for _, tedElem := range tedElems {
- tedElem.UpdateTed(ted)
+ tedElem.UpdateTED(ted)
}
}
-func (ted *LsTed) Print() {
+func (ted *LsTED) Print() {
for _, nodes := range ted.Nodes {
nodeCnt := 1
for nodeID, node := range nodes {
@@ -62,12 +62,12 @@ func (ted *LsTed) Print() {
}
}
-type TedElem interface {
- UpdateTed(ted *LsTed)
+type TEDElem interface {
+ UpdateTED(ted *LsTED)
}
type LsNode struct {
- Asn uint32 // primary key, in MP_REACH_NLRI Attr
+ ASN uint32 // primary key, in MP_REACH_NLRI Attr
RouterID string // primary key, in MP_REACH_NLRI Attr
IsisAreaID string // in BGP-LS Attr
Hostname string // in BGP-LS Attr
@@ -80,7 +80,7 @@ type LsNode struct {
func NewLsNode(asn uint32, nodeID string) *LsNode {
return &LsNode{
- Asn: asn,
+ ASN: asn,
RouterID: nodeID,
}
}
@@ -112,8 +112,8 @@ func (n *LsNode) LoopbackAddr() (netip.Addr, error) {
return netip.Addr{}, errors.New("node doesn't have a loopback address")
}
-func (n *LsNode) UpdateTed(ted *LsTed) {
- nodes, asn := ted.Nodes, n.Asn
+func (n *LsNode) UpdateTED(ted *LsTED) {
+ nodes, asn := ted.Nodes, n.ASN
if _, ok := nodes[asn]; !ok {
nodes[asn] = make(map[string]*LsNode)
@@ -159,22 +159,22 @@ func (l *LsLink) Metric(metricType MetricType) (uint32, error) {
return 0, fmt.Errorf("metric %s not defined", metricType)
}
-func (l *LsLink) UpdateTed(ted *LsTed) {
- nodes, asn := ted.Nodes, l.LocalNode.Asn
+func (l *LsLink) UpdateTED(ted *LsTED) {
+ nodes, asn := ted.Nodes, l.LocalNode.ASN
if _, ok := nodes[asn]; !ok {
nodes[asn] = make(map[string]*LsNode)
}
if _, ok := nodes[asn][l.LocalNode.RouterID]; !ok {
- nodes[asn][l.LocalNode.RouterID] = NewLsNode(l.LocalNode.Asn, l.LocalNode.RouterID)
+ nodes[asn][l.LocalNode.RouterID] = NewLsNode(l.LocalNode.ASN, l.LocalNode.RouterID)
}
- if _, ok := nodes[l.RemoteNode.Asn][l.RemoteNode.RouterID]; !ok {
- nodes[l.RemoteNode.Asn][l.RemoteNode.RouterID] = NewLsNode(l.RemoteNode.Asn, l.RemoteNode.RouterID)
+ if _, ok := nodes[l.RemoteNode.ASN][l.RemoteNode.RouterID]; !ok {
+ nodes[l.RemoteNode.ASN][l.RemoteNode.RouterID] = NewLsNode(l.RemoteNode.ASN, l.RemoteNode.RouterID)
}
- l.LocalNode, l.RemoteNode = nodes[asn][l.LocalNode.RouterID], nodes[l.RemoteNode.Asn][l.RemoteNode.RouterID]
+ l.LocalNode, l.RemoteNode = nodes[asn][l.LocalNode.RouterID], nodes[l.RemoteNode.ASN][l.RemoteNode.RouterID]
l.LocalNode.AddLink(l)
}
@@ -191,15 +191,15 @@ func NewLsPrefixV4(localNode *LsNode) *LsPrefixV4 {
}
}
-func (lp *LsPrefixV4) UpdateTed(ted *LsTed) {
- nodes, asn := ted.Nodes, lp.LocalNode.Asn
+func (lp *LsPrefixV4) UpdateTED(ted *LsTED) {
+ nodes, asn := ted.Nodes, lp.LocalNode.ASN
if _, ok := nodes[asn]; !ok {
nodes[asn] = make(map[string]*LsNode)
}
if _, ok := nodes[asn][lp.LocalNode.RouterID]; !ok {
- nodes[asn][lp.LocalNode.RouterID] = NewLsNode(lp.LocalNode.Asn, lp.LocalNode.RouterID)
+ nodes[asn][lp.LocalNode.RouterID] = NewLsNode(lp.LocalNode.ASN, lp.LocalNode.RouterID)
}
localNode := nodes[asn][lp.LocalNode.RouterID]
@@ -225,15 +225,15 @@ func NewLsSrv6SID(node *LsNode) *LsSrv6SID {
}
}
-func (s *LsSrv6SID) UpdateTed(ted *LsTed) {
- nodes, asn := ted.Nodes, s.LocalNode.Asn
+func (s *LsSrv6SID) UpdateTED(ted *LsTED) {
+ nodes, asn := ted.Nodes, s.LocalNode.ASN
if _, ok := nodes[asn]; !ok {
nodes[asn] = make(map[string]*LsNode)
}
if _, ok := nodes[asn][s.LocalNode.RouterID]; !ok {
- nodes[asn][s.LocalNode.RouterID] = NewLsNode(s.LocalNode.Asn, s.LocalNode.RouterID)
+ nodes[asn][s.LocalNode.RouterID] = NewLsNode(s.LocalNode.ASN, s.LocalNode.RouterID)
}
s.LocalNode = nodes[asn][s.LocalNode.RouterID]
@@ -260,21 +260,21 @@ func NewMetric(metricType MetricType, value uint32) *Metric {
type MetricType int
const (
- IGP_METRIC MetricType = iota
- TE_METRIC
- DELAY_METRIC
- HOPCOUNT_METRIC
+ IGPMetric MetricType = iota
+ TEMetric
+ DelayMetric
+ HopcountMetric
)
func (m MetricType) String() string {
switch m {
- case IGP_METRIC:
+ case IGPMetric:
return "IGP"
- case TE_METRIC:
+ case TEMetric:
return "TE"
- case DELAY_METRIC:
+ case DelayMetric:
return "DELAY"
- case HOPCOUNT_METRIC:
+ case HopcountMetric:
return "HOPCOUNT"
default:
return "Unknown"
diff --git a/pkg/packet/pcep/capability.go b/pkg/packet/pcep/capability.go
index b948021d..3bdc89b2 100644
--- a/pkg/packet/pcep/capability.go
+++ b/pkg/packet/pcep/capability.go
@@ -14,8 +14,8 @@ func PolaCapability(caps []CapabilityInterface) []CapabilityInterface {
polaCaps := []CapabilityInterface{}
for _, cap := range caps {
switch tlv := cap.(type) {
- case *StatefulPceCapability:
- tlv = &StatefulPceCapability{
+ case *StatefulPCECapability:
+ tlv = &StatefulPCECapability{
LSPUpdateCapability: true,
IncludeDBVersion: false,
LSPInstantiationCapability: true,
diff --git a/pkg/packet/pcep/message.go b/pkg/packet/pcep/message.go
index c81888c0..2d3bd77d 100644
--- a/pkg/packet/pcep/message.go
+++ b/pkg/packet/pcep/message.go
@@ -175,7 +175,7 @@ func NewKeepaliveMessage() (*KeepaliveMessage, error) {
// PCErr Message
type PCErrMessage struct {
- PcepErrorObject *PcepErrorObject
+ PCEPErrorObject *PCEPErrorObject
}
func (m *PCErrMessage) DecodeFromBytes(messageBody []uint8) error {
@@ -183,30 +183,30 @@ func (m *PCErrMessage) DecodeFromBytes(messageBody []uint8) error {
if err := commonObjectHeader.DecodeFromBytes(messageBody); err != nil {
return err
}
- pcepErrorObject := &PcepErrorObject{}
+ pcepErrorObject := &PCEPErrorObject{}
if err := pcepErrorObject.DecodeFromBytes(commonObjectHeader.ObjectType, messageBody[commonObjectHeaderLength:commonObjectHeader.ObjectLength]); err != nil {
return err
}
- m.PcepErrorObject = pcepErrorObject
+ m.PCEPErrorObject = pcepErrorObject
return nil
}
func (m *PCErrMessage) Serialize() []uint8 {
- pcerrMessageLength := CommonHeaderLength + m.PcepErrorObject.Len()
+ pcerrMessageLength := CommonHeaderLength + m.PCEPErrorObject.Len()
pcerrHeader := NewCommonHeader(MessageTypeError, pcerrMessageLength)
bytePCErrHeader := pcerrHeader.Serialize()
- bytePcepErrorObject := m.PcepErrorObject.Serialize()
- bytePCErrMessage := AppendByteSlices(bytePCErrHeader, bytePcepErrorObject)
+ bytePCEPErrorObject := m.PCEPErrorObject.Serialize()
+ bytePCErrMessage := AppendByteSlices(bytePCErrHeader, bytePCEPErrorObject)
return bytePCErrMessage
}
func NewPCErrMessage(errorType uint8, errorValue uint8, tlvs []TLVInterface) (*PCErrMessage, error) {
- o, err := NewPcepErrorObject(errorType, errorValue, tlvs)
+ o, err := NewPCEPErrorObject(errorType, errorValue, tlvs)
if err != nil {
return nil, err
}
m := &PCErrMessage{
- PcepErrorObject: o,
+ PCEPErrorObject: o,
}
return m, nil
}
@@ -471,6 +471,7 @@ func NewPCInitiateMessage(srpID uint32, lspName string, lspDelete bool, plspID u
m := &PCInitiateMessage{}
var err error
+
if m.SrpObject, err = NewSrpObject(segmentList, srpID, lspDelete); err != nil {
return nil, err
}
@@ -480,12 +481,11 @@ func NewPCInitiateMessage(srpID uint32, lspName string, lspDelete bool, plspID u
return nil, err
}
return m, nil
- } else {
- if m.LSPObject, err = NewLSPObject(lspName, &color, 0); err != nil {
- return nil, err
- }
}
+ if m.LSPObject, err = NewLSPObject(lspName, &color, 0); err != nil {
+ return nil, err
+ }
if m.EndpointsObject, err = NewEndpointsObject(dstAddr, srcAddr); err != nil {
return nil, err
}
diff --git a/pkg/packet/pcep/object.go b/pkg/packet/pcep/object.go
index 485c1081..a3eeae84 100644
--- a/pkg/packet/pcep/object.go
+++ b/pkg/packet/pcep/object.go
@@ -414,14 +414,14 @@ const (
ObjectTypeErrorError ObjectType = 0x01
)
-type PcepErrorObject struct {
+type PCEPErrorObject struct {
ObjectType ObjectType
ErrorType uint8
ErrorValue uint8
Tlvs []TLVInterface
}
-func (o *PcepErrorObject) DecodeFromBytes(typ ObjectType, objectBody []uint8) error {
+func (o *PCEPErrorObject) DecodeFromBytes(typ ObjectType, objectBody []uint8) error {
o.ObjectType = typ
o.ErrorType = objectBody[2]
o.ErrorValue = objectBody[3]
@@ -435,19 +435,19 @@ func (o *PcepErrorObject) DecodeFromBytes(typ ObjectType, objectBody []uint8) er
return nil
}
-func (o *PcepErrorObject) Serialize() []uint8 {
+func (o *PCEPErrorObject) Serialize() []uint8 {
pcepErrorObjectHeader := NewCommonObjectHeader(ObjectClassPCEPError, o.ObjectType, o.Len())
- bytePcepErrorObjectHeader := pcepErrorObjectHeader.Serialize()
+ bytePCEPErrorObjectHeader := pcepErrorObjectHeader.Serialize()
buf := make([]uint8, 4)
buf[2] = o.ErrorType
buf[3] = o.ErrorValue
- bytePcepErrorObject := AppendByteSlices(bytePcepErrorObjectHeader, buf)
- return bytePcepErrorObject
+ bytePCEPErrorObject := AppendByteSlices(bytePCEPErrorObjectHeader, buf)
+ return bytePCEPErrorObject
}
-func (o *PcepErrorObject) Len() uint16 {
+func (o *PCEPErrorObject) Len() uint16 {
tlvsByteLength := uint16(0)
for _, tlv := range o.Tlvs {
tlvsByteLength += tlv.Len()
@@ -456,8 +456,8 @@ func (o *PcepErrorObject) Len() uint16 {
return commonObjectHeaderLength + 4 + tlvsByteLength
}
-func NewPcepErrorObject(errorType uint8, errorValue uint8, tlvs []TLVInterface) (*PcepErrorObject, error) {
- o := &PcepErrorObject{
+func NewPCEPErrorObject(errorType uint8, errorValue uint8, tlvs []TLVInterface) (*PCEPErrorObject, error) {
+ o := &PCEPErrorObject{
ObjectType: ObjectTypeErrorError,
ErrorType: errorType,
ErrorValue: errorValue,
@@ -600,7 +600,6 @@ func NewSrpObject(segs []table.Segment, srpID uint32, isRemove bool) (*SrpObject
}
if _, ok := segs[0].(table.SegmentSRMPLS); ok {
o.TLVs = append(o.TLVs, &PathSetupType{PathSetupType: PathSetupTypeSRTE})
- } else if _, ok := segs[0].(table.SegmentSRv6); ok {
o.TLVs = append(o.TLVs, &PathSetupType{PathSetupType: PathSetupTypeSRv6TE})
} else {
return nil, errors.New("invalid Segment type")
@@ -767,7 +766,7 @@ func (o *EroObject) DecodeFromBytes(typ ObjectType, objectBody []uint8) error {
switch SubObjectType(objectBody[0] & 0x7f) {
case SubObjectTypeEROSR:
eroSubobj = &SREroSubobject{}
- case OT_ERO_SRV6:
+ case SubObjectTypeEROSRv6:
eroSubobj = &SRv6EroSubobject{}
default:
return errors.New("invalid Subobject type")
@@ -1020,7 +1019,7 @@ func (o *SREroSubobject) ToSegment() table.Segment {
// SRv6-ERO Subobject (RFC9603 4.3.1)
const (
- OT_ERO_SRV6 SubObjectType = 0x28
+ SubObjectTypeEROSRv6 SubObjectType = 0x28
)
type NAITypeSRv6 uint8
@@ -1167,7 +1166,7 @@ func (o *SRv6EroSubobject) Len() (uint16, error) {
func NewSRv6EroSubObject(seg table.SegmentSRv6) (*SRv6EroSubobject, error) {
subo := &SRv6EroSubobject{
LFlag: false,
- SubobjectType: OT_ERO_SRV6,
+ SubobjectType: SubObjectTypeEROSRv6,
VFlag: false,
SFlag: false, // SID is absent
Segment: seg,
diff --git a/pkg/packet/pcep/tlv.go b/pkg/packet/pcep/tlv.go
index 6673c98a..8016d417 100644
--- a/pkg/packet/pcep/tlv.go
+++ b/pkg/packet/pcep/tlv.go
@@ -32,10 +32,10 @@ const ( // PCEP TLV
TLVWavelengthAllocation TLVType = 0x0a
TLVOpticalInterfaceClassList TLVType = 0x0b
TLVClientSignalInformation TLVType = 0x0c
- TLVHPceCapability TLVType = 0x0d
+ TLVHPCECapability TLVType = 0x0d
TLVDomainID TLVType = 0x0e
- TLVHPceFlag TLVType = 0x0f
- TLVStatefulPceCapability TLVType = 0x10
+ TLVHPCEFlag TLVType = 0x0f
+ TLVStatefulPCECapability TLVType = 0x10
TLVSymbolicPathName TLVType = 0x11
TLVIPv4LSPIdentifiers TLVType = 0x12
TLVIPv6LSPIdentifiers TLVType = 0x13
@@ -43,7 +43,7 @@ const ( // PCEP TLV
TLVRsvpErrorSpec TLVType = 0x15
TLVLSPDBVersion TLVType = 0x17
TLVSpeakerEntityID TLVType = 0x18
- TLVSRPceCapability TLVType = 0x1a
+ TLVSRPCECapability TLVType = 0x1a
TLVPathSetupType TLVType = 0x1c
TLVOperatorConfiguredAssociationRange TLVType = 0x1d
TLVGlobalAssociationSource TLVType = 0x1e
@@ -67,7 +67,7 @@ const ( // PCEP TLV
TLVPolicyParameters TLVType = 0x30
TLVSchedLSPAttribute TLVType = 0x31
TLVSchedPdLSPAttribute TLVType = 0x32
- TLVPceFlowspecCapability TLVType = 0x33
+ TLVPCEFlowspecCapability TLVType = 0x33
TLVFlowFilter TLVType = 0x34
TLVBidirectionalLSPAssociationGroup TLVType = 0x36
TLVTePathBinding TLVType = 0x37
@@ -109,10 +109,10 @@ var tlvDescriptions = map[TLVType]struct {
TLVWavelengthAllocation: {"WAVELENGTH-ALLOCATION", "RFC8780"},
TLVOpticalInterfaceClassList: {"OPTICAL-INTERFACE-CLASS-LIST", "RFC8780"},
TLVClientSignalInformation: {"CLIENT-SIGNAL-INFORMATION", "RFC8780"},
- TLVHPceCapability: {"H-PCE-CAPABILITY", "RFC8685"},
+ TLVHPCECapability: {"H-PCE-CAPABILITY", "RFC8685"},
TLVDomainID: {"DOMAIN-ID", "RFC8685"},
- TLVHPceFlag: {"H-PCE-FLAG", "RFC8685"},
- TLVStatefulPceCapability: {"STATEFUL-PCE-CAPABILITY", "RFC8231"},
+ TLVHPCEFlag: {"H-PCE-FLAG", "RFC8685"},
+ TLVStatefulPCECapability: {"STATEFUL-PCE-CAPABILITY", "RFC8231"},
TLVSymbolicPathName: {"SYMBOLIC-PATH-NAME", "RFC8231"},
TLVIPv4LSPIdentifiers: {"IPV4-LSP-IDENTIFIERS", "RFC8231"},
TLVIPv6LSPIdentifiers: {"IPV6-LSP-IDENTIFIERS", "RFC8231"},
@@ -120,7 +120,7 @@ var tlvDescriptions = map[TLVType]struct {
TLVRsvpErrorSpec: {"RSVP-ERROR-SPEC", "RFC8231"},
TLVLSPDBVersion: {"LSP-DB-VERSION", "RFC8232"},
TLVSpeakerEntityID: {"SPEAKER-ENTITY-ID", "RFC8232"},
- TLVSRPceCapability: {"SR-PCE-CAPABILITY", "RFC8664"},
+ TLVSRPCECapability: {"SR-PCE-CAPABILITY", "RFC8664"},
TLVPathSetupType: {"PATH-SETUP-TYPE", "RFC8408"},
TLVOperatorConfiguredAssociationRange: {"OPERATOR-CONFIGURED-ASSOCIATION-RANGE", "RFC8697"},
TLVGlobalAssociationSource: {"GLOBAL-ASSOCIATION-SOURCE", "RFC8697"},
@@ -144,7 +144,7 @@ var tlvDescriptions = map[TLVType]struct {
TLVPolicyParameters: {"POLICY-PARAMETERS-TLV", "RFC9005"},
TLVSchedLSPAttribute: {"SCHED-LSP-ATTRIBUTE", "RFC8934"},
TLVSchedPdLSPAttribute: {"SCHED-PD-LSP-ATTRIBUTE", "RFC8934"},
- TLVPceFlowspecCapability: {"PCE-FLOWSPEC-CAPABILITY TLV", "RFC9168"},
+ TLVPCEFlowspecCapability: {"PCE-FLOWSPEC-CAPABILITY TLV", "RFC9168"},
TLVFlowFilter: {"FLOW-FILTER-TLV", "RFC9168"},
TLVBidirectionalLSPAssociationGroup: {"BIDIRECTIONAL-LSP Association Group TLV", "RFC9059"},
TLVTePathBinding: {"TE-PATH-BINDING", "RFC9604"},
@@ -178,12 +178,12 @@ func (t TLVType) String() string {
}
var tlvMap = map[TLVType]func() TLVInterface{
- TLVStatefulPceCapability: func() TLVInterface { return &StatefulPceCapability{} },
+ TLVStatefulPCECapability: func() TLVInterface { return &StatefulPCECapability{} },
TLVSymbolicPathName: func() TLVInterface { return &SymbolicPathName{} },
TLVIPv4LSPIdentifiers: func() TLVInterface { return &IPv4LSPIdentifiers{} },
TLVIPv6LSPIdentifiers: func() TLVInterface { return &IPv6LSPIdentifiers{} },
TLVLSPDBVersion: func() TLVInterface { return &LSPDBVersion{} },
- TLVSRPceCapability: func() TLVInterface { return &SRPceCapability{} },
+ TLVSRPCECapability: func() TLVInterface { return &SRPCECapability{} },
TLVPathSetupType: func() TLVInterface { return &PathSetupType{} },
TLVExtendedAssociationID: func() TLVInterface { return &ExtendedAssociationID{} },
TLVPathSetupTypeCapability: func() TLVInterface { return &PathSetupTypeCapability{} },
@@ -192,9 +192,9 @@ var tlvMap = map[TLVType]func() TLVInterface{
}
const (
- TLVStatefulPceCapabilityValueLength uint16 = 4
+ TLVStatefulPCECapabilityValueLength uint16 = 4
TLVLSPDBVersionValueLength uint16 = 8
- TLVSRPceCapabilityValueLength uint16 = 4
+ TLVSRPCECapabilityValueLength uint16 = 4
TLVPathSetupTypeValueLength uint16 = 4
TLVExtendedAssociationIDIPv4ValueLength uint16 = 8
TLVExtendedAssociationIDIPv6ValueLength uint16 = 20
@@ -233,7 +233,7 @@ type TLVInterface interface {
Len() uint16 // Total length of Type, Length, and Value
}
-type StatefulPceCapability struct {
+type StatefulPCECapability struct {
LSPUpdateCapability bool // 31
IncludeDBVersion bool // 30
LSPInstantiationCapability bool // 29
@@ -251,7 +251,7 @@ type StatefulPceCapability struct {
Relax bool // 17
}
-func (tlv *StatefulPceCapability) DecodeFromBytes(flags []uint8) error {
+func (tlv *StatefulPCECapability) DecodeFromBytes(flags []uint8) error {
if len(flags) < 4 {
return fmt.Errorf("flags array is too short, expected at least 4 bytes but got %d", len(flags))
}
@@ -291,7 +291,7 @@ func setFlag(flags []uint8, index int, mask uint8, condition bool) {
}
}
-func (tlv *StatefulPceCapability) Serialize() []uint8 {
+func (tlv *StatefulPCECapability) Serialize() []uint8 {
buf := []uint8{}
typ := make([]uint8, 2)
@@ -299,10 +299,10 @@ func (tlv *StatefulPceCapability) Serialize() []uint8 {
buf = append(buf, typ...)
length := make([]uint8, 2)
- binary.BigEndian.PutUint16(length, TLVStatefulPceCapabilityValueLength)
+ binary.BigEndian.PutUint16(length, TLVStatefulPCECapabilityValueLength)
buf = append(buf, length...)
- flags := make([]uint8, TLVStatefulPceCapabilityValueLength)
+ flags := make([]uint8, TLVStatefulPCECapabilityValueLength)
setFlag(flags, 3, 0x01, tlv.LSPUpdateCapability)
setFlag(flags, 3, 0x02, tlv.IncludeDBVersion)
@@ -325,19 +325,19 @@ func (tlv *StatefulPceCapability) Serialize() []uint8 {
return buf
}
-func (tlv *StatefulPceCapability) MarshalLogObject(enc zapcore.ObjectEncoder) error {
+func (tlv *StatefulPCECapability) MarshalLogObject(enc zapcore.ObjectEncoder) error {
return nil
}
-func (tlv *StatefulPceCapability) Type() TLVType {
- return TLVStatefulPceCapability
+func (tlv *StatefulPCECapability) Type() TLVType {
+ return TLVStatefulPCECapability
}
-func (tlv *StatefulPceCapability) Len() uint16 {
- return TLVHeaderLength + TLVStatefulPceCapabilityValueLength
+func (tlv *StatefulPCECapability) Len() uint16 {
+ return TLVHeaderLength + TLVStatefulPCECapabilityValueLength
}
-func (tlv *StatefulPceCapability) CapStrings() []string {
+func (tlv *StatefulPCECapability) CapStrings() []string {
ret := []string{}
ret = append(ret, "Stateful")
if tlv.LSPUpdateCapability {
@@ -520,20 +520,20 @@ func (tlv *LSPDBVersion) CapStrings() []string {
return []string{"LSP-DB-VERSION"}
}
-type SRPceCapability struct {
+type SRPCECapability struct {
UnlimitedMSD bool
SupportNAI bool
MaximumSidDepth uint8
}
-func (tlv *SRPceCapability) DecodeFromBytes(data []uint8) error {
+func (tlv *SRPCECapability) DecodeFromBytes(data []uint8) error {
tlv.UnlimitedMSD = (data[6] & 0x01) != 0
tlv.SupportNAI = (data[6] & 0x02) != 0
tlv.MaximumSidDepth = data[7]
return nil
}
-func (tlv *SRPceCapability) Serialize() []uint8 {
+func (tlv *SRPCECapability) Serialize() []uint8 {
buf := []uint8{}
typ := make([]uint8, 2)
@@ -541,10 +541,10 @@ func (tlv *SRPceCapability) Serialize() []uint8 {
buf = append(buf, typ...)
length := make([]uint8, 2)
- binary.BigEndian.PutUint16(length, TLVSRPceCapabilityValueLength)
+ binary.BigEndian.PutUint16(length, TLVSRPCECapabilityValueLength)
buf = append(buf, length...)
- val := make([]uint8, TLVSRPceCapabilityValueLength)
+ val := make([]uint8, TLVSRPCECapabilityValueLength)
if tlv.UnlimitedMSD {
val[2] = val[2] | 0x01
}
@@ -557,19 +557,19 @@ func (tlv *SRPceCapability) Serialize() []uint8 {
return buf
}
-func (tlv *SRPceCapability) MarshalLogObject(enc zapcore.ObjectEncoder) error {
+func (tlv *SRPCECapability) MarshalLogObject(enc zapcore.ObjectEncoder) error {
return nil
}
-func (tlv *SRPceCapability) Type() TLVType {
- return TLVSRPceCapability
+func (tlv *SRPCECapability) Type() TLVType {
+ return TLVSRPCECapability
}
-func (tlv *SRPceCapability) Len() uint16 {
- return TLVHeaderLength + TLVSRPceCapabilityValueLength
+func (tlv *SRPCECapability) Len() uint16 {
+ return TLVHeaderLength + TLVSRPCECapabilityValueLength
}
-func (tlv *SRPceCapability) CapStrings() []string {
+func (tlv *SRPCECapability) CapStrings() []string {
return []string{"SR-TE"}
}
@@ -1037,22 +1037,22 @@ func (tlv *UndefinedTLV) DecodeFromBytes(data []uint8) error {
}
func (tlv *UndefinedTLV) Serialize() []uint8 {
- bytePcepTLV := []uint8{}
+ bytePCEPTLV := []uint8{}
byteTLVType := make([]uint8, 2)
binary.BigEndian.PutUint16(byteTLVType, uint16(tlv.Typ))
- bytePcepTLV = append(bytePcepTLV, byteTLVType...) // Type (2byte)
+ bytePCEPTLV = append(bytePCEPTLV, byteTLVType...) // Type (2byte)
byteTLVLength := make([]uint8, 2)
binary.BigEndian.PutUint16(byteTLVLength, tlv.Length)
- bytePcepTLV = append(bytePcepTLV, byteTLVLength...) // Length (2byte)
+ bytePCEPTLV = append(bytePCEPTLV, byteTLVLength...) // Length (2byte)
- bytePcepTLV = append(bytePcepTLV, tlv.Value...) // Value (Length byte)
+ bytePCEPTLV = append(bytePCEPTLV, tlv.Value...) // Value (Length byte)
if padding := tlv.Length % 4; padding != 0 {
bytePadding := make([]uint8, 4-padding)
- bytePcepTLV = append(bytePcepTLV, bytePadding...)
+ bytePCEPTLV = append(bytePCEPTLV, bytePadding...)
}
- return bytePcepTLV
+ return bytePCEPTLV
}
func (tlv *UndefinedTLV) MarshalLogObject(enc zapcore.ObjectEncoder) error {
diff --git a/pkg/server/error.go b/pkg/server/error.go
index b670d724..a25feabc 100644
--- a/pkg/server/error.go
+++ b/pkg/server/error.go
@@ -5,7 +5,7 @@
package server
-type ServerError struct {
+type Error struct {
Error error
Server string
}
diff --git a/pkg/server/grpc_server.go b/pkg/server/grpc_server.go
index f8c3d2cd..491f93fc 100644
--- a/pkg/server/grpc_server.go
+++ b/pkg/server/grpc_server.go
@@ -28,7 +28,7 @@ type APIServer struct {
grpcServer *grpc.Server
usidMode bool
logger *zap.Logger
- pb.UnimplementedPceServiceServer
+ pb.UnimplementedPCEServiceServer
}
func NewAPIServer(pce *Server, grpcServer *grpc.Server, usidMode bool, logger *zap.Logger) *APIServer {
@@ -38,7 +38,7 @@ func NewAPIServer(pce *Server, grpcServer *grpc.Server, usidMode bool, logger *z
usidMode: usidMode,
logger: logger.With(zap.String("server", "grpc")),
}
- pb.RegisterPceServiceServer(grpcServer, s)
+ pb.RegisterPCEServiceServer(grpcServer, s)
return s
}
@@ -112,7 +112,7 @@ func buildSegmentList(s *APIServer, input *pb.CreateSRPolicyInput, withLinkState
func sendSRPolicyRequest(s *APIServer, input *pb.CreateSRPolicyInput, segmentList []table.Segment, srcAddr, dstAddr netip.Addr) (*pb.RequestStatus, error) {
inputSRPolicy := input.GetSRPolicy()
- pcepSession, err := getSyncedPcepSession(s.pce, inputSRPolicy.GetPcepSessionAddr())
+ pcepSession, err := getSyncedPCEPSession(s.pce, inputSRPolicy.GetPCEPSessionAddr())
if err != nil {
return &pb.RequestStatus{IsSuccess: false}, err
}
@@ -176,14 +176,14 @@ func (s *APIServer) DeleteSRPolicy(ctx context.Context, input *pb.DeleteSRPolicy
segmentList = append(segmentList, seg)
}
- inputJson, err := json.Marshal(input)
+ inputJSON, err := json.Marshal(input)
if err != nil {
return nil, err
}
s.logger.Info("Received DeleteSRPolicy API request")
- s.logger.Debug("Received paramater", zap.String("input", string(inputJson)))
+ s.logger.Debug("Received paramater", zap.String("input", string(inputJSON)))
- pcepSession, err := getSyncedPcepSession(s.pce, inputSRPolicy.GetPcepSessionAddr())
+ pcepSession, err := getSyncedPCEPSession(s.pce, inputSRPolicy.GetPCEPSessionAddr())
if err != nil {
return &pb.RequestStatus{IsSuccess: false}, err
}
@@ -232,26 +232,26 @@ const (
var validator = map[ValidationKind]func(policy *pb.SRPolicy, asn uint32) bool{
ValidationKind("Add"): func(policy *pb.SRPolicy, asn uint32) bool {
return asn != 0 &&
- policy.PcepSessionAddr != nil &&
+ policy.PCEPSessionAddr != nil &&
policy.Color != 0 &&
policy.SrcRouterID != "" &&
policy.DstRouterID != ""
},
ValidationKind("AddWithoutLinkState"): func(policy *pb.SRPolicy, asn uint32) bool {
- return policy.PcepSessionAddr != nil &&
+ return policy.PCEPSessionAddr != nil &&
len(policy.SrcAddr) > 0 &&
len(policy.DstAddr) > 0 &&
len(policy.SegmentList) > 0
},
ValidationKind("Delete"): func(policy *pb.SRPolicy, asn uint32) bool {
- return policy.PcepSessionAddr != nil &&
+ return policy.PCEPSessionAddr != nil &&
policy.Color != 0 &&
len(policy.DstAddr) > 0 &&
policy.PolicyName != ""
},
}
-func getSyncedPcepSession(pce *Server, addr []byte) (*Session, error) {
+func getSyncedPCEPSession(pce *Server, addr []byte) (*Session, error) {
pcepSessionAddr, _ := netip.AddrFromSlice(addr)
pcepSession := pce.SearchSession(pcepSessionAddr, true)
if pcepSession == nil {
@@ -268,7 +268,7 @@ func getLoopbackAddr(pce *Server, asn uint32, routerID string) (netip.Addr, erro
return node.LoopbackAddr()
}
-func getSegmentList(inputSRPolicy *pb.SRPolicy, asn uint32, ted *table.LsTed) ([]table.Segment, error) {
+func getSegmentList(inputSRPolicy *pb.SRPolicy, asn uint32, ted *table.LsTED) ([]table.Segment, error) {
var segmentList []table.Segment
switch inputSRPolicy.GetType() {
@@ -301,14 +301,14 @@ func getSegmentList(inputSRPolicy *pb.SRPolicy, asn uint32, ted *table.LsTed) ([
func getMetricType(metricType pb.MetricType) (table.MetricType, error) {
switch metricType {
- case pb.MetricType_IGP:
- return table.IGP_METRIC, nil
- case pb.MetricType_TE:
- return table.TE_METRIC, nil
- case pb.MetricType_DELAY:
- return table.DELAY_METRIC, nil
- case pb.MetricType_HOPCOUNT:
- return table.HOPCOUNT_METRIC, nil
+ case pb.MetricType_METRIC_TYPE_IGP:
+ return table.IGPMetric, nil
+ case pb.MetricType_METRIC_TYPE_TE:
+ return table.TEMetric, nil
+ case pb.MetricType_METRIC_TYPE_DELAY:
+ return table.DelayMetric, nil
+ case pb.MetricType_METRIC_TYPE_HOPCOUNT:
+ return table.HopcountMetric, nil
default:
return 0, fmt.Errorf("unknown metric type: %v", metricType)
}
@@ -343,7 +343,7 @@ func (s *APIServer) GetSRPolicyList(context.Context, *empty.Empty) (*pb.SRPolicy
for ssAddr, policies := range s.pce.SRPolicies() {
for _, policy := range policies {
srPolicyData := &pb.SRPolicy{
- PcepSessionAddr: ssAddr.AsSlice(),
+ PCEPSessionAddr: ssAddr.AsSlice(),
SegmentList: make([]*pb.Segment, 0),
Color: policy.Color,
Preference: policy.Preference,
@@ -366,10 +366,10 @@ func (s *APIServer) GetSRPolicyList(context.Context, *empty.Empty) (*pb.SRPolicy
return &ret, nil
}
-func (s *APIServer) GetTed(context.Context, *empty.Empty) (*pb.Ted, error) {
- s.logger.Info("Received GetTed API request")
+func (s *APIServer) GetTED(context.Context, *empty.Empty) (*pb.TED, error) {
+ s.logger.Info("Received GetTED API request")
- ret := &pb.Ted{
+ ret := &pb.TED{
Enable: true,
}
@@ -383,7 +383,7 @@ func (s *APIServer) GetTed(context.Context, *empty.Empty) (*pb.Ted, error) {
for _, lsNodes := range s.pce.ted.Nodes {
for _, lsNode := range lsNodes {
node := &pb.LsNode{
- Asn: lsNode.Asn,
+ Asn: lsNode.ASN,
RouterID: lsNode.RouterID,
IsisAreaID: lsNode.IsisAreaID,
Hostname: lsNode.Hostname,
@@ -396,13 +396,13 @@ func (s *APIServer) GetTed(context.Context, *empty.Empty) (*pb.Ted, error) {
for _, lsLink := range lsNode.Links {
link := &pb.LsLink{
LocalRouterID: lsLink.LocalNode.RouterID,
- LocalAsn: lsLink.LocalNode.Asn,
+ LocalASN: lsLink.LocalNode.ASN,
LocalIP: lsLink.LocalIP.String(),
RemoteRouterID: lsLink.RemoteNode.RouterID,
- RemoteAsn: lsLink.RemoteNode.Asn,
+ RemoteASN: lsLink.RemoteNode.ASN,
RemoteIP: lsLink.RemoteIP.String(),
Metrics: make([]*pb.Metric, 0, len(lsLink.Metrics)),
- AdjSid: lsLink.AdjSid,
+ AdjSID: lsLink.AdjSid,
}
for _, lsMetric := range lsLink.Metrics {
@@ -436,7 +436,7 @@ func (s *APIServer) GetTed(context.Context, *empty.Empty) (*pb.Ted, error) {
}
}
- s.logger.Debug("Send GetTed API reply")
+ s.logger.Debug("Send GetTED API reply")
return ret, nil
}
diff --git a/pkg/server/server.go b/pkg/server/server.go
index d08dc5f0..49a71d01 100644
--- a/pkg/server/server.go
+++ b/pkg/server/server.go
@@ -21,23 +21,23 @@ import (
type Server struct {
sessionList []*Session
- ted *table.LsTed
+ ted *table.LsTED
logger *zap.Logger
}
-type PceOptions struct {
- PcepAddr string
- PcepPort string
- GrpcAddr string
- GrpcPort string
- TedEnable bool
+type PCEOptions struct {
+ PCEPAddr string
+ PCEPPort string
+ GRPCAddr string
+ GRPCPort string
+ TEDEnable bool
USidMode bool
}
-func NewPce(o *PceOptions, logger *zap.Logger, tedElemsChan chan []table.TedElem) ServerError {
+func NewPCE(o *PCEOptions, logger *zap.Logger, tedElemsChan chan []table.TEDElem) Error {
s := &Server{logger: logger}
- if o.TedEnable {
- s.ted = &table.LsTed{
+ if o.TEDEnable {
+ s.ted = &table.LsTED{
ID: 1,
Nodes: map[uint32]map[string]*table.LsNode{},
}
@@ -46,7 +46,7 @@ func NewPce(o *PceOptions, logger *zap.Logger, tedElemsChan chan []table.TedElem
go func() {
for {
tedElems := <-tedElemsChan
- ted := &table.LsTed{
+ ted := &table.LsTED{
ID: s.ted.ID,
Nodes: map[uint32]map[string]*table.LsNode{},
}
@@ -57,10 +57,10 @@ func NewPce(o *PceOptions, logger *zap.Logger, tedElemsChan chan []table.TedElem
}()
}
- errChan := make(chan ServerError)
+ errChan := make(chan Error)
go func() {
- if err := s.Serve(o.PcepAddr, o.PcepPort, o.USidMode); err != nil {
- errChan <- ServerError{
+ if err := s.Serve(o.PCEPAddr, o.PCEPPort, o.USidMode); err != nil {
+ errChan <- Error{
Server: "pcep",
Error: err,
}
@@ -70,8 +70,8 @@ func NewPce(o *PceOptions, logger *zap.Logger, tedElemsChan chan []table.TedElem
go func() {
grpcServer := grpc.NewServer()
apiServer := NewAPIServer(s, grpcServer, o.USidMode, logger)
- if err := apiServer.Serve(o.GrpcAddr, o.GrpcPort); err != nil {
- errChan <- ServerError{
+ if err := apiServer.Serve(o.GRPCAddr, o.GRPCPort); err != nil {
+ errChan <- Error{
Server: "grpc",
Error: err,
}
diff --git a/pkg/server/session.go b/pkg/server/session.go
index 79d51e48..74d5c6de 100644
--- a/pkg/server/session.go
+++ b/pkg/server/session.go
@@ -60,7 +60,7 @@ func (ss *Session) Established() {
// Receive PCEP messages in a separate goroutine
go func() {
- if err := ss.ReceivePcepMessage(); err != nil {
+ if err := ss.ReceivePCEPMessage(); err != nil {
ss.logger.Debug("ERROR! Receive PCEP Message", zap.Error(err))
}
done <- struct{}{}
@@ -82,7 +82,7 @@ func (ss *Session) Established() {
}
}
-func (ss *Session) sendPcepMessage(message pcep.Message) error {
+func (ss *Session) sendPCEPMessage(message pcep.Message) error {
byteMessage, err := message.Serialize()
if err != nil {
return err
@@ -156,7 +156,7 @@ func (ss *Session) SendKeepalive() error {
return err
}
ss.logger.Debug("Send Keepalive Message")
- return ss.sendPcepMessage(keepaliveMessage)
+ return ss.sendPCEPMessage(keepaliveMessage)
}
func (ss *Session) SendClose(reason pcep.CloseReason) error {
@@ -175,7 +175,7 @@ func (ss *Session) SendClose(reason pcep.CloseReason) error {
return nil
}
-func (ss *Session) ReceivePcepMessage() error {
+func (ss *Session) ReceivePCEPMessage() error {
for {
commonHeader, err := ss.readCommonHeader()
if err != nil {
@@ -203,8 +203,8 @@ func (ss *Session) ReceivePcepMessage() error {
}
ss.logger.Debug("Received PCErr",
- zap.Uint8("error-Type", pcerrMessage.PcepErrorObject.ErrorType),
- zap.Uint8("error-value", pcerrMessage.PcepErrorObject.ErrorValue),
+ zap.Uint8("error-Type", pcerrMessage.PCEPErrorObject.ErrorType),
+ zap.Uint8("error-value", pcerrMessage.PCEPErrorObject.ErrorValue),
zap.String("detail", "See https://www.iana.org/assignments/pcep/pcep.xhtml#pcep-error-object"))
case pcep.MessageTypeClose:
byteCloseMessageBody := make([]uint8, commonHeader.MessageLength-pcep.CommonHeaderLength)
@@ -305,7 +305,7 @@ func (ss *Session) SendOpen() error {
return err
}
ss.logger.Debug("Send Open Message")
- return ss.sendPcepMessage(openMessage)
+ return ss.sendPCEPMessage(openMessage)
}
func (ss *Session) SendPCInitiate(srPolicy table.SRPolicy, lspDelete bool) error {
@@ -314,7 +314,7 @@ func (ss *Session) SendPCInitiate(srPolicy table.SRPolicy, lspDelete bool) error
return err
}
ss.logger.Debug("Send PCInitiate Message")
- err = ss.sendPcepMessage(pcinitiateMessage)
+ err = ss.sendPCEPMessage(pcinitiateMessage)
if err == nil {
ss.srpIDHead++
}
@@ -327,7 +327,7 @@ func (ss *Session) SendPCUpdate(srPolicy table.SRPolicy) error {
return err
}
ss.logger.Debug("Send Update Message")
- err = ss.sendPcepMessage(pcupdateMessage)
+ err = ss.sendPCEPMessage(pcupdateMessage)
if err == nil {
ss.srpIDHead++
}
@@ -346,7 +346,7 @@ func (ss *Session) RegisterSRPolicy(sr pcep.StateReport) {
// TODO: Move hasColorCapability to Session struct
hasColorCapability := false
for _, cap := range ss.pccCapabilities {
- if statefulCap, ok := cap.(*pcep.StatefulPceCapability); ok {
+ if statefulCap, ok := cap.(*pcep.StatefulPCECapability); ok {
if statefulCap.ColorCapability {
hasColorCapability = true
break
@@ -370,13 +370,13 @@ func (ss *Session) RegisterSRPolicy(sr pcep.StateReport) {
var state table.PolicyState
switch sr.LSPObject.OFlag {
case uint8(0x00):
- state = table.POLICY_DOWN
+ state = table.PolicyDown
case uint8(0x01):
- state = table.POLICY_UP
+ state = table.PolicyUp
case uint8(0x02):
- state = table.POLICY_ACTIVE
+ state = table.PolicyActive
default:
- state = table.POLICY_UNKNOWN
+ state = table.PolicyUnknown
}
if p, ok := ss.SearchSRPolicy(sr.LSPObject.PlspID); ok {
diff --git a/tools/grpc/go/add_sr-policy/add_sr-policy.go b/tools/grpc/go/add_sr-policy/add_sr-policy.go
index 5b29a379..a2f2de71 100644
--- a/tools/grpc/go/add_sr-policy/add_sr-policy.go
+++ b/tools/grpc/go/add_sr-policy/add_sr-policy.go
@@ -34,7 +34,7 @@ func main() {
}
}()
- c := pb.NewPceServiceClient(conn)
+ c := pb.NewPCEServiceClient(conn)
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
@@ -44,7 +44,7 @@ func main() {
r, err := c.CreateSRPolicy(ctx, &pb.CreateSRPolicyInput{
Asn: 65000,
SRPolicy: &pb.SRPolicy{
- PcepSessionAddr: ssAddr.AsSlice(),
+ PCEPSessionAddr: ssAddr.AsSlice(),
SrcRouterID: "0000.0aff.0001",
DstRouterID: "0000.0aff.0004",
Color: uint32(100),
diff --git a/tools/grpc/go/add_sr-policy_no_ls/add_sr-policy_no_ls.go b/tools/grpc/go/add_sr-policy_no_ls/add_sr-policy_no_ls.go
index 8e17cd7b..faeb8d33 100644
--- a/tools/grpc/go/add_sr-policy_no_ls/add_sr-policy_no_ls.go
+++ b/tools/grpc/go/add_sr-policy_no_ls/add_sr-policy_no_ls.go
@@ -34,7 +34,7 @@ func main() {
}
}()
- c := pb.NewPceServiceClient(conn)
+ c := pb.NewPCEServiceClient(conn)
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
@@ -45,7 +45,7 @@ func main() {
r, err := c.CreateSRPolicyWithoutLinkState(ctx, &pb.CreateSRPolicyInput{
SRPolicy: &pb.SRPolicy{
- PcepSessionAddr: ssAddr.AsSlice(),
+ PCEPSessionAddr: ssAddr.AsSlice(),
SrcAddr: srcAddr.AsSlice(),
DstAddr: dstAddr.AsSlice(),
Color: uint32(100),
diff --git a/tools/grpc/go/del_session/del_session.go b/tools/grpc/go/del_session/del_session.go
index 5703562d..e395d56e 100644
--- a/tools/grpc/go/del_session/del_session.go
+++ b/tools/grpc/go/del_session/del_session.go
@@ -34,7 +34,7 @@ func main() {
}
}()
- c := pb.NewPceServiceClient(conn)
+ c := pb.NewPCEServiceClient(conn)
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
diff --git a/tools/grpc/go/show_session/show_session.go b/tools/grpc/go/show_session/show_session.go
index 5a153a51..91b2b5df 100644
--- a/tools/grpc/go/show_session/show_session.go
+++ b/tools/grpc/go/show_session/show_session.go
@@ -37,7 +37,7 @@ func main() {
}
}()
- c := pb.NewPceServiceClient(conn)
+ c := pb.NewPCEServiceClient(conn)
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
diff --git a/tools/grpc/go/show_sr-policy/show_sr-policy_list.go b/tools/grpc/go/show_sr-policy/show_sr-policy_list.go
index 4afd752d..9ad2ece8 100644
--- a/tools/grpc/go/show_sr-policy/show_sr-policy_list.go
+++ b/tools/grpc/go/show_sr-policy/show_sr-policy_list.go
@@ -37,7 +37,7 @@ func main() {
}
}()
- c := pb.NewPceServiceClient(conn)
+ c := pb.NewPCEServiceClient(conn)
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
@@ -50,7 +50,7 @@ func main() {
for i, srPolicy := range ret.GetSRPolicies() {
fmt.Printf("srPolicy(%d): \n", i)
- sessionAddr := net.IP(srPolicy.GetPcepSessionAddr())
+ sessionAddr := net.IP(srPolicy.GetPCEPSessionAddr())
fmt.Printf(" sessionAddr: %s\n", sessionAddr.String())
fmt.Printf(" policyName: %s\n", srPolicy.GetPolicyName())
fmt.Printf(" SrcAddr: %s\n", net.IP(srPolicy.GetSrcAddr()))
diff --git a/tools/grpc/go/show_ted/show_ted.go b/tools/grpc/go/show_ted/show_ted.go
index 8afff069..1c9d10eb 100644
--- a/tools/grpc/go/show_ted/show_ted.go
+++ b/tools/grpc/go/show_ted/show_ted.go
@@ -35,14 +35,14 @@ func main() {
}
}()
- c := pb.NewPceServiceClient(conn)
+ c := pb.NewPCEServiceClient(conn)
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
var empty empty.Empty
- ret, err := c.GetTed(ctx, &empty)
+ ret, err := c.GetTED(ctx, &empty)
if err != nil {
log.Fatalf("unable to get TED info: %v", err)
}
From a19b7b2c03ccd235c8ca6cf4c7de56eea294c70d Mon Sep 17 00:00:00 2001
From: Motok1
Date: Thu, 28 Aug 2025 11:11:01 +0900
Subject: [PATCH 11/87] refactor(grpc): align with Protocol Buffers Style Guide
and rename option
---
api/grpc/pola.pb.go | 1276 ----------
api/grpc/pola.proto | 128 -
api/pola/v1/pola.pb.go | 2063 +++++++++++++++++
api/pola/v1/pola.proto | 161 ++
api/{grpc => pola/v1}/pola.zap.go | 12 +-
api/{grpc => pola/v1}/pola_grpc.pb.go | 185 +-
cmd/pola/README.md | 2 +-
cmd/pola/grpc/grpc_client.go | 56 +-
cmd/pola/root.go | 2 +-
cmd/pola/session_del.go | 6 +-
cmd/pola/sr_policy_add.go | 52 +-
cmd/pola/sr_policy_delete.go | 8 +-
examples/containerlab/srv6_te_l3vpn/README.md | 4 +-
examples/tinet/sr-mpls_te_l3vpn/README.md | 2 +-
pkg/server/grpc_server.go | 172 +-
tools/grpc/go/add_sr-policy/add_sr-policy.go | 17 +-
.../add_sr-policy_no_ls.go | 11 +-
tools/grpc/go/del_session/del_session.go | 4 +-
tools/grpc/go/show_session/show_session.go | 6 +-
.../go/show_sr-policy/show_sr-policy_list.go | 10 +-
tools/grpc/go/show_ted/show_ted.go | 7 +-
21 files changed, 2458 insertions(+), 1726 deletions(-)
delete mode 100644 api/grpc/pola.pb.go
delete mode 100644 api/grpc/pola.proto
create mode 100644 api/pola/v1/pola.pb.go
create mode 100644 api/pola/v1/pola.proto
rename api/{grpc => pola/v1}/pola.zap.go (80%)
rename api/{grpc => pola/v1}/pola_grpc.pb.go (52%)
diff --git a/api/grpc/pola.pb.go b/api/grpc/pola.pb.go
deleted file mode 100644
index cfb7533e..00000000
--- a/api/grpc/pola.pb.go
+++ /dev/null
@@ -1,1276 +0,0 @@
-// Copyright (c) 2022 NTT Communications Corporation
-//
-// This software is released under the MIT License.
-// see https://github.com/nttcom/pola/blob/main/LICENSE
-
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// versions:
-// protoc-gen-go v1.36.5
-// protoc v5.29.3
-// source: pola.proto
-
-package grpc
-
-import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
- emptypb "google.golang.org/protobuf/types/known/emptypb"
- reflect "reflect"
- sync "sync"
- unsafe "unsafe"
-)
-
-const (
- // Verify that this generated code is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
- // Verify that runtime/protoimpl is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
-)
-
-type SRPolicyType int32
-
-const (
- SRPolicyType_EXPLICIT SRPolicyType = 0
- SRPolicyType_DYNAMIC SRPolicyType = 1
-)
-
-// Enum value maps for SRPolicyType.
-var (
- SRPolicyType_name = map[int32]string{
- 0: "EXPLICIT",
- 1: "DYNAMIC",
- }
- SRPolicyType_value = map[string]int32{
- "EXPLICIT": 0,
- "DYNAMIC": 1,
- }
-)
-
-func (x SRPolicyType) Enum() *SRPolicyType {
- p := new(SRPolicyType)
- *p = x
- return p
-}
-
-func (x SRPolicyType) String() string {
- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
-}
-
-func (SRPolicyType) Descriptor() protoreflect.EnumDescriptor {
- return file_pola_proto_enumTypes[0].Descriptor()
-}
-
-func (SRPolicyType) Type() protoreflect.EnumType {
- return &file_pola_proto_enumTypes[0]
-}
-
-func (x SRPolicyType) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(x)
-}
-
-// Deprecated: Use SRPolicyType.Descriptor instead.
-func (SRPolicyType) EnumDescriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{0}
-}
-
-type SessionState int32
-
-const (
- SessionState_DOWN SessionState = 0
- SessionState_UP SessionState = 1
-)
-
-// Enum value maps for SessionState.
-var (
- SessionState_name = map[int32]string{
- 0: "DOWN",
- 1: "UP",
- }
- SessionState_value = map[string]int32{
- "DOWN": 0,
- "UP": 1,
- }
-)
-
-func (x SessionState) Enum() *SessionState {
- p := new(SessionState)
- *p = x
- return p
-}
-
-func (x SessionState) String() string {
- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
-}
-
-func (SessionState) Descriptor() protoreflect.EnumDescriptor {
- return file_pola_proto_enumTypes[1].Descriptor()
-}
-
-func (SessionState) Type() protoreflect.EnumType {
- return &file_pola_proto_enumTypes[1]
-}
-
-func (x SessionState) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(x)
-}
-
-// Deprecated: Use SessionState.Descriptor instead.
-func (SessionState) EnumDescriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{1}
-}
-
-type MetricType int32
-
-const (
- MetricType_IGP MetricType = 0
- MetricType_TE MetricType = 1
- MetricType_DELAY MetricType = 2
- MetricType_HOPCOUNT MetricType = 3
-)
-
-// Enum value maps for MetricType.
-var (
- MetricType_name = map[int32]string{
- 0: "IGP",
- 1: "TE",
- 2: "DELAY",
- 3: "HOPCOUNT",
- }
- MetricType_value = map[string]int32{
- "IGP": 0,
- "TE": 1,
- "DELAY": 2,
- "HOPCOUNT": 3,
- }
-)
-
-func (x MetricType) Enum() *MetricType {
- p := new(MetricType)
- *p = x
- return p
-}
-
-func (x MetricType) String() string {
- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
-}
-
-func (MetricType) Descriptor() protoreflect.EnumDescriptor {
- return file_pola_proto_enumTypes[2].Descriptor()
-}
-
-func (MetricType) Type() protoreflect.EnumType {
- return &file_pola_proto_enumTypes[2]
-}
-
-func (x MetricType) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(x)
-}
-
-// Deprecated: Use MetricType.Descriptor instead.
-func (MetricType) EnumDescriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{2}
-}
-
-type Segment struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- Sid string `protobuf:"bytes,1,opt,name=sid,proto3" json:"sid,omitempty"`
- SidStructure string `protobuf:"bytes,2,opt,name=sidStructure,proto3" json:"sidStructure,omitempty"`
- LocalAddr string `protobuf:"bytes,3,opt,name=localAddr,proto3" json:"localAddr,omitempty"`
- RemoteAddr string `protobuf:"bytes,4,opt,name=remoteAddr,proto3" json:"remoteAddr,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *Segment) Reset() {
- *x = Segment{}
- mi := &file_pola_proto_msgTypes[0]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *Segment) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*Segment) ProtoMessage() {}
-
-func (x *Segment) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[0]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use Segment.ProtoReflect.Descriptor instead.
-func (*Segment) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{0}
-}
-
-func (x *Segment) GetSid() string {
- if x != nil {
- return x.Sid
- }
- return ""
-}
-
-func (x *Segment) GetSidStructure() string {
- if x != nil {
- return x.SidStructure
- }
- return ""
-}
-
-func (x *Segment) GetLocalAddr() string {
- if x != nil {
- return x.LocalAddr
- }
- return ""
-}
-
-func (x *Segment) GetRemoteAddr() string {
- if x != nil {
- return x.RemoteAddr
- }
- return ""
-}
-
-type SRPolicy struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- PCEPSessionAddr []byte `protobuf:"bytes,1,opt,name=PCEPSessionAddr,proto3" json:"PCEPSessionAddr,omitempty"`
- SrcAddr []byte `protobuf:"bytes,2,opt,name=srcAddr,proto3" json:"srcAddr,omitempty"`
- DstAddr []byte `protobuf:"bytes,3,opt,name=dstAddr,proto3" json:"dstAddr,omitempty"`
- SrcRouterID string `protobuf:"bytes,4,opt,name=srcRouterID,proto3" json:"srcRouterID,omitempty"`
- DstRouterID string `protobuf:"bytes,5,opt,name=dstRouterID,proto3" json:"dstRouterID,omitempty"`
- Color uint32 `protobuf:"varint,6,opt,name=color,proto3" json:"color,omitempty"`
- Preference uint32 `protobuf:"varint,7,opt,name=preference,proto3" json:"preference,omitempty"`
- PolicyName string `protobuf:"bytes,8,opt,name=policyName,proto3" json:"policyName,omitempty"`
- Type SRPolicyType `protobuf:"varint,9,opt,name=type,proto3,enum=pb.SRPolicyType" json:"type,omitempty"`
- SegmentList []*Segment `protobuf:"bytes,10,rep,name=segmentList,proto3" json:"segmentList,omitempty"`
- Metric MetricType `protobuf:"varint,11,opt,name=metric,proto3,enum=pb.MetricType" json:"metric,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *SRPolicy) Reset() {
- *x = SRPolicy{}
- mi := &file_pola_proto_msgTypes[1]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *SRPolicy) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*SRPolicy) ProtoMessage() {}
-
-func (x *SRPolicy) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[1]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use SRPolicy.ProtoReflect.Descriptor instead.
-func (*SRPolicy) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{1}
-}
-
-func (x *SRPolicy) GetPCEPSessionAddr() []byte {
- if x != nil {
- return x.PCEPSessionAddr
- }
- return nil
-}
-
-func (x *SRPolicy) GetSrcAddr() []byte {
- if x != nil {
- return x.SrcAddr
- }
- return nil
-}
-
-func (x *SRPolicy) GetDstAddr() []byte {
- if x != nil {
- return x.DstAddr
- }
- return nil
-}
-
-func (x *SRPolicy) GetSrcRouterID() string {
- if x != nil {
- return x.SrcRouterID
- }
- return ""
-}
-
-func (x *SRPolicy) GetDstRouterID() string {
- if x != nil {
- return x.DstRouterID
- }
- return ""
-}
-
-func (x *SRPolicy) GetColor() uint32 {
- if x != nil {
- return x.Color
- }
- return 0
-}
-
-func (x *SRPolicy) GetPreference() uint32 {
- if x != nil {
- return x.Preference
- }
- return 0
-}
-
-func (x *SRPolicy) GetPolicyName() string {
- if x != nil {
- return x.PolicyName
- }
- return ""
-}
-
-func (x *SRPolicy) GetType() SRPolicyType {
- if x != nil {
- return x.Type
- }
- return SRPolicyType_EXPLICIT
-}
-
-func (x *SRPolicy) GetSegmentList() []*Segment {
- if x != nil {
- return x.SegmentList
- }
- return nil
-}
-
-func (x *SRPolicy) GetMetric() MetricType {
- if x != nil {
- return x.Metric
- }
- return MetricType_IGP
-}
-
-type CreateSRPolicyInput struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- SRPolicy *SRPolicy `protobuf:"bytes,1,opt,name=SRPolicy,proto3" json:"SRPolicy,omitempty"`
- Asn uint32 `protobuf:"varint,2,opt,name=asn,proto3" json:"asn,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *CreateSRPolicyInput) Reset() {
- *x = CreateSRPolicyInput{}
- mi := &file_pola_proto_msgTypes[2]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *CreateSRPolicyInput) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*CreateSRPolicyInput) ProtoMessage() {}
-
-func (x *CreateSRPolicyInput) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[2]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use CreateSRPolicyInput.ProtoReflect.Descriptor instead.
-func (*CreateSRPolicyInput) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{2}
-}
-
-func (x *CreateSRPolicyInput) GetSRPolicy() *SRPolicy {
- if x != nil {
- return x.SRPolicy
- }
- return nil
-}
-
-func (x *CreateSRPolicyInput) GetAsn() uint32 {
- if x != nil {
- return x.Asn
- }
- return 0
-}
-
-type DeleteSRPolicyInput struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- SRPolicy *SRPolicy `protobuf:"bytes,1,opt,name=SRPolicy,proto3" json:"SRPolicy,omitempty"`
- Asn uint32 `protobuf:"varint,2,opt,name=asn,proto3" json:"asn,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *DeleteSRPolicyInput) Reset() {
- *x = DeleteSRPolicyInput{}
- mi := &file_pola_proto_msgTypes[3]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *DeleteSRPolicyInput) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*DeleteSRPolicyInput) ProtoMessage() {}
-
-func (x *DeleteSRPolicyInput) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[3]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use DeleteSRPolicyInput.ProtoReflect.Descriptor instead.
-func (*DeleteSRPolicyInput) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{3}
-}
-
-func (x *DeleteSRPolicyInput) GetSRPolicy() *SRPolicy {
- if x != nil {
- return x.SRPolicy
- }
- return nil
-}
-
-func (x *DeleteSRPolicyInput) GetAsn() uint32 {
- if x != nil {
- return x.Asn
- }
- return 0
-}
-
-type RequestStatus struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- IsSuccess bool `protobuf:"varint,1,opt,name=isSuccess,proto3" json:"isSuccess,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *RequestStatus) Reset() {
- *x = RequestStatus{}
- mi := &file_pola_proto_msgTypes[4]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *RequestStatus) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*RequestStatus) ProtoMessage() {}
-
-func (x *RequestStatus) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[4]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use RequestStatus.ProtoReflect.Descriptor instead.
-func (*RequestStatus) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{4}
-}
-
-func (x *RequestStatus) GetIsSuccess() bool {
- if x != nil {
- return x.IsSuccess
- }
- return false
-}
-
-type Session struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- Addr []byte `protobuf:"bytes,1,opt,name=Addr,proto3" json:"Addr,omitempty"`
- State SessionState `protobuf:"varint,2,opt,name=State,proto3,enum=pb.SessionState" json:"State,omitempty"`
- Caps []string `protobuf:"bytes,3,rep,name=Caps,proto3" json:"Caps,omitempty"`
- IsSynced bool `protobuf:"varint,4,opt,name=IsSynced,proto3" json:"IsSynced,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *Session) Reset() {
- *x = Session{}
- mi := &file_pola_proto_msgTypes[5]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *Session) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*Session) ProtoMessage() {}
-
-func (x *Session) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[5]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use Session.ProtoReflect.Descriptor instead.
-func (*Session) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{5}
-}
-
-func (x *Session) GetAddr() []byte {
- if x != nil {
- return x.Addr
- }
- return nil
-}
-
-func (x *Session) GetState() SessionState {
- if x != nil {
- return x.State
- }
- return SessionState_DOWN
-}
-
-func (x *Session) GetCaps() []string {
- if x != nil {
- return x.Caps
- }
- return nil
-}
-
-func (x *Session) GetIsSynced() bool {
- if x != nil {
- return x.IsSynced
- }
- return false
-}
-
-type SessionList struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- Sessions []*Session `protobuf:"bytes,1,rep,name=Sessions,proto3" json:"Sessions,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *SessionList) Reset() {
- *x = SessionList{}
- mi := &file_pola_proto_msgTypes[6]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *SessionList) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*SessionList) ProtoMessage() {}
-
-func (x *SessionList) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[6]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use SessionList.ProtoReflect.Descriptor instead.
-func (*SessionList) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{6}
-}
-
-func (x *SessionList) GetSessions() []*Session {
- if x != nil {
- return x.Sessions
- }
- return nil
-}
-
-type SRPolicyList struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- SRPolicies []*SRPolicy `protobuf:"bytes,1,rep,name=SRPolicies,proto3" json:"SRPolicies,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *SRPolicyList) Reset() {
- *x = SRPolicyList{}
- mi := &file_pola_proto_msgTypes[7]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *SRPolicyList) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*SRPolicyList) ProtoMessage() {}
-
-func (x *SRPolicyList) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[7]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use SRPolicyList.ProtoReflect.Descriptor instead.
-func (*SRPolicyList) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{7}
-}
-
-func (x *SRPolicyList) GetSRPolicies() []*SRPolicy {
- if x != nil {
- return x.SRPolicies
- }
- return nil
-}
-
-type LsPrefix struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- Prefix string `protobuf:"bytes,1,opt,name=prefix,proto3" json:"prefix,omitempty"`
- SidIndex uint32 `protobuf:"varint,2,opt,name=sidIndex,proto3" json:"sidIndex,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *LsPrefix) Reset() {
- *x = LsPrefix{}
- mi := &file_pola_proto_msgTypes[8]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *LsPrefix) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*LsPrefix) ProtoMessage() {}
-
-func (x *LsPrefix) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[8]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use LsPrefix.ProtoReflect.Descriptor instead.
-func (*LsPrefix) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{8}
-}
-
-func (x *LsPrefix) GetPrefix() string {
- if x != nil {
- return x.Prefix
- }
- return ""
-}
-
-func (x *LsPrefix) GetSidIndex() uint32 {
- if x != nil {
- return x.SidIndex
- }
- return 0
-}
-
-type Metric struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- Type MetricType `protobuf:"varint,1,opt,name=type,proto3,enum=pb.MetricType" json:"type,omitempty"`
- Value uint32 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *Metric) Reset() {
- *x = Metric{}
- mi := &file_pola_proto_msgTypes[9]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *Metric) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*Metric) ProtoMessage() {}
-
-func (x *Metric) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[9]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use Metric.ProtoReflect.Descriptor instead.
-func (*Metric) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{9}
-}
-
-func (x *Metric) GetType() MetricType {
- if x != nil {
- return x.Type
- }
- return MetricType_IGP
-}
-
-func (x *Metric) GetValue() uint32 {
- if x != nil {
- return x.Value
- }
- return 0
-}
-
-type LsLink struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- LocalRouterID string `protobuf:"bytes,1,opt,name=localRouterID,proto3" json:"localRouterID,omitempty"`
- LocalASN uint32 `protobuf:"varint,2,opt,name=localASN,proto3" json:"localASN,omitempty"`
- LocalIP string `protobuf:"bytes,3,opt,name=localIP,proto3" json:"localIP,omitempty"`
- RemoteRouterID string `protobuf:"bytes,4,opt,name=remoteRouterID,proto3" json:"remoteRouterID,omitempty"`
- RemoteASN uint32 `protobuf:"varint,5,opt,name=remoteASN,proto3" json:"remoteASN,omitempty"`
- RemoteIP string `protobuf:"bytes,6,opt,name=remoteIP,proto3" json:"remoteIP,omitempty"`
- Metrics []*Metric `protobuf:"bytes,7,rep,name=metrics,proto3" json:"metrics,omitempty"`
- AdjSID uint32 `protobuf:"varint,8,opt,name=adjSID,proto3" json:"adjSID,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *LsLink) Reset() {
- *x = LsLink{}
- mi := &file_pola_proto_msgTypes[10]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *LsLink) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*LsLink) ProtoMessage() {}
-
-func (x *LsLink) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[10]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use LsLink.ProtoReflect.Descriptor instead.
-func (*LsLink) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{10}
-}
-
-func (x *LsLink) GetLocalRouterID() string {
- if x != nil {
- return x.LocalRouterID
- }
- return ""
-}
-
-func (x *LsLink) GetLocalASN() uint32 {
- if x != nil {
- return x.LocalASN
- }
- return 0
-}
-
-func (x *LsLink) GetLocalIP() string {
- if x != nil {
- return x.LocalIP
- }
- return ""
-}
-
-func (x *LsLink) GetRemoteRouterID() string {
- if x != nil {
- return x.RemoteRouterID
- }
- return ""
-}
-
-func (x *LsLink) GetRemoteASN() uint32 {
- if x != nil {
- return x.RemoteASN
- }
- return 0
-}
-
-func (x *LsLink) GetRemoteIP() string {
- if x != nil {
- return x.RemoteIP
- }
- return ""
-}
-
-func (x *LsLink) GetMetrics() []*Metric {
- if x != nil {
- return x.Metrics
- }
- return nil
-}
-
-func (x *LsLink) GetAdjSID() uint32 {
- if x != nil {
- return x.AdjSID
- }
- return 0
-}
-
-type LsNode struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- Asn uint32 `protobuf:"varint,1,opt,name=asn,proto3" json:"asn,omitempty"`
- RouterID string `protobuf:"bytes,2,opt,name=routerID,proto3" json:"routerID,omitempty"`
- IsisAreaID string `protobuf:"bytes,3,opt,name=isisAreaID,proto3" json:"isisAreaID,omitempty"`
- Hostname string `protobuf:"bytes,4,opt,name=hostname,proto3" json:"hostname,omitempty"`
- SrgbBegin uint32 `protobuf:"varint,5,opt,name=srgbBegin,proto3" json:"srgbBegin,omitempty"`
- SrgbEnd uint32 `protobuf:"varint,6,opt,name=srgbEnd,proto3" json:"srgbEnd,omitempty"`
- LsLinks []*LsLink `protobuf:"bytes,7,rep,name=lsLinks,proto3" json:"lsLinks,omitempty"`
- LsPrefixes []*LsPrefix `protobuf:"bytes,8,rep,name=lsPrefixes,proto3" json:"lsPrefixes,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *LsNode) Reset() {
- *x = LsNode{}
- mi := &file_pola_proto_msgTypes[11]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *LsNode) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*LsNode) ProtoMessage() {}
-
-func (x *LsNode) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[11]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use LsNode.ProtoReflect.Descriptor instead.
-func (*LsNode) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{11}
-}
-
-func (x *LsNode) GetAsn() uint32 {
- if x != nil {
- return x.Asn
- }
- return 0
-}
-
-func (x *LsNode) GetRouterID() string {
- if x != nil {
- return x.RouterID
- }
- return ""
-}
-
-func (x *LsNode) GetIsisAreaID() string {
- if x != nil {
- return x.IsisAreaID
- }
- return ""
-}
-
-func (x *LsNode) GetHostname() string {
- if x != nil {
- return x.Hostname
- }
- return ""
-}
-
-func (x *LsNode) GetSrgbBegin() uint32 {
- if x != nil {
- return x.SrgbBegin
- }
- return 0
-}
-
-func (x *LsNode) GetSrgbEnd() uint32 {
- if x != nil {
- return x.SrgbEnd
- }
- return 0
-}
-
-func (x *LsNode) GetLsLinks() []*LsLink {
- if x != nil {
- return x.LsLinks
- }
- return nil
-}
-
-func (x *LsNode) GetLsPrefixes() []*LsPrefix {
- if x != nil {
- return x.LsPrefixes
- }
- return nil
-}
-
-type TED struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- Enable bool `protobuf:"varint,1,opt,name=enable,proto3" json:"enable,omitempty"`
- LsNodes []*LsNode `protobuf:"bytes,2,rep,name=lsNodes,proto3" json:"lsNodes,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *TED) Reset() {
- *x = TED{}
- mi := &file_pola_proto_msgTypes[12]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *TED) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*TED) ProtoMessage() {}
-
-func (x *TED) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[12]
- if x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use TED.ProtoReflect.Descriptor instead.
-func (*TED) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{12}
-}
-
-func (x *TED) GetEnable() bool {
- if x != nil {
- return x.Enable
- }
- return false
-}
-
-func (x *TED) GetLsNodes() []*LsNode {
- if x != nil {
- return x.LsNodes
- }
- return nil
-}
-
-var File_pola_proto protoreflect.FileDescriptor
-
-var file_pola_proto_rawDesc = string([]byte{
- 0x0a, 0x0a, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62,
- 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
- 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x7d, 0x0a,
- 0x07, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x69, 0x64, 0x18,
- 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x69, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x69,
- 0x64, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
- 0x52, 0x0c, 0x73, 0x69, 0x64, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, 0x1c,
- 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28,
- 0x09, 0x52, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x12, 0x1e, 0x0a, 0x0a,
- 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x64, 0x64, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
- 0x52, 0x0a, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x64, 0x64, 0x72, 0x22, 0xff, 0x02, 0x0a,
- 0x08, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x28, 0x0a, 0x0f, 0x50, 0x43, 0x45,
- 0x50, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01,
- 0x28, 0x0c, 0x52, 0x0f, 0x50, 0x43, 0x45, 0x50, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x41,
- 0x64, 0x64, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x72, 0x63, 0x41, 0x64, 0x64, 0x72, 0x18, 0x02,
- 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x72, 0x63, 0x41, 0x64, 0x64, 0x72, 0x12, 0x18, 0x0a,
- 0x07, 0x64, 0x73, 0x74, 0x41, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07,
- 0x64, 0x73, 0x74, 0x41, 0x64, 0x64, 0x72, 0x12, 0x20, 0x0a, 0x0b, 0x73, 0x72, 0x63, 0x52, 0x6f,
- 0x75, 0x74, 0x65, 0x72, 0x49, 0x44, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x72,
- 0x63, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x73, 0x74,
- 0x52, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x49, 0x44, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b,
- 0x64, 0x73, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x49, 0x44, 0x12, 0x14, 0x0a, 0x05, 0x63,
- 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f,
- 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18,
- 0x07, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x70, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63,
- 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x18,
- 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4e, 0x61, 0x6d,
- 0x65, 0x12, 0x24, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0e, 0x32,
- 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x54, 0x79, 0x70,
- 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x2d, 0x0a, 0x0b, 0x73, 0x65, 0x67, 0x6d, 0x65,
- 0x6e, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70,
- 0x62, 0x2e, 0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x0b, 0x73, 0x65, 0x67, 0x6d, 0x65,
- 0x6e, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63,
- 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x74, 0x72,
- 0x69, 0x63, 0x54, 0x79, 0x70, 0x65, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x22, 0x51,
- 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79,
- 0x49, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x28, 0x0a, 0x08, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63,
- 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x52, 0x50,
- 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x08, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12,
- 0x10, 0x0a, 0x03, 0x61, 0x73, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x61, 0x73,
- 0x6e, 0x22, 0x51, 0x0a, 0x13, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c,
- 0x69, 0x63, 0x79, 0x49, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x28, 0x0a, 0x08, 0x53, 0x52, 0x50, 0x6f,
- 0x6c, 0x69, 0x63, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x62, 0x2e,
- 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x08, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69,
- 0x63, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x73, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52,
- 0x03, 0x61, 0x73, 0x6e, 0x22, 0x2d, 0x0a, 0x0d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x53,
- 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x65,
- 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x53, 0x75, 0x63, 0x63,
- 0x65, 0x73, 0x73, 0x22, 0x75, 0x0a, 0x07, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x12,
- 0x0a, 0x04, 0x41, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x41, 0x64,
- 0x64, 0x72, 0x12, 0x26, 0x0a, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
- 0x0e, 0x32, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74,
- 0x61, 0x74, 0x65, 0x52, 0x05, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x61,
- 0x70, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x43, 0x61, 0x70, 0x73, 0x12, 0x1a,
- 0x0a, 0x08, 0x49, 0x73, 0x53, 0x79, 0x6e, 0x63, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08,
- 0x52, 0x08, 0x49, 0x73, 0x53, 0x79, 0x6e, 0x63, 0x65, 0x64, 0x22, 0x36, 0x0a, 0x0b, 0x53, 0x65,
- 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x27, 0x0a, 0x08, 0x53, 0x65, 0x73,
- 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x62,
- 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f,
- 0x6e, 0x73, 0x22, 0x3c, 0x0a, 0x0c, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4c, 0x69,
- 0x73, 0x74, 0x12, 0x2c, 0x0a, 0x0a, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73,
- 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x52, 0x50, 0x6f,
- 0x6c, 0x69, 0x63, 0x79, 0x52, 0x0a, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73,
- 0x22, 0x3e, 0x0a, 0x08, 0x4c, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x16, 0x0a, 0x06,
- 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x72,
- 0x65, 0x66, 0x69, 0x78, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x69, 0x64, 0x49, 0x6e, 0x64, 0x65, 0x78,
- 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x73, 0x69, 0x64, 0x49, 0x6e, 0x64, 0x65, 0x78,
- 0x22, 0x42, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x22, 0x0a, 0x04, 0x74, 0x79,
- 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0e, 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65,
- 0x74, 0x72, 0x69, 0x63, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14,
- 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x76,
- 0x61, 0x6c, 0x75, 0x65, 0x22, 0x84, 0x02, 0x0a, 0x06, 0x4c, 0x73, 0x4c, 0x69, 0x6e, 0x6b, 0x12,
- 0x24, 0x0a, 0x0d, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x49, 0x44,
- 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x52, 0x6f, 0x75,
- 0x74, 0x65, 0x72, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x41, 0x53,
- 0x4e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x41, 0x53,
- 0x4e, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x49, 0x50, 0x18, 0x03, 0x20, 0x01,
- 0x28, 0x09, 0x52, 0x07, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x49, 0x50, 0x12, 0x26, 0x0a, 0x0e, 0x72,
- 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x49, 0x44, 0x18, 0x04, 0x20,
- 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65,
- 0x72, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x53, 0x4e,
- 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x53,
- 0x4e, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x49, 0x50, 0x18, 0x06, 0x20,
- 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x49, 0x50, 0x12, 0x24, 0x0a,
- 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a,
- 0x2e, 0x70, 0x62, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x72,
- 0x69, 0x63, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x64, 0x6a, 0x53, 0x49, 0x44, 0x18, 0x08, 0x20,
- 0x01, 0x28, 0x0d, 0x52, 0x06, 0x61, 0x64, 0x6a, 0x53, 0x49, 0x44, 0x22, 0xfe, 0x01, 0x0a, 0x06,
- 0x4c, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x73, 0x6e, 0x18, 0x01, 0x20,
- 0x01, 0x28, 0x0d, 0x52, 0x03, 0x61, 0x73, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x6f, 0x75, 0x74,
- 0x65, 0x72, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x6f, 0x75, 0x74,
- 0x65, 0x72, 0x49, 0x44, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x73, 0x69, 0x73, 0x41, 0x72, 0x65, 0x61,
- 0x49, 0x44, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x73, 0x69, 0x73, 0x41, 0x72,
- 0x65, 0x61, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65,
- 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65,
- 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x72, 0x67, 0x62, 0x42, 0x65, 0x67, 0x69, 0x6e, 0x18, 0x05, 0x20,
- 0x01, 0x28, 0x0d, 0x52, 0x09, 0x73, 0x72, 0x67, 0x62, 0x42, 0x65, 0x67, 0x69, 0x6e, 0x12, 0x18,
- 0x0a, 0x07, 0x73, 0x72, 0x67, 0x62, 0x45, 0x6e, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52,
- 0x07, 0x73, 0x72, 0x67, 0x62, 0x45, 0x6e, 0x64, 0x12, 0x24, 0x0a, 0x07, 0x6c, 0x73, 0x4c, 0x69,
- 0x6e, 0x6b, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x4c,
- 0x73, 0x4c, 0x69, 0x6e, 0x6b, 0x52, 0x07, 0x6c, 0x73, 0x4c, 0x69, 0x6e, 0x6b, 0x73, 0x12, 0x2c,
- 0x0a, 0x0a, 0x6c, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03,
- 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x62, 0x2e, 0x4c, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78,
- 0x52, 0x0a, 0x6c, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x65, 0x73, 0x22, 0x43, 0x0a, 0x03,
- 0x54, 0x45, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20,
- 0x01, 0x28, 0x08, 0x52, 0x06, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x24, 0x0a, 0x07, 0x6c,
- 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70,
- 0x62, 0x2e, 0x4c, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x07, 0x6c, 0x73, 0x4e, 0x6f, 0x64, 0x65,
- 0x73, 0x2a, 0x29, 0x0a, 0x0c, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x54, 0x79, 0x70,
- 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x45, 0x58, 0x50, 0x4c, 0x49, 0x43, 0x49, 0x54, 0x10, 0x00, 0x12,
- 0x0b, 0x0a, 0x07, 0x44, 0x59, 0x4e, 0x41, 0x4d, 0x49, 0x43, 0x10, 0x01, 0x2a, 0x20, 0x0a, 0x0c,
- 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x08, 0x0a, 0x04,
- 0x44, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x55, 0x50, 0x10, 0x01, 0x2a, 0x36,
- 0x0a, 0x0a, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a, 0x03,
- 0x49, 0x47, 0x50, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x54, 0x45, 0x10, 0x01, 0x12, 0x09, 0x0a,
- 0x05, 0x44, 0x45, 0x4c, 0x41, 0x59, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x48, 0x4f, 0x50, 0x43,
- 0x4f, 0x55, 0x4e, 0x54, 0x10, 0x03, 0x32, 0x88, 0x04, 0x0a, 0x0a, 0x50, 0x43, 0x45, 0x53, 0x65,
- 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3e, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53,
- 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65,
- 0x61, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x49, 0x6e, 0x70, 0x75, 0x74,
- 0x1a, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x53, 0x74, 0x61,
- 0x74, 0x75, 0x73, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x1e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53,
- 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x57, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x4c, 0x69,
- 0x6e, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65,
- 0x61, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x49, 0x6e, 0x70, 0x75, 0x74,
- 0x1a, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x53, 0x74, 0x61,
- 0x74, 0x75, 0x73, 0x22, 0x00, 0x12, 0x3e, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53,
- 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, 0x6c,
- 0x65, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x49, 0x6e, 0x70, 0x75, 0x74,
- 0x1a, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x53, 0x74, 0x61,
- 0x74, 0x75, 0x73, 0x22, 0x00, 0x12, 0x4e, 0x0a, 0x1e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53,
- 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x57, 0x69, 0x74, 0x68, 0x6f, 0x75, 0x74, 0x4c, 0x69,
- 0x6e, 0x6b, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x17, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, 0x6c,
- 0x65, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x49, 0x6e, 0x70, 0x75, 0x74,
- 0x1a, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x53, 0x74, 0x61,
- 0x74, 0x75, 0x73, 0x22, 0x00, 0x12, 0x3b, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73,
- 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
- 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a,
- 0x0f, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74,
- 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63,
- 0x79, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
- 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x10, 0x2e,
- 0x70, 0x62, 0x2e, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x22,
- 0x00, 0x12, 0x2b, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x54, 0x45, 0x44, 0x12, 0x16, 0x2e, 0x67, 0x6f,
- 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d,
- 0x70, 0x74, 0x79, 0x1a, 0x07, 0x2e, 0x70, 0x62, 0x2e, 0x54, 0x45, 0x44, 0x22, 0x00, 0x12, 0x31,
- 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12,
- 0x0b, 0x2e, 0x70, 0x62, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x1a, 0x11, 0x2e, 0x70,
- 0x62, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22,
- 0x00, 0x42, 0x21, 0x5a, 0x1f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f,
- 0x6e, 0x74, 0x74, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6f, 0x6c, 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f,
- 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
-})
-
-var (
- file_pola_proto_rawDescOnce sync.Once
- file_pola_proto_rawDescData []byte
-)
-
-func file_pola_proto_rawDescGZIP() []byte {
- file_pola_proto_rawDescOnce.Do(func() {
- file_pola_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_pola_proto_rawDesc), len(file_pola_proto_rawDesc)))
- })
- return file_pola_proto_rawDescData
-}
-
-var file_pola_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
-var file_pola_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
-var file_pola_proto_goTypes = []any{
- (SRPolicyType)(0), // 0: pb.SRPolicyType
- (SessionState)(0), // 1: pb.SessionState
- (MetricType)(0), // 2: pb.MetricType
- (*Segment)(nil), // 3: pb.Segment
- (*SRPolicy)(nil), // 4: pb.SRPolicy
- (*CreateSRPolicyInput)(nil), // 5: pb.CreateSRPolicyInput
- (*DeleteSRPolicyInput)(nil), // 6: pb.DeleteSRPolicyInput
- (*RequestStatus)(nil), // 7: pb.RequestStatus
- (*Session)(nil), // 8: pb.Session
- (*SessionList)(nil), // 9: pb.SessionList
- (*SRPolicyList)(nil), // 10: pb.SRPolicyList
- (*LsPrefix)(nil), // 11: pb.LsPrefix
- (*Metric)(nil), // 12: pb.Metric
- (*LsLink)(nil), // 13: pb.LsLink
- (*LsNode)(nil), // 14: pb.LsNode
- (*TED)(nil), // 15: pb.TED
- (*emptypb.Empty)(nil), // 16: google.protobuf.Empty
-}
-var file_pola_proto_depIdxs = []int32{
- 0, // 0: pb.SRPolicy.type:type_name -> pb.SRPolicyType
- 3, // 1: pb.SRPolicy.segmentList:type_name -> pb.Segment
- 2, // 2: pb.SRPolicy.metric:type_name -> pb.MetricType
- 4, // 3: pb.CreateSRPolicyInput.SRPolicy:type_name -> pb.SRPolicy
- 4, // 4: pb.DeleteSRPolicyInput.SRPolicy:type_name -> pb.SRPolicy
- 1, // 5: pb.Session.State:type_name -> pb.SessionState
- 8, // 6: pb.SessionList.Sessions:type_name -> pb.Session
- 4, // 7: pb.SRPolicyList.SRPolicies:type_name -> pb.SRPolicy
- 2, // 8: pb.Metric.type:type_name -> pb.MetricType
- 12, // 9: pb.LsLink.metrics:type_name -> pb.Metric
- 13, // 10: pb.LsNode.lsLinks:type_name -> pb.LsLink
- 11, // 11: pb.LsNode.lsPrefixes:type_name -> pb.LsPrefix
- 14, // 12: pb.TED.lsNodes:type_name -> pb.LsNode
- 5, // 13: pb.PCEService.CreateSRPolicy:input_type -> pb.CreateSRPolicyInput
- 5, // 14: pb.PCEService.CreateSRPolicyWithoutLinkState:input_type -> pb.CreateSRPolicyInput
- 6, // 15: pb.PCEService.DeleteSRPolicy:input_type -> pb.DeleteSRPolicyInput
- 6, // 16: pb.PCEService.DeleteSRPolicyWithoutLinkState:input_type -> pb.DeleteSRPolicyInput
- 16, // 17: pb.PCEService.GetSessionList:input_type -> google.protobuf.Empty
- 16, // 18: pb.PCEService.GetSRPolicyList:input_type -> google.protobuf.Empty
- 16, // 19: pb.PCEService.GetTED:input_type -> google.protobuf.Empty
- 8, // 20: pb.PCEService.DeleteSession:input_type -> pb.Session
- 7, // 21: pb.PCEService.CreateSRPolicy:output_type -> pb.RequestStatus
- 7, // 22: pb.PCEService.CreateSRPolicyWithoutLinkState:output_type -> pb.RequestStatus
- 7, // 23: pb.PCEService.DeleteSRPolicy:output_type -> pb.RequestStatus
- 7, // 24: pb.PCEService.DeleteSRPolicyWithoutLinkState:output_type -> pb.RequestStatus
- 9, // 25: pb.PCEService.GetSessionList:output_type -> pb.SessionList
- 10, // 26: pb.PCEService.GetSRPolicyList:output_type -> pb.SRPolicyList
- 15, // 27: pb.PCEService.GetTED:output_type -> pb.TED
- 7, // 28: pb.PCEService.DeleteSession:output_type -> pb.RequestStatus
- 21, // [21:29] is the sub-list for method output_type
- 13, // [13:21] is the sub-list for method input_type
- 13, // [13:13] is the sub-list for extension type_name
- 13, // [13:13] is the sub-list for extension extendee
- 0, // [0:13] is the sub-list for field type_name
-}
-
-func init() { file_pola_proto_init() }
-func file_pola_proto_init() {
- if File_pola_proto != nil {
- return
- }
- type x struct{}
- out := protoimpl.TypeBuilder{
- File: protoimpl.DescBuilder{
- GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
- RawDescriptor: unsafe.Slice(unsafe.StringData(file_pola_proto_rawDesc), len(file_pola_proto_rawDesc)),
- NumEnums: 3,
- NumMessages: 13,
- NumExtensions: 0,
- NumServices: 1,
- },
- GoTypes: file_pola_proto_goTypes,
- DependencyIndexes: file_pola_proto_depIdxs,
- EnumInfos: file_pola_proto_enumTypes,
- MessageInfos: file_pola_proto_msgTypes,
- }.Build()
- File_pola_proto = out.File
- file_pola_proto_goTypes = nil
- file_pola_proto_depIdxs = nil
-}
diff --git a/api/grpc/pola.proto b/api/grpc/pola.proto
deleted file mode 100644
index ee42958a..00000000
--- a/api/grpc/pola.proto
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright (c) 2022 NTT Communications Corporation
-//
-// This software is released under the MIT License.
-// see https://github.com/nttcom/pola/blob/main/LICENSE
-
-syntax = "proto3";
-
-package pb;
-
-option go_package = "github.com/nttcom/pola/api/grpc";
-
-import "google/protobuf/empty.proto";
-
-service PCEService {
- rpc CreateSRPolicy (CreateSRPolicyInput) returns (RequestStatus) {};
- rpc CreateSRPolicyWithoutLinkState (CreateSRPolicyInput) returns (RequestStatus) {};
- rpc DeleteSRPolicy (DeleteSRPolicyInput) returns (RequestStatus) {};
- rpc DeleteSRPolicyWithoutLinkState (DeleteSRPolicyInput) returns (RequestStatus) {};
- rpc GetSessionList (google.protobuf.Empty) returns (SessionList) {};
- rpc GetSRPolicyList (google.protobuf.Empty) returns (SRPolicyList) {};
- rpc GetTED (google.protobuf.Empty) returns (TED) {};
- rpc DeleteSession (Session) returns (RequestStatus) {};
-}
-
-message Segment {
- string sid = 1;
- string sidStructure = 2;
- string localAddr = 3;
- string remoteAddr = 4;
-}
-
-enum SRPolicyType {
- EXPLICIT = 0;
- DYNAMIC = 1;
-}
-
-message SRPolicy {
- bytes PCEPSessionAddr = 1;
- bytes srcAddr = 2;
- bytes dstAddr = 3;
- string srcRouterID = 4;
- string dstRouterID = 5;
- uint32 color = 6;
- uint32 preference = 7;
- string policyName = 8;
- SRPolicyType type = 9;
- repeated Segment segmentList = 10;
- MetricType metric = 11;
-}
-
-message CreateSRPolicyInput {
- SRPolicy SRPolicy = 1;
- uint32 asn = 2;
-}
-
-message DeleteSRPolicyInput {
- SRPolicy SRPolicy = 1;
- uint32 asn = 2;
-}
-
-message RequestStatus {
- bool isSuccess = 1;
-}
-
-enum SessionState {
- DOWN = 0;
- UP = 1;
-}
-
-message Session {
- bytes Addr = 1;
- SessionState State = 2;
- repeated string Caps = 3;
- bool IsSynced = 4;
-}
-
-message SessionList {
- repeated Session Sessions = 1;
-}
-
-message SRPolicyList {
- repeated SRPolicy SRPolicies = 1;
-}
-
-message LsPrefix {
- string prefix = 1;
- uint32 sidIndex = 2;
-}
-
-enum MetricType {
- IGP = 0;
- TE = 1;
- DELAY = 2;
- HOPCOUNT = 3;
-}
-
-message Metric {
- MetricType type = 1;
- uint32 value = 2;
-}
-
-message LsLink {
- string localRouterID = 1;
- uint32 localASN = 2;
- string localIP = 3;
- string remoteRouterID = 4;
- uint32 remoteASN = 5;
- string remoteIP = 6;
- repeated Metric metrics = 7;
- uint32 adjSID = 8;
-}
-
-message LsNode {
- uint32 asn = 1;
- string routerID = 2;
- string isisAreaID = 3;
- string hostname = 4;
- uint32 srgbBegin = 5;
- uint32 srgbEnd = 6;
- repeated LsLink lsLinks = 7;
- repeated LsPrefix lsPrefixes = 8;
-}
-
-
-message TED {
- bool enable = 1;
- repeated LsNode lsNodes = 2;
-}
diff --git a/api/pola/v1/pola.pb.go b/api/pola/v1/pola.pb.go
new file mode 100644
index 00000000..c56ab5d0
--- /dev/null
+++ b/api/pola/v1/pola.pb.go
@@ -0,0 +1,2063 @@
+// Copyright (c) 2022 NTT Communications Corporation
+//
+// This software is released under the MIT License.
+// see https://github.com/nttcom/pola/blob/main/LICENSE
+
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.26.0
+// protoc v3.12.4
+// source: pola.proto
+
+package v1
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type SRPolicyType int32
+
+const (
+ SRPolicyType_SR_POLICY_TYPE_UNSPECIFIED SRPolicyType = 0
+ SRPolicyType_SR_POLICY_TYPE_EXPLICIT SRPolicyType = 1
+ SRPolicyType_SR_POLICY_TYPE_DYNAMIC SRPolicyType = 2
+)
+
+// Enum value maps for SRPolicyType.
+var (
+ SRPolicyType_name = map[int32]string{
+ 0: "SR_POLICY_TYPE_UNSPECIFIED",
+ 1: "SR_POLICY_TYPE_EXPLICIT",
+ 2: "SR_POLICY_TYPE_DYNAMIC",
+ }
+ SRPolicyType_value = map[string]int32{
+ "SR_POLICY_TYPE_UNSPECIFIED": 0,
+ "SR_POLICY_TYPE_EXPLICIT": 1,
+ "SR_POLICY_TYPE_DYNAMIC": 2,
+ }
+)
+
+func (x SRPolicyType) Enum() *SRPolicyType {
+ p := new(SRPolicyType)
+ *p = x
+ return p
+}
+
+func (x SRPolicyType) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (SRPolicyType) Descriptor() protoreflect.EnumDescriptor {
+ return file_pola_proto_enumTypes[0].Descriptor()
+}
+
+func (SRPolicyType) Type() protoreflect.EnumType {
+ return &file_pola_proto_enumTypes[0]
+}
+
+func (x SRPolicyType) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use SRPolicyType.Descriptor instead.
+func (SRPolicyType) EnumDescriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{0}
+}
+
+type SessionState int32
+
+const (
+ SessionState_SESSION_STATE_UNSPECIFIED SessionState = 0
+ SessionState_SESSION_STATE_DOWN SessionState = 1
+ SessionState_SESSION_STATE_UP SessionState = 2
+)
+
+// Enum value maps for SessionState.
+var (
+ SessionState_name = map[int32]string{
+ 0: "SESSION_STATE_UNSPECIFIED",
+ 1: "SESSION_STATE_DOWN",
+ 2: "SESSION_STATE_UP",
+ }
+ SessionState_value = map[string]int32{
+ "SESSION_STATE_UNSPECIFIED": 0,
+ "SESSION_STATE_DOWN": 1,
+ "SESSION_STATE_UP": 2,
+ }
+)
+
+func (x SessionState) Enum() *SessionState {
+ p := new(SessionState)
+ *p = x
+ return p
+}
+
+func (x SessionState) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (SessionState) Descriptor() protoreflect.EnumDescriptor {
+ return file_pola_proto_enumTypes[1].Descriptor()
+}
+
+func (SessionState) Type() protoreflect.EnumType {
+ return &file_pola_proto_enumTypes[1]
+}
+
+func (x SessionState) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use SessionState.Descriptor instead.
+func (SessionState) EnumDescriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{1}
+}
+
+type MetricType int32
+
+const (
+ MetricType_METRIC_TYPE_UNSPECIFIED MetricType = 0
+ MetricType_METRIC_TYPE_IGP MetricType = 1
+ MetricType_METRIC_TYPE_TE MetricType = 2
+ MetricType_METRIC_TYPE_DELAY MetricType = 3
+ MetricType_METRIC_TYPE_HOPCOUNT MetricType = 4
+)
+
+// Enum value maps for MetricType.
+var (
+ MetricType_name = map[int32]string{
+ 0: "METRIC_TYPE_UNSPECIFIED",
+ 1: "METRIC_TYPE_IGP",
+ 2: "METRIC_TYPE_TE",
+ 3: "METRIC_TYPE_DELAY",
+ 4: "METRIC_TYPE_HOPCOUNT",
+ }
+ MetricType_value = map[string]int32{
+ "METRIC_TYPE_UNSPECIFIED": 0,
+ "METRIC_TYPE_IGP": 1,
+ "METRIC_TYPE_TE": 2,
+ "METRIC_TYPE_DELAY": 3,
+ "METRIC_TYPE_HOPCOUNT": 4,
+ }
+)
+
+func (x MetricType) Enum() *MetricType {
+ p := new(MetricType)
+ *p = x
+ return p
+}
+
+func (x MetricType) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (MetricType) Descriptor() protoreflect.EnumDescriptor {
+ return file_pola_proto_enumTypes[2].Descriptor()
+}
+
+func (MetricType) Type() protoreflect.EnumType {
+ return &file_pola_proto_enumTypes[2]
+}
+
+func (x MetricType) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use MetricType.Descriptor instead.
+func (MetricType) EnumDescriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{2}
+}
+
+type Segment struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Sid string `protobuf:"bytes,1,opt,name=sid,proto3" json:"sid,omitempty"`
+ SidStructure string `protobuf:"bytes,2,opt,name=sid_structure,json=sidStructure,proto3" json:"sid_structure,omitempty"`
+ LocalAddr string `protobuf:"bytes,3,opt,name=local_addr,json=localAddr,proto3" json:"local_addr,omitempty"`
+ RemoteAddr string `protobuf:"bytes,4,opt,name=remote_addr,json=remoteAddr,proto3" json:"remote_addr,omitempty"`
+}
+
+func (x *Segment) Reset() {
+ *x = Segment{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Segment) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Segment) ProtoMessage() {}
+
+func (x *Segment) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Segment.ProtoReflect.Descriptor instead.
+func (*Segment) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *Segment) GetSid() string {
+ if x != nil {
+ return x.Sid
+ }
+ return ""
+}
+
+func (x *Segment) GetSidStructure() string {
+ if x != nil {
+ return x.SidStructure
+ }
+ return ""
+}
+
+func (x *Segment) GetLocalAddr() string {
+ if x != nil {
+ return x.LocalAddr
+ }
+ return ""
+}
+
+func (x *Segment) GetRemoteAddr() string {
+ if x != nil {
+ return x.RemoteAddr
+ }
+ return ""
+}
+
+type SRPolicy struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ PcepSessionAddr []byte `protobuf:"bytes,1,opt,name=pcep_session_addr,json=pcepSessionAddr,proto3" json:"pcep_session_addr,omitempty"`
+ SrcAddr []byte `protobuf:"bytes,2,opt,name=src_addr,json=srcAddr,proto3" json:"src_addr,omitempty"`
+ DstAddr []byte `protobuf:"bytes,3,opt,name=dst_addr,json=dstAddr,proto3" json:"dst_addr,omitempty"`
+ SrcRouterId string `protobuf:"bytes,4,opt,name=src_router_id,json=srcRouterId,proto3" json:"src_router_id,omitempty"`
+ DstRouterId string `protobuf:"bytes,5,opt,name=dst_router_id,json=dstRouterId,proto3" json:"dst_router_id,omitempty"`
+ Color uint32 `protobuf:"varint,6,opt,name=color,proto3" json:"color,omitempty"`
+ Preference uint32 `protobuf:"varint,7,opt,name=preference,proto3" json:"preference,omitempty"`
+ PolicyName string `protobuf:"bytes,8,opt,name=policy_name,json=policyName,proto3" json:"policy_name,omitempty"`
+ Type SRPolicyType `protobuf:"varint,9,opt,name=type,proto3,enum=api.pola.v1.SRPolicyType" json:"type,omitempty"`
+ SegmentList []*Segment `protobuf:"bytes,10,rep,name=segment_list,json=segmentList,proto3" json:"segment_list,omitempty"`
+ Metric MetricType `protobuf:"varint,11,opt,name=metric,proto3,enum=api.pola.v1.MetricType" json:"metric,omitempty"`
+}
+
+func (x *SRPolicy) Reset() {
+ *x = SRPolicy{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SRPolicy) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SRPolicy) ProtoMessage() {}
+
+func (x *SRPolicy) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SRPolicy.ProtoReflect.Descriptor instead.
+func (*SRPolicy) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *SRPolicy) GetPcepSessionAddr() []byte {
+ if x != nil {
+ return x.PcepSessionAddr
+ }
+ return nil
+}
+
+func (x *SRPolicy) GetSrcAddr() []byte {
+ if x != nil {
+ return x.SrcAddr
+ }
+ return nil
+}
+
+func (x *SRPolicy) GetDstAddr() []byte {
+ if x != nil {
+ return x.DstAddr
+ }
+ return nil
+}
+
+func (x *SRPolicy) GetSrcRouterId() string {
+ if x != nil {
+ return x.SrcRouterId
+ }
+ return ""
+}
+
+func (x *SRPolicy) GetDstRouterId() string {
+ if x != nil {
+ return x.DstRouterId
+ }
+ return ""
+}
+
+func (x *SRPolicy) GetColor() uint32 {
+ if x != nil {
+ return x.Color
+ }
+ return 0
+}
+
+func (x *SRPolicy) GetPreference() uint32 {
+ if x != nil {
+ return x.Preference
+ }
+ return 0
+}
+
+func (x *SRPolicy) GetPolicyName() string {
+ if x != nil {
+ return x.PolicyName
+ }
+ return ""
+}
+
+func (x *SRPolicy) GetType() SRPolicyType {
+ if x != nil {
+ return x.Type
+ }
+ return SRPolicyType_SR_POLICY_TYPE_UNSPECIFIED
+}
+
+func (x *SRPolicy) GetSegmentList() []*Segment {
+ if x != nil {
+ return x.SegmentList
+ }
+ return nil
+}
+
+func (x *SRPolicy) GetMetric() MetricType {
+ if x != nil {
+ return x.Metric
+ }
+ return MetricType_METRIC_TYPE_UNSPECIFIED
+}
+
+type CreateSRPolicyRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ SrPolicy *SRPolicy `protobuf:"bytes,1,opt,name=sr_policy,json=srPolicy,proto3" json:"sr_policy,omitempty"`
+ Asn uint32 `protobuf:"varint,2,opt,name=asn,proto3" json:"asn,omitempty"`
+ SidValidate bool `protobuf:"varint,3,opt,name=sid_validate,json=sidValidate,proto3" json:"sid_validate,omitempty"`
+}
+
+func (x *CreateSRPolicyRequest) Reset() {
+ *x = CreateSRPolicyRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CreateSRPolicyRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CreateSRPolicyRequest) ProtoMessage() {}
+
+func (x *CreateSRPolicyRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CreateSRPolicyRequest.ProtoReflect.Descriptor instead.
+func (*CreateSRPolicyRequest) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *CreateSRPolicyRequest) GetSrPolicy() *SRPolicy {
+ if x != nil {
+ return x.SrPolicy
+ }
+ return nil
+}
+
+func (x *CreateSRPolicyRequest) GetAsn() uint32 {
+ if x != nil {
+ return x.Asn
+ }
+ return 0
+}
+
+func (x *CreateSRPolicyRequest) GetSidValidate() bool {
+ if x != nil {
+ return x.SidValidate
+ }
+ return false
+}
+
+type CreateSRPolicyResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ IsSuccess bool `protobuf:"varint,1,opt,name=is_success,json=isSuccess,proto3" json:"is_success,omitempty"`
+}
+
+func (x *CreateSRPolicyResponse) Reset() {
+ *x = CreateSRPolicyResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CreateSRPolicyResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CreateSRPolicyResponse) ProtoMessage() {}
+
+func (x *CreateSRPolicyResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CreateSRPolicyResponse.ProtoReflect.Descriptor instead.
+func (*CreateSRPolicyResponse) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *CreateSRPolicyResponse) GetIsSuccess() bool {
+ if x != nil {
+ return x.IsSuccess
+ }
+ return false
+}
+
+type DeleteSRPolicyRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ SrPolicy *SRPolicy `protobuf:"bytes,1,opt,name=sr_policy,json=srPolicy,proto3" json:"sr_policy,omitempty"`
+ Asn uint32 `protobuf:"varint,2,opt,name=asn,proto3" json:"asn,omitempty"`
+}
+
+func (x *DeleteSRPolicyRequest) Reset() {
+ *x = DeleteSRPolicyRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[4]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *DeleteSRPolicyRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DeleteSRPolicyRequest) ProtoMessage() {}
+
+func (x *DeleteSRPolicyRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[4]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use DeleteSRPolicyRequest.ProtoReflect.Descriptor instead.
+func (*DeleteSRPolicyRequest) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{4}
+}
+
+func (x *DeleteSRPolicyRequest) GetSrPolicy() *SRPolicy {
+ if x != nil {
+ return x.SrPolicy
+ }
+ return nil
+}
+
+func (x *DeleteSRPolicyRequest) GetAsn() uint32 {
+ if x != nil {
+ return x.Asn
+ }
+ return 0
+}
+
+type DeleteSRPolicyResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ IsSuccess bool `protobuf:"varint,1,opt,name=is_success,json=isSuccess,proto3" json:"is_success,omitempty"`
+}
+
+func (x *DeleteSRPolicyResponse) Reset() {
+ *x = DeleteSRPolicyResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[5]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *DeleteSRPolicyResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DeleteSRPolicyResponse) ProtoMessage() {}
+
+func (x *DeleteSRPolicyResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[5]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use DeleteSRPolicyResponse.ProtoReflect.Descriptor instead.
+func (*DeleteSRPolicyResponse) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{5}
+}
+
+func (x *DeleteSRPolicyResponse) GetIsSuccess() bool {
+ if x != nil {
+ return x.IsSuccess
+ }
+ return false
+}
+
+type Session struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Addr []byte `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"`
+ State SessionState `protobuf:"varint,2,opt,name=state,proto3,enum=api.pola.v1.SessionState" json:"state,omitempty"`
+ Caps []string `protobuf:"bytes,3,rep,name=caps,proto3" json:"caps,omitempty"`
+ IsSynced bool `protobuf:"varint,4,opt,name=is_synced,json=isSynced,proto3" json:"is_synced,omitempty"`
+}
+
+func (x *Session) Reset() {
+ *x = Session{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[6]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Session) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Session) ProtoMessage() {}
+
+func (x *Session) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[6]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Session.ProtoReflect.Descriptor instead.
+func (*Session) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{6}
+}
+
+func (x *Session) GetAddr() []byte {
+ if x != nil {
+ return x.Addr
+ }
+ return nil
+}
+
+func (x *Session) GetState() SessionState {
+ if x != nil {
+ return x.State
+ }
+ return SessionState_SESSION_STATE_UNSPECIFIED
+}
+
+func (x *Session) GetCaps() []string {
+ if x != nil {
+ return x.Caps
+ }
+ return nil
+}
+
+func (x *Session) GetIsSynced() bool {
+ if x != nil {
+ return x.IsSynced
+ }
+ return false
+}
+
+type SessionList struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Sessions []*Session `protobuf:"bytes,1,rep,name=sessions,proto3" json:"sessions,omitempty"`
+}
+
+func (x *SessionList) Reset() {
+ *x = SessionList{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[7]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SessionList) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SessionList) ProtoMessage() {}
+
+func (x *SessionList) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[7]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SessionList.ProtoReflect.Descriptor instead.
+func (*SessionList) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{7}
+}
+
+func (x *SessionList) GetSessions() []*Session {
+ if x != nil {
+ return x.Sessions
+ }
+ return nil
+}
+
+type SRPolicyList struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ SrPolicies []*SRPolicy `protobuf:"bytes,1,rep,name=sr_policies,json=srPolicies,proto3" json:"sr_policies,omitempty"`
+}
+
+func (x *SRPolicyList) Reset() {
+ *x = SRPolicyList{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[8]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SRPolicyList) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SRPolicyList) ProtoMessage() {}
+
+func (x *SRPolicyList) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[8]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SRPolicyList.ProtoReflect.Descriptor instead.
+func (*SRPolicyList) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{8}
+}
+
+func (x *SRPolicyList) GetSrPolicies() []*SRPolicy {
+ if x != nil {
+ return x.SrPolicies
+ }
+ return nil
+}
+
+type LsPrefix struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Prefix string `protobuf:"bytes,1,opt,name=prefix,proto3" json:"prefix,omitempty"`
+ SidIndex uint32 `protobuf:"varint,2,opt,name=sid_index,json=sidIndex,proto3" json:"sid_index,omitempty"`
+}
+
+func (x *LsPrefix) Reset() {
+ *x = LsPrefix{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[9]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *LsPrefix) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*LsPrefix) ProtoMessage() {}
+
+func (x *LsPrefix) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[9]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use LsPrefix.ProtoReflect.Descriptor instead.
+func (*LsPrefix) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{9}
+}
+
+func (x *LsPrefix) GetPrefix() string {
+ if x != nil {
+ return x.Prefix
+ }
+ return ""
+}
+
+func (x *LsPrefix) GetSidIndex() uint32 {
+ if x != nil {
+ return x.SidIndex
+ }
+ return 0
+}
+
+type Metric struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Type MetricType `protobuf:"varint,1,opt,name=type,proto3,enum=api.pola.v1.MetricType" json:"type,omitempty"`
+ Value uint32 `protobuf:"varint,2,opt,name=value,proto3" json:"value,omitempty"`
+}
+
+func (x *Metric) Reset() {
+ *x = Metric{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[10]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Metric) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Metric) ProtoMessage() {}
+
+func (x *Metric) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[10]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Metric.ProtoReflect.Descriptor instead.
+func (*Metric) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{10}
+}
+
+func (x *Metric) GetType() MetricType {
+ if x != nil {
+ return x.Type
+ }
+ return MetricType_METRIC_TYPE_UNSPECIFIED
+}
+
+func (x *Metric) GetValue() uint32 {
+ if x != nil {
+ return x.Value
+ }
+ return 0
+}
+
+type LsLink struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ LocalRouterId string `protobuf:"bytes,1,opt,name=local_router_id,json=localRouterId,proto3" json:"local_router_id,omitempty"`
+ LocalAsn uint32 `protobuf:"varint,2,opt,name=local_asn,json=localAsn,proto3" json:"local_asn,omitempty"`
+ LocalIp string `protobuf:"bytes,3,opt,name=local_ip,json=localIp,proto3" json:"local_ip,omitempty"`
+ RemoteRouterId string `protobuf:"bytes,4,opt,name=remote_router_id,json=remoteRouterId,proto3" json:"remote_router_id,omitempty"`
+ RemoteAsn uint32 `protobuf:"varint,5,opt,name=remote_asn,json=remoteAsn,proto3" json:"remote_asn,omitempty"`
+ RemoteIp string `protobuf:"bytes,6,opt,name=remote_ip,json=remoteIp,proto3" json:"remote_ip,omitempty"`
+ Metrics []*Metric `protobuf:"bytes,7,rep,name=metrics,proto3" json:"metrics,omitempty"`
+ AdjSid uint32 `protobuf:"varint,8,opt,name=adj_sid,json=adjSid,proto3" json:"adj_sid,omitempty"`
+}
+
+func (x *LsLink) Reset() {
+ *x = LsLink{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[11]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *LsLink) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*LsLink) ProtoMessage() {}
+
+func (x *LsLink) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[11]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use LsLink.ProtoReflect.Descriptor instead.
+func (*LsLink) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{11}
+}
+
+func (x *LsLink) GetLocalRouterId() string {
+ if x != nil {
+ return x.LocalRouterId
+ }
+ return ""
+}
+
+func (x *LsLink) GetLocalAsn() uint32 {
+ if x != nil {
+ return x.LocalAsn
+ }
+ return 0
+}
+
+func (x *LsLink) GetLocalIp() string {
+ if x != nil {
+ return x.LocalIp
+ }
+ return ""
+}
+
+func (x *LsLink) GetRemoteRouterId() string {
+ if x != nil {
+ return x.RemoteRouterId
+ }
+ return ""
+}
+
+func (x *LsLink) GetRemoteAsn() uint32 {
+ if x != nil {
+ return x.RemoteAsn
+ }
+ return 0
+}
+
+func (x *LsLink) GetRemoteIp() string {
+ if x != nil {
+ return x.RemoteIp
+ }
+ return ""
+}
+
+func (x *LsLink) GetMetrics() []*Metric {
+ if x != nil {
+ return x.Metrics
+ }
+ return nil
+}
+
+func (x *LsLink) GetAdjSid() uint32 {
+ if x != nil {
+ return x.AdjSid
+ }
+ return 0
+}
+
+type LsNode struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Asn uint32 `protobuf:"varint,1,opt,name=asn,proto3" json:"asn,omitempty"`
+ RouterId string `protobuf:"bytes,2,opt,name=router_id,json=routerId,proto3" json:"router_id,omitempty"`
+ IsisAreaId string `protobuf:"bytes,3,opt,name=isis_area_id,json=isisAreaId,proto3" json:"isis_area_id,omitempty"`
+ Hostname string `protobuf:"bytes,4,opt,name=hostname,proto3" json:"hostname,omitempty"`
+ SrgbBegin uint32 `protobuf:"varint,5,opt,name=srgb_begin,json=srgbBegin,proto3" json:"srgb_begin,omitempty"`
+ SrgbEnd uint32 `protobuf:"varint,6,opt,name=srgb_end,json=srgbEnd,proto3" json:"srgb_end,omitempty"`
+ LsLinks []*LsLink `protobuf:"bytes,7,rep,name=ls_links,json=lsLinks,proto3" json:"ls_links,omitempty"`
+ LsPrefixes []*LsPrefix `protobuf:"bytes,8,rep,name=ls_prefixes,json=lsPrefixes,proto3" json:"ls_prefixes,omitempty"`
+}
+
+func (x *LsNode) Reset() {
+ *x = LsNode{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[12]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *LsNode) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*LsNode) ProtoMessage() {}
+
+func (x *LsNode) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[12]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use LsNode.ProtoReflect.Descriptor instead.
+func (*LsNode) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{12}
+}
+
+func (x *LsNode) GetAsn() uint32 {
+ if x != nil {
+ return x.Asn
+ }
+ return 0
+}
+
+func (x *LsNode) GetRouterId() string {
+ if x != nil {
+ return x.RouterId
+ }
+ return ""
+}
+
+func (x *LsNode) GetIsisAreaId() string {
+ if x != nil {
+ return x.IsisAreaId
+ }
+ return ""
+}
+
+func (x *LsNode) GetHostname() string {
+ if x != nil {
+ return x.Hostname
+ }
+ return ""
+}
+
+func (x *LsNode) GetSrgbBegin() uint32 {
+ if x != nil {
+ return x.SrgbBegin
+ }
+ return 0
+}
+
+func (x *LsNode) GetSrgbEnd() uint32 {
+ if x != nil {
+ return x.SrgbEnd
+ }
+ return 0
+}
+
+func (x *LsNode) GetLsLinks() []*LsLink {
+ if x != nil {
+ return x.LsLinks
+ }
+ return nil
+}
+
+func (x *LsNode) GetLsPrefixes() []*LsPrefix {
+ if x != nil {
+ return x.LsPrefixes
+ }
+ return nil
+}
+
+type TED struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Enable bool `protobuf:"varint,1,opt,name=enable,proto3" json:"enable,omitempty"`
+ LsNodes []*LsNode `protobuf:"bytes,2,rep,name=ls_nodes,json=lsNodes,proto3" json:"ls_nodes,omitempty"`
+}
+
+func (x *TED) Reset() {
+ *x = TED{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[13]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *TED) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*TED) ProtoMessage() {}
+
+func (x *TED) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[13]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use TED.ProtoReflect.Descriptor instead.
+func (*TED) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{13}
+}
+
+func (x *TED) GetEnable() bool {
+ if x != nil {
+ return x.Enable
+ }
+ return false
+}
+
+func (x *TED) GetLsNodes() []*LsNode {
+ if x != nil {
+ return x.LsNodes
+ }
+ return nil
+}
+
+type GetSessionListRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+}
+
+func (x *GetSessionListRequest) Reset() {
+ *x = GetSessionListRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[14]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetSessionListRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetSessionListRequest) ProtoMessage() {}
+
+func (x *GetSessionListRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[14]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetSessionListRequest.ProtoReflect.Descriptor instead.
+func (*GetSessionListRequest) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{14}
+}
+
+type GetSessionListResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Sessions []*Session `protobuf:"bytes,1,rep,name=sessions,proto3" json:"sessions,omitempty"`
+}
+
+func (x *GetSessionListResponse) Reset() {
+ *x = GetSessionListResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[15]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetSessionListResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetSessionListResponse) ProtoMessage() {}
+
+func (x *GetSessionListResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[15]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetSessionListResponse.ProtoReflect.Descriptor instead.
+func (*GetSessionListResponse) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{15}
+}
+
+func (x *GetSessionListResponse) GetSessions() []*Session {
+ if x != nil {
+ return x.Sessions
+ }
+ return nil
+}
+
+type GetSRPolicyListRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+}
+
+func (x *GetSRPolicyListRequest) Reset() {
+ *x = GetSRPolicyListRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[16]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetSRPolicyListRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetSRPolicyListRequest) ProtoMessage() {}
+
+func (x *GetSRPolicyListRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[16]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetSRPolicyListRequest.ProtoReflect.Descriptor instead.
+func (*GetSRPolicyListRequest) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{16}
+}
+
+type GetSRPolicyListResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ SrPolicies []*SRPolicy `protobuf:"bytes,1,rep,name=sr_policies,json=srPolicies,proto3" json:"sr_policies,omitempty"`
+}
+
+func (x *GetSRPolicyListResponse) Reset() {
+ *x = GetSRPolicyListResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[17]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetSRPolicyListResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetSRPolicyListResponse) ProtoMessage() {}
+
+func (x *GetSRPolicyListResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[17]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetSRPolicyListResponse.ProtoReflect.Descriptor instead.
+func (*GetSRPolicyListResponse) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{17}
+}
+
+func (x *GetSRPolicyListResponse) GetSrPolicies() []*SRPolicy {
+ if x != nil {
+ return x.SrPolicies
+ }
+ return nil
+}
+
+type GetTEDRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+}
+
+func (x *GetTEDRequest) Reset() {
+ *x = GetTEDRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[18]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetTEDRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetTEDRequest) ProtoMessage() {}
+
+func (x *GetTEDRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[18]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetTEDRequest.ProtoReflect.Descriptor instead.
+func (*GetTEDRequest) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{18}
+}
+
+type GetTEDResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Enable bool `protobuf:"varint,1,opt,name=enable,proto3" json:"enable,omitempty"`
+ LsNodes []*LsNode `protobuf:"bytes,2,rep,name=ls_nodes,json=lsNodes,proto3" json:"ls_nodes,omitempty"`
+}
+
+func (x *GetTEDResponse) Reset() {
+ *x = GetTEDResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[19]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetTEDResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetTEDResponse) ProtoMessage() {}
+
+func (x *GetTEDResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[19]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use GetTEDResponse.ProtoReflect.Descriptor instead.
+func (*GetTEDResponse) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{19}
+}
+
+func (x *GetTEDResponse) GetEnable() bool {
+ if x != nil {
+ return x.Enable
+ }
+ return false
+}
+
+func (x *GetTEDResponse) GetLsNodes() []*LsNode {
+ if x != nil {
+ return x.LsNodes
+ }
+ return nil
+}
+
+type DeleteSessionRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Addr []byte `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"`
+}
+
+func (x *DeleteSessionRequest) Reset() {
+ *x = DeleteSessionRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[20]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *DeleteSessionRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DeleteSessionRequest) ProtoMessage() {}
+
+func (x *DeleteSessionRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[20]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use DeleteSessionRequest.ProtoReflect.Descriptor instead.
+func (*DeleteSessionRequest) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{20}
+}
+
+func (x *DeleteSessionRequest) GetAddr() []byte {
+ if x != nil {
+ return x.Addr
+ }
+ return nil
+}
+
+type DeleteSessionResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ IsSuccess bool `protobuf:"varint,1,opt,name=is_success,json=isSuccess,proto3" json:"is_success,omitempty"`
+}
+
+func (x *DeleteSessionResponse) Reset() {
+ *x = DeleteSessionResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[21]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *DeleteSessionResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DeleteSessionResponse) ProtoMessage() {}
+
+func (x *DeleteSessionResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[21]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use DeleteSessionResponse.ProtoReflect.Descriptor instead.
+func (*DeleteSessionResponse) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{21}
+}
+
+func (x *DeleteSessionResponse) GetIsSuccess() bool {
+ if x != nil {
+ return x.IsSuccess
+ }
+ return false
+}
+
+var File_pola_proto protoreflect.FileDescriptor
+
+var file_pola_proto_rawDesc = []byte{
+ 0x0a, 0x0a, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x61, 0x70,
+ 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x22, 0x80, 0x01, 0x0a, 0x07, 0x53, 0x65,
+ 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x03, 0x73, 0x69, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x69, 0x64, 0x5f, 0x73,
+ 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c,
+ 0x73, 0x69, 0x64, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, 0x1d, 0x0a, 0x0a,
+ 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x41, 0x64, 0x64, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x72,
+ 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x0a, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x64, 0x64, 0x72, 0x22, 0xa4, 0x03, 0x0a,
+ 0x08, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x2a, 0x0a, 0x11, 0x70, 0x63, 0x65,
+ 0x70, 0x5f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0f, 0x70, 0x63, 0x65, 0x70, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f,
+ 0x6e, 0x41, 0x64, 0x64, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x72, 0x63, 0x5f, 0x61, 0x64, 0x64,
+ 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x73, 0x72, 0x63, 0x41, 0x64, 0x64, 0x72,
+ 0x12, 0x19, 0x0a, 0x08, 0x64, 0x73, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x03, 0x20, 0x01,
+ 0x28, 0x0c, 0x52, 0x07, 0x64, 0x73, 0x74, 0x41, 0x64, 0x64, 0x72, 0x12, 0x22, 0x0a, 0x0d, 0x73,
+ 0x72, 0x63, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x0b, 0x73, 0x72, 0x63, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12,
+ 0x22, 0x0a, 0x0d, 0x64, 0x73, 0x74, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64,
+ 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x73, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65,
+ 0x72, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x18, 0x06, 0x20, 0x01,
+ 0x28, 0x0d, 0x52, 0x05, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x72, 0x65,
+ 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x70,
+ 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x6f, 0x6c,
+ 0x69, 0x63, 0x79, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a,
+ 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x2d, 0x0a, 0x04, 0x74, 0x79,
+ 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70,
+ 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x54,
+ 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x37, 0x0a, 0x0c, 0x73, 0x65, 0x67,
+ 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32,
+ 0x14, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65,
+ 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x0b, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x4c, 0x69,
+ 0x73, 0x74, 0x12, 0x2f, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x0b, 0x20, 0x01,
+ 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31,
+ 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x79, 0x70, 0x65, 0x52, 0x06, 0x6d, 0x65, 0x74,
+ 0x72, 0x69, 0x63, 0x22, 0x80, 0x01, 0x0a, 0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x52,
+ 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x32, 0x0a,
+ 0x09, 0x73, 0x72, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b,
+ 0x32, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x53,
+ 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x08, 0x73, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63,
+ 0x79, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x73, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03,
+ 0x61, 0x73, 0x6e, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x69, 0x64, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64,
+ 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x73, 0x69, 0x64, 0x56, 0x61,
+ 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x22, 0x37, 0x0a, 0x16, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
+ 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
+ 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73, 0x5f, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22,
+ 0x5d, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63,
+ 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x32, 0x0a, 0x09, 0x73, 0x72, 0x5f, 0x70,
+ 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x61, 0x70,
+ 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69,
+ 0x63, 0x79, 0x52, 0x08, 0x73, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x10, 0x0a, 0x03,
+ 0x61, 0x73, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x61, 0x73, 0x6e, 0x22, 0x37,
+ 0x0a, 0x16, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79,
+ 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73, 0x5f, 0x73,
+ 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73,
+ 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x22, 0x7f, 0x0a, 0x07, 0x53, 0x65, 0x73, 0x73, 0x69,
+ 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c,
+ 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x2f, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61,
+ 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65,
+ 0x52, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x61, 0x70, 0x73, 0x18,
+ 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x63, 0x61, 0x70, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x69,
+ 0x73, 0x5f, 0x73, 0x79, 0x6e, 0x63, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08,
+ 0x69, 0x73, 0x53, 0x79, 0x6e, 0x63, 0x65, 0x64, 0x22, 0x3f, 0x0a, 0x0b, 0x53, 0x65, 0x73, 0x73,
+ 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x30, 0x0a, 0x08, 0x73, 0x65, 0x73, 0x73, 0x69,
+ 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x70, 0x69, 0x2e,
+ 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52,
+ 0x08, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x46, 0x0a, 0x0c, 0x53, 0x52, 0x50,
+ 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x36, 0x0a, 0x0b, 0x73, 0x72, 0x5f,
+ 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15,
+ 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x52, 0x50,
+ 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x0a, 0x73, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65,
+ 0x73, 0x22, 0x3f, 0x0a, 0x08, 0x4c, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x16, 0x0a,
+ 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70,
+ 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x69, 0x64, 0x5f, 0x69, 0x6e, 0x64,
+ 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x73, 0x69, 0x64, 0x49, 0x6e, 0x64,
+ 0x65, 0x78, 0x22, 0x4b, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x2b, 0x0a, 0x04,
+ 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x61, 0x70, 0x69,
+ 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54,
+ 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c,
+ 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22,
+ 0x96, 0x02, 0x0a, 0x06, 0x4c, 0x73, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x26, 0x0a, 0x0f, 0x6c, 0x6f,
+ 0x63, 0x61, 0x6c, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x72,
+ 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x61, 0x73, 0x6e, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x41, 0x73, 0x6e, 0x12,
+ 0x19, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x69, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x07, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x49, 0x70, 0x12, 0x28, 0x0a, 0x10, 0x72, 0x65,
+ 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x04,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x52, 0x6f, 0x75, 0x74,
+ 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x61,
+ 0x73, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65,
+ 0x41, 0x73, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x69, 0x70,
+ 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x49, 0x70,
+ 0x12, 0x2d, 0x0a, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28,
+ 0x0b, 0x32, 0x13, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e,
+ 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12,
+ 0x17, 0x0a, 0x07, 0x61, 0x64, 0x6a, 0x5f, 0x73, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0d,
+ 0x52, 0x06, 0x61, 0x64, 0x6a, 0x53, 0x69, 0x64, 0x22, 0x97, 0x02, 0x0a, 0x06, 0x4c, 0x73, 0x4e,
+ 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x73, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d,
+ 0x52, 0x03, 0x61, 0x73, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f,
+ 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72,
+ 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0c, 0x69, 0x73, 0x69, 0x73, 0x5f, 0x61, 0x72, 0x65, 0x61, 0x5f,
+ 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x73, 0x69, 0x73, 0x41, 0x72,
+ 0x65, 0x61, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65,
+ 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65,
+ 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x72, 0x67, 0x62, 0x5f, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x18, 0x05,
+ 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x73, 0x72, 0x67, 0x62, 0x42, 0x65, 0x67, 0x69, 0x6e, 0x12,
+ 0x19, 0x0a, 0x08, 0x73, 0x72, 0x67, 0x62, 0x5f, 0x65, 0x6e, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28,
+ 0x0d, 0x52, 0x07, 0x73, 0x72, 0x67, 0x62, 0x45, 0x6e, 0x64, 0x12, 0x2e, 0x0a, 0x08, 0x6c, 0x73,
+ 0x5f, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x61,
+ 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x73, 0x4c, 0x69, 0x6e,
+ 0x6b, 0x52, 0x07, 0x6c, 0x73, 0x4c, 0x69, 0x6e, 0x6b, 0x73, 0x12, 0x36, 0x0a, 0x0b, 0x6c, 0x73,
+ 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32,
+ 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x73,
+ 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x52, 0x0a, 0x6c, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78,
+ 0x65, 0x73, 0x22, 0x4d, 0x0a, 0x03, 0x54, 0x45, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x61,
+ 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x65, 0x6e, 0x61, 0x62, 0x6c,
+ 0x65, 0x12, 0x2e, 0x0a, 0x08, 0x6c, 0x73, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20,
+ 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76,
+ 0x31, 0x2e, 0x4c, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x07, 0x6c, 0x73, 0x4e, 0x6f, 0x64, 0x65,
+ 0x73, 0x22, 0x17, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c,
+ 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x4a, 0x0a, 0x16, 0x47, 0x65,
+ 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70,
+ 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x08, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73,
+ 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c,
+ 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x73, 0x65,
+ 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x18, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x53, 0x52, 0x50,
+ 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
+ 0x22, 0x51, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4c,
+ 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x0b, 0x73,
+ 0x72, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
+ 0x32, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x53,
+ 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x0a, 0x73, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63,
+ 0x69, 0x65, 0x73, 0x22, 0x0f, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x54, 0x45, 0x44, 0x52, 0x65, 0x71,
+ 0x75, 0x65, 0x73, 0x74, 0x22, 0x58, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x54, 0x45, 0x44, 0x52, 0x65,
+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x2e,
+ 0x0a, 0x08, 0x6c, 0x73, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b,
+ 0x32, 0x13, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4c,
+ 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x07, 0x6c, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x22, 0x2a,
+ 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52,
+ 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x22, 0x36, 0x0a, 0x15, 0x44, 0x65,
+ 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f,
+ 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73, 0x5f, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73,
+ 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x65,
+ 0x73, 0x73, 0x2a, 0x67, 0x0a, 0x0c, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x54, 0x79,
+ 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x1a, 0x53, 0x52, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f,
+ 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44,
+ 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x53, 0x52, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f,
+ 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x58, 0x50, 0x4c, 0x49, 0x43, 0x49, 0x54, 0x10, 0x01, 0x12,
+ 0x1a, 0x0a, 0x16, 0x53, 0x52, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x54, 0x59, 0x50,
+ 0x45, 0x5f, 0x44, 0x59, 0x4e, 0x41, 0x4d, 0x49, 0x43, 0x10, 0x02, 0x2a, 0x5b, 0x0a, 0x0c, 0x53,
+ 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x53,
+ 0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x55, 0x4e, 0x53,
+ 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x45,
+ 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x44, 0x4f, 0x57, 0x4e,
+ 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54,
+ 0x41, 0x54, 0x45, 0x5f, 0x55, 0x50, 0x10, 0x02, 0x2a, 0x83, 0x01, 0x0a, 0x0a, 0x4d, 0x65, 0x74,
+ 0x72, 0x69, 0x63, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x17, 0x4d, 0x45, 0x54, 0x52, 0x49,
+ 0x43, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49,
+ 0x45, 0x44, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54,
+ 0x59, 0x50, 0x45, 0x5f, 0x49, 0x47, 0x50, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x4d, 0x45, 0x54,
+ 0x52, 0x49, 0x43, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x45, 0x10, 0x02, 0x12, 0x15, 0x0a,
+ 0x11, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x45, 0x4c,
+ 0x41, 0x59, 0x10, 0x03, 0x12, 0x18, 0x0a, 0x14, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54,
+ 0x59, 0x50, 0x45, 0x5f, 0x48, 0x4f, 0x50, 0x43, 0x4f, 0x55, 0x4e, 0x54, 0x10, 0x04, 0x32, 0x96,
+ 0x04, 0x0a, 0x0a, 0x50, 0x43, 0x45, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x59, 0x0a,
+ 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12,
+ 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72,
+ 0x65, 0x61, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75,
+ 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76,
+ 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79,
+ 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65,
+ 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x22, 0x2e, 0x61, 0x70, 0x69,
+ 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53,
+ 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23,
+ 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c,
+ 0x65, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f,
+ 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f,
+ 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61,
+ 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x69,
+ 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x61, 0x70, 0x69, 0x2e,
+ 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69,
+ 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c,
+ 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4c, 0x69, 0x73,
+ 0x74, 0x12, 0x23, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e,
+ 0x47, 0x65, 0x74, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52,
+ 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c,
+ 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79,
+ 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x06,
+ 0x47, 0x65, 0x74, 0x54, 0x45, 0x44, 0x12, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c,
+ 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x45, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65,
+ 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31,
+ 0x2e, 0x47, 0x65, 0x74, 0x54, 0x45, 0x44, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
+ 0x56, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e,
+ 0x12, 0x21, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x44,
+ 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75,
+ 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76,
+ 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52,
+ 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x24, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75,
+ 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x74, 0x74, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6f, 0x6c,
+ 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6c, 0x61, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70,
+ 0x72, 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_pola_proto_rawDescOnce sync.Once
+ file_pola_proto_rawDescData = file_pola_proto_rawDesc
+)
+
+func file_pola_proto_rawDescGZIP() []byte {
+ file_pola_proto_rawDescOnce.Do(func() {
+ file_pola_proto_rawDescData = protoimpl.X.CompressGZIP(file_pola_proto_rawDescData)
+ })
+ return file_pola_proto_rawDescData
+}
+
+var file_pola_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
+var file_pola_proto_msgTypes = make([]protoimpl.MessageInfo, 22)
+var file_pola_proto_goTypes = []interface{}{
+ (SRPolicyType)(0), // 0: api.pola.v1.SRPolicyType
+ (SessionState)(0), // 1: api.pola.v1.SessionState
+ (MetricType)(0), // 2: api.pola.v1.MetricType
+ (*Segment)(nil), // 3: api.pola.v1.Segment
+ (*SRPolicy)(nil), // 4: api.pola.v1.SRPolicy
+ (*CreateSRPolicyRequest)(nil), // 5: api.pola.v1.CreateSRPolicyRequest
+ (*CreateSRPolicyResponse)(nil), // 6: api.pola.v1.CreateSRPolicyResponse
+ (*DeleteSRPolicyRequest)(nil), // 7: api.pola.v1.DeleteSRPolicyRequest
+ (*DeleteSRPolicyResponse)(nil), // 8: api.pola.v1.DeleteSRPolicyResponse
+ (*Session)(nil), // 9: api.pola.v1.Session
+ (*SessionList)(nil), // 10: api.pola.v1.SessionList
+ (*SRPolicyList)(nil), // 11: api.pola.v1.SRPolicyList
+ (*LsPrefix)(nil), // 12: api.pola.v1.LsPrefix
+ (*Metric)(nil), // 13: api.pola.v1.Metric
+ (*LsLink)(nil), // 14: api.pola.v1.LsLink
+ (*LsNode)(nil), // 15: api.pola.v1.LsNode
+ (*TED)(nil), // 16: api.pola.v1.TED
+ (*GetSessionListRequest)(nil), // 17: api.pola.v1.GetSessionListRequest
+ (*GetSessionListResponse)(nil), // 18: api.pola.v1.GetSessionListResponse
+ (*GetSRPolicyListRequest)(nil), // 19: api.pola.v1.GetSRPolicyListRequest
+ (*GetSRPolicyListResponse)(nil), // 20: api.pola.v1.GetSRPolicyListResponse
+ (*GetTEDRequest)(nil), // 21: api.pola.v1.GetTEDRequest
+ (*GetTEDResponse)(nil), // 22: api.pola.v1.GetTEDResponse
+ (*DeleteSessionRequest)(nil), // 23: api.pola.v1.DeleteSessionRequest
+ (*DeleteSessionResponse)(nil), // 24: api.pola.v1.DeleteSessionResponse
+}
+var file_pola_proto_depIdxs = []int32{
+ 0, // 0: api.pola.v1.SRPolicy.type:type_name -> api.pola.v1.SRPolicyType
+ 3, // 1: api.pola.v1.SRPolicy.segment_list:type_name -> api.pola.v1.Segment
+ 2, // 2: api.pola.v1.SRPolicy.metric:type_name -> api.pola.v1.MetricType
+ 4, // 3: api.pola.v1.CreateSRPolicyRequest.sr_policy:type_name -> api.pola.v1.SRPolicy
+ 4, // 4: api.pola.v1.DeleteSRPolicyRequest.sr_policy:type_name -> api.pola.v1.SRPolicy
+ 1, // 5: api.pola.v1.Session.state:type_name -> api.pola.v1.SessionState
+ 9, // 6: api.pola.v1.SessionList.sessions:type_name -> api.pola.v1.Session
+ 4, // 7: api.pola.v1.SRPolicyList.sr_policies:type_name -> api.pola.v1.SRPolicy
+ 2, // 8: api.pola.v1.Metric.type:type_name -> api.pola.v1.MetricType
+ 13, // 9: api.pola.v1.LsLink.metrics:type_name -> api.pola.v1.Metric
+ 14, // 10: api.pola.v1.LsNode.ls_links:type_name -> api.pola.v1.LsLink
+ 12, // 11: api.pola.v1.LsNode.ls_prefixes:type_name -> api.pola.v1.LsPrefix
+ 15, // 12: api.pola.v1.TED.ls_nodes:type_name -> api.pola.v1.LsNode
+ 9, // 13: api.pola.v1.GetSessionListResponse.sessions:type_name -> api.pola.v1.Session
+ 4, // 14: api.pola.v1.GetSRPolicyListResponse.sr_policies:type_name -> api.pola.v1.SRPolicy
+ 15, // 15: api.pola.v1.GetTEDResponse.ls_nodes:type_name -> api.pola.v1.LsNode
+ 5, // 16: api.pola.v1.PCEService.CreateSRPolicy:input_type -> api.pola.v1.CreateSRPolicyRequest
+ 7, // 17: api.pola.v1.PCEService.DeleteSRPolicy:input_type -> api.pola.v1.DeleteSRPolicyRequest
+ 17, // 18: api.pola.v1.PCEService.GetSessionList:input_type -> api.pola.v1.GetSessionListRequest
+ 19, // 19: api.pola.v1.PCEService.GetSRPolicyList:input_type -> api.pola.v1.GetSRPolicyListRequest
+ 21, // 20: api.pola.v1.PCEService.GetTED:input_type -> api.pola.v1.GetTEDRequest
+ 23, // 21: api.pola.v1.PCEService.DeleteSession:input_type -> api.pola.v1.DeleteSessionRequest
+ 6, // 22: api.pola.v1.PCEService.CreateSRPolicy:output_type -> api.pola.v1.CreateSRPolicyResponse
+ 8, // 23: api.pola.v1.PCEService.DeleteSRPolicy:output_type -> api.pola.v1.DeleteSRPolicyResponse
+ 18, // 24: api.pola.v1.PCEService.GetSessionList:output_type -> api.pola.v1.GetSessionListResponse
+ 20, // 25: api.pola.v1.PCEService.GetSRPolicyList:output_type -> api.pola.v1.GetSRPolicyListResponse
+ 22, // 26: api.pola.v1.PCEService.GetTED:output_type -> api.pola.v1.GetTEDResponse
+ 24, // 27: api.pola.v1.PCEService.DeleteSession:output_type -> api.pola.v1.DeleteSessionResponse
+ 22, // [22:28] is the sub-list for method output_type
+ 16, // [16:22] is the sub-list for method input_type
+ 16, // [16:16] is the sub-list for extension type_name
+ 16, // [16:16] is the sub-list for extension extendee
+ 0, // [0:16] is the sub-list for field type_name
+}
+
+func init() { file_pola_proto_init() }
+func file_pola_proto_init() {
+ if File_pola_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_pola_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Segment); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SRPolicy); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CreateSRPolicyRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CreateSRPolicyResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*DeleteSRPolicyRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*DeleteSRPolicyResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Session); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SessionList); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*SRPolicyList); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*LsPrefix); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Metric); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*LsLink); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*LsNode); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*TED); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetSessionListRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetSessionListResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetSRPolicyListRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetSRPolicyListResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetTEDRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetTEDResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*DeleteSessionRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*DeleteSessionResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_pola_proto_rawDesc,
+ NumEnums: 3,
+ NumMessages: 22,
+ NumExtensions: 0,
+ NumServices: 1,
+ },
+ GoTypes: file_pola_proto_goTypes,
+ DependencyIndexes: file_pola_proto_depIdxs,
+ EnumInfos: file_pola_proto_enumTypes,
+ MessageInfos: file_pola_proto_msgTypes,
+ }.Build()
+ File_pola_proto = out.File
+ file_pola_proto_rawDesc = nil
+ file_pola_proto_goTypes = nil
+ file_pola_proto_depIdxs = nil
+}
diff --git a/api/pola/v1/pola.proto b/api/pola/v1/pola.proto
new file mode 100644
index 00000000..b3769f64
--- /dev/null
+++ b/api/pola/v1/pola.proto
@@ -0,0 +1,161 @@
+// Copyright (c) 2022 NTT Communications Corporation
+//
+// This software is released under the MIT License.
+// see https://github.com/nttcom/pola/blob/main/LICENSE
+
+syntax = "proto3";
+
+package api.pola.v1;
+
+option go_package = "github.com/nttcom/pola/api/pola/v1";
+
+service PCEService {
+ rpc CreateSRPolicy (CreateSRPolicyRequest) returns (CreateSRPolicyResponse);
+ rpc DeleteSRPolicy (DeleteSRPolicyRequest) returns (DeleteSRPolicyResponse);
+ rpc GetSessionList (GetSessionListRequest) returns (GetSessionListResponse);
+ rpc GetSRPolicyList (GetSRPolicyListRequest) returns (GetSRPolicyListResponse);
+ rpc GetTED (GetTEDRequest) returns (GetTEDResponse);
+ rpc DeleteSession (DeleteSessionRequest) returns (DeleteSessionResponse);
+}
+
+message Segment {
+ string sid = 1;
+ string sid_structure = 2;
+ string local_addr = 3;
+ string remote_addr = 4;
+}
+
+enum SRPolicyType {
+ SR_POLICY_TYPE_UNSPECIFIED = 0;
+ SR_POLICY_TYPE_EXPLICIT = 1;
+ SR_POLICY_TYPE_DYNAMIC = 2;
+}
+
+message SRPolicy {
+ bytes pcep_session_addr = 1;
+ bytes src_addr = 2;
+ bytes dst_addr = 3;
+ string src_router_id = 4;
+ string dst_router_id = 5;
+ uint32 color = 6;
+ uint32 preference = 7;
+ string policy_name = 8;
+ SRPolicyType type = 9;
+ repeated Segment segment_list = 10;
+ MetricType metric = 11;
+}
+
+message CreateSRPolicyRequest {
+ SRPolicy sr_policy = 1;
+ uint32 asn = 2;
+ bool sid_validate = 3;
+}
+
+message CreateSRPolicyResponse {
+ bool is_success = 1;
+}
+
+message DeleteSRPolicyRequest {
+ SRPolicy sr_policy = 1;
+ uint32 asn = 2;
+}
+
+message DeleteSRPolicyResponse {
+ bool is_success = 1;
+}
+
+enum SessionState {
+ SESSION_STATE_UNSPECIFIED = 0;
+ SESSION_STATE_DOWN = 1;
+ SESSION_STATE_UP = 2;
+}
+
+message Session {
+ bytes addr = 1;
+ SessionState state = 2;
+ repeated string caps = 3;
+ bool is_synced = 4;
+}
+
+message SessionList {
+ repeated Session sessions = 1;
+}
+
+message SRPolicyList {
+ repeated SRPolicy sr_policies = 1;
+}
+
+message LsPrefix {
+ string prefix = 1;
+ uint32 sid_index = 2;
+}
+
+enum MetricType {
+ METRIC_TYPE_UNSPECIFIED = 0;
+ METRIC_TYPE_IGP = 1;
+ METRIC_TYPE_TE = 2;
+ METRIC_TYPE_DELAY = 3;
+ METRIC_TYPE_HOPCOUNT = 4;
+}
+
+message Metric {
+ MetricType type = 1;
+ uint32 value = 2;
+}
+
+message LsLink {
+ string local_router_id = 1;
+ uint32 local_asn = 2;
+ string local_ip = 3;
+ string remote_router_id = 4;
+ uint32 remote_asn = 5;
+ string remote_ip = 6;
+ repeated Metric metrics = 7;
+ uint32 adj_sid = 8;
+}
+
+message LsNode {
+ uint32 asn = 1;
+ string router_id = 2;
+ string isis_area_id = 3;
+ string hostname = 4;
+ uint32 srgb_begin = 5;
+ uint32 srgb_end = 6;
+ repeated LsLink ls_links = 7;
+ repeated LsPrefix ls_prefixes = 8;
+}
+
+message TED {
+ bool enable = 1;
+ repeated LsNode ls_nodes = 2;
+}
+
+message GetSessionListRequest {
+}
+
+message GetSessionListResponse {
+ repeated Session sessions = 1;
+}
+
+message GetSRPolicyListRequest {
+}
+
+message GetSRPolicyListResponse {
+ repeated SRPolicy sr_policies = 1;
+}
+
+message GetTEDRequest {
+}
+
+message GetTEDResponse {
+ bool enable = 1;
+ repeated LsNode ls_nodes = 2;
+}
+
+message DeleteSessionRequest {
+ bytes addr = 1;
+}
+
+message DeleteSessionResponse {
+ bool is_success = 1;
+}
diff --git a/api/grpc/pola.zap.go b/api/pola/v1/pola.zap.go
similarity index 80%
rename from api/grpc/pola.zap.go
rename to api/pola/v1/pola.zap.go
index 135393a6..e13fdbdd 100644
--- a/api/grpc/pola.zap.go
+++ b/api/pola/v1/pola.zap.go
@@ -3,7 +3,7 @@
// This software is released under the MIT License.
// see https://github.com/nttcom/pola/blob/main/LICENSE
-package grpc
+package v1
import (
"net/netip"
@@ -14,16 +14,16 @@ import (
// Implements zapcore.ObjectMarshaler interface for SRPolicy
func (x *SRPolicy) MarshalLogObject(enc zapcore.ObjectEncoder) error {
// Convert IP address slices to netip.Addr
- ssAddr, _ := netip.AddrFromSlice(x.GetPCEPSessionAddr())
+ ssAddr, _ := netip.AddrFromSlice(x.GetPcepSessionAddr())
enc.AddString("PCEPSessionAddr", ssAddr.String())
srcAddr, _ := netip.AddrFromSlice(x.GetSrcAddr())
enc.AddString("SrcAddr", srcAddr.String())
dstAddr, _ := netip.AddrFromSlice(x.GetDstAddr())
enc.AddString("DstAddr", dstAddr.String())
- if srcRouterID := x.GetSrcRouterID(); srcRouterID != "" {
+ if srcRouterID := x.GetSrcRouterId(); srcRouterID != "" {
enc.AddString("SrcRouterID", srcRouterID)
}
- if dstRouterID := x.DstRouterID; dstRouterID != "" {
+ if dstRouterID := x.DstRouterId; dstRouterID != "" {
enc.AddString("DstRouterID", dstRouterID)
}
enc.AddUint32("Color", x.GetColor())
@@ -31,11 +31,11 @@ func (x *SRPolicy) MarshalLogObject(enc zapcore.ObjectEncoder) error {
enc.AddString("PolicyName", x.GetPolicyName())
enc.AddString("Type", x.GetType().String())
- if x.GetType() == SRPolicyType_EXPLICIT {
+ if x.GetType() == SRPolicyType_SR_POLICY_TYPE_EXPLICIT {
if err := enc.AddReflected("SegmentList", x.GetSegmentList()); err != nil {
return err
}
- } else if x.GetType() == SRPolicyType_DYNAMIC {
+ } else if x.GetType() == SRPolicyType_SR_POLICY_TYPE_DYNAMIC {
enc.AddString("Metric", x.Metric.String())
}
return nil
diff --git a/api/grpc/pola_grpc.pb.go b/api/pola/v1/pola_grpc.pb.go
similarity index 52%
rename from api/grpc/pola_grpc.pb.go
rename to api/pola/v1/pola_grpc.pb.go
index 366e2ffa..3c6b0a90 100644
--- a/api/grpc/pola_grpc.pb.go
+++ b/api/pola/v1/pola_grpc.pb.go
@@ -1,13 +1,12 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
-package grpc
+package v1
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
- emptypb "google.golang.org/protobuf/types/known/emptypb"
)
// This is a compile-time assertion to ensure that this generated file
@@ -19,14 +18,12 @@ const _ = grpc.SupportPackageIsVersion7
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type PCEServiceClient interface {
- CreateSRPolicy(ctx context.Context, in *CreateSRPolicyInput, opts ...grpc.CallOption) (*RequestStatus, error)
- CreateSRPolicyWithoutLinkState(ctx context.Context, in *CreateSRPolicyInput, opts ...grpc.CallOption) (*RequestStatus, error)
- DeleteSRPolicy(ctx context.Context, in *DeleteSRPolicyInput, opts ...grpc.CallOption) (*RequestStatus, error)
- DeleteSRPolicyWithoutLinkState(ctx context.Context, in *DeleteSRPolicyInput, opts ...grpc.CallOption) (*RequestStatus, error)
- GetSessionList(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*SessionList, error)
- GetSRPolicyList(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*SRPolicyList, error)
- GetTED(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*TED, error)
- DeleteSession(ctx context.Context, in *Session, opts ...grpc.CallOption) (*RequestStatus, error)
+ CreateSRPolicy(ctx context.Context, in *CreateSRPolicyRequest, opts ...grpc.CallOption) (*CreateSRPolicyResponse, error)
+ DeleteSRPolicy(ctx context.Context, in *DeleteSRPolicyRequest, opts ...grpc.CallOption) (*DeleteSRPolicyResponse, error)
+ GetSessionList(ctx context.Context, in *GetSessionListRequest, opts ...grpc.CallOption) (*GetSessionListResponse, error)
+ GetSRPolicyList(ctx context.Context, in *GetSRPolicyListRequest, opts ...grpc.CallOption) (*GetSRPolicyListResponse, error)
+ GetTED(ctx context.Context, in *GetTEDRequest, opts ...grpc.CallOption) (*GetTEDResponse, error)
+ DeleteSession(ctx context.Context, in *DeleteSessionRequest, opts ...grpc.CallOption) (*DeleteSessionResponse, error)
}
type pCEServiceClient struct {
@@ -37,72 +34,54 @@ func NewPCEServiceClient(cc grpc.ClientConnInterface) PCEServiceClient {
return &pCEServiceClient{cc}
}
-func (c *pCEServiceClient) CreateSRPolicy(ctx context.Context, in *CreateSRPolicyInput, opts ...grpc.CallOption) (*RequestStatus, error) {
- out := new(RequestStatus)
- err := c.cc.Invoke(ctx, "/pb.PCEService/CreateSRPolicy", in, out, opts...)
+func (c *pCEServiceClient) CreateSRPolicy(ctx context.Context, in *CreateSRPolicyRequest, opts ...grpc.CallOption) (*CreateSRPolicyResponse, error) {
+ out := new(CreateSRPolicyResponse)
+ err := c.cc.Invoke(ctx, "/api.pola.v1.PCEService/CreateSRPolicy", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
-func (c *pCEServiceClient) CreateSRPolicyWithoutLinkState(ctx context.Context, in *CreateSRPolicyInput, opts ...grpc.CallOption) (*RequestStatus, error) {
- out := new(RequestStatus)
- err := c.cc.Invoke(ctx, "/pb.PCEService/CreateSRPolicyWithoutLinkState", in, out, opts...)
+func (c *pCEServiceClient) DeleteSRPolicy(ctx context.Context, in *DeleteSRPolicyRequest, opts ...grpc.CallOption) (*DeleteSRPolicyResponse, error) {
+ out := new(DeleteSRPolicyResponse)
+ err := c.cc.Invoke(ctx, "/api.pola.v1.PCEService/DeleteSRPolicy", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
-func (c *pCEServiceClient) DeleteSRPolicy(ctx context.Context, in *DeleteSRPolicyInput, opts ...grpc.CallOption) (*RequestStatus, error) {
- out := new(RequestStatus)
- err := c.cc.Invoke(ctx, "/pb.PCEService/DeleteSRPolicy", in, out, opts...)
+func (c *pCEServiceClient) GetSessionList(ctx context.Context, in *GetSessionListRequest, opts ...grpc.CallOption) (*GetSessionListResponse, error) {
+ out := new(GetSessionListResponse)
+ err := c.cc.Invoke(ctx, "/api.pola.v1.PCEService/GetSessionList", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
-func (c *pCEServiceClient) DeleteSRPolicyWithoutLinkState(ctx context.Context, in *DeleteSRPolicyInput, opts ...grpc.CallOption) (*RequestStatus, error) {
- out := new(RequestStatus)
- err := c.cc.Invoke(ctx, "/pb.PCEService/DeleteSRPolicyWithoutLinkState", in, out, opts...)
+func (c *pCEServiceClient) GetSRPolicyList(ctx context.Context, in *GetSRPolicyListRequest, opts ...grpc.CallOption) (*GetSRPolicyListResponse, error) {
+ out := new(GetSRPolicyListResponse)
+ err := c.cc.Invoke(ctx, "/api.pola.v1.PCEService/GetSRPolicyList", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
-func (c *pCEServiceClient) GetSessionList(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*SessionList, error) {
- out := new(SessionList)
- err := c.cc.Invoke(ctx, "/pb.PCEService/GetSessionList", in, out, opts...)
+func (c *pCEServiceClient) GetTED(ctx context.Context, in *GetTEDRequest, opts ...grpc.CallOption) (*GetTEDResponse, error) {
+ out := new(GetTEDResponse)
+ err := c.cc.Invoke(ctx, "/api.pola.v1.PCEService/GetTED", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
-func (c *pCEServiceClient) GetSRPolicyList(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*SRPolicyList, error) {
- out := new(SRPolicyList)
- err := c.cc.Invoke(ctx, "/pb.PCEService/GetSRPolicyList", in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *pCEServiceClient) GetTED(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*TED, error) {
- out := new(TED)
- err := c.cc.Invoke(ctx, "/pb.PCEService/GetTED", in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *pCEServiceClient) DeleteSession(ctx context.Context, in *Session, opts ...grpc.CallOption) (*RequestStatus, error) {
- out := new(RequestStatus)
- err := c.cc.Invoke(ctx, "/pb.PCEService/DeleteSession", in, out, opts...)
+func (c *pCEServiceClient) DeleteSession(ctx context.Context, in *DeleteSessionRequest, opts ...grpc.CallOption) (*DeleteSessionResponse, error) {
+ out := new(DeleteSessionResponse)
+ err := c.cc.Invoke(ctx, "/api.pola.v1.PCEService/DeleteSession", in, out, opts...)
if err != nil {
return nil, err
}
@@ -113,14 +92,12 @@ func (c *pCEServiceClient) DeleteSession(ctx context.Context, in *Session, opts
// All implementations must embed UnimplementedPCEServiceServer
// for forward compatibility
type PCEServiceServer interface {
- CreateSRPolicy(context.Context, *CreateSRPolicyInput) (*RequestStatus, error)
- CreateSRPolicyWithoutLinkState(context.Context, *CreateSRPolicyInput) (*RequestStatus, error)
- DeleteSRPolicy(context.Context, *DeleteSRPolicyInput) (*RequestStatus, error)
- DeleteSRPolicyWithoutLinkState(context.Context, *DeleteSRPolicyInput) (*RequestStatus, error)
- GetSessionList(context.Context, *emptypb.Empty) (*SessionList, error)
- GetSRPolicyList(context.Context, *emptypb.Empty) (*SRPolicyList, error)
- GetTED(context.Context, *emptypb.Empty) (*TED, error)
- DeleteSession(context.Context, *Session) (*RequestStatus, error)
+ CreateSRPolicy(context.Context, *CreateSRPolicyRequest) (*CreateSRPolicyResponse, error)
+ DeleteSRPolicy(context.Context, *DeleteSRPolicyRequest) (*DeleteSRPolicyResponse, error)
+ GetSessionList(context.Context, *GetSessionListRequest) (*GetSessionListResponse, error)
+ GetSRPolicyList(context.Context, *GetSRPolicyListRequest) (*GetSRPolicyListResponse, error)
+ GetTED(context.Context, *GetTEDRequest) (*GetTEDResponse, error)
+ DeleteSession(context.Context, *DeleteSessionRequest) (*DeleteSessionResponse, error)
mustEmbedUnimplementedPCEServiceServer()
}
@@ -128,28 +105,22 @@ type PCEServiceServer interface {
type UnimplementedPCEServiceServer struct {
}
-func (UnimplementedPCEServiceServer) CreateSRPolicy(context.Context, *CreateSRPolicyInput) (*RequestStatus, error) {
+func (UnimplementedPCEServiceServer) CreateSRPolicy(context.Context, *CreateSRPolicyRequest) (*CreateSRPolicyResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateSRPolicy not implemented")
}
-func (UnimplementedPCEServiceServer) CreateSRPolicyWithoutLinkState(context.Context, *CreateSRPolicyInput) (*RequestStatus, error) {
- return nil, status.Errorf(codes.Unimplemented, "method CreateSRPolicyWithoutLinkState not implemented")
-}
-func (UnimplementedPCEServiceServer) DeleteSRPolicy(context.Context, *DeleteSRPolicyInput) (*RequestStatus, error) {
+func (UnimplementedPCEServiceServer) DeleteSRPolicy(context.Context, *DeleteSRPolicyRequest) (*DeleteSRPolicyResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteSRPolicy not implemented")
}
-func (UnimplementedPCEServiceServer) DeleteSRPolicyWithoutLinkState(context.Context, *DeleteSRPolicyInput) (*RequestStatus, error) {
- return nil, status.Errorf(codes.Unimplemented, "method DeleteSRPolicyWithoutLinkState not implemented")
-}
-func (UnimplementedPCEServiceServer) GetSessionList(context.Context, *emptypb.Empty) (*SessionList, error) {
+func (UnimplementedPCEServiceServer) GetSessionList(context.Context, *GetSessionListRequest) (*GetSessionListResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetSessionList not implemented")
}
-func (UnimplementedPCEServiceServer) GetSRPolicyList(context.Context, *emptypb.Empty) (*SRPolicyList, error) {
+func (UnimplementedPCEServiceServer) GetSRPolicyList(context.Context, *GetSRPolicyListRequest) (*GetSRPolicyListResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetSRPolicyList not implemented")
}
-func (UnimplementedPCEServiceServer) GetTED(context.Context, *emptypb.Empty) (*TED, error) {
+func (UnimplementedPCEServiceServer) GetTED(context.Context, *GetTEDRequest) (*GetTEDResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetTED not implemented")
}
-func (UnimplementedPCEServiceServer) DeleteSession(context.Context, *Session) (*RequestStatus, error) {
+func (UnimplementedPCEServiceServer) DeleteSession(context.Context, *DeleteSessionRequest) (*DeleteSessionResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteSession not implemented")
}
func (UnimplementedPCEServiceServer) mustEmbedUnimplementedPCEServiceServer() {}
@@ -166,7 +137,7 @@ func RegisterPCEServiceServer(s grpc.ServiceRegistrar, srv PCEServiceServer) {
}
func _PCEService_CreateSRPolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(CreateSRPolicyInput)
+ in := new(CreateSRPolicyRequest)
if err := dec(in); err != nil {
return nil, err
}
@@ -175,34 +146,16 @@ func _PCEService_CreateSRPolicy_Handler(srv interface{}, ctx context.Context, de
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/pb.PCEService/CreateSRPolicy",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(PCEServiceServer).CreateSRPolicy(ctx, req.(*CreateSRPolicyInput))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _PCEService_CreateSRPolicyWithoutLinkState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(CreateSRPolicyInput)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(PCEServiceServer).CreateSRPolicyWithoutLinkState(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/pb.PCEService/CreateSRPolicyWithoutLinkState",
+ FullMethod: "/api.pola.v1.PCEService/CreateSRPolicy",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(PCEServiceServer).CreateSRPolicyWithoutLinkState(ctx, req.(*CreateSRPolicyInput))
+ return srv.(PCEServiceServer).CreateSRPolicy(ctx, req.(*CreateSRPolicyRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PCEService_DeleteSRPolicy_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(DeleteSRPolicyInput)
+ in := new(DeleteSRPolicyRequest)
if err := dec(in); err != nil {
return nil, err
}
@@ -211,34 +164,16 @@ func _PCEService_DeleteSRPolicy_Handler(srv interface{}, ctx context.Context, de
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/pb.PCEService/DeleteSRPolicy",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(PCEServiceServer).DeleteSRPolicy(ctx, req.(*DeleteSRPolicyInput))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _PCEService_DeleteSRPolicyWithoutLinkState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(DeleteSRPolicyInput)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(PCEServiceServer).DeleteSRPolicyWithoutLinkState(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/pb.PCEService/DeleteSRPolicyWithoutLinkState",
+ FullMethod: "/api.pola.v1.PCEService/DeleteSRPolicy",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(PCEServiceServer).DeleteSRPolicyWithoutLinkState(ctx, req.(*DeleteSRPolicyInput))
+ return srv.(PCEServiceServer).DeleteSRPolicy(ctx, req.(*DeleteSRPolicyRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PCEService_GetSessionList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(emptypb.Empty)
+ in := new(GetSessionListRequest)
if err := dec(in); err != nil {
return nil, err
}
@@ -247,16 +182,16 @@ func _PCEService_GetSessionList_Handler(srv interface{}, ctx context.Context, de
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/pb.PCEService/GetSessionList",
+ FullMethod: "/api.pola.v1.PCEService/GetSessionList",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(PCEServiceServer).GetSessionList(ctx, req.(*emptypb.Empty))
+ return srv.(PCEServiceServer).GetSessionList(ctx, req.(*GetSessionListRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PCEService_GetSRPolicyList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(emptypb.Empty)
+ in := new(GetSRPolicyListRequest)
if err := dec(in); err != nil {
return nil, err
}
@@ -265,16 +200,16 @@ func _PCEService_GetSRPolicyList_Handler(srv interface{}, ctx context.Context, d
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/pb.PCEService/GetSRPolicyList",
+ FullMethod: "/api.pola.v1.PCEService/GetSRPolicyList",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(PCEServiceServer).GetSRPolicyList(ctx, req.(*emptypb.Empty))
+ return srv.(PCEServiceServer).GetSRPolicyList(ctx, req.(*GetSRPolicyListRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PCEService_GetTED_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(emptypb.Empty)
+ in := new(GetTEDRequest)
if err := dec(in); err != nil {
return nil, err
}
@@ -283,16 +218,16 @@ func _PCEService_GetTED_Handler(srv interface{}, ctx context.Context, dec func(i
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/pb.PCEService/GetTED",
+ FullMethod: "/api.pola.v1.PCEService/GetTED",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(PCEServiceServer).GetTED(ctx, req.(*emptypb.Empty))
+ return srv.(PCEServiceServer).GetTED(ctx, req.(*GetTEDRequest))
}
return interceptor(ctx, in, info, handler)
}
func _PCEService_DeleteSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(Session)
+ in := new(DeleteSessionRequest)
if err := dec(in); err != nil {
return nil, err
}
@@ -301,10 +236,10 @@ func _PCEService_DeleteSession_Handler(srv interface{}, ctx context.Context, dec
}
info := &grpc.UnaryServerInfo{
Server: srv,
- FullMethod: "/pb.PCEService/DeleteSession",
+ FullMethod: "/api.pola.v1.PCEService/DeleteSession",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(PCEServiceServer).DeleteSession(ctx, req.(*Session))
+ return srv.(PCEServiceServer).DeleteSession(ctx, req.(*DeleteSessionRequest))
}
return interceptor(ctx, in, info, handler)
}
@@ -313,25 +248,17 @@ func _PCEService_DeleteSession_Handler(srv interface{}, ctx context.Context, dec
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var PCEService_ServiceDesc = grpc.ServiceDesc{
- ServiceName: "pb.PCEService",
+ ServiceName: "api.pola.v1.PCEService",
HandlerType: (*PCEServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "CreateSRPolicy",
Handler: _PCEService_CreateSRPolicy_Handler,
},
- {
- MethodName: "CreateSRPolicyWithoutLinkState",
- Handler: _PCEService_CreateSRPolicyWithoutLinkState_Handler,
- },
{
MethodName: "DeleteSRPolicy",
Handler: _PCEService_DeleteSRPolicy_Handler,
},
- {
- MethodName: "DeleteSRPolicyWithoutLinkState",
- Handler: _PCEService_DeleteSRPolicyWithoutLinkState_Handler,
- },
{
MethodName: "GetSessionList",
Handler: _PCEService_GetSessionList_Handler,
diff --git a/cmd/pola/README.md b/cmd/pola/README.md
index 5db54f4b..2206bddd 100644
--- a/cmd/pola/README.md
+++ b/cmd/pola/README.md
@@ -209,7 +209,7 @@ JSON formatted response
}
```
-### pola sr-policy add -f _filepath_ --no-link-state
+### pola sr-policy add -f `filepath` --no-sid-validate
Create a new SR Policy **without using TED**
diff --git a/cmd/pola/grpc/grpc_client.go b/cmd/pola/grpc/grpc_client.go
index 010f3852..86abe104 100644
--- a/cmd/pola/grpc/grpc_client.go
+++ b/cmd/pola/grpc/grpc_client.go
@@ -11,8 +11,7 @@ import (
"net/netip"
"time"
- "github.com/golang/protobuf/ptypes/empty"
- pb "github.com/nttcom/pola/api/grpc"
+ pb "github.com/nttcom/pola/api/pola/v1"
"github.com/nttcom/pola/internal/pkg/table"
)
@@ -31,7 +30,7 @@ func GetSessions(client pb.PCEServiceClient) ([]Session, error) {
ctx, cancel := withTimeout()
defer cancel()
- ret, err := client.GetSessionList(ctx, &empty.Empty{})
+ ret, err := client.GetSessionList(ctx, &pb.GetSessionListRequest{})
if err != nil {
return nil, err
}
@@ -52,10 +51,11 @@ func GetSessions(client pb.PCEServiceClient) ([]Session, error) {
return sessions, nil
}
-func DeleteSession(client pb.PCEServiceClient, session *pb.Session) error {
+func DeleteSession(client pb.PCEServiceClient, req *pb.DeleteSessionRequest) error {
ctx, cancel := withTimeout()
defer cancel()
- _, err := client.DeleteSession(ctx, session)
+
+ _, err := client.DeleteSession(ctx, req)
if err != nil {
return err
}
@@ -66,15 +66,15 @@ func GetSRPolicyList(client pb.PCEServiceClient) (map[netip.Addr][]table.SRPolic
ctx, cancel := withTimeout()
defer cancel()
- ret, err := client.GetSRPolicyList(ctx, &empty.Empty{})
+ ret, err := client.GetSRPolicyList(ctx, &pb.GetSRPolicyListRequest{})
if err != nil {
return nil, err
}
- policies := make(map[netip.Addr][]table.SRPolicy, len(ret.GetSRPolicies()))
+ policies := make(map[netip.Addr][]table.SRPolicy, len(ret.GetSrPolicies()))
- for _, p := range ret.GetSRPolicies() {
- peerAddr, _ := netip.AddrFromSlice(p.PCEPSessionAddr)
+ for _, p := range ret.GetSrPolicies() {
+ peerAddr, _ := netip.AddrFromSlice(p.PcepSessionAddr)
srcAddr, _ := netip.AddrFromSlice(p.SrcAddr)
dstAddr, _ := netip.AddrFromSlice(p.DstAddr)
var segmentList []table.Segment
@@ -99,27 +99,19 @@ func GetSRPolicyList(client pb.PCEServiceClient) (map[netip.Addr][]table.SRPolic
return policies, nil
}
-func CreateSRPolicy(client pb.PCEServiceClient, input *pb.CreateSRPolicyInput) error {
- ctx, cancel := withTimeout()
- defer cancel()
-
- _, err := client.CreateSRPolicy(ctx, input)
- return err
-}
-
-func CreateSRPolicyWithoutLinkState(client pb.PCEServiceClient, input *pb.CreateSRPolicyInput) error {
+func CreateSRPolicy(client pb.PCEServiceClient, req *pb.CreateSRPolicyRequest) error {
ctx, cancel := withTimeout()
defer cancel()
- _, err := client.CreateSRPolicyWithoutLinkState(ctx, input)
+ _, err := client.CreateSRPolicy(ctx, req)
return err
}
-func DeleteSRPolicy(client pb.PCEServiceClient, input *pb.DeleteSRPolicyInput) error {
+func DeleteSRPolicy(client pb.PCEServiceClient, req *pb.DeleteSRPolicyRequest) error {
ctx, cancel := withTimeout()
defer cancel()
- _, err := client.DeleteSRPolicy(ctx, input)
+ _, err := client.DeleteSRPolicy(ctx, req)
return err
}
@@ -127,7 +119,7 @@ func GetTED(client pb.PCEServiceClient) (*table.LsTED, error) {
ctx, cancel := withTimeout()
defer cancel()
- ret, err := client.GetTED(ctx, &empty.Empty{})
+ ret, err := client.GetTED(ctx, &pb.GetTEDRequest{})
if err != nil {
return nil, err
}
@@ -155,9 +147,9 @@ func GetTED(client pb.PCEServiceClient) (*table.LsTED, error) {
// initializeLsNodes initializes LsNodes in the LsTED table using the given array of nodes
func initializeLsNodes(ted *table.LsTED, nodes []*pb.LsNode) {
for _, node := range nodes {
- lsNode := table.NewLsNode(node.GetAsn(), node.GetRouterID())
+ lsNode := table.NewLsNode(node.GetAsn(), node.GetRouterId())
lsNode.Hostname = node.GetHostname()
- lsNode.IsisAreaID = node.GetIsisAreaID()
+ lsNode.IsisAreaID = node.GetIsisAreaId()
lsNode.SrgbBegin = node.GetSrgbBegin()
lsNode.SrgbEnd = node.GetSrgbEnd()
@@ -170,21 +162,21 @@ func initializeLsNodes(ted *table.LsTED, nodes []*pb.LsNode) {
func addLsNode(ted *table.LsTED, node *pb.LsNode) error {
for _, link := range node.GetLsLinks() {
- localNode := ted.Nodes[link.LocalASN][link.LocalRouterID]
- remoteNode := ted.Nodes[link.RemoteASN][link.RemoteRouterID]
+ localNode := ted.Nodes[link.LocalAsn][link.LocalRouterId]
+ remoteNode := ted.Nodes[link.RemoteAsn][link.RemoteRouterId]
lsLink, err := createLsLink(localNode, remoteNode, link)
if err != nil {
return err
}
- ted.Nodes[node.GetAsn()][node.GetRouterID()].Links = append(ted.Nodes[node.GetAsn()][node.GetRouterID()].Links, lsLink)
+ ted.Nodes[node.GetAsn()][node.GetRouterId()].Links = append(ted.Nodes[node.GetAsn()][node.GetRouterId()].Links, lsLink)
}
for _, prefix := range node.LsPrefixes {
- lsPrefix, err := createLsPrefix(ted.Nodes[node.GetAsn()][node.GetRouterID()], prefix)
+ lsPrefix, err := createLsPrefix(ted.Nodes[node.GetAsn()][node.GetRouterId()], prefix)
if err != nil {
return err
}
- ted.Nodes[node.GetAsn()][node.GetRouterID()].Prefixes = append(ted.Nodes[node.GetAsn()][node.GetRouterID()].Prefixes, lsPrefix)
+ ted.Nodes[node.GetAsn()][node.GetRouterId()].Prefixes = append(ted.Nodes[node.GetAsn()][node.GetRouterId()].Prefixes, lsPrefix)
}
return nil
@@ -206,14 +198,14 @@ func createLsLink(localNode, remoteNode *table.LsNode, link *pb.LsLink) (*table.
lsLink := &table.LsLink{
LocalNode: localNode,
RemoteNode: remoteNode,
- AdjSid: link.GetAdjSID(),
+ AdjSid: link.GetAdjSid(),
}
var err error
- lsLink.LocalIP, err = netip.ParseAddr(link.GetLocalIP())
+ lsLink.LocalIP, err = netip.ParseAddr(link.GetLocalIp())
if err != nil {
return nil, err
}
- lsLink.RemoteIP, err = netip.ParseAddr(link.GetRemoteIP())
+ lsLink.RemoteIP, err = netip.ParseAddr(link.GetRemoteIp())
if err != nil {
return nil, err
}
diff --git a/cmd/pola/root.go b/cmd/pola/root.go
index b4203bd6..12fb57cb 100644
--- a/cmd/pola/root.go
+++ b/cmd/pola/root.go
@@ -9,7 +9,7 @@ import (
"fmt"
"net"
- pb "github.com/nttcom/pola/api/grpc"
+ pb "github.com/nttcom/pola/api/pola/v1"
"github.com/spf13/cobra"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
diff --git a/cmd/pola/session_del.go b/cmd/pola/session_del.go
index 357a03ab..21b32c14 100644
--- a/cmd/pola/session_del.go
+++ b/cmd/pola/session_del.go
@@ -9,7 +9,7 @@ import (
"fmt"
"net/netip"
- pb "github.com/nttcom/pola/api/grpc"
+ pb "github.com/nttcom/pola/api/pola/v1"
"github.com/nttcom/pola/cmd/pola/grpc"
"github.com/spf13/cobra"
)
@@ -35,10 +35,10 @@ func newSessionDelCmd() *cobra.Command {
}
func delSession(session netip.Addr, jsonFlag bool) error {
- ss := &pb.Session{
+ request := &pb.DeleteSessionRequest{
Addr: session.AsSlice(),
}
- err := grpc.DeleteSession(client, ss)
+ err := grpc.DeleteSession(client, request)
if err != nil {
return err
}
diff --git a/cmd/pola/sr_policy_add.go b/cmd/pola/sr_policy_add.go
index 40f93c6a..e90cfe03 100644
--- a/cmd/pola/sr_policy_add.go
+++ b/cmd/pola/sr_policy_add.go
@@ -14,7 +14,7 @@ import (
"github.com/spf13/cobra"
yaml "gopkg.in/yaml.v2"
- pb "github.com/nttcom/pola/api/grpc"
+ pb "github.com/nttcom/pola/api/pola/v1"
"github.com/nttcom/pola/cmd/pola/grpc"
)
@@ -22,9 +22,9 @@ func newSRPolicyAddCmd() *cobra.Command {
srPolicyAddCmd := &cobra.Command{
Use: "add",
RunE: func(cmd *cobra.Command, args []string) error {
- noLinkStateFlag, err := cmd.Flags().GetBool("no-link-state")
+ noSIDValidateFlag, err := cmd.Flags().GetBool("no-sid-validate")
if err != nil {
- return fmt.Errorf("failed to retrieve 'no-link-state' flag: %v", err)
+ return fmt.Errorf("failed to retrieve 'no-sid-validate' flag: %v", err)
}
filepath, err := cmd.Flags().GetString("file")
@@ -50,14 +50,14 @@ func newSRPolicyAddCmd() *cobra.Command {
return fmt.Errorf("YAML syntax error in file \"%s\": %v", filepath, err)
}
- if err := addSRPolicy(inputData, jsonFmt, noLinkStateFlag); err != nil {
+ if err := addSRPolicy(inputData, jsonFmt, noSIDValidateFlag); err != nil {
return fmt.Errorf("failed to add SR policy: %v", err)
}
return nil
},
}
- srPolicyAddCmd.Flags().BoolP("no-link-state", "l", false, "add SR Policy without Link State")
+ srPolicyAddCmd.Flags().BoolP("no-sid-validate", "s", false, "disable SR policy SID validation")
srPolicyAddCmd.Flags().StringP("file", "f", "", "[mandatory] path to YAML formatted LSP information file")
return srPolicyAddCmd
@@ -90,13 +90,13 @@ type InputFormat struct {
ASN uint32 `yaml:"asn"`
}
-func addSRPolicy(input InputFormat, jsonFlag bool, noLinkStateFlag bool) error {
- if noLinkStateFlag {
- if err := addSRPolicyNoLinkState(input); err != nil {
+func addSRPolicy(input InputFormat, jsonFlag bool, explicitPathFlag bool) error {
+ if explicitPathFlag {
+ if err := addSRPolicyWithoutSIDValidation(input); err != nil {
return err
}
} else {
- if err := addSRPolicyLinkState(input); err != nil {
+ if err := addSRPolicyWithSIDValidation(input); err != nil {
return err
}
}
@@ -109,7 +109,7 @@ func addSRPolicy(input InputFormat, jsonFlag bool, noLinkStateFlag bool) error {
return nil
}
-func addSRPolicyNoLinkState(input InputFormat) error {
+func addSRPolicyWithoutSIDValidation(input InputFormat) error {
if !input.SRPolicy.PCEPSessionAddr.IsValid() || input.SRPolicy.Color == 0 || !input.SRPolicy.SrcAddr.IsValid() || !input.SRPolicy.DstAddr.IsValid() || len(input.SRPolicy.SegmentList) == 0 {
sampleInput := "srPolicy:\n" +
" pcepSessionAddr: 192.0.2.1\n" +
@@ -138,7 +138,7 @@ func addSRPolicyNoLinkState(input InputFormat) error {
segmentList = append(segmentList, pbSeg)
}
srPolicy := &pb.SRPolicy{
- PCEPSessionAddr: input.SRPolicy.PCEPSessionAddr.AsSlice(),
+ PcepSessionAddr: input.SRPolicy.PCEPSessionAddr.AsSlice(),
SrcAddr: input.SRPolicy.SrcAddr.AsSlice(),
DstAddr: input.SRPolicy.DstAddr.AsSlice(),
SegmentList: segmentList,
@@ -146,17 +146,17 @@ func addSRPolicyNoLinkState(input InputFormat) error {
PolicyName: input.SRPolicy.Name,
}
- inputData := &pb.CreateSRPolicyInput{
- SRPolicy: srPolicy,
+ request := &pb.CreateSRPolicyRequest{
+ SrPolicy: srPolicy,
}
- if err := grpc.CreateSRPolicyWithoutLinkState(client, inputData); err != nil {
+ if err := grpc.CreateSRPolicy(client, request); err != nil {
return err
}
return nil
}
-func addSRPolicyLinkState(input InputFormat) error {
+func addSRPolicyWithSIDValidation(input InputFormat) error {
sampleInputDynamic := "#case: dynamic path\n" +
"asn: 65000\n" +
"srPolicy:\n" +
@@ -184,7 +184,7 @@ func addSRPolicyLinkState(input InputFormat) error {
"input example is below\n\n" +
sampleInputDynamic +
sampleInputExplicit +
- "or, if create SR Policy without TED, then use `--no-link-state` flag\n"
+ "or, if create SR Policy without TED, then use `--no-sid-validate` flag\n"
return errors.New(errMsg)
}
@@ -200,7 +200,7 @@ func addSRPolicyLinkState(input InputFormat) error {
return errors.New(errMsg)
}
- srPolicyType = pb.SRPolicyType_EXPLICIT
+ srPolicyType = pb.SRPolicyType_SR_POLICY_TYPE_EXPLICIT
for _, segment := range input.SRPolicy.SegmentList {
segmentList = append(segmentList, &pb.Segment{Sid: segment.Sid})
}
@@ -211,14 +211,14 @@ func addSRPolicyLinkState(input InputFormat) error {
sampleInputDynamic
return errors.New(errMsg)
}
- srPolicyType = pb.SRPolicyType_DYNAMIC
+ srPolicyType = pb.SRPolicyType_SR_POLICY_TYPE_DYNAMIC
switch input.SRPolicy.Metric {
case "igp":
- metric = pb.MetricType_IGP
+ metric = pb.MetricType_METRIC_TYPE_IGP
case "delay":
- metric = pb.MetricType_DELAY
+ metric = pb.MetricType_METRIC_TYPE_DELAY
case "te":
- metric = pb.MetricType_TE
+ metric = pb.MetricType_METRIC_TYPE_TE
default:
return fmt.Errorf("invalid input `metric`")
}
@@ -228,17 +228,17 @@ func addSRPolicyLinkState(input InputFormat) error {
}
srPolicy := &pb.SRPolicy{
- PCEPSessionAddr: input.SRPolicy.PCEPSessionAddr.AsSlice(),
- SrcRouterID: input.SRPolicy.SrcRouterID,
- DstRouterID: input.SRPolicy.DstRouterID,
+ PcepSessionAddr: input.SRPolicy.PCEPSessionAddr.AsSlice(),
+ SrcRouterId: input.SRPolicy.SrcRouterID,
+ DstRouterId: input.SRPolicy.DstRouterID,
Color: input.SRPolicy.Color,
PolicyName: input.SRPolicy.Name,
Type: srPolicyType,
SegmentList: segmentList,
Metric: metric,
}
- inputData := &pb.CreateSRPolicyInput{
- SRPolicy: srPolicy,
+ inputData := &pb.CreateSRPolicyRequest{
+ SrPolicy: srPolicy,
Asn: input.ASN,
}
if err := grpc.CreateSRPolicy(client, inputData); err != nil {
diff --git a/cmd/pola/sr_policy_delete.go b/cmd/pola/sr_policy_delete.go
index 5bf780c8..e5d86b2d 100644
--- a/cmd/pola/sr_policy_delete.go
+++ b/cmd/pola/sr_policy_delete.go
@@ -10,7 +10,7 @@ import (
"fmt"
"os"
- pb "github.com/nttcom/pola/api/grpc"
+ pb "github.com/nttcom/pola/api/pola/v1"
"github.com/spf13/cobra"
yaml "gopkg.in/yaml.v2"
@@ -70,13 +70,13 @@ func deleteSRPolicy(input InputFormat, jsonFlag bool) error {
}
srPolicy := &pb.SRPolicy{
- PCEPSessionAddr: input.SRPolicy.PCEPSessionAddr.AsSlice(),
+ PcepSessionAddr: input.SRPolicy.PCEPSessionAddr.AsSlice(),
DstAddr: input.SRPolicy.DstAddr.AsSlice(),
Color: input.SRPolicy.Color,
PolicyName: input.SRPolicy.Name,
}
- inputData := &pb.DeleteSRPolicyInput{
- SRPolicy: srPolicy,
+ inputData := &pb.DeleteSRPolicyRequest{
+ SrPolicy: srPolicy,
Asn: input.ASN,
}
if err := grpc.DeleteSRPolicy(client, inputData); err != nil {
diff --git a/examples/containerlab/srv6_te_l3vpn/README.md b/examples/containerlab/srv6_te_l3vpn/README.md
index 7d25f91b..95212ff3 100644
--- a/examples/containerlab/srv6_te_l3vpn/README.md
+++ b/examples/containerlab/srv6_te_l3vpn/README.md
@@ -72,9 +72,9 @@ no SR Policies
Apply and check SR Policy
```bash
-# pola sr-policy add -f pe01-policy1.yaml --no-link-state
+# pola sr-policy add -f pe01-policy1.yaml --no-sid-validate
success!
-# pola sr-policy add -f pe02-policy1.yaml --no-link-state
+# pola sr-policy add -f pe02-policy1.yaml --no-sid-validate
success!
# pola sr-policy list
diff --git a/examples/tinet/sr-mpls_te_l3vpn/README.md b/examples/tinet/sr-mpls_te_l3vpn/README.md
index 042df9d8..e372b472 100644
--- a/examples/tinet/sr-mpls_te_l3vpn/README.md
+++ b/examples/tinet/sr-mpls_te_l3vpn/README.md
@@ -72,7 +72,7 @@ srPolicy:
Apply and check SR Policy
```bash
-# pola sr-policy add -f policy1.yaml --no-link-state
+# pola sr-policy add -f policy1.yaml --no-sid-validate
success!
# pola sr-policy list
diff --git a/pkg/server/grpc_server.go b/pkg/server/grpc_server.go
index 491f93fc..f57559f2 100644
--- a/pkg/server/grpc_server.go
+++ b/pkg/server/grpc_server.go
@@ -14,8 +14,7 @@ import (
"net/netip"
"slices"
- "github.com/golang/protobuf/ptypes/empty"
- pb "github.com/nttcom/pola/api/grpc"
+ pb "github.com/nttcom/pola/api/pola/v1"
"github.com/nttcom/pola/internal/pkg/cspf"
"github.com/nttcom/pola/internal/pkg/table"
"github.com/nttcom/pola/pkg/packet/pcep"
@@ -52,39 +51,31 @@ func (s *APIServer) Serve(address string, port string) error {
return s.grpcServer.Serve(grpcListener)
}
-func (s *APIServer) CreateSRPolicy(ctx context.Context, input *pb.CreateSRPolicyInput) (*pb.RequestStatus, error) {
- return s.createSRPolicy(ctx, input, true)
-}
-
-func (s *APIServer) CreateSRPolicyWithoutLinkState(ctx context.Context, input *pb.CreateSRPolicyInput) (*pb.RequestStatus, error) {
- return s.createSRPolicy(ctx, input, false)
-}
-
-func validateCreateSRPolicy(input *pb.CreateSRPolicyInput, withLinkState bool) error {
- if withLinkState {
- return validate(input.GetSRPolicy(), input.GetAsn(), ValidationAdd)
+func validateCreateSRPolicy(req *pb.CreateSRPolicyRequest, disablePathCompute bool) error {
+ if disablePathCompute {
+ return validate(req.GetSrPolicy(), req.GetAsn(), ValidationAddDisablePathCompute)
}
- return validate(input.GetSRPolicy(), input.GetAsn(), ValidationAddWithoutLinkState)
+ return validate(req.GetSrPolicy(), req.GetAsn(), ValidationAdd)
}
-func buildSegmentList(s *APIServer, input *pb.CreateSRPolicyInput, withLinkState bool) ([]table.Segment, netip.Addr, netip.Addr, error) {
+func buildSegmentList(s *APIServer, input *pb.CreateSRPolicyRequest, disablePathCompute bool) ([]table.Segment, netip.Addr, netip.Addr, error) {
var srcAddr, dstAddr netip.Addr
var segmentList []table.Segment
var err error
- inputSRPolicy := input.GetSRPolicy()
+ inputSRPolicy := input.GetSrPolicy()
- if withLinkState {
+ if !disablePathCompute {
if s.pce.ted == nil {
return nil, netip.Addr{}, netip.Addr{}, errors.New("ted is disabled")
}
- srcAddr, err = getLoopbackAddr(s.pce, input.GetAsn(), inputSRPolicy.GetSrcRouterID())
+ srcAddr, err = getLoopbackAddr(s.pce, input.GetAsn(), inputSRPolicy.GetSrcRouterId())
if err != nil {
return nil, netip.Addr{}, netip.Addr{}, err
}
- dstAddr, err = getLoopbackAddr(s.pce, input.GetAsn(), inputSRPolicy.GetDstRouterID())
+ dstAddr, err = getLoopbackAddr(s.pce, input.GetAsn(), inputSRPolicy.GetDstRouterId())
if err != nil {
return nil, netip.Addr{}, netip.Addr{}, err
}
@@ -109,12 +100,12 @@ func buildSegmentList(s *APIServer, input *pb.CreateSRPolicyInput, withLinkState
return segmentList, srcAddr, dstAddr, nil
}
-func sendSRPolicyRequest(s *APIServer, input *pb.CreateSRPolicyInput, segmentList []table.Segment, srcAddr, dstAddr netip.Addr) (*pb.RequestStatus, error) {
- inputSRPolicy := input.GetSRPolicy()
+func sendSRPolicyRequest(s *APIServer, input *pb.CreateSRPolicyRequest, segmentList []table.Segment, srcAddr, dstAddr netip.Addr) error {
+ inputSRPolicy := input.GetSrPolicy()
- pcepSession, err := getSyncedPCEPSession(s.pce, inputSRPolicy.GetPCEPSessionAddr())
+ pcepSession, err := getSyncedPCEPSession(s.pce, inputSRPolicy.GetPcepSessionAddr())
if err != nil {
- return &pb.RequestStatus{IsSuccess: false}, err
+ return fmt.Errorf("failed to get synchronized PCEP session: %w", err)
}
srPolicy := table.SRPolicy{
@@ -131,38 +122,43 @@ func sendSRPolicyRequest(s *APIServer, input *pb.CreateSRPolicyInput, segmentLis
srPolicy.PlspID = id
if err := pcepSession.SendPCUpdate(srPolicy); err != nil {
- return &pb.RequestStatus{IsSuccess: false}, err
+ return fmt.Errorf("failed to send PC update: %w", err)
}
} else {
s.logger.Debug("Request to create SR Policy")
if err := pcepSession.RequestSRPolicyCreated(srPolicy); err != nil {
- return &pb.RequestStatus{IsSuccess: false}, err
+ return fmt.Errorf("failed to request SR policy creation: %w", err)
}
}
- return &pb.RequestStatus{IsSuccess: true}, nil
+ return nil
}
-func (s *APIServer) createSRPolicy(_ context.Context, input *pb.CreateSRPolicyInput, withLinkState bool) (*pb.RequestStatus, error) {
- if err := validateCreateSRPolicy(input, withLinkState); err != nil {
- return &pb.RequestStatus{IsSuccess: false}, err
+func (s *APIServer) CreateSRPolicy(ctx context.Context, req *pb.CreateSRPolicyRequest) (*pb.CreateSRPolicyResponse, error) {
+ sidvalidate := req.GetSidValidate()
+ if err := validateCreateSRPolicy(req, sidvalidate); err != nil {
+ return nil, fmt.Errorf("failed to validate SR policy creation: %w", err)
}
- segmentList, srcAddr, dstAddr, err := buildSegmentList(s, input, withLinkState)
+ segmentList, srcAddr, dstAddr, err := buildSegmentList(s, req, sidvalidate)
if err != nil {
- return &pb.RequestStatus{IsSuccess: false}, err
+ return nil, fmt.Errorf("failed to build segment list: %w", err)
+ }
+
+ if err := sendSRPolicyRequest(s, req, segmentList, srcAddr, dstAddr); err != nil {
+ return nil, fmt.Errorf("failed to send SR policy request: %w", err)
}
- return sendSRPolicyRequest(s, input, segmentList, srcAddr, dstAddr)
+ return &pb.CreateSRPolicyResponse{IsSuccess: true}, nil
}
-func (s *APIServer) DeleteSRPolicy(ctx context.Context, input *pb.DeleteSRPolicyInput) (*pb.RequestStatus, error) {
- err := validate(input.GetSRPolicy(), input.GetAsn(), ValidationDelete)
+func (s *APIServer) DeleteSRPolicy(ctx context.Context, input *pb.DeleteSRPolicyRequest) (*pb.DeleteSRPolicyResponse, error) {
+ err := validate(input.GetSrPolicy(), input.GetAsn(), ValidationDelete)
if err != nil {
- return &pb.RequestStatus{IsSuccess: false}, err
+ return &pb.DeleteSRPolicyResponse{IsSuccess: false}, err
}
- inputSRPolicy := input.GetSRPolicy()
+ inputSRPolicy := input.GetSrPolicy()
var srcAddr, dstAddr netip.Addr
var segmentList []table.Segment
@@ -171,7 +167,7 @@ func (s *APIServer) DeleteSRPolicy(ctx context.Context, input *pb.DeleteSRPolicy
for _, segment := range inputSRPolicy.GetSegmentList() {
seg, err := table.NewSegment(segment.GetSid())
if err != nil {
- return &pb.RequestStatus{IsSuccess: false}, err
+ return &pb.DeleteSRPolicyResponse{IsSuccess: false}, err
}
segmentList = append(segmentList, seg)
}
@@ -183,9 +179,9 @@ func (s *APIServer) DeleteSRPolicy(ctx context.Context, input *pb.DeleteSRPolicy
s.logger.Info("Received DeleteSRPolicy API request")
s.logger.Debug("Received paramater", zap.String("input", string(inputJSON)))
- pcepSession, err := getSyncedPCEPSession(s.pce, inputSRPolicy.GetPCEPSessionAddr())
+ pcepSession, err := getSyncedPCEPSession(s.pce, inputSRPolicy.GetPcepSessionAddr())
if err != nil {
- return &pb.RequestStatus{IsSuccess: false}, err
+ return &pb.DeleteSRPolicyResponse{IsSuccess: false}, err
}
srPolicy := table.SRPolicy{
@@ -198,19 +194,18 @@ func (s *APIServer) DeleteSRPolicy(ctx context.Context, input *pb.DeleteSRPolicy
}
if id, exists := pcepSession.SearchPlspID(inputSRPolicy.GetColor(), dstAddr); exists {
- // Delete SR Policy
s.logger.Debug("Request to delete SR Policy", zap.Uint32("plspID", id))
srPolicy.PlspID = id
if err := pcepSession.RequestSRPolicyDeleted(srPolicy); err != nil {
- return &pb.RequestStatus{IsSuccess: false}, nil
+ return &pb.DeleteSRPolicyResponse{IsSuccess: false}, nil
}
} else {
// Invalid SR Policy
- return &pb.RequestStatus{IsSuccess: false}, fmt.Errorf("requested SR Policy not found")
+ return &pb.DeleteSRPolicyResponse{IsSuccess: false}, fmt.Errorf("requested SR Policy not found")
}
- return &pb.RequestStatus{IsSuccess: true}, nil
+ return &pb.DeleteSRPolicyResponse{IsSuccess: true}, nil
}
func validate(inputSRPolicy *pb.SRPolicy, asn uint32, validationKind ValidationKind) error {
@@ -224,27 +219,27 @@ func validate(inputSRPolicy *pb.SRPolicy, asn uint32, validationKind ValidationK
type ValidationKind string
const (
- ValidationAdd ValidationKind = "Add"
- ValidationAddWithoutLinkState ValidationKind = "AddWithoutLinkState"
- ValidationDelete ValidationKind = "Delete"
+ ValidationAdd ValidationKind = "Add"
+ ValidationAddDisablePathCompute ValidationKind = "AddDisablePathCompute"
+ ValidationDelete ValidationKind = "Delete"
)
var validator = map[ValidationKind]func(policy *pb.SRPolicy, asn uint32) bool{
ValidationKind("Add"): func(policy *pb.SRPolicy, asn uint32) bool {
return asn != 0 &&
- policy.PCEPSessionAddr != nil &&
+ policy.PcepSessionAddr != nil &&
policy.Color != 0 &&
- policy.SrcRouterID != "" &&
- policy.DstRouterID != ""
+ policy.SrcRouterId != "" &&
+ policy.DstRouterId != ""
},
ValidationKind("AddWithoutLinkState"): func(policy *pb.SRPolicy, asn uint32) bool {
- return policy.PCEPSessionAddr != nil &&
+ return policy.PcepSessionAddr != nil &&
len(policy.SrcAddr) > 0 &&
len(policy.DstAddr) > 0 &&
len(policy.SegmentList) > 0
},
ValidationKind("Delete"): func(policy *pb.SRPolicy, asn uint32) bool {
- return policy.PCEPSessionAddr != nil &&
+ return policy.PcepSessionAddr != nil &&
policy.Color != 0 &&
len(policy.DstAddr) > 0 &&
policy.PolicyName != ""
@@ -272,7 +267,7 @@ func getSegmentList(inputSRPolicy *pb.SRPolicy, asn uint32, ted *table.LsTED) ([
var segmentList []table.Segment
switch inputSRPolicy.GetType() {
- case pb.SRPolicyType_EXPLICIT:
+ case pb.SRPolicyType_SR_POLICY_TYPE_EXPLICIT:
if len(inputSRPolicy.GetSegmentList()) == 0 {
return nil, errors.New("no segments in SRPolicy input")
}
@@ -283,12 +278,12 @@ func getSegmentList(inputSRPolicy *pb.SRPolicy, asn uint32, ted *table.LsTED) ([
}
segmentList = append(segmentList, sid)
}
- case pb.SRPolicyType_DYNAMIC:
+ case pb.SRPolicyType_SR_POLICY_TYPE_DYNAMIC:
metricType, err := getMetricType(inputSRPolicy.GetMetric())
if err != nil {
return nil, err
}
- segmentList, err = cspf.Cspf(inputSRPolicy.GetSrcRouterID(), inputSRPolicy.GetDstRouterID(), asn, metricType, ted)
+ segmentList, err = cspf.Cspf(inputSRPolicy.GetSrcRouterId(), inputSRPolicy.GetDstRouterId(), asn, metricType, ted)
if err != nil {
return nil, err
}
@@ -314,14 +309,14 @@ func getMetricType(metricType pb.MetricType) (table.MetricType, error) {
}
}
-func (s *APIServer) GetSessionList(context.Context, *empty.Empty) (*pb.SessionList, error) {
+func (s *APIServer) GetSessionList(ctx context.Context, _ *pb.GetSessionListRequest) (*pb.GetSessionListResponse, error) {
s.logger.Info("Received GetSessionList API request")
- var ret pb.SessionList
+ var sessions []*pb.Session
for _, pcepSession := range s.pce.sessionList {
ss := &pb.Session{
Addr: pcepSession.peerAddr.AsSlice(),
- State: pb.SessionState_UP, // Only the UP state in the current specification
+ State: pb.SessionState_SESSION_STATE_UP, // Only the UP state in the current specification
Caps: []string{},
IsSynced: pcepSession.isSynced,
}
@@ -329,21 +324,23 @@ func (s *APIServer) GetSessionList(context.Context, *empty.Empty) (*pb.SessionLi
ss.Caps = append(ss.Caps, cap.CapStrings()...)
}
ss.Caps = slices.Compact(ss.Caps)
- ret.Sessions = append(ret.Sessions, ss)
+ sessions = append(sessions, ss)
}
- s.logger.Debug("Send GetPeerAddrList API reply")
- return &ret, nil
+ s.logger.Debug("Send GetSessionList API reply")
+ return &pb.GetSessionListResponse{
+ Sessions: sessions,
+ }, nil
}
-func (s *APIServer) GetSRPolicyList(context.Context, *empty.Empty) (*pb.SRPolicyList, error) {
+func (s *APIServer) GetSRPolicyList(ctx context.Context, _ *pb.GetSRPolicyListRequest) (*pb.GetSRPolicyListResponse, error) {
s.logger.Info("Received GetSRPolicyList API request")
- var ret pb.SRPolicyList
+ var srPolicies []*pb.SRPolicy
for ssAddr, policies := range s.pce.SRPolicies() {
for _, policy := range policies {
- srPolicyData := &pb.SRPolicy{
- PCEPSessionAddr: ssAddr.AsSlice(),
+ srPolicy := &pb.SRPolicy{
+ PcepSessionAddr: ssAddr.AsSlice(),
SegmentList: make([]*pb.Segment, 0),
Color: policy.Color,
Preference: policy.Preference,
@@ -353,23 +350,25 @@ func (s *APIServer) GetSRPolicyList(context.Context, *empty.Empty) (*pb.SRPolicy
}
for _, segment := range policy.SegmentList {
- srPolicyData.SegmentList = append(srPolicyData.SegmentList, &pb.Segment{
+ srPolicy.SegmentList = append(srPolicy.SegmentList, &pb.Segment{
Sid: segment.SidString(),
})
}
- ret.SRPolicies = append(ret.SRPolicies, srPolicyData)
+ srPolicies = append(srPolicies, srPolicy)
}
}
s.logger.Debug("Send SRPolicyList API reply")
- return &ret, nil
+ return &pb.GetSRPolicyListResponse{
+ SrPolicies: srPolicies,
+ }, nil
}
-func (s *APIServer) GetTED(context.Context, *empty.Empty) (*pb.TED, error) {
+func (s *APIServer) GetTED(ctx context.Context, req *pb.GetTEDRequest) (*pb.GetTEDResponse, error) {
s.logger.Info("Received GetTED API request")
- ret := &pb.TED{
+ ret := &pb.GetTEDResponse{
Enable: true,
}
@@ -384,8 +383,8 @@ func (s *APIServer) GetTED(context.Context, *empty.Empty) (*pb.TED, error) {
for _, lsNode := range lsNodes {
node := &pb.LsNode{
Asn: lsNode.ASN,
- RouterID: lsNode.RouterID,
- IsisAreaID: lsNode.IsisAreaID,
+ RouterId: lsNode.RouterID,
+ IsisAreaId: lsNode.IsisAreaID,
Hostname: lsNode.Hostname,
SrgbBegin: lsNode.SrgbBegin,
SrgbEnd: lsNode.SrgbEnd,
@@ -395,19 +394,18 @@ func (s *APIServer) GetTED(context.Context, *empty.Empty) (*pb.TED, error) {
for _, lsLink := range lsNode.Links {
link := &pb.LsLink{
- LocalRouterID: lsLink.LocalNode.RouterID,
- LocalASN: lsLink.LocalNode.ASN,
- LocalIP: lsLink.LocalIP.String(),
- RemoteRouterID: lsLink.RemoteNode.RouterID,
- RemoteASN: lsLink.RemoteNode.ASN,
- RemoteIP: lsLink.RemoteIP.String(),
+ LocalRouterId: lsLink.LocalNode.RouterID,
+ LocalAsn: lsLink.LocalNode.ASN,
+ LocalIp: lsLink.LocalIP.String(),
+ RemoteRouterId: lsLink.RemoteNode.RouterID,
+ RemoteAsn: lsLink.RemoteNode.ASN,
+ RemoteIp: lsLink.RemoteIP.String(),
Metrics: make([]*pb.Metric, 0, len(lsLink.Metrics)),
- AdjSID: lsLink.AdjSid,
+ AdjSid: lsLink.AdjSid,
}
for _, lsMetric := range lsLink.Metrics {
metricType, ok := pb.MetricType_value[lsMetric.Type.String()]
-
if !ok {
return nil, fmt.Errorf("invalid metric type: %s", lsMetric.Type.String())
}
@@ -440,24 +438,24 @@ func (s *APIServer) GetTED(context.Context, *empty.Empty) (*pb.TED, error) {
return ret, nil
}
-func (c *APIServer) DeleteSession(ctx context.Context, input *pb.Session) (*pb.RequestStatus, error) {
- ssAddr, ok := netip.AddrFromSlice(input.GetAddr())
+func (s *APIServer) DeleteSession(ctx context.Context, req *pb.DeleteSessionRequest) (*pb.DeleteSessionResponse, error) {
+ ssAddr, ok := netip.AddrFromSlice(req.GetAddr())
if !ok {
- return nil, fmt.Errorf("invalid address: %v", input.GetAddr())
+ return nil, fmt.Errorf("invalid address: %v", req.GetAddr())
}
- s := c.pce
- ss := s.SearchSession(ssAddr, false)
+ pce := s.pce
+ ss := pce.SearchSession(ssAddr, false)
if ss == nil {
return nil, fmt.Errorf("no session with address %s found", ssAddr)
}
if err := ss.SendClose(pcep.CloseReasonNoExplanationProvided); err != nil {
- return &pb.RequestStatus{IsSuccess: false}, fmt.Errorf("failed to send close message: %v", err)
+ return &pb.DeleteSessionResponse{IsSuccess: false}, fmt.Errorf("failed to send close message: %v", err)
}
// Remove session info from PCE server
- s.closeSession(ss)
+ pce.closeSession(ss)
- return &pb.RequestStatus{IsSuccess: true}, nil
+ return &pb.DeleteSessionResponse{IsSuccess: true}, nil
}
diff --git a/tools/grpc/go/add_sr-policy/add_sr-policy.go b/tools/grpc/go/add_sr-policy/add_sr-policy.go
index a2f2de71..c628a98b 100644
--- a/tools/grpc/go/add_sr-policy/add_sr-policy.go
+++ b/tools/grpc/go/add_sr-policy/add_sr-policy.go
@@ -15,7 +15,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
- pb "github.com/nttcom/pola/api/grpc"
+ pb "github.com/nttcom/pola/api/pola/v1"
)
func main() {
@@ -41,17 +41,18 @@ func main() {
ssAddr := netip.MustParseAddr("192.0.2.1")
- r, err := c.CreateSRPolicy(ctx, &pb.CreateSRPolicyInput{
+ r, err := c.CreateSRPolicy(ctx, &pb.CreateSRPolicyRequest{
Asn: 65000,
- SRPolicy: &pb.SRPolicy{
- PCEPSessionAddr: ssAddr.AsSlice(),
- SrcRouterID: "0000.0aff.0001",
- DstRouterID: "0000.0aff.0004",
+ SrPolicy: &pb.SRPolicy{
+ PcepSessionAddr: ssAddr.AsSlice(),
+ SrcRouterId: "0000.0aff.0001",
+ DstRouterId: "0000.0aff.0004",
Color: uint32(100),
PolicyName: "sample-name",
- Type: pb.SRPolicyType_DYNAMIC,
- Metric: pb.MetricType_TE,
+ Type: pb.SRPolicyType_SR_POLICY_TYPE_DYNAMIC,
+ Metric: pb.MetricType_METRIC_TYPE_TE,
},
+ SidValidate: true,
})
if err != nil {
log.Fatalf("c.CreateSRPolicy error: %v", err)
diff --git a/tools/grpc/go/add_sr-policy_no_ls/add_sr-policy_no_ls.go b/tools/grpc/go/add_sr-policy_no_ls/add_sr-policy_no_ls.go
index faeb8d33..328347a9 100644
--- a/tools/grpc/go/add_sr-policy_no_ls/add_sr-policy_no_ls.go
+++ b/tools/grpc/go/add_sr-policy_no_ls/add_sr-policy_no_ls.go
@@ -15,7 +15,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
- pb "github.com/nttcom/pola/api/grpc"
+ pb "github.com/nttcom/pola/api/pola/v1"
)
func main() {
@@ -43,9 +43,9 @@ func main() {
srcAddr := netip.MustParseAddr("192.0.2.1")
dstAddr := netip.MustParseAddr("192.0.2.2")
- r, err := c.CreateSRPolicyWithoutLinkState(ctx, &pb.CreateSRPolicyInput{
- SRPolicy: &pb.SRPolicy{
- PCEPSessionAddr: ssAddr.AsSlice(),
+ r, err := c.CreateSRPolicy(ctx, &pb.CreateSRPolicyRequest{
+ SrPolicy: &pb.SRPolicy{
+ PcepSessionAddr: ssAddr.AsSlice(),
SrcAddr: srcAddr.AsSlice(),
DstAddr: dstAddr.AsSlice(),
Color: uint32(100),
@@ -56,9 +56,10 @@ func main() {
{Sid: "16004"},
},
},
+ SidValidate: false,
})
if err != nil {
- log.Fatalf("c.CreateSRPolicyWithoutLinkState error: %v", err)
+ log.Fatalf("c.CreateSRPolicy error: %v", err)
}
log.Printf("Success: %#v", r)
diff --git a/tools/grpc/go/del_session/del_session.go b/tools/grpc/go/del_session/del_session.go
index e395d56e..2b871b1e 100644
--- a/tools/grpc/go/del_session/del_session.go
+++ b/tools/grpc/go/del_session/del_session.go
@@ -15,7 +15,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
- pb "github.com/nttcom/pola/api/grpc"
+ pb "github.com/nttcom/pola/api/pola/v1"
)
func main() {
@@ -39,7 +39,7 @@ func main() {
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
- ss := &pb.Session{
+ ss := &pb.DeleteSessionRequest{
Addr: netip.MustParseAddr("192.0.2.1").AsSlice(),
}
diff --git a/tools/grpc/go/show_session/show_session.go b/tools/grpc/go/show_session/show_session.go
index 91b2b5df..13313687 100644
--- a/tools/grpc/go/show_session/show_session.go
+++ b/tools/grpc/go/show_session/show_session.go
@@ -16,8 +16,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
- empty "github.com/golang/protobuf/ptypes/empty"
- pb "github.com/nttcom/pola/api/grpc"
+ pb "github.com/nttcom/pola/api/pola/v1"
)
func main() {
@@ -41,9 +40,8 @@ func main() {
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
- var empty empty.Empty
- ret, err := c.GetSessionList(ctx, &empty)
+ ret, err := c.GetSessionList(ctx, &pb.GetSessionListRequest{})
if err != nil {
log.Fatalf("unable to get session list from server: %v", err)
}
diff --git a/tools/grpc/go/show_sr-policy/show_sr-policy_list.go b/tools/grpc/go/show_sr-policy/show_sr-policy_list.go
index 9ad2ece8..4c5f224d 100644
--- a/tools/grpc/go/show_sr-policy/show_sr-policy_list.go
+++ b/tools/grpc/go/show_sr-policy/show_sr-policy_list.go
@@ -16,8 +16,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
- empty "github.com/golang/protobuf/ptypes/empty"
- pb "github.com/nttcom/pola/api/grpc"
+ pb "github.com/nttcom/pola/api/pola/v1"
)
func main() {
@@ -42,15 +41,14 @@ func main() {
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
- var empty empty.Empty
- ret, err := c.GetSRPolicyList(ctx, &empty)
+ ret, err := c.GetSRPolicyList(ctx, &pb.GetSRPolicyListRequest{})
if err != nil {
log.Fatalf("unable to get SR policy list from server: %v", err)
}
- for i, srPolicy := range ret.GetSRPolicies() {
+ for i, srPolicy := range ret.GetSrPolicies() {
fmt.Printf("srPolicy(%d): \n", i)
- sessionAddr := net.IP(srPolicy.GetPCEPSessionAddr())
+ sessionAddr := net.IP(srPolicy.GetPcepSessionAddr())
fmt.Printf(" sessionAddr: %s\n", sessionAddr.String())
fmt.Printf(" policyName: %s\n", srPolicy.GetPolicyName())
fmt.Printf(" SrcAddr: %s\n", net.IP(srPolicy.GetSrcAddr()))
diff --git a/tools/grpc/go/show_ted/show_ted.go b/tools/grpc/go/show_ted/show_ted.go
index 1c9d10eb..04eea043 100644
--- a/tools/grpc/go/show_ted/show_ted.go
+++ b/tools/grpc/go/show_ted/show_ted.go
@@ -15,8 +15,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
- empty "github.com/golang/protobuf/ptypes/empty"
- pb "github.com/nttcom/pola/api/grpc"
+ pb "github.com/nttcom/pola/api/pola/v1"
)
func main() {
@@ -40,9 +39,7 @@ func main() {
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
- var empty empty.Empty
-
- ret, err := c.GetTED(ctx, &empty)
+ ret, err := c.GetTED(ctx, &pb.GetTEDRequest{})
if err != nil {
log.Fatalf("unable to get TED info: %v", err)
}
From 9ea9ce62ced46b200e4411f7be2765946589f4c5 Mon Sep 17 00:00:00 2001
From: watal
Date: Tue, 15 Apr 2025 13:31:11 +0900
Subject: [PATCH 12/87] refactor(yaml): use snake_case for YAML field names and
improve consistency
---
cmd/pola/sr_policy_add.go | 30 ++++++++++++++----------------
internal/config/config.go | 6 +++---
2 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/cmd/pola/sr_policy_add.go b/cmd/pola/sr_policy_add.go
index e90cfe03..9ccf1847 100644
--- a/cmd/pola/sr_policy_add.go
+++ b/cmd/pola/sr_policy_add.go
@@ -63,30 +63,28 @@ func newSRPolicyAddCmd() *cobra.Command {
return srPolicyAddCmd
}
-// Unify with table.Segment
type Segment struct {
- Sid string `yaml:"sid"`
- LocalAddr string `yaml:"localAddr"`
- RemoteAddr string `yaml:"remoteAddr"`
- SidStructure string `yaml:"sidStructure"`
+ SID string `yaml:"sid"`
+ LocalAddr string `yaml:"local_addr"`
+ RemoteAddr string `yaml:"remote_addr"`
+ SIDStructure string `yaml:"sid_structure"`
}
-// Unify with table.SRPolciy
type SRPolicy struct {
- PCEPSessionAddr netip.Addr `yaml:"pcepSessionAddr"`
- SrcAddr netip.Addr `yaml:"srcAddr"`
- DstAddr netip.Addr `yaml:"dstAddr"`
- SrcRouterID string `yaml:"srcRouterID"`
- DstRouterID string `yaml:"dstRouterID"`
+ PCEPSessionAddr netip.Addr `yaml:"pcep_session_addr"`
+ SrcAddr netip.Addr `yaml:"src_addr"`
+ DstAddr netip.Addr `yaml:"dst_addr"`
+ SrcRouterID string `yaml:"src_router_id"`
+ DstRouterID string `yaml:"dst_router_id"`
Name string `yaml:"name"`
- SegmentList []Segment `yaml:"segmentList"`
+ SegmentList []Segment `yaml:"segment_list"`
Color uint32 `yaml:"color"`
Type string `yaml:"type"`
Metric string `yaml:"metric"`
}
type InputFormat struct {
- SRPolicy SRPolicy `yaml:"srPolicy"`
+ SRPolicy SRPolicy `yaml:"sr_policy"`
ASN uint32 `yaml:"asn"`
}
@@ -130,10 +128,10 @@ func addSRPolicyWithoutSIDValidation(input InputFormat) error {
segmentList := []*pb.Segment{}
for _, segment := range input.SRPolicy.SegmentList {
pbSeg := &pb.Segment{
- Sid: segment.Sid,
+ Sid: segment.SID,
LocalAddr: segment.LocalAddr,
RemoteAddr: segment.RemoteAddr,
- SidStructure: segment.SidStructure,
+ SidStructure: segment.SIDStructure,
}
segmentList = append(segmentList, pbSeg)
}
@@ -202,7 +200,7 @@ func addSRPolicyWithSIDValidation(input InputFormat) error {
}
srPolicyType = pb.SRPolicyType_SR_POLICY_TYPE_EXPLICIT
for _, segment := range input.SRPolicy.SegmentList {
- segmentList = append(segmentList, &pb.Segment{Sid: segment.Sid})
+ segmentList = append(segmentList, &pb.Segment{Sid: segment.SID})
}
case "dynamic":
if input.SRPolicy.Metric == "" {
diff --git a/internal/config/config.go b/internal/config/config.go
index 6e5b9474..fc24948e 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -34,7 +34,7 @@ type Log struct {
}
type GoBGP struct {
- GRPCClient GRPCClient `yaml:"grpc-client"`
+ GRPCClient GRPCClient `yaml:"grpc_client"`
}
type TED struct {
@@ -44,11 +44,11 @@ type TED struct {
type Global struct {
PCEP PCEP `yaml:"pcep"`
- GRPCServer GRPCServer `yaml:"grpc-server"`
+ GRPCServer GRPCServer `yaml:"grpc_server"`
Log Log `yaml:"log"`
TED *TED `yaml:"ted"`
GoBGP GoBGP `yaml:"gobgp"`
- USidMode bool `yaml:"usid-mode"`
+ USidMode bool `yaml:"usid_mode"`
}
type Config struct {
From 0951d9300257eb9b34d598ebd52494bc3571a945 Mon Sep 17 00:00:00 2001
From: watal
Date: Tue, 15 Apr 2025 16:03:45 +0900
Subject: [PATCH 13/87] refactor(markdown): Apply markdownlint
---
.markdownlint.json | 5 +
CODE_OF_CONDUCT.md | 6 +-
CONTRIBUTING.md | 16 +-
README.md | 27 +-
SECURITY.md | 7 +-
build/package/README.md | 5 +-
cmd/pola/README.md | 478 +++++++++---------
docs/sources/getting-started.md | 11 +-
examples/containerlab/sr-mpls_pcep/README.md | 43 +-
examples/containerlab/srv6_te_l3vpn/README.md | 32 +-
10 files changed, 363 insertions(+), 267 deletions(-)
create mode 100644 .markdownlint.json
diff --git a/.markdownlint.json b/.markdownlint.json
new file mode 100644
index 00000000..e10fb3b4
--- /dev/null
+++ b/.markdownlint.json
@@ -0,0 +1,5 @@
+{
+ "MD013": false,
+ "MD033": false,
+ "MD041": false
+ }
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
index 0509a052..535f6a0f 100644
--- a/CODE_OF_CONDUCT.md
+++ b/CODE_OF_CONDUCT.md
@@ -116,7 +116,7 @@ the community.
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
-https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
+.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
@@ -124,5 +124,5 @@ enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
-https://www.contributor-covenant.org/faq. Translations are available at
-https://www.contributor-covenant.org/translations.
+. Translations are available at
+.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index c3c10578..3c5f03a6 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,5 +1,15 @@
+# Contributing
+
+Thank you for considering contributing to Pola PCE!
+Below are the guidelines for contributing.
+
## Creating Pull Requests
-All updates, including those contributed by project members, must be reviewed via Pull Request.
-## Creating issues
-If you have a bug report, feature request, or other question, please create an issue. However, please refer to [Security Policy](https://github.com/nttcom/pola/blob/main/SECURITY.md) for vulnerabilities.
+All updates, including those contributed by project members,
+must be reviewed via pull request.
+
+## Creating Issues
+
+If you have a bug report, feature request, or other question, please create an issue.
+However, please refer to the [security policy](https://github.com/nttcom/pola/blob/main/security.md)
+for vulnerabilities.
diff --git a/README.md b/README.md
index 105b296a..efd5ddcf 100644
--- a/README.md
+++ b/README.md
@@ -3,16 +3,19 @@
# Pola PCE
+
[](https://github.com/nttcom/pola/actions)
[](https://github.com/nttcom/pola/actions)
-[](https://goreportcard.com/report/github.com/nttcom/pola)
+[](https://goreportcard.com/report/github.com/nttcom/pola)
[](https://pkg.go.dev/github.com/nttcom/pola)
[](https://go.dev/)
[](LICENSE)
-Pola PCE is an implementation of the Path Computation Element (PCE) and a PCEP Library in Go.
+Pola PCE is an implementation of the Path Computation Element (PCE)
+and a PCEP Library in Go.
## Features
+
* Support for SRv6(full-SID/uSID) and SR-MPLS
* Implementation of active stateful PCE functionality (PCInitiate, PCUpdate, etc.)
* Dynamic and explicit SR policy definition using YAML
@@ -20,29 +23,41 @@ Pola PCE is an implementation of the Path Computation Element (PCE) and a PCEP L
* Explicit path: Allows users to define and provision any Segment List
## Interoperability
+
### SR-MPLS
+
* IOS-XR
* Junos
* FRRouting
### SRv6 (full-SID)
+
* Junos
### SRv6 (uSID)
+
* IOS-XR
* Junos
* VRP
## Installation & Use
+
* [Getting Started](docs/sources/getting-started.md)
* Examples (powered by [Containerlab](https://containerlab.dev/)/[Tinet](https://github.com/tinynetwork/tinet))
* [SR-MPLS Example](examples/tinet/sr-mpls_te_l3vpn)
* [SRv6 Example](examples/containerlab/srv6_te_l3vpn)
## Contributing
-If you are interested in contributing to the project, please refer to the [CONTRIBUTING](https://github.com/nttcom/pola/blob/main/CONTRIBUTING.md) guidelines.
-Feel free to fork the repository and create a Pull Request. Your contributions are highly appreciated.
+
+If you are interested in contributing to the project, please refer to the
+[CONTRIBUTING](https://github.com/nttcom/pola/blob/main/CONTRIBUTING.md)
+guidelines.
+Feel free to fork the repository and create a Pull Request.
+Your contributions are highly appreciated.
## Licensing
-Pola PCE is licensed under the [MIT license](https://en.wikipedia.org/wiki/MIT_License).
-For the full license text, see [LICENSE](https://github.com/nttcom/pola/blob/master/LICENSE).
+
+Pola PCE is licensed under the
+[MIT license](https://en.wikipedia.org/wiki/MIT_License).
+For the full license text, see
+[LICENSE](https://github.com/nttcom/pola/blob/master/LICENSE).
diff --git a/SECURITY.md b/SECURITY.md
index d10b4a52..e133da03 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -4,8 +4,9 @@
**Please do not report security vulnerabilities in public issues on GitHub.**
-Instead, please report by email to the Pola PCE maintainer ([watal](https://github.com/watal)).
-Include "Vulnerability" in the subject line of the email.
+Instead, please report by email to the Pola PCE maintainer ([watal](https://github.com/watal)).
+Include "Vulnerability" in the subject line of the email.
We will action the vulnerability within 72 hours of receiving the vulnerability report.
-If you have suggestions for improving this policy, please submit a PR or Issue for discussion.
+If you have suggestions for improving this policy,
+please submit a PR or Issue for discussion.
diff --git a/build/package/README.md b/build/package/README.md
index 5ea7c29a..958a1fce 100644
--- a/build/package/README.md
+++ b/build/package/README.md
@@ -25,7 +25,6 @@ docker run -itd --network host \
/bin/bash -c "source ~/.bashrc;polad"
```
-
## Use bridge network mode
```bash
@@ -49,7 +48,9 @@ docker pull ghcr.io/nttcom/pola:latest
# Container up and detach
CURRENTDIR=`pwd`
docker run -itd --network pcep_net --ip \
- -v $CURRENTDIR/$MOUNTDIR:/$MOUNTDIR -v $LOGDIR:$LOGDIR -w /$MOUNTDIR ghcr.io/nttcom/pola:latest \
+ -v $CURRENTDIR/$MOUNTDIR:/$MOUNTDIR \
+ -v $LOGDIR:$LOGDIR \
+ -w /$MOUNTDIR ghcr.io/nttcom/pola:latest \
/bin/bash -c "source ~/.bashrc;polad"
# Connect the container's PCC to the network
diff --git a/cmd/pola/README.md b/cmd/pola/README.md
index 2206bddd..ad95d62e 100644
--- a/cmd/pola/README.md
+++ b/cmd/pola/README.md
@@ -5,33 +5,35 @@
### From Go Package
```bash
-$ go install github.com/nttcom/pola/cmd/pola@latest
+go install github.com/nttcom/pola/cmd/pola@latest
```
### From Source
-**Getting the Source**
+#### Getting the Source
```bash
-$ git clone https://github.com/nttcom/pola.git
+git clone https://github.com/nttcom/pola.git
```
-**Build & install**
+#### Build & install
```bash
-$ cd pola
-$ go install ./cmd/pola
+cd pola
+go install ./cmd/pola
# or, install with daemon
-$ go install ./...
+go install ./...
```
## Command Reference
### pola session \[-j\]
+
Displays the peer addresses of the active session.
JSON formatted response
+
```json
[
{
@@ -59,9 +61,11 @@ JSON formatted response
```
### pola session del *Address* \[-j\]
+
Deletes the specified session.
JSON formatted response
+
```json
{
"status": "success"
@@ -69,102 +73,107 @@ JSON formatted response
```
### pola sr-policy list \[-j\]
+
Displays the lsp list managed by polad.
JSON formatted response
+
```json
{
- "lsps": [
- {
- "color": 999,
- "dstAddr": "192.0.2.1",
- "segmentList": [
- 16003,
- 16001
- ],
- "peerAddr": "192.0.2.2",
- "policyName": "sample_policy1",
- "preference": 100,
- "srcAddr": "192.0.2.2"
- },
- {
- "color": 888
- "dstAddr": "192.0.2.2",
- "segmentList": [
- 16003,
- 16002
- ],
- "peerAddr": "192.0.2.1",
- "policyName": "sample_policy2",
- "preference": 100,
- "srcAddr": "192.0.2.1"
- }
- ]
+ "lsps": [
+ {
+ "color": 999,
+ "dstAddr": "192.0.2.1",
+ "segmentList": [
+ 16003,
+ 16001
+ ],
+ "peerAddr": "192.0.2.2",
+ "policyName": "sample_policy1",
+ "preference": 100,
+ "srcAddr": "192.0.2.2"
+ },
+ {
+ "color": 888,
+ "dstAddr": "192.0.2.2",
+ "segmentList": [
+ 16003,
+ 16002
+ ],
+ "peerAddr": "192.0.2.1",
+ "policyName": "sample_policy2",
+ "preference": 100,
+ "srcAddr": "192.0.2.1"
+ }
+ ]
}
```
※ want to change to this format later.
+
```json
-{
- "peers": [
+ "peers": [
+ {
+ "peerAddr": "192.0.2.1",
+ "lsps": [
{
- "peerAddr": "192.0.2.1",
- "lsps": [
- {
- "policyName": "sample_policy1",
- "srcAddr": "192.0.2.1",
- "dstAddr": "192.0.2.2",
- "segmentList": [
- 16003,
- 16002
- ]
- },
- {
- "policyName": "sample_policy2",
- "srcAddr": "192.0.2.1",
- "dstAddr": "192.0.2.2",
- "segmentList": [
- 16003,
- 16001,
- 16002
- ]
- },
- ]
+ "policyName": "sample_policy1",
+ "srcAddr": "192.0.2.1",
+ "dstAddr": "192.0.2.2",
+ "segmentList": [
+ 16003,
+ 16002
+ ]
},
{
- "peerAddr": "192.0.2.2",
- "lsps": [
- {
- "policyName": "sample_policy3",
- "srcAddr": "192.0.2.2",
- "dstAddr": "192.0.2.1",
- "segmentList": [
- 16003,
- 16001
- ]
- },
- {
- "policyName": "sample_policy4",
- "srcAddr": "192.0.2.2",
- "dstAddr": "192.0.2.1",
- "segmentList": [
- 16003,
- 16002,
- 16001
- ]
- },
- ]
- },
-]
+ "policyName": "sample_policy2",
+ "srcAddr": "192.0.2.1",
+ "dstAddr": "192.0.2.2",
+ "segmentList": [
+ 16003,
+ 16001,
+ 16002
+ ]
+ }
+ ]
+ },
+ {
+ "peerAddr": "192.0.2.2",
+ "lsps": [
+ {
+ "policyName": "sample_policy3",
+ "srcAddr": "192.0.2.2",
+ "dstAddr": "192.0.2.1",
+ "segmentList": [
+ 16003,
+ 16001
+ ]
+ },
+ {
+ "policyName": "sample_policy4",
+ "srcAddr": "192.0.2.2",
+ "dstAddr": "192.0.2.1",
+ "segmentList": [
+ 16003,
+ 16002,
+ 16001
+ ]
+ }
+ ]
+ }
+ ]
+}
+
```
-### pola sr-policy add -f _filepath_
+### pola sr-policy add -f `filepath`
-Create a new SR Policy **using TED**
+Create a new SR Policy **using TED**
#### Case: Dynamic Path calculate
YAML input format
+
```yaml
asn: 65000
srPolicy:
@@ -178,15 +187,17 @@ srPolicy:
```
JSON formatted response
+
```json
{
- "status": "success"
+ "status": "success"
}
```
#### Case: Explicit Path
YAML input format
+
```yaml
asn: 65000
srPolicy:
@@ -203,9 +214,10 @@ srPolicy:
```
JSON formatted response
+
```json
{
- "status": "success"
+ "status": "success"
}
```
@@ -213,11 +225,13 @@ JSON formatted response
Create a new SR Policy **without using TED**
-Should write the `localAddress` (and `remoteAddr` if Adj-SID) of each sid for creation of Nai
+For each SID, write the `localAddress` (and `remoteAddr` if it's an Adj-SID)
+to construct the NAI.
See [JSON shema](schemas/polad_config.json) for input details.
YAML input format
+
```yaml
srPolicy:
pcepSessionAddr: "2001:0db8::1"
@@ -241,177 +255,183 @@ srPolicy:
```
json formatted response
+
```json
{
- "status": "success"
+ "status": "success"
}
```
### pola ted \[-j\]
+
Displays the ted managed by polad.
JSON formatted response
+
```json
{
- "ted": [
- {
- "asn": 65000,
- "hostname": "host1",
- "isisAreaID": "490000",
- "links": [
- {
- "adjSid": 17,
- "localIP": "10.0.1.1",
- "metrics": [
- {
- "type": "IGP",
- "value": 10
- }
- ],
- "remoteIP": "10.0.1.2",
- "remoteNode": "0000.0aff.0003"
- },
- {
- "adjSid": 18,
- "localIP": "10.0.0.1",
- "metrics": [
- {
- "type": "IGP",
- "value": 10
- }
- ],
- "remoteIP": "10.0.0.2",
- "remoteNode": "0000.0aff.0002"
- }
- ],
- "prefixes": [
- {
- "prefix": "10.0.1.0/30"
- },
- {
- "prefix": "10.0.0.0/30"
- },
- {
- "prefix": "10.255.0.1/32",
- "sidIndex": 1
- }
- ],
- "routerID": "0000.0aff.0001",
- "srgbBegin": 16000,
- "srgbEnd": 24000
- },
- {
- "asn": 65000,
- "hostname": "host2",
- "isisAreaID": "490000",
- "links": [
- {
- "adjSid": 17,
- "localIP": "10.0.1.2",
- "metrics": [
- {
- "type": "IGP",
- "value": 10
- }
- ],
- "remoteIP": "10.0.1.1",
- "remoteNode": "0000.0aff.0001"
- },
- {
- "adjSid": 16,
- "localIP": "10.0.2.2",
- "metrics": [
- {
- "type": "IGP",
- "value": 10
- }
- ],
- "remoteIP": "10.0.2.1",
- "remoteNode": "0000.0aff.0002"
- }
- ],
- "prefixes": [
- {
- "prefix": "10.255.0.3/32",
- "sidIndex": 3
- },
- {
- "prefix": "10.0.2.0/30"
- },
- {
- "prefix": "10.0.1.0/30"
- }
- ],
- "routerID": "0000.0aff.0003",
- "srgbBegin": 16000,
- "srgbEnd": 24000
- },
- {
- "asn": 65000,
- "hostname": "host3",
- "isisAreaID": "490000",
- "links": [
- {
- "adjSid": 24001,
- "localIP": "10.0.0.2",
- "metrics": [
- {
- "type": "IGP",
- "value": 10
- }
- ],
- "remoteIP": "10.0.0.1",
- "remoteNode": "0000.0aff.0001"
- },
- {
- "adjSid": 24003,
- "localIP": "10.0.2.1",
- "metrics": [
- {
- "type": "IGP",
- "value": 10
- }
- ],
- "remoteIP": "10.0.2.2",
- "remoteNode": "0000.0aff.0201"
- }
- ],
- "prefixes": [
- {
- "prefix": "10.0.2.0/30"
- },
- {
- "prefix": "10.0.0.0/30"
- },
- {
- "prefix": "10.255.0.2/32",
- "sidIndex": 2
- }
- ],
- "routerID": "0000.0aff.0002",
- "srgbBegin": 16000,
- "srgbEnd": 24000
- }
- ]
+ "ted": [
+ {
+ "asn": 65000,
+ "hostname": "host1",
+ "isisAreaID": "490000",
+ "links": [
+ {
+ "adjSid": 17,
+ "localIP": "10.0.1.1",
+ "metrics": [
+ {
+ "type": "IGP",
+ "value": 10
+ }
+ ],
+ "remoteIP": "10.0.1.2",
+ "remoteNode": "0000.0aff.0003"
+ },
+ {
+ "adjSid": 18,
+ "localIP": "10.0.0.1",
+ "metrics": [
+ {
+ "type": "IGP",
+ "value": 10
+ }
+ ],
+ "remoteIP": "10.0.0.2",
+ "remoteNode": "0000.0aff.0002"
+ }
+ ],
+ "prefixes": [
+ {
+ "prefix": "10.0.1.0/30"
+ },
+ {
+ "prefix": "10.0.0.0/30"
+ },
+ {
+ "prefix": "10.255.0.1/32",
+ "sidIndex": 1
+ }
+ ],
+ "routerID": "0000.0aff.0001",
+ "srgbBegin": 16000,
+ "srgbEnd": 24000
+ },
+ {
+ "asn": 65000,
+ "hostname": "host2",
+ "isisAreaID": "490000",
+ "links": [
+ {
+ "adjSid": 17,
+ "localIP": "10.0.1.2",
+ "metrics": [
+ {
+ "type": "IGP",
+ "value": 10
+ }
+ ],
+ "remoteIP": "10.0.1.1",
+ "remoteNode": "0000.0aff.0001"
+ },
+ {
+ "adjSid": 16,
+ "localIP": "10.0.2.2",
+ "metrics": [
+ {
+ "type": "IGP",
+ "value": 10
+ }
+ ],
+ "remoteIP": "10.0.2.1",
+ "remoteNode": "0000.0aff.0002"
+ }
+ ],
+ "prefixes": [
+ {
+ "prefix": "10.255.0.3/32",
+ "sidIndex": 3
+ },
+ {
+ "prefix": "10.0.2.0/30"
+ },
+ {
+ "prefix": "10.0.1.0/30"
+ }
+ ],
+ "routerID": "0000.0aff.0003",
+ "srgbBegin": 16000,
+ "srgbEnd": 24000
+ },
+ {
+ "asn": 65000,
+ "hostname": "host3",
+ "isisAreaID": "490000",
+ "links": [
+ {
+ "adjSid": 24001,
+ "localIP": "10.0.0.2",
+ "metrics": [
+ {
+ "type": "IGP",
+ "value": 10
+ }
+ ],
+ "remoteIP": "10.0.0.1",
+ "remoteNode": "0000.0aff.0001"
+ },
+ {
+ "adjSid": 24003,
+ "localIP": "10.0.2.1",
+ "metrics": [
+ {
+ "type": "IGP",
+ "value": 10
+ }
+ ],
+ "remoteIP": "10.0.2.2",
+ "remoteNode": "0000.0aff.0201"
+ }
+ ],
+ "prefixes": [
+ {
+ "prefix": "10.0.2.0/30"
+ },
+ {
+ "prefix": "10.0.0.0/30"
+ },
+ {
+ "prefix": "10.255.0.2/32",
+ "sidIndex": 2
+ }
+ ],
+ "routerID": "0000.0aff.0002",
+ "srgbBegin": 16000,
+ "srgbEnd": 24000
+ }
+ ]
}
```
## Completion
## Bash
+
```bash
pola completion bash | sudo tee -a /usr/share/bash-completion/completions/pola >/dev/null
source /usr/share/bash-completion/completions/pola
```
## Zsh
-```sh
+
+```bash
pola completion zsh > /usr/local/share/zsh/site-functions/_pola
compinit
```
## Fish
-```sh
+
+```bash
pola completion fish > ~/.config/fish/completions/pola.fish
fish_update_completions
```
diff --git a/docs/sources/getting-started.md b/docs/sources/getting-started.md
index 8b691e5e..8d8ad443 100644
--- a/docs/sources/getting-started.md
+++ b/docs/sources/getting-started.md
@@ -7,18 +7,18 @@ This page explains how to use Pola PCE.
### From Go Package
```bash
-$ go install github.com/nttcom/pola/cmd/polad@latest
+go install github.com/nttcom/pola/cmd/polad@latest
```
### From Source
-**Getting the Source**
+#### Getting the Source
```bash
-$ git clone https://github.com/nttcom/pola.git
+git clone https://github.com/nttcom/pola.git
```
-**Build & install**
+#### Build & install
```bash
$ cd pola
@@ -116,4 +116,5 @@ $ sudo polad -f polad.yaml
2022-06-05T22:57:59.823Z info PCEP listen {"listenInfo": "192.0.2.254:4189"}
```
-After Polad is running, use [pola cmd](../../cmd/pola/README.md) or the [gRCP client](../../api/grpc/) for daemon operations
+After Polad is running, use [pola cmd](../../cmd/pola/README.md) or the
+[gRCP client](../../api/grpc/) for daemon operations
diff --git a/examples/containerlab/sr-mpls_pcep/README.md b/examples/containerlab/sr-mpls_pcep/README.md
index 1e481175..bd8a4ce5 100644
--- a/examples/containerlab/sr-mpls_pcep/README.md
+++ b/examples/containerlab/sr-mpls_pcep/README.md
@@ -1,19 +1,27 @@
# SR-MPLS + PCEP (IOS-XR/Junos/FRRouting)
+
Example topology powered by [Containerlab](https://containerlab.dev/)
-
+
+
## Requirements
+
* container host (Linux)
* Cisco XRd image
* Juniper vMX image
+
## Usage
+
### Install Containerlab & XRd/vMX
+
**[Install Containerlab](https://containerlab.dev/install/)**
+
```bash
-$ sudo bash -c "$(curl -sL https://get.containerlab.dev)"
+sudo bash -c "$(curl -sL https://get.containerlab.dev)"
```
**Install Cisco XRd**
Configure sysctl on host
+
```bash
$ vi /etc/sysctl.conf
fs.inotify.max_user_instances=64000
@@ -27,17 +35,23 @@ net.core.wmem_max=67108864
net.ipv4.udp_mem=1124736 10000000 67108864
$ sysctl -p
```
+
host-check (see: [link](https://xrdocs.io/virtual-routing/tutorials/2022-08-22-setting-up-host-environment-to-run-xrd/))
+
```bash
git clone https://github.com/ios-xr/xrd-tools
cd xrd-tools/scripts
./host-check --platform xrd-control-plane
```
+
Load XRd container image
+
```bash
docker load -i .tar.gz
```
+
Install Juniper vMX on Vrnetlab
+
```bash
$ sudo apt install make
$ git clone https://github.com/hellt/vrnetlab && cd vrnetlab/vmx
@@ -51,32 +65,44 @@ vrnetlab/vr-vmx 22.4R1.10 6d2704750cd7 3 minutes ago 10.8GB
$ sudo rm -rf vrnetlab
$ sudo docker builder prune -a
```
+
### Building a Lab Network
+
Create bridge
+
```bash
-$ sudo ip link add switch type bridge
-$ sudo ip link set dev switch up
+sudo ip link add switch type bridge
+sudo ip link set dev switch up
```
+
Enable MPLS kernel module
-```
+
+```bash
sudo modprobe mpls_router
sudo modprobe mpls_gso
sudo modprobe mpls_iptunnel
```
+
Start Containerlab network
+
```bash
-$ git clone https://github.com/nttcom/pola
-$ cd pola/examples/containerlab/sr-mpls_pcep
-$ sudo containerlab deploy
+git clone https://github.com/nttcom/pola
+cd pola/examples/containerlab/sr-mpls_pcep
+sudo containerlab deploy
```
+
Wait for starting vMX after execute `sudo containerlab deploy` (it takes some time).
+
```bash
$ docker logs clab-sr-mpls_pcep-pe02 -f
2023-02-20 15:03:26,233: launch INFO Startup complete in: 0:09:06.969773
```
+
### Check PCEP Session
+
Connect to PCEP container, check PCEP session and SR policy
+
```bash
$ sudo docker exec -it clab-sr-mpls_pcep-pola-pce bash
# polad -f polad.yaml > /dev/null 2>&1 &
@@ -87,4 +113,5 @@ sessionAddr(2): 10.0.255.2
# pola sr-policy list
no SR Policies
```
+
Now the environment for PCEP verification is ready!
diff --git a/examples/containerlab/srv6_te_l3vpn/README.md b/examples/containerlab/srv6_te_l3vpn/README.md
index 95212ff3..9a91903c 100644
--- a/examples/containerlab/srv6_te_l3vpn/README.md
+++ b/examples/containerlab/srv6_te_l3vpn/README.md
@@ -2,21 +2,25 @@
Example topology powered by [Containerlab](https://containerlab.dev/)
-
+
## Requirements
+
* container host (Linux)
* Juniper vMX image
## Usage
### Install Containerlab & Juniper vMX
+
[Install Containerlab](https://containerlab.dev/install/)
+
```bash
-$ sudo bash -c "$(curl -sL https://get.containerlab.dev)"
+sudo bash -c "$(curl -sL https://get.containerlab.dev)"
```
Install Juniper vMX on [Vrnetlab](https://containerlab.dev/manual/vrnetlab/)
+
```bash
$ sudo apt install make
$ git clone https://github.com/hellt/vrnetlab && cd vrnetlab/vmx
@@ -34,21 +38,25 @@ $ sudo docker builder prune -a
```
### Building a Lab Network
+
Create bridge
+
```bash
-$ sudo ip link add switch type bridge
-$ sudo ip link set dev switch up
+sudo ip link add switch type bridge
+sudo ip link set dev switch up
```
Start Containerlab network
+
```bash
-$ git clone https://github.com/nttcom/pola
-$ cd pola/examples/containerlab/srv6_te_l3vpn
+git clone https://github.com/nttcom/pola
+cd pola/examples/containerlab/srv6_te_l3vpn
-$ sudo containerlab deploy
+sudo containerlab deploy
```
Wait for starting vMX after execute `sudo containerlab deploy` (it takes some time).
+
```bash
$ docker logs clab-srv6_te_l3vpn-pe01 -f
@@ -56,7 +64,9 @@ $ docker logs clab-srv6_te_l3vpn-pe01 -f
```
### Apply SR Policy
+
Connect to PCEP container, check PCEP session and SR policy
+
```bash
$ sudo docker exec -it clab-srv6_te_l3vpn-pola-pce bash
@@ -71,6 +81,7 @@ no SR Policies
```
Apply and check SR Policy
+
```bash
# pola sr-policy add -f pe01-policy1.yaml --no-sid-validate
success!
@@ -96,8 +107,10 @@ Session: fd00::2
```
Enter container pe01 and check SR Policy
+
* user: admin
* pass: admin@123
+
```bash
# exit
$ ssh clab-srv6_te_l3vpn-pe01 -l admin
@@ -151,6 +164,7 @@ fd00:a2::/64 *[BGP/170] 00:32:08, localpref 100, from fd00:ffff::2
Enter container host01 and check SRv6-TE
* ping over VPN
+
```bash
admin@pe01> exit
@@ -170,6 +184,7 @@ PING fd00:a2::1(fd00:a2::1) 56 data bytes
```
* Capture on containerlab host
+
```bash
$ sudo ip netns exec clab-srv6_te_l3vpn-pe01 tcpdump -nni eth1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
@@ -182,7 +197,8 @@ listening on eth1, link-type EN10MB (Ethernet), capture size 262144 bytes
01:05:34.067531 IP6 fd00:ffff::2 > fd00:ffff:1:0:4:a::: srcrt (len=4, type=4, segleft=0[|srcrt]
```
-Also, you can analyze with Wireshark on your Local PC ([ref: Packet capture & Wireshark](https://containerlab.dev/manual/wireshark/)).
+Also, you can analyze with Wireshark on your Local PC
+([ref: Packet capture & Wireshark](https://containerlab.dev/manual/wireshark/)).
```bash
ssh $clab_host "sudo -S ip netns exec clab-srv6_te_l3vpn-pe01 tcpdump -U -nni eth1 -w -" | wireshark -k -i -
From e5e57b571c6cc23f3a4a117ba27072224bc2a1b6 Mon Sep 17 00:00:00 2001
From: watal
Date: Tue, 15 Apr 2025 16:44:47 +0900
Subject: [PATCH 14/87] chore(ci): update CI workflow to improve buf and
markdown lint checks
---
.github/workflows/ci.yml | 43 ++++++++++++++++++++++++++++++++--------
1 file changed, 35 insertions(+), 8 deletions(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 20503e42..9603c796 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,10 +1,12 @@
-name: golangci-lint
+name: Lint
on:
push:
- branches: [ 'main' ]
+ branches:
+ - main
pull_request:
- branches: [ 'main' ]
+ branches:
+ - main
types:
- opened
- reopened
@@ -12,15 +14,40 @@ on:
- ready_for_review
jobs:
- golangci:
- name: lint
+ lint:
+ name: Lint
runs-on: ubuntu-latest
- if: github.event.pull_request.draft == false
+ if: github.event_name == 'push' && (github.event.pull_request.draft == false || github.event.pull_request == null)
steps:
- - uses: actions/checkout@v5
- - uses: actions/setup-go@v6
+ - name: Checkout code
+ uses: actions/checkout@v5
+
+ - name: Setup Go
+ uses: actions/setup-go@v6
+ with:
+ go-version-file: go.mod
+
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v8
with:
version: latest
args: --config=.golangci.yml
+
+ - name: Install buf CLI
+ uses: bufbuild/buf-setup-action@v1
+ with:
+ version: latest
+
+ - name: Run buf lint
+ run: buf lint
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: latest
+
+ - name: Install markdownlint-cli
+ run: npm install -g markdownlint-cli
+
+ - name: Run markdownlint
+ run: markdownlint '**/*.md' --ignore node_modules
From 0ec7aee463a87c11195445290190de732d01ecbc Mon Sep 17 00:00:00 2001
From: watal
Date: Tue, 15 Apr 2025 16:46:14 +0900
Subject: [PATCH 15/87] chore(ci): apply lint checks to both main and develop
branches
---
.github/workflows/ci.yml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 9603c796..1f5a7301 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -4,9 +4,11 @@ on:
push:
branches:
- main
+ - develop
pull_request:
branches:
- main
+ - develop
types:
- opened
- reopened
@@ -17,7 +19,7 @@ jobs:
lint:
name: Lint
runs-on: ubuntu-latest
- if: github.event_name == 'push' && (github.event.pull_request.draft == false || github.event.pull_request == null)
+ if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false)
steps:
- name: Checkout code
uses: actions/checkout@v5
From 4ab8b095d4f9c6d9c5cf42f09c2ea81f00a4aa26 Mon Sep 17 00:00:00 2001
From: watal
Date: Tue, 15 Apr 2025 17:06:28 +0900
Subject: [PATCH 16/87] chore(ci): add buf.yml
---
buf.yaml | 2 ++
1 file changed, 2 insertions(+)
create mode 100644 buf.yaml
diff --git a/buf.yaml b/buf.yaml
new file mode 100644
index 00000000..8808a922
--- /dev/null
+++ b/buf.yaml
@@ -0,0 +1,2 @@
+version: v1
+name: github.com/nttcom/pola
From 20e1e03639f0feae5bef0b2fc5b99853201051ec Mon Sep 17 00:00:00 2001
From: watal
Date: Wed, 8 Mar 2023 17:16:29 +0900
Subject: [PATCH 17/87] refactor,test(pcep): improve decode/serialization and
add new tests for pcep_util, capability and tlv
---
CREDITS | 33 ++
go.mod | 5 +-
go.sum | 6 +-
pkg/packet/pcep/capability_test.go | 97 ++++++
pkg/packet/pcep/pcep_util.go | 22 +-
pkg/packet/pcep/pcep_util_test.go | 198 +++++++++++
pkg/packet/pcep/tlv.go | 452 ++++++++++++++++--------
pkg/packet/pcep/tlv_test.go | 535 +++++++++++++++++++++++++++++
8 files changed, 1196 insertions(+), 152 deletions(-)
create mode 100644 pkg/packet/pcep/capability_test.go
create mode 100644 pkg/packet/pcep/pcep_util_test.go
create mode 100644 pkg/packet/pcep/tlv_test.go
diff --git a/CREDITS b/CREDITS
index adc34a8f..a68ab975 100644
--- a/CREDITS
+++ b/CREDITS
@@ -2573,6 +2573,39 @@ THE SOFTWARE.
================================================================
+golang.org/x/exp
+https://golang.org/x/exp
+----------------------------------------------------------------
+Copyright 2009 The Go Authors.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google LLC nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+================================================================
+
golang.org/x/net
https://golang.org/x/net
----------------------------------------------------------------
diff --git a/go.mod b/go.mod
index 64f5c189..4f009320 100644
--- a/go.mod
+++ b/go.mod
@@ -3,10 +3,11 @@ module github.com/nttcom/pola
go 1.24.2
require (
- github.com/golang/protobuf v1.5.4
github.com/osrg/gobgp/v3 v3.37.0
github.com/spf13/cobra v1.10.1
+ github.com/stretchr/testify v1.11.1
go.uber.org/zap v1.27.0
+ golang.org/x/exp v0.0.0-20251017212417-90e834f514db
google.golang.org/grpc v1.76.0
google.golang.org/protobuf v1.36.10
gopkg.in/yaml.v2 v2.4.0
@@ -14,7 +15,9 @@ require (
)
require (
+ github.com/davecgh/go-spew v1.1.1 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
+ github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/pflag v1.0.9 // indirect
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/net v0.42.0 // indirect
diff --git a/go.sum b/go.sum
index 303dd379..d32a8a74 100644
--- a/go.sum
+++ b/go.sum
@@ -22,8 +22,8 @@ github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s=
github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0=
github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY=
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
-github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
-github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
+github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
+github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ=
@@ -42,6 +42,8 @@ go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
+golang.org/x/exp v0.0.0-20251017212417-90e834f514db h1:by6IehL4BH5k3e3SJmcoNbOobMey2SLpAF79iPOEBvw=
+golang.org/x/exp v0.0.0-20251017212417-90e834f514db/go.mod h1:j/pmGrbnkbPtQfxEe5D0VQhZC6qKbfKifgD0oM7sR70=
golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs=
golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8=
golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA=
diff --git a/pkg/packet/pcep/capability_test.go b/pkg/packet/pcep/capability_test.go
new file mode 100644
index 00000000..505acfa9
--- /dev/null
+++ b/pkg/packet/pcep/capability_test.go
@@ -0,0 +1,97 @@
+// Copyright (c) 2022 NTT Communications Corporation
+//
+// This software is released under the MIT License.
+// see https://github.com/nttcom/pola/blob/main/LICENSE
+
+package pcep
+
+import (
+ "reflect"
+ "testing"
+)
+
+func TestPolaCapability(t *testing.T) {
+ tests := []struct {
+ name string
+ input []CapabilityInterface
+ expected []CapabilityInterface
+ }{
+ {
+ name: "Basic Capability Test",
+ input: []CapabilityInterface{
+ &StatefulPCECapability{
+ LSPUpdateCapability: false,
+ IncludeDBVersion: true,
+ LSPInstantiationCapability: false,
+ TriggeredResync: true,
+ DeltaLSPSyncCapability: true,
+ TriggeredInitialSync: true,
+ },
+ &PathSetupTypeCapability{
+ PathSetupTypes: Psts{PathSetupTypeRSVPTE, PathSetupTypeSRTE, PathSetupTypeSRv6TE},
+ SubTLVs: []TLVInterface{
+ &SRPCECapability{
+ HasUnlimitedMaxSIDDepth: false,
+ IsNAISupported: false,
+ MaximumSidDepth: uint8(16),
+ },
+ },
+ },
+ &SRPCECapability{
+ HasUnlimitedMaxSIDDepth: false,
+ IsNAISupported: false,
+ MaximumSidDepth: uint8(16),
+ },
+ &AssocTypeList{
+ AssocTypes: []AssocType{AssocTypePathProtectionAssociation, AssocTypeSRPolicyAssociation},
+ },
+ },
+ expected: []CapabilityInterface{
+ &StatefulPCECapability{
+ LSPUpdateCapability: true,
+ IncludeDBVersion: false,
+ LSPInstantiationCapability: true,
+ TriggeredResync: false,
+ DeltaLSPSyncCapability: false,
+ TriggeredInitialSync: false,
+ P2mpCapability: false,
+ P2mpLSPUpdateCapability: false,
+ P2mpLSPInstantiationCapability: false,
+ LSPSchedulingCapability: false,
+ PdLSPCapability: false,
+ ColorCapability: true,
+ PathRecomputationCapability: false,
+ StrictPathCapability: false,
+ Relax: false,
+ },
+ &PathSetupTypeCapability{
+ PathSetupTypes: Psts{PathSetupTypeRSVPTE, PathSetupTypeSRTE, PathSetupTypeSRv6TE},
+ SubTLVs: []TLVInterface{
+ &SRPCECapability{
+ HasUnlimitedMaxSIDDepth: false,
+ IsNAISupported: false,
+ MaximumSidDepth: uint8(16),
+ },
+ },
+ },
+ &SRPCECapability{
+ HasUnlimitedMaxSIDDepth: false,
+ IsNAISupported: false,
+ MaximumSidDepth: uint8(16),
+ },
+ &AssocTypeList{
+ AssocTypes: []AssocType{AssocTypePathProtectionAssociation, AssocTypeSRPolicyAssociation},
+ },
+ },
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ result := PolaCapability(tt.input)
+ if !reflect.DeepEqual(result, tt.expected) {
+ t.Fatalf("%s: expected %+v, got %+v", tt.name, tt.expected, result)
+ }
+ })
+ }
+}
diff --git a/pkg/packet/pcep/pcep_util.go b/pkg/packet/pcep/pcep_util.go
index a5fa3f0e..80ff0a4a 100644
--- a/pkg/packet/pcep/pcep_util.go
+++ b/pkg/packet/pcep/pcep_util.go
@@ -5,7 +5,11 @@
package pcep
-import "encoding/binary"
+import (
+ "encoding/binary"
+
+ "golang.org/x/exp/constraints"
+)
// AppendByteSlices concatenates byte slices into a single slice.
func AppendByteSlices(byteSlices ...[]byte) []byte {
@@ -37,3 +41,19 @@ func Uint32ToByteSlice(input uint32) []byte {
binary.BigEndian.PutUint32(uint32Bytes, input)
return uint32Bytes
}
+
+// Bitwise is a type constraint for unsigned integer types (uint8, uint16, uint32).
+type Bitwise interface {
+ constraints.Unsigned
+ ~uint8 | ~uint16 | ~uint32
+}
+
+// IsBitSet checks if a bit is set, with bit 0 as the least significant bit (LSB).
+func IsBitSet[T Bitwise](value, mask T) bool {
+ return value&mask != 0
+}
+
+// SetBit sets a specific bit in a value of any unsigned integer type.
+func SetBit[T Bitwise](value, bit T) T {
+ return value | bit
+}
diff --git a/pkg/packet/pcep/pcep_util_test.go b/pkg/packet/pcep/pcep_util_test.go
new file mode 100644
index 00000000..2c7f51a1
--- /dev/null
+++ b/pkg/packet/pcep/pcep_util_test.go
@@ -0,0 +1,198 @@
+// Copyright (c) 2022 NTT Communications Corporation
+//
+// This software is released under the MIT License.
+// see https://github.com/nttcom/pola/blob/main/LICENSE
+
+package pcep
+
+import (
+ "bytes"
+ "testing"
+)
+
+func TestAppendByteSlices(t *testing.T) {
+ tests := []struct {
+ name string
+ input [][]byte
+ expected []byte
+ }{
+ {
+ name: "Concatenate non-empty slices",
+ input: [][]byte{{0x01, 0x02}, {0x03, 0x04, 0x05}},
+ expected: []byte{0x01, 0x02, 0x03, 0x04, 0x05},
+ },
+ {
+ name: "Concatenate empty slices",
+ input: [][]byte{{}, {}},
+ expected: []byte{},
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ result := AppendByteSlices(tt.input...)
+ if !bytes.Equal(result, tt.expected) {
+ t.Errorf("expected %v, got %v", tt.expected, result)
+ }
+ })
+ }
+}
+
+func TestUint16ToByteSlice(t *testing.T) {
+ tests := []struct {
+ name string
+ input uint16
+ expected []byte
+ }{
+ {
+ name: "Convert 0x0102 to bytes",
+ input: 0x0102,
+ expected: []byte{0x01, 0x02},
+ },
+ {
+ name: "Convert 0xFFFF to bytes",
+ input: 0xFFFF,
+ expected: []byte{0xFF, 0xFF},
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ result := Uint16ToByteSlice(tt.input)
+ if !bytes.Equal(result, tt.expected) {
+ t.Errorf("expected %v, got %v", tt.expected, result)
+ }
+ })
+ }
+}
+
+func TestUint32ToByteSlice(t *testing.T) {
+ tests := []struct {
+ name string
+ input uint32
+ expected []byte
+ }{
+ {
+ name: "Convert 0x01020304 to bytes",
+ input: 0x01020304,
+ expected: []byte{0x01, 0x02, 0x03, 0x04},
+ },
+ {
+ name: "Convert 0xFFFFFFFF to bytes",
+ input: 0xFFFFFFFF,
+ expected: []byte{0xFF, 0xFF, 0xFF, 0xFF},
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ result := Uint32ToByteSlice(tt.input)
+ if !bytes.Equal(result, tt.expected) {
+ t.Errorf("expected %v, got %v", tt.expected, result)
+ }
+ })
+ }
+}
+
+func TestIsBitSet(t *testing.T) {
+ type testCase[T Bitwise] struct {
+ name string
+ value T
+ mask T
+ expected bool
+ }
+
+ t.Run("uint8", func(t *testing.T) {
+ tests := []testCase[uint8]{
+ {"bit 0 set", 0x01, 0x01, true},
+ {"bit 1 set", 0x03, 0x02, true},
+ {"bit 2 not set", 0x03, 0x04, false},
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if got := IsBitSet(tt.value, tt.mask); got != tt.expected {
+ t.Errorf("expected %v, got %v", tt.expected, got)
+ }
+ })
+ }
+ })
+
+ t.Run("uint16", func(t *testing.T) {
+ tests := []testCase[uint16]{
+ {"bit 8 set", 0x0100, 0x0100, true},
+ {"bit 9 set", 0x0201, 0x0200, true},
+ {"bit 10 not set", 0x0201, 0x0400, false},
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if got := IsBitSet(tt.value, tt.mask); got != tt.expected {
+ t.Errorf("expected %v, got %v", tt.expected, got)
+ }
+ })
+ }
+ })
+
+ t.Run("uint32", func(t *testing.T) {
+ tests := []testCase[uint32]{
+ {"bit 16 set", 0x00010000, 0x00010000, true},
+ {"bit 17 set", 0x00020001, 0x00020000, true},
+ {"bit 18 not set", 0x00020001, 0x00040000, false},
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ if got := IsBitSet(tt.value, tt.mask); got != tt.expected {
+ t.Errorf("expected %v, got %v", tt.expected, got)
+ }
+ })
+ }
+ })
+}
+
+func TestSetBit(t *testing.T) {
+ tests := []struct {
+ name string
+ value uint8
+ bit uint8
+ expected uint8
+ }{
+ {
+ name: "Set bit 0",
+ value: 0x00,
+ bit: 0x01,
+ expected: 0x01,
+ },
+ {
+ name: "Set bit 1",
+ value: 0x00,
+ bit: 0x02,
+ expected: 0x02,
+ },
+ {
+ name: "Set bit 0 when bit 0 is already set",
+ value: 0x01,
+ bit: 0x01,
+ expected: 0x01,
+ },
+ {
+ name: "Set bit 1 when bit 0 is already set",
+ value: 0x01,
+ bit: 0x02,
+ expected: 0x03,
+ },
+ {
+ name: "Set bit 0 when bit 1 is already set",
+ value: 0x02,
+ bit: 0x01,
+ expected: 0x03,
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ result := SetBit(tt.value, tt.bit)
+ if result != tt.expected {
+ t.Errorf("Test %s failed: expected %v, got %v", tt.name, tt.expected, result)
+ }
+ })
+ }
+}
diff --git a/pkg/packet/pcep/tlv.go b/pkg/packet/pcep/tlv.go
index 8016d417..faf3179e 100644
--- a/pkg/packet/pcep/tlv.go
+++ b/pkg/packet/pcep/tlv.go
@@ -191,6 +191,9 @@ var tlvMap = map[TLVType]func() TLVInterface{
TLVColor: func() TLVInterface { return &Color{} },
}
+const TLVHeaderLength = 4
+
+// TLV value lengths (in bytes), excluding the 4-byte TLV header (type + length)
const (
TLVStatefulPCECapabilityValueLength uint16 = 4
TLVLSPDBVersionValueLength uint16 = 8
@@ -223,8 +226,6 @@ const (
SubTLVPreferenceCiscoValueLength uint16 = 4
)
-const TLVHeaderLength = 4
-
type TLVInterface interface {
DecodeFromBytes(data []uint8) error
Serialize() []uint8
@@ -251,81 +252,54 @@ type StatefulPCECapability struct {
Relax bool // 17
}
-func (tlv *StatefulPCECapability) DecodeFromBytes(flags []uint8) error {
- if len(flags) < 4 {
- return fmt.Errorf("flags array is too short, expected at least 4 bytes but got %d", len(flags))
- }
+const (
+ LSPUpdateCapabilityBit uint32 = 0x01
+ IncludeDBVersionCapabilityBit uint32 = 0x02
+ LSPInstantiationCapabilityBit uint32 = 0x04
+ TriggeredResyncCapabilityBit uint32 = 0x08
+ DeltaLSPSyncCapabilityBit uint32 = 0x10
+ TriggeredInitialSyncBit uint32 = 0x20
+)
- flagMap := []struct {
- field *bool
- mask uint8
- index int
- }{
- {&tlv.LSPUpdateCapability, 0x01, 3},
- {&tlv.IncludeDBVersion, 0x02, 3},
- {&tlv.LSPInstantiationCapability, 0x04, 3},
- {&tlv.TriggeredResync, 0x08, 3},
- {&tlv.DeltaLSPSyncCapability, 0x10, 3},
- {&tlv.TriggeredInitialSync, 0x20, 3},
- {&tlv.P2mpCapability, 0x40, 3},
- {&tlv.P2mpLSPUpdateCapability, 0x80, 3},
- {&tlv.P2mpLSPInstantiationCapability, 0x01, 2},
- {&tlv.LSPSchedulingCapability, 0x02, 2},
- {&tlv.PdLSPCapability, 0x04, 2},
- {&tlv.ColorCapability, 0x08, 2},
- {&tlv.PathRecomputationCapability, 0x10, 2},
- {&tlv.StrictPathCapability, 0x20, 2},
- {&tlv.Relax, 0x40, 2},
- }
+const (
+ StatefulPCECapabilityFlagsIndex = 3
+)
- for _, f := range flagMap {
- *f.field = (flags[f.index] & f.mask) != 0
+func (tlv *StatefulPCECapability) DecodeFromBytes(data []uint8) error {
+ if len(data) < int(tlv.Len()) {
+ return fmt.Errorf("data is too short: expected at least %d bytes, but got %d bytes for StatefulPCECapability", tlv.Len(), len(data))
}
+ flagByte := uint32(data[TLVHeaderLength+StatefulPCECapabilityFlagsIndex])
+ tlv.LSPUpdateCapability = IsBitSet(flagByte, LSPUpdateCapabilityBit)
+ tlv.IncludeDBVersion = IsBitSet(flagByte, IncludeDBVersionCapabilityBit)
+ tlv.LSPInstantiationCapability = IsBitSet(flagByte, LSPInstantiationCapabilityBit)
+ tlv.TriggeredResync = IsBitSet(flagByte, TriggeredResyncCapabilityBit)
+ tlv.DeltaLSPSyncCapability = IsBitSet(flagByte, DeltaLSPSyncCapabilityBit)
+ tlv.TriggeredInitialSync = IsBitSet(flagByte, TriggeredInitialSyncBit)
+
return nil
}
-func setFlag(flags []uint8, index int, mask uint8, condition bool) {
- if condition {
- flags[index] = flags[index] | mask
- }
-}
+func (tlv *StatefulPCECapability) Serialize() []byte {
+ buf := make([]byte, 0, TLVHeaderLength+TLVStatefulPCECapabilityValueLength)
+ buf = append(buf, byte(tlv.Type()>>8), byte(tlv.Type()))
+ buf = append(buf, byte(TLVStatefulPCECapabilityValueLength>>8), byte(TLVStatefulPCECapabilityValueLength))
-func (tlv *StatefulPCECapability) Serialize() []uint8 {
- buf := []uint8{}
-
- typ := make([]uint8, 2)
- binary.BigEndian.PutUint16(typ, uint16(tlv.Type()))
- buf = append(buf, typ...)
-
- length := make([]uint8, 2)
- binary.BigEndian.PutUint16(length, TLVStatefulPCECapabilityValueLength)
- buf = append(buf, length...)
-
- flags := make([]uint8, TLVStatefulPCECapabilityValueLength)
-
- setFlag(flags, 3, 0x01, tlv.LSPUpdateCapability)
- setFlag(flags, 3, 0x02, tlv.IncludeDBVersion)
- setFlag(flags, 3, 0x04, tlv.LSPInstantiationCapability)
- setFlag(flags, 3, 0x08, tlv.TriggeredResync)
- setFlag(flags, 3, 0x10, tlv.DeltaLSPSyncCapability)
- setFlag(flags, 3, 0x20, tlv.TriggeredInitialSync)
- setFlag(flags, 3, 0x40, tlv.P2mpCapability)
- setFlag(flags, 3, 0x80, tlv.P2mpLSPUpdateCapability)
- setFlag(flags, 2, 0x01, tlv.P2mpLSPInstantiationCapability)
- setFlag(flags, 2, 0x02, tlv.LSPSchedulingCapability)
- setFlag(flags, 2, 0x04, tlv.PdLSPCapability)
- setFlag(flags, 2, 0x08, tlv.ColorCapability)
- setFlag(flags, 2, 0x10, tlv.PathRecomputationCapability)
- setFlag(flags, 2, 0x20, tlv.StrictPathCapability)
- setFlag(flags, 2, 0x40, tlv.Relax)
-
- buf = append(buf, flags...)
+ val := make([]byte, TLVStatefulPCECapabilityValueLength)
+ binary.BigEndian.PutUint32(val, tlv.CapabilityBits())
+ buf = append(buf, val...)
return buf
}
func (tlv *StatefulPCECapability) MarshalLogObject(enc zapcore.ObjectEncoder) error {
+ enc.AddBool("lspUpdateCapability", tlv.LSPUpdateCapability)
+ enc.AddBool("includeDBVersion", tlv.IncludeDBVersion)
+ enc.AddBool("lspInstantiationCapability", tlv.LSPInstantiationCapability)
+ enc.AddBool("triggeredResync", tlv.TriggeredResync)
+ enc.AddBool("deltaLSPSyncCapability", tlv.DeltaLSPSyncCapability)
+ enc.AddBool("triggeredInitialSync", tlv.TriggeredInitialSync)
return nil
}
@@ -338,8 +312,7 @@ func (tlv *StatefulPCECapability) Len() uint16 {
}
func (tlv *StatefulPCECapability) CapStrings() []string {
- ret := []string{}
- ret = append(ret, "Stateful")
+ ret := []string{"Stateful"}
if tlv.LSPUpdateCapability {
ret = append(ret, "Update")
}
@@ -347,16 +320,16 @@ func (tlv *StatefulPCECapability) CapStrings() []string {
ret = append(ret, "Include-DB-Ver")
}
if tlv.LSPInstantiationCapability {
- ret = append(ret, "Initiate")
+ ret = append(ret, "Instantiation")
}
if tlv.TriggeredResync {
- ret = append(ret, "Triggerd-Resync")
+ ret = append(ret, "Triggered-Resync")
}
if tlv.DeltaLSPSyncCapability {
ret = append(ret, "Delta-LSP-Sync")
}
if tlv.TriggeredInitialSync {
- ret = append(ret, "Triggerd-init-sync")
+ ret = append(ret, "Triggered-Initial-Sync")
}
if tlv.ColorCapability {
ret = append(ret, "Color")
@@ -364,39 +337,77 @@ func (tlv *StatefulPCECapability) CapStrings() []string {
return ret
}
+func (tlv *StatefulPCECapability) FromBits(bits uint32) {
+ tlv.LSPUpdateCapability = bits&LSPUpdateCapabilityBit != 0
+ tlv.IncludeDBVersion = bits&IncludeDBVersionCapabilityBit != 0
+ tlv.LSPInstantiationCapability = bits&LSPInstantiationCapabilityBit != 0
+ tlv.TriggeredResync = bits&TriggeredResyncCapabilityBit != 0
+ tlv.DeltaLSPSyncCapability = bits&DeltaLSPSyncCapabilityBit != 0
+ tlv.TriggeredInitialSync = bits&TriggeredInitialSyncBit != 0
+}
+
+func NewStatefulPCECapability(bits uint32) *StatefulPCECapability {
+ tlv := &StatefulPCECapability{}
+ tlv.FromBits(bits)
+ return tlv
+}
+
+func (tlv *StatefulPCECapability) CapabilityBits() uint32 {
+ var flags uint32
+ if tlv.LSPUpdateCapability {
+ flags = SetBit(flags, LSPUpdateCapabilityBit)
+ }
+ if tlv.IncludeDBVersion {
+ flags = SetBit(flags, IncludeDBVersionCapabilityBit)
+ }
+ if tlv.LSPInstantiationCapability {
+ flags = SetBit(flags, LSPInstantiationCapabilityBit)
+ }
+ if tlv.TriggeredResync {
+ flags = SetBit(flags, TriggeredResyncCapabilityBit)
+ }
+ if tlv.DeltaLSPSyncCapability {
+ flags = SetBit(flags, DeltaLSPSyncCapabilityBit)
+ }
+ if tlv.TriggeredInitialSync {
+ flags = SetBit(flags, TriggeredInitialSyncBit)
+ }
+ return flags
+}
+
type SymbolicPathName struct {
Name string
}
-func (tlv *SymbolicPathName) DecodeFromBytes(data []uint8) error {
+func (tlv *SymbolicPathName) DecodeFromBytes(data []byte) error {
+ if len(data) < TLVHeaderLength {
+ return fmt.Errorf("data is too short: expected at least %d bytes, but got %d bytes for SymbolicPathName", TLVHeaderLength, len(data))
+ }
+
length := binary.BigEndian.Uint16(data[2:4])
- tlv.Name = string(data[4 : 4+length])
+ totalLength := int(TLVHeaderLength + length)
+ if len(data) != totalLength {
+ return fmt.Errorf("data length mismatch: expected %d bytes, but got %d bytes for SymbolicPathName", totalLength, len(data))
+ }
+
+ tlv.Name = string(data[TLVHeaderLength:totalLength])
return nil
}
-func (tlv *SymbolicPathName) Serialize() []uint8 {
- buf := []uint8{}
-
- typ := make([]uint8, 2)
- binary.BigEndian.PutUint16(typ, uint16(tlv.Type()))
- buf = append(buf, typ...)
-
- l := uint16(len(tlv.Name))
- length := make([]uint8, 2)
- binary.BigEndian.PutUint16(length, l)
- buf = append(buf, length...)
+func (tlv *SymbolicPathName) Serialize() []byte {
+ nameLen := uint16(len(tlv.Name))
+ padding := (4 - (nameLen % 4)) % 4 // Padding for 4-byte alignment
- buf = append(buf, []uint8(tlv.Name)...)
+ buf := make([]byte, 0, TLVHeaderLength+int(nameLen)+int(padding))
+ buf = append(buf, Uint16ToByteSlice(uint16(tlv.Type()))...)
+ buf = append(buf, Uint16ToByteSlice(nameLen)...)
+ buf = append(buf, []byte(tlv.Name)...)
- if l%4 != 0 {
- pad := make([]uint8, 4-l%4)
- buf = append(buf, pad...)
+ if padding > 0 {
+ buf = append(buf, make([]byte, padding)...)
}
- return buf
-}
-func (tlv *SymbolicPathName) MarshalLogObject(enc zapcore.ObjectEncoder) error {
- return nil
+ return buf
}
func (tlv *SymbolicPathName) Type() TLVType {
@@ -404,12 +415,22 @@ func (tlv *SymbolicPathName) Type() TLVType {
}
func (tlv *SymbolicPathName) Len() uint16 {
- l := uint16(len(tlv.Name))
+ length := uint16(len(tlv.Name))
padding := uint16(0)
- if l%4 != 0 {
- padding = (4 - l%4)
+ if mod := length % 4; mod != 0 {
+ padding = 4 - mod
}
- return TLVHeaderLength + l + padding
+
+ return TLVHeaderLength + length + padding
+}
+
+func (tlv *SymbolicPathName) MarshalLogObject(enc zapcore.ObjectEncoder) error {
+ enc.AddString("symbolicPathName", tlv.Name)
+ return nil
+}
+
+func NewSymbolicPathName(name string) *SymbolicPathName {
+ return &SymbolicPathName{Name: name}
}
type IPv4LSPIdentifiers struct {
@@ -417,21 +438,58 @@ type IPv4LSPIdentifiers struct {
IPv4TunnelEndpointAddress netip.Addr
LSPID uint16
TunnelID uint16
+ ExtendedTunnelID uint32
}
+const (
+ IPv4LSPIdentifiersTunnelSenderAddressIndex = 4
+ IPv4LSPIdentifiersLSPIDIndex = 6
+ IPv4LSPIdentifiersTunnelIDIndex = 8
+ IPv4LSPIdentifiersExtendedTunnelIDIndex = 12
+)
+
func (tlv *IPv4LSPIdentifiers) DecodeFromBytes(data []uint8) error {
+ expectedLength := TLVHeaderLength + int(TLVIPv4LSPIdentifiersValueLength)
+ if len(data) != expectedLength {
+ return fmt.Errorf("data length mismatch: expected %d bytes, but got %d bytes for IPv4LSPIdentifiers", expectedLength, len(data))
+ }
+
var ok bool
- if tlv.IPv4TunnelSenderAddress, ok = netip.AddrFromSlice(data[12:16]); !ok {
- tlv.IPv4TunnelSenderAddress, _ = netip.AddrFromSlice(data[4:8])
+ if tlv.IPv4TunnelSenderAddress, ok = netip.AddrFromSlice(data[TLVHeaderLength : TLVHeaderLength+IPv4LSPIdentifiersTunnelSenderAddressIndex]); !ok {
+ return fmt.Errorf("failed to parse IPv4TunnelSenderAddress")
}
- tlv.LSPID = binary.BigEndian.Uint16(data[8:10])
- tlv.TunnelID = binary.BigEndian.Uint16(data[10:12])
- tlv.IPv4TunnelEndpointAddress, _ = netip.AddrFromSlice(data[16:20])
+
+ tlv.LSPID = binary.BigEndian.Uint16(data[TLVHeaderLength+IPv4LSPIdentifiersTunnelSenderAddressIndex : TLVHeaderLength+IPv4LSPIdentifiersLSPIDIndex])
+ tlv.TunnelID = binary.BigEndian.Uint16(data[TLVHeaderLength+IPv4LSPIdentifiersLSPIDIndex : TLVHeaderLength+IPv4LSPIdentifiersTunnelIDIndex])
+ tlv.ExtendedTunnelID = binary.BigEndian.Uint32(data[TLVHeaderLength+IPv4LSPIdentifiersTunnelIDIndex : TLVHeaderLength+IPv4LSPIdentifiersExtendedTunnelIDIndex])
+
+ if tlv.IPv4TunnelEndpointAddress, ok = netip.AddrFromSlice(data[TLVHeaderLength+IPv4LSPIdentifiersExtendedTunnelIDIndex : TLVHeaderLength+TLVIPv4LSPIdentifiersValueLength]); !ok {
+ return fmt.Errorf("failed to parse IPv4TunnelEndpointAddress")
+ }
+
return nil
}
func (tlv *IPv4LSPIdentifiers) Serialize() []uint8 {
- return nil
+ buf := make([]uint8, 0, TLVHeaderLength+TLVIPv4LSPIdentifiersValueLength)
+
+ typ := make([]uint8, 2)
+ binary.BigEndian.PutUint16(typ, uint16(tlv.Type()))
+ buf = append(buf, typ...)
+
+ length := make([]uint8, 2)
+ binary.BigEndian.PutUint16(length, TLVIPv4LSPIdentifiersValueLength)
+ buf = append(buf, length...)
+
+ val := make([]byte, TLVIPv4LSPIdentifiersValueLength)
+ copy(val[0:4], tlv.IPv4TunnelSenderAddress.AsSlice())
+ binary.BigEndian.PutUint16(val[4:6], tlv.LSPID)
+ binary.BigEndian.PutUint16(val[6:8], tlv.TunnelID)
+ binary.BigEndian.PutUint32(val[8:12], tlv.ExtendedTunnelID)
+ copy(val[12:16], tlv.IPv4TunnelEndpointAddress.AsSlice())
+ buf = append(buf, val...)
+
+ return buf
}
func (tlv *IPv4LSPIdentifiers) MarshalLogObject(enc zapcore.ObjectEncoder) error {
@@ -446,23 +504,58 @@ func (tlv *IPv4LSPIdentifiers) Len() uint16 {
return TLVHeaderLength + TLVIPv4LSPIdentifiersValueLength
}
+func NewIPv4LSPIdentifiers(senderAddr, endpointAddr netip.Addr, lspID, tunnelID uint16, extendedTunnelID uint32) *IPv4LSPIdentifiers {
+ return &IPv4LSPIdentifiers{
+ IPv4TunnelSenderAddress: senderAddr,
+ IPv4TunnelEndpointAddress: endpointAddr,
+ LSPID: lspID,
+ TunnelID: tunnelID,
+ ExtendedTunnelID: extendedTunnelID,
+ }
+}
+
type IPv6LSPIdentifiers struct {
IPv6TunnelSenderAddress netip.Addr
IPv6TunnelEndpointAddress netip.Addr
LSPID uint16
TunnelID uint16
+ ExtendedTunnelID [16]byte
}
func (tlv *IPv6LSPIdentifiers) DecodeFromBytes(data []uint8) error {
- tlv.IPv6TunnelSenderAddress, _ = netip.AddrFromSlice(data[4:20])
+ expectedLength := TLVHeaderLength + int(TLVIPv6LSPIdentifiersValueLength)
+ if len(data) != expectedLength {
+ return fmt.Errorf("data length mismatch: expected %d bytes, but got %d bytes for IPv6LSPIdentifiers", expectedLength, len(data))
+ }
+
+ var ok bool
+ if tlv.IPv6TunnelSenderAddress, ok = netip.AddrFromSlice(data[4:20]); !ok {
+ return fmt.Errorf("failed to parse IPv6TunnelSenderAddress")
+ }
+
tlv.LSPID = binary.BigEndian.Uint16(data[20:22])
tlv.TunnelID = binary.BigEndian.Uint16(data[22:24])
- tlv.IPv6TunnelEndpointAddress, _ = netip.AddrFromSlice(data[40:56])
+ copy(tlv.ExtendedTunnelID[:], data[24:40])
+
+ if tlv.IPv6TunnelEndpointAddress, ok = netip.AddrFromSlice(data[40:56]); !ok {
+ return fmt.Errorf("failed to parse IPv6TunnelEndpointAddress")
+ }
+
return nil
}
func (tlv *IPv6LSPIdentifiers) Serialize() []uint8 {
- return nil
+ buf := make([]uint8, tlv.Len())
+
+ binary.BigEndian.PutUint16(buf[0:2], uint16(tlv.Type()))
+ binary.BigEndian.PutUint16(buf[2:4], TLVIPv6LSPIdentifiersValueLength)
+ copy(buf[4:20], tlv.IPv6TunnelSenderAddress.AsSlice())
+ binary.BigEndian.PutUint16(buf[20:22], tlv.LSPID)
+ binary.BigEndian.PutUint16(buf[22:24], tlv.TunnelID)
+ copy(buf[24:40], tlv.ExtendedTunnelID[:])
+ copy(buf[40:56], tlv.IPv6TunnelEndpointAddress.AsSlice())
+
+ return buf
}
func (tlv *IPv6LSPIdentifiers) MarshalLogObject(enc zapcore.ObjectEncoder) error {
@@ -477,11 +570,26 @@ func (tlv *IPv6LSPIdentifiers) Len() uint16 {
return TLVHeaderLength + TLVIPv6LSPIdentifiersValueLength
}
+func NewIPv6LSPIdentifiers(senderAddr, endpointAddr netip.Addr, lspID, tunnelID uint16, extendedTunnelID [16]byte) *IPv6LSPIdentifiers {
+ return &IPv6LSPIdentifiers{
+ IPv6TunnelSenderAddress: senderAddr,
+ IPv6TunnelEndpointAddress: endpointAddr,
+ LSPID: lspID,
+ TunnelID: tunnelID,
+ ExtendedTunnelID: extendedTunnelID,
+ }
+}
+
type LSPDBVersion struct {
VersionNumber uint64
}
func (tlv *LSPDBVersion) DecodeFromBytes(data []uint8) error {
+ expectedLength := TLVHeaderLength + int(TLVLSPDBVersionValueLength)
+ if len(data) != expectedLength {
+ return fmt.Errorf("data length mismatch: expected %d bytes, but got %d bytes for LSPDBVersion", expectedLength, len(data))
+ }
+
tlv.VersionNumber = binary.BigEndian.Uint64(data[4:12])
return nil
}
@@ -520,44 +628,77 @@ func (tlv *LSPDBVersion) CapStrings() []string {
return []string{"LSP-DB-VERSION"}
}
+func NewLSPDBVersion(version uint64) *LSPDBVersion {
+ return &LSPDBVersion{
+ VersionNumber: version,
+ }
+}
+
type SRPCECapability struct {
- UnlimitedMSD bool
- SupportNAI bool
- MaximumSidDepth uint8
+ HasUnlimitedMaxSIDDepth bool
+ IsNAISupported bool
+ MaximumSidDepth uint8
}
-func (tlv *SRPCECapability) DecodeFromBytes(data []uint8) error {
- tlv.UnlimitedMSD = (data[6] & 0x01) != 0
- tlv.SupportNAI = (data[6] & 0x02) != 0
- tlv.MaximumSidDepth = data[7]
+const (
+ UnlimitedMaximumSIDDepthFlag uint8 = 0x01
+ NAISupportedFlag uint8 = 0x02
+)
+
+const (
+ SRPCECapabilityFlagsIndex = 2
+ SRPCECapabilityMSDIndex = 3
+)
+
+func (tlv *SRPCECapability) DecodeFromBytes(data []byte) error {
+ expectedLength := TLVHeaderLength + int(TLVSRPCECapabilityValueLength)
+ if len(data) != expectedLength {
+ return fmt.Errorf("data length mismatch: expected %d bytes, but got %d bytes for SRPCECapability", expectedLength, len(data))
+ }
+
+ // Extract TLV value field (after 4-byte TLV header)
+ val := data[TLVHeaderLength:]
+
+ if len(val) != int(TLVSRPCECapabilityValueLength) {
+ return fmt.Errorf("invalid value length for SRPCECapability: expected %d bytes, but got %d bytes", TLVSRPCECapabilityValueLength, len(val))
+ }
+
+ flags := val[SRPCECapabilityFlagsIndex]
+ tlv.HasUnlimitedMaxSIDDepth = IsBitSet(flags, UnlimitedMaximumSIDDepthFlag)
+ tlv.IsNAISupported = IsBitSet(flags, NAISupportedFlag)
+ tlv.MaximumSidDepth = val[SRPCECapabilityMSDIndex]
+
return nil
}
-func (tlv *SRPCECapability) Serialize() []uint8 {
- buf := []uint8{}
+func (tlv *SRPCECapability) Serialize() []byte {
+ buf := make([]byte, 0, TLVHeaderLength+TLVSRPCECapabilityValueLength)
- typ := make([]uint8, 2)
+ typ := make([]byte, 2)
binary.BigEndian.PutUint16(typ, uint16(tlv.Type()))
buf = append(buf, typ...)
- length := make([]uint8, 2)
+ length := make([]byte, 2)
binary.BigEndian.PutUint16(length, TLVSRPCECapabilityValueLength)
buf = append(buf, length...)
- val := make([]uint8, TLVSRPCECapabilityValueLength)
- if tlv.UnlimitedMSD {
- val[2] = val[2] | 0x01
+ val := make([]byte, TLVSRPCECapabilityValueLength)
+ if tlv.HasUnlimitedMaxSIDDepth {
+ val[SRPCECapabilityFlagsIndex] = SetBit(val[SRPCECapabilityFlagsIndex], UnlimitedMaximumSIDDepthFlag)
}
- if tlv.SupportNAI {
- val[2] = val[2] | 0x02
+ if tlv.IsNAISupported {
+ val[SRPCECapabilityFlagsIndex] = SetBit(val[SRPCECapabilityFlagsIndex], NAISupportedFlag)
}
- val[3] = tlv.MaximumSidDepth
+ val[SRPCECapabilityMSDIndex] = tlv.MaximumSidDepth
buf = append(buf, val...)
return buf
}
func (tlv *SRPCECapability) MarshalLogObject(enc zapcore.ObjectEncoder) error {
+ enc.AddBool("unlimited_max_sid_depth", tlv.HasUnlimitedMaxSIDDepth)
+ enc.AddBool("nai_is_supported", tlv.IsNAISupported)
+ enc.AddUint8("maximum_sid_depth", tlv.MaximumSidDepth)
return nil
}
@@ -570,7 +711,22 @@ func (tlv *SRPCECapability) Len() uint16 {
}
func (tlv *SRPCECapability) CapStrings() []string {
- return []string{"SR-TE"}
+ var ret []string
+ if tlv.HasUnlimitedMaxSIDDepth {
+ ret = append(ret, "Unlimited-SID-Depth")
+ }
+ if tlv.IsNAISupported {
+ ret = append(ret, "NAI-Supported")
+ }
+ return ret
+}
+
+func NewSRPCECapability(hasUnlimitedMaxSIDDepth bool, isNAISupported bool, maximumSidDepth uint8) *SRPCECapability {
+ return &SRPCECapability{
+ HasUnlimitedMaxSIDDepth: hasUnlimitedMaxSIDDepth,
+ IsNAISupported: isNAISupported,
+ MaximumSidDepth: maximumSidDepth,
+ }
}
type Pst uint8
@@ -658,11 +814,11 @@ type ExtendedAssociationID struct {
}
func (tlv *ExtendedAssociationID) DecodeFromBytes(data []uint8) error {
- l := binary.BigEndian.Uint16(data[2:4])
+ length := binary.BigEndian.Uint16(data[2:4])
tlv.Color = binary.BigEndian.Uint32(data[4:8])
- switch l {
+ switch length {
case TLVExtendedAssociationIDIPv4ValueLength:
tlv.Endpoint, _ = netip.AddrFromSlice(data[8:12])
case TLVExtendedAssociationIDIPv6ValueLength:
@@ -719,7 +875,7 @@ type PathSetupTypeCapability struct {
}
func (tlv *PathSetupTypeCapability) DecodeFromBytes(data []uint8) error {
- l := binary.BigEndian.Uint16(data[2:4])
+ length := binary.BigEndian.Uint16(data[2:4])
pstNum := int(data[7])
for i := 0; i < pstNum; i++ {
@@ -730,7 +886,7 @@ func (tlv *PathSetupTypeCapability) DecodeFromBytes(data []uint8) error {
pstNum += 4 - (pstNum % 4) // padding byte
}
var err error
- tlv.SubTLVs, err = DecodeTLVs(data[8+pstNum : TLVHeaderLength+l]) // 8 byte: Type&Length (4 byte) + Reserve&pstNum (4 byte)
+ tlv.SubTLVs, err = DecodeTLVs(data[8+pstNum : TLVHeaderLength+length]) // 8 byte: Type&Length (4 byte) + Reserve&pstNum (4 byte)
if err != nil {
return err
}
@@ -746,17 +902,17 @@ func (tlv *PathSetupTypeCapability) Serialize() []uint8 {
numOfPst := uint16(len(tlv.PathSetupTypes))
- l := uint16(4) // 4 byte: reserve & num of PSTs field
- l += numOfPst
+ length := uint16(4) // 4 byte: reserve & num of PSTs field
+ length += numOfPst
if numOfPst%4 != 0 {
- l += 4 - (numOfPst % 4)
+ length += 4 - (numOfPst % 4)
}
for _, subTLV := range tlv.SubTLVs {
- l += subTLV.Len()
+ length += subTLV.Len()
}
- length := make([]uint8, 2)
- binary.BigEndian.PutUint16(length, l)
- buf = append(buf, length...)
+ lengthBytes := make([]uint8, 2)
+ binary.BigEndian.PutUint16(lengthBytes, length)
+ buf = append(buf, lengthBytes...)
var val []uint8
if numOfPst%4 == 0 {
@@ -787,16 +943,16 @@ func (tlv *PathSetupTypeCapability) Type() TLVType {
}
func (tlv *PathSetupTypeCapability) Len() uint16 {
- l := uint16(4) // 4 byte: reserve & num of PSTs field
+ length := uint16(4) // 4 byte: reserve & num of PSTs field
numOfPst := uint16(len(tlv.PathSetupTypes))
- l += numOfPst
+ length += numOfPst
if numOfPst%4 != 0 {
- l += 4 - (numOfPst % 4)
+ length += 4 - (numOfPst % 4)
}
for _, subTLV := range tlv.SubTLVs {
- l += subTLV.Len()
+ length += subTLV.Len()
}
- return TLVHeaderLength + l
+ return TLVHeaderLength + length
}
func (tlv *PathSetupTypeCapability) CapStrings() []string {
@@ -818,7 +974,7 @@ const (
AssocTypePolicyAssociation AssocType = 0x03
AssocTypeSingleSidedBidirectionalLSPAssociation AssocType = 0x04
AssocTypeDoubleSidedBidirectionalLSPAssociation AssocType = 0x05
- AssocTypeSrPolicyAssociation AssocType = 0x06
+ AssocTypeSRPolicyAssociation AssocType = 0x06
AssocTypeVnAssociationType AssocType = 0x07
)
@@ -828,7 +984,7 @@ var assocTypeNames = map[AssocType]string{
AssocTypePolicyAssociation: "Policy Association",
AssocTypeSingleSidedBidirectionalLSPAssociation: "Single Sided Bidirectional LSP Association",
AssocTypeDoubleSidedBidirectionalLSPAssociation: "Double Sided Bidirectional LSP Association",
- AssocTypeSrPolicyAssociation: "SR Policy Association",
+ AssocTypeSRPolicyAssociation: "SR Policy Association",
AssocTypeVnAssociationType: "VN Association Type",
}
@@ -859,18 +1015,18 @@ func (tlv *AssocTypeList) Serialize() []uint8 {
binary.BigEndian.PutUint16(typ, uint16(tlv.Type()))
buf = append(buf, typ...)
- l := uint16(len(tlv.AssocTypes)) * 2
- length := make([]uint8, 2)
- binary.BigEndian.PutUint16(length, l)
- buf = append(buf, length...)
+ length := uint16(len(tlv.AssocTypes)) * 2
+ lengthBytes := make([]uint8, 2)
+ binary.BigEndian.PutUint16(lengthBytes, length)
+ buf = append(buf, lengthBytes...)
for _, at := range tlv.AssocTypes {
binAt := make([]uint8, 2)
binary.BigEndian.PutUint16(binAt, uint16(at))
buf = append(buf, binAt...)
}
- if l%4 != 0 {
- pad := make([]uint8, 4-(l%4))
+ if length%4 != 0 {
+ pad := make([]uint8, 4-(length%4))
buf = append(buf, pad...)
}
return buf
@@ -885,12 +1041,12 @@ func (tlv *AssocTypeList) Type() TLVType {
}
func (tlv *AssocTypeList) Len() uint16 {
- l := uint16(len(tlv.AssocTypes)) * 2
+ length := uint16(len(tlv.AssocTypes)) * 2
padding := uint16(0)
- if l%4 != 0 {
+ if length%4 != 0 {
padding = 2
}
- return TLVHeaderLength + l + padding
+ return TLVHeaderLength + length + padding
}
func (tlv *AssocTypeList) CapStrings() []string {
diff --git a/pkg/packet/pcep/tlv_test.go b/pkg/packet/pcep/tlv_test.go
new file mode 100644
index 00000000..eb4a64cd
--- /dev/null
+++ b/pkg/packet/pcep/tlv_test.go
@@ -0,0 +1,535 @@
+// Copyright (c) 2022 NTT Communications Corporation
+//
+// This software is released under the MIT License.
+// see https://github.com/nttcom/pola/blob/main/LICENSE
+
+package pcep
+
+import (
+ "encoding/binary"
+ "net/netip"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+ "go.uber.org/zap/zapcore"
+)
+
+func TestStatefulPCECapability_DecodeFromBytes(t *testing.T) {
+ tests := []struct {
+ name string
+ input []uint8
+ expected *StatefulPCECapability
+ err bool
+ }{
+ {
+ name: "Single capability: LSP Update enabled",
+ input: NewStatefulPCECapability(0x01).Serialize(),
+ expected: NewStatefulPCECapability(0x01),
+ err: false,
+ },
+ {
+ name: "All capabilities enabled",
+ input: NewStatefulPCECapability(0x3F).Serialize(),
+ expected: NewStatefulPCECapability(0x3F),
+ err: false,
+ },
+ {
+ name: "Input too short (missing TLV body)",
+ input: []uint8{uint8(TLVStatefulPCECapability >> 8), uint8(TLVStatefulPCECapability & 0xFF), 0x00, 0x04}, // type=0x0010, length=4, but body missing
+ expected: nil,
+ err: true,
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ var actual StatefulPCECapability
+ err := actual.DecodeFromBytes(tt.input)
+ if tt.err {
+ assert.Error(t, err, "expected error for input: %v", tt.input)
+ } else {
+ assert.NoError(t, err, "unexpected error for input: %v", tt.input)
+ assert.Equal(t, *tt.expected, actual, "decoded capability mismatch")
+ }
+ })
+ }
+}
+
+func TestStatefulPCECapability_Serialize(t *testing.T) {
+ tests := []struct {
+ name string
+ bits uint32
+ }{
+ {
+ name: "LSP Update Capability enabled",
+ bits: 0x01,
+ },
+ {
+ name: "All capabilities enabled",
+ bits: 0x3F,
+ },
+ {
+ name: "No capabilities enabled",
+ bits: 0x00,
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ tlv := NewStatefulPCECapability(tt.bits)
+ expected := make([]uint8, TLVHeaderLength+TLVStatefulPCECapabilityValueLength)
+ binary.BigEndian.PutUint16(expected[0:2], uint16(TLVStatefulPCECapability))
+ binary.BigEndian.PutUint16(expected[2:4], TLVStatefulPCECapabilityValueLength)
+ binary.BigEndian.PutUint32(expected[4:8], tlv.CapabilityBits())
+
+ assert.Equal(t, expected, tlv.Serialize(), "serialized output mismatch")
+ })
+ }
+}
+
+func TestStatefulPCECapability_MarshalLogObject(t *testing.T) {
+ tests := []struct {
+ name string
+ tlv *StatefulPCECapability
+ expected bool
+ }{
+ {
+ name: "LSP Update Capability enabled",
+ tlv: &StatefulPCECapability{
+ LSPUpdateCapability: true,
+ },
+ expected: true,
+ },
+ {
+ name: "LSP Update Capability disabled",
+ tlv: &StatefulPCECapability{
+ LSPUpdateCapability: false,
+ },
+ expected: false,
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ enc := zapcore.NewMapObjectEncoder()
+ err := tt.tlv.MarshalLogObject(enc)
+
+ assert.NoError(t, err, "expected no error while marshaling log object")
+ assert.Equal(t, tt.expected, enc.Fields["lspUpdateCapability"], "field 'lspUpdateCapability' mismatch")
+ })
+ }
+}
+
+func TestStatefulPCECapability_CapStrings(t *testing.T) {
+ tests := []struct {
+ name string
+ bits uint32
+ expected []string
+ }{
+ {
+ name: "All capabilities enabled",
+ bits: 0x3F,
+ expected: []string{"Stateful", "Update", "Include-DB-Ver", "Instantiation", "Triggered-Resync", "Delta-LSP-Sync", "Triggered-Initial-Sync"},
+ },
+ {
+ name: "No capabilities enabled",
+ bits: 0x00,
+ expected: []string{"Stateful"},
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ input := NewStatefulPCECapability(tt.bits)
+ assert.ElementsMatch(t, tt.expected, input.CapStrings(), "capabilities mismatch")
+ })
+ }
+}
+
+func TestSymbolicPathName_DecodeFromBytes(t *testing.T) {
+ tests := []struct {
+ name string
+ input []uint8
+ expected *SymbolicPathName
+ err bool
+ }{
+ {
+ name: "Valid Symbolic Path Name",
+ input: NewSymbolicPathName("Test").Serialize(),
+ expected: NewSymbolicPathName("Test"),
+ err: false,
+ },
+ {
+ name: "Invalid input (too short data)",
+ input: []byte{0x00, 0x11, 0x00, 0x02, 'T'}, // Input too short for valid decoding
+ expected: NewSymbolicPathName(""),
+ err: true,
+ },
+ {
+ name: "Invalid input (too long data)",
+ input: []byte{0x00, 0x11, 0x00, 0x01, 'T', 'e'}, // Input too long for valid decoding
+ expected: NewSymbolicPathName(""),
+ err: true,
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ var tlv SymbolicPathName
+ err := tlv.DecodeFromBytes(tt.input)
+ if tt.err {
+ assert.Error(t, err, "expected error for input: %v", tt.input)
+ } else {
+ assert.NoError(t, err, "unexpected error for input: %v", tt.input)
+ assert.Equal(t, tt.expected, &tlv)
+ }
+ })
+ }
+}
+
+func TestSymbolicPathName_Serialize(t *testing.T) {
+ tests := []struct {
+ name string
+ input *SymbolicPathName
+ expected []uint8
+ }{
+ {
+ name: "Valid Symbolic Path Name",
+ input: NewSymbolicPathName("Test"),
+ expected: NewSymbolicPathName("Test").Serialize(),
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ assert.Equal(t, tt.expected, tt.input.Serialize())
+ })
+ }
+}
+
+func TestSymbolicPathName_Len(t *testing.T) {
+ tests := []struct {
+ name string
+ input *SymbolicPathName
+ expected uint16
+ }{
+ {
+ name: "Symbolic Path Name length",
+ input: NewSymbolicPathName("Test"),
+ expected: TLVHeaderLength + 4,
+ },
+ {
+ name: "Symbolic Path Name with padding",
+ input: NewSymbolicPathName("ABC"), // 3 bytes + 1 byte padding
+ expected: TLVHeaderLength + 3 + 1,
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ assert.Equal(t, tt.expected, tt.input.Len())
+ })
+ }
+}
+
+func TestIPv4LSPIdentifiers_DecodeFromBytes(t *testing.T) {
+ tests := []struct {
+ name string
+ input []uint8
+ expected *IPv4LSPIdentifiers
+ err bool
+ }{
+ {
+ name: "Valid IPv4 LSP Identifiers",
+ input: NewIPv4LSPIdentifiers(netip.MustParseAddr("192.0.2.1"), netip.MustParseAddr("192.0.2.2"), 1, 2, 1234).Serialize(),
+ expected: NewIPv4LSPIdentifiers(netip.MustParseAddr("192.0.2.1"), netip.MustParseAddr("192.0.2.2"), 1, 2, 1234),
+ err: false,
+ },
+ {
+ name: "Invalid IPv4 LSP Identifiers (truncated '192.0.2.1')",
+ input: []uint8{
+ 0x00, 0x12, 0x00, 0x14, // Type (0x12) and Length (0x10)
+ 0xC0, 0x00, 0x02, // Incomplete address: missing last byte (0x01)
+ },
+ expected: NewIPv4LSPIdentifiers(netip.Addr{}, netip.Addr{}, 0, 0, 0),
+ err: true,
+ },
+ {
+ name: "Invalid IPv4 LSP Identifiers (extra bytes after '192.0.2.1')",
+ input: []uint8{
+ 0x00, 0x12, 0x00, 0x14, // Type (0x12) and Length (0x10)
+ 0xC0, 0x00, 0x02, 0x01, // Valid IPv4 address: 192.0.2.1
+ 0xDE, 0xAD, 0xBE, 0xEF, // Extra unexpected bytes
+ },
+ expected: NewIPv4LSPIdentifiers(netip.Addr{}, netip.Addr{}, 0, 0, 0),
+ err: true,
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ var tlv IPv4LSPIdentifiers
+ err := tlv.DecodeFromBytes(tt.input)
+ if tt.err {
+ assert.Error(t, err, "expected error for input: %v", tt.input)
+ } else {
+ assert.NoError(t, err, "unexpected error for input: %v", tt.input)
+ assert.Equal(t, tt.expected, &tlv)
+ }
+ })
+ }
+}
+
+func TestIPv4LSPIdentifiers_Serialize(t *testing.T) {
+ tests := []struct {
+ name string
+ input *IPv4LSPIdentifiers
+ expected []uint8
+ }{
+ {
+ name: "Valid IPv4 LSP Identifiers",
+ input: NewIPv4LSPIdentifiers(netip.MustParseAddr("192.0.2.1"), netip.MustParseAddr("192.0.2.2"), 1, 2, 1234),
+ expected: NewIPv4LSPIdentifiers(netip.MustParseAddr("192.0.2.1"), netip.MustParseAddr("192.0.2.2"), 1, 2, 1234).Serialize(),
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ assert.Equal(t, tt.expected, tt.input.Serialize())
+ })
+ }
+}
+
+func TestIPv6LSPIdentifiers_DecodeFromBytes(t *testing.T) {
+ tests := []struct {
+ name string
+ input []uint8
+ expected *IPv6LSPIdentifiers
+ err bool
+ }{
+ {
+ name: "Valid IPv6 LSP Identifiers",
+ input: NewIPv6LSPIdentifiers(netip.MustParseAddr("2001:db8::1"), netip.MustParseAddr("2001:db8::2"), 1, 2, [16]byte{}).Serialize(),
+ expected: NewIPv6LSPIdentifiers(netip.MustParseAddr("2001:db8::1"), netip.MustParseAddr("2001:db8::2"), 1, 2, [16]byte{}),
+ err: false,
+ },
+ {
+ name: "Invalid IPv6 LSP Identifiers (truncated '2001:db8::1')",
+ input: []uint8{
+ 0x00, 0x13, 0x00, 0x20, // Type IPV6-LSP-IDENTIFIERS (0x13)、Length 56 (0x38)
+ 0x20, 0x01, 0x0D, 0xB8, // Start of '2001:db8::'
+ 0x00, 0x00, 0x00, // Incomplete (should be 16 bytes total)
+ },
+ expected: NewIPv6LSPIdentifiers(netip.Addr{}, netip.Addr{}, 0, 0, [16]byte{}),
+ err: true,
+ },
+ {
+ name: "Invalid IPv6 LSP Identifiers (extra bytes after '2001:db8::1')",
+ input: []uint8{
+ 0x00, 0x13, 0x00, 0x20, // Type IPV6-LSP-IDENTIFIERS (0x13)、Length 56 (0x38)
+ 0x20, 0x01, 0x0D, 0xB8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, // Valid IPv6: 2001:db8::1
+ 0xCA, 0xFE, 0xBA, 0xBE, // Extra unexpected bytes
+ },
+ expected: NewIPv6LSPIdentifiers(netip.Addr{}, netip.Addr{}, 0, 0, [16]byte{}),
+ err: true,
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ var tlv IPv6LSPIdentifiers
+ err := tlv.DecodeFromBytes(tt.input)
+ if tt.err {
+ assert.Error(t, err, "expected error for input: %v", tt.input)
+ } else {
+ assert.NoError(t, err, "unexpected error for input: %v", tt.input)
+ assert.Equal(t, tt.expected, &tlv)
+ }
+ })
+ }
+}
+
+func TestIPv6LSPIdentifiers_Serialize(t *testing.T) {
+ tests := []struct {
+ name string
+ input *IPv6LSPIdentifiers
+ expected []uint8
+ }{
+ {
+ name: "Valid IPv6 LSP Identifiers",
+ input: NewIPv6LSPIdentifiers(netip.MustParseAddr("2001:db8::1"), netip.MustParseAddr("2001:db8::2"), 1, 2, [16]byte{}),
+ expected: NewIPv6LSPIdentifiers(netip.MustParseAddr("2001:db8::1"), netip.MustParseAddr("2001:db8::2"), 1, 2, [16]byte{}).Serialize(),
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ assert.Equal(t, tt.expected, tt.input.Serialize())
+ })
+ }
+}
+
+func TestLSPDBVersion_DecodeFromBytes(t *testing.T) {
+ tests := []struct {
+ name string
+ input []uint8
+ expected *LSPDBVersion
+ err bool
+ }{
+ {
+ name: "Valid LSPDB Version",
+ input: NewLSPDBVersion(12345).Serialize(),
+ expected: NewLSPDBVersion(12345),
+ err: false,
+ },
+ {
+ name: "Invalid input (too short data)",
+ input: []byte{0x00, 0x17, 0x00, 0x02}, // Type LSP-DB-VERSION (0x17)、Input too short for valid decoding
+ expected: NewLSPDBVersion(0),
+ err: true,
+ },
+ {
+ name: "Invalid input (too long data)",
+ input: []byte{
+ 0x00, 0x17, 0x00, 0x09, // Type LSP-DB-VERSION (0x17)、Length 8
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x39,
+ 0x00, // Extra bytes after version
+ },
+ expected: NewLSPDBVersion(0),
+ err: true,
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ var tlv LSPDBVersion
+ err := tlv.DecodeFromBytes(tt.input)
+ if tt.err {
+ assert.Error(t, err, "expected error for input: %v", tt.input)
+ } else {
+ assert.NoError(t, err, "unexpected error for input: %v", tt.input)
+ assert.Equal(t, tt.expected, &tlv)
+ }
+ })
+ }
+}
+
+func TestLSPDBVersion_Serialize(t *testing.T) {
+ tests := []struct {
+ name string
+ input *LSPDBVersion
+ expected []uint8
+ }{
+ {
+ name: "Valid LSPDB Version",
+ input: NewLSPDBVersion(12345),
+ expected: NewLSPDBVersion(12345).Serialize(),
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ assert.Equal(t, tt.expected, tt.input.Serialize())
+ })
+ }
+}
+
+func TestLSPDBVersion_Len(t *testing.T) {
+ tests := []struct {
+ name string
+ input *LSPDBVersion
+ expected uint16
+ }{
+ {
+ name: "LSPDB Version length",
+ input: NewLSPDBVersion(12345),
+ expected: TLVHeaderLength + TLVLSPDBVersionValueLength,
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ assert.Equal(t, tt.expected, tt.input.Len())
+ })
+ }
+}
+
+func TestSRPCECapability_DecodeFromBytes(t *testing.T) {
+ tests := []struct {
+ name string
+ input []uint8
+ expected *SRPCECapability
+ err bool
+ }{
+ {
+ name: "Valid SRPCE Capability",
+ input: NewSRPCECapability(true, true, 42).Serialize(), // Maximum SID Depth 42
+ expected: NewSRPCECapability(true, true, 42),
+ err: false,
+ },
+ {
+ name: "Invalid input (too short data)",
+ input: []uint8{0x00, 0x11, 0x00, 0x02}, // Too short for valid decoding
+ expected: NewSRPCECapability(false, false, 0),
+ err: true,
+ },
+ {
+ name: "Invalid input (too long data)",
+ input: []uint8{0x00, 0x11, 0x00, 0x02, 0x00, 0x00, 0x03, 0x05, 0x01}, // Too long for valid decoding
+ expected: NewSRPCECapability(false, false, 0),
+ err: true,
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ var tlv SRPCECapability
+ err := tlv.DecodeFromBytes(tt.input)
+ if tt.err {
+ assert.Error(t, err, "expected error for input: %v", tt.input)
+ } else {
+ assert.NoError(t, err, "unexpected error for input: %v", tt.input)
+ assert.Equal(t, tt.expected, &tlv)
+ }
+ })
+ }
+}
+
+func TestSRPCECapability_Serialize(t *testing.T) {
+ tests := []struct {
+ name string
+ input *SRPCECapability
+ expected []uint8
+ }{
+ {
+ name: "Valid SRPCE Capability",
+ input: NewSRPCECapability(true, true, 5),
+ expected: NewSRPCECapability(true, true, 5).Serialize(),
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ assert.Equal(t, tt.expected, tt.input.Serialize())
+ })
+ }
+}
+
+func TestSRPCECapability_Len(t *testing.T) {
+ tests := []struct {
+ name string
+ input *SRPCECapability
+ expected uint16
+ }{
+ {
+ name: "SRPCE Capability length",
+ input: NewSRPCECapability(true, true, 5),
+ expected: TLVHeaderLength + TLVSRPCECapabilityValueLength,
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ assert.Equal(t, tt.expected, tt.input.Len())
+ })
+ }
+}
From beaf7f2b1dce91e6d8694d34dc79f0460085aed5 Mon Sep 17 00:00:00 2001
From: watal
Date: Mon, 7 Apr 2025 12:01:01 +0900
Subject: [PATCH 18/87] fix(json): replace strings.Fields with explicit loop in
Psts.MarshalJSON to avoid whitespace issues
---
pkg/packet/pcep/tlv.go | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/pkg/packet/pcep/tlv.go b/pkg/packet/pcep/tlv.go
index faf3179e..b997b742 100644
--- a/pkg/packet/pcep/tlv.go
+++ b/pkg/packet/pcep/tlv.go
@@ -764,7 +764,11 @@ func (ts Psts) MarshalJSON() ([]byte, error) {
if ts == nil {
result = "null"
} else {
- result = strings.Join(strings.Fields(fmt.Sprintf("%d", ts)), ",")
+ var values []string
+ for _, pst := range ts {
+ values = append(values, fmt.Sprintf("%d", pst))
+ }
+ result = strings.Join(values, ",")
}
return []byte(result), nil
}
From a65a8e10c964e73bb60820655a969f229cfb34fd Mon Sep 17 00:00:00 2001
From: watal
Date: Wed, 16 Apr 2025 08:24:13 +0900
Subject: [PATCH 19/87] refactor(pcep): add length check, index const, and
tests for PathSetupType
---
pkg/packet/pcep/tlv.go | 19 ++++++++-
pkg/packet/pcep/tlv_test.go | 81 +++++++++++++++++++++++++++++++++++++
2 files changed, 98 insertions(+), 2 deletions(-)
diff --git a/pkg/packet/pcep/tlv.go b/pkg/packet/pcep/tlv.go
index b997b742..59d26ab1 100644
--- a/pkg/packet/pcep/tlv.go
+++ b/pkg/packet/pcep/tlv.go
@@ -777,8 +777,17 @@ type PathSetupType struct {
PathSetupType Pst
}
+const (
+ PathSetupTypePathSetupTypeIndex = 3
+)
+
func (tlv *PathSetupType) DecodeFromBytes(data []uint8) error {
- tlv.PathSetupType = Pst(data[7])
+ expectedLength := TLVHeaderLength + int(TLVPathSetupTypeValueLength)
+ if len(data) != expectedLength {
+ return fmt.Errorf("data length mismatch: expected %d bytes, but got %d bytes for PathSetupType", expectedLength, len(data))
+ }
+
+ tlv.PathSetupType = Pst(data[TLVHeaderLength+PathSetupTypePathSetupTypeIndex])
return nil
}
@@ -794,7 +803,7 @@ func (tlv *PathSetupType) Serialize() []uint8 {
buf = append(buf, length...)
val := make([]uint8, TLVPathSetupTypeValueLength)
- val[3] = uint8(tlv.PathSetupType)
+ val[PathSetupTypePathSetupTypeIndex] = uint8(tlv.PathSetupType)
buf = append(buf, val...)
return buf
@@ -812,6 +821,12 @@ func (tlv *PathSetupType) Len() uint16 {
return TLVHeaderLength + TLVPathSetupTypeValueLength
}
+func NewPathSetupType(pst Pst) *PathSetupType {
+ return &PathSetupType{
+ PathSetupType: pst,
+ }
+}
+
type ExtendedAssociationID struct {
Color uint32
Endpoint netip.Addr
diff --git a/pkg/packet/pcep/tlv_test.go b/pkg/packet/pcep/tlv_test.go
index eb4a64cd..5c623a01 100644
--- a/pkg/packet/pcep/tlv_test.go
+++ b/pkg/packet/pcep/tlv_test.go
@@ -533,3 +533,84 @@ func TestSRPCECapability_Len(t *testing.T) {
})
}
}
+
+func TestPathSetupType_DecodeFromBytes(t *testing.T) {
+ tests := []struct {
+ name string
+ input []uint8
+ expected *PathSetupType
+ err bool
+ }{
+ {
+ name: "Valid PathSetupType SRv6TE",
+ input: NewPathSetupType(PathSetupTypeSRv6TE).Serialize(),
+ expected: NewPathSetupType(PathSetupTypeSRv6TE),
+ err: false,
+ },
+ {
+ name: "Invalid input (too short)",
+ input: []uint8{0x00, 0x15, 0x00, 0x04}, // insufficient data
+ expected: NewPathSetupType(0),
+ err: true,
+ },
+ {
+ name: "Invalid input (too long)",
+ input: append(NewPathSetupType(PathSetupTypeSRTE).Serialize(), 0x00, 0x00),
+ expected: NewPathSetupType(0),
+ err: true,
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ var tlv PathSetupType
+ err := tlv.DecodeFromBytes(tt.input)
+ if tt.err {
+ assert.Error(t, err, "expected error for input: %v", tt.input)
+ } else {
+ assert.NoError(t, err, "unexpected error for input: %v", tt.input)
+ assert.Equal(t, tt.expected, &tlv)
+ }
+ })
+ }
+}
+
+func TestPathSetupType_Serialize(t *testing.T) {
+ tests := []struct {
+ name string
+ input *PathSetupType
+ expected []uint8
+ }{
+ {
+ name: "Serialize PathSetupType SRTE",
+ input: NewPathSetupType(PathSetupTypeSRTE),
+ expected: NewPathSetupType(PathSetupTypeSRTE).Serialize(),
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ assert.Equal(t, tt.expected, tt.input.Serialize())
+ })
+ }
+}
+
+func TestPathSetupType_Len(t *testing.T) {
+ tests := []struct {
+ name string
+ input *PathSetupType
+ expected uint16
+ }{
+ {
+ name: "Length should be header + value length",
+ input: NewPathSetupType(PathSetupTypeRSVPTE),
+ expected: TLVHeaderLength + TLVPathSetupTypeValueLength,
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ assert.Equal(t, tt.expected, tt.input.Len())
+ })
+ }
+}
From 50bce3b9172822437c753705d51025211ceafe26 Mon Sep 17 00:00:00 2001
From: watal
Date: Fri, 18 Apr 2025 09:02:31 +0900
Subject: [PATCH 20/87] refactor(pcep): fix TLV constant names and improve TLV
parsing with named offset
---
pkg/packet/pcep/tlv.go | 39 +++++++++++++++++++++------------------
1 file changed, 21 insertions(+), 18 deletions(-)
diff --git a/pkg/packet/pcep/tlv.go b/pkg/packet/pcep/tlv.go
index 59d26ab1..6df99da0 100644
--- a/pkg/packet/pcep/tlv.go
+++ b/pkg/packet/pcep/tlv.go
@@ -19,7 +19,8 @@ import (
type TLVType uint16
-const ( // PCEP TLV
+// PCEP TLV types
+const (
TLVNoPathVector TLVType = 0x01
TLVOverloadDuration TLVType = 0x02
TLVReqMissing TLVType = 0x03
@@ -177,32 +178,19 @@ func (t TLVType) String() string {
return fmt.Sprintf("Unknown TLV (0x%04x)", uint16(t))
}
-var tlvMap = map[TLVType]func() TLVInterface{
- TLVStatefulPCECapability: func() TLVInterface { return &StatefulPCECapability{} },
- TLVSymbolicPathName: func() TLVInterface { return &SymbolicPathName{} },
- TLVIPv4LSPIdentifiers: func() TLVInterface { return &IPv4LSPIdentifiers{} },
- TLVIPv6LSPIdentifiers: func() TLVInterface { return &IPv6LSPIdentifiers{} },
- TLVLSPDBVersion: func() TLVInterface { return &LSPDBVersion{} },
- TLVSRPCECapability: func() TLVInterface { return &SRPCECapability{} },
- TLVPathSetupType: func() TLVInterface { return &PathSetupType{} },
- TLVExtendedAssociationID: func() TLVInterface { return &ExtendedAssociationID{} },
- TLVPathSetupTypeCapability: func() TLVInterface { return &PathSetupTypeCapability{} },
- TLVAssocTypeList: func() TLVInterface { return &AssocTypeList{} },
- TLVColor: func() TLVInterface { return &Color{} },
-}
-
+// TLV header length (type + length)
const TLVHeaderLength = 4
-// TLV value lengths (in bytes), excluding the 4-byte TLV header (type + length)
+// TLV value lengths, excluding the 4-byte TLV header (type + length)
const (
TLVStatefulPCECapabilityValueLength uint16 = 4
+ TLVIPv4LSPIdentifiersValueLength uint16 = 16
+ TLVIPv6LSPIdentifiersValueLength uint16 = 52
TLVLSPDBVersionValueLength uint16 = 8
TLVSRPCECapabilityValueLength uint16 = 4
TLVPathSetupTypeValueLength uint16 = 4
TLVExtendedAssociationIDIPv4ValueLength uint16 = 8
TLVExtendedAssociationIDIPv6ValueLength uint16 = 20
- TLVIPv4LSPIdentifiersValueLength uint16 = 16
- TLVIPv6LSPIdentifiersValueLength uint16 = 52
TLVSRPolicyCPathIDValueLength uint16 = 28
TLVSRPolicyCPathPreferenceValueLength uint16 = 4
TLVColorValueLength uint16 = 4
@@ -221,6 +209,7 @@ const (
SubTLVPreferenceCisco TLVType = 0x03
)
+// Cisco specific SubTLV length
const (
SubTLVColorCiscoValueLength uint16 = 4
SubTLVPreferenceCiscoValueLength uint16 = 4
@@ -234,6 +223,20 @@ type TLVInterface interface {
Len() uint16 // Total length of Type, Length, and Value
}
+var tlvMap = map[TLVType]func() TLVInterface{
+ TLVStatefulPCECapability: func() TLVInterface { return &StatefulPCECapability{} },
+ TLVSymbolicPathName: func() TLVInterface { return &SymbolicPathName{} },
+ TLVIPv4LSPIdentifiers: func() TLVInterface { return &IPv4LSPIdentifiers{} },
+ TLVIPv6LSPIdentifiers: func() TLVInterface { return &IPv6LSPIdentifiers{} },
+ TLVLSPDBVersion: func() TLVInterface { return &LSPDBVersion{} },
+ TLVSRPCECapability: func() TLVInterface { return &SRPCECapability{} },
+ TLVPathSetupType: func() TLVInterface { return &PathSetupType{} },
+ TLVExtendedAssociationID: func() TLVInterface { return &ExtendedAssociationID{} },
+ TLVPathSetupTypeCapability: func() TLVInterface { return &PathSetupTypeCapability{} },
+ TLVAssocTypeList: func() TLVInterface { return &AssocTypeList{} },
+ TLVColor: func() TLVInterface { return &Color{} },
+}
+
type StatefulPCECapability struct {
LSPUpdateCapability bool // 31
IncludeDBVersion bool // 30
From e2e237f1474a6fba5a38be47278accc42efe5788 Mon Sep 17 00:00:00 2001
From: Motok1
Date: Wed, 27 Aug 2025 18:45:18 +0900
Subject: [PATCH 21/87] refactor(ted): simplify types
---
cmd/pola/ted.go | 44 ++++++++++++++++++++++----------------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/cmd/pola/ted.go b/cmd/pola/ted.go
index 0136ee9d..0d0438fb 100644
--- a/cmd/pola/ted.go
+++ b/cmd/pola/ted.go
@@ -38,70 +38,70 @@ func print(jsonFlag bool) error {
if jsonFlag {
// Output JSON format
- nodes := []map[string]interface{}{}
+ nodes := []map[string]any{}
for _, as := range ted.Nodes {
for _, node := range as {
- tmpNode := map[string]interface{}{ // TODO: Fix format according to readme
+ nodeMap := map[string]any{ // TODO: Fix format according to readme
"asn": node.ASN,
"routerID": node.RouterID,
"isisAreaID": node.IsisAreaID,
"hostname": node.Hostname,
"srgbBegin": node.SrgbBegin,
"srgbEnd": node.SrgbEnd,
- "prefixes": []map[string]interface{}{},
- "links": []map[string]interface{}{},
+ "prefixes": []map[string]any{},
+ "links": []map[string]any{},
}
- links := []map[string]interface{}{}
+ links := []map[string]any{}
for _, link := range node.Links {
- metrics := []map[string]interface{}{}
+ metrics := []map[string]any{}
for _, metric := range link.Metrics {
- tmpMetric := map[string]interface{}{
+ metricMap := map[string]any{
"type": metric.Type.String(),
"value": metric.Value,
}
- metrics = append(metrics, tmpMetric)
+ metrics = append(metrics, metricMap)
}
- tmpLink := map[string]interface{}{
+ linkMap := map[string]any{
"localIP": link.LocalIP.String(),
"remoteIP": link.RemoteIP.String(),
"remoteNode": link.RemoteNode.RouterID,
"metrics": metrics,
"adjSid": link.AdjSid,
}
- links = append(links, tmpLink)
+ links = append(links, linkMap)
}
- tmpNode["links"] = links
+ nodeMap["links"] = links
- prefixes := []map[string]interface{}{}
+ prefixes := []map[string]any{}
for _, prefix := range node.Prefixes {
- tmpPrefix := map[string]interface{}{
+ prefixMap := map[string]any{
"prefix": prefix.Prefix.String(),
}
if prefix.SidIndex != 0 {
- tmpPrefix["sidIndex"] = prefix.SidIndex
+ prefixMap["sidIndex"] = prefix.SidIndex
}
- prefixes = append(prefixes, tmpPrefix)
+ prefixes = append(prefixes, prefixMap)
}
- tmpNode["prefixes"] = prefixes
+ nodeMap["prefixes"] = prefixes
- srv6SIDs := []map[string]interface{}{}
+ srv6SIDs := []map[string]any{}
for _, srv6SID := range node.SRv6SIDs {
- tmpSrv6SID := map[string]interface{}{
+ srv6SIDMap := map[string]any{
"sids": srv6SID.Sids,
"endpointBehavior": srv6SID.EndpointBehavior,
"multiTopoIDs": srv6SID.MultiTopoIDs,
}
- srv6SIDs = append(srv6SIDs, tmpSrv6SID)
+ srv6SIDs = append(srv6SIDs, srv6SIDMap)
}
- tmpNode["srv6SIDs"] = srv6SIDs
+ nodeMap["srv6SIDs"] = srv6SIDs
- nodes = append(nodes, tmpNode)
+ nodes = append(nodes, nodeMap)
}
}
- outputMap := map[string]interface{}{
+ outputMap := map[string]any{
"ted": nodes,
}
From dcd1ae78cb19a283be9cec249bf3442715f1fb92 Mon Sep 17 00:00:00 2001
From: watal
Date: Fri, 18 Apr 2025 10:14:03 +0900
Subject: [PATCH 22/87] refactor,test(pcep): make Uint16ToByteSlice generic
(~uint16) and add TLVType tests
---
pkg/packet/pcep/object.go | 2 +-
pkg/packet/pcep/pcep_util.go | 57 ++++++++++++++-----------------
pkg/packet/pcep/pcep_util_test.go | 30 ++++++++++++----
pkg/packet/pcep/tlv.go | 2 +-
4 files changed, 52 insertions(+), 39 deletions(-)
diff --git a/pkg/packet/pcep/object.go b/pkg/packet/pcep/object.go
index a3eeae84..012c76cd 100644
--- a/pkg/packet/pcep/object.go
+++ b/pkg/packet/pcep/object.go
@@ -1329,7 +1329,7 @@ func (o *AssociationObject) Serialize() ([]uint8, error) {
buf[4] = buf[4] | 0x01
}
- assocType := Uint16ToByteSlice(uint16(o.AssocType))
+ assocType := Uint16ToByteSlice(o.AssocType)
assocID := Uint16ToByteSlice(o.AssocID)
byteTLVs := []uint8{}
diff --git a/pkg/packet/pcep/pcep_util.go b/pkg/packet/pcep/pcep_util.go
index 80ff0a4a..a8dd7fa0 100644
--- a/pkg/packet/pcep/pcep_util.go
+++ b/pkg/packet/pcep/pcep_util.go
@@ -5,55 +5,50 @@
package pcep
-import (
- "encoding/binary"
-
- "golang.org/x/exp/constraints"
-)
-
-// AppendByteSlices concatenates byte slices into a single slice.
-func AppendByteSlices(byteSlices ...[]byte) []byte {
- // Calculate the total length of the joined slice.
- joinedSliceLength := 0
- for _, byteSlice := range byteSlices {
- joinedSliceLength += len(byteSlice)
+import "encoding/binary"
+
+// AppendByteSlices concatenates multiple byte slices into a single slice.
+func AppendByteSlices(slices ...[]byte) []byte {
+ totalLength := 0
+ for _, s := range slices {
+ totalLength += len(s)
}
- // Allocate the joined slice with the total length and copy the byte slices.
- joinedSlice := make([]byte, joinedSliceLength)
- var index int
- for _, byteSlice := range byteSlices {
- copy(joinedSlice[index:], byteSlice)
- index += len(byteSlice)
+
+ result := make([]byte, totalLength)
+ offset := 0
+ for _, s := range slices {
+ copy(result[offset:], s)
+ offset += len(s)
}
- return joinedSlice
+
+ return result
}
-// Uint16ToByteSlice converts a uint16 value to a big-endian byte slice.
-func Uint16ToByteSlice(input uint16) []byte {
- uint16Bytes := make([]byte, 2)
- binary.BigEndian.PutUint16(uint16Bytes, input)
- return uint16Bytes
+// Uint16ToByteSlice converts a uint16 or TLVType value to a big-endian byte slice.
+func Uint16ToByteSlice[T ~uint16](v T) []byte {
+ b := make([]byte, 2)
+ binary.BigEndian.PutUint16(b, uint16(v))
+ return b
}
// Uint32ToByteSlice converts a uint32 value to a big-endian byte slice.
-func Uint32ToByteSlice(input uint32) []byte {
- uint32Bytes := make([]byte, 4)
- binary.BigEndian.PutUint32(uint32Bytes, input)
- return uint32Bytes
+func Uint32ToByteSlice(v uint32) []byte {
+ b := make([]byte, 4)
+ binary.BigEndian.PutUint32(b, v)
+ return b
}
// Bitwise is a type constraint for unsigned integer types (uint8, uint16, uint32).
type Bitwise interface {
- constraints.Unsigned
~uint8 | ~uint16 | ~uint32
}
-// IsBitSet checks if a bit is set, with bit 0 as the least significant bit (LSB).
+// IsBitSet checks if a specific bit is set in the value, with bit 0 as the least significant bit (LSB).
func IsBitSet[T Bitwise](value, mask T) bool {
return value&mask != 0
}
-// SetBit sets a specific bit in a value of any unsigned integer type.
+// SetBit sets a specific bit in the value of any unsigned integer type.
func SetBit[T Bitwise](value, bit T) T {
return value | bit
}
diff --git a/pkg/packet/pcep/pcep_util_test.go b/pkg/packet/pcep/pcep_util_test.go
index 2c7f51a1..a8360917 100644
--- a/pkg/packet/pcep/pcep_util_test.go
+++ b/pkg/packet/pcep/pcep_util_test.go
@@ -41,24 +41,42 @@ func TestAppendByteSlices(t *testing.T) {
func TestUint16ToByteSlice(t *testing.T) {
tests := []struct {
name string
- input uint16
+ input any
expected []byte
}{
{
- name: "Convert 0x0102 to bytes",
- input: 0x0102,
+ name: "Convert uint16 0x0102 to bytes",
+ input: uint16(0x0102),
expected: []byte{0x01, 0x02},
},
{
- name: "Convert 0xFFFF to bytes",
- input: 0xFFFF,
+ name: "Convert uint16 0xFFFF to bytes",
+ input: uint16(0xFFFF),
+ expected: []byte{0xFF, 0xFF},
+ },
+ {
+ name: "Convert TLVType 0x0102 to bytes",
+ input: TLVType(0x0102),
+ expected: []byte{0x01, 0x02},
+ },
+ {
+ name: "Convert TLVType 0xFFFF to bytes",
+ input: TLVType(0xFFFF),
expected: []byte{0xFF, 0xFF},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
- result := Uint16ToByteSlice(tt.input)
+ var result []byte
+ switch v := tt.input.(type) {
+ case uint16:
+ result = Uint16ToByteSlice(v)
+ case TLVType:
+ result = Uint16ToByteSlice(v)
+ default:
+ t.Fatalf("unexpected type %T", v)
+ }
if !bytes.Equal(result, tt.expected) {
t.Errorf("expected %v, got %v", tt.expected, result)
}
diff --git a/pkg/packet/pcep/tlv.go b/pkg/packet/pcep/tlv.go
index 6df99da0..89f66b53 100644
--- a/pkg/packet/pcep/tlv.go
+++ b/pkg/packet/pcep/tlv.go
@@ -402,7 +402,7 @@ func (tlv *SymbolicPathName) Serialize() []byte {
padding := (4 - (nameLen % 4)) % 4 // Padding for 4-byte alignment
buf := make([]byte, 0, TLVHeaderLength+int(nameLen)+int(padding))
- buf = append(buf, Uint16ToByteSlice(uint16(tlv.Type()))...)
+ buf = append(buf, Uint16ToByteSlice(tlv.Type())...)
buf = append(buf, Uint16ToByteSlice(nameLen)...)
buf = append(buf, []byte(tlv.Name)...)
From b3354c1b356e0461ccd4b12fe3bd035d3a54ede3 Mon Sep 17 00:00:00 2001
From: watal
Date: Fri, 18 Apr 2025 16:54:17 +0900
Subject: [PATCH 23/87] refactor(pcep): simplify serialization by making SetBit
conditional
---
pkg/packet/pcep/message.go | 4 +-
pkg/packet/pcep/pcep_util.go | 7 +++-
pkg/packet/pcep/pcep_util_test.go | 63 +++++++++++++++++++------------
pkg/packet/pcep/tlv_test.go | 10 ++---
4 files changed, 49 insertions(+), 35 deletions(-)
diff --git a/pkg/packet/pcep/message.go b/pkg/packet/pcep/message.go
index 2d3bd77d..55269972 100644
--- a/pkg/packet/pcep/message.go
+++ b/pkg/packet/pcep/message.go
@@ -89,9 +89,7 @@ func (h *CommonHeader) Serialize() []uint8 {
verFlag := uint8(h.Version<<5 | h.Flag)
buf = append(buf, verFlag)
buf = append(buf, uint8(h.MessageType))
- messageLength := make([]uint8, 2)
- binary.BigEndian.PutUint16(messageLength, h.MessageLength)
- buf = append(buf, messageLength...)
+ buf = append(buf, Uint16ToByteSlice(h.MessageLength)...)
return buf
}
diff --git a/pkg/packet/pcep/pcep_util.go b/pkg/packet/pcep/pcep_util.go
index a8dd7fa0..9643cc06 100644
--- a/pkg/packet/pcep/pcep_util.go
+++ b/pkg/packet/pcep/pcep_util.go
@@ -49,6 +49,9 @@ func IsBitSet[T Bitwise](value, mask T) bool {
}
// SetBit sets a specific bit in the value of any unsigned integer type.
-func SetBit[T Bitwise](value, bit T) T {
- return value | bit
+func SetBit[T Bitwise](value, bit T, condition bool) T {
+ if condition {
+ return value | bit
+ }
+ return value
}
diff --git a/pkg/packet/pcep/pcep_util_test.go b/pkg/packet/pcep/pcep_util_test.go
index a8360917..f7554242 100644
--- a/pkg/packet/pcep/pcep_util_test.go
+++ b/pkg/packet/pcep/pcep_util_test.go
@@ -168,46 +168,59 @@ func TestIsBitSet(t *testing.T) {
func TestSetBit(t *testing.T) {
tests := []struct {
- name string
- value uint8
- bit uint8
- expected uint8
+ name string
+ value uint8
+ bit uint8
+ condition bool
+ expected uint8
}{
{
- name: "Set bit 0",
- value: 0x00,
- bit: 0x01,
- expected: 0x01,
+ name: "Set bit 0",
+ value: 0x00,
+ bit: 0x01,
+ condition: true,
+ expected: 0x01,
+ },
+ {
+ name: "Set bit 1",
+ value: 0x00,
+ bit: 0x02,
+ condition: true,
+ expected: 0x02,
},
{
- name: "Set bit 1",
- value: 0x00,
- bit: 0x02,
- expected: 0x02,
+ name: "Set bit 0 when bit 0 is already set",
+ value: 0x01,
+ bit: 0x01,
+ condition: true,
+ expected: 0x01,
},
{
- name: "Set bit 0 when bit 0 is already set",
- value: 0x01,
- bit: 0x01,
- expected: 0x01,
+ name: "Set bit 1 when bit 0 is already set",
+ value: 0x01,
+ bit: 0x02,
+ condition: true,
+ expected: 0x03,
},
{
- name: "Set bit 1 when bit 0 is already set",
- value: 0x01,
- bit: 0x02,
- expected: 0x03,
+ name: "Set bit 0 when bit 1 is already set",
+ value: 0x02,
+ bit: 0x01,
+ condition: true,
+ expected: 0x03,
},
{
- name: "Set bit 0 when bit 1 is already set",
- value: 0x02,
- bit: 0x01,
- expected: 0x03,
+ name: "Do not set bit 0 when condition is false",
+ value: 0x00,
+ bit: 0x01,
+ condition: false,
+ expected: 0x00,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
- result := SetBit(tt.value, tt.bit)
+ result := SetBit(tt.value, tt.bit, tt.condition)
if result != tt.expected {
t.Errorf("Test %s failed: expected %v, got %v", tt.name, tt.expected, result)
}
diff --git a/pkg/packet/pcep/tlv_test.go b/pkg/packet/pcep/tlv_test.go
index 5c623a01..46c186ee 100644
--- a/pkg/packet/pcep/tlv_test.go
+++ b/pkg/packet/pcep/tlv_test.go
@@ -6,7 +6,6 @@
package pcep
import (
- "encoding/binary"
"net/netip"
"testing"
@@ -76,10 +75,11 @@ func TestStatefulPCECapability_Serialize(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
tlv := NewStatefulPCECapability(tt.bits)
- expected := make([]uint8, TLVHeaderLength+TLVStatefulPCECapabilityValueLength)
- binary.BigEndian.PutUint16(expected[0:2], uint16(TLVStatefulPCECapability))
- binary.BigEndian.PutUint16(expected[2:4], TLVStatefulPCECapabilityValueLength)
- binary.BigEndian.PutUint32(expected[4:8], tlv.CapabilityBits())
+ expected := AppendByteSlices(
+ Uint16ToByteSlice(TLVStatefulPCECapability),
+ Uint16ToByteSlice(TLVStatefulPCECapabilityValueLength),
+ Uint32ToByteSlice(tlv.SetFlags()),
+ )
assert.Equal(t, expected, tlv.Serialize(), "serialized output mismatch")
})
From 0012b3129349ec91ac3a2c09d80cd7d8b1522df8 Mon Sep 17 00:00:00 2001
From: watal
Date: Fri, 18 Apr 2025 17:27:05 +0900
Subject: [PATCH 24/87] refactor(pcep): use []byte and byte consistently
---
pkg/packet/pcep/pcep_util.go | 6 +-
pkg/packet/pcep/tlv.go | 156 +++++++++++++++++------------------
2 files changed, 81 insertions(+), 81 deletions(-)
diff --git a/pkg/packet/pcep/pcep_util.go b/pkg/packet/pcep/pcep_util.go
index 9643cc06..adc11ec3 100644
--- a/pkg/packet/pcep/pcep_util.go
+++ b/pkg/packet/pcep/pcep_util.go
@@ -9,12 +9,12 @@ import "encoding/binary"
// AppendByteSlices concatenates multiple byte slices into a single slice.
func AppendByteSlices(slices ...[]byte) []byte {
- totalLength := 0
+ totalLen := 0
for _, s := range slices {
- totalLength += len(s)
+ totalLen += len(s)
}
- result := make([]byte, totalLength)
+ result := make([]byte, totalLen)
offset := 0
for _, s := range slices {
copy(result[offset:], s)
diff --git a/pkg/packet/pcep/tlv.go b/pkg/packet/pcep/tlv.go
index 89f66b53..822f2a71 100644
--- a/pkg/packet/pcep/tlv.go
+++ b/pkg/packet/pcep/tlv.go
@@ -216,8 +216,8 @@ const (
)
type TLVInterface interface {
- DecodeFromBytes(data []uint8) error
- Serialize() []uint8
+ DecodeFromBytes(data []byte) error
+ Serialize() []byte
MarshalLogObject(enc zapcore.ObjectEncoder) error
Type() TLVType
Len() uint16 // Total length of Type, Length, and Value
@@ -268,7 +268,7 @@ const (
StatefulPCECapabilityFlagsIndex = 3
)
-func (tlv *StatefulPCECapability) DecodeFromBytes(data []uint8) error {
+func (tlv *StatefulPCECapability) DecodeFromBytes(data []byte) error {
if len(data) < int(tlv.Len()) {
return fmt.Errorf("data is too short: expected at least %d bytes, but got %d bytes for StatefulPCECapability", tlv.Len(), len(data))
}
@@ -387,8 +387,8 @@ func (tlv *SymbolicPathName) DecodeFromBytes(data []byte) error {
return fmt.Errorf("data is too short: expected at least %d bytes, but got %d bytes for SymbolicPathName", TLVHeaderLength, len(data))
}
- length := binary.BigEndian.Uint16(data[2:4])
- totalLength := int(TLVHeaderLength + length)
+ nameLen := binary.BigEndian.Uint16(data[2:4])
+ totalLength := TLVHeaderLength + int(nameLen)
if len(data) != totalLength {
return fmt.Errorf("data length mismatch: expected %d bytes, but got %d bytes for SymbolicPathName", totalLength, len(data))
}
@@ -451,7 +451,7 @@ const (
IPv4LSPIdentifiersExtendedTunnelIDIndex = 12
)
-func (tlv *IPv4LSPIdentifiers) DecodeFromBytes(data []uint8) error {
+func (tlv *IPv4LSPIdentifiers) DecodeFromBytes(data []byte) error {
expectedLength := TLVHeaderLength + int(TLVIPv4LSPIdentifiersValueLength)
if len(data) != expectedLength {
return fmt.Errorf("data length mismatch: expected %d bytes, but got %d bytes for IPv4LSPIdentifiers", expectedLength, len(data))
@@ -525,7 +525,7 @@ type IPv6LSPIdentifiers struct {
ExtendedTunnelID [16]byte
}
-func (tlv *IPv6LSPIdentifiers) DecodeFromBytes(data []uint8) error {
+func (tlv *IPv6LSPIdentifiers) DecodeFromBytes(data []byte) error {
expectedLength := TLVHeaderLength + int(TLVIPv6LSPIdentifiersValueLength)
if len(data) != expectedLength {
return fmt.Errorf("data length mismatch: expected %d bytes, but got %d bytes for IPv6LSPIdentifiers", expectedLength, len(data))
@@ -547,8 +547,8 @@ func (tlv *IPv6LSPIdentifiers) DecodeFromBytes(data []uint8) error {
return nil
}
-func (tlv *IPv6LSPIdentifiers) Serialize() []uint8 {
- buf := make([]uint8, tlv.Len())
+func (tlv *IPv6LSPIdentifiers) Serialize() []byte {
+ buf := make([]byte, tlv.Len())
binary.BigEndian.PutUint16(buf[0:2], uint16(tlv.Type()))
binary.BigEndian.PutUint16(buf[2:4], TLVIPv6LSPIdentifiersValueLength)
@@ -587,7 +587,7 @@ type LSPDBVersion struct {
VersionNumber uint64
}
-func (tlv *LSPDBVersion) DecodeFromBytes(data []uint8) error {
+func (tlv *LSPDBVersion) DecodeFromBytes(data []byte) error {
expectedLength := TLVHeaderLength + int(TLVLSPDBVersionValueLength)
if len(data) != expectedLength {
return fmt.Errorf("data length mismatch: expected %d bytes, but got %d bytes for LSPDBVersion", expectedLength, len(data))
@@ -597,18 +597,18 @@ func (tlv *LSPDBVersion) DecodeFromBytes(data []uint8) error {
return nil
}
-func (tlv *LSPDBVersion) Serialize() []uint8 {
- buf := []uint8{}
+func (tlv *LSPDBVersion) Serialize() []byte {
+ buf := []byte{}
- typ := make([]uint8, 2)
+ typ := make([]byte, 2)
binary.BigEndian.PutUint16(typ, uint16(tlv.Type()))
buf = append(buf, typ...)
- length := make([]uint8, 2)
+ length := make([]byte, 2)
binary.BigEndian.PutUint16(length, TLVLSPDBVersionValueLength)
buf = append(buf, length...)
- val := make([]uint8, TLVLSPDBVersionValueLength)
+ val := make([]byte, TLVLSPDBVersionValueLength)
binary.BigEndian.PutUint64(val, tlv.VersionNumber)
buf = append(buf, val...)
@@ -644,8 +644,8 @@ type SRPCECapability struct {
}
const (
- UnlimitedMaximumSIDDepthFlag uint8 = 0x01
- NAISupportedFlag uint8 = 0x02
+ UnlimitedMaximumSIDDepthFlag byte = 0x01
+ NAISupportedFlag byte = 0x02
)
const (
@@ -735,11 +735,11 @@ func NewSRPCECapability(hasUnlimitedMaxSIDDepth bool, isNAISupported bool, maxim
type Pst uint8
const (
- PathSetupTypeRSVPTE Pst = 0x0
- PathSetupTypeSRTE Pst = 0x1
- PathSetupTypePCECCTE Pst = 0x2
- PathSetupTypeSRv6TE Pst = 0x3
- PathSetupTypeIPTE Pst = 0x4
+ PathSetupTypeRSVPTE Pst = 0x00
+ PathSetupTypeSRTE Pst = 0x01
+ PathSetupTypePCECCTE Pst = 0x02
+ PathSetupTypeSRv6TE Pst = 0x03
+ PathSetupTypeIPTE Pst = 0x04
)
var pathSetupDescriptions = map[Pst]struct {
@@ -784,7 +784,7 @@ const (
PathSetupTypePathSetupTypeIndex = 3
)
-func (tlv *PathSetupType) DecodeFromBytes(data []uint8) error {
+func (tlv *PathSetupType) DecodeFromBytes(data []byte) error {
expectedLength := TLVHeaderLength + int(TLVPathSetupTypeValueLength)
if len(data) != expectedLength {
return fmt.Errorf("data length mismatch: expected %d bytes, but got %d bytes for PathSetupType", expectedLength, len(data))
@@ -794,19 +794,19 @@ func (tlv *PathSetupType) DecodeFromBytes(data []uint8) error {
return nil
}
-func (tlv *PathSetupType) Serialize() []uint8 {
- buf := []uint8{}
+func (tlv *PathSetupType) Serialize() []byte {
+ buf := []byte{}
- typ := make([]uint8, 2)
+ typ := make([]byte, 2)
binary.BigEndian.PutUint16(typ, uint16(tlv.Type()))
buf = append(buf, typ...)
- length := make([]uint8, 2)
+ length := make([]byte, 2)
binary.BigEndian.PutUint16(length, TLVPathSetupTypeValueLength)
buf = append(buf, length...)
- val := make([]uint8, TLVPathSetupTypeValueLength)
- val[PathSetupTypePathSetupTypeIndex] = uint8(tlv.PathSetupType)
+ val := make([]byte, TLVPathSetupTypeValueLength)
+ val[PathSetupTypePathSetupTypeIndex] = byte(tlv.PathSetupType)
buf = append(buf, val...)
return buf
@@ -835,7 +835,7 @@ type ExtendedAssociationID struct {
Endpoint netip.Addr
}
-func (tlv *ExtendedAssociationID) DecodeFromBytes(data []uint8) error {
+func (tlv *ExtendedAssociationID) DecodeFromBytes(data []byte) error {
length := binary.BigEndian.Uint16(data[2:4])
tlv.Color = binary.BigEndian.Uint32(data[4:8])
@@ -850,14 +850,14 @@ func (tlv *ExtendedAssociationID) DecodeFromBytes(data []uint8) error {
return nil
}
-func (tlv *ExtendedAssociationID) Serialize() []uint8 {
- buf := []uint8{}
+func (tlv *ExtendedAssociationID) Serialize() []byte {
+ buf := []byte{}
- typ := make([]uint8, 2)
+ typ := make([]byte, 2)
binary.BigEndian.PutUint16(typ, uint16(tlv.Type()))
buf = append(buf, typ...)
- length := make([]uint8, 2)
+ length := make([]byte, 2)
if tlv.Endpoint.Is4() {
binary.BigEndian.PutUint16(length, TLVExtendedAssociationIDIPv4ValueLength)
} else if tlv.Endpoint.Is6() {
@@ -865,7 +865,7 @@ func (tlv *ExtendedAssociationID) Serialize() []uint8 {
}
buf = append(buf, length...)
- color := make([]uint8, 4)
+ color := make([]byte, 4)
binary.BigEndian.PutUint32(color, tlv.Color)
buf = append(buf, color...)
@@ -896,7 +896,7 @@ type PathSetupTypeCapability struct {
SubTLVs []TLVInterface
}
-func (tlv *PathSetupTypeCapability) DecodeFromBytes(data []uint8) error {
+func (tlv *PathSetupTypeCapability) DecodeFromBytes(data []byte) error {
length := binary.BigEndian.Uint16(data[2:4])
pstNum := int(data[7])
@@ -915,10 +915,10 @@ func (tlv *PathSetupTypeCapability) DecodeFromBytes(data []uint8) error {
return nil
}
-func (tlv *PathSetupTypeCapability) Serialize() []uint8 {
- buf := []uint8{}
+func (tlv *PathSetupTypeCapability) Serialize() []byte {
+ buf := []byte{}
- typ := make([]uint8, 2)
+ typ := make([]byte, 2)
binary.BigEndian.PutUint16(typ, uint16(tlv.Type()))
buf = append(buf, typ...)
@@ -932,21 +932,21 @@ func (tlv *PathSetupTypeCapability) Serialize() []uint8 {
for _, subTLV := range tlv.SubTLVs {
length += subTLV.Len()
}
- lengthBytes := make([]uint8, 2)
+ lengthBytes := make([]byte, 2)
binary.BigEndian.PutUint16(lengthBytes, length)
buf = append(buf, lengthBytes...)
- var val []uint8
+ var val []byte
if numOfPst%4 == 0 {
- val = make([]uint8, 4+numOfPst) // 4 byte: Reserve & Num of PST
+ val = make([]byte, 4+numOfPst) // 4 byte: Reserve & Num of PST
} else {
- val = make([]uint8, 4+numOfPst+(4-(numOfPst%4))) // 4 byte: Reserve & Num of PST
+ val = make([]byte, 4+numOfPst+(4-(numOfPst%4))) // 4 byte: Reserve & Num of PST
}
- val[3] = uint8(numOfPst)
+ val[3] = byte(numOfPst)
for i, pst := range tlv.PathSetupTypes {
- val[4+i] = uint8(pst)
+ val[4+i] = byte(pst)
}
for _, subTLV := range tlv.SubTLVs {
@@ -1021,7 +1021,7 @@ type AssocTypeList struct {
AssocTypes []AssocType
}
-func (tlv *AssocTypeList) DecodeFromBytes(data []uint8) error {
+func (tlv *AssocTypeList) DecodeFromBytes(data []byte) error {
AssocTypeNum := binary.BigEndian.Uint16(data[2:4]) / 2
for i := 0; i < int(AssocTypeNum); i++ {
at := binary.BigEndian.Uint16(data[4+2*i : 6+2*i])
@@ -1030,25 +1030,25 @@ func (tlv *AssocTypeList) DecodeFromBytes(data []uint8) error {
return nil
}
-func (tlv *AssocTypeList) Serialize() []uint8 {
- buf := []uint8{}
+func (tlv *AssocTypeList) Serialize() []byte {
+ buf := []byte{}
- typ := make([]uint8, 2)
+ typ := make([]byte, 2)
binary.BigEndian.PutUint16(typ, uint16(tlv.Type()))
buf = append(buf, typ...)
length := uint16(len(tlv.AssocTypes)) * 2
- lengthBytes := make([]uint8, 2)
+ lengthBytes := make([]byte, 2)
binary.BigEndian.PutUint16(lengthBytes, length)
buf = append(buf, lengthBytes...)
for _, at := range tlv.AssocTypes {
- binAt := make([]uint8, 2)
+ binAt := make([]byte, 2)
binary.BigEndian.PutUint16(binAt, uint16(at))
buf = append(buf, binAt...)
}
if length%4 != 0 {
- pad := make([]uint8, 4-(length%4))
+ pad := make([]byte, 4-(length%4))
buf = append(buf, pad...)
}
return buf
@@ -1079,19 +1079,19 @@ type SRPolicyCandidatePathIdentifier struct {
OriginatorAddr netip.Addr // After DecodeFromBytes, even ipv4 addresses are assigned in ipv6 format
}
-func (tlv *SRPolicyCandidatePathIdentifier) DecodeFromBytes(data []uint8) error {
+func (tlv *SRPolicyCandidatePathIdentifier) DecodeFromBytes(data []byte) error {
tlv.OriginatorAddr, _ = netip.AddrFromSlice(data[12:28])
return nil
}
-func (tlv *SRPolicyCandidatePathIdentifier) Serialize() []uint8 {
- buf := []uint8{}
+func (tlv *SRPolicyCandidatePathIdentifier) Serialize() []byte {
+ buf := []byte{}
- typ := make([]uint8, 2)
+ typ := make([]byte, 2)
binary.BigEndian.PutUint16(typ, uint16(tlv.Type()))
buf = append(buf, typ...)
- length := make([]uint8, 2)
+ length := make([]byte, 2)
binary.BigEndian.PutUint16(length, TLVSRPolicyCPathIDValueLength)
buf = append(buf, length...)
@@ -1126,23 +1126,23 @@ type SRPolicyCandidatePathPreference struct {
Preference uint32
}
-func (tlv *SRPolicyCandidatePathPreference) DecodeFromBytes(data []uint8) error {
+func (tlv *SRPolicyCandidatePathPreference) DecodeFromBytes(data []byte) error {
tlv.Preference = binary.BigEndian.Uint32(data[4:8])
return nil
}
-func (tlv *SRPolicyCandidatePathPreference) Serialize() []uint8 {
- buf := []uint8{}
+func (tlv *SRPolicyCandidatePathPreference) Serialize() []byte {
+ buf := []byte{}
- typ := make([]uint8, 2)
+ typ := make([]byte, 2)
binary.BigEndian.PutUint16(typ, uint16(tlv.Type()))
buf = append(buf, typ...)
- length := make([]uint8, 2)
+ length := make([]byte, 2)
binary.BigEndian.PutUint16(length, TLVSRPolicyCPathPreferenceValueLength)
buf = append(buf, length...)
- preference := make([]uint8, 4)
+ preference := make([]byte, 4)
binary.BigEndian.PutUint32(preference, tlv.Preference)
buf = append(buf, preference...)
@@ -1165,23 +1165,23 @@ type Color struct {
Color uint32
}
-func (tlv *Color) DecodeFromBytes(data []uint8) error {
+func (tlv *Color) DecodeFromBytes(data []byte) error {
tlv.Color = binary.BigEndian.Uint32(data[4:8])
return nil
}
-func (tlv *Color) Serialize() []uint8 {
- buf := []uint8{}
+func (tlv *Color) Serialize() []byte {
+ buf := []byte{}
- typ := make([]uint8, 2)
+ typ := make([]byte, 2)
binary.BigEndian.PutUint16(typ, uint16(tlv.Type()))
buf = append(buf, typ...)
- length := make([]uint8, 2)
+ length := make([]byte, 2)
binary.BigEndian.PutUint16(length, uint16(TLVColor))
buf = append(buf, length...)
- color := make([]uint8, 4)
+ color := make([]byte, 4)
binary.BigEndian.PutUint32(color, tlv.Color)
buf = append(buf, color...)
@@ -1203,10 +1203,10 @@ func (tlv *Color) Len() uint16 {
type UndefinedTLV struct {
Typ TLVType
Length uint16
- Value []uint8
+ Value []byte
}
-func (tlv *UndefinedTLV) DecodeFromBytes(data []uint8) error {
+func (tlv *UndefinedTLV) DecodeFromBytes(data []byte) error {
tlv.Typ = TLVType(binary.BigEndian.Uint16(data[0:2]))
tlv.Length = binary.BigEndian.Uint16(data[2:4])
@@ -1214,20 +1214,20 @@ func (tlv *UndefinedTLV) DecodeFromBytes(data []uint8) error {
return nil
}
-func (tlv *UndefinedTLV) Serialize() []uint8 {
- bytePCEPTLV := []uint8{}
+func (tlv *UndefinedTLV) Serialize() []byte {
+ bytePCEPTLV := []byte{}
- byteTLVType := make([]uint8, 2)
+ byteTLVType := make([]byte, 2)
binary.BigEndian.PutUint16(byteTLVType, uint16(tlv.Typ))
bytePCEPTLV = append(bytePCEPTLV, byteTLVType...) // Type (2byte)
- byteTLVLength := make([]uint8, 2)
+ byteTLVLength := make([]byte, 2)
binary.BigEndian.PutUint16(byteTLVLength, tlv.Length)
bytePCEPTLV = append(bytePCEPTLV, byteTLVLength...) // Length (2byte)
bytePCEPTLV = append(bytePCEPTLV, tlv.Value...) // Value (Length byte)
if padding := tlv.Length % 4; padding != 0 {
- bytePadding := make([]uint8, 4-padding)
+ bytePadding := make([]byte, 4-padding)
bytePCEPTLV = append(bytePCEPTLV, bytePadding...)
}
return bytePCEPTLV
@@ -1258,7 +1258,7 @@ func (tlv *UndefinedTLV) SetLength() {
tlv.Length = uint16(len(tlv.Value))
}
-func DecodeTLV(data []uint8) (TLVInterface, error) {
+func DecodeTLV(data []byte) (TLVInterface, error) {
if len(data) < 2 {
return nil, errors.New("insufficient data to read TLV type")
}
@@ -1281,7 +1281,7 @@ func DecodeTLV(data []uint8) (TLVInterface, error) {
return tlv, nil
}
-func DecodeTLVs(data []uint8) ([]TLVInterface, error) {
+func DecodeTLVs(data []byte) ([]TLVInterface, error) {
var tlvs []TLVInterface
for len(data) > 0 {
From 11b1f491359f3a8949d9f0771412f681f3b00375 Mon Sep 17 00:00:00 2001
From: watal
Date: Fri, 18 Apr 2025 17:27:50 +0900
Subject: [PATCH 25/87] refactor(pcep): extend SetBit to support conditional
flag setting
---
pkg/packet/pcep/tlv.go | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/pkg/packet/pcep/tlv.go b/pkg/packet/pcep/tlv.go
index 822f2a71..b3649ded 100644
--- a/pkg/packet/pcep/tlv.go
+++ b/pkg/packet/pcep/tlv.go
@@ -686,12 +686,8 @@ func (tlv *SRPCECapability) Serialize() []byte {
buf = append(buf, length...)
val := make([]byte, TLVSRPCECapabilityValueLength)
- if tlv.HasUnlimitedMaxSIDDepth {
- val[SRPCECapabilityFlagsIndex] = SetBit(val[SRPCECapabilityFlagsIndex], UnlimitedMaximumSIDDepthFlag)
- }
- if tlv.IsNAISupported {
- val[SRPCECapabilityFlagsIndex] = SetBit(val[SRPCECapabilityFlagsIndex], NAISupportedFlag)
- }
+ val[SRPCECapabilityFlagsIndex] = SetBit(val[SRPCECapabilityFlagsIndex], UnlimitedMaximumSIDDepthFlag, tlv.HasUnlimitedMaxSIDDepth)
+ val[SRPCECapabilityFlagsIndex] = SetBit(val[SRPCECapabilityFlagsIndex], NAISupportedFlag, tlv.IsNAISupported)
val[SRPCECapabilityMSDIndex] = tlv.MaximumSidDepth
buf = append(buf, val...)
From 0e05e617b0d6a5d4ee9e104847bac8a3f611f7e9 Mon Sep 17 00:00:00 2001
From: watal
Date: Fri, 18 Apr 2025 17:29:04 +0900
Subject: [PATCH 26/87] refactor(SymbolicPathName): add utf8 validation
---
pkg/packet/pcep/tlv.go | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/pkg/packet/pcep/tlv.go b/pkg/packet/pcep/tlv.go
index b3649ded..392158aa 100644
--- a/pkg/packet/pcep/tlv.go
+++ b/pkg/packet/pcep/tlv.go
@@ -13,6 +13,7 @@ import (
"slices"
"strconv"
"strings"
+ "unicode/utf8"
"go.uber.org/zap/zapcore"
)
@@ -394,6 +395,10 @@ func (tlv *SymbolicPathName) DecodeFromBytes(data []byte) error {
}
tlv.Name = string(data[TLVHeaderLength:totalLength])
+ if !utf8.Valid([]byte(tlv.Name)) {
+ return fmt.Errorf("invalid UTF-8 sequence in SymbolicPathName")
+ }
+
return nil
}
From a9b587f37ee1444f384907b0c29c320fc347c6a8 Mon Sep 17 00:00:00 2001
From: watal
Date: Fri, 18 Apr 2025 17:35:04 +0900
Subject: [PATCH 27/87] refactor(pcep): improve serialization and decoding
using pcep_utils
---
pkg/packet/pcep/object.go | 7 +-
pkg/packet/pcep/tlv.go | 130 +++++++++++++++-----------------------
2 files changed, 54 insertions(+), 83 deletions(-)
diff --git a/pkg/packet/pcep/object.go b/pkg/packet/pcep/object.go
index 012c76cd..9174dc85 100644
--- a/pkg/packet/pcep/object.go
+++ b/pkg/packet/pcep/object.go
@@ -198,9 +198,7 @@ func (h *CommonObjectHeader) Serialize() []uint8 {
Flagbyte = Flagbyte | IFlagMask
}
buf = append(buf, Flagbyte)
- objectLength := make([]uint8, 2)
- binary.BigEndian.PutUint16(objectLength, h.ObjectLength)
- buf = append(buf, objectLength...)
+ buf = append(buf, Uint16ToByteSlice(h.ObjectLength)...)
return buf
}
@@ -1110,8 +1108,7 @@ func (o *SRv6EroSubobject) Serialize() []uint8 {
buf[3] = buf[3] | 0x01
}
reserved := make([]uint8, 2)
- behavior := make([]uint8, 2)
- binary.BigEndian.PutUint16(behavior, o.Segment.Behavior())
+ behavior := Uint16ToByteSlice(o.Segment.Behavior())
byteSid := o.Segment.Sid.AsSlice()
byteNAI := []uint8{}
diff --git a/pkg/packet/pcep/tlv.go b/pkg/packet/pcep/tlv.go
index 392158aa..858e367e 100644
--- a/pkg/packet/pcep/tlv.go
+++ b/pkg/packet/pcep/tlv.go
@@ -274,27 +274,18 @@ func (tlv *StatefulPCECapability) DecodeFromBytes(data []byte) error {
return fmt.Errorf("data is too short: expected at least %d bytes, but got %d bytes for StatefulPCECapability", tlv.Len(), len(data))
}
- flagByte := uint32(data[TLVHeaderLength+StatefulPCECapabilityFlagsIndex])
- tlv.LSPUpdateCapability = IsBitSet(flagByte, LSPUpdateCapabilityBit)
- tlv.IncludeDBVersion = IsBitSet(flagByte, IncludeDBVersionCapabilityBit)
- tlv.LSPInstantiationCapability = IsBitSet(flagByte, LSPInstantiationCapabilityBit)
- tlv.TriggeredResync = IsBitSet(flagByte, TriggeredResyncCapabilityBit)
- tlv.DeltaLSPSyncCapability = IsBitSet(flagByte, DeltaLSPSyncCapabilityBit)
- tlv.TriggeredInitialSync = IsBitSet(flagByte, TriggeredInitialSyncBit)
+ flags := uint32(data[TLVHeaderLength+StatefulPCECapabilityFlagsIndex])
+ tlv.ExtractCapabilities(flags)
return nil
}
func (tlv *StatefulPCECapability) Serialize() []byte {
- buf := make([]byte, 0, TLVHeaderLength+TLVStatefulPCECapabilityValueLength)
- buf = append(buf, byte(tlv.Type()>>8), byte(tlv.Type()))
- buf = append(buf, byte(TLVStatefulPCECapabilityValueLength>>8), byte(TLVStatefulPCECapabilityValueLength))
-
- val := make([]byte, TLVStatefulPCECapabilityValueLength)
- binary.BigEndian.PutUint32(val, tlv.CapabilityBits())
- buf = append(buf, val...)
-
- return buf
+ return AppendByteSlices(
+ Uint16ToByteSlice(tlv.Type()),
+ Uint16ToByteSlice(TLVStatefulPCECapabilityValueLength),
+ Uint32ToByteSlice(tlv.SetFlags()),
+ )
}
func (tlv *StatefulPCECapability) MarshalLogObject(enc zapcore.ObjectEncoder) error {
@@ -315,6 +306,26 @@ func (tlv *StatefulPCECapability) Len() uint16 {
return TLVHeaderLength + TLVStatefulPCECapabilityValueLength
}
+func (tlv *StatefulPCECapability) ExtractCapabilities(flags uint32) {
+ tlv.LSPUpdateCapability = flags&LSPUpdateCapabilityBit != 0
+ tlv.IncludeDBVersion = flags&IncludeDBVersionCapabilityBit != 0
+ tlv.LSPInstantiationCapability = flags&LSPInstantiationCapabilityBit != 0
+ tlv.TriggeredResync = flags&TriggeredResyncCapabilityBit != 0
+ tlv.DeltaLSPSyncCapability = flags&DeltaLSPSyncCapabilityBit != 0
+ tlv.TriggeredInitialSync = flags&TriggeredInitialSyncBit != 0
+}
+
+func (tlv *StatefulPCECapability) SetFlags() uint32 {
+ var flags uint32
+ flags = SetBit(flags, LSPUpdateCapabilityBit, tlv.LSPUpdateCapability)
+ flags = SetBit(flags, IncludeDBVersionCapabilityBit, tlv.IncludeDBVersion)
+ flags = SetBit(flags, LSPInstantiationCapabilityBit, tlv.LSPInstantiationCapability)
+ flags = SetBit(flags, TriggeredResyncCapabilityBit, tlv.TriggeredResync)
+ flags = SetBit(flags, DeltaLSPSyncCapabilityBit, tlv.DeltaLSPSyncCapability)
+ flags = SetBit(flags, TriggeredInitialSyncBit, tlv.TriggeredInitialSync)
+ return flags
+}
+
func (tlv *StatefulPCECapability) CapStrings() []string {
ret := []string{"Stateful"}
if tlv.LSPUpdateCapability {
@@ -341,44 +352,12 @@ func (tlv *StatefulPCECapability) CapStrings() []string {
return ret
}
-func (tlv *StatefulPCECapability) FromBits(bits uint32) {
- tlv.LSPUpdateCapability = bits&LSPUpdateCapabilityBit != 0
- tlv.IncludeDBVersion = bits&IncludeDBVersionCapabilityBit != 0
- tlv.LSPInstantiationCapability = bits&LSPInstantiationCapabilityBit != 0
- tlv.TriggeredResync = bits&TriggeredResyncCapabilityBit != 0
- tlv.DeltaLSPSyncCapability = bits&DeltaLSPSyncCapabilityBit != 0
- tlv.TriggeredInitialSync = bits&TriggeredInitialSyncBit != 0
-}
-
-func NewStatefulPCECapability(bits uint32) *StatefulPCECapability {
+func NewStatefulPCECapability(flags uint32) *StatefulPCECapability {
tlv := &StatefulPCECapability{}
- tlv.FromBits(bits)
+ tlv.ExtractCapabilities(flags)
return tlv
}
-func (tlv *StatefulPCECapability) CapabilityBits() uint32 {
- var flags uint32
- if tlv.LSPUpdateCapability {
- flags = SetBit(flags, LSPUpdateCapabilityBit)
- }
- if tlv.IncludeDBVersion {
- flags = SetBit(flags, IncludeDBVersionCapabilityBit)
- }
- if tlv.LSPInstantiationCapability {
- flags = SetBit(flags, LSPInstantiationCapabilityBit)
- }
- if tlv.TriggeredResync {
- flags = SetBit(flags, TriggeredResyncCapabilityBit)
- }
- if tlv.DeltaLSPSyncCapability {
- flags = SetBit(flags, DeltaLSPSyncCapabilityBit)
- }
- if tlv.TriggeredInitialSync {
- flags = SetBit(flags, TriggeredInitialSyncBit)
- }
- return flags
-}
-
type SymbolicPathName struct {
Name string
}
@@ -403,19 +382,20 @@ func (tlv *SymbolicPathName) DecodeFromBytes(data []byte) error {
}
func (tlv *SymbolicPathName) Serialize() []byte {
+ const alignment = 4
+
nameLen := uint16(len(tlv.Name))
- padding := (4 - (nameLen % 4)) % 4 // Padding for 4-byte alignment
+ padding := (alignment - (nameLen % alignment)) % alignment // Padding for 4-byte alignment
- buf := make([]byte, 0, TLVHeaderLength+int(nameLen)+int(padding))
- buf = append(buf, Uint16ToByteSlice(tlv.Type())...)
- buf = append(buf, Uint16ToByteSlice(nameLen)...)
- buf = append(buf, []byte(tlv.Name)...)
+ value := make([]byte, 0, int(nameLen)+int(padding))
+ value = append(value, []byte(tlv.Name)...)
+ value = append(value, make([]byte, padding)...)
- if padding > 0 {
- buf = append(buf, make([]byte, padding)...)
- }
-
- return buf
+ return AppendByteSlices(
+ Uint16ToByteSlice(tlv.Type()),
+ Uint16ToByteSlice(nameLen),
+ value,
+ )
}
func (tlv *SymbolicPathName) Type() TLVType {
@@ -478,26 +458,20 @@ func (tlv *IPv4LSPIdentifiers) DecodeFromBytes(data []byte) error {
return nil
}
-func (tlv *IPv4LSPIdentifiers) Serialize() []uint8 {
- buf := make([]uint8, 0, TLVHeaderLength+TLVIPv4LSPIdentifiersValueLength)
+func (tlv *IPv4LSPIdentifiers) Serialize() []byte {
+ value := make([]byte, TLVIPv4LSPIdentifiersValueLength)
- typ := make([]uint8, 2)
- binary.BigEndian.PutUint16(typ, uint16(tlv.Type()))
- buf = append(buf, typ...)
+ copy(value[0:4], tlv.IPv4TunnelSenderAddress.AsSlice())
+ binary.BigEndian.PutUint16(value[4:6], tlv.LSPID)
+ binary.BigEndian.PutUint16(value[6:8], tlv.TunnelID)
+ binary.BigEndian.PutUint32(value[8:12], tlv.ExtendedTunnelID)
+ copy(value[12:16], tlv.IPv4TunnelEndpointAddress.AsSlice())
- length := make([]uint8, 2)
- binary.BigEndian.PutUint16(length, TLVIPv4LSPIdentifiersValueLength)
- buf = append(buf, length...)
-
- val := make([]byte, TLVIPv4LSPIdentifiersValueLength)
- copy(val[0:4], tlv.IPv4TunnelSenderAddress.AsSlice())
- binary.BigEndian.PutUint16(val[4:6], tlv.LSPID)
- binary.BigEndian.PutUint16(val[6:8], tlv.TunnelID)
- binary.BigEndian.PutUint32(val[8:12], tlv.ExtendedTunnelID)
- copy(val[12:16], tlv.IPv4TunnelEndpointAddress.AsSlice())
- buf = append(buf, val...)
-
- return buf
+ return AppendByteSlices(
+ Uint16ToByteSlice(tlv.Type()),
+ Uint16ToByteSlice(TLVIPv4LSPIdentifiersValueLength),
+ value,
+ )
}
func (tlv *IPv4LSPIdentifiers) MarshalLogObject(enc zapcore.ObjectEncoder) error {
From 112b3913f47665553074b4e6a44161d7855835ed Mon Sep 17 00:00:00 2001
From: k1yoto
Date: Sat, 17 May 2025 00:44:20 +0000
Subject: [PATCH 28/87] feat(LsPrefixNLRI): merge LsPrefixV4NLRI and
LsPrefixV6NLRI processing
---
internal/pkg/gobgp/interface.go | 82 ++++++++++++++++++---------------
internal/pkg/table/ted.go | 10 ++--
2 files changed, 50 insertions(+), 42 deletions(-)
diff --git a/internal/pkg/gobgp/interface.go b/internal/pkg/gobgp/interface.go
index d190020c..87afe20c 100644
--- a/internal/pkg/gobgp/interface.go
+++ b/internal/pkg/gobgp/interface.go
@@ -111,20 +111,18 @@ func ConvertToTEDElem(dst *api.Destination) ([]table.TEDElem, error) {
return nil, fmt.Errorf("failed to process LS Link NLRI: %w", err)
}
return []table.TEDElem{lsLink}, nil
- case *api.LsPrefixV4NLRI:
- lsPrefixV4List, err := getLsPrefixV4List(path.GetPattrs())
+ case *api.LsPrefixV4NLRI, *api.LsPrefixV6NLRI:
+ lsPrefixList, err := getLsPrefixList(path.GetPattrs())
if err != nil {
return nil, fmt.Errorf("failed to process LS Prefix V4 NLRI: %w", err)
}
- return lsPrefixV4List, nil
+ return lsPrefixList, nil
case *api.LsSrv6SIDNLRI:
lsSrv6SIDList, err := getLsSrv6SIDNLRIList(path.GetPattrs())
if err != nil {
return nil, fmt.Errorf("failed to process LS SRv6 SID NLRI: %w", err)
}
return lsSrv6SIDList, nil
- case *api.LsPrefixV6NLRI:
- return nil, nil // TODO: Implement LsPrefixV6NLRI handling
default:
return nil, fmt.Errorf("invalid LS Link State NLRI type: %T", linkStateNLRI)
}
@@ -219,71 +217,81 @@ func getLsLinkNLRI(typedLinkStateNLRI *api.LsLinkNLRI, pathAttrs []*anypb.Any) (
return lsLink, nil
}
-func getLsPrefixV4List(pathAttrs []*anypb.Any) ([]table.TEDElem, error) {
- var lsPrefixV4List []table.TEDElem
+func getLsPrefixList(pathAttrs []*anypb.Any) ([]table.TEDElem, error) {
+ var lsPrefixList []table.TEDElem
var sidIndex uint32
for _, pathAttr := range pathAttrs {
typedPathAttr, err := pathAttr.UnmarshalNew()
if err != nil {
- return nil, fmt.Errorf("failed to unmarshal path attribute: %w", err)
+ return nil, fmt.Errorf("failed to unmarshal path attribute: %v", err)
}
switch typedPathAttr := typedPathAttr.(type) {
case *api.LsAttribute:
- sidIndex = typedPathAttr.GetPrefix().GetSrPrefixSid()
-
+ if typedPathAttr.GetPrefix().GetSrPrefixSid() != 0 {
+ sidIndex = typedPathAttr.GetPrefix().GetSrPrefixSid()
+ } else {
+ sidIndex = 0
+ }
case *api.MpReachNLRIAttribute:
for _, nlri := range typedPathAttr.GetNlris() {
- typedNLRI, err := nlri.UnmarshalNew()
+ typedNlri, err := nlri.UnmarshalNew()
if err != nil {
- return nil, fmt.Errorf("failed to unmarshal NLRI: %w", err)
+ return nil, fmt.Errorf("failed to unmarshal NLRI: %v", err)
}
- if lsNLRI, ok := typedNLRI.(*api.LsAddrPrefix); ok {
- lsPrefixV4, err := getLsPrefixV4(lsNLRI, sidIndex)
+ if lsNlri, ok := typedNlri.(*api.LsAddrPrefix); ok {
+ lsPrefix, err := getLsPrefix(lsNlri, sidIndex)
if err != nil {
- return nil, fmt.Errorf("failed to get LS Prefix V4: %w", err)
+ return nil, fmt.Errorf("failed to get LS Prefix: %v", err)
}
- lsPrefixV4List = append(lsPrefixV4List, lsPrefixV4)
- } else {
- return nil, fmt.Errorf("unexpected NLRI type: %T", typedNLRI)
+ lsPrefixList = append(lsPrefixList, lsPrefix)
}
}
}
}
- return lsPrefixV4List, nil
+ return lsPrefixList, nil
}
-func getLsPrefixV4(lsNLRI *api.LsAddrPrefix, sidIndex uint32) (*table.LsPrefixV4, error) {
- prefixNLRI, err := lsNLRI.GetNlri().UnmarshalNew()
+func getLsPrefix(lsNlri *api.LsAddrPrefix, sidIndex uint32) (*table.LsPrefix, error) {
+ nlri, err := lsNlri.GetNlri().UnmarshalNew()
if err != nil {
- return nil, fmt.Errorf("failed to unmarshal LS Prefix V4: %w", err)
- }
- prefixv4NLRI, ok := prefixNLRI.(*api.LsPrefixV4NLRI)
- if !ok {
- return nil, fmt.Errorf("invalid LS prefix v4 NLRI type: %T", prefixNLRI)
+ return nil, fmt.Errorf("failed to unmarshal LS Prefix V4: %v", err)
}
- localNodeID := prefixv4NLRI.GetLocalNode().GetIgpRouterId()
- localNodeASN := prefixv4NLRI.GetLocalNode().GetAsn()
- prefixV4 := prefixv4NLRI.GetPrefixDescriptor().GetIpReachability()
+ var localNodeID string
+ var localNodeAsn uint32
+ var prefix []string
+
+ switch prefNlri := nlri.(type) {
+ case *api.LsPrefixV4NLRI:
+ localNodeID = prefNlri.GetLocalNode().GetIgpRouterId()
+ localNodeAsn = prefNlri.GetLocalNode().GetAsn()
+ prefix = prefNlri.GetPrefixDescriptor().GetIpReachability()
+ case *api.LsPrefixV6NLRI:
+ localNodeID = prefNlri.GetLocalNode().GetIgpRouterId()
+ localNodeAsn = prefNlri.GetLocalNode().GetAsn()
+ prefix = prefNlri.GetPrefixDescriptor().GetIpReachability()
+ default:
+ return nil, errors.New("invalid LS prefix NLRI type")
+ }
- localNode := table.NewLsNode(localNodeASN, localNodeID)
- lsPrefixV4 := table.NewLsPrefixV4(localNode)
- lsPrefixV4.SidIndex = sidIndex
+ localNode := table.NewLsNode(localNodeAsn, localNodeID)
+ lsPrefix := table.NewLsPrefix(localNode)
+ lsPrefix.SidIndex = sidIndex
- if len(prefixV4) != 1 {
- return nil, fmt.Errorf("invalid prefix length: expected 1, got %d", len(prefixV4))
+ if len(prefix) != 1 {
+ return nil, errors.New("invalid prefix length: expected 1 prefix")
}
- lsPrefixV4.Prefix, err = netip.ParsePrefix(prefixV4[0])
+ lsPrefix.Prefix, err = netip.ParsePrefix(prefix[0])
if err != nil {
- return nil, fmt.Errorf("failed to parse prefix %q: %w", prefixV4[0], err)
+ return nil, fmt.Errorf("failed to parse prefix: %v", err)
}
- return lsPrefixV4, nil
+ return lsPrefix, nil
}
func getLsSrv6SIDNLRIList(pathAttrs []*anypb.Any) ([]table.TEDElem, error) {
diff --git a/internal/pkg/table/ted.go b/internal/pkg/table/ted.go
index 51bd705f..07d10f4f 100644
--- a/internal/pkg/table/ted.go
+++ b/internal/pkg/table/ted.go
@@ -74,7 +74,7 @@ type LsNode struct {
SrgbBegin uint32 // in BGP-LS Attr
SrgbEnd uint32 // in BGP-LS Attr
Links []*LsLink
- Prefixes []*LsPrefixV4
+ Prefixes []*LsPrefix
SRv6SIDs []*LsSrv6SID
}
@@ -179,19 +179,19 @@ func (l *LsLink) UpdateTED(ted *LsTED) {
l.LocalNode.AddLink(l)
}
-type LsPrefixV4 struct {
+type LsPrefix struct {
LocalNode *LsNode // primary key, in MP_REACH_NLRI Attr
Prefix netip.Prefix // in MP_REACH_NLRI Attr
SidIndex uint32 // in BGP-LS Attr (only for Lo Address Prefix)
}
-func NewLsPrefixV4(localNode *LsNode) *LsPrefixV4 {
- return &LsPrefixV4{
+func NewLsPrefix(localNode *LsNode) *LsPrefix {
+ return &LsPrefix{
LocalNode: localNode,
}
}
-func (lp *LsPrefixV4) UpdateTED(ted *LsTED) {
+func (lp *LsPrefix) UpdateTED(ted *LsTED) {
nodes, asn := ted.Nodes, lp.LocalNode.ASN
if _, ok := nodes[asn]; !ok {
From ff67e9a47b5ff94e50b8b7ad8cc8b9d3c86f0e94 Mon Sep 17 00:00:00 2001
From: k1yoto
Date: Sat, 17 May 2025 00:48:52 +0000
Subject: [PATCH 29/87] feat(grpc): support LsSRv6SIDNLRI and LsPrefixV6NLRI
---
api/pola/v1/pola.pb.go | 687 +++++++++++++++++++++++------------
api/pola/v1/pola.proto | 15 +
cmd/pola/grpc/grpc_client.go | 30 +-
pkg/server/grpc_server.go | 22 ++
4 files changed, 521 insertions(+), 233 deletions(-)
diff --git a/api/pola/v1/pola.pb.go b/api/pola/v1/pola.pb.go
index c56ab5d0..27e62d8e 100644
--- a/api/pola/v1/pola.pb.go
+++ b/api/pola/v1/pola.pb.go
@@ -753,6 +753,163 @@ func (x *SRPolicyList) GetSrPolicies() []*SRPolicy {
return nil
}
+type LsSrv6SID struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Sids []*SID `protobuf:"bytes,1,rep,name=sids,proto3" json:"sids,omitempty"`
+ EndpointBehavior uint32 `protobuf:"varint,2,opt,name=endpoint_behavior,json=endpointBehavior,proto3" json:"endpoint_behavior,omitempty"`
+ MultiTopoIds []*MultiTopoID `protobuf:"bytes,3,rep,name=multi_topo_ids,json=multiTopoIds,proto3" json:"multi_topo_ids,omitempty"`
+}
+
+func (x *LsSrv6SID) Reset() {
+ *x = LsSrv6SID{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[9]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *LsSrv6SID) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*LsSrv6SID) ProtoMessage() {}
+
+func (x *LsSrv6SID) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[9]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use LsSrv6SID.ProtoReflect.Descriptor instead.
+func (*LsSrv6SID) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{9}
+}
+
+func (x *LsSrv6SID) GetSids() []*SID {
+ if x != nil {
+ return x.Sids
+ }
+ return nil
+}
+
+func (x *LsSrv6SID) GetEndpointBehavior() uint32 {
+ if x != nil {
+ return x.EndpointBehavior
+ }
+ return 0
+}
+
+func (x *LsSrv6SID) GetMultiTopoIds() []*MultiTopoID {
+ if x != nil {
+ return x.MultiTopoIds
+ }
+ return nil
+}
+
+type SID struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Sid string `protobuf:"bytes,1,opt,name=sid,proto3" json:"sid,omitempty"`
+}
+
+func (x *SID) Reset() {
+ *x = SID{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[10]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SID) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SID) ProtoMessage() {}
+
+func (x *SID) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[10]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SID.ProtoReflect.Descriptor instead.
+func (*SID) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{10}
+}
+
+func (x *SID) GetSid() string {
+ if x != nil {
+ return x.Sid
+ }
+ return ""
+}
+
+type MultiTopoID struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ MultiTopoId uint32 `protobuf:"varint,1,opt,name=multi_topo_id,json=multiTopoId,proto3" json:"multi_topo_id,omitempty"`
+}
+
+func (x *MultiTopoID) Reset() {
+ *x = MultiTopoID{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[11]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *MultiTopoID) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*MultiTopoID) ProtoMessage() {}
+
+func (x *MultiTopoID) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[11]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use MultiTopoID.ProtoReflect.Descriptor instead.
+func (*MultiTopoID) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{11}
+}
+
+func (x *MultiTopoID) GetMultiTopoId() uint32 {
+ if x != nil {
+ return x.MultiTopoId
+ }
+ return 0
+}
+
type LsPrefix struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -765,7 +922,7 @@ type LsPrefix struct {
func (x *LsPrefix) Reset() {
*x = LsPrefix{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[9]
+ mi := &file_pola_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -778,7 +935,7 @@ func (x *LsPrefix) String() string {
func (*LsPrefix) ProtoMessage() {}
func (x *LsPrefix) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[9]
+ mi := &file_pola_proto_msgTypes[12]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -791,7 +948,7 @@ func (x *LsPrefix) ProtoReflect() protoreflect.Message {
// Deprecated: Use LsPrefix.ProtoReflect.Descriptor instead.
func (*LsPrefix) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{9}
+ return file_pola_proto_rawDescGZIP(), []int{12}
}
func (x *LsPrefix) GetPrefix() string {
@@ -820,7 +977,7 @@ type Metric struct {
func (x *Metric) Reset() {
*x = Metric{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[10]
+ mi := &file_pola_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -833,7 +990,7 @@ func (x *Metric) String() string {
func (*Metric) ProtoMessage() {}
func (x *Metric) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[10]
+ mi := &file_pola_proto_msgTypes[13]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -846,7 +1003,7 @@ func (x *Metric) ProtoReflect() protoreflect.Message {
// Deprecated: Use Metric.ProtoReflect.Descriptor instead.
func (*Metric) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{10}
+ return file_pola_proto_rawDescGZIP(), []int{13}
}
func (x *Metric) GetType() MetricType {
@@ -881,7 +1038,7 @@ type LsLink struct {
func (x *LsLink) Reset() {
*x = LsLink{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[11]
+ mi := &file_pola_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -894,7 +1051,7 @@ func (x *LsLink) String() string {
func (*LsLink) ProtoMessage() {}
func (x *LsLink) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[11]
+ mi := &file_pola_proto_msgTypes[14]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -907,7 +1064,7 @@ func (x *LsLink) ProtoReflect() protoreflect.Message {
// Deprecated: Use LsLink.ProtoReflect.Descriptor instead.
func (*LsLink) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{11}
+ return file_pola_proto_rawDescGZIP(), []int{14}
}
func (x *LsLink) GetLocalRouterId() string {
@@ -971,20 +1128,21 @@ type LsNode struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
- Asn uint32 `protobuf:"varint,1,opt,name=asn,proto3" json:"asn,omitempty"`
- RouterId string `protobuf:"bytes,2,opt,name=router_id,json=routerId,proto3" json:"router_id,omitempty"`
- IsisAreaId string `protobuf:"bytes,3,opt,name=isis_area_id,json=isisAreaId,proto3" json:"isis_area_id,omitempty"`
- Hostname string `protobuf:"bytes,4,opt,name=hostname,proto3" json:"hostname,omitempty"`
- SrgbBegin uint32 `protobuf:"varint,5,opt,name=srgb_begin,json=srgbBegin,proto3" json:"srgb_begin,omitempty"`
- SrgbEnd uint32 `protobuf:"varint,6,opt,name=srgb_end,json=srgbEnd,proto3" json:"srgb_end,omitempty"`
- LsLinks []*LsLink `protobuf:"bytes,7,rep,name=ls_links,json=lsLinks,proto3" json:"ls_links,omitempty"`
- LsPrefixes []*LsPrefix `protobuf:"bytes,8,rep,name=ls_prefixes,json=lsPrefixes,proto3" json:"ls_prefixes,omitempty"`
+ Asn uint32 `protobuf:"varint,1,opt,name=asn,proto3" json:"asn,omitempty"`
+ RouterId string `protobuf:"bytes,2,opt,name=router_id,json=routerId,proto3" json:"router_id,omitempty"`
+ IsisAreaId string `protobuf:"bytes,3,opt,name=isis_area_id,json=isisAreaId,proto3" json:"isis_area_id,omitempty"`
+ Hostname string `protobuf:"bytes,4,opt,name=hostname,proto3" json:"hostname,omitempty"`
+ SrgbBegin uint32 `protobuf:"varint,5,opt,name=srgb_begin,json=srgbBegin,proto3" json:"srgb_begin,omitempty"`
+ SrgbEnd uint32 `protobuf:"varint,6,opt,name=srgb_end,json=srgbEnd,proto3" json:"srgb_end,omitempty"`
+ LsLinks []*LsLink `protobuf:"bytes,7,rep,name=ls_links,json=lsLinks,proto3" json:"ls_links,omitempty"`
+ LsPrefixes []*LsPrefix `protobuf:"bytes,8,rep,name=ls_prefixes,json=lsPrefixes,proto3" json:"ls_prefixes,omitempty"`
+ LsSrv6Sids []*LsSrv6SID `protobuf:"bytes,9,rep,name=ls_srv6_sids,json=lsSrv6Sids,proto3" json:"ls_srv6_sids,omitempty"`
}
func (x *LsNode) Reset() {
*x = LsNode{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[12]
+ mi := &file_pola_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -997,7 +1155,7 @@ func (x *LsNode) String() string {
func (*LsNode) ProtoMessage() {}
func (x *LsNode) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[12]
+ mi := &file_pola_proto_msgTypes[15]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1010,7 +1168,7 @@ func (x *LsNode) ProtoReflect() protoreflect.Message {
// Deprecated: Use LsNode.ProtoReflect.Descriptor instead.
func (*LsNode) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{12}
+ return file_pola_proto_rawDescGZIP(), []int{15}
}
func (x *LsNode) GetAsn() uint32 {
@@ -1069,6 +1227,13 @@ func (x *LsNode) GetLsPrefixes() []*LsPrefix {
return nil
}
+func (x *LsNode) GetLsSrv6Sids() []*LsSrv6SID {
+ if x != nil {
+ return x.LsSrv6Sids
+ }
+ return nil
+}
+
type TED struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -1081,7 +1246,7 @@ type TED struct {
func (x *TED) Reset() {
*x = TED{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[13]
+ mi := &file_pola_proto_msgTypes[16]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1094,7 +1259,7 @@ func (x *TED) String() string {
func (*TED) ProtoMessage() {}
func (x *TED) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[13]
+ mi := &file_pola_proto_msgTypes[16]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1107,7 +1272,7 @@ func (x *TED) ProtoReflect() protoreflect.Message {
// Deprecated: Use TED.ProtoReflect.Descriptor instead.
func (*TED) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{13}
+ return file_pola_proto_rawDescGZIP(), []int{16}
}
func (x *TED) GetEnable() bool {
@@ -1133,7 +1298,7 @@ type GetSessionListRequest struct {
func (x *GetSessionListRequest) Reset() {
*x = GetSessionListRequest{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[14]
+ mi := &file_pola_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1146,7 +1311,7 @@ func (x *GetSessionListRequest) String() string {
func (*GetSessionListRequest) ProtoMessage() {}
func (x *GetSessionListRequest) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[14]
+ mi := &file_pola_proto_msgTypes[17]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1159,7 +1324,7 @@ func (x *GetSessionListRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetSessionListRequest.ProtoReflect.Descriptor instead.
func (*GetSessionListRequest) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{14}
+ return file_pola_proto_rawDescGZIP(), []int{17}
}
type GetSessionListResponse struct {
@@ -1173,7 +1338,7 @@ type GetSessionListResponse struct {
func (x *GetSessionListResponse) Reset() {
*x = GetSessionListResponse{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[15]
+ mi := &file_pola_proto_msgTypes[18]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1186,7 +1351,7 @@ func (x *GetSessionListResponse) String() string {
func (*GetSessionListResponse) ProtoMessage() {}
func (x *GetSessionListResponse) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[15]
+ mi := &file_pola_proto_msgTypes[18]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1199,7 +1364,7 @@ func (x *GetSessionListResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetSessionListResponse.ProtoReflect.Descriptor instead.
func (*GetSessionListResponse) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{15}
+ return file_pola_proto_rawDescGZIP(), []int{18}
}
func (x *GetSessionListResponse) GetSessions() []*Session {
@@ -1218,7 +1383,7 @@ type GetSRPolicyListRequest struct {
func (x *GetSRPolicyListRequest) Reset() {
*x = GetSRPolicyListRequest{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[16]
+ mi := &file_pola_proto_msgTypes[19]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1231,7 +1396,7 @@ func (x *GetSRPolicyListRequest) String() string {
func (*GetSRPolicyListRequest) ProtoMessage() {}
func (x *GetSRPolicyListRequest) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[16]
+ mi := &file_pola_proto_msgTypes[19]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1244,7 +1409,7 @@ func (x *GetSRPolicyListRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetSRPolicyListRequest.ProtoReflect.Descriptor instead.
func (*GetSRPolicyListRequest) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{16}
+ return file_pola_proto_rawDescGZIP(), []int{19}
}
type GetSRPolicyListResponse struct {
@@ -1258,7 +1423,7 @@ type GetSRPolicyListResponse struct {
func (x *GetSRPolicyListResponse) Reset() {
*x = GetSRPolicyListResponse{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[17]
+ mi := &file_pola_proto_msgTypes[20]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1271,7 +1436,7 @@ func (x *GetSRPolicyListResponse) String() string {
func (*GetSRPolicyListResponse) ProtoMessage() {}
func (x *GetSRPolicyListResponse) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[17]
+ mi := &file_pola_proto_msgTypes[20]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1284,7 +1449,7 @@ func (x *GetSRPolicyListResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetSRPolicyListResponse.ProtoReflect.Descriptor instead.
func (*GetSRPolicyListResponse) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{17}
+ return file_pola_proto_rawDescGZIP(), []int{20}
}
func (x *GetSRPolicyListResponse) GetSrPolicies() []*SRPolicy {
@@ -1303,7 +1468,7 @@ type GetTEDRequest struct {
func (x *GetTEDRequest) Reset() {
*x = GetTEDRequest{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[18]
+ mi := &file_pola_proto_msgTypes[21]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1316,7 +1481,7 @@ func (x *GetTEDRequest) String() string {
func (*GetTEDRequest) ProtoMessage() {}
func (x *GetTEDRequest) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[18]
+ mi := &file_pola_proto_msgTypes[21]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1329,7 +1494,7 @@ func (x *GetTEDRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetTEDRequest.ProtoReflect.Descriptor instead.
func (*GetTEDRequest) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{18}
+ return file_pola_proto_rawDescGZIP(), []int{21}
}
type GetTEDResponse struct {
@@ -1344,7 +1509,7 @@ type GetTEDResponse struct {
func (x *GetTEDResponse) Reset() {
*x = GetTEDResponse{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[19]
+ mi := &file_pola_proto_msgTypes[22]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1357,7 +1522,7 @@ func (x *GetTEDResponse) String() string {
func (*GetTEDResponse) ProtoMessage() {}
func (x *GetTEDResponse) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[19]
+ mi := &file_pola_proto_msgTypes[22]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1370,7 +1535,7 @@ func (x *GetTEDResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetTEDResponse.ProtoReflect.Descriptor instead.
func (*GetTEDResponse) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{19}
+ return file_pola_proto_rawDescGZIP(), []int{22}
}
func (x *GetTEDResponse) GetEnable() bool {
@@ -1398,7 +1563,7 @@ type DeleteSessionRequest struct {
func (x *DeleteSessionRequest) Reset() {
*x = DeleteSessionRequest{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[20]
+ mi := &file_pola_proto_msgTypes[23]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1411,7 +1576,7 @@ func (x *DeleteSessionRequest) String() string {
func (*DeleteSessionRequest) ProtoMessage() {}
func (x *DeleteSessionRequest) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[20]
+ mi := &file_pola_proto_msgTypes[23]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1424,7 +1589,7 @@ func (x *DeleteSessionRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteSessionRequest.ProtoReflect.Descriptor instead.
func (*DeleteSessionRequest) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{20}
+ return file_pola_proto_rawDescGZIP(), []int{23}
}
func (x *DeleteSessionRequest) GetAddr() []byte {
@@ -1445,7 +1610,7 @@ type DeleteSessionResponse struct {
func (x *DeleteSessionResponse) Reset() {
*x = DeleteSessionResponse{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[21]
+ mi := &file_pola_proto_msgTypes[24]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1458,7 +1623,7 @@ func (x *DeleteSessionResponse) String() string {
func (*DeleteSessionResponse) ProtoMessage() {}
func (x *DeleteSessionResponse) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[21]
+ mi := &file_pola_proto_msgTypes[24]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1471,7 +1636,7 @@ func (x *DeleteSessionResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteSessionResponse.ProtoReflect.Descriptor instead.
func (*DeleteSessionResponse) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{21}
+ return file_pola_proto_rawDescGZIP(), []int{24}
}
func (x *DeleteSessionResponse) GetIsSuccess() bool {
@@ -1558,139 +1723,157 @@ var file_pola_proto_rawDesc = []byte{
0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15,
0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x52, 0x50,
0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x0a, 0x73, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65,
- 0x73, 0x22, 0x3f, 0x0a, 0x08, 0x4c, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x16, 0x0a,
- 0x06, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70,
- 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x69, 0x64, 0x5f, 0x69, 0x6e, 0x64,
- 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x73, 0x69, 0x64, 0x49, 0x6e, 0x64,
- 0x65, 0x78, 0x22, 0x4b, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x2b, 0x0a, 0x04,
- 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x61, 0x70, 0x69,
- 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54,
- 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c,
- 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22,
- 0x96, 0x02, 0x0a, 0x06, 0x4c, 0x73, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x26, 0x0a, 0x0f, 0x6c, 0x6f,
- 0x63, 0x61, 0x6c, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20,
- 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x72,
- 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x61, 0x73, 0x6e, 0x18,
- 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x41, 0x73, 0x6e, 0x12,
- 0x19, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x69, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28,
- 0x09, 0x52, 0x07, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x49, 0x70, 0x12, 0x28, 0x0a, 0x10, 0x72, 0x65,
- 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x04,
- 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x52, 0x6f, 0x75, 0x74,
- 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x61,
- 0x73, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65,
- 0x41, 0x73, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x69, 0x70,
- 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x49, 0x70,
- 0x12, 0x2d, 0x0a, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28,
- 0x0b, 0x32, 0x13, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e,
- 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12,
- 0x17, 0x0a, 0x07, 0x61, 0x64, 0x6a, 0x5f, 0x73, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0d,
- 0x52, 0x06, 0x61, 0x64, 0x6a, 0x53, 0x69, 0x64, 0x22, 0x97, 0x02, 0x0a, 0x06, 0x4c, 0x73, 0x4e,
- 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x73, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d,
- 0x52, 0x03, 0x61, 0x73, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f,
- 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72,
- 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0c, 0x69, 0x73, 0x69, 0x73, 0x5f, 0x61, 0x72, 0x65, 0x61, 0x5f,
- 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x73, 0x69, 0x73, 0x41, 0x72,
- 0x65, 0x61, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65,
- 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65,
- 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x72, 0x67, 0x62, 0x5f, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x18, 0x05,
- 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x73, 0x72, 0x67, 0x62, 0x42, 0x65, 0x67, 0x69, 0x6e, 0x12,
- 0x19, 0x0a, 0x08, 0x73, 0x72, 0x67, 0x62, 0x5f, 0x65, 0x6e, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28,
- 0x0d, 0x52, 0x07, 0x73, 0x72, 0x67, 0x62, 0x45, 0x6e, 0x64, 0x12, 0x2e, 0x0a, 0x08, 0x6c, 0x73,
- 0x5f, 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x61,
- 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x73, 0x4c, 0x69, 0x6e,
- 0x6b, 0x52, 0x07, 0x6c, 0x73, 0x4c, 0x69, 0x6e, 0x6b, 0x73, 0x12, 0x36, 0x0a, 0x0b, 0x6c, 0x73,
- 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32,
- 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x73,
- 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x52, 0x0a, 0x6c, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78,
- 0x65, 0x73, 0x22, 0x4d, 0x0a, 0x03, 0x54, 0x45, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x61,
- 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x65, 0x6e, 0x61, 0x62, 0x6c,
- 0x65, 0x12, 0x2e, 0x0a, 0x08, 0x6c, 0x73, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20,
- 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76,
- 0x31, 0x2e, 0x4c, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x07, 0x6c, 0x73, 0x4e, 0x6f, 0x64, 0x65,
- 0x73, 0x22, 0x17, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c,
- 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x4a, 0x0a, 0x16, 0x47, 0x65,
- 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70,
- 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x08, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73,
- 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c,
- 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x73, 0x65,
- 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x18, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x53, 0x52, 0x50,
- 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
- 0x22, 0x51, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4c,
- 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x0b, 0x73,
- 0x72, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
- 0x32, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x53,
- 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x0a, 0x73, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63,
- 0x69, 0x65, 0x73, 0x22, 0x0f, 0x0a, 0x0d, 0x47, 0x65, 0x74, 0x54, 0x45, 0x44, 0x52, 0x65, 0x71,
- 0x75, 0x65, 0x73, 0x74, 0x22, 0x58, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x54, 0x45, 0x44, 0x52, 0x65,
- 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65,
- 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x2e,
- 0x0a, 0x08, 0x6c, 0x73, 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b,
- 0x32, 0x13, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4c,
- 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x07, 0x6c, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x22, 0x2a,
- 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52,
- 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01,
- 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x22, 0x36, 0x0a, 0x15, 0x44, 0x65,
- 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f,
- 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73, 0x5f, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73,
- 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x65,
- 0x73, 0x73, 0x2a, 0x67, 0x0a, 0x0c, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x54, 0x79,
- 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x1a, 0x53, 0x52, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f,
- 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44,
- 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x53, 0x52, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f,
- 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x58, 0x50, 0x4c, 0x49, 0x43, 0x49, 0x54, 0x10, 0x01, 0x12,
- 0x1a, 0x0a, 0x16, 0x53, 0x52, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x54, 0x59, 0x50,
- 0x45, 0x5f, 0x44, 0x59, 0x4e, 0x41, 0x4d, 0x49, 0x43, 0x10, 0x02, 0x2a, 0x5b, 0x0a, 0x0c, 0x53,
- 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x53,
- 0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x55, 0x4e, 0x53,
- 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x45,
- 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x44, 0x4f, 0x57, 0x4e,
- 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54,
- 0x41, 0x54, 0x45, 0x5f, 0x55, 0x50, 0x10, 0x02, 0x2a, 0x83, 0x01, 0x0a, 0x0a, 0x4d, 0x65, 0x74,
- 0x72, 0x69, 0x63, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x17, 0x4d, 0x45, 0x54, 0x52, 0x49,
- 0x43, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49,
- 0x45, 0x44, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54,
- 0x59, 0x50, 0x45, 0x5f, 0x49, 0x47, 0x50, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x4d, 0x45, 0x54,
- 0x52, 0x49, 0x43, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x45, 0x10, 0x02, 0x12, 0x15, 0x0a,
- 0x11, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x45, 0x4c,
- 0x41, 0x59, 0x10, 0x03, 0x12, 0x18, 0x0a, 0x14, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54,
- 0x59, 0x50, 0x45, 0x5f, 0x48, 0x4f, 0x50, 0x43, 0x4f, 0x55, 0x4e, 0x54, 0x10, 0x04, 0x32, 0x96,
- 0x04, 0x0a, 0x0a, 0x50, 0x43, 0x45, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x59, 0x0a,
- 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12,
- 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72,
- 0x65, 0x61, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75,
- 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76,
- 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79,
- 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65,
- 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x22, 0x2e, 0x61, 0x70, 0x69,
+ 0x73, 0x22, 0x9e, 0x01, 0x0a, 0x09, 0x4c, 0x73, 0x53, 0x72, 0x76, 0x36, 0x53, 0x49, 0x44, 0x12,
+ 0x24, 0x0a, 0x04, 0x73, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e,
+ 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x49, 0x44, 0x52,
+ 0x04, 0x73, 0x69, 0x64, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e,
+ 0x74, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d,
+ 0x52, 0x10, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69,
+ 0x6f, 0x72, 0x12, 0x3e, 0x0a, 0x0e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x5f, 0x74, 0x6f, 0x70, 0x6f,
+ 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x70, 0x69,
+ 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x54, 0x6f,
+ 0x70, 0x6f, 0x49, 0x44, 0x52, 0x0c, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x54, 0x6f, 0x70, 0x6f, 0x49,
+ 0x64, 0x73, 0x22, 0x17, 0x0a, 0x03, 0x53, 0x49, 0x44, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x69, 0x64,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x69, 0x64, 0x22, 0x31, 0x0a, 0x0b, 0x4d,
+ 0x75, 0x6c, 0x74, 0x69, 0x54, 0x6f, 0x70, 0x6f, 0x49, 0x44, 0x12, 0x22, 0x0a, 0x0d, 0x6d, 0x75,
+ 0x6c, 0x74, 0x69, 0x5f, 0x74, 0x6f, 0x70, 0x6f, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x0d, 0x52, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x54, 0x6f, 0x70, 0x6f, 0x49, 0x64, 0x22, 0x3f,
+ 0x0a, 0x08, 0x4c, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x72,
+ 0x65, 0x66, 0x69, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x72, 0x65, 0x66,
+ 0x69, 0x78, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x69, 0x64, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x73, 0x69, 0x64, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x22,
+ 0x4b, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x12, 0x2b, 0x0a, 0x04, 0x74, 0x79, 0x70,
+ 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f,
+ 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x79, 0x70, 0x65,
+ 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x96, 0x02, 0x0a,
+ 0x06, 0x4c, 0x73, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x26, 0x0a, 0x0f, 0x6c, 0x6f, 0x63, 0x61, 0x6c,
+ 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x0d, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12,
+ 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x61, 0x73, 0x6e, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x0d, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x41, 0x73, 0x6e, 0x12, 0x19, 0x0a, 0x08,
+ 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x69, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
+ 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x49, 0x70, 0x12, 0x28, 0x0a, 0x10, 0x72, 0x65, 0x6d, 0x6f, 0x74,
+ 0x65, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x0e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x49,
+ 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x61, 0x73, 0x6e, 0x18,
+ 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x73, 0x6e,
+ 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x69, 0x70, 0x18, 0x06, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x49, 0x70, 0x12, 0x2d, 0x0a,
+ 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13,
+ 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x74,
+ 0x72, 0x69, 0x63, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x17, 0x0a, 0x07,
+ 0x61, 0x64, 0x6a, 0x5f, 0x73, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x61,
+ 0x64, 0x6a, 0x53, 0x69, 0x64, 0x22, 0xd1, 0x02, 0x0a, 0x06, 0x4c, 0x73, 0x4e, 0x6f, 0x64, 0x65,
+ 0x12, 0x10, 0x0a, 0x03, 0x61, 0x73, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x61,
+ 0x73, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12,
+ 0x20, 0x0a, 0x0c, 0x69, 0x73, 0x69, 0x73, 0x5f, 0x61, 0x72, 0x65, 0x61, 0x5f, 0x69, 0x64, 0x18,
+ 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x73, 0x69, 0x73, 0x41, 0x72, 0x65, 0x61, 0x49,
+ 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a,
+ 0x0a, 0x73, 0x72, 0x67, 0x62, 0x5f, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28,
+ 0x0d, 0x52, 0x09, 0x73, 0x72, 0x67, 0x62, 0x42, 0x65, 0x67, 0x69, 0x6e, 0x12, 0x19, 0x0a, 0x08,
+ 0x73, 0x72, 0x67, 0x62, 0x5f, 0x65, 0x6e, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07,
+ 0x73, 0x72, 0x67, 0x62, 0x45, 0x6e, 0x64, 0x12, 0x2e, 0x0a, 0x08, 0x6c, 0x73, 0x5f, 0x6c, 0x69,
+ 0x6e, 0x6b, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x61, 0x70, 0x69, 0x2e,
+ 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x73, 0x4c, 0x69, 0x6e, 0x6b, 0x52, 0x07,
+ 0x6c, 0x73, 0x4c, 0x69, 0x6e, 0x6b, 0x73, 0x12, 0x36, 0x0a, 0x0b, 0x6c, 0x73, 0x5f, 0x70, 0x72,
+ 0x65, 0x66, 0x69, 0x78, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x61,
+ 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x73, 0x50, 0x72, 0x65,
+ 0x66, 0x69, 0x78, 0x52, 0x0a, 0x6c, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x65, 0x73, 0x12,
+ 0x38, 0x0a, 0x0c, 0x6c, 0x73, 0x5f, 0x73, 0x72, 0x76, 0x36, 0x5f, 0x73, 0x69, 0x64, 0x73, 0x18,
+ 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61,
+ 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x73, 0x53, 0x72, 0x76, 0x36, 0x53, 0x49, 0x44, 0x52, 0x0a, 0x6c,
+ 0x73, 0x53, 0x72, 0x76, 0x36, 0x53, 0x69, 0x64, 0x73, 0x22, 0x4d, 0x0a, 0x03, 0x54, 0x45, 0x44,
+ 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08,
+ 0x52, 0x06, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x2e, 0x0a, 0x08, 0x6c, 0x73, 0x5f, 0x6e,
+ 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x61, 0x70, 0x69,
+ 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x52,
+ 0x07, 0x6c, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x22, 0x17, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x53,
+ 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
+ 0x74, 0x22, 0x4a, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c,
+ 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x08, 0x73,
+ 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e,
+ 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x73, 0x73,
+ 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x18, 0x0a,
+ 0x16, 0x47, 0x65, 0x74, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4c, 0x69, 0x73, 0x74,
+ 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x51, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x53, 0x52,
+ 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
+ 0x73, 0x65, 0x12, 0x36, 0x0a, 0x0b, 0x73, 0x72, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65,
+ 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f,
+ 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x0a,
+ 0x73, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x22, 0x0f, 0x0a, 0x0d, 0x47, 0x65,
+ 0x74, 0x54, 0x45, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x58, 0x0a, 0x0e, 0x47,
+ 0x65, 0x74, 0x54, 0x45, 0x44, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a,
+ 0x06, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x65,
+ 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x2e, 0x0a, 0x08, 0x6c, 0x73, 0x5f, 0x6e, 0x6f, 0x64, 0x65,
+ 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f,
+ 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x07, 0x6c, 0x73,
+ 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x22, 0x2a, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53,
+ 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a,
+ 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x61, 0x64, 0x64,
+ 0x72, 0x22, 0x36, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69,
+ 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73,
+ 0x5f, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09,
+ 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x2a, 0x67, 0x0a, 0x0c, 0x53, 0x52, 0x50,
+ 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x1a, 0x53, 0x52, 0x5f,
+ 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50,
+ 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x53, 0x52, 0x5f,
+ 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x58, 0x50, 0x4c,
+ 0x49, 0x43, 0x49, 0x54, 0x10, 0x01, 0x12, 0x1a, 0x0a, 0x16, 0x53, 0x52, 0x5f, 0x50, 0x4f, 0x4c,
+ 0x49, 0x43, 0x59, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x59, 0x4e, 0x41, 0x4d, 0x49, 0x43,
+ 0x10, 0x02, 0x2a, 0x5b, 0x0a, 0x0c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61,
+ 0x74, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x53, 0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54,
+ 0x41, 0x54, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10,
+ 0x00, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54, 0x41,
+ 0x54, 0x45, 0x5f, 0x44, 0x4f, 0x57, 0x4e, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x45, 0x53,
+ 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x55, 0x50, 0x10, 0x02, 0x2a,
+ 0x83, 0x01, 0x0a, 0x0a, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1b,
+ 0x0a, 0x17, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e,
+ 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4d,
+ 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x47, 0x50, 0x10, 0x01,
+ 0x12, 0x12, 0x0a, 0x0e, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f,
+ 0x54, 0x45, 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54,
+ 0x59, 0x50, 0x45, 0x5f, 0x44, 0x45, 0x4c, 0x41, 0x59, 0x10, 0x03, 0x12, 0x18, 0x0a, 0x14, 0x4d,
+ 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x48, 0x4f, 0x50, 0x43, 0x4f,
+ 0x55, 0x4e, 0x54, 0x10, 0x04, 0x32, 0x96, 0x04, 0x0a, 0x0a, 0x50, 0x43, 0x45, 0x53, 0x65, 0x72,
+ 0x76, 0x69, 0x63, 0x65, 0x12, 0x59, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x52,
+ 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c,
+ 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c,
+ 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x61, 0x70, 0x69,
+ 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53,
+ 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
+ 0x59, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63,
+ 0x79, 0x12, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e,
+ 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65,
+ 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61,
+ 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69,
+ 0x63, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x0e, 0x47, 0x65,
+ 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x22, 0x2e, 0x61,
+ 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65,
+ 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
+ 0x1a, 0x23, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x47,
+ 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73,
+ 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x53, 0x52, 0x50, 0x6f,
+ 0x6c, 0x69, 0x63, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x23, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70,
+ 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69,
+ 0x63, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e,
+ 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53,
+ 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f,
+ 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x54, 0x45, 0x44, 0x12, 0x1a, 0x2e,
+ 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x54,
+ 0x45, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x61, 0x70, 0x69, 0x2e,
+ 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x45, 0x44, 0x52, 0x65,
+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65,
+ 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f,
+ 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73,
+ 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x61, 0x70, 0x69,
0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53,
- 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23,
- 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c,
- 0x65, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f,
- 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f,
- 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61,
- 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x69,
- 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x61, 0x70, 0x69, 0x2e,
- 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69,
- 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c,
- 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4c, 0x69, 0x73,
- 0x74, 0x12, 0x23, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e,
- 0x47, 0x65, 0x74, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52,
- 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c,
- 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79,
- 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x06,
- 0x47, 0x65, 0x74, 0x54, 0x45, 0x44, 0x12, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c,
- 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x45, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65,
- 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31,
- 0x2e, 0x47, 0x65, 0x74, 0x54, 0x45, 0x44, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
- 0x56, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e,
- 0x12, 0x21, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x44,
- 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75,
- 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76,
- 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52,
- 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x24, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75,
- 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x74, 0x74, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6f, 0x6c,
- 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6c, 0x61, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70,
- 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x24,
+ 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x74, 0x74,
+ 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6f, 0x6c, 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6c,
+ 0x61, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -1706,7 +1889,7 @@ func file_pola_proto_rawDescGZIP() []byte {
}
var file_pola_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
-var file_pola_proto_msgTypes = make([]protoimpl.MessageInfo, 22)
+var file_pola_proto_msgTypes = make([]protoimpl.MessageInfo, 25)
var file_pola_proto_goTypes = []interface{}{
(SRPolicyType)(0), // 0: api.pola.v1.SRPolicyType
(SessionState)(0), // 1: api.pola.v1.SessionState
@@ -1720,19 +1903,22 @@ var file_pola_proto_goTypes = []interface{}{
(*Session)(nil), // 9: api.pola.v1.Session
(*SessionList)(nil), // 10: api.pola.v1.SessionList
(*SRPolicyList)(nil), // 11: api.pola.v1.SRPolicyList
- (*LsPrefix)(nil), // 12: api.pola.v1.LsPrefix
- (*Metric)(nil), // 13: api.pola.v1.Metric
- (*LsLink)(nil), // 14: api.pola.v1.LsLink
- (*LsNode)(nil), // 15: api.pola.v1.LsNode
- (*TED)(nil), // 16: api.pola.v1.TED
- (*GetSessionListRequest)(nil), // 17: api.pola.v1.GetSessionListRequest
- (*GetSessionListResponse)(nil), // 18: api.pola.v1.GetSessionListResponse
- (*GetSRPolicyListRequest)(nil), // 19: api.pola.v1.GetSRPolicyListRequest
- (*GetSRPolicyListResponse)(nil), // 20: api.pola.v1.GetSRPolicyListResponse
- (*GetTEDRequest)(nil), // 21: api.pola.v1.GetTEDRequest
- (*GetTEDResponse)(nil), // 22: api.pola.v1.GetTEDResponse
- (*DeleteSessionRequest)(nil), // 23: api.pola.v1.DeleteSessionRequest
- (*DeleteSessionResponse)(nil), // 24: api.pola.v1.DeleteSessionResponse
+ (*LsSrv6SID)(nil), // 12: api.pola.v1.LsSrv6SID
+ (*SID)(nil), // 13: api.pola.v1.SID
+ (*MultiTopoID)(nil), // 14: api.pola.v1.MultiTopoID
+ (*LsPrefix)(nil), // 15: api.pola.v1.LsPrefix
+ (*Metric)(nil), // 16: api.pola.v1.Metric
+ (*LsLink)(nil), // 17: api.pola.v1.LsLink
+ (*LsNode)(nil), // 18: api.pola.v1.LsNode
+ (*TED)(nil), // 19: api.pola.v1.TED
+ (*GetSessionListRequest)(nil), // 20: api.pola.v1.GetSessionListRequest
+ (*GetSessionListResponse)(nil), // 21: api.pola.v1.GetSessionListResponse
+ (*GetSRPolicyListRequest)(nil), // 22: api.pola.v1.GetSRPolicyListRequest
+ (*GetSRPolicyListResponse)(nil), // 23: api.pola.v1.GetSRPolicyListResponse
+ (*GetTEDRequest)(nil), // 24: api.pola.v1.GetTEDRequest
+ (*GetTEDResponse)(nil), // 25: api.pola.v1.GetTEDResponse
+ (*DeleteSessionRequest)(nil), // 26: api.pola.v1.DeleteSessionRequest
+ (*DeleteSessionResponse)(nil), // 27: api.pola.v1.DeleteSessionResponse
}
var file_pola_proto_depIdxs = []int32{
0, // 0: api.pola.v1.SRPolicy.type:type_name -> api.pola.v1.SRPolicyType
@@ -1743,31 +1929,34 @@ var file_pola_proto_depIdxs = []int32{
1, // 5: api.pola.v1.Session.state:type_name -> api.pola.v1.SessionState
9, // 6: api.pola.v1.SessionList.sessions:type_name -> api.pola.v1.Session
4, // 7: api.pola.v1.SRPolicyList.sr_policies:type_name -> api.pola.v1.SRPolicy
- 2, // 8: api.pola.v1.Metric.type:type_name -> api.pola.v1.MetricType
- 13, // 9: api.pola.v1.LsLink.metrics:type_name -> api.pola.v1.Metric
- 14, // 10: api.pola.v1.LsNode.ls_links:type_name -> api.pola.v1.LsLink
- 12, // 11: api.pola.v1.LsNode.ls_prefixes:type_name -> api.pola.v1.LsPrefix
- 15, // 12: api.pola.v1.TED.ls_nodes:type_name -> api.pola.v1.LsNode
- 9, // 13: api.pola.v1.GetSessionListResponse.sessions:type_name -> api.pola.v1.Session
- 4, // 14: api.pola.v1.GetSRPolicyListResponse.sr_policies:type_name -> api.pola.v1.SRPolicy
- 15, // 15: api.pola.v1.GetTEDResponse.ls_nodes:type_name -> api.pola.v1.LsNode
- 5, // 16: api.pola.v1.PCEService.CreateSRPolicy:input_type -> api.pola.v1.CreateSRPolicyRequest
- 7, // 17: api.pola.v1.PCEService.DeleteSRPolicy:input_type -> api.pola.v1.DeleteSRPolicyRequest
- 17, // 18: api.pola.v1.PCEService.GetSessionList:input_type -> api.pola.v1.GetSessionListRequest
- 19, // 19: api.pola.v1.PCEService.GetSRPolicyList:input_type -> api.pola.v1.GetSRPolicyListRequest
- 21, // 20: api.pola.v1.PCEService.GetTED:input_type -> api.pola.v1.GetTEDRequest
- 23, // 21: api.pola.v1.PCEService.DeleteSession:input_type -> api.pola.v1.DeleteSessionRequest
- 6, // 22: api.pola.v1.PCEService.CreateSRPolicy:output_type -> api.pola.v1.CreateSRPolicyResponse
- 8, // 23: api.pola.v1.PCEService.DeleteSRPolicy:output_type -> api.pola.v1.DeleteSRPolicyResponse
- 18, // 24: api.pola.v1.PCEService.GetSessionList:output_type -> api.pola.v1.GetSessionListResponse
- 20, // 25: api.pola.v1.PCEService.GetSRPolicyList:output_type -> api.pola.v1.GetSRPolicyListResponse
- 22, // 26: api.pola.v1.PCEService.GetTED:output_type -> api.pola.v1.GetTEDResponse
- 24, // 27: api.pola.v1.PCEService.DeleteSession:output_type -> api.pola.v1.DeleteSessionResponse
- 22, // [22:28] is the sub-list for method output_type
- 16, // [16:22] is the sub-list for method input_type
- 16, // [16:16] is the sub-list for extension type_name
- 16, // [16:16] is the sub-list for extension extendee
- 0, // [0:16] is the sub-list for field type_name
+ 13, // 8: api.pola.v1.LsSrv6SID.sids:type_name -> api.pola.v1.SID
+ 14, // 9: api.pola.v1.LsSrv6SID.multi_topo_ids:type_name -> api.pola.v1.MultiTopoID
+ 2, // 10: api.pola.v1.Metric.type:type_name -> api.pola.v1.MetricType
+ 16, // 11: api.pola.v1.LsLink.metrics:type_name -> api.pola.v1.Metric
+ 17, // 12: api.pola.v1.LsNode.ls_links:type_name -> api.pola.v1.LsLink
+ 15, // 13: api.pola.v1.LsNode.ls_prefixes:type_name -> api.pola.v1.LsPrefix
+ 12, // 14: api.pola.v1.LsNode.ls_srv6_sids:type_name -> api.pola.v1.LsSrv6SID
+ 18, // 15: api.pola.v1.TED.ls_nodes:type_name -> api.pola.v1.LsNode
+ 9, // 16: api.pola.v1.GetSessionListResponse.sessions:type_name -> api.pola.v1.Session
+ 4, // 17: api.pola.v1.GetSRPolicyListResponse.sr_policies:type_name -> api.pola.v1.SRPolicy
+ 18, // 18: api.pola.v1.GetTEDResponse.ls_nodes:type_name -> api.pola.v1.LsNode
+ 5, // 19: api.pola.v1.PCEService.CreateSRPolicy:input_type -> api.pola.v1.CreateSRPolicyRequest
+ 7, // 20: api.pola.v1.PCEService.DeleteSRPolicy:input_type -> api.pola.v1.DeleteSRPolicyRequest
+ 20, // 21: api.pola.v1.PCEService.GetSessionList:input_type -> api.pola.v1.GetSessionListRequest
+ 22, // 22: api.pola.v1.PCEService.GetSRPolicyList:input_type -> api.pola.v1.GetSRPolicyListRequest
+ 24, // 23: api.pola.v1.PCEService.GetTED:input_type -> api.pola.v1.GetTEDRequest
+ 26, // 24: api.pola.v1.PCEService.DeleteSession:input_type -> api.pola.v1.DeleteSessionRequest
+ 6, // 25: api.pola.v1.PCEService.CreateSRPolicy:output_type -> api.pola.v1.CreateSRPolicyResponse
+ 8, // 26: api.pola.v1.PCEService.DeleteSRPolicy:output_type -> api.pola.v1.DeleteSRPolicyResponse
+ 21, // 27: api.pola.v1.PCEService.GetSessionList:output_type -> api.pola.v1.GetSessionListResponse
+ 23, // 28: api.pola.v1.PCEService.GetSRPolicyList:output_type -> api.pola.v1.GetSRPolicyListResponse
+ 25, // 29: api.pola.v1.PCEService.GetTED:output_type -> api.pola.v1.GetTEDResponse
+ 27, // 30: api.pola.v1.PCEService.DeleteSession:output_type -> api.pola.v1.DeleteSessionResponse
+ 25, // [25:31] is the sub-list for method output_type
+ 19, // [19:25] is the sub-list for method input_type
+ 19, // [19:19] is the sub-list for extension type_name
+ 19, // [19:19] is the sub-list for extension extendee
+ 0, // [0:19] is the sub-list for field type_name
}
func init() { file_pola_proto_init() }
@@ -1885,7 +2074,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*LsPrefix); i {
+ switch v := v.(*LsSrv6SID); i {
case 0:
return &v.state
case 1:
@@ -1897,7 +2086,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*Metric); i {
+ switch v := v.(*SID); i {
case 0:
return &v.state
case 1:
@@ -1909,7 +2098,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*LsLink); i {
+ switch v := v.(*MultiTopoID); i {
case 0:
return &v.state
case 1:
@@ -1921,7 +2110,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*LsNode); i {
+ switch v := v.(*LsPrefix); i {
case 0:
return &v.state
case 1:
@@ -1933,7 +2122,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*TED); i {
+ switch v := v.(*Metric); i {
case 0:
return &v.state
case 1:
@@ -1945,7 +2134,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*GetSessionListRequest); i {
+ switch v := v.(*LsLink); i {
case 0:
return &v.state
case 1:
@@ -1957,7 +2146,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*GetSessionListResponse); i {
+ switch v := v.(*LsNode); i {
case 0:
return &v.state
case 1:
@@ -1969,7 +2158,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*GetSRPolicyListRequest); i {
+ switch v := v.(*TED); i {
case 0:
return &v.state
case 1:
@@ -1981,7 +2170,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*GetSRPolicyListResponse); i {
+ switch v := v.(*GetSessionListRequest); i {
case 0:
return &v.state
case 1:
@@ -1993,7 +2182,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*GetTEDRequest); i {
+ switch v := v.(*GetSessionListResponse); i {
case 0:
return &v.state
case 1:
@@ -2005,7 +2194,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*GetTEDResponse); i {
+ switch v := v.(*GetSRPolicyListRequest); i {
case 0:
return &v.state
case 1:
@@ -2017,7 +2206,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*DeleteSessionRequest); i {
+ switch v := v.(*GetSRPolicyListResponse); i {
case 0:
return &v.state
case 1:
@@ -2029,6 +2218,42 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetTEDRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetTEDResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*DeleteSessionRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteSessionResponse); i {
case 0:
return &v.state
@@ -2047,7 +2272,7 @@ func file_pola_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_pola_proto_rawDesc,
NumEnums: 3,
- NumMessages: 22,
+ NumMessages: 25,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/api/pola/v1/pola.proto b/api/pola/v1/pola.proto
index b3769f64..797494b7 100644
--- a/api/pola/v1/pola.proto
+++ b/api/pola/v1/pola.proto
@@ -85,6 +85,20 @@ message SRPolicyList {
repeated SRPolicy sr_policies = 1;
}
+message LsSrv6SID {
+ repeated SID sids = 1;
+ uint32 endpoint_behavior = 2;
+ repeated MultiTopoID multi_topo_ids = 3;
+}
+
+message SID {
+ string sid = 1;
+}
+
+message MultiTopoID {
+ uint32 multi_topo_id = 1;
+}
+
message LsPrefix {
string prefix = 1;
uint32 sid_index = 2;
@@ -123,6 +137,7 @@ message LsNode {
uint32 srgb_end = 6;
repeated LsLink ls_links = 7;
repeated LsPrefix ls_prefixes = 8;
+ repeated LsSrv6SID ls_srv6_sids = 9;
}
message TED {
diff --git a/cmd/pola/grpc/grpc_client.go b/cmd/pola/grpc/grpc_client.go
index 86abe104..05033135 100644
--- a/cmd/pola/grpc/grpc_client.go
+++ b/cmd/pola/grpc/grpc_client.go
@@ -179,11 +179,19 @@ func addLsNode(ted *table.LsTED, node *pb.LsNode) error {
ted.Nodes[node.GetAsn()][node.GetRouterId()].Prefixes = append(ted.Nodes[node.GetAsn()][node.GetRouterId()].Prefixes, lsPrefix)
}
+ for _, srv6SID := range node.LsSrv6Sids {
+ lsSrv6SID, err := createSrv6SID(ted.Nodes[node.GetAsn()][node.GetRouterId()], srv6SID)
+ if err != nil {
+ return err
+ }
+ ted.Nodes[node.GetAsn()][node.GetRouterId()].SRv6SIDs = append(ted.Nodes[node.GetAsn()][node.GetRouterId()].SRv6SIDs, lsSrv6SID)
+ }
+
return nil
}
-func createLsPrefix(lsNode *table.LsNode, prefix *pb.LsPrefix) (*table.LsPrefixV4, error) {
- lsPrefix := table.NewLsPrefixV4(lsNode)
+func createLsPrefix(lsNode *table.LsNode, prefix *pb.LsPrefix) (*table.LsPrefix, error) {
+ lsPrefix := table.NewLsPrefix(lsNode)
var err error
lsPrefix.Prefix, err = netip.ParsePrefix(prefix.GetPrefix())
if err != nil {
@@ -233,3 +241,21 @@ func createMetric(metricInfo *pb.Metric) (*table.Metric, error) {
return nil, errors.New("unknown metric type")
}
}
+
+func createSrv6SID(lsNode *table.LsNode, srv6SID *pb.LsSrv6SID) (*table.LsSrv6SID, error) {
+ lsSrv6SID := table.NewLsSrv6SID(lsNode)
+
+ lsSrv6SID.EndpointBehavior = srv6SID.GetEndpointBehavior()
+ lsSrv6SID.ServiceType = srv6SID.GetServiceType()
+ lsSrv6SID.TrafficType = srv6SID.GetTrafficType()
+ lsSrv6SID.OpaqueType = srv6SID.GetOpaqueType()
+ lsSrv6SID.Value = srv6SID.GetValue()
+ for _, sid := range srv6SID.GetSids() {
+ lsSrv6SID.Sids = append(lsSrv6SID.Sids, sid.GetSid())
+ }
+ for _, topoID := range srv6SID.GetMultiTopoIds() {
+ lsSrv6SID.MultiTopoIDs = append(lsSrv6SID.MultiTopoIDs, topoID.GetMultiTopoId())
+ }
+
+ return lsSrv6SID, nil
+}
diff --git a/pkg/server/grpc_server.go b/pkg/server/grpc_server.go
index f57559f2..b768c992 100644
--- a/pkg/server/grpc_server.go
+++ b/pkg/server/grpc_server.go
@@ -390,6 +390,7 @@ func (s *APIServer) GetTED(ctx context.Context, req *pb.GetTEDRequest) (*pb.GetT
SrgbEnd: lsNode.SrgbEnd,
LsLinks: make([]*pb.LsLink, 0, len(lsNode.Links)),
LsPrefixes: make([]*pb.LsPrefix, 0, len(lsNode.Prefixes)),
+ LsSrv6Sids: make([]*pb.LsSrv6SID, 0, len(lsNode.SRv6SIDs)),
}
for _, lsLink := range lsNode.Links {
@@ -430,6 +431,27 @@ func (s *APIServer) GetTED(ctx context.Context, req *pb.GetTEDRequest) (*pb.GetT
node.LsPrefixes = append(node.LsPrefixes, prefix)
}
+ for _, lsSrv6SID := range lsNode.SRv6SIDs {
+ srv6SID := &pb.LsSrv6SID{
+ EndpointBehavior: lsSrv6SID.EndpointBehavior,
+ Sids: make([]*pb.SID, 0, len(lsSrv6SID.Sids)),
+ MultiTopoIds: make([]*pb.MultiTopoID, 0, len(lsSrv6SID.MultiTopoIDs)),
+ }
+
+ for _, sid := range lsSrv6SID.Sids {
+ srv6SID.Sids = append(srv6SID.Sids, &pb.SID{
+ Sid: sid,
+ })
+ }
+
+ for _, topoID := range lsSrv6SID.MultiTopoIDs {
+ srv6SID.MultiTopoIds = append(srv6SID.MultiTopoIds, &pb.MultiTopoID{
+ MultiTopoId: topoID,
+ })
+ }
+ node.LsSrv6Sids = append(node.LsSrv6Sids, srv6SID)
+ }
+
ret.LsNodes = append(ret.LsNodes, node)
}
}
From d19513c0783445a9d25644d77bc2ed7fe2e2427f Mon Sep 17 00:00:00 2001
From: k1yoto
Date: Sat, 17 May 2025 00:52:14 +0000
Subject: [PATCH 30/87] fix(interface): support IPv6 for LsNodeNLRI and
LsLinkNLRI
---
internal/pkg/gobgp/interface.go | 42 ++++++++++++++++++++++++---------
1 file changed, 31 insertions(+), 11 deletions(-)
diff --git a/internal/pkg/gobgp/interface.go b/internal/pkg/gobgp/interface.go
index 87afe20c..f346e32a 100644
--- a/internal/pkg/gobgp/interface.go
+++ b/internal/pkg/gobgp/interface.go
@@ -164,12 +164,15 @@ func getLsNodeNLRI(typedLinkStateNLRI *api.LsNodeNLRI, pathAttrs []*anypb.Any) (
isisArea := bgplsAttr.GetNode().GetIsisArea()
lsNode.IsisAreaID = formatIsisAreaID(isisArea)
lsNode.Hostname = bgplsAttr.GetNode().GetName()
- srCapabilities := bgplsAttr.GetNode().GetSrCapabilities().GetRanges()
- if len(srCapabilities) != 1 {
- return nil, fmt.Errorf("expected 1 SR Capability TLV, got: %d", len(srCapabilities))
+ if bgplsAttr.GetNode().GetSrCapabilities() != nil {
+ srCapabilities := bgplsAttr.GetNode().GetSrCapabilities().GetRanges()
+ if len(srCapabilities) != 1 {
+ return nil, fmt.Errorf("expected 1 SR Capability TLV, got: %d", len(srCapabilities))
+ } else {
+ lsNode.SrgbBegin = srCapabilities[0].GetBegin()
+ lsNode.SrgbEnd = srCapabilities[0].GetEnd()
+ }
}
- lsNode.SrgbBegin = srCapabilities[0].GetBegin()
- lsNode.SrgbEnd = srCapabilities[0].GetEnd()
}
return lsNode, nil
@@ -179,14 +182,31 @@ func getLsLinkNLRI(typedLinkStateNLRI *api.LsLinkNLRI, pathAttrs []*anypb.Any) (
localNode := table.NewLsNode(typedLinkStateNLRI.GetLocalNode().GetAsn(), typedLinkStateNLRI.GetLocalNode().GetIgpRouterId())
remoteNode := table.NewLsNode(typedLinkStateNLRI.GetRemoteNode().GetAsn(), typedLinkStateNLRI.GetRemoteNode().GetIgpRouterId())
- localIP, err := netip.ParseAddr(typedLinkStateNLRI.GetLinkDescriptor().GetInterfaceAddrIpv4())
- if err != nil {
- return nil, fmt.Errorf("failed to parse local IP address %q: %v", typedLinkStateNLRI.GetLinkDescriptor().GetInterfaceAddrIpv4(), err)
+ var err error
+ var localIP netip.Addr
+ if typedLinkStateNLRI.GetLinkDescriptor().GetInterfaceAddrIpv4() != "" {
+ localIP, err = netip.ParseAddr(typedLinkStateNLRI.GetLinkDescriptor().GetInterfaceAddrIpv4())
+ if err != nil {
+ return nil, fmt.Errorf("failed to parse local IPv4 address: %v", err)
+ }
+ } else {
+ localIP, err = netip.ParseAddr(typedLinkStateNLRI.GetLinkDescriptor().GetInterfaceAddrIpv6())
+ if err != nil {
+ return nil, fmt.Errorf("failed to parse local IPv6 address: %v", err)
+ }
}
- remoteIP, err := netip.ParseAddr(typedLinkStateNLRI.GetLinkDescriptor().GetNeighborAddrIpv4())
- if err != nil {
- return nil, fmt.Errorf("failed to parse remote IP address %q: %v", typedLinkStateNLRI.GetLinkDescriptor().GetNeighborAddrIpv4(), err)
+ var remoteIP netip.Addr
+ if typedLinkStateNLRI.GetLinkDescriptor().GetNeighborAddrIpv4() != "" {
+ remoteIP, err = netip.ParseAddr(typedLinkStateNLRI.GetLinkDescriptor().GetNeighborAddrIpv4())
+ if err != nil {
+ return nil, fmt.Errorf("failed to parse remote IPv4 address: %v", err)
+ }
+ } else {
+ remoteIP, err = netip.ParseAddr(typedLinkStateNLRI.GetLinkDescriptor().GetNeighborAddrIpv6())
+ if err != nil {
+ return nil, fmt.Errorf("failed to parse remote IPv6 address: %v", err)
+ }
}
lsLink := table.NewLsLink(localNode, remoteNode)
From d99dfe1dc3158467138ebbd05656595d086e74ec Mon Sep 17 00:00:00 2001
From: k1yoto
Date: Sat, 17 May 2025 00:54:39 +0000
Subject: [PATCH 31/87] chore(LsSRv6SIDNLRI): add comment-outs and tools
---
internal/pkg/gobgp/interface.go | 4 ++--
internal/pkg/table/ted.go | 2 +-
tools/grpc/go/show_ted/show_ted.go | 3 +++
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/internal/pkg/gobgp/interface.go b/internal/pkg/gobgp/interface.go
index f346e32a..3b02e9e8 100644
--- a/internal/pkg/gobgp/interface.go
+++ b/internal/pkg/gobgp/interface.go
@@ -325,8 +325,8 @@ func getLsSrv6SIDNLRIList(pathAttrs []*anypb.Any) ([]table.TEDElem, error) {
}
switch typedPathAttr := typedPathAttr.(type) {
- case *api.SRv6EndPointBehavior:
- endpointBehavior = uint32(typedPathAttr.GetBehavior())
+ case *api.LsAttribute:
+ // TODO: Handle LsAttribute for SRv6 SID
case *api.MpReachNLRIAttribute:
for _, nlri := range typedPathAttr.GetNlris() {
typedNLRI, err := nlri.UnmarshalNew()
diff --git a/internal/pkg/table/ted.go b/internal/pkg/table/ted.go
index 07d10f4f..87d8c41a 100644
--- a/internal/pkg/table/ted.go
+++ b/internal/pkg/table/ted.go
@@ -215,7 +215,7 @@ func (lp *LsPrefix) UpdateTED(ted *LsTED) {
type LsSrv6SID struct {
LocalNode *LsNode // primary key, in MP_REACH_NLRI Attr
Sids []string // in LsSrv6SID Attr
- EndpointBehavior uint32 // in srv6EndpointBehavior Attr
+ EndpointBehavior uint32 // in BGP-LS Attr
MultiTopoIDs []uint32 // in LsSrv6SID Attr
}
diff --git a/tools/grpc/go/show_ted/show_ted.go b/tools/grpc/go/show_ted/show_ted.go
index 04eea043..a2591b4d 100644
--- a/tools/grpc/go/show_ted/show_ted.go
+++ b/tools/grpc/go/show_ted/show_ted.go
@@ -52,6 +52,9 @@ func main() {
for _, link := range node.GetLsLinks() {
fmt.Printf("link info: %#v\n", link)
}
+ for _, srv6SID := range node.GetLsSrv6Sids() {
+ fmt.Printf("srv6SID info: %#v\n", srv6SID)
+ }
fmt.Println()
}
}
From 89ecb1eb4160b0a9ad387710592d752b3d3f2e38 Mon Sep 17 00:00:00 2001
From: k1yoto
Date: Sat, 17 May 2025 03:26:30 +0000
Subject: [PATCH 32/87] fix(gobgp): fix to be able to display TED in CLI tool
---
internal/pkg/table/ted.go | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/internal/pkg/table/ted.go b/internal/pkg/table/ted.go
index 87d8c41a..88073625 100644
--- a/internal/pkg/table/ted.go
+++ b/internal/pkg/table/ted.go
@@ -269,14 +269,14 @@ const (
func (m MetricType) String() string {
switch m {
case IGPMetric:
- return "IGP"
+ return "METRIC_TYPE_IGP"
case TEMetric:
- return "TE"
+ return "METRIC_TYPE_TE"
case DelayMetric:
- return "DELAY"
+ return "METRIC_TYPE_DELAY"
case HopcountMetric:
- return "HOPCOUNT"
+ return "METRIC_TYPE_HOPCOUNT"
default:
- return "Unknown"
+ return "METRIC_TYPE_UNSPECIFIED"
}
}
From 8d31734effb3a45fe5d6d6e16efbd27fc508db51 Mon Sep 17 00:00:00 2001
From: k1yoto
Date: Tue, 27 May 2025 10:16:06 +0000
Subject: [PATCH 33/87] chore(README): fix link text to be descriptive
---
examples/containerlab/sr-mpls_pcep/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/examples/containerlab/sr-mpls_pcep/README.md b/examples/containerlab/sr-mpls_pcep/README.md
index bd8a4ce5..bdb04c1f 100644
--- a/examples/containerlab/sr-mpls_pcep/README.md
+++ b/examples/containerlab/sr-mpls_pcep/README.md
@@ -36,7 +36,7 @@ net.ipv4.udp_mem=1124736 10000000 67108864
$ sysctl -p
```
-host-check (see: [link](https://xrdocs.io/virtual-routing/tutorials/2022-08-22-setting-up-host-environment-to-run-xrd/))
+host-check (see: [Setting up the Host Environment to run XRd](https://xrdocs.io/virtual-routing/tutorials/2022-08-22-setting-up-host-environment-to-run-xrd/))
```bash
git clone https://github.com/ios-xr/xrd-tools
From a0a4c5561518cde661454de53eb42654d7f8a52f Mon Sep 17 00:00:00 2001
From: k1yoto
Date: Sun, 22 Jun 2025 08:26:40 +0000
Subject: [PATCH 34/87] feat(api): add SRv6 SIDStructure and EndpointBehavior
protobuf definitions
---
api/pola/v1/pola.pb.go | 843 +++++++++++++++++++++++------------
api/pola/v1/pola.proto | 33 +-
cmd/pola/grpc/grpc_client.go | 4 -
3 files changed, 595 insertions(+), 285 deletions(-)
diff --git a/api/pola/v1/pola.pb.go b/api/pola/v1/pola.pb.go
index 27e62d8e..aec3d106 100644
--- a/api/pola/v1/pola.pb.go
+++ b/api/pola/v1/pola.pb.go
@@ -12,10 +12,11 @@
package v1
import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
+
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
)
const (
@@ -753,18 +754,18 @@ func (x *SRPolicyList) GetSrPolicies() []*SRPolicy {
return nil
}
-type LsSrv6SID struct {
+type EndpointBehavior struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
- Sids []*SID `protobuf:"bytes,1,rep,name=sids,proto3" json:"sids,omitempty"`
- EndpointBehavior uint32 `protobuf:"varint,2,opt,name=endpoint_behavior,json=endpointBehavior,proto3" json:"endpoint_behavior,omitempty"`
- MultiTopoIds []*MultiTopoID `protobuf:"bytes,3,rep,name=multi_topo_ids,json=multiTopoIds,proto3" json:"multi_topo_ids,omitempty"`
+ Behavior uint32 `protobuf:"varint,1,opt,name=behavior,proto3" json:"behavior,omitempty"`
+ Flags uint32 `protobuf:"varint,2,opt,name=flags,proto3" json:"flags,omitempty"`
+ Algorithm uint32 `protobuf:"varint,3,opt,name=algorithm,proto3" json:"algorithm,omitempty"`
}
-func (x *LsSrv6SID) Reset() {
- *x = LsSrv6SID{}
+func (x *EndpointBehavior) Reset() {
+ *x = EndpointBehavior{}
if protoimpl.UnsafeEnabled {
mi := &file_pola_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -772,13 +773,13 @@ func (x *LsSrv6SID) Reset() {
}
}
-func (x *LsSrv6SID) String() string {
+func (x *EndpointBehavior) String() string {
return protoimpl.X.MessageStringOf(x)
}
-func (*LsSrv6SID) ProtoMessage() {}
+func (*EndpointBehavior) ProtoMessage() {}
-func (x *LsSrv6SID) ProtoReflect() protoreflect.Message {
+func (x *EndpointBehavior) ProtoReflect() protoreflect.Message {
mi := &file_pola_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -790,30 +791,101 @@ func (x *LsSrv6SID) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
-// Deprecated: Use LsSrv6SID.ProtoReflect.Descriptor instead.
-func (*LsSrv6SID) Descriptor() ([]byte, []int) {
+// Deprecated: Use EndpointBehavior.ProtoReflect.Descriptor instead.
+func (*EndpointBehavior) Descriptor() ([]byte, []int) {
return file_pola_proto_rawDescGZIP(), []int{9}
}
-func (x *LsSrv6SID) GetSids() []*SID {
+func (x *EndpointBehavior) GetBehavior() uint32 {
if x != nil {
- return x.Sids
+ return x.Behavior
}
- return nil
+ return 0
}
-func (x *LsSrv6SID) GetEndpointBehavior() uint32 {
+func (x *EndpointBehavior) GetFlags() uint32 {
if x != nil {
- return x.EndpointBehavior
+ return x.Flags
}
return 0
}
-func (x *LsSrv6SID) GetMultiTopoIds() []*MultiTopoID {
+func (x *EndpointBehavior) GetAlgorithm() uint32 {
if x != nil {
- return x.MultiTopoIds
+ return x.Algorithm
}
- return nil
+ return 0
+}
+
+type SidStructure struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ LocalBlock uint32 `protobuf:"varint,1,opt,name=local_block,json=localBlock,proto3" json:"local_block,omitempty"`
+ LocalNode uint32 `protobuf:"varint,2,opt,name=local_node,json=localNode,proto3" json:"local_node,omitempty"`
+ LocalFunc uint32 `protobuf:"varint,3,opt,name=local_func,json=localFunc,proto3" json:"local_func,omitempty"`
+ LocalArg uint32 `protobuf:"varint,4,opt,name=local_arg,json=localArg,proto3" json:"local_arg,omitempty"`
+}
+
+func (x *SidStructure) Reset() {
+ *x = SidStructure{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[10]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *SidStructure) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SidStructure) ProtoMessage() {}
+
+func (x *SidStructure) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[10]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SidStructure.ProtoReflect.Descriptor instead.
+func (*SidStructure) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{10}
+}
+
+func (x *SidStructure) GetLocalBlock() uint32 {
+ if x != nil {
+ return x.LocalBlock
+ }
+ return 0
+}
+
+func (x *SidStructure) GetLocalNode() uint32 {
+ if x != nil {
+ return x.LocalNode
+ }
+ return 0
+}
+
+func (x *SidStructure) GetLocalFunc() uint32 {
+ if x != nil {
+ return x.LocalFunc
+ }
+ return 0
+}
+
+func (x *SidStructure) GetLocalArg() uint32 {
+ if x != nil {
+ return x.LocalArg
+ }
+ return 0
}
type SID struct {
@@ -827,7 +899,7 @@ type SID struct {
func (x *SID) Reset() {
*x = SID{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[10]
+ mi := &file_pola_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -840,7 +912,7 @@ func (x *SID) String() string {
func (*SID) ProtoMessage() {}
func (x *SID) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[10]
+ mi := &file_pola_proto_msgTypes[11]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -853,7 +925,7 @@ func (x *SID) ProtoReflect() protoreflect.Message {
// Deprecated: Use SID.ProtoReflect.Descriptor instead.
func (*SID) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{10}
+ return file_pola_proto_rawDescGZIP(), []int{11}
}
func (x *SID) GetSid() string {
@@ -874,7 +946,7 @@ type MultiTopoID struct {
func (x *MultiTopoID) Reset() {
*x = MultiTopoID{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[11]
+ mi := &file_pola_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -887,7 +959,7 @@ func (x *MultiTopoID) String() string {
func (*MultiTopoID) ProtoMessage() {}
func (x *MultiTopoID) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[11]
+ mi := &file_pola_proto_msgTypes[12]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -900,7 +972,7 @@ func (x *MultiTopoID) ProtoReflect() protoreflect.Message {
// Deprecated: Use MultiTopoID.ProtoReflect.Descriptor instead.
func (*MultiTopoID) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{11}
+ return file_pola_proto_rawDescGZIP(), []int{12}
}
func (x *MultiTopoID) GetMultiTopoId() uint32 {
@@ -910,6 +982,77 @@ func (x *MultiTopoID) GetMultiTopoId() uint32 {
return 0
}
+type LsSrv6SID struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Sids []*SID `protobuf:"bytes,1,rep,name=sids,proto3" json:"sids,omitempty"`
+ EndpointBehavior *EndpointBehavior `protobuf:"bytes,2,opt,name=endpoint_behavior,json=endpointBehavior,proto3" json:"endpoint_behavior,omitempty"`
+ SidStructure *SidStructure `protobuf:"bytes,3,opt,name=sid_structure,json=sidStructure,proto3" json:"sid_structure,omitempty"`
+ MultiTopoIds []*MultiTopoID `protobuf:"bytes,4,rep,name=multi_topo_ids,json=multiTopoIds,proto3" json:"multi_topo_ids,omitempty"`
+}
+
+func (x *LsSrv6SID) Reset() {
+ *x = LsSrv6SID{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[13]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *LsSrv6SID) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*LsSrv6SID) ProtoMessage() {}
+
+func (x *LsSrv6SID) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[13]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use LsSrv6SID.ProtoReflect.Descriptor instead.
+func (*LsSrv6SID) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{13}
+}
+
+func (x *LsSrv6SID) GetSids() []*SID {
+ if x != nil {
+ return x.Sids
+ }
+ return nil
+}
+
+func (x *LsSrv6SID) GetEndpointBehavior() *EndpointBehavior {
+ if x != nil {
+ return x.EndpointBehavior
+ }
+ return nil
+}
+
+func (x *LsSrv6SID) GetSidStructure() *SidStructure {
+ if x != nil {
+ return x.SidStructure
+ }
+ return nil
+}
+
+func (x *LsSrv6SID) GetMultiTopoIds() []*MultiTopoID {
+ if x != nil {
+ return x.MultiTopoIds
+ }
+ return nil
+}
+
type LsPrefix struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -922,7 +1065,7 @@ type LsPrefix struct {
func (x *LsPrefix) Reset() {
*x = LsPrefix{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[12]
+ mi := &file_pola_proto_msgTypes[14]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -935,7 +1078,7 @@ func (x *LsPrefix) String() string {
func (*LsPrefix) ProtoMessage() {}
func (x *LsPrefix) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[12]
+ mi := &file_pola_proto_msgTypes[14]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -948,7 +1091,7 @@ func (x *LsPrefix) ProtoReflect() protoreflect.Message {
// Deprecated: Use LsPrefix.ProtoReflect.Descriptor instead.
func (*LsPrefix) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{12}
+ return file_pola_proto_rawDescGZIP(), []int{14}
}
func (x *LsPrefix) GetPrefix() string {
@@ -977,7 +1120,7 @@ type Metric struct {
func (x *Metric) Reset() {
*x = Metric{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[13]
+ mi := &file_pola_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -990,7 +1133,7 @@ func (x *Metric) String() string {
func (*Metric) ProtoMessage() {}
func (x *Metric) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[13]
+ mi := &file_pola_proto_msgTypes[15]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1003,7 +1146,7 @@ func (x *Metric) ProtoReflect() protoreflect.Message {
// Deprecated: Use Metric.ProtoReflect.Descriptor instead.
func (*Metric) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{13}
+ return file_pola_proto_rawDescGZIP(), []int{15}
}
func (x *Metric) GetType() MetricType {
@@ -1020,25 +1163,89 @@ func (x *Metric) GetValue() uint32 {
return 0
}
+type Srv6EndXSID struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ EndpointBehavior uint32 `protobuf:"varint,1,opt,name=endpoint_behavior,json=endpointBehavior,proto3" json:"endpoint_behavior,omitempty"`
+ Sids []*SID `protobuf:"bytes,2,rep,name=sids,proto3" json:"sids,omitempty"`
+ SidStructure *SidStructure `protobuf:"bytes,3,opt,name=sid_structure,json=sidStructure,proto3" json:"sid_structure,omitempty"`
+}
+
+func (x *Srv6EndXSID) Reset() {
+ *x = Srv6EndXSID{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_pola_proto_msgTypes[16]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Srv6EndXSID) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Srv6EndXSID) ProtoMessage() {}
+
+func (x *Srv6EndXSID) ProtoReflect() protoreflect.Message {
+ mi := &file_pola_proto_msgTypes[16]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Srv6EndXSID.ProtoReflect.Descriptor instead.
+func (*Srv6EndXSID) Descriptor() ([]byte, []int) {
+ return file_pola_proto_rawDescGZIP(), []int{16}
+}
+
+func (x *Srv6EndXSID) GetEndpointBehavior() uint32 {
+ if x != nil {
+ return x.EndpointBehavior
+ }
+ return 0
+}
+
+func (x *Srv6EndXSID) GetSids() []*SID {
+ if x != nil {
+ return x.Sids
+ }
+ return nil
+}
+
+func (x *Srv6EndXSID) GetSidStructure() *SidStructure {
+ if x != nil {
+ return x.SidStructure
+ }
+ return nil
+}
+
type LsLink struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
- LocalRouterId string `protobuf:"bytes,1,opt,name=local_router_id,json=localRouterId,proto3" json:"local_router_id,omitempty"`
- LocalAsn uint32 `protobuf:"varint,2,opt,name=local_asn,json=localAsn,proto3" json:"local_asn,omitempty"`
- LocalIp string `protobuf:"bytes,3,opt,name=local_ip,json=localIp,proto3" json:"local_ip,omitempty"`
- RemoteRouterId string `protobuf:"bytes,4,opt,name=remote_router_id,json=remoteRouterId,proto3" json:"remote_router_id,omitempty"`
- RemoteAsn uint32 `protobuf:"varint,5,opt,name=remote_asn,json=remoteAsn,proto3" json:"remote_asn,omitempty"`
- RemoteIp string `protobuf:"bytes,6,opt,name=remote_ip,json=remoteIp,proto3" json:"remote_ip,omitempty"`
- Metrics []*Metric `protobuf:"bytes,7,rep,name=metrics,proto3" json:"metrics,omitempty"`
- AdjSid uint32 `protobuf:"varint,8,opt,name=adj_sid,json=adjSid,proto3" json:"adj_sid,omitempty"`
+ LocalRouterId string `protobuf:"bytes,1,opt,name=local_router_id,json=localRouterId,proto3" json:"local_router_id,omitempty"`
+ LocalAsn uint32 `protobuf:"varint,2,opt,name=local_asn,json=localAsn,proto3" json:"local_asn,omitempty"`
+ LocalIp string `protobuf:"bytes,3,opt,name=local_ip,json=localIp,proto3" json:"local_ip,omitempty"`
+ RemoteRouterId string `protobuf:"bytes,4,opt,name=remote_router_id,json=remoteRouterId,proto3" json:"remote_router_id,omitempty"`
+ RemoteAsn uint32 `protobuf:"varint,5,opt,name=remote_asn,json=remoteAsn,proto3" json:"remote_asn,omitempty"`
+ RemoteIp string `protobuf:"bytes,6,opt,name=remote_ip,json=remoteIp,proto3" json:"remote_ip,omitempty"`
+ Metrics []*Metric `protobuf:"bytes,7,rep,name=metrics,proto3" json:"metrics,omitempty"`
+ AdjSid uint32 `protobuf:"varint,8,opt,name=adj_sid,json=adjSid,proto3" json:"adj_sid,omitempty"`
+ Srv6EndXSid *Srv6EndXSID `protobuf:"bytes,9,opt,name=srv6_end_x_sid,json=srv6EndXSid,proto3" json:"srv6_end_x_sid,omitempty"`
}
func (x *LsLink) Reset() {
*x = LsLink{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[14]
+ mi := &file_pola_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1051,7 +1258,7 @@ func (x *LsLink) String() string {
func (*LsLink) ProtoMessage() {}
func (x *LsLink) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[14]
+ mi := &file_pola_proto_msgTypes[17]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1064,7 +1271,7 @@ func (x *LsLink) ProtoReflect() protoreflect.Message {
// Deprecated: Use LsLink.ProtoReflect.Descriptor instead.
func (*LsLink) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{14}
+ return file_pola_proto_rawDescGZIP(), []int{17}
}
func (x *LsLink) GetLocalRouterId() string {
@@ -1123,6 +1330,13 @@ func (x *LsLink) GetAdjSid() uint32 {
return 0
}
+func (x *LsLink) GetSrv6EndXSid() *Srv6EndXSID {
+ if x != nil {
+ return x.Srv6EndXSid
+ }
+ return nil
+}
+
type LsNode struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -1142,7 +1356,7 @@ type LsNode struct {
func (x *LsNode) Reset() {
*x = LsNode{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[15]
+ mi := &file_pola_proto_msgTypes[18]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1155,7 +1369,7 @@ func (x *LsNode) String() string {
func (*LsNode) ProtoMessage() {}
func (x *LsNode) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[15]
+ mi := &file_pola_proto_msgTypes[18]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1168,7 +1382,7 @@ func (x *LsNode) ProtoReflect() protoreflect.Message {
// Deprecated: Use LsNode.ProtoReflect.Descriptor instead.
func (*LsNode) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{15}
+ return file_pola_proto_rawDescGZIP(), []int{18}
}
func (x *LsNode) GetAsn() uint32 {
@@ -1246,7 +1460,7 @@ type TED struct {
func (x *TED) Reset() {
*x = TED{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[16]
+ mi := &file_pola_proto_msgTypes[19]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1259,7 +1473,7 @@ func (x *TED) String() string {
func (*TED) ProtoMessage() {}
func (x *TED) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[16]
+ mi := &file_pola_proto_msgTypes[19]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1272,7 +1486,7 @@ func (x *TED) ProtoReflect() protoreflect.Message {
// Deprecated: Use TED.ProtoReflect.Descriptor instead.
func (*TED) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{16}
+ return file_pola_proto_rawDescGZIP(), []int{19}
}
func (x *TED) GetEnable() bool {
@@ -1298,7 +1512,7 @@ type GetSessionListRequest struct {
func (x *GetSessionListRequest) Reset() {
*x = GetSessionListRequest{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[17]
+ mi := &file_pola_proto_msgTypes[20]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1311,7 +1525,7 @@ func (x *GetSessionListRequest) String() string {
func (*GetSessionListRequest) ProtoMessage() {}
func (x *GetSessionListRequest) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[17]
+ mi := &file_pola_proto_msgTypes[20]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1324,7 +1538,7 @@ func (x *GetSessionListRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetSessionListRequest.ProtoReflect.Descriptor instead.
func (*GetSessionListRequest) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{17}
+ return file_pola_proto_rawDescGZIP(), []int{20}
}
type GetSessionListResponse struct {
@@ -1338,7 +1552,7 @@ type GetSessionListResponse struct {
func (x *GetSessionListResponse) Reset() {
*x = GetSessionListResponse{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[18]
+ mi := &file_pola_proto_msgTypes[21]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1351,7 +1565,7 @@ func (x *GetSessionListResponse) String() string {
func (*GetSessionListResponse) ProtoMessage() {}
func (x *GetSessionListResponse) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[18]
+ mi := &file_pola_proto_msgTypes[21]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1364,7 +1578,7 @@ func (x *GetSessionListResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetSessionListResponse.ProtoReflect.Descriptor instead.
func (*GetSessionListResponse) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{18}
+ return file_pola_proto_rawDescGZIP(), []int{21}
}
func (x *GetSessionListResponse) GetSessions() []*Session {
@@ -1383,7 +1597,7 @@ type GetSRPolicyListRequest struct {
func (x *GetSRPolicyListRequest) Reset() {
*x = GetSRPolicyListRequest{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[19]
+ mi := &file_pola_proto_msgTypes[22]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1396,7 +1610,7 @@ func (x *GetSRPolicyListRequest) String() string {
func (*GetSRPolicyListRequest) ProtoMessage() {}
func (x *GetSRPolicyListRequest) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[19]
+ mi := &file_pola_proto_msgTypes[22]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1409,7 +1623,7 @@ func (x *GetSRPolicyListRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetSRPolicyListRequest.ProtoReflect.Descriptor instead.
func (*GetSRPolicyListRequest) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{19}
+ return file_pola_proto_rawDescGZIP(), []int{22}
}
type GetSRPolicyListResponse struct {
@@ -1423,7 +1637,7 @@ type GetSRPolicyListResponse struct {
func (x *GetSRPolicyListResponse) Reset() {
*x = GetSRPolicyListResponse{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[20]
+ mi := &file_pola_proto_msgTypes[23]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1436,7 +1650,7 @@ func (x *GetSRPolicyListResponse) String() string {
func (*GetSRPolicyListResponse) ProtoMessage() {}
func (x *GetSRPolicyListResponse) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[20]
+ mi := &file_pola_proto_msgTypes[23]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1449,7 +1663,7 @@ func (x *GetSRPolicyListResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetSRPolicyListResponse.ProtoReflect.Descriptor instead.
func (*GetSRPolicyListResponse) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{20}
+ return file_pola_proto_rawDescGZIP(), []int{23}
}
func (x *GetSRPolicyListResponse) GetSrPolicies() []*SRPolicy {
@@ -1468,7 +1682,7 @@ type GetTEDRequest struct {
func (x *GetTEDRequest) Reset() {
*x = GetTEDRequest{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[21]
+ mi := &file_pola_proto_msgTypes[24]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1481,7 +1695,7 @@ func (x *GetTEDRequest) String() string {
func (*GetTEDRequest) ProtoMessage() {}
func (x *GetTEDRequest) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[21]
+ mi := &file_pola_proto_msgTypes[24]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1494,7 +1708,7 @@ func (x *GetTEDRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetTEDRequest.ProtoReflect.Descriptor instead.
func (*GetTEDRequest) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{21}
+ return file_pola_proto_rawDescGZIP(), []int{24}
}
type GetTEDResponse struct {
@@ -1509,7 +1723,7 @@ type GetTEDResponse struct {
func (x *GetTEDResponse) Reset() {
*x = GetTEDResponse{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[22]
+ mi := &file_pola_proto_msgTypes[25]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1522,7 +1736,7 @@ func (x *GetTEDResponse) String() string {
func (*GetTEDResponse) ProtoMessage() {}
func (x *GetTEDResponse) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[22]
+ mi := &file_pola_proto_msgTypes[25]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1535,7 +1749,7 @@ func (x *GetTEDResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use GetTEDResponse.ProtoReflect.Descriptor instead.
func (*GetTEDResponse) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{22}
+ return file_pola_proto_rawDescGZIP(), []int{25}
}
func (x *GetTEDResponse) GetEnable() bool {
@@ -1563,7 +1777,7 @@ type DeleteSessionRequest struct {
func (x *DeleteSessionRequest) Reset() {
*x = DeleteSessionRequest{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[23]
+ mi := &file_pola_proto_msgTypes[26]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1576,7 +1790,7 @@ func (x *DeleteSessionRequest) String() string {
func (*DeleteSessionRequest) ProtoMessage() {}
func (x *DeleteSessionRequest) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[23]
+ mi := &file_pola_proto_msgTypes[26]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1589,7 +1803,7 @@ func (x *DeleteSessionRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteSessionRequest.ProtoReflect.Descriptor instead.
func (*DeleteSessionRequest) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{23}
+ return file_pola_proto_rawDescGZIP(), []int{26}
}
func (x *DeleteSessionRequest) GetAddr() []byte {
@@ -1610,7 +1824,7 @@ type DeleteSessionResponse struct {
func (x *DeleteSessionResponse) Reset() {
*x = DeleteSessionResponse{}
if protoimpl.UnsafeEnabled {
- mi := &file_pola_proto_msgTypes[24]
+ mi := &file_pola_proto_msgTypes[27]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1623,7 +1837,7 @@ func (x *DeleteSessionResponse) String() string {
func (*DeleteSessionResponse) ProtoMessage() {}
func (x *DeleteSessionResponse) ProtoReflect() protoreflect.Message {
- mi := &file_pola_proto_msgTypes[24]
+ mi := &file_pola_proto_msgTypes[27]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1636,7 +1850,7 @@ func (x *DeleteSessionResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteSessionResponse.ProtoReflect.Descriptor instead.
func (*DeleteSessionResponse) Descriptor() ([]byte, []int) {
- return file_pola_proto_rawDescGZIP(), []int{24}
+ return file_pola_proto_rawDescGZIP(), []int{27}
}
func (x *DeleteSessionResponse) GetIsSuccess() bool {
@@ -1723,21 +1937,42 @@ var file_pola_proto_rawDesc = []byte{
0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15,
0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x52, 0x50,
0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x0a, 0x73, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65,
- 0x73, 0x22, 0x9e, 0x01, 0x0a, 0x09, 0x4c, 0x73, 0x53, 0x72, 0x76, 0x36, 0x53, 0x49, 0x44, 0x12,
- 0x24, 0x0a, 0x04, 0x73, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e,
- 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x49, 0x44, 0x52,
- 0x04, 0x73, 0x69, 0x64, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e,
- 0x74, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d,
- 0x52, 0x10, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69,
- 0x6f, 0x72, 0x12, 0x3e, 0x0a, 0x0e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x5f, 0x74, 0x6f, 0x70, 0x6f,
- 0x5f, 0x69, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x70, 0x69,
- 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x54, 0x6f,
- 0x70, 0x6f, 0x49, 0x44, 0x52, 0x0c, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x54, 0x6f, 0x70, 0x6f, 0x49,
- 0x64, 0x73, 0x22, 0x17, 0x0a, 0x03, 0x53, 0x49, 0x44, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x69, 0x64,
+ 0x73, 0x22, 0x62, 0x0a, 0x10, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x42, 0x65, 0x68,
+ 0x61, 0x76, 0x69, 0x6f, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f,
+ 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f,
+ 0x72, 0x12, 0x14, 0x0a, 0x05, 0x66, 0x6c, 0x61, 0x67, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d,
+ 0x52, 0x05, 0x66, 0x6c, 0x61, 0x67, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x6c, 0x67, 0x6f, 0x72,
+ 0x69, 0x74, 0x68, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x61, 0x6c, 0x67, 0x6f,
+ 0x72, 0x69, 0x74, 0x68, 0x6d, 0x22, 0x8a, 0x01, 0x0a, 0x0c, 0x53, 0x69, 0x64, 0x53, 0x74, 0x72,
+ 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f,
+ 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x6c, 0x6f, 0x63,
+ 0x61, 0x6c, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1d, 0x0a, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c,
+ 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x6c, 0x6f, 0x63,
+ 0x61, 0x6c, 0x4e, 0x6f, 0x64, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f,
+ 0x66, 0x75, 0x6e, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x6c, 0x6f, 0x63, 0x61,
+ 0x6c, 0x46, 0x75, 0x6e, 0x63, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x61,
+ 0x72, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x41,
+ 0x72, 0x67, 0x22, 0x17, 0x0a, 0x03, 0x53, 0x49, 0x44, 0x12, 0x10, 0x0a, 0x03, 0x73, 0x69, 0x64,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x73, 0x69, 0x64, 0x22, 0x31, 0x0a, 0x0b, 0x4d,
0x75, 0x6c, 0x74, 0x69, 0x54, 0x6f, 0x70, 0x6f, 0x49, 0x44, 0x12, 0x22, 0x0a, 0x0d, 0x6d, 0x75,
0x6c, 0x74, 0x69, 0x5f, 0x74, 0x6f, 0x70, 0x6f, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
- 0x0d, 0x52, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x54, 0x6f, 0x70, 0x6f, 0x49, 0x64, 0x22, 0x3f,
+ 0x0d, 0x52, 0x0b, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x54, 0x6f, 0x70, 0x6f, 0x49, 0x64, 0x22, 0xfd,
+ 0x01, 0x0a, 0x09, 0x4c, 0x73, 0x53, 0x72, 0x76, 0x36, 0x53, 0x49, 0x44, 0x12, 0x24, 0x0a, 0x04,
+ 0x73, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x61, 0x70, 0x69,
+ 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x49, 0x44, 0x52, 0x04, 0x73, 0x69,
+ 0x64, 0x73, 0x12, 0x4a, 0x0a, 0x11, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x62,
+ 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e,
+ 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x6e, 0x64, 0x70,
+ 0x6f, 0x69, 0x6e, 0x74, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x52, 0x10, 0x65, 0x6e,
+ 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x12, 0x3e,
+ 0x0a, 0x0d, 0x73, 0x69, 0x64, 0x5f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x18,
+ 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61,
+ 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x69, 0x64, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65,
+ 0x52, 0x0c, 0x73, 0x69, 0x64, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x12, 0x3e,
+ 0x0a, 0x0e, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x5f, 0x74, 0x6f, 0x70, 0x6f, 0x5f, 0x69, 0x64, 0x73,
+ 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c,
+ 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x54, 0x6f, 0x70, 0x6f, 0x49, 0x44,
+ 0x52, 0x0c, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x54, 0x6f, 0x70, 0x6f, 0x49, 0x64, 0x73, 0x22, 0x3f,
0x0a, 0x08, 0x4c, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x72,
0x65, 0x66, 0x69, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x72, 0x65, 0x66,
0x69, 0x78, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x69, 0x64, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18,
@@ -1746,134 +1981,148 @@ var file_pola_proto_rawDesc = []byte{
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f,
0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x79, 0x70, 0x65,
0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18,
- 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0x96, 0x02, 0x0a,
- 0x06, 0x4c, 0x73, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x26, 0x0a, 0x0f, 0x6c, 0x6f, 0x63, 0x61, 0x6c,
- 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
- 0x52, 0x0d, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12,
- 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x61, 0x73, 0x6e, 0x18, 0x02, 0x20, 0x01,
- 0x28, 0x0d, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x41, 0x73, 0x6e, 0x12, 0x19, 0x0a, 0x08,
- 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x69, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
- 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x49, 0x70, 0x12, 0x28, 0x0a, 0x10, 0x72, 0x65, 0x6d, 0x6f, 0x74,
- 0x65, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28,
- 0x09, 0x52, 0x0e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x49,
- 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x61, 0x73, 0x6e, 0x18,
- 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x41, 0x73, 0x6e,
- 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x69, 0x70, 0x18, 0x06, 0x20,
- 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x49, 0x70, 0x12, 0x2d, 0x0a,
- 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13,
- 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x65, 0x74,
- 0x72, 0x69, 0x63, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x17, 0x0a, 0x07,
- 0x61, 0x64, 0x6a, 0x5f, 0x73, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x61,
- 0x64, 0x6a, 0x53, 0x69, 0x64, 0x22, 0xd1, 0x02, 0x0a, 0x06, 0x4c, 0x73, 0x4e, 0x6f, 0x64, 0x65,
- 0x12, 0x10, 0x0a, 0x03, 0x61, 0x73, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x03, 0x61,
- 0x73, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18,
- 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x49, 0x64, 0x12,
- 0x20, 0x0a, 0x0c, 0x69, 0x73, 0x69, 0x73, 0x5f, 0x61, 0x72, 0x65, 0x61, 0x5f, 0x69, 0x64, 0x18,
- 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x73, 0x69, 0x73, 0x41, 0x72, 0x65, 0x61, 0x49,
- 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20,
- 0x01, 0x28, 0x09, 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a,
- 0x0a, 0x73, 0x72, 0x67, 0x62, 0x5f, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28,
- 0x0d, 0x52, 0x09, 0x73, 0x72, 0x67, 0x62, 0x42, 0x65, 0x67, 0x69, 0x6e, 0x12, 0x19, 0x0a, 0x08,
- 0x73, 0x72, 0x67, 0x62, 0x5f, 0x65, 0x6e, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07,
- 0x73, 0x72, 0x67, 0x62, 0x45, 0x6e, 0x64, 0x12, 0x2e, 0x0a, 0x08, 0x6c, 0x73, 0x5f, 0x6c, 0x69,
- 0x6e, 0x6b, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x61, 0x70, 0x69, 0x2e,
- 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x73, 0x4c, 0x69, 0x6e, 0x6b, 0x52, 0x07,
- 0x6c, 0x73, 0x4c, 0x69, 0x6e, 0x6b, 0x73, 0x12, 0x36, 0x0a, 0x0b, 0x6c, 0x73, 0x5f, 0x70, 0x72,
- 0x65, 0x66, 0x69, 0x78, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x61,
- 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x73, 0x50, 0x72, 0x65,
- 0x66, 0x69, 0x78, 0x52, 0x0a, 0x6c, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x65, 0x73, 0x12,
- 0x38, 0x0a, 0x0c, 0x6c, 0x73, 0x5f, 0x73, 0x72, 0x76, 0x36, 0x5f, 0x73, 0x69, 0x64, 0x73, 0x18,
- 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61,
- 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x73, 0x53, 0x72, 0x76, 0x36, 0x53, 0x49, 0x44, 0x52, 0x0a, 0x6c,
- 0x73, 0x53, 0x72, 0x76, 0x36, 0x53, 0x69, 0x64, 0x73, 0x22, 0x4d, 0x0a, 0x03, 0x54, 0x45, 0x44,
- 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08,
- 0x52, 0x06, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x2e, 0x0a, 0x08, 0x6c, 0x73, 0x5f, 0x6e,
- 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x61, 0x70, 0x69,
- 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x52,
- 0x07, 0x6c, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x22, 0x17, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x53,
- 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
- 0x74, 0x22, 0x4a, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c,
- 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a, 0x08, 0x73,
- 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e,
- 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x73, 0x73,
- 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x18, 0x0a,
- 0x16, 0x47, 0x65, 0x74, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4c, 0x69, 0x73, 0x74,
- 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x51, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x53, 0x52,
- 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
- 0x73, 0x65, 0x12, 0x36, 0x0a, 0x0b, 0x73, 0x72, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65,
- 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f,
- 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x0a,
- 0x73, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x22, 0x0f, 0x0a, 0x0d, 0x47, 0x65,
- 0x74, 0x54, 0x45, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x58, 0x0a, 0x0e, 0x47,
- 0x65, 0x74, 0x54, 0x45, 0x44, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a,
- 0x06, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x65,
- 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x2e, 0x0a, 0x08, 0x6c, 0x73, 0x5f, 0x6e, 0x6f, 0x64, 0x65,
- 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f,
- 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x07, 0x6c, 0x73,
- 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x22, 0x2a, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53,
- 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a,
- 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x61, 0x64, 0x64,
- 0x72, 0x22, 0x36, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69,
- 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x69, 0x73,
- 0x5f, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09,
- 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x2a, 0x67, 0x0a, 0x0c, 0x53, 0x52, 0x50,
- 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x1a, 0x53, 0x52, 0x5f,
- 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50,
- 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x53, 0x52, 0x5f,
- 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x58, 0x50, 0x4c,
- 0x49, 0x43, 0x49, 0x54, 0x10, 0x01, 0x12, 0x1a, 0x0a, 0x16, 0x53, 0x52, 0x5f, 0x50, 0x4f, 0x4c,
- 0x49, 0x43, 0x59, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x59, 0x4e, 0x41, 0x4d, 0x49, 0x43,
- 0x10, 0x02, 0x2a, 0x5b, 0x0a, 0x0c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61,
- 0x74, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x53, 0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54,
- 0x41, 0x54, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10,
- 0x00, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54, 0x41,
- 0x54, 0x45, 0x5f, 0x44, 0x4f, 0x57, 0x4e, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x45, 0x53,
- 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x55, 0x50, 0x10, 0x02, 0x2a,
- 0x83, 0x01, 0x0a, 0x0a, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1b,
- 0x0a, 0x17, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e,
- 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x4d,
- 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x47, 0x50, 0x10, 0x01,
- 0x12, 0x12, 0x0a, 0x0e, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f,
- 0x54, 0x45, 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54,
- 0x59, 0x50, 0x45, 0x5f, 0x44, 0x45, 0x4c, 0x41, 0x59, 0x10, 0x03, 0x12, 0x18, 0x0a, 0x14, 0x4d,
- 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x48, 0x4f, 0x50, 0x43, 0x4f,
- 0x55, 0x4e, 0x54, 0x10, 0x04, 0x32, 0x96, 0x04, 0x0a, 0x0a, 0x50, 0x43, 0x45, 0x53, 0x65, 0x72,
- 0x76, 0x69, 0x63, 0x65, 0x12, 0x59, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x52,
- 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c,
- 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c,
- 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x61, 0x70, 0x69,
- 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53,
- 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
- 0x59, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63,
- 0x79, 0x12, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e,
- 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65,
- 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61,
- 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69,
- 0x63, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x0e, 0x47, 0x65,
- 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x22, 0x2e, 0x61,
- 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65,
- 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
- 0x1a, 0x23, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x47,
- 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73,
- 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x53, 0x52, 0x50, 0x6f,
- 0x6c, 0x69, 0x63, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x23, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70,
- 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69,
- 0x63, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e,
- 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53,
- 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f,
- 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x54, 0x45, 0x44, 0x12, 0x1a, 0x2e,
- 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x54,
- 0x45, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x61, 0x70, 0x69, 0x2e,
- 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x45, 0x44, 0x52, 0x65,
- 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65,
- 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f,
- 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x73, 0x73,
- 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x61, 0x70, 0x69,
- 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53,
- 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x24,
- 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x74, 0x74,
- 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6f, 0x6c, 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70, 0x6f, 0x6c,
- 0x61, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xa0, 0x01, 0x0a,
+ 0x0b, 0x53, 0x72, 0x76, 0x36, 0x45, 0x6e, 0x64, 0x58, 0x53, 0x49, 0x44, 0x12, 0x2b, 0x0a, 0x11,
+ 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x62, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f,
+ 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x10, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e,
+ 0x74, 0x42, 0x65, 0x68, 0x61, 0x76, 0x69, 0x6f, 0x72, 0x12, 0x24, 0x0a, 0x04, 0x73, 0x69, 0x64,
+ 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f,
+ 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x49, 0x44, 0x52, 0x04, 0x73, 0x69, 0x64, 0x73, 0x12,
+ 0x3e, 0x0a, 0x0d, 0x73, 0x69, 0x64, 0x5f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65,
+ 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c,
+ 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x69, 0x64, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72,
+ 0x65, 0x52, 0x0c, 0x73, 0x69, 0x64, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x75, 0x72, 0x65, 0x22,
+ 0xd5, 0x02, 0x0a, 0x06, 0x4c, 0x73, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x26, 0x0a, 0x0f, 0x6c, 0x6f,
+ 0x63, 0x61, 0x6c, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20,
+ 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x72,
+ 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x61, 0x73, 0x6e, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x41, 0x73, 0x6e, 0x12,
+ 0x19, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x5f, 0x69, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x07, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x49, 0x70, 0x12, 0x28, 0x0a, 0x10, 0x72, 0x65,
+ 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x04,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x52, 0x6f, 0x75, 0x74,
+ 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x61,
+ 0x73, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65,
+ 0x41, 0x73, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x5f, 0x69, 0x70,
+ 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x49, 0x70,
+ 0x12, 0x2d, 0x0a, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28,
+ 0x0b, 0x32, 0x13, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e,
+ 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12,
+ 0x17, 0x0a, 0x07, 0x61, 0x64, 0x6a, 0x5f, 0x73, 0x69, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0d,
+ 0x52, 0x06, 0x61, 0x64, 0x6a, 0x53, 0x69, 0x64, 0x12, 0x3d, 0x0a, 0x0e, 0x73, 0x72, 0x76, 0x36,
+ 0x5f, 0x65, 0x6e, 0x64, 0x5f, 0x78, 0x5f, 0x73, 0x69, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b,
+ 0x32, 0x18, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x53,
+ 0x72, 0x76, 0x36, 0x45, 0x6e, 0x64, 0x58, 0x53, 0x49, 0x44, 0x52, 0x0b, 0x73, 0x72, 0x76, 0x36,
+ 0x45, 0x6e, 0x64, 0x58, 0x53, 0x69, 0x64, 0x22, 0xd1, 0x02, 0x0a, 0x06, 0x4c, 0x73, 0x4e, 0x6f,
+ 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x61, 0x73, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52,
+ 0x03, 0x61, 0x73, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x5f, 0x69,
+ 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x72, 0x49,
+ 0x64, 0x12, 0x20, 0x0a, 0x0c, 0x69, 0x73, 0x69, 0x73, 0x5f, 0x61, 0x72, 0x65, 0x61, 0x5f, 0x69,
+ 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x73, 0x69, 0x73, 0x41, 0x72, 0x65,
+ 0x61, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x18,
+ 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x12,
+ 0x1d, 0x0a, 0x0a, 0x73, 0x72, 0x67, 0x62, 0x5f, 0x62, 0x65, 0x67, 0x69, 0x6e, 0x18, 0x05, 0x20,
+ 0x01, 0x28, 0x0d, 0x52, 0x09, 0x73, 0x72, 0x67, 0x62, 0x42, 0x65, 0x67, 0x69, 0x6e, 0x12, 0x19,
+ 0x0a, 0x08, 0x73, 0x72, 0x67, 0x62, 0x5f, 0x65, 0x6e, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d,
+ 0x52, 0x07, 0x73, 0x72, 0x67, 0x62, 0x45, 0x6e, 0x64, 0x12, 0x2e, 0x0a, 0x08, 0x6c, 0x73, 0x5f,
+ 0x6c, 0x69, 0x6e, 0x6b, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x61, 0x70,
+ 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x73, 0x4c, 0x69, 0x6e, 0x6b,
+ 0x52, 0x07, 0x6c, 0x73, 0x4c, 0x69, 0x6e, 0x6b, 0x73, 0x12, 0x36, 0x0a, 0x0b, 0x6c, 0x73, 0x5f,
+ 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x65, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15,
+ 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x73, 0x50,
+ 0x72, 0x65, 0x66, 0x69, 0x78, 0x52, 0x0a, 0x6c, 0x73, 0x50, 0x72, 0x65, 0x66, 0x69, 0x78, 0x65,
+ 0x73, 0x12, 0x38, 0x0a, 0x0c, 0x6c, 0x73, 0x5f, 0x73, 0x72, 0x76, 0x36, 0x5f, 0x73, 0x69, 0x64,
+ 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f,
+ 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x73, 0x53, 0x72, 0x76, 0x36, 0x53, 0x49, 0x44, 0x52,
+ 0x0a, 0x6c, 0x73, 0x53, 0x72, 0x76, 0x36, 0x53, 0x69, 0x64, 0x73, 0x22, 0x4d, 0x0a, 0x03, 0x54,
+ 0x45, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x08, 0x52, 0x06, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x2e, 0x0a, 0x08, 0x6c, 0x73,
+ 0x5f, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x61,
+ 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x73, 0x4e, 0x6f, 0x64,
+ 0x65, 0x52, 0x07, 0x6c, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x22, 0x17, 0x0a, 0x15, 0x47, 0x65,
+ 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75,
+ 0x65, 0x73, 0x74, 0x22, 0x4a, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f,
+ 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x30, 0x0a,
+ 0x08, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
+ 0x14, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65,
+ 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x22,
+ 0x18, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4c, 0x69,
+ 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x51, 0x0a, 0x17, 0x47, 0x65, 0x74,
+ 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70,
+ 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x36, 0x0a, 0x0b, 0x73, 0x72, 0x5f, 0x70, 0x6f, 0x6c, 0x69, 0x63,
+ 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e,
+ 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79,
+ 0x52, 0x0a, 0x73, 0x72, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x69, 0x65, 0x73, 0x22, 0x0f, 0x0a, 0x0d,
+ 0x47, 0x65, 0x74, 0x54, 0x45, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x58, 0x0a,
+ 0x0e, 0x47, 0x65, 0x74, 0x54, 0x45, 0x44, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
+ 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52,
+ 0x06, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x2e, 0x0a, 0x08, 0x6c, 0x73, 0x5f, 0x6e, 0x6f,
+ 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x61, 0x70, 0x69, 0x2e,
+ 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x52, 0x07,
+ 0x6c, 0x73, 0x4e, 0x6f, 0x64, 0x65, 0x73, 0x22, 0x2a, 0x0a, 0x14, 0x44, 0x65, 0x6c, 0x65, 0x74,
+ 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
+ 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x61,
+ 0x64, 0x64, 0x72, 0x22, 0x36, 0x0a, 0x15, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65, 0x73,
+ 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1d, 0x0a, 0x0a,
+ 0x69, 0x73, 0x5f, 0x73, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08,
+ 0x52, 0x09, 0x69, 0x73, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x2a, 0x67, 0x0a, 0x0c, 0x53,
+ 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1e, 0x0a, 0x1a, 0x53,
+ 0x52, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e,
+ 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x53,
+ 0x52, 0x5f, 0x50, 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x45, 0x58,
+ 0x50, 0x4c, 0x49, 0x43, 0x49, 0x54, 0x10, 0x01, 0x12, 0x1a, 0x0a, 0x16, 0x53, 0x52, 0x5f, 0x50,
+ 0x4f, 0x4c, 0x49, 0x43, 0x59, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x59, 0x4e, 0x41, 0x4d,
+ 0x49, 0x43, 0x10, 0x02, 0x2a, 0x5b, 0x0a, 0x0c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53,
+ 0x74, 0x61, 0x74, 0x65, 0x12, 0x1d, 0x0a, 0x19, 0x53, 0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x5f,
+ 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45,
+ 0x44, 0x10, 0x00, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x53,
+ 0x54, 0x41, 0x54, 0x45, 0x5f, 0x44, 0x4f, 0x57, 0x4e, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53,
+ 0x45, 0x53, 0x53, 0x49, 0x4f, 0x4e, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x5f, 0x55, 0x50, 0x10,
+ 0x02, 0x2a, 0x83, 0x01, 0x0a, 0x0a, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x54, 0x79, 0x70, 0x65,
+ 0x12, 0x1b, 0x0a, 0x17, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f,
+ 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x13, 0x0a,
+ 0x0f, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x49, 0x47, 0x50,
+ 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54, 0x59, 0x50,
+ 0x45, 0x5f, 0x54, 0x45, 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43,
+ 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x45, 0x4c, 0x41, 0x59, 0x10, 0x03, 0x12, 0x18, 0x0a,
+ 0x14, 0x4d, 0x45, 0x54, 0x52, 0x49, 0x43, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x48, 0x4f, 0x50,
+ 0x43, 0x4f, 0x55, 0x4e, 0x54, 0x10, 0x04, 0x32, 0x96, 0x04, 0x0a, 0x0a, 0x50, 0x43, 0x45, 0x53,
+ 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x59, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
+ 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x12, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70,
+ 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x53, 0x52, 0x50,
+ 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x61,
+ 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74,
+ 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
+ 0x65, 0x12, 0x59, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c,
+ 0x69, 0x63, 0x79, 0x12, 0x22, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76,
+ 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79,
+ 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f,
+ 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x52, 0x50, 0x6f,
+ 0x6c, 0x69, 0x63, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x0e,
+ 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x22,
+ 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74,
+ 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65,
+ 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31,
+ 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52,
+ 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5c, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x53, 0x52,
+ 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x23, 0x2e, 0x61, 0x70, 0x69,
+ 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x52, 0x50, 0x6f,
+ 0x6c, 0x69, 0x63, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
+ 0x24, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65,
+ 0x74, 0x53, 0x52, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73,
+ 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x06, 0x47, 0x65, 0x74, 0x54, 0x45, 0x44, 0x12,
+ 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65,
+ 0x74, 0x54, 0x45, 0x44, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x61, 0x70,
+ 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x45, 0x44,
+ 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65,
+ 0x74, 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x21, 0x2e, 0x61, 0x70, 0x69, 0x2e,
+ 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x53, 0x65,
+ 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x61,
+ 0x70, 0x69, 0x2e, 0x70, 0x6f, 0x6c, 0x61, 0x2e, 0x76, 0x31, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74,
+ 0x65, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
+ 0x42, 0x24, 0x5a, 0x22, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e,
+ 0x74, 0x74, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x6f, 0x6c, 0x61, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x70,
+ 0x6f, 0x6c, 0x61, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -1889,7 +2138,7 @@ func file_pola_proto_rawDescGZIP() []byte {
}
var file_pola_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
-var file_pola_proto_msgTypes = make([]protoimpl.MessageInfo, 25)
+var file_pola_proto_msgTypes = make([]protoimpl.MessageInfo, 28)
var file_pola_proto_goTypes = []interface{}{
(SRPolicyType)(0), // 0: api.pola.v1.SRPolicyType
(SessionState)(0), // 1: api.pola.v1.SessionState
@@ -1903,22 +2152,25 @@ var file_pola_proto_goTypes = []interface{}{
(*Session)(nil), // 9: api.pola.v1.Session
(*SessionList)(nil), // 10: api.pola.v1.SessionList
(*SRPolicyList)(nil), // 11: api.pola.v1.SRPolicyList
- (*LsSrv6SID)(nil), // 12: api.pola.v1.LsSrv6SID
- (*SID)(nil), // 13: api.pola.v1.SID
- (*MultiTopoID)(nil), // 14: api.pola.v1.MultiTopoID
- (*LsPrefix)(nil), // 15: api.pola.v1.LsPrefix
- (*Metric)(nil), // 16: api.pola.v1.Metric
- (*LsLink)(nil), // 17: api.pola.v1.LsLink
- (*LsNode)(nil), // 18: api.pola.v1.LsNode
- (*TED)(nil), // 19: api.pola.v1.TED
- (*GetSessionListRequest)(nil), // 20: api.pola.v1.GetSessionListRequest
- (*GetSessionListResponse)(nil), // 21: api.pola.v1.GetSessionListResponse
- (*GetSRPolicyListRequest)(nil), // 22: api.pola.v1.GetSRPolicyListRequest
- (*GetSRPolicyListResponse)(nil), // 23: api.pola.v1.GetSRPolicyListResponse
- (*GetTEDRequest)(nil), // 24: api.pola.v1.GetTEDRequest
- (*GetTEDResponse)(nil), // 25: api.pola.v1.GetTEDResponse
- (*DeleteSessionRequest)(nil), // 26: api.pola.v1.DeleteSessionRequest
- (*DeleteSessionResponse)(nil), // 27: api.pola.v1.DeleteSessionResponse
+ (*EndpointBehavior)(nil), // 12: api.pola.v1.EndpointBehavior
+ (*SidStructure)(nil), // 13: api.pola.v1.SidStructure
+ (*SID)(nil), // 14: api.pola.v1.SID
+ (*MultiTopoID)(nil), // 15: api.pola.v1.MultiTopoID
+ (*LsSrv6SID)(nil), // 16: api.pola.v1.LsSrv6SID
+ (*LsPrefix)(nil), // 17: api.pola.v1.LsPrefix
+ (*Metric)(nil), // 18: api.pola.v1.Metric
+ (*Srv6EndXSID)(nil), // 19: api.pola.v1.Srv6EndXSID
+ (*LsLink)(nil), // 20: api.pola.v1.LsLink
+ (*LsNode)(nil), // 21: api.pola.v1.LsNode
+ (*TED)(nil), // 22: api.pola.v1.TED
+ (*GetSessionListRequest)(nil), // 23: api.pola.v1.GetSessionListRequest
+ (*GetSessionListResponse)(nil), // 24: api.pola.v1.GetSessionListResponse
+ (*GetSRPolicyListRequest)(nil), // 25: api.pola.v1.GetSRPolicyListRequest
+ (*GetSRPolicyListResponse)(nil), // 26: api.pola.v1.GetSRPolicyListResponse
+ (*GetTEDRequest)(nil), // 27: api.pola.v1.GetTEDRequest
+ (*GetTEDResponse)(nil), // 28: api.pola.v1.GetTEDResponse
+ (*DeleteSessionRequest)(nil), // 29: api.pola.v1.DeleteSessionRequest
+ (*DeleteSessionResponse)(nil), // 30: api.pola.v1.DeleteSessionResponse
}
var file_pola_proto_depIdxs = []int32{
0, // 0: api.pola.v1.SRPolicy.type:type_name -> api.pola.v1.SRPolicyType
@@ -1929,34 +2181,39 @@ var file_pola_proto_depIdxs = []int32{
1, // 5: api.pola.v1.Session.state:type_name -> api.pola.v1.SessionState
9, // 6: api.pola.v1.SessionList.sessions:type_name -> api.pola.v1.Session
4, // 7: api.pola.v1.SRPolicyList.sr_policies:type_name -> api.pola.v1.SRPolicy
- 13, // 8: api.pola.v1.LsSrv6SID.sids:type_name -> api.pola.v1.SID
- 14, // 9: api.pola.v1.LsSrv6SID.multi_topo_ids:type_name -> api.pola.v1.MultiTopoID
- 2, // 10: api.pola.v1.Metric.type:type_name -> api.pola.v1.MetricType
- 16, // 11: api.pola.v1.LsLink.metrics:type_name -> api.pola.v1.Metric
- 17, // 12: api.pola.v1.LsNode.ls_links:type_name -> api.pola.v1.LsLink
- 15, // 13: api.pola.v1.LsNode.ls_prefixes:type_name -> api.pola.v1.LsPrefix
- 12, // 14: api.pola.v1.LsNode.ls_srv6_sids:type_name -> api.pola.v1.LsSrv6SID
- 18, // 15: api.pola.v1.TED.ls_nodes:type_name -> api.pola.v1.LsNode
- 9, // 16: api.pola.v1.GetSessionListResponse.sessions:type_name -> api.pola.v1.Session
- 4, // 17: api.pola.v1.GetSRPolicyListResponse.sr_policies:type_name -> api.pola.v1.SRPolicy
- 18, // 18: api.pola.v1.GetTEDResponse.ls_nodes:type_name -> api.pola.v1.LsNode
- 5, // 19: api.pola.v1.PCEService.CreateSRPolicy:input_type -> api.pola.v1.CreateSRPolicyRequest
- 7, // 20: api.pola.v1.PCEService.DeleteSRPolicy:input_type -> api.pola.v1.DeleteSRPolicyRequest
- 20, // 21: api.pola.v1.PCEService.GetSessionList:input_type -> api.pola.v1.GetSessionListRequest
- 22, // 22: api.pola.v1.PCEService.GetSRPolicyList:input_type -> api.pola.v1.GetSRPolicyListRequest
- 24, // 23: api.pola.v1.PCEService.GetTED:input_type -> api.pola.v1.GetTEDRequest
- 26, // 24: api.pola.v1.PCEService.DeleteSession:input_type -> api.pola.v1.DeleteSessionRequest
- 6, // 25: api.pola.v1.PCEService.CreateSRPolicy:output_type -> api.pola.v1.CreateSRPolicyResponse
- 8, // 26: api.pola.v1.PCEService.DeleteSRPolicy:output_type -> api.pola.v1.DeleteSRPolicyResponse
- 21, // 27: api.pola.v1.PCEService.GetSessionList:output_type -> api.pola.v1.GetSessionListResponse
- 23, // 28: api.pola.v1.PCEService.GetSRPolicyList:output_type -> api.pola.v1.GetSRPolicyListResponse
- 25, // 29: api.pola.v1.PCEService.GetTED:output_type -> api.pola.v1.GetTEDResponse
- 27, // 30: api.pola.v1.PCEService.DeleteSession:output_type -> api.pola.v1.DeleteSessionResponse
- 25, // [25:31] is the sub-list for method output_type
- 19, // [19:25] is the sub-list for method input_type
- 19, // [19:19] is the sub-list for extension type_name
- 19, // [19:19] is the sub-list for extension extendee
- 0, // [0:19] is the sub-list for field type_name
+ 14, // 8: api.pola.v1.LsSrv6SID.sids:type_name -> api.pola.v1.SID
+ 12, // 9: api.pola.v1.LsSrv6SID.endpoint_behavior:type_name -> api.pola.v1.EndpointBehavior
+ 13, // 10: api.pola.v1.LsSrv6SID.sid_structure:type_name -> api.pola.v1.SidStructure
+ 15, // 11: api.pola.v1.LsSrv6SID.multi_topo_ids:type_name -> api.pola.v1.MultiTopoID
+ 2, // 12: api.pola.v1.Metric.type:type_name -> api.pola.v1.MetricType
+ 14, // 13: api.pola.v1.Srv6EndXSID.sids:type_name -> api.pola.v1.SID
+ 13, // 14: api.pola.v1.Srv6EndXSID.sid_structure:type_name -> api.pola.v1.SidStructure
+ 18, // 15: api.pola.v1.LsLink.metrics:type_name -> api.pola.v1.Metric
+ 19, // 16: api.pola.v1.LsLink.srv6_end_x_sid:type_name -> api.pola.v1.Srv6EndXSID
+ 20, // 17: api.pola.v1.LsNode.ls_links:type_name -> api.pola.v1.LsLink
+ 17, // 18: api.pola.v1.LsNode.ls_prefixes:type_name -> api.pola.v1.LsPrefix
+ 16, // 19: api.pola.v1.LsNode.ls_srv6_sids:type_name -> api.pola.v1.LsSrv6SID
+ 21, // 20: api.pola.v1.TED.ls_nodes:type_name -> api.pola.v1.LsNode
+ 9, // 21: api.pola.v1.GetSessionListResponse.sessions:type_name -> api.pola.v1.Session
+ 4, // 22: api.pola.v1.GetSRPolicyListResponse.sr_policies:type_name -> api.pola.v1.SRPolicy
+ 21, // 23: api.pola.v1.GetTEDResponse.ls_nodes:type_name -> api.pola.v1.LsNode
+ 5, // 24: api.pola.v1.PCEService.CreateSRPolicy:input_type -> api.pola.v1.CreateSRPolicyRequest
+ 7, // 25: api.pola.v1.PCEService.DeleteSRPolicy:input_type -> api.pola.v1.DeleteSRPolicyRequest
+ 23, // 26: api.pola.v1.PCEService.GetSessionList:input_type -> api.pola.v1.GetSessionListRequest
+ 25, // 27: api.pola.v1.PCEService.GetSRPolicyList:input_type -> api.pola.v1.GetSRPolicyListRequest
+ 27, // 28: api.pola.v1.PCEService.GetTED:input_type -> api.pola.v1.GetTEDRequest
+ 29, // 29: api.pola.v1.PCEService.DeleteSession:input_type -> api.pola.v1.DeleteSessionRequest
+ 6, // 30: api.pola.v1.PCEService.CreateSRPolicy:output_type -> api.pola.v1.CreateSRPolicyResponse
+ 8, // 31: api.pola.v1.PCEService.DeleteSRPolicy:output_type -> api.pola.v1.DeleteSRPolicyResponse
+ 24, // 32: api.pola.v1.PCEService.GetSessionList:output_type -> api.pola.v1.GetSessionListResponse
+ 26, // 33: api.pola.v1.PCEService.GetSRPolicyList:output_type -> api.pola.v1.GetSRPolicyListResponse
+ 28, // 34: api.pola.v1.PCEService.GetTED:output_type -> api.pola.v1.GetTEDResponse
+ 30, // 35: api.pola.v1.PCEService.DeleteSession:output_type -> api.pola.v1.DeleteSessionResponse
+ 30, // [30:36] is the sub-list for method output_type
+ 24, // [24:30] is the sub-list for method input_type
+ 24, // [24:24] is the sub-list for extension type_name
+ 24, // [24:24] is the sub-list for extension extendee
+ 0, // [0:24] is the sub-list for field type_name
}
func init() { file_pola_proto_init() }
@@ -2074,7 +2331,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*LsSrv6SID); i {
+ switch v := v.(*EndpointBehavior); i {
case 0:
return &v.state
case 1:
@@ -2086,7 +2343,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*SID); i {
+ switch v := v.(*SidStructure); i {
case 0:
return &v.state
case 1:
@@ -2098,7 +2355,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*MultiTopoID); i {
+ switch v := v.(*SID); i {
case 0:
return &v.state
case 1:
@@ -2110,7 +2367,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*LsPrefix); i {
+ switch v := v.(*MultiTopoID); i {
case 0:
return &v.state
case 1:
@@ -2122,7 +2379,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*Metric); i {
+ switch v := v.(*LsSrv6SID); i {
case 0:
return &v.state
case 1:
@@ -2134,7 +2391,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*LsLink); i {
+ switch v := v.(*LsPrefix); i {
case 0:
return &v.state
case 1:
@@ -2146,7 +2403,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*LsNode); i {
+ switch v := v.(*Metric); i {
case 0:
return &v.state
case 1:
@@ -2158,7 +2415,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*TED); i {
+ switch v := v.(*Srv6EndXSID); i {
case 0:
return &v.state
case 1:
@@ -2170,7 +2427,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*GetSessionListRequest); i {
+ switch v := v.(*LsLink); i {
case 0:
return &v.state
case 1:
@@ -2182,7 +2439,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[18].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*GetSessionListResponse); i {
+ switch v := v.(*LsNode); i {
case 0:
return &v.state
case 1:
@@ -2194,7 +2451,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*GetSRPolicyListRequest); i {
+ switch v := v.(*TED); i {
case 0:
return &v.state
case 1:
@@ -2206,7 +2463,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*GetSRPolicyListResponse); i {
+ switch v := v.(*GetSessionListRequest); i {
case 0:
return &v.state
case 1:
@@ -2218,7 +2475,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[21].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*GetTEDRequest); i {
+ switch v := v.(*GetSessionListResponse); i {
case 0:
return &v.state
case 1:
@@ -2230,7 +2487,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[22].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*GetTEDResponse); i {
+ switch v := v.(*GetSRPolicyListRequest); i {
case 0:
return &v.state
case 1:
@@ -2242,7 +2499,7 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*DeleteSessionRequest); i {
+ switch v := v.(*GetSRPolicyListResponse); i {
case 0:
return &v.state
case 1:
@@ -2254,6 +2511,42 @@ func file_pola_proto_init() {
}
}
file_pola_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetTEDRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[25].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetTEDResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[26].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*DeleteSessionRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_pola_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteSessionResponse); i {
case 0:
return &v.state
@@ -2272,7 +2565,7 @@ func file_pola_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_pola_proto_rawDesc,
NumEnums: 3,
- NumMessages: 25,
+ NumMessages: 28,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/api/pola/v1/pola.proto b/api/pola/v1/pola.proto
index 797494b7..100f6346 100644
--- a/api/pola/v1/pola.proto
+++ b/api/pola/v1/pola.proto
@@ -85,18 +85,32 @@ message SRPolicyList {
repeated SRPolicy sr_policies = 1;
}
-message LsSrv6SID {
- repeated SID sids = 1;
- uint32 endpoint_behavior = 2;
- repeated MultiTopoID multi_topo_ids = 3;
+message EndpointBehavior {
+ uint32 behavior = 1;
+ uint32 flags = 2;
+ uint32 algorithm = 3;
+}
+
+message SidStructure {
+ uint32 local_block = 1;
+ uint32 local_node = 2;
+ uint32 local_func = 3;
+ uint32 local_arg = 4;
}
message SID {
- string sid = 1;
+ string sid = 1;
}
message MultiTopoID {
- uint32 multi_topo_id = 1;
+ uint32 multi_topo_id = 1;
+}
+
+message LsSrv6SID {
+ repeated SID sids = 1;
+ EndpointBehavior endpoint_behavior = 2;
+ SidStructure sid_structure = 3;
+ repeated MultiTopoID multi_topo_ids = 4;
}
message LsPrefix {
@@ -117,6 +131,12 @@ message Metric {
uint32 value = 2;
}
+message Srv6EndXSID {
+ uint32 endpoint_behavior = 1;
+ repeated SID sids = 2;
+ SidStructure sid_structure = 3;
+}
+
message LsLink {
string local_router_id = 1;
uint32 local_asn = 2;
@@ -126,6 +146,7 @@ message LsLink {
string remote_ip = 6;
repeated Metric metrics = 7;
uint32 adj_sid = 8;
+ Srv6EndXSID srv6_end_x_sid = 9;
}
message LsNode {
diff --git a/cmd/pola/grpc/grpc_client.go b/cmd/pola/grpc/grpc_client.go
index 05033135..bdd3e315 100644
--- a/cmd/pola/grpc/grpc_client.go
+++ b/cmd/pola/grpc/grpc_client.go
@@ -246,10 +246,6 @@ func createSrv6SID(lsNode *table.LsNode, srv6SID *pb.LsSrv6SID) (*table.LsSrv6SI
lsSrv6SID := table.NewLsSrv6SID(lsNode)
lsSrv6SID.EndpointBehavior = srv6SID.GetEndpointBehavior()
- lsSrv6SID.ServiceType = srv6SID.GetServiceType()
- lsSrv6SID.TrafficType = srv6SID.GetTrafficType()
- lsSrv6SID.OpaqueType = srv6SID.GetOpaqueType()
- lsSrv6SID.Value = srv6SID.GetValue()
for _, sid := range srv6SID.GetSids() {
lsSrv6SID.Sids = append(lsSrv6SID.Sids, sid.GetSid())
}
From a1be49738691dc1bf38193c99b4d0eff836da6b4 Mon Sep 17 00:00:00 2001
From: k1yoto
Date: Sun, 22 Jun 2025 08:35:42 +0000
Subject: [PATCH 35/87] feat(srv6): add SRv6 End.X SID and SID Structure
support
---
cmd/pola/grpc/grpc_client.go | 36 +++++++++++++++++++++-
internal/pkg/gobgp/interface.go | 35 ++++++++++++++++++---
internal/pkg/table/ted.go | 54 ++++++++++++++++++++++++++-------
pkg/server/grpc_server.go | 38 ++++++++++++++++++++---
4 files changed, 142 insertions(+), 21 deletions(-)
diff --git a/cmd/pola/grpc/grpc_client.go b/cmd/pola/grpc/grpc_client.go
index bdd3e315..a57afe22 100644
--- a/cmd/pola/grpc/grpc_client.go
+++ b/cmd/pola/grpc/grpc_client.go
@@ -224,6 +224,13 @@ func createLsLink(localNode, remoteNode *table.LsNode, link *pb.LsLink) (*table.
}
lsLink.Metrics = append(lsLink.Metrics, metric)
}
+ if link.GetSrv6EndXSid() != nil {
+ srv6EndXSID, err := createSrv6EndXSID(link.GetSrv6EndXSid())
+ if err != nil {
+ return nil, err
+ }
+ lsLink.Srv6EndXSID = srv6EndXSID
+ }
return lsLink, nil
}
@@ -242,10 +249,28 @@ func createMetric(metricInfo *pb.Metric) (*table.Metric, error) {
}
}
+func createSrv6EndXSID(srv6EndXSID *pb.Srv6EndXSID) (*table.Srv6EndXSID, error) {
+ lsSrv6EndXSID := &table.Srv6EndXSID{
+ EndpointBehavior: uint16(srv6EndXSID.EndpointBehavior),
+ Sids: []string{},
+ Srv6SIDStructure: table.SIDStructure{
+ LocalBlock: uint8(srv6EndXSID.GetSidStructure().GetLocalBlock()),
+ LocalNode: uint8(srv6EndXSID.GetSidStructure().GetLocalNode()),
+ LocalFunc: uint8(srv6EndXSID.GetSidStructure().GetLocalFunc()),
+ LocalArg: uint8(srv6EndXSID.GetSidStructure().GetLocalArg()),
+ },
+ }
+
+ for _, sid := range srv6EndXSID.GetSids() {
+ lsSrv6EndXSID.Sids = append(lsSrv6EndXSID.Sids, sid.GetSid())
+ }
+
+ return lsSrv6EndXSID, nil
+}
+
func createSrv6SID(lsNode *table.LsNode, srv6SID *pb.LsSrv6SID) (*table.LsSrv6SID, error) {
lsSrv6SID := table.NewLsSrv6SID(lsNode)
- lsSrv6SID.EndpointBehavior = srv6SID.GetEndpointBehavior()
for _, sid := range srv6SID.GetSids() {
lsSrv6SID.Sids = append(lsSrv6SID.Sids, sid.GetSid())
}
@@ -253,5 +278,14 @@ func createSrv6SID(lsNode *table.LsNode, srv6SID *pb.LsSrv6SID) (*table.LsSrv6SI
lsSrv6SID.MultiTopoIDs = append(lsSrv6SID.MultiTopoIDs, topoID.GetMultiTopoId())
}
+ lsSrv6SID.EndpointBehavior.Behavior = uint16(srv6SID.GetEndpointBehavior().GetBehavior())
+ lsSrv6SID.EndpointBehavior.Flags = uint8(srv6SID.GetEndpointBehavior().GetFlags())
+ lsSrv6SID.EndpointBehavior.Algorithm = uint8(srv6SID.GetEndpointBehavior().GetAlgorithm())
+
+ lsSrv6SID.SIDStructure.LocalBlock = uint8(srv6SID.GetSidStructure().GetLocalBlock())
+ lsSrv6SID.SIDStructure.LocalNode = uint8(srv6SID.GetSidStructure().GetLocalNode())
+ lsSrv6SID.SIDStructure.LocalFunc = uint8(srv6SID.GetSidStructure().GetLocalFunc())
+ lsSrv6SID.SIDStructure.LocalArg = uint8(srv6SID.GetSidStructure().GetLocalArg())
+
return lsSrv6SID, nil
}
diff --git a/internal/pkg/gobgp/interface.go b/internal/pkg/gobgp/interface.go
index 3b02e9e8..c89743df 100644
--- a/internal/pkg/gobgp/interface.go
+++ b/internal/pkg/gobgp/interface.go
@@ -232,6 +232,22 @@ func getLsLinkNLRI(typedLinkStateNLRI *api.LsLinkNLRI, pathAttrs []*anypb.Any) (
}
lsLink.AdjSid = bgplsAttr.GetLink().GetSrAdjacencySid()
+
+ // handle SRv6 SID TLV
+ var srv6EndXSID *api.LsSrv6EndXSID
+ srv6EndXSID = bgplsAttr.GetLink().GetSrv6EndXSid()
+ if srv6EndXSID != nil {
+ lsLink.Srv6EndXSID = &table.Srv6EndXSID{
+ EndpointBehavior: uint16(srv6EndXSID.EndpointBehavior),
+ Sids: srv6EndXSID.Sids,
+ Srv6SIDStructure: table.SIDStructure{
+ LocalBlock: uint8(srv6EndXSID.Srv6SidStructure.GetLocalBlock()),
+ LocalNode: uint8(srv6EndXSID.Srv6SidStructure.GetLocalNode()),
+ LocalFunc: uint8(srv6EndXSID.Srv6SidStructure.GetLocalFunc()),
+ LocalArg: uint8(srv6EndXSID.Srv6SidStructure.GetLocalArg()),
+ },
+ }
+ }
}
return lsLink, nil
@@ -316,7 +332,8 @@ func getLsPrefix(lsNlri *api.LsAddrPrefix, sidIndex uint32) (*table.LsPrefix, er
func getLsSrv6SIDNLRIList(pathAttrs []*anypb.Any) ([]table.TEDElem, error) {
var lsSrv6SIDList []table.TEDElem
- var endpointBehavior uint32
+ var endpointBehavior *api.LsSrv6EndpointBehavior
+ var srv6SIDStructure *api.LsSrv6SIDStructure
for _, pathAttr := range pathAttrs {
typedPathAttr, err := pathAttr.UnmarshalNew()
@@ -326,7 +343,9 @@ func getLsSrv6SIDNLRIList(pathAttrs []*anypb.Any) ([]table.TEDElem, error) {
switch typedPathAttr := typedPathAttr.(type) {
case *api.LsAttribute:
- // TODO: Handle LsAttribute for SRv6 SID
+ // handle LsAttribute for SRv6 SID
+ srv6SIDStructure = typedPathAttr.GetSrv6Sid().GetSrv6SidStructure()
+ endpointBehavior = typedPathAttr.GetSrv6Sid().GetSrv6EndpointBehavior()
case *api.MpReachNLRIAttribute:
for _, nlri := range typedPathAttr.GetNlris() {
typedNLRI, err := nlri.UnmarshalNew()
@@ -334,7 +353,7 @@ func getLsSrv6SIDNLRIList(pathAttrs []*anypb.Any) ([]table.TEDElem, error) {
return nil, fmt.Errorf("failed to unmarshal NLRI: %w", err)
}
if lsNLRI, ok := typedNLRI.(*api.LsAddrPrefix); ok {
- lsSrv6SID, err := getLsSrv6SIDNLRI(lsNLRI, endpointBehavior)
+ lsSrv6SID, err := getLsSrv6SIDNLRI(lsNLRI, endpointBehavior, srv6SIDStructure)
if err != nil {
return nil, fmt.Errorf("failed to process LS SRv6 SID NLRI: %w", err)
}
@@ -349,7 +368,7 @@ func getLsSrv6SIDNLRIList(pathAttrs []*anypb.Any) ([]table.TEDElem, error) {
}
// getLsSrv6SIDNLRI processes the LS SRv6 SID NLRI and returns a corresponding LsSrv6SID.
-func getLsSrv6SIDNLRI(lsNLRI *api.LsAddrPrefix, endpointBehavior uint32) (*table.LsSrv6SID, error) {
+func getLsSrv6SIDNLRI(lsNLRI *api.LsAddrPrefix, endpointBehavior *api.LsSrv6EndpointBehavior, srv6SIDStructure *api.LsSrv6SIDStructure) (*table.LsSrv6SID, error) {
srv6NLRI, err := lsNLRI.GetNlri().UnmarshalNew()
if err != nil {
return nil, fmt.Errorf("failed to unmarshal LS NLRI: %w", err)
@@ -366,7 +385,13 @@ func getLsSrv6SIDNLRI(lsNLRI *api.LsAddrPrefix, endpointBehavior uint32) (*table
localNode := table.NewLsNode(localNodeASN, localNodeID)
lsSrv6SID := table.NewLsSrv6SID(localNode)
- lsSrv6SID.EndpointBehavior = endpointBehavior
+ lsSrv6SID.SIDStructure.LocalBlock = uint8(srv6SIDStructure.GetLocalBlock())
+ lsSrv6SID.SIDStructure.LocalNode = uint8(srv6SIDStructure.GetLocalNode())
+ lsSrv6SID.SIDStructure.LocalFunc = uint8(srv6SIDStructure.GetLocalFunc())
+ lsSrv6SID.SIDStructure.LocalArg = uint8(srv6SIDStructure.GetLocalArg())
+ lsSrv6SID.EndpointBehavior.Behavior = uint16(endpointBehavior.GetEndpointBehavior())
+ lsSrv6SID.EndpointBehavior.Flags = uint8(endpointBehavior.GetFlags())
+ lsSrv6SID.EndpointBehavior.Algorithm = uint8(endpointBehavior.GetAlgorithm())
lsSrv6SID.Sids = srv6SIDs
lsSrv6SID.MultiTopoIDs = multiTopoIDs
diff --git a/internal/pkg/table/ted.go b/internal/pkg/table/ted.go
index 88073625..7be62763 100644
--- a/internal/pkg/table/ted.go
+++ b/internal/pkg/table/ted.go
@@ -48,11 +48,22 @@ func (ted *LsTED) Print() {
fmt.Printf(" %s: %d\n", metric.Type.String(), metric.Value)
}
fmt.Printf(" Adj-SID: %d\n", link.AdjSid)
+ fmt.Printf(" SRv6 End.X SID:\n")
+ fmt.Printf(" EndpointBehavior: %x\n", link.Srv6EndXSID.EndpointBehavior)
+ fmt.Printf(" SIDs: %v\n", link.Srv6EndXSID.Sids)
+ fmt.Printf(" SID Structure: Block: %d, Node: %d, Func: %d, Arg: %d\n",
+ link.Srv6EndXSID.Srv6SIDStructure.LocalBlock,
+ link.Srv6EndXSID.Srv6SIDStructure.LocalNode,
+ link.Srv6EndXSID.Srv6SIDStructure.LocalFunc,
+ link.Srv6EndXSID.Srv6SIDStructure.LocalArg)
}
fmt.Printf(" SRv6 SIDs:\n")
for _, srv6SID := range node.SRv6SIDs {
fmt.Printf(" SIDs: %v\n", srv6SID.Sids)
- fmt.Printf(" EndpointBehavior: %d\n", srv6SID.EndpointBehavior)
+ fmt.Printf(" Block: %d, Node: %d, Func: %d, Arg: %d\n", srv6SID.SIDStructure.LocalBlock,
+ srv6SID.SIDStructure.LocalNode, srv6SID.SIDStructure.LocalFunc, srv6SID.SIDStructure.LocalArg)
+ fmt.Printf(" EndpointBehavior: %x, Flags: %d, Algorithm: %d\n", srv6SID.EndpointBehavior.Behavior,
+ srv6SID.EndpointBehavior.Flags, srv6SID.EndpointBehavior.Algorithm)
fmt.Printf(" MultiTopoIDs: %v\n", srv6SID.MultiTopoIDs)
}
@@ -134,12 +145,13 @@ func (n *LsNode) AddLink(link *LsLink) {
}
type LsLink struct {
- LocalNode *LsNode // Primary key, in MP_REACH_NLRI Attr
- RemoteNode *LsNode // Primary key, in MP_REACH_NLRI Attr
- LocalIP netip.Addr // In MP_REACH_NLRI Attr
- RemoteIP netip.Addr // In MP_REACH_NLRI Attr
- Metrics []*Metric // In BGP-LS Attr
- AdjSid uint32 // In BGP-LS Attr
+ LocalNode *LsNode // Primary key, in MP_REACH_NLRI Attr
+ RemoteNode *LsNode // Primary key, in MP_REACH_NLRI Attr
+ LocalIP netip.Addr // In MP_REACH_NLRI Attr
+ RemoteIP netip.Addr // In MP_REACH_NLRI Attr
+ Metrics []*Metric // In BGP-LS Attr
+ AdjSid uint32 // In BGP-LS Attr
+ Srv6EndXSID *Srv6EndXSID // In BGP-LS Attr
}
func NewLsLink(localNode *LsNode, remoteNode *LsNode) *LsLink {
@@ -212,11 +224,25 @@ func (lp *LsPrefix) UpdateTED(ted *LsTED) {
localNode.Prefixes = append(localNode.Prefixes, lp)
}
+type SIDStructure struct {
+ LocalBlock uint8
+ LocalNode uint8
+ LocalFunc uint8
+ LocalArg uint8
+}
+
+type EndpointBehavior struct {
+ Behavior uint16
+ Flags uint8
+ Algorithm uint8
+}
+
type LsSrv6SID struct {
- LocalNode *LsNode // primary key, in MP_REACH_NLRI Attr
- Sids []string // in LsSrv6SID Attr
- EndpointBehavior uint32 // in BGP-LS Attr
- MultiTopoIDs []uint32 // in LsSrv6SID Attr
+ LocalNode *LsNode // primary key, in MP_REACH_NLRI Attr
+ Sids []string // in LsSrv6SID Attr
+ EndpointBehavior EndpointBehavior // in BGP-LS Attr
+ SIDStructure SIDStructure // in BGP-LS Attr
+ MultiTopoIDs []uint32 // in LsSrv6SID Attr
}
func NewLsSrv6SID(node *LsNode) *LsSrv6SID {
@@ -280,3 +306,9 @@ func (m MetricType) String() string {
return "METRIC_TYPE_UNSPECIFIED"
}
}
+
+type Srv6EndXSID struct {
+ EndpointBehavior uint16
+ Sids []string
+ Srv6SIDStructure SIDStructure
+}
diff --git a/pkg/server/grpc_server.go b/pkg/server/grpc_server.go
index b768c992..00279ec8 100644
--- a/pkg/server/grpc_server.go
+++ b/pkg/server/grpc_server.go
@@ -232,7 +232,7 @@ var validator = map[ValidationKind]func(policy *pb.SRPolicy, asn uint32) bool{
policy.SrcRouterId != "" &&
policy.DstRouterId != ""
},
- ValidationKind("AddWithoutLinkState"): func(policy *pb.SRPolicy, asn uint32) bool {
+ ValidationKind("AddDisablePathCompute"): func(policy *pb.SRPolicy, asn uint32) bool {
return policy.PcepSessionAddr != nil &&
len(policy.SrcAddr) > 0 &&
len(policy.DstAddr) > 0 &&
@@ -419,6 +419,23 @@ func (s *APIServer) GetTED(ctx context.Context, req *pb.GetTEDRequest) (*pb.GetT
link.Metrics = append(link.Metrics, metric)
}
+ link.Srv6EndXSid = &pb.Srv6EndXSID{
+ EndpointBehavior: uint32(lsLink.Srv6EndXSID.EndpointBehavior),
+ Sids: make([]*pb.SID, 0, len(lsLink.Srv6EndXSID.Sids)),
+ SidStructure: &pb.SidStructure{
+ LocalBlock: uint32(lsLink.Srv6EndXSID.Srv6SIDStructure.LocalBlock),
+ LocalNode: uint32(lsLink.Srv6EndXSID.Srv6SIDStructure.LocalNode),
+ LocalFunc: uint32(lsLink.Srv6EndXSID.Srv6SIDStructure.LocalFunc),
+ LocalArg: uint32(lsLink.Srv6EndXSID.Srv6SIDStructure.LocalArg),
+ },
+ }
+
+ for _, sid := range lsLink.Srv6EndXSID.Sids {
+ link.Srv6EndXSid.Sids = append(link.Srv6EndXSid.Sids, &pb.SID{
+ Sid: sid,
+ })
+ }
+
node.LsLinks = append(node.LsLinks, link)
}
@@ -433,9 +450,8 @@ func (s *APIServer) GetTED(ctx context.Context, req *pb.GetTEDRequest) (*pb.GetT
for _, lsSrv6SID := range lsNode.SRv6SIDs {
srv6SID := &pb.LsSrv6SID{
- EndpointBehavior: lsSrv6SID.EndpointBehavior,
- Sids: make([]*pb.SID, 0, len(lsSrv6SID.Sids)),
- MultiTopoIds: make([]*pb.MultiTopoID, 0, len(lsSrv6SID.MultiTopoIDs)),
+ Sids: make([]*pb.SID, 0, len(lsSrv6SID.Sids)),
+ MultiTopoIds: make([]*pb.MultiTopoID, 0, len(lsSrv6SID.MultiTopoIDs)),
}
for _, sid := range lsSrv6SID.Sids {
@@ -449,6 +465,20 @@ func (s *APIServer) GetTED(ctx context.Context, req *pb.GetTEDRequest) (*pb.GetT
MultiTopoId: topoID,
})
}
+
+ srv6SID.EndpointBehavior = &pb.EndpointBehavior{
+ Behavior: uint32(lsSrv6SID.EndpointBehavior.Behavior),
+ Flags: uint32(lsSrv6SID.EndpointBehavior.Flags),
+ Algorithm: uint32(lsSrv6SID.EndpointBehavior.Algorithm),
+ }
+
+ srv6SID.SidStructure = &pb.SidStructure{
+ LocalBlock: uint32(lsSrv6SID.SIDStructure.LocalBlock),
+ LocalNode: uint32(lsSrv6SID.SIDStructure.LocalNode),
+ LocalFunc: uint32(lsSrv6SID.SIDStructure.LocalFunc),
+ LocalArg: uint32(lsSrv6SID.SIDStructure.LocalArg),
+ }
+
node.LsSrv6Sids = append(node.LsSrv6Sids, srv6SID)
}
From 8355759e574d8d040ee45d8f6ee167362d480219 Mon Sep 17 00:00:00 2001
From: k1yoto
Date: Sun, 22 Jun 2025 08:59:29 +0000
Subject: [PATCH 36/87] feat(srv6): enhance SRv6 Segment creation and node
support
---
internal/pkg/table/sr_policy.go | 59 +++++++++++++++++++++++++++++++++
internal/pkg/table/ted.go | 19 +++++++++--
2 files changed, 75 insertions(+), 3 deletions(-)
diff --git a/internal/pkg/table/sr_policy.go b/internal/pkg/table/sr_policy.go
index 6c834e45..0fa0db7c 100644
--- a/internal/pkg/table/sr_policy.go
+++ b/internal/pkg/table/sr_policy.go
@@ -114,6 +114,28 @@ const (
BehaviorUA uint16 = 0x0039
)
+func BehaviorToString(behavior uint16) string {
+ switch behavior {
+ case BehaviorReserved:
+ return "RESERVED"
+ case BehaviorEND:
+ return "END"
+ case BehaviorENDX:
+ return "ENDX"
+ case BehaviorUN:
+ return "UN"
+ case BehaviorUA:
+ return "UA"
+ default:
+ return "UNKNOWN"
+ }
+}
+
+const (
+ FirstSRv6SIDIndex = 0 // Index for first SRv6 SID in array
+ FirstSIDIndex = 0 // Index for first SID in Sids array
+)
+
type SegmentSRv6 struct {
Sid netip.Addr
LocalAddr netip.Addr
@@ -148,6 +170,43 @@ func NewSegmentSRv6(sid netip.Addr) SegmentSRv6 {
}
}
+func NewSegmentSRv6WithNodeInfo(sid netip.Addr, n *LsNode) (SegmentSRv6, error) {
+ seg := SegmentSRv6{
+ Sid: sid,
+ }
+
+ if len(n.SRv6SIDs) == 0 || len(n.SRv6SIDs[FirstSRv6SIDIndex].Sids) == 0 {
+ return seg, errors.New("no SRv6 SIDs available")
+ }
+
+ addr, err := netip.ParseAddr(n.SRv6SIDs[FirstSRv6SIDIndex].Sids[FirstSIDIndex])
+ if err != nil {
+ return seg, err
+ }
+ seg.LocalAddr = addr
+
+ for _, srv6SID := range n.SRv6SIDs {
+ if len(srv6SID.Sids) > 0 {
+ seg.Structure = []uint8{
+ srv6SID.SIDStructure.LocalBlock,
+ srv6SID.SIDStructure.LocalNode,
+ srv6SID.SIDStructure.LocalFunc,
+ srv6SID.SIDStructure.LocalArg,
+ }
+
+ switch srv6SID.EndpointBehavior.Behavior {
+ case BehaviorUN, BehaviorUA:
+ seg.USid = true
+ default:
+ seg.USid = false
+ }
+ break
+ }
+ }
+
+ return seg, nil
+}
+
type SegmentSRMPLS struct {
Sid uint32
}
diff --git a/internal/pkg/table/ted.go b/internal/pkg/table/ted.go
index 7be62763..4f5fd9ee 100644
--- a/internal/pkg/table/ted.go
+++ b/internal/pkg/table/ted.go
@@ -49,7 +49,7 @@ func (ted *LsTED) Print() {
}
fmt.Printf(" Adj-SID: %d\n", link.AdjSid)
fmt.Printf(" SRv6 End.X SID:\n")
- fmt.Printf(" EndpointBehavior: %x\n", link.Srv6EndXSID.EndpointBehavior)
+ fmt.Printf(" EndpointBehavior: %s\n", BehaviorToString(link.Srv6EndXSID.EndpointBehavior))
fmt.Printf(" SIDs: %v\n", link.Srv6EndXSID.Sids)
fmt.Printf(" SID Structure: Block: %d, Node: %d, Func: %d, Arg: %d\n",
link.Srv6EndXSID.Srv6SIDStructure.LocalBlock,
@@ -62,7 +62,7 @@ func (ted *LsTED) Print() {
fmt.Printf(" SIDs: %v\n", srv6SID.Sids)
fmt.Printf(" Block: %d, Node: %d, Func: %d, Arg: %d\n", srv6SID.SIDStructure.LocalBlock,
srv6SID.SIDStructure.LocalNode, srv6SID.SIDStructure.LocalFunc, srv6SID.SIDStructure.LocalArg)
- fmt.Printf(" EndpointBehavior: %x, Flags: %d, Algorithm: %d\n", srv6SID.EndpointBehavior.Behavior,
+ fmt.Printf(" EndpointBehavior: %s, Flags: %d, Algorithm: %d\n", BehaviorToString(srv6SID.EndpointBehavior.Behavior),
srv6SID.EndpointBehavior.Flags, srv6SID.EndpointBehavior.Algorithm)
fmt.Printf(" MultiTopoIDs: %v\n", srv6SID.MultiTopoIDs)
}
@@ -108,7 +108,20 @@ func (n *LsNode) NodeSegment() (Segment, error) {
return seg, nil
}
}
- // TODO: for SRv6 Segment
+ // for SRv6 Segment
+ for _, srv6SID := range n.SRv6SIDs {
+ if len(srv6SID.Sids) > 0 {
+ addr, err := netip.ParseAddr(srv6SID.Sids[FirstSIDIndex])
+ if err != nil {
+ return nil, err
+ }
+ seg, err := NewSegmentSRv6WithNodeInfo(addr, n)
+ if err != nil {
+ return nil, err
+ }
+ return seg, nil
+ }
+ }
return nil, errors.New("node doesn't have a Node SID")
}
From 86ef7f80cbe52e57b81fda3a992276b98a3d74d6 Mon Sep 17 00:00:00 2001
From: k1yoto
Date: Sun, 22 Jun 2025 09:00:48 +0000
Subject: [PATCH 37/87] feat(cspf): implement dynamic path computation from TED
---
pkg/server/server.go | 2 +-
pkg/server/session.go | 153 +++++++++++++++++++++++++++++++++++++++++-
2 files changed, 153 insertions(+), 2 deletions(-)
diff --git a/pkg/server/server.go b/pkg/server/server.go
index 49a71d01..4d803fe9 100644
--- a/pkg/server/server.go
+++ b/pkg/server/server.go
@@ -118,7 +118,7 @@ func (s *Server) Serve(address string, port string, usidMode bool) error {
if err != nil {
return fmt.Errorf("failed to parse remote address %s: %w", tcpConn.RemoteAddr().String(), err)
}
- ss := NewSession(sessionID, peerAddrPort.Addr(), tcpConn, s.logger)
+ ss := NewSession(sessionID, peerAddrPort.Addr(), tcpConn, s.logger, s.ted)
ss.logger.Info("start PCEP session")
s.sessionList = append(s.sessionList, ss)
diff --git a/pkg/server/session.go b/pkg/server/session.go
index 74d5c6de..034b6e29 100644
--- a/pkg/server/session.go
+++ b/pkg/server/session.go
@@ -6,11 +6,13 @@
package server
import (
+ "errors"
"fmt"
"net"
"net/netip"
"time"
+ "github.com/nttcom/pola/internal/pkg/cspf"
"github.com/nttcom/pola/internal/pkg/table"
"github.com/nttcom/pola/pkg/packet/pcep"
@@ -28,9 +30,10 @@ type Session struct {
keepAlive uint8
pccType pcep.PccType
pccCapabilities []pcep.CapabilityInterface
+ ted *table.LsTED
}
-func NewSession(sessionID uint8, peerAddr netip.Addr, tcpConn *net.TCPConn, logger *zap.Logger) *Session {
+func NewSession(sessionID uint8, peerAddr netip.Addr, tcpConn *net.TCPConn, logger *zap.Logger, ted *table.LsTED) *Session {
return &Session{
sessionID: sessionID,
isSynced: false,
@@ -39,6 +42,7 @@ func NewSession(sessionID uint8, peerAddr netip.Addr, tcpConn *net.TCPConn, logg
pccType: pcep.RFCCompliant,
peerAddr: peerAddr,
tcpConn: tcpConn,
+ ted: ted,
}
}
@@ -273,7 +277,21 @@ func (ss *Session) handlePCRpt(length uint16) error {
} else {
ss.RegisterSRPolicy(*sr)
}
+ // receive SR Policy with PLSP-ID
+ case sr.LSPObject.PlspID != 0:
+ ss.logger.Debug("Received SR Policy", zap.Uint32("plspID", sr.LSPObject.PlspID))
+ computedSegmentList, err := ss.computePathFromTED(*sr)
+ if err != nil {
+ ss.logger.Error("Failed to compute path from TED", zap.Error(err))
+ return err
+ }
+ sr.EroObject = createEroFromSegmentList(computedSegmentList)
+
+ ss.RegisterSRPolicy(*sr)
+ if policy, found := ss.SearchSRPolicy(sr.LSPObject.PlspID); found {
+ ss.SendPCUpdate(*policy)
+ }
default:
if sr.LSPObject.RFlag {
ss.DeleteSRPolicy(*sr)
@@ -286,6 +304,139 @@ func (ss *Session) handlePCRpt(length uint16) error {
return nil
}
+func (ss *Session) computePathFromTED(sr pcep.StateReport) ([]table.Segment, error) {
+ if ss.ted == nil {
+ return nil, errors.New("TED not available")
+ }
+
+ srcRouterID, dstRouterID, err := ss.extractSrcDstRouterIDs(sr)
+ if err != nil {
+ return nil, fmt.Errorf("failed to extract router IDs: %w", err)
+ }
+
+ asn, err := ss.extractASN(srcRouterID)
+ if err != nil {
+ ss.logger.Error("Could not determine ASN", zap.Error(err))
+ }
+
+ metricType := ss.selectMetricType(sr)
+
+ ss.logger.Debug("Computed CSPF parameters",
+ zap.String("srcRouterID", srcRouterID),
+ zap.String("dstRouterID", dstRouterID),
+ zap.Uint32("asn", asn),
+ zap.String("metricType", metricType.String()))
+
+ segmentList, err := cspf.Cspf(srcRouterID, dstRouterID, asn, metricType, ss.ted)
+ if err != nil {
+ return nil, fmt.Errorf("CSPF computation failed: %w", err)
+ }
+
+ return segmentList, nil
+}
+
+func (ss *Session) extractSrcDstRouterIDs(sr pcep.StateReport) (string, string, error) {
+ var srcAddr, dstAddr netip.Addr
+
+ if sr.LSPObject.SrcAddr.IsValid() {
+ srcAddr = sr.LSPObject.SrcAddr
+ }
+ if sr.LSPObject.DstAddr.IsValid() {
+ dstAddr = sr.LSPObject.DstAddr
+ }
+
+ if !srcAddr.IsValid() || !dstAddr.IsValid() {
+ return "", "", errors.New("could not extract valid source and destination addresses")
+ }
+
+ srcRouterID, err := ss.findRouterIDFromAddress(srcAddr)
+ if err != nil {
+ return "", "", fmt.Errorf("cannot find source router ID for %s: %w", srcAddr, err)
+ }
+
+ dstRouterID, err := ss.findRouterIDFromAddress(dstAddr)
+ if err != nil {
+ return "", "", fmt.Errorf("cannot find destination router ID for %s: %w", dstAddr, err)
+ }
+
+ return srcRouterID, dstRouterID, nil
+}
+
+func (ss *Session) findRouterIDFromAddress(addr netip.Addr) (string, error) {
+ for _, nodes := range ss.ted.Nodes {
+ for routerID, node := range nodes {
+ for _, prefix := range node.Prefixes {
+ if prefix.Prefix.Contains(addr) {
+ return routerID, nil
+ }
+ }
+ if node.RouterID == addr.String() {
+ return routerID, nil
+ }
+ }
+ }
+ return "", fmt.Errorf("address %s not found in TED", addr)
+}
+
+func (ss *Session) extractASN(srcRouterID string) (uint32, error) {
+ for asn, nodes := range ss.ted.Nodes {
+ if _, exists := nodes[srcRouterID]; exists {
+ return asn, nil
+ }
+ }
+ return 0, fmt.Errorf("ASN not found for router %s", srcRouterID)
+}
+
+func (ss *Session) selectMetricType(sr pcep.StateReport) table.MetricType {
+ if len(sr.MetricObjects) > 0 {
+ switch sr.MetricObjects[0].MetricType {
+ case 1:
+ return table.IGPMetric
+ case 2:
+ return table.TEMetric
+ case 3:
+ return table.DelayMetric
+ case 4:
+ return table.HopcountMetric
+ default:
+ return table.TEMetric
+ }
+ }
+
+ switch ss.pccType {
+ case pcep.CiscoLegacy:
+ return table.TEMetric
+ case pcep.JuniperLegacy:
+ return table.IGPMetric
+ default:
+ return table.TEMetric
+ }
+}
+
+func createEroFromSegmentList(segmentList []table.Segment) *pcep.EroObject {
+ eroObject := &pcep.EroObject{
+ ObjectType: pcep.ObjectTypeEROExplicitRoute,
+ EroSubobjects: make([]pcep.EroSubobject, 0),
+ }
+
+ for _, segment := range segmentList {
+ switch seg := segment.(type) {
+ case table.SegmentSRMPLS:
+ subobj, err := pcep.NewSREroSubObject(seg)
+ if err == nil {
+ eroObject.EroSubobjects = append(eroObject.EroSubobjects, subobj)
+ }
+ case table.SegmentSRv6:
+ subobj, err := pcep.NewSRv6EroSubObject(seg)
+ if err == nil {
+ eroObject.EroSubobjects = append(eroObject.EroSubobjects, subobj)
+ }
+ }
+ }
+
+ return eroObject
+}
+
func (ss *Session) RequestAllSRPolicyDeleted() error {
var srPolicy table.SRPolicy
return ss.SendPCInitiate(srPolicy, true)
From 8717757b9ae9d0a0497f146861a94e95787d5a53 Mon Sep 17 00:00:00 2001
From: k1yoto
Date: Sun, 22 Jun 2025 09:04:06 +0000
Subject: [PATCH 38/87] chore(srPolicy): improve input validation and error
handling
---
pkg/packet/pcep/object.go | 1 +
pkg/server/grpc_server.go | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/pkg/packet/pcep/object.go b/pkg/packet/pcep/object.go
index 9174dc85..e4b029d5 100644
--- a/pkg/packet/pcep/object.go
+++ b/pkg/packet/pcep/object.go
@@ -598,6 +598,7 @@ func NewSrpObject(segs []table.Segment, srpID uint32, isRemove bool) (*SrpObject
}
if _, ok := segs[0].(table.SegmentSRMPLS); ok {
o.TLVs = append(o.TLVs, &PathSetupType{PathSetupType: PathSetupTypeSRTE})
+ } else if _, ok := segs[0].(table.SegmentSRv6); ok {
o.TLVs = append(o.TLVs, &PathSetupType{PathSetupType: PathSetupTypeSRv6TE})
} else {
return nil, errors.New("invalid Segment type")
diff --git a/pkg/server/grpc_server.go b/pkg/server/grpc_server.go
index 00279ec8..393cfdcc 100644
--- a/pkg/server/grpc_server.go
+++ b/pkg/server/grpc_server.go
@@ -209,6 +209,12 @@ func (s *APIServer) DeleteSRPolicy(ctx context.Context, input *pb.DeleteSRPolicy
}
func validate(inputSRPolicy *pb.SRPolicy, asn uint32, validationKind ValidationKind) error {
+ if inputSRPolicy == nil {
+ return errors.New("validate error, input is nil")
+ }
+ if asn == 0 {
+ return errors.New("validate error, ASN is nil")
+ }
if !validator[validationKind](inputSRPolicy, asn) {
return errors.New("validate error, invalid input")
}
From d7ce7c3a29d0909d6b7d8e86454df160449da597 Mon Sep 17 00:00:00 2001
From: Wataru Mishima
Date: Mon, 25 Aug 2025 18:23:47 +0900
Subject: [PATCH 39/87] feat(gobgp): migrate GoBGP gRPC API support from v3 to
v4
Co-authored-by: Takenaka Motoki <84055826+Motok1@users.noreply.github.com>
---
go.mod | 4 +-
go.sum | 4 +-
internal/pkg/gobgp/interface.go | 366 +++++++++++++++-----------------
3 files changed, 178 insertions(+), 196 deletions(-)
diff --git a/go.mod b/go.mod
index 4f009320..9d46a676 100644
--- a/go.mod
+++ b/go.mod
@@ -1,9 +1,9 @@
module github.com/nttcom/pola
-go 1.24.2
+go 1.24.5
require (
- github.com/osrg/gobgp/v3 v3.37.0
+ github.com/osrg/gobgp/v4 v4.0.0-20251020140220-f6bf251a9a7f
github.com/spf13/cobra v1.10.1
github.com/stretchr/testify v1.11.1
go.uber.org/zap v1.27.0
diff --git a/go.sum b/go.sum
index d32a8a74..ca5e8e4d 100644
--- a/go.sum
+++ b/go.sum
@@ -13,8 +13,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
-github.com/osrg/gobgp/v3 v3.37.0 h1:+ObuOdvj7G7nxrT0fKFta+EAupdWf/q1WzbXydr8IOY=
-github.com/osrg/gobgp/v3 v3.37.0/go.mod h1:kVHVFy1/fyZHJ8P32+ctvPeJogn9qKwa1YCeMRXXrP0=
+github.com/osrg/gobgp/v4 v4.0.0-20251020140220-f6bf251a9a7f h1:tDfeX3Q8obMQrArGzU9K/LDzht1LGhk/OeoDxWJVxAs=
+github.com/osrg/gobgp/v4 v4.0.0-20251020140220-f6bf251a9a7f/go.mod h1:1a0YiXMuyRPqcCX+fkXZ2UUtcOnUxAWynFunUOSZepk=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
diff --git a/internal/pkg/gobgp/interface.go b/internal/pkg/gobgp/interface.go
index c89743df..e037b768 100644
--- a/internal/pkg/gobgp/interface.go
+++ b/internal/pkg/gobgp/interface.go
@@ -16,10 +16,9 @@ import (
"strings"
"github.com/nttcom/pola/internal/pkg/table"
- api "github.com/osrg/gobgp/v3/api"
+ api "github.com/osrg/gobgp/v4/api"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
- "google.golang.org/protobuf/types/known/anypb"
)
func GetBGPlsNLRIs(serverAddr string, serverPort string) ([]table.TEDElem, error) {
@@ -40,18 +39,18 @@ func GetBGPlsNLRIs(serverAddr string, serverPort string) ([]table.TEDElem, error
}()
// Create gRPC client
- client := api.NewGobgpApiClient(cc)
+ client := api.NewGoBgpServiceClient(cc)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
req := &api.ListPathRequest{
- TableType: api.TableType_GLOBAL,
+ TableType: api.TableType_TABLE_TYPE_GLOBAL,
Family: &api.Family{
Afi: api.Family_AFI_LS,
Safi: api.Family_SAFI_LS,
},
Name: "",
- SortType: api.ListPathRequest_PREFIX,
+ SortType: api.ListPathRequest_SORT_TYPE_PREFIX,
}
stream, err := client.ListPath(ctx, req)
@@ -86,48 +85,96 @@ func ConvertToTEDElem(dst *api.Destination) ([]table.TEDElem, error) {
}
path := dst.GetPaths()[0]
- nlri, err := path.GetNlri().UnmarshalNew()
- if err != nil {
- return nil, fmt.Errorf("failed to unmarshal NLRI: %w", err)
+ nlri := path.GetNlri()
+ if nlri == nil {
+ return nil, errors.New("NLRI is nil")
}
-
- switch nlri := nlri.(type) {
- case *api.LsAddrPrefix:
- linkStateNLRI, err := nlri.GetNlri().UnmarshalNew()
+ lsAddrPrefix := nlri.GetLsAddrPrefix()
+ if lsAddrPrefix == nil {
+ return nil, errors.New("LSAddrPrefix is nil")
+ }
+ // Get BGP-LS Attribute
+ var lsAttr *api.Attribute_Ls
+ var ok bool
+ for _, pathAttr := range path.GetPattrs() {
+ if lsAttr, ok = pathAttr.Attr.(*api.Attribute_Ls); ok {
+ // Found BGP-LS Attribute
+ break
+ }
+ }
+ if lsAttr == nil {
+ return nil, errors.New("BGP-LS Attribute is nil")
+ }
+ switch lsAddrPrefix.GetType() {
+ case api.LsNLRIType_LS_NLRI_TYPE_NODE:
+ lsAttrNode := lsAttr.Ls.GetNode()
+ if lsAttrNode == nil {
+ return nil, fmt.Errorf("LS Node Attribute is nil")
+ }
+ lsNode, err := getLsNode(lsAddrPrefix, lsAttrNode)
if err != nil {
- return nil, fmt.Errorf("failed to unmarshal LS Address Prefix: %w", err)
+ return nil, fmt.Errorf("failed to process LS Node NLRI: %w", err)
}
+ return []table.TEDElem{lsNode}, nil
- switch linkStateNLRI := linkStateNLRI.(type) {
- case *api.LsNodeNLRI:
- lsNode, err := getLsNodeNLRI(linkStateNLRI, path.GetPattrs())
- if err != nil {
- return nil, fmt.Errorf("failed to process LS Node NLRI: %w", err)
- }
- return []table.TEDElem{lsNode}, nil
- case *api.LsLinkNLRI:
- lsLink, err := getLsLinkNLRI(linkStateNLRI, path.GetPattrs())
- if err != nil {
- return nil, fmt.Errorf("failed to process LS Link NLRI: %w", err)
- }
- return []table.TEDElem{lsLink}, nil
- case *api.LsPrefixV4NLRI, *api.LsPrefixV6NLRI:
- lsPrefixList, err := getLsPrefixList(path.GetPattrs())
- if err != nil {
- return nil, fmt.Errorf("failed to process LS Prefix V4 NLRI: %w", err)
+ case api.LsNLRIType_LS_NLRI_TYPE_LINK:
+ lsAttrLink := lsAttr.Ls.GetLink()
+ if lsAttrLink == nil {
+ return nil, fmt.Errorf("LS Link Attribute is nil")
+ }
+ lsLink, err := getLsLink(lsAddrPrefix, lsAttrLink)
+ if err != nil {
+ return nil, fmt.Errorf("failed to process LS Link NLRI: %w", err)
+ }
+ return []table.TEDElem{lsLink}, nil
+ case api.LsNLRIType_LS_NLRI_TYPE_PREFIX_V4, api.LsNLRIType_LS_NLRI_TYPE_PREFIX_V6:
+ lsAttrPrefix := lsAttr.Ls.GetPrefix()
+ if lsAttrPrefix == nil {
+ return nil, fmt.Errorf("LS Prefix Attribute is nil")
+ }
+ // Link-State Prefix NLRI may contain one or more entries within the MP-REACH NLRI.
+ // Since path.GetNLRI() only includes one of them, you need to retrieve all of them from path.GetPattrs().
+ var mpReachAttr *api.MpReachNLRIAttribute
+ for _, pathAttr := range path.GetPattrs() {
+ mpReachAttr = pathAttr.GetMpReach()
+ if mpReachAttr != nil {
+ // Found MP-REACH NLRI Attribute
+ break
}
- return lsPrefixList, nil
- case *api.LsSrv6SIDNLRI:
- lsSrv6SIDList, err := getLsSrv6SIDNLRIList(path.GetPattrs())
- if err != nil {
- return nil, fmt.Errorf("failed to process LS SRv6 SID NLRI: %w", err)
+ }
+ if mpReachAttr == nil {
+ return nil, errors.New("MP-REACH NLRI Attribute is nil")
+ }
+ lsPrefixList, err := getLsPrefixList(mpReachAttr.GetNlris(), lsAttrPrefix)
+ if err != nil {
+ return nil, fmt.Errorf("failed to process LS Prefix V4 NLRI: %w", err)
+ }
+ return lsPrefixList, nil
+ case api.LsNLRIType_LS_NLRI_TYPE_SRV6_SID:
+ lsAttrSrv6SID := lsAttr.Ls.GetSrv6Sid()
+ if lsAttrSrv6SID == nil {
+ return nil, fmt.Errorf("LS SRv6 SID Attribute is nil")
+ }
+ // Link-State Prefix NLRI may contain one or more entries within the MP-REACH NLRI.
+ // Since path.GetNLRI() only includes one of them, you need to retrieve the others from path.GetPattrs() instead of using path.GetNLRI().
+ var mpReachAttr *api.MpReachNLRIAttribute
+ for _, pathAttr := range path.GetPattrs() {
+ mpReachAttr = pathAttr.GetMpReach()
+ if mpReachAttr != nil {
+ break
}
- return lsSrv6SIDList, nil
- default:
- return nil, fmt.Errorf("invalid LS Link State NLRI type: %T", linkStateNLRI)
}
+ if mpReachAttr == nil {
+ return nil, errors.New("MP-REACH NLRI Attribute is nil")
+ }
+ lsSrv6SIDList, err := getLsSrv6SIDList(mpReachAttr.GetNlris(), lsAttrSrv6SID)
+ if err != nil {
+ return nil, fmt.Errorf("failed to process LS SRv6 SID NLRI: %w", err)
+ }
+ return lsSrv6SIDList, nil
+
default:
- return nil, fmt.Errorf("invalid NLRI type: %T", nlri)
+ return nil, fmt.Errorf("invalid LS Link State NLRI type: %s", lsAddrPrefix.GetType().String())
}
}
@@ -144,172 +191,131 @@ func formatIsisAreaID(isisArea []byte) string {
return strIsisArea.String()
}
-func getLsNodeNLRI(typedLinkStateNLRI *api.LsNodeNLRI, pathAttrs []*anypb.Any) (*table.LsNode, error) {
- asn := typedLinkStateNLRI.GetLocalNode().GetAsn()
- routerID := typedLinkStateNLRI.GetLocalNode().GetIgpRouterId()
+func getLsNode(typedLinkStateNLRI *api.LsAddrPrefix, lsAttrNode *api.LsAttributeNode) (*table.LsNode, error) {
+ lsNodeNLRI := typedLinkStateNLRI.Nlri.GetNode()
+ asn := lsNodeNLRI.GetLocalNode().GetAsn()
+ routerID := lsNodeNLRI.GetLocalNode().GetIgpRouterId()
lsNode := table.NewLsNode(asn, routerID)
- for _, pathAttr := range pathAttrs {
- typedPathAttr, err := pathAttr.UnmarshalNew()
- if err != nil {
- return nil, fmt.Errorf("failed to unmarshal path attribute: %w", err)
- }
-
- bgplsAttr, ok := typedPathAttr.(*api.LsAttribute)
- if !ok {
- continue
- }
-
- isisArea := bgplsAttr.GetNode().GetIsisArea()
- lsNode.IsisAreaID = formatIsisAreaID(isisArea)
- lsNode.Hostname = bgplsAttr.GetNode().GetName()
- if bgplsAttr.GetNode().GetSrCapabilities() != nil {
- srCapabilities := bgplsAttr.GetNode().GetSrCapabilities().GetRanges()
- if len(srCapabilities) != 1 {
- return nil, fmt.Errorf("expected 1 SR Capability TLV, got: %d", len(srCapabilities))
- } else {
- lsNode.SrgbBegin = srCapabilities[0].GetBegin()
- lsNode.SrgbEnd = srCapabilities[0].GetEnd()
- }
+ isisArea := lsAttrNode.GetIsisArea()
+ lsNode.IsisAreaID = formatIsisAreaID(isisArea)
+ lsNode.Hostname = lsAttrNode.GetName()
+ if lsAttrNode.GetSrCapabilities() != nil {
+ srCapabilities := lsAttrNode.GetSrCapabilities().GetRanges()
+ if len(srCapabilities) != 1 {
+ return nil, fmt.Errorf("expected 1 SR Capability TLV, got: %d", len(srCapabilities))
+ } else {
+ lsNode.SrgbBegin = srCapabilities[0].GetBegin()
+ lsNode.SrgbEnd = srCapabilities[0].GetEnd()
}
}
-
return lsNode, nil
}
-func getLsLinkNLRI(typedLinkStateNLRI *api.LsLinkNLRI, pathAttrs []*anypb.Any) (*table.LsLink, error) {
- localNode := table.NewLsNode(typedLinkStateNLRI.GetLocalNode().GetAsn(), typedLinkStateNLRI.GetLocalNode().GetIgpRouterId())
- remoteNode := table.NewLsNode(typedLinkStateNLRI.GetRemoteNode().GetAsn(), typedLinkStateNLRI.GetRemoteNode().GetIgpRouterId())
+func getLsLink(typedLinkStateNLRI *api.LsAddrPrefix, lsAttrLink *api.LsAttributeLink) (*table.LsLink, error) {
+ lsLinkNLRI := typedLinkStateNLRI.Nlri.GetLink()
+ localNode := table.NewLsNode(lsLinkNLRI.GetLocalNode().GetAsn(), lsLinkNLRI.GetLocalNode().GetIgpRouterId())
+ remoteNode := table.NewLsNode(lsLinkNLRI.GetRemoteNode().GetAsn(), lsLinkNLRI.GetRemoteNode().GetIgpRouterId())
var err error
var localIP netip.Addr
- if typedLinkStateNLRI.GetLinkDescriptor().GetInterfaceAddrIpv4() != "" {
- localIP, err = netip.ParseAddr(typedLinkStateNLRI.GetLinkDescriptor().GetInterfaceAddrIpv4())
+ if lsLinkNLRI.GetLinkDescriptor().GetInterfaceAddrIpv4() != "" {
+ localIP, err = netip.ParseAddr(lsLinkNLRI.GetLinkDescriptor().GetInterfaceAddrIpv4())
if err != nil {
return nil, fmt.Errorf("failed to parse local IPv4 address: %v", err)
}
- } else {
- localIP, err = netip.ParseAddr(typedLinkStateNLRI.GetLinkDescriptor().GetInterfaceAddrIpv6())
+ } else if lsLinkNLRI.GetLinkDescriptor().GetInterfaceAddrIpv6() != "" {
+ localIP, err = netip.ParseAddr(lsLinkNLRI.GetLinkDescriptor().GetInterfaceAddrIpv6())
if err != nil {
return nil, fmt.Errorf("failed to parse local IPv6 address: %v", err)
}
+ } else {
+ localIP = netip.Addr{}
}
var remoteIP netip.Addr
- if typedLinkStateNLRI.GetLinkDescriptor().GetNeighborAddrIpv4() != "" {
- remoteIP, err = netip.ParseAddr(typedLinkStateNLRI.GetLinkDescriptor().GetNeighborAddrIpv4())
+ if lsLinkNLRI.GetLinkDescriptor().GetNeighborAddrIpv4() != "" {
+ remoteIP, err = netip.ParseAddr(lsLinkNLRI.GetLinkDescriptor().GetNeighborAddrIpv4())
if err != nil {
return nil, fmt.Errorf("failed to parse remote IPv4 address: %v", err)
}
- } else {
- remoteIP, err = netip.ParseAddr(typedLinkStateNLRI.GetLinkDescriptor().GetNeighborAddrIpv6())
+ } else if lsLinkNLRI.GetLinkDescriptor().GetNeighborAddrIpv6() != "" {
+ remoteIP, err = netip.ParseAddr(lsLinkNLRI.GetLinkDescriptor().GetNeighborAddrIpv6())
if err != nil {
return nil, fmt.Errorf("failed to parse remote IPv6 address: %v", err)
}
+ } else {
+ remoteIP = netip.Addr{}
}
lsLink := table.NewLsLink(localNode, remoteNode)
lsLink.LocalIP = localIP
lsLink.RemoteIP = remoteIP
- for _, pathAttr := range pathAttrs {
- typedPathAttr, err := pathAttr.UnmarshalNew()
- if err != nil {
- return nil, fmt.Errorf("failed to unmarshal path attribute %v: %v", pathAttr, err)
- }
-
- bgplsAttr, ok := typedPathAttr.(*api.LsAttribute)
- if !ok {
- continue
- }
+ lsLink.Metrics = append(lsLink.Metrics, table.NewMetric(table.MetricType(table.IGPMetric), lsAttrLink.GetIgpMetric()))
- lsLink.Metrics = append(lsLink.Metrics, table.NewMetric(table.MetricType(table.IGPMetric), bgplsAttr.GetLink().GetIgpMetric()))
-
- teMetric := bgplsAttr.GetLink().GetDefaultTeMetric()
- if teMetric != 0 {
- lsLink.Metrics = append(lsLink.Metrics, table.NewMetric(table.MetricType(table.TEMetric), teMetric))
- }
+ teMetric := lsAttrLink.GetDefaultTeMetric()
+ if teMetric != 0 {
+ lsLink.Metrics = append(lsLink.Metrics, table.NewMetric(table.MetricType(table.TEMetric), teMetric))
+ }
- lsLink.AdjSid = bgplsAttr.GetLink().GetSrAdjacencySid()
-
- // handle SRv6 SID TLV
- var srv6EndXSID *api.LsSrv6EndXSID
- srv6EndXSID = bgplsAttr.GetLink().GetSrv6EndXSid()
- if srv6EndXSID != nil {
- lsLink.Srv6EndXSID = &table.Srv6EndXSID{
- EndpointBehavior: uint16(srv6EndXSID.EndpointBehavior),
- Sids: srv6EndXSID.Sids,
- Srv6SIDStructure: table.SIDStructure{
- LocalBlock: uint8(srv6EndXSID.Srv6SidStructure.GetLocalBlock()),
- LocalNode: uint8(srv6EndXSID.Srv6SidStructure.GetLocalNode()),
- LocalFunc: uint8(srv6EndXSID.Srv6SidStructure.GetLocalFunc()),
- LocalArg: uint8(srv6EndXSID.Srv6SidStructure.GetLocalArg()),
- },
- }
+ lsLink.AdjSid = lsAttrLink.GetSrAdjacencySid()
+
+ // handle SRv6 SID TLV
+ srv6EndXSID := lsAttrLink.GetSrv6EndXSid()
+ if srv6EndXSID != nil {
+ lsLink.Srv6EndXSID = &table.Srv6EndXSID{
+ EndpointBehavior: uint16(srv6EndXSID.EndpointBehavior),
+ Sids: srv6EndXSID.Sids,
+ Srv6SIDStructure: table.SIDStructure{
+ LocalBlock: uint8(srv6EndXSID.Srv6SidStructure.GetLocalBlock()),
+ LocalNode: uint8(srv6EndXSID.Srv6SidStructure.GetLocalNode()),
+ LocalFunc: uint8(srv6EndXSID.Srv6SidStructure.GetLocalFunc()),
+ LocalArg: uint8(srv6EndXSID.Srv6SidStructure.GetLocalArg()),
+ },
}
}
return lsLink, nil
}
-func getLsPrefixList(pathAttrs []*anypb.Any) ([]table.TEDElem, error) {
+func getLsPrefixList(nlris []*api.NLRI, lsAttrPrefix *api.LsAttributePrefix) ([]table.TEDElem, error) {
var lsPrefixList []table.TEDElem
- var sidIndex uint32
- for _, pathAttr := range pathAttrs {
- typedPathAttr, err := pathAttr.UnmarshalNew()
- if err != nil {
- return nil, fmt.Errorf("failed to unmarshal path attribute: %v", err)
- }
+ for _, nlri := range nlris {
+ lsAddrPrefix := nlri.GetLsAddrPrefix()
- switch typedPathAttr := typedPathAttr.(type) {
- case *api.LsAttribute:
- if typedPathAttr.GetPrefix().GetSrPrefixSid() != 0 {
- sidIndex = typedPathAttr.GetPrefix().GetSrPrefixSid()
- } else {
- sidIndex = 0
- }
- case *api.MpReachNLRIAttribute:
- for _, nlri := range typedPathAttr.GetNlris() {
- typedNlri, err := nlri.UnmarshalNew()
- if err != nil {
- return nil, fmt.Errorf("failed to unmarshal NLRI: %v", err)
- }
-
- if lsNlri, ok := typedNlri.(*api.LsAddrPrefix); ok {
- lsPrefix, err := getLsPrefix(lsNlri, sidIndex)
- if err != nil {
- return nil, fmt.Errorf("failed to get LS Prefix: %v", err)
- }
- lsPrefixList = append(lsPrefixList, lsPrefix)
- }
- }
+ lsPrefix, err := getLsPrefix(lsAddrPrefix, lsAttrPrefix)
+ if err != nil {
+ return nil, fmt.Errorf("failed to get LS Prefix: %v", err)
}
+ lsPrefixList = append(lsPrefixList, lsPrefix)
}
-
return lsPrefixList, nil
}
-func getLsPrefix(lsNlri *api.LsAddrPrefix, sidIndex uint32) (*table.LsPrefix, error) {
- nlri, err := lsNlri.GetNlri().UnmarshalNew()
- if err != nil {
- return nil, fmt.Errorf("failed to unmarshal LS Prefix V4: %v", err)
- }
-
+func getLsPrefix(typedLinkStateNLRI *api.LsAddrPrefix, lsAttrPrefix *api.LsAttributePrefix) (*table.LsPrefix, error) {
var localNodeID string
var localNodeAsn uint32
var prefix []string
+ var sidIndex uint32
+
+ if lsAttrPrefix.GetSrPrefixSid() != 0 {
+ sidIndex = lsAttrPrefix.GetSrPrefixSid()
+ } else {
+ sidIndex = 0
+ }
- switch prefNlri := nlri.(type) {
- case *api.LsPrefixV4NLRI:
- localNodeID = prefNlri.GetLocalNode().GetIgpRouterId()
- localNodeAsn = prefNlri.GetLocalNode().GetAsn()
- prefix = prefNlri.GetPrefixDescriptor().GetIpReachability()
- case *api.LsPrefixV6NLRI:
- localNodeID = prefNlri.GetLocalNode().GetIgpRouterId()
- localNodeAsn = prefNlri.GetLocalNode().GetAsn()
- prefix = prefNlri.GetPrefixDescriptor().GetIpReachability()
+ switch prefNLRI := typedLinkStateNLRI.Nlri.Nlri.(type) {
+ case *api.LsAddrPrefix_LsNLRI_PrefixV4:
+ localNodeID = prefNLRI.PrefixV4.GetLocalNode().GetIgpRouterId()
+ localNodeAsn = prefNLRI.PrefixV4.GetLocalNode().GetAsn()
+ prefix = prefNLRI.PrefixV4.GetPrefixDescriptor().GetIpReachability()
+ case *api.LsAddrPrefix_LsNLRI_PrefixV6:
+ localNodeID = prefNLRI.PrefixV6.GetLocalNode().GetIgpRouterId()
+ localNodeAsn = prefNLRI.PrefixV6.GetLocalNode().GetAsn()
+ prefix = prefNLRI.PrefixV6.GetPrefixDescriptor().GetIpReachability()
default:
return nil, errors.New("invalid LS prefix NLRI type")
}
@@ -322,6 +328,7 @@ func getLsPrefix(lsNlri *api.LsAddrPrefix, sidIndex uint32) (*table.LsPrefix, er
return nil, errors.New("invalid prefix length: expected 1 prefix")
}
+ var err error
lsPrefix.Prefix, err = netip.ParsePrefix(prefix[0])
if err != nil {
return nil, fmt.Errorf("failed to parse prefix: %v", err)
@@ -330,53 +337,28 @@ func getLsPrefix(lsNlri *api.LsAddrPrefix, sidIndex uint32) (*table.LsPrefix, er
return lsPrefix, nil
}
-func getLsSrv6SIDNLRIList(pathAttrs []*anypb.Any) ([]table.TEDElem, error) {
+func getLsSrv6SIDList(nlris []*api.NLRI, lsAttrSrv6SID *api.LsAttributeSrv6SID) ([]table.TEDElem, error) {
var lsSrv6SIDList []table.TEDElem
- var endpointBehavior *api.LsSrv6EndpointBehavior
- var srv6SIDStructure *api.LsSrv6SIDStructure
- for _, pathAttr := range pathAttrs {
- typedPathAttr, err := pathAttr.UnmarshalNew()
- if err != nil {
- return nil, fmt.Errorf("failed to unmarshal path attribute: %w", err)
- }
+ for _, nlri := range nlris {
+ lsAddrPrefix := nlri.GetLsAddrPrefix()
- switch typedPathAttr := typedPathAttr.(type) {
- case *api.LsAttribute:
- // handle LsAttribute for SRv6 SID
- srv6SIDStructure = typedPathAttr.GetSrv6Sid().GetSrv6SidStructure()
- endpointBehavior = typedPathAttr.GetSrv6Sid().GetSrv6EndpointBehavior()
- case *api.MpReachNLRIAttribute:
- for _, nlri := range typedPathAttr.GetNlris() {
- typedNLRI, err := nlri.UnmarshalNew()
- if err != nil {
- return nil, fmt.Errorf("failed to unmarshal NLRI: %w", err)
- }
- if lsNLRI, ok := typedNLRI.(*api.LsAddrPrefix); ok {
- lsSrv6SID, err := getLsSrv6SIDNLRI(lsNLRI, endpointBehavior, srv6SIDStructure)
- if err != nil {
- return nil, fmt.Errorf("failed to process LS SRv6 SID NLRI: %w", err)
- }
- lsSrv6SIDList = append(lsSrv6SIDList, lsSrv6SID)
- } else {
- return nil, fmt.Errorf("unexpected NLRI type: %T", typedNLRI)
- }
- }
+ lsPrefix, err := getLsSrv6SID(lsAddrPrefix, lsAttrSrv6SID)
+ if err != nil {
+ return nil, fmt.Errorf("failed to get LS Prefix: %v", err)
}
+ lsSrv6SIDList = append(lsSrv6SIDList, lsPrefix)
}
+
return lsSrv6SIDList, nil
}
-// getLsSrv6SIDNLRI processes the LS SRv6 SID NLRI and returns a corresponding LsSrv6SID.
-func getLsSrv6SIDNLRI(lsNLRI *api.LsAddrPrefix, endpointBehavior *api.LsSrv6EndpointBehavior, srv6SIDStructure *api.LsSrv6SIDStructure) (*table.LsSrv6SID, error) {
- srv6NLRI, err := lsNLRI.GetNlri().UnmarshalNew()
- if err != nil {
- return nil, fmt.Errorf("failed to unmarshal LS NLRI: %w", err)
- }
- srv6SIDNLRI, ok := srv6NLRI.(*api.LsSrv6SIDNLRI)
- if !ok {
- return nil, fmt.Errorf("invalid LS SRv6 SID NLRI type: %T", srv6NLRI)
- }
+// getLsSrv6SID processes the LS SRv6 SID NLRI and returns a corresponding LsSrv6SID.
+func getLsSrv6SID(typedLinkStateNLRI *api.LsAddrPrefix, lsAttrSrv6SID *api.LsAttributeSrv6SID) (*table.LsSrv6SID, error) {
+
+ srv6SIDStructure := lsAttrSrv6SID.GetSrv6SidStructure()
+ endpointBehavior := lsAttrSrv6SID.GetSrv6EndpointBehavior()
+ srv6SIDNLRI := typedLinkStateNLRI.Nlri.GetSrv6Sid()
localNodeID := srv6SIDNLRI.GetLocalNode().GetIgpRouterId()
localNodeASN := srv6SIDNLRI.GetLocalNode().GetAsn()
From b426df39d1d858255e1ff0d8672caf4580d8c8a9 Mon Sep 17 00:00:00 2001
From: Motok1
Date: Tue, 26 Aug 2025 18:51:17 +0900
Subject: [PATCH 40/87] fix(ted): TED struct and "show ted" command for ipv6
unnumbered
---
cmd/pola/grpc/grpc_client.go | 4 ++--
cmd/pola/ted.go | 17 +++++++++++++++--
internal/pkg/table/ted.go | 14 +++++++++++++-
3 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/cmd/pola/grpc/grpc_client.go b/cmd/pola/grpc/grpc_client.go
index a57afe22..b695c193 100644
--- a/cmd/pola/grpc/grpc_client.go
+++ b/cmd/pola/grpc/grpc_client.go
@@ -209,11 +209,11 @@ func createLsLink(localNode, remoteNode *table.LsNode, link *pb.LsLink) (*table.
AdjSid: link.GetAdjSid(),
}
var err error
- lsLink.LocalIP, err = netip.ParseAddr(link.GetLocalIp())
+ err = lsLink.LocalIP.UnmarshalText([]byte(link.GetLocalIp()))
if err != nil {
return nil, err
}
- lsLink.RemoteIP, err = netip.ParseAddr(link.GetRemoteIp())
+ err = lsLink.RemoteIP.UnmarshalText([]byte(link.GetRemoteIp()))
if err != nil {
return nil, err
}
diff --git a/cmd/pola/ted.go b/cmd/pola/ted.go
index 0d0438fb..8590c465 100644
--- a/cmd/pola/ted.go
+++ b/cmd/pola/ted.go
@@ -63,9 +63,22 @@ func print(jsonFlag bool) error {
metrics = append(metrics, metricMap)
}
+ var localIP string
+ var remoteIP string
+ if link.LocalIP.IsValid() {
+ localIP = link.LocalIP.String()
+ } else {
+ localIP = "None"
+ }
+ if link.RemoteIP.IsValid() {
+ remoteIP = link.RemoteIP.String()
+ } else {
+ remoteIP = "None"
+ }
+
linkMap := map[string]any{
- "localIP": link.LocalIP.String(),
- "remoteIP": link.RemoteIP.String(),
+ "localIP": localIP,
+ "remoteIP": remoteIP,
"remoteNode": link.RemoteNode.RouterID,
"metrics": metrics,
"adjSid": link.AdjSid,
diff --git a/internal/pkg/table/ted.go b/internal/pkg/table/ted.go
index 4f5fd9ee..cac16956 100644
--- a/internal/pkg/table/ted.go
+++ b/internal/pkg/table/ted.go
@@ -41,7 +41,19 @@ func (ted *LsTED) Print() {
}
fmt.Printf(" Links:\n")
for _, link := range node.Links {
- fmt.Printf(" Local: %s Remote: %s\n", link.LocalIP.String(), link.RemoteIP.String())
+ var localIP string
+ var remoteIP string
+ if link.LocalIP.IsValid() {
+ localIP = link.LocalIP.String()
+ } else {
+ localIP = "None"
+ }
+ if link.RemoteIP.IsValid() {
+ remoteIP = link.RemoteIP.String()
+ } else {
+ remoteIP = "None"
+ }
+ fmt.Printf(" Local: %s Remote: %s\n", localIP, remoteIP)
fmt.Printf(" RemoteNode: %s\n", link.RemoteNode.RouterID)
fmt.Printf(" Metrics:\n")
for _, metric := range link.Metrics {
From a738ff5b0770e51b3f39fafaab9e088579a6fc77 Mon Sep 17 00:00:00 2001
From: Motok1
Date: Tue, 26 Aug 2025 18:51:48 +0900
Subject: [PATCH 41/87] fix(grpc): fix create sr policy validator
---
pkg/server/grpc_server.go | 86 +++++++++++++++++++++++++++++----------
1 file changed, 65 insertions(+), 21 deletions(-)
diff --git a/pkg/server/grpc_server.go b/pkg/server/grpc_server.go
index 393cfdcc..d0daf56e 100644
--- a/pkg/server/grpc_server.go
+++ b/pkg/server/grpc_server.go
@@ -215,8 +215,12 @@ func validate(inputSRPolicy *pb.SRPolicy, asn uint32, validationKind ValidationK
if asn == 0 {
return errors.New("validate error, ASN is nil")
}
- if !validator[validationKind](inputSRPolicy, asn) {
- return errors.New("validate error, invalid input")
+ if validateFunc, ok := validator[validationKind]; ok {
+ if err := validateFunc(inputSRPolicy, asn); err != nil {
+ return fmt.Errorf("validate error: %w", err)
+ }
+ } else {
+ return fmt.Errorf("validate error: unknown validation kind %q", validationKind)
}
return nil
@@ -230,25 +234,56 @@ const (
ValidationDelete ValidationKind = "Delete"
)
-var validator = map[ValidationKind]func(policy *pb.SRPolicy, asn uint32) bool{
- ValidationKind("Add"): func(policy *pb.SRPolicy, asn uint32) bool {
- return asn != 0 &&
- policy.PcepSessionAddr != nil &&
- policy.Color != 0 &&
- policy.SrcRouterId != "" &&
- policy.DstRouterId != ""
+var validator = map[ValidationKind]func(policy *pb.SRPolicy, asn uint32) error{
+ ValidationAdd: func(policy *pb.SRPolicy, asn uint32) error {
+ if asn == 0 {
+ return errors.New("ASN must not be zero")
+ }
+ if policy.PcepSessionAddr == nil {
+ return errors.New("PCEP session address must not be nil")
+ }
+ if policy.Color == 0 {
+ return errors.New("Color must not be zero")
+ }
+ if policy.SrcRouterId == "" {
+ return errors.New("SrcRouterId must not be empty")
+ }
+ if policy.DstRouterId == "" {
+ return errors.New("DstRouterId must not be empty")
+ }
+ return nil
},
- ValidationKind("AddDisablePathCompute"): func(policy *pb.SRPolicy, asn uint32) bool {
- return policy.PcepSessionAddr != nil &&
- len(policy.SrcAddr) > 0 &&
- len(policy.DstAddr) > 0 &&
- len(policy.SegmentList) > 0
+
+ ValidationAddDisablePathCompute: func(policy *pb.SRPolicy, asn uint32) error {
+ if policy.PcepSessionAddr == nil {
+ return errors.New("PCEP session address must not be nil")
+ }
+ if len(policy.SrcAddr) == 0 {
+ return errors.New("SrcAddr must not be empty")
+ }
+ if len(policy.DstAddr) == 0 {
+ return errors.New("DstAddr must not be empty")
+ }
+ if len(policy.SegmentList) == 0 {
+ return errors.New("SegmentList must not be empty")
+ }
+ return nil
},
- ValidationKind("Delete"): func(policy *pb.SRPolicy, asn uint32) bool {
- return policy.PcepSessionAddr != nil &&
- policy.Color != 0 &&
- len(policy.DstAddr) > 0 &&
- policy.PolicyName != ""
+
+ ValidationDelete: func(policy *pb.SRPolicy, asn uint32) error {
+ if policy.PcepSessionAddr == nil {
+ return errors.New("PCEP session address must not be nil")
+ }
+ if policy.Color == 0 {
+ return errors.New("Color must not be zero")
+ }
+ if len(policy.DstAddr) == 0 {
+ return errors.New("DstAddr must not be empty")
+ }
+ if policy.PolicyName == "" {
+ return errors.New("PolicyName must not be empty")
+ }
+ return nil
},
}
@@ -400,13 +435,22 @@ func (s *APIServer) GetTED(ctx context.Context, req *pb.GetTEDRequest) (*pb.GetT
}
for _, lsLink := range lsNode.Links {
+ localIp, err := lsLink.LocalIP.MarshalText()
+ if err != nil {
+ return nil, fmt.Errorf("failed to marshal local IP: %v", err)
+ }
+ remoteIp, err := lsLink.RemoteIP.MarshalText()
+ if err != nil {
+ return nil, fmt.Errorf("failed to marshal remote IP: %v", err)
+ }
+
link := &pb.LsLink{
LocalRouterId: lsLink.LocalNode.RouterID,
LocalAsn: lsLink.LocalNode.ASN,
- LocalIp: lsLink.LocalIP.String(),
+ LocalIp: string(localIp),
RemoteRouterId: lsLink.RemoteNode.RouterID,
RemoteAsn: lsLink.RemoteNode.ASN,
- RemoteIp: lsLink.RemoteIP.String(),
+ RemoteIp: string(remoteIp),
Metrics: make([]*pb.Metric, 0, len(lsLink.Metrics)),
AdjSid: lsLink.AdjSid,
}
From 726c482c1d7ded50dedecd052e909ea5c0c9e745 Mon Sep 17 00:00:00 2001
From: Wataru Mishima
Date: Fri, 5 Sep 2025 16:09:38 +0900
Subject: [PATCH 42/87] fix(ted): add nil checks in TED Print
---
internal/pkg/table/ted.go | 122 ++++++++++++++++++++++++++------------
1 file changed, 84 insertions(+), 38 deletions(-)
diff --git a/internal/pkg/table/ted.go b/internal/pkg/table/ted.go
index cac16956..511f001e 100644
--- a/internal/pkg/table/ted.go
+++ b/internal/pkg/table/ted.go
@@ -24,59 +24,105 @@ func (ted *LsTED) Update(tedElems []TEDElem) {
}
func (ted *LsTED) Print() {
+ if ted == nil || ted.Nodes == nil {
+ fmt.Println("TED is empty")
+ return
+ }
+
for _, nodes := range ted.Nodes {
+ if nodes == nil {
+ continue
+ }
nodeCnt := 1
for nodeID, node := range nodes {
+ if node == nil {
+ continue
+ }
fmt.Printf("Node: %d\n", nodeCnt)
fmt.Printf(" %s\n", nodeID)
fmt.Printf(" Hostname: %s\n", node.Hostname)
fmt.Printf(" ISIS Area ID: %s\n", node.IsisAreaID)
fmt.Printf(" SRGB: %d - %d\n", node.SrgbBegin, node.SrgbEnd)
+
fmt.Printf(" Prefixes:\n")
- for _, prefix := range node.Prefixes {
- fmt.Printf(" %s\n", prefix.Prefix.String())
- if prefix.SidIndex != 0 {
- fmt.Printf(" index: %d\n", prefix.SidIndex)
+ if node.Prefixes != nil {
+ for _, prefix := range node.Prefixes {
+ if prefix == nil {
+ continue
+ }
+ fmt.Printf(" %s\n", prefix.Prefix.String())
+ if prefix.SidIndex != 0 {
+ fmt.Printf(" index: %d\n", prefix.SidIndex)
+ }
}
}
+
fmt.Printf(" Links:\n")
- for _, link := range node.Links {
- var localIP string
- var remoteIP string
- if link.LocalIP.IsValid() {
- localIP = link.LocalIP.String()
- } else {
- localIP = "None"
- }
- if link.RemoteIP.IsValid() {
- remoteIP = link.RemoteIP.String()
- } else {
- remoteIP = "None"
- }
- fmt.Printf(" Local: %s Remote: %s\n", localIP, remoteIP)
- fmt.Printf(" RemoteNode: %s\n", link.RemoteNode.RouterID)
- fmt.Printf(" Metrics:\n")
- for _, metric := range link.Metrics {
- fmt.Printf(" %s: %d\n", metric.Type.String(), metric.Value)
+ if node.Links != nil {
+ for _, link := range node.Links {
+ if link == nil {
+ continue
+ }
+
+ localIP := "None"
+ remoteIP := "None"
+ if link.LocalIP.IsValid() {
+ localIP = link.LocalIP.String()
+ }
+ if link.RemoteIP.IsValid() {
+ remoteIP = link.RemoteIP.String()
+ }
+ fmt.Printf(" Local: %s Remote: %s\n", localIP, remoteIP)
+
+ remoteNodeID := "None"
+ if link.RemoteNode != nil {
+ remoteNodeID = link.RemoteNode.RouterID
+ }
+ fmt.Printf(" RemoteNode: %s\n", remoteNodeID)
+
+ fmt.Printf(" Metrics:\n")
+ if link.Metrics != nil {
+ for _, metric := range link.Metrics {
+ if metric == nil {
+ continue
+ }
+ fmt.Printf(" %s: %d\n", metric.Type.String(), metric.Value)
+ }
+ }
+
+ fmt.Printf(" Adj-SID: %d\n", link.AdjSid)
+
+ if link.Srv6EndXSID != nil {
+ fmt.Printf(" SRv6 End.X SID:\n")
+ fmt.Printf(" EndpointBehavior: %s\n", BehaviorToString(link.Srv6EndXSID.EndpointBehavior))
+ fmt.Printf(" SIDs: %v\n", link.Srv6EndXSID.Sids)
+ fmt.Printf(" SID Structure: Block: %d, Node: %d, Func: %d, Arg: %d\n",
+ link.Srv6EndXSID.Srv6SIDStructure.LocalBlock,
+ link.Srv6EndXSID.Srv6SIDStructure.LocalNode,
+ link.Srv6EndXSID.Srv6SIDStructure.LocalFunc,
+ link.Srv6EndXSID.Srv6SIDStructure.LocalArg)
+ }
}
- fmt.Printf(" Adj-SID: %d\n", link.AdjSid)
- fmt.Printf(" SRv6 End.X SID:\n")
- fmt.Printf(" EndpointBehavior: %s\n", BehaviorToString(link.Srv6EndXSID.EndpointBehavior))
- fmt.Printf(" SIDs: %v\n", link.Srv6EndXSID.Sids)
- fmt.Printf(" SID Structure: Block: %d, Node: %d, Func: %d, Arg: %d\n",
- link.Srv6EndXSID.Srv6SIDStructure.LocalBlock,
- link.Srv6EndXSID.Srv6SIDStructure.LocalNode,
- link.Srv6EndXSID.Srv6SIDStructure.LocalFunc,
- link.Srv6EndXSID.Srv6SIDStructure.LocalArg)
}
+
fmt.Printf(" SRv6 SIDs:\n")
- for _, srv6SID := range node.SRv6SIDs {
- fmt.Printf(" SIDs: %v\n", srv6SID.Sids)
- fmt.Printf(" Block: %d, Node: %d, Func: %d, Arg: %d\n", srv6SID.SIDStructure.LocalBlock,
- srv6SID.SIDStructure.LocalNode, srv6SID.SIDStructure.LocalFunc, srv6SID.SIDStructure.LocalArg)
- fmt.Printf(" EndpointBehavior: %s, Flags: %d, Algorithm: %d\n", BehaviorToString(srv6SID.EndpointBehavior.Behavior),
- srv6SID.EndpointBehavior.Flags, srv6SID.EndpointBehavior.Algorithm)
- fmt.Printf(" MultiTopoIDs: %v\n", srv6SID.MultiTopoIDs)
+ if node.SRv6SIDs != nil {
+ for _, srv6SID := range node.SRv6SIDs {
+ if srv6SID == nil {
+ continue
+ }
+ fmt.Printf(" SIDs: %v\n", srv6SID.Sids)
+ fmt.Printf(" Block: %d, Node: %d, Func: %d, Arg: %d\n",
+ srv6SID.SIDStructure.LocalBlock,
+ srv6SID.SIDStructure.LocalNode,
+ srv6SID.SIDStructure.LocalFunc,
+ srv6SID.SIDStructure.LocalArg)
+ fmt.Printf(" EndpointBehavior: %s, Flags: %d, Algorithm: %d\n",
+ BehaviorToString(srv6SID.EndpointBehavior.Behavior),
+ srv6SID.EndpointBehavior.Flags,
+ srv6SID.EndpointBehavior.Algorithm)
+ fmt.Printf(" MultiTopoIDs: %v\n", srv6SID.MultiTopoIDs)
+ }
}
nodeCnt++
From 1719c2618c25db996bd1800a1325819e97994d35 Mon Sep 17 00:00:00 2001
From: Wataru Mishima
Date: Fri, 5 Sep 2025 16:22:09 +0900
Subject: [PATCH 43/87] fix(ted): add nil checks in GetTED
---
pkg/server/grpc_server.go | 98 +++++++++++++++++++++++----------------
1 file changed, 57 insertions(+), 41 deletions(-)
diff --git a/pkg/server/grpc_server.go b/pkg/server/grpc_server.go
index d0daf56e..70887d33 100644
--- a/pkg/server/grpc_server.go
+++ b/pkg/server/grpc_server.go
@@ -413,7 +413,7 @@ func (s *APIServer) GetTED(ctx context.Context, req *pb.GetTEDRequest) (*pb.GetT
Enable: true,
}
- if s.pce.ted == nil {
+ if s.pce == nil || s.pce.ted == nil {
ret.Enable = false
return ret, nil
}
@@ -422,6 +422,10 @@ func (s *APIServer) GetTED(ctx context.Context, req *pb.GetTEDRequest) (*pb.GetT
for _, lsNodes := range s.pce.ted.Nodes {
for _, lsNode := range lsNodes {
+ if lsNode == nil {
+ continue
+ }
+
node := &pb.LsNode{
Asn: lsNode.ASN,
RouterId: lsNode.RouterID,
@@ -435,79 +439,89 @@ func (s *APIServer) GetTED(ctx context.Context, req *pb.GetTEDRequest) (*pb.GetT
}
for _, lsLink := range lsNode.Links {
- localIp, err := lsLink.LocalIP.MarshalText()
- if err != nil {
- return nil, fmt.Errorf("failed to marshal local IP: %v", err)
- }
- remoteIp, err := lsLink.RemoteIP.MarshalText()
- if err != nil {
- return nil, fmt.Errorf("failed to marshal remote IP: %v", err)
+ if lsLink == nil || lsLink.LocalNode == nil || lsLink.RemoteNode == nil {
+ s.logger.Debug("skip link with nil node", zap.Any("link", lsLink))
+ continue
}
+ localIP, _ := lsLink.LocalIP.MarshalText()
+ remoteIP, _ := lsLink.RemoteIP.MarshalText()
+
link := &pb.LsLink{
LocalRouterId: lsLink.LocalNode.RouterID,
LocalAsn: lsLink.LocalNode.ASN,
- LocalIp: string(localIp),
+ LocalIp: string(localIP),
RemoteRouterId: lsLink.RemoteNode.RouterID,
RemoteAsn: lsLink.RemoteNode.ASN,
- RemoteIp: string(remoteIp),
+ RemoteIp: string(remoteIP),
Metrics: make([]*pb.Metric, 0, len(lsLink.Metrics)),
AdjSid: lsLink.AdjSid,
}
for _, lsMetric := range lsLink.Metrics {
+ if lsMetric == nil {
+ continue
+ }
metricType, ok := pb.MetricType_value[lsMetric.Type.String()]
if !ok {
- return nil, fmt.Errorf("invalid metric type: %s", lsMetric.Type.String())
+ s.logger.Debug("invalid metric type", zap.String("type", lsMetric.Type.String()))
+ continue
}
-
- metric := &pb.Metric{
+ link.Metrics = append(link.Metrics, &pb.Metric{
Type: pb.MetricType(metricType),
Value: lsMetric.Value,
- }
-
- link.Metrics = append(link.Metrics, metric)
+ })
}
- link.Srv6EndXSid = &pb.Srv6EndXSID{
- EndpointBehavior: uint32(lsLink.Srv6EndXSID.EndpointBehavior),
- Sids: make([]*pb.SID, 0, len(lsLink.Srv6EndXSID.Sids)),
- SidStructure: &pb.SidStructure{
- LocalBlock: uint32(lsLink.Srv6EndXSID.Srv6SIDStructure.LocalBlock),
- LocalNode: uint32(lsLink.Srv6EndXSID.Srv6SIDStructure.LocalNode),
- LocalFunc: uint32(lsLink.Srv6EndXSID.Srv6SIDStructure.LocalFunc),
- LocalArg: uint32(lsLink.Srv6EndXSID.Srv6SIDStructure.LocalArg),
- },
- }
+ if lsLink.Srv6EndXSID != nil {
+ srv6 := &pb.Srv6EndXSID{
+ EndpointBehavior: uint32(lsLink.Srv6EndXSID.EndpointBehavior),
+ Sids: make([]*pb.SID, 0, len(lsLink.Srv6EndXSID.Sids)),
+ SidStructure: &pb.SidStructure{
+ LocalBlock: uint32(lsLink.Srv6EndXSID.Srv6SIDStructure.LocalBlock),
+ LocalNode: uint32(lsLink.Srv6EndXSID.Srv6SIDStructure.LocalNode),
+ LocalFunc: uint32(lsLink.Srv6EndXSID.Srv6SIDStructure.LocalFunc),
+ LocalArg: uint32(lsLink.Srv6EndXSID.Srv6SIDStructure.LocalArg),
+ },
+ }
- for _, sid := range lsLink.Srv6EndXSID.Sids {
- link.Srv6EndXSid.Sids = append(link.Srv6EndXSid.Sids, &pb.SID{
- Sid: sid,
- })
+ for _, sid := range lsLink.Srv6EndXSID.Sids {
+ if sid == "" {
+ continue
+ }
+ srv6.Sids = append(srv6.Sids, &pb.SID{Sid: sid})
+ }
+
+ link.Srv6EndXSid = srv6
}
node.LsLinks = append(node.LsLinks, link)
}
for _, lsPrefix := range lsNode.Prefixes {
- prefix := &pb.LsPrefix{
+ if lsPrefix == nil {
+ continue
+ }
+ node.LsPrefixes = append(node.LsPrefixes, &pb.LsPrefix{
Prefix: lsPrefix.Prefix.String(),
SidIndex: lsPrefix.SidIndex,
- }
-
- node.LsPrefixes = append(node.LsPrefixes, prefix)
+ })
}
for _, lsSrv6SID := range lsNode.SRv6SIDs {
+ if lsSrv6SID == nil {
+ continue
+ }
srv6SID := &pb.LsSrv6SID{
Sids: make([]*pb.SID, 0, len(lsSrv6SID.Sids)),
MultiTopoIds: make([]*pb.MultiTopoID, 0, len(lsSrv6SID.MultiTopoIDs)),
}
for _, sid := range lsSrv6SID.Sids {
- srv6SID.Sids = append(srv6SID.Sids, &pb.SID{
- Sid: sid,
- })
+ if sid == "" {
+ continue
+ }
+ srv6SID.Sids = append(srv6SID.Sids, &pb.SID{Sid: sid})
}
for _, topoID := range lsSrv6SID.MultiTopoIDs {
@@ -516,10 +530,12 @@ func (s *APIServer) GetTED(ctx context.Context, req *pb.GetTEDRequest) (*pb.GetT
})
}
- srv6SID.EndpointBehavior = &pb.EndpointBehavior{
- Behavior: uint32(lsSrv6SID.EndpointBehavior.Behavior),
- Flags: uint32(lsSrv6SID.EndpointBehavior.Flags),
- Algorithm: uint32(lsSrv6SID.EndpointBehavior.Algorithm),
+ if lsSrv6SID.EndpointBehavior != (table.EndpointBehavior{}) {
+ srv6SID.EndpointBehavior = &pb.EndpointBehavior{
+ Behavior: uint32(lsSrv6SID.EndpointBehavior.Behavior),
+ Flags: uint32(lsSrv6SID.EndpointBehavior.Flags),
+ Algorithm: uint32(lsSrv6SID.EndpointBehavior.Algorithm),
+ }
}
srv6SID.SidStructure = &pb.SidStructure{
From 5399d6c000f6eb3a29f60744bf1d28380635e332 Mon Sep 17 00:00:00 2001
From: Wataru Mishima
Date: Fri, 5 Sep 2025 16:13:58 +0900
Subject: [PATCH 44/87] refactor(ted): update loopback address detection logic
---
internal/pkg/table/ted.go | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/internal/pkg/table/ted.go b/internal/pkg/table/ted.go
index 511f001e..7b7b1f34 100644
--- a/internal/pkg/table/ted.go
+++ b/internal/pkg/table/ted.go
@@ -186,8 +186,14 @@ func (n *LsNode) NodeSegment() (Segment, error) {
func (n *LsNode) LoopbackAddr() (netip.Addr, error) {
for _, prefix := range n.Prefixes {
- if prefix.SidIndex != 0 {
- return prefix.Prefix.Addr(), nil
+ if prefix.Prefix.Addr().Is4() {
+ if prefix.Prefix.Bits() == 32 {
+ return prefix.Prefix.Addr(), nil
+ }
+ } else if prefix.Prefix.Addr().Is6() {
+ if prefix.Prefix.Bits() == 128 {
+ return prefix.Prefix.Addr(), nil
+ }
}
}
From f4f485461dddf4e7ec2cf018e5a47366499b69be Mon Sep 17 00:00:00 2001
From: Wataru Mishima
Date: Fri, 5 Sep 2025 16:24:39 +0900
Subject: [PATCH 45/87] fix(tlv): improve multiple TLV decoding with offset and
truncation checks
---
pkg/packet/pcep/tlv.go | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/pkg/packet/pcep/tlv.go b/pkg/packet/pcep/tlv.go
index 858e367e..15edff64 100644
--- a/pkg/packet/pcep/tlv.go
+++ b/pkg/packet/pcep/tlv.go
@@ -1258,21 +1258,29 @@ func DecodeTLV(data []byte) (TLVInterface, error) {
func DecodeTLVs(data []byte) ([]TLVInterface, error) {
var tlvs []TLVInterface
+ offset := 0
- for len(data) > 0 {
- tlv, err := DecodeTLV(data)
- if err != nil {
- return nil, err
+ for offset < len(data) {
+ if len(data[offset:]) < 4 {
+ return nil, fmt.Errorf("truncated TLV header at offset %d", offset)
}
- tlvs = append(tlvs, tlv)
+ tlvType := binary.BigEndian.Uint16(data[offset : offset+2])
+ valueLen := int(binary.BigEndian.Uint16(data[offset+2 : offset+4]))
+ totalLen := 4 + valueLen
+
+ if len(data[offset:]) < totalLen {
+ return nil, fmt.Errorf("truncated TLV value for type 0x%x at offset %d", tlvType, offset)
+ }
- tlvLen := int(tlv.Len())
- if len(data) < tlvLen {
- return nil, fmt.Errorf("expected TLV length %d but found %d bytes remaining", tlvLen, len(data))
+ tlv, err := DecodeTLV(data[offset : offset+totalLen])
+ if err != nil {
+ return nil, fmt.Errorf("error decoding TLV type 0x%x: %w", tlvType, err)
}
- data = data[tlvLen:]
+ tlvs = append(tlvs, tlv)
+ paddedLen := (totalLen + 3) & ^3
+ offset += paddedLen
}
return tlvs, nil
From 3af5753abd59cab147daa776a1b0072c5f03ec06 Mon Sep 17 00:00:00 2001
From: Wataru Mishima
Date: Fri, 5 Sep 2025 16:25:14 +0900
Subject: [PATCH 46/87] fix(tlv): change EndpointsObject receiver to pointer
for Len method
---
pkg/packet/pcep/object.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pkg/packet/pcep/object.go b/pkg/packet/pcep/object.go
index e4b029d5..7fe2bc75 100644
--- a/pkg/packet/pcep/object.go
+++ b/pkg/packet/pcep/object.go
@@ -1226,7 +1226,7 @@ func (o *EndpointsObject) Serialize() ([]uint8, error) {
return byteEndpointsObject, nil
}
-func (o EndpointsObject) Len() (uint16, error) {
+func (o *EndpointsObject) Len() (uint16, error) {
var length uint16
if o.SrcAddr.Is4() && o.DstAddr.Is4() {
// CommonObjectHeader(4byte) + srcIPv4 (4byte) + dstIPv4 (4byte)
From 9a98d9d7988259bf50d5071e1bc5c78621694dc7 Mon Sep 17 00:00:00 2001
From: Wataru Mishima
Date: Fri, 5 Sep 2025 16:27:20 +0900
Subject: [PATCH 47/87] fix(object): add details to Endpoints and Association
Object errors
---
pkg/packet/pcep/object.go | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/pkg/packet/pcep/object.go b/pkg/packet/pcep/object.go
index 7fe2bc75..d1f7406b 100644
--- a/pkg/packet/pcep/object.go
+++ b/pkg/packet/pcep/object.go
@@ -1235,7 +1235,7 @@ func (o *EndpointsObject) Len() (uint16, error) {
// CommonObjectHeader(4byte) + srcIPv4 (16byte) + dstIPv4 (16byte)
length = commonObjectHeaderLength + 16 + 16
} else {
- return uint16(0), errors.New("invalid endpoints address")
+ return uint16(0), fmt.Errorf("invalid endpoints address (Len()): src=%v dst=%v", o.SrcAddr, o.DstAddr)
}
return length, nil
}
@@ -1247,7 +1247,7 @@ func NewEndpointsObject(dstAddr netip.Addr, srcAddr netip.Addr) (*EndpointsObjec
} else if dstAddr.Is6() && srcAddr.Is6() {
objectType = ObjectTypeEndpointIPv6
} else {
- return nil, errors.New("invalid endpoints address")
+ return nil, fmt.Errorf("invalid endpoints address (NewEndpointsObject): dst=%v src=%v", dstAddr, srcAddr)
}
o := &EndpointsObject{
@@ -1306,7 +1306,7 @@ func (o *AssociationObject) DecodeFromBytes(typ ObjectType, objectBody []uint8)
}
}
default:
- return errors.New("invalid association source address")
+ return errors.New("invalid association source address (DecodeFromBytes)")
}
return nil
@@ -1354,7 +1354,7 @@ func (o AssociationObject) Len() (uint16, error) {
// Reserved(2byte) + Flags(2byte) + Assoc Type(2byte) + Assoc ID(2byte) + IPv6 Assoc Src(16byte)
associationObjectBodyLength = uint16(24) + tlvsByteLength
} else {
- return uint16(0), errors.New("invalid association source address")
+ return uint16(0), errors.New("invalid association source address (Len())")
}
return (commonObjectHeaderLength + associationObjectBodyLength), nil
}
@@ -1373,7 +1373,7 @@ func NewAssociationObject(srcAddr netip.Addr, dstAddr netip.Addr, color uint32,
} else if dstAddr.Is6() && srcAddr.Is6() {
objectType = ObjectTypeEndpointIPv6
} else {
- return nil, errors.New("invalid endpoints address")
+ return nil, fmt.Errorf("invalid endpoints address (NewAssociationObject): src=%v dst=%v", srcAddr, dstAddr)
}
o := &AssociationObject{
ObjectType: objectType,
From 3d9395d31828af42cc6b8eeb5b87a49f4f3510c5 Mon Sep 17 00:00:00 2001
From: watal
Date: Fri, 5 Sep 2025 21:31:06 +0900
Subject: [PATCH 48/87] fix(validation): clarify error messages with
policy. prefix
---
pkg/server/grpc_server.go | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/pkg/server/grpc_server.go b/pkg/server/grpc_server.go
index 70887d33..88b65266 100644
--- a/pkg/server/grpc_server.go
+++ b/pkg/server/grpc_server.go
@@ -237,51 +237,51 @@ const (
var validator = map[ValidationKind]func(policy *pb.SRPolicy, asn uint32) error{
ValidationAdd: func(policy *pb.SRPolicy, asn uint32) error {
if asn == 0 {
- return errors.New("ASN must not be zero")
+ return errors.New("policy.ASN must not be zero")
}
if policy.PcepSessionAddr == nil {
- return errors.New("PCEP session address must not be nil")
+ return errors.New("policy.PCEP session address must not be nil")
}
if policy.Color == 0 {
- return errors.New("Color must not be zero")
+ return errors.New("policy.Color must not be zero")
}
if policy.SrcRouterId == "" {
- return errors.New("SrcRouterId must not be empty")
+ return errors.New("policy.SrcRouterId must not be empty")
}
if policy.DstRouterId == "" {
- return errors.New("DstRouterId must not be empty")
+ return errors.New("policy.DstRouterId must not be empty")
}
return nil
},
ValidationAddDisablePathCompute: func(policy *pb.SRPolicy, asn uint32) error {
if policy.PcepSessionAddr == nil {
- return errors.New("PCEP session address must not be nil")
+ return errors.New("policy.PCEP session address must not be nil")
}
if len(policy.SrcAddr) == 0 {
- return errors.New("SrcAddr must not be empty")
+ return errors.New("policy.SrcAddr must not be empty")
}
if len(policy.DstAddr) == 0 {
- return errors.New("DstAddr must not be empty")
+ return errors.New("policy.DstAddr must not be empty")
}
if len(policy.SegmentList) == 0 {
- return errors.New("SegmentList must not be empty")
+ return errors.New("policy.SegmentList must not be empty")
}
return nil
},
ValidationDelete: func(policy *pb.SRPolicy, asn uint32) error {
if policy.PcepSessionAddr == nil {
- return errors.New("PCEP session address must not be nil")
+ return errors.New("policy.PCEP session address must not be nil")
}
if policy.Color == 0 {
- return errors.New("Color must not be zero")
+ return errors.New("policy.Color must not be zero")
}
if len(policy.DstAddr) == 0 {
- return errors.New("DstAddr must not be empty")
+ return errors.New("policy.DstAddr must not be empty")
}
if policy.PolicyName == "" {
- return errors.New("PolicyName must not be empty")
+ return errors.New("policy.PolicyName must not be empty")
}
return nil
},
From cc8b8a3cd939571028f748e0ed7ce8aa6154c9e5 Mon Sep 17 00:00:00 2001
From: Motok1
Date: Wed, 10 Sep 2025 00:31:22 +0900
Subject: [PATCH 49/87] refactor(test): update input and expected data
---
test/README.md | 4 ++--
.../show_ted/srmpls/expected/srmpls.json | 14 ++++++++------
.../show_ted/srmpls/input/polad.cfg.yaml | 4 ++--
test/scenario_test/show_ted/srmpls/topo.clab.yaml | 2 +-
test/scenario_test/show_ted/test_show_ted.py | 1 +
5 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/test/README.md b/test/README.md
index f447db7a..dfe9f773 100644
--- a/test/README.md
+++ b/test/README.md
@@ -40,8 +40,8 @@ uv 0.8.13
### vjunos-router
```
-$ docker images | grep vrnetlab/juniper_vjunos-router | grep 24.2R1-S2.5
-vrnetlab/juniper_vjunos-router 24.2R1-S2.5 27c5af1efc9c 2 months ago 4.17GB
+$ docker images | grep vrnetlab/juniper_vjunos-router | grep 25.2R1.9
+vrnetlab/juniper_vjunos-router 25.2R1.9 6e9b1472b46b 37 minutes ago 4.18GB
```
#### how to install image
diff --git a/test/scenario_test/show_ted/srmpls/expected/srmpls.json b/test/scenario_test/show_ted/srmpls/expected/srmpls.json
index fc1631b9..c0cec496 100644
--- a/test/scenario_test/show_ted/srmpls/expected/srmpls.json
+++ b/test/scenario_test/show_ted/srmpls/expected/srmpls.json
@@ -10,11 +10,11 @@
"localIP": "10.0.0.1",
"metrics": [
{
- "type": "IGP",
+ "type": "METRIC_TYPE_IGP",
"value": 10
},
{
- "type": "TE",
+ "type": "METRIC_TYPE_TE",
"value": 10
}
],
@@ -30,7 +30,8 @@
],
"routerID": "0000.0aff.0001",
"srgbBegin": 800000,
- "srgbEnd": 804096
+ "srgbEnd": 804096,
+ "srv6SIDs": []
},
{
"asn": 65000,
@@ -42,11 +43,11 @@
"localIP": "10.0.0.2",
"metrics": [
{
- "type": "IGP",
+ "type": "METRIC_TYPE_IGP",
"value": 10
},
{
- "type": "TE",
+ "type": "METRIC_TYPE_TE",
"value": 10
}
],
@@ -62,7 +63,8 @@
],
"routerID": "0000.0aff.0002",
"srgbBegin": 800000,
- "srgbEnd": 804096
+ "srgbEnd": 804096,
+ "srv6SIDs": []
}
]
}
diff --git a/test/scenario_test/show_ted/srmpls/input/polad.cfg.yaml b/test/scenario_test/show_ted/srmpls/input/polad.cfg.yaml
index 1a5e381f..ccc4218a 100644
--- a/test/scenario_test/show_ted/srmpls/input/polad.cfg.yaml
+++ b/test/scenario_test/show_ted/srmpls/input/polad.cfg.yaml
@@ -2,7 +2,7 @@ global:
pcep:
address: "0.0.0.0"
port: 4189
- grpc-server:
+ grpc_server:
address: "127.0.0.1"
port: 50052
log:
@@ -12,6 +12,6 @@ global:
enable: true
source: "gobgp"
gobgp:
- grpc-client:
+ grpc_client:
address: "127.0.0.1"
port: 50051
diff --git a/test/scenario_test/show_ted/srmpls/topo.clab.yaml b/test/scenario_test/show_ted/srmpls/topo.clab.yaml
index 6d029bc4..8a6a4581 100644
--- a/test/scenario_test/show_ted/srmpls/topo.clab.yaml
+++ b/test/scenario_test/show_ted/srmpls/topo.clab.yaml
@@ -2,7 +2,7 @@ name: srmpls
topology:
kinds:
juniper_vjunosrouter:
- image: vrnetlab/juniper_vjunos-router:24.2R1-S2.5
+ image: vrnetlab/juniper_vjunos-router:25.2R1.9
nodes:
pola:
kind: linux
diff --git a/test/scenario_test/show_ted/test_show_ted.py b/test/scenario_test/show_ted/test_show_ted.py
index 32d6a306..0c6d282e 100644
--- a/test/scenario_test/show_ted/test_show_ted.py
+++ b/test/scenario_test/show_ted/test_show_ted.py
@@ -33,6 +33,7 @@ def test__srmpls(self, clab_deploy):
time.sleep(60)
output = json.loads(subprocess.run("docker exec -it clab-srmpls-pola /bin/pola -p 50052 ted -j", shell=True, capture_output=True, text=True).stdout)
+ print("output is", output)
with open(TEST_SRMPLS_DIR+"/expected/srmpls.json") as f:
expected_output = json.load(f)
From 75b60fbe48628c5c9207a90998ac4e28e7fdd40c Mon Sep 17 00:00:00 2001
From: Wataru Mishima
Date: Wed, 10 Sep 2025 14:17:08 +0900
Subject: [PATCH 50/87] chore(example): add SRv6 uSID dynamic-path example
---
.../srv6_usid_dynamic-path/README.md | 148 ++++++++++++++++++
.../srv6_usid_dynamic-path/bin/.gitkeep | 0
.../srv6_usid_dynamic-path/gobgpd/gobgpd.yml | 11 ++
.../srv6_usid_dynamic-path/polad/polad.yaml | 18 +++
.../sr-policies/pe02-policy1.yaml | 9 ++
.../startup-configs/p01.cfg | 106 +++++++++++++
.../startup-configs/p02.cfg | 106 +++++++++++++
.../startup-configs/pe01.cfg | 124 +++++++++++++++
.../startup-configs/pe02.cfg | 134 ++++++++++++++++
.../srv6_usid_dynamic-path/topo.clab.yml | 59 +++++++
.../srv6_usid_dynamic-path/topo.png | Bin 0 -> 279139 bytes
11 files changed, 715 insertions(+)
create mode 100644 examples/containerlab/srv6_usid_dynamic-path/README.md
create mode 100644 examples/containerlab/srv6_usid_dynamic-path/bin/.gitkeep
create mode 100644 examples/containerlab/srv6_usid_dynamic-path/gobgpd/gobgpd.yml
create mode 100644 examples/containerlab/srv6_usid_dynamic-path/polad/polad.yaml
create mode 100644 examples/containerlab/srv6_usid_dynamic-path/sr-policies/pe02-policy1.yaml
create mode 100644 examples/containerlab/srv6_usid_dynamic-path/startup-configs/p01.cfg
create mode 100644 examples/containerlab/srv6_usid_dynamic-path/startup-configs/p02.cfg
create mode 100644 examples/containerlab/srv6_usid_dynamic-path/startup-configs/pe01.cfg
create mode 100644 examples/containerlab/srv6_usid_dynamic-path/startup-configs/pe02.cfg
create mode 100644 examples/containerlab/srv6_usid_dynamic-path/topo.clab.yml
create mode 100644 examples/containerlab/srv6_usid_dynamic-path/topo.png
diff --git a/examples/containerlab/srv6_usid_dynamic-path/README.md b/examples/containerlab/srv6_usid_dynamic-path/README.md
new file mode 100644
index 00000000..24adf9a1
--- /dev/null
+++ b/examples/containerlab/srv6_usid_dynamic-path/README.md
@@ -0,0 +1,148 @@
+# SRv6 uSID Dynamic Path
+
+Example topology powered by [Containerlab](https://containerlab.dev/)
+
+
+
+## Requirements
+
+* container host (Linux)
+* vJunos image
+
+## Usage
+
+### Install Containerlab & vJunos-router
+
+[Install Containerlab](https://containerlab.dev/install/)
+
+```bash
+sudo bash -c "$(curl -sL https://get.containerlab.dev)"
+```
+
+Install vJunos on [Vrnetlab](https://containerlab.dev/manual/vrnetlab/)
+
+### Building a Lab Network
+
+Create bridge
+
+```bash
+sudo ip link add switch type bridge
+sudo ip link set dev switch up
+```
+
+Copy Pola PCE & GoBGP to bin
+
+* GoBGP: Use [this version](https://github.com/k1yoto/gobgp/tree/feature/bgp-ls-srv6)
+* Pola PCE: Replace the GoBGP module in go.mod with your local GoBGP version, e.g.:
+
+```text
+replace github.com/osrg/gobgp/v4 => ../gobgp
+```
+
+Start Containerlab network
+
+```bash
+git clone https://github.com/nttcom/pola
+cd pola/examples/containerlab/srv6_usid_dynamic-path
+
+sudo containerlab deploy
+```
+
+### Starting Daemons
+
+```bash
+$ sudo docker exec -it clab-dynamic-path-gobgp bash
+# gobgpd -f /gobgpd.yml
+```
+
+```bash
+$ sudo docker exec -it clab-dynamic-path-pola bash
+# polad -f /polad.yaml
+```
+
+### Show TED
+```bash
+$ sudo docker exec -it clab-dynamic-path-pola bash
+# pola -p 50052 ted
+```
+
+### Apply SR Policy
+
+Connect to PCEP container, check PCEP session and SR policy
+
+```bash
+$ sudo docker exec -it clab-dynamic-path-pola bash
+
+# pola session -p 50052
+sessionAddr(0): fd00::2
+
+# pola sr-policy list -p 50052
+No SR Policies found.
+```
+
+Apply and check SR Policy
+
+```bash
+# pola sr-policy add -f /pe02-policy1.yaml -p 50052
+success!
+
+# pola sr-policy list -p 50052
+Session: fd00::2
+ PolicyName: DYNAMIC-POLICY
+ SrcAddr: fd00:ffff::2
+ DstAddr: fd00:ffff::1
+ Color: 100
+ Preference: 0
+ SegmentList: fcbb:bb00:1004:: -> fcbb:bb00:1003:: -> fcbb:bb00:1001::
+```
+
+Enter container pe02 and check SR Policy
+
+* user: admin
+* pass: admin@123
+
+```text
+$ ssh clab-dynamic-path-pe02 -l admin
+
+admin@pe02> show spring-traffic-engineering lsp brief
+To State LSPname
+fd00:ffff::1-100 Up DYNAMIC-POLICY
+
+
+Total displayed LSPs: 1 (Up: 1, Down: 0, Initializing: 0)
+
+admin@pe02> show spring-traffic-engineering lsp name DYNAMIC-POLICY detail
+E = Entropy-label Capability
+
+Name: DYNAMIC-POLICY
+ Tunnel-source: Path computation element protocol(PCEP)
+ Tunnel Forward Type: SRV6
+ To: fd00:ffff::1-100
+ From: fd00:ffff::2
+ State: Up
+ Path Status: NA
+ Outgoing interface: NA
+ Delegation compute constraints info:
+ Actual-Bandwidth from PCUpdate: 0
+ Bandwidth-Requested from PCUpdate: 0
+ Setup-Priority: 0
+ Reservation-Priority: 0
+ Auto-translate status: Disabled Auto-translate result: N/A
+ BFD status: N/A BFD name: N/A
+ BFD remote-discriminator: N/A
+ Segment ID : 129
+ ERO Valid: true
+ SR-ERO hop count: 3
+ Hop 1 (Strict):
+ NAI: IPv6 Node ID, Node address: fcbb:bb00:1004::
+ SID type: srv6-sid, Value: fcbb:bb00:1004::
+ Hop 2 (Strict):
+ NAI: IPv6 Node ID, Node address: fcbb:bb00:1003::
+ SID type: srv6-sid, Value: fcbb:bb00:1003::
+ Hop 3 (Strict):
+ NAI: IPv6 Node ID, Node address: fcbb:bb00:1001::
+ SID type: srv6-sid, Value: fcbb:bb00:1001::
+
+
+Total displayed LSPs: 1 (Up: 1, Down: 0, Initializing: 0)
+```
diff --git a/examples/containerlab/srv6_usid_dynamic-path/bin/.gitkeep b/examples/containerlab/srv6_usid_dynamic-path/bin/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/examples/containerlab/srv6_usid_dynamic-path/gobgpd/gobgpd.yml b/examples/containerlab/srv6_usid_dynamic-path/gobgpd/gobgpd.yml
new file mode 100644
index 00000000..37a1af5b
--- /dev/null
+++ b/examples/containerlab/srv6_usid_dynamic-path/gobgpd/gobgpd.yml
@@ -0,0 +1,11 @@
+global:
+ config:
+ as: 65000
+ router-id: "10.255.0.255"
+neighbors:
+ - config:
+ peer-as: 65000
+ neighbor-address: "fd00::1"
+ afi-safis:
+ - config:
+ afi-safi-name: ls
diff --git a/examples/containerlab/srv6_usid_dynamic-path/polad/polad.yaml b/examples/containerlab/srv6_usid_dynamic-path/polad/polad.yaml
new file mode 100644
index 00000000..ecf1fe43
--- /dev/null
+++ b/examples/containerlab/srv6_usid_dynamic-path/polad/polad.yaml
@@ -0,0 +1,18 @@
+global:
+ pcep:
+ address: "fd00::3"
+ port: 4189
+ grpc_server:
+ address: "127.0.0.1"
+ port: 50052
+ log:
+ path: "/var/log/pola/"
+ debug: true
+ name: "polad.log"
+ ted:
+ enable: true
+ source: "gobgp"
+ gobgp:
+ grpc_client:
+ address: "10.0.0.4"
+ port: 50051
diff --git a/examples/containerlab/srv6_usid_dynamic-path/sr-policies/pe02-policy1.yaml b/examples/containerlab/srv6_usid_dynamic-path/sr-policies/pe02-policy1.yaml
new file mode 100644
index 00000000..2d926641
--- /dev/null
+++ b/examples/containerlab/srv6_usid_dynamic-path/sr-policies/pe02-policy1.yaml
@@ -0,0 +1,9 @@
+asn: 65000
+srPolicy:
+ pcepSessionAddr: "fd00::2"
+ srcRouterID: "0000.0001.0002"
+ dstRouterID: "0000.0001.0001"
+ name: "DYNAMIC-POLICY"
+ color: 100
+ type: dynamic
+ metric: igp
diff --git a/examples/containerlab/srv6_usid_dynamic-path/startup-configs/p01.cfg b/examples/containerlab/srv6_usid_dynamic-path/startup-configs/p01.cfg
new file mode 100644
index 00000000..5d004516
--- /dev/null
+++ b/examples/containerlab/srv6_usid_dynamic-path/startup-configs/p01.cfg
@@ -0,0 +1,106 @@
+hostname p01
+username admin
+ group root-lr
+ group cisco-support
+ secret 10 $6$MTEbC5od1RuC....$xvQt1LVtwS9akjpzHYOZyj6ZMLZwJ5R9PvRCMaqjrR9iqeoPXisq.rXiiJZPoPE6Gi5XL1yjIlzAY4dfWC6Gr1
+!
+grpc
+ vrf MGMT
+ no-tls
+ address-family dual
+!
+vrf MGMT
+ address-family ipv4 unicast
+ !
+ address-family ipv6 unicast
+ !
+!
+line default
+ transport input ssh
+!
+call-home
+ service active
+ contact smart-licensing
+ profile CiscoTAC-1
+ active
+ destination transport-method email disable
+ destination transport-method http
+ !
+!
+netconf-yang agent
+ ssh
+!
+interface Loopback0
+ ipv6 address fd00:ffff::3/128
+!
+interface GigabitEthernet0/0/0/0
+ description to:pe01
+ ipv6 enable
+!
+interface GigabitEthernet0/0/0/1
+ description to:pe02
+ ipv6 enable
+!
+interface GigabitEthernet0/0/0/2
+ description to:p02
+ ipv6 enable
+!
+router isis 1
+ is-type level-2-only
+ net 49.0000.0000.0001.0003.00
+ address-family ipv6 unicast
+ metric-style wide
+ router-id Loopback0
+ segment-routing srv6
+ locator uSID
+ level 2
+ !
+ !
+ !
+ interface Loopback0
+ passive
+ address-family ipv6 unicast
+ !
+ !
+ interface GigabitEthernet0/0/0/0
+ circuit-type level-2-only
+ point-to-point
+ hello-interval 1
+ address-family ipv6 unicast
+ metric 10 level 2
+ !
+ !
+ interface GigabitEthernet0/0/0/1
+ circuit-type level-2-only
+ point-to-point
+ hello-interval 1
+ address-family ipv6 unicast
+ metric 100 level 2
+ !
+ !
+ interface GigabitEthernet0/0/0/2
+ circuit-type level-2-only
+ point-to-point
+ hello-interval 1
+ address-family ipv6 unicast
+ metric 10 level 2
+ !
+ !
+!
+mpls oam
+!
+segment-routing
+ srv6
+ logging locator status
+ locators
+ locator uSID
+ micro-segment behavior unode psp-usd
+ prefix fcbb:bb00:1003::/48
+ !
+ !
+ !
+!
+ssh server v2
+ssh server vrf MGMT
+ssh server netconf vrf MGMT
+end
diff --git a/examples/containerlab/srv6_usid_dynamic-path/startup-configs/p02.cfg b/examples/containerlab/srv6_usid_dynamic-path/startup-configs/p02.cfg
new file mode 100644
index 00000000..db3b3e43
--- /dev/null
+++ b/examples/containerlab/srv6_usid_dynamic-path/startup-configs/p02.cfg
@@ -0,0 +1,106 @@
+hostname p02
+username admin
+ group root-lr
+ group cisco-support
+ secret 10 $6$MTEbC5od1RuC....$xvQt1LVtwS9akjpzHYOZyj6ZMLZwJ5R9PvRCMaqjrR9iqeoPXisq.rXiiJZPoPE6Gi5XL1yjIlzAY4dfWC6Gr1
+!
+grpc
+ vrf MGMT
+ no-tls
+ address-family dual
+!
+vrf MGMT
+ address-family ipv4 unicast
+ !
+ address-family ipv6 unicast
+ !
+!
+line default
+ transport input ssh
+!
+call-home
+ service active
+ contact smart-licensing
+ profile CiscoTAC-1
+ active
+ destination transport-method email disable
+ destination transport-method http
+ !
+!
+netconf-yang agent
+ ssh
+!
+interface Loopback0
+ ipv6 address fd00:ffff::4/128
+!
+interface GigabitEthernet0/0/0/0
+ description to:pe01
+ ipv6 enable
+!
+interface GigabitEthernet0/0/0/1
+ description to:pe02
+ ipv6 enable
+!
+interface GigabitEthernet0/0/0/2
+ description to:p01
+ ipv6 enable
+!
+router isis 1
+ is-type level-2-only
+ net 49.0000.0000.0001.0004.00
+ address-family ipv6 unicast
+ metric-style wide
+ router-id Loopback0
+ segment-routing srv6
+ locator uSID
+ level 2
+ !
+ !
+ !
+ interface Loopback0
+ passive
+ address-family ipv6 unicast
+ !
+ !
+ interface GigabitEthernet0/0/0/0
+ circuit-type level-2-only
+ point-to-point
+ hello-interval 1
+ address-family ipv6 unicast
+ metric 100 level 2
+ !
+ !
+ interface GigabitEthernet0/0/0/1
+ circuit-type level-2-only
+ point-to-point
+ hello-interval 1
+ address-family ipv6 unicast
+ metric 10 level 2
+ !
+ !
+ interface GigabitEthernet0/0/0/2
+ circuit-type level-2-only
+ point-to-point
+ hello-interval 1
+ address-family ipv6 unicast
+ metric 10 level 2
+ !
+ !
+!
+mpls oam
+!
+segment-routing
+ srv6
+ logging locator status
+ locators
+ locator uSID
+ micro-segment behavior unode psp-usd
+ prefix fcbb:bb00:1004::/48
+ !
+ !
+ !
+!
+ssh server v2
+ssh server vrf MGMT
+ssh server netconf vrf MGMT
+end
diff --git a/examples/containerlab/srv6_usid_dynamic-path/startup-configs/pe01.cfg b/examples/containerlab/srv6_usid_dynamic-path/startup-configs/pe01.cfg
new file mode 100644
index 00000000..815f3672
--- /dev/null
+++ b/examples/containerlab/srv6_usid_dynamic-path/startup-configs/pe01.cfg
@@ -0,0 +1,124 @@
+hostname pe01
+username admin
+ group root-lr
+ group cisco-support
+ secret admin@123
+!
+grpc
+ vrf MGMT
+ port 9339
+ no-tls
+ address-family dual
+!
+vrf MGMT
+ address-family ipv4 unicast
+ !
+ address-family ipv6 unicast
+ !
+!
+line default
+ transport input ssh
+!
+call-home
+ service active
+ contact smart-licensing
+ profile CiscoTAC-1
+ active
+ destination transport-method email disable
+ destination transport-method http
+ !
+!
+netconf-yang agent
+ ssh
+!
+interface Loopback0
+ ipv6 address fd00:ffff::1/128
+!
+interface GigabitEthernet0/0/0/0
+ description to:p01
+ ipv6 enable
+!
+interface GigabitEthernet0/0/0/1
+ description to:p02
+ ipv6 enable
+!
+interface GigabitEthernet0/0/0/2
+ description to:pce
+ ipv6 address fd00::1/64
+!
+router isis 1
+ is-type level-2-only
+ net 49.0000.0000.0001.0001.00
+ distribute link-state level 2
+ address-family ipv6 unicast
+ metric-style wide
+ router-id Loopback0
+ segment-routing srv6
+ locator uSID
+ level 2
+ !
+ !
+ !
+ interface Loopback0
+ passive
+ address-family ipv6 unicast
+ !
+ !
+ interface GigabitEthernet0/0/0/0
+ circuit-type level-2-only
+ point-to-point
+ hello-interval 1
+ address-family ipv6 unicast
+ metric 10 level 2
+ !
+ !
+ interface GigabitEthernet0/0/0/1
+ circuit-type level-2-only
+ point-to-point
+ hello-interval 1
+ address-family ipv6 unicast
+ metric 100 level 2
+ !
+ !
+!
+router bgp 65000
+ bgp router-id 10.255.0.1
+ address-family link-state link-state
+ !
+ neighbor fd00::4
+ remote-as 65000
+ update-source GigabitEthernet0/0/0/2
+ address-family link-state link-state
+ !
+ !
+!
+mpls oam
+!
+segment-routing
+ traffic-eng
+ candidate-paths
+ pcep
+ !
+ !
+ pcc
+ pce address ipv6 fd00::3
+ !
+ !
+ !
+ srv6
+ logging locator status
+ micro-segment
+ merge-overlay-underlay-sids
+ !
+ locators
+ locator uSID
+ micro-segment behavior unode psp-usd
+ prefix fcbb:bb00:1001::/48
+ !
+ !
+ !
+!
+ssh server v2
+ssh server vrf MGMT
+ssh server netconf vrf MGMT
+end
diff --git a/examples/containerlab/srv6_usid_dynamic-path/startup-configs/pe02.cfg b/examples/containerlab/srv6_usid_dynamic-path/startup-configs/pe02.cfg
new file mode 100644
index 00000000..2eea3283
--- /dev/null
+++ b/examples/containerlab/srv6_usid_dynamic-path/startup-configs/pe02.cfg
@@ -0,0 +1,134 @@
+chassis {
+ network-services enhanced-ip;
+}
+
+interfaces {
+ ge-0/0/0 {
+ description "to:p01";
+ unit 0 {
+ family iso;
+ family inet6;
+ }
+ }
+ ge-0/0/1 {
+ description "to:p02";
+ unit 0 {
+ family iso;
+ family inet6;
+ }
+ }
+ ge-0/0/2 {
+ description "POLA-PCE";
+ unit 0 {
+ family inet6 {
+ address fd00::2/64;
+ }
+ }
+ }
+ lo0 {
+ unit 0 {
+ family iso {
+ address 49.0000.0000.0001.0002.00;
+ }
+ family inet6 {
+ address fd00:ffff::2/128;
+ }
+ }
+ }
+}
+
+routing-options {
+ router-id 10.255.0.2;
+ autonomous-system 65000;
+ forwarding-table {
+ srv6-chain-merge;
+ }
+ source-packet-routing {
+ srv6 {
+ no-reduced-srh;
+ block usid-block {
+ fcbb:bb00::/32;
+ local-micro-sid {
+ maximum-static-sids 1000;
+ }
+ }
+ locator loc-pe02 {
+ fcbb:bb00:1002::/48;
+ micro-sid {
+ block-name usid-block;
+ flavor psp;
+ flavor usd;
+ }
+ }
+ }
+ }
+}
+
+protocols {
+ isis {
+ level 1 disable;
+ level 2 {
+ wide-metrics-only;
+ }
+ no-ipv4-routing;
+ topologies {
+ ipv6-unicast;
+ }
+ net 49.0000.0000.0001.0002.00;
+ interface ge-0/0/0.0 {
+ point-to-point;
+ level 2 {
+ ipv6-unicast-metric 100;
+ srv6-adjacency-segment {
+ unprotected {
+ locator loc-pe02 {
+ micro-adjacency-sid;
+ }
+ }
+ }
+ }
+ }
+ interface ge-0/0/1.0 {
+ point-to-point;
+ level 2 {
+ ipv6-unicast-metric 10;
+ srv6-adjacency-segment {
+ unprotected {
+ locator loc-pe02 {
+ micro-adjacency-sid;
+ }
+ }
+ }
+ }
+ }
+ interface lo0.0 {
+ passive;
+ }
+ source-packet-routing {
+ srv6 {
+ locator loc-pe02 {
+ micro-node-sid;
+ }
+ }
+ }
+ }
+ mpls {
+ lsp-external-controller pccd;
+ }
+ source-packet-routing {
+ lsp-external-controller pccd;
+ srv6;
+ preserve-nexthop-hierarchy;
+ }
+ pcep {
+ pce POLA-PCE {
+ local-ipv6-address fd00::2;
+ destination-ipv6-address fd00::3;
+ pce-type active;
+ pce-type stateful;
+ lsp-provisioning;
+ spring-capability;
+ srv6-capability;
+ }
+ }
+}
diff --git a/examples/containerlab/srv6_usid_dynamic-path/topo.clab.yml b/examples/containerlab/srv6_usid_dynamic-path/topo.clab.yml
new file mode 100644
index 00000000..61217159
--- /dev/null
+++ b/examples/containerlab/srv6_usid_dynamic-path/topo.clab.yml
@@ -0,0 +1,59 @@
+name: dynamic-path
+topology:
+ kinds:
+ xrd:
+ image: ios-xr/xrd-control-plane:7.8.1
+ juniper_vjunosrouter:
+ image: vrnetlab/juniper_vjunos-router:24.2R1-S2.5
+ nodes:
+ pe01:
+ kind: xrd
+ startup-config: startup-configs/pe01.cfg
+ pe02:
+ kind: juniper_vjunosrouter
+ startup-config: startup-configs/pe02.cfg
+ p01:
+ kind: xrd
+ startup-config: startup-configs/p01.cfg
+ p02:
+ kind: xrd
+ startup-config: startup-configs/p02.cfg
+ pola:
+ kind: linux
+ image: golang:1.24.1
+ binds:
+ - bin/polad:/bin/polad
+ - bin/pola:/bin/pola
+ - polad/polad.yaml:/polad.yaml
+ - sr-policies/pe02-policy1.yaml:/pe02-policy1.yaml
+ exec:
+ - apt update
+ - apt install iproute2 -y
+ - ip addr add 10.0.0.3/24 dev eth1
+ - ip -6 addr add fd00::3/64 dev eth1
+ gobgp:
+ kind: linux
+ image: golang:1.24.1
+ binds:
+ - bin/gobgpd:/bin/gobgpd
+ - bin/gobgp:/bin/gobgp
+ - gobgpd/gobgpd.yml:/gobgpd.yml
+ exec:
+ - apt update
+ - apt install iproute2 -y
+ - ip addr add 10.0.0.4/24 dev eth1
+ - ip -6 addr add fd00::4/64 dev eth1
+ switch:
+ kind: bridge
+ links:
+ # SRv6 domain
+ - endpoints: ["pe01:Gi0-0-0-0", "p01:Gi0-0-0-0"]
+ - endpoints: ["pe01:Gi0-0-0-1", "p02:Gi0-0-0-0"]
+ - endpoints: ["pe02:eth1", "p01:Gi0-0-0-1"]
+ - endpoints: ["pe02:eth2", "p02:Gi0-0-0-1"]
+ - endpoints: ["p01:Gi0-0-0-2", "p02:Gi0-0-0-2"]
+ # Switch
+ - endpoints: ["pe01:Gi0-0-0-2", "switch:eth1"]
+ - endpoints: ["pe02:eth3", "switch:eth2"]
+ - endpoints: ["pola:eth1", "switch:eth3"]
+ - endpoints: ["gobgp:eth1", "switch:eth4"]
diff --git a/examples/containerlab/srv6_usid_dynamic-path/topo.png b/examples/containerlab/srv6_usid_dynamic-path/topo.png
new file mode 100644
index 0000000000000000000000000000000000000000..4a458b629d56d4e99eaec10aeb709d5e39732c0d
GIT binary patch
literal 279139
zcmd43bzD?k7dAYDlprD^jg*0cFiJ{;bSp>=CCv~+cZ-66w170y-90qY-JR0iJ@B6K
zzMpu%?~lj(zn9-{X3m_m_c?p7wf0)qy4D{2-pYyN;gI8iKp;Fx2@wSl=ynnaguaB0
z37iQ*XKw_7?#RJ}h2KgF3)8%{wlIX58Gt|%ei15Is)`-N3F->8=-48HQfspJLhlPo
zVKaFiF*DHKz9;qdwopsZi~RXXQS>hV{EyF6l?90@HnJH5baw+Vhzv9}NDv24(fbXw
z&u3ldrq6c;jIOy>r=wkVL4v!B(rHzhPeD#$u4*!c0*ueOK8tRE^*>-gYry!rjJu>D
z_x}BBPlHONi<283P3K9mx58#3@}|uAwx~52B=O+q`kN{m{6%VTgF1$S8b3(n`BIP3
zvUG&w!=KzNYcxOErQ))h@}%POn@F(C7j-M|37~oA_O5oZfcw|Hd2<9qZriQBgw8)E
z@PBgeQfMnYic=VSpYDr!5?)+*{;*MoM_TwfXU`FVEWdyadX6sHizQHzMod@Yp-1{J
zkEj}rmOaYR!fd0CH@e?mHP`TUMiZp}+_+aCkt#0oCKnInAMn}xM5?=6;nUBYt#=e&
zakw^^-|xwXt+pQcoRQKB(A?1#{=)jWieN#QLzHZhCJnEf8cN%{+9H&TWfdqvMarXZ
zqrvgW&~et3jD^|gi$`Y^-bK>zO>Vp2YUa_a?H2?V64W*?y8Wd;eaEp9^mR??H+?N*`vq=xZl(kh-^^`YG8{P-*M6+GD?9rTxkTwmAVYcH)Zg6*0Vt
zU)RagAD&oXTE*4S*gKjD@oU5}xYdZnP!nYw5EgW=_=;s+HJ*A|Hei4~F&-4Ady~;n
zeBp79bzX?irpMm%x}%RqU`eX$BmVgAiNriR@q>?ZwD-a1?XPbdwFsVhUS+(?4I>P;
z%+9&hPP(C(z2w<;Z`JE%2<|SCw^SGb{{4nW?O$#d2&k38Uuj8{4Q}dJeJ3Dyuviv^
zzv?=Q5xb3tkxJa5@ww;yrMwcnBm*7M?Cd3j!E_6btUI}-_F;BoS?gvxN*MTmrc={v|SGm)T4<;pKaHR
z?u`(V7pJ^__qLPNpSs2HNCJ-sZ;XJ*AiushxO40%)YV4ZS*))Q$#D5*+$XU7XI;x(
zU86$6ajskbLNbYgjdxwA{G}zhx&@5Dk%6j+U%aj8_aE5?9i$
zGq$g@X0s
zJVPa(iae*|-HQg(J+RQd`)`CvzwqmRRHZxl!rCO}8Y1|Z(oZNXlQb
ziK!$J8M9YonTyCLtq$ZElUz`4w}H}qUcFN62J7i*ytpsj$nuh`9K_htS!9w+W$M*;
z&NBM>Sa;WwuD3z0@|H#;ts^gUgV7@H-m>EpEpN`njJ>Wiw;KE#nIwWcw@=XJ(Sk!n
z+8=k*eY@9ro9DJKcE*C%#?zXo_x)s&*#{o(wCL+{STS31S+N#*ImV4kx=L)(he}*L
zb_wHr9`=)dIb2GDLefQ|O(IHSCbdGJz4-P-G^L0ft#rHSlJx=n;N8KK1HuC=|EDcs
zi;{k+*w1aAF+S&c#`F#M8@v-Mn|LH^u-+f?DI|kk>sad~Yqc>CWEo}ipK9B98Ahz=^lZi;
zp?C6bLqnlX(5^Cj)A%9hY}vu`!Mnr6CM2d7WBggj5U*F=WEwu6MW2eitzri9golep
z7uNMRzpZbLtoN@Ejf~n2$o9wQsi(P!R0R0F%KOf1$ZYfE5Ohd>h$KyU756InRafh9
za24B1;H)a20AHw9mX`OdQtj!*3#1^D5;<}qd*Og*d5g!}*jo)#{f->PQP2q4CcE;>
za@#GhqKZ53gn61to2z`L@TTxC1HT4-3``ZH2$Ul~CT9&qek}Dd8PCH?E4ql
z(P&Cmr`ACOE7hu8oYCjXiCI5jU$UBPV`0AQSgfWcjwN&@m?emn_crBDKIhzr9Ebe4
zgaIAIhc7l>z||C9Ohl?hQoQI>tt%=nmnwytjOZT^L;GTkG>tWl+}eB$f0?olrBAN-
zGYv$V$Lb*_PLdy*teQj_s2DgjQk6NBkW5*W?^24BuD+6E$#uuuF;v9*B8!|=+8UL`{#U3e-!oBCsE`R4hF)6+Bh@MAdN4)G3bCw97^#BTiE*78;f6*|60
z@Mo$#s$Je0-a|fo$LodV`G{X-Q=99LHzkuLd7kneaU8C=SRC#g=$xmXyY3Dxn{ITS
z=AF3B8|}~^O|74P((CG2*;=UCb2x}Pr#|p#K3?iwrNVDO`*=(07B^bitzWkoZ|!14
zV;EqLU>sv0F#GWMsor4U##MW09dGoLaL>fa?Z?iKLt**PS-vekN{wh{d7vQmrnC3k^>Z)9QTcT_
zJ6R^lT8>LhEI?KW?J
zw3@d3Fw$7s`f-LKY2SCg6h#vVQ>cBbzbjLz6YyZK;uM3dNl;G(;i
zypU4kl-li*yS<|^Owlv^ZSdY=E_obp9FOk-eMH^nu}0h$`!$z`T!$4*g2bs1V|C-Y
zLPwp`%bsVQ@NmsZBcrad<
z>rMPLponr~CW^dPSb49kbz)WZ;T$q2dzQb5@FF5(
zJC~?co(~e&Gaai3mPeYq-PE34QcQiUU{_XGin5@GL&mQi#hZdy1qwYfXJCaTW~&*R
zVVaukuh=t8W=u^TD0Z~ed`F*eIG?2MR8?|*u&}8WMwVk53QzDC$`|cUT$dup?tXe`
z%+t=VdXuso9DDcG-3Si4KpXPQnBth~nDAI0d|xWK>AnfqQTQ);1XNZ%CuogI&FPzS
z>DgLCQIj6BEv?N(UO&NcoTGO8q$4$4MNTwv*E(fkfVBE}N~~(}_`=gw?w@
zP1kAbHB;xU_G2f)_0`wTnaz1A`yVequLMw$sB_cXQPnQFtp8m0>=Mvk(B$%9Uo=@Q
zJ2U0X&(PYfrmfjOGTiBjs=$G}Ro1TEU65PX>_IG_-q}^UF}ze4j#3{By#$|5QUBzx
zM84hIJAZVZ5qc8k#tGIM`VK
zJezf0#XT7Ar7(i=6@G&uL*or0wGXZV5)6L>RY^lxSr7woj158ulY=mTBQWsd2UGm}
zSPc9ObnEwdG!V!a215V4jU4ca`U?SGs6Kyv-U{;pVFBOn124xUw12g}os@LzU&rW6
zz%`JNqOhbS@TsV0ZD0VmF}ASn-#|ScblXxw%?1P_eu8>|B^4g;0rww=y;rqWm6hSv
zvoL4Y(YMewV0JXOL^TKTI&uSt<_5MpG>+zGa2sw%KDys6xPfETX$T$7?I*v?mn@4}$9V
z2?hiNe*SZH0<*wQ+9&^G^`mC}McNYt)i8VU>Ce@IO(O^j9Q!BjJq0z;(EAs4^=SWz
z(Ew7e!Td+FU%XG_NlZe4OZyLu4EvtoFZO@Zp5|T@2wYk@u8RFnmKv~R3jRrZ(Er;@
zCK98-Yq#!_`A6-zQKFl!R)V>hIB|}7a(=an*${I2!{&}|P~h=#N*BFJ7e`M?p~LH$
zazD8IDevfE2ghl`ZcM_mw|Q<`rlDV*&v^PNBjoqx;K!)TwSDzmPiD%CfaaV7!1tb#
zx_{iA+Dwm6j9u!8{U=9{%4Be}U-br5x6B}RXSK=PjDNh<`Rm5FHPbKV)wPrElu__0
zk%|nLhnwg6v9qglabfu7MN}!|PcF!HV^cP*>U31<>^oN`yg&3E|b*!jA!rc{I9
z_1t&EYboi8=_MM{BLoaDRz+&1?rbrD5W4F}pYSY2EYKhJaD6u2U3J>y2Kj0`h3k-g
zOoMPpz&3h(CDx+uxnAqnR}OsX3vJXMyy@qM2C)|xl1tPNkyzr|!bPPrW~?*2vd8Vd
z=7x)hG=x)2hcwj=mD>FHXLtN}Tw9$Ve)BsutTPMmOIp(^aX-J)>AQK0Pj8)HjvqhS
zC2>u|6=Ge{`SV!lX?gU{X}U>u)q(yfWz4-vpM3K@IsiWzOx>-N3xmP3@j
zE7i{n&UJmWA^b6+Xh#b}-PrXy{(co}elu3GF`=S5PSzq>e*9^H*qPSWi>fHUK5rS|
z;kPPOq|aUpxKizrJ#e3`Y29<0XAWOm72=({xj$o=JNNFW9q8v^)!NDk_-3uD#K<9!
zmq+zZhbt4o?oN-=E_-7AJXBeWdR))ng!=vJ{@LR8*MQx>EjM$p?mLC}0rRho{_7p`
zTMD?s*O?1D-~Kg%(?g4(WtY(B2fr+z=Hs&z^~lt40>X5~tg5f*E^=${@aL-6d5|S_&?+W+qR>v{%DC!WY_)53eZaochXnTB1yzC5vpWancM=w(`jTwx
zIY*vRmv3%KAnv{FP7!^
zMqMe?=Jy^%T9lapVms%x^w6#h3_M0n67Ik7>+B8=r&Vj}CF?V?M64n$mnV9$MVPOC
z-!)FfZb`h}l}djRp;|3~e0dx6sYy%;iI%>8e2)r;>k}iStS`NBBPf0&6>RChE?Vs(?4k{%m&?Ftqt=ZqBxq
zEem>u0&RbCAorX?z8;coT3O33UUL}%qFvQu
z(Gn=4GGZx@{%vKfqo;-}W_mM*btpl-9&&SQVD~$JzQY&y_hr=mYqVJ#6?Ksgicvkj
zz~Z1ZV$mx3OOmK37Bs2`vl5PB0aE05#oTvF+Vxx`2TV}zKTV8Y&$MN&4nF5!KEW9>
zlj0odJ1kRlBc<|1nb700$Q)w7xh7W4SdM`g^>%dwb}A8hgFsi1)I;rq@0VB4=mF2<990e&o4A
zw_@8Uxz>&0`|i&N73%3Tu+kH2q$2KewcmEQ)}F%i9?f`w>lMkL!^Wi|PvWxVB&9Q4
zn$=szac6tsy`=vDLD7(*aXl0qI&c62O{i&pmCun5ixyMvtv{6o7(JP|-FH!qi$V}_
zbA7q(t`c7&dy^A{9{k5*pb0Sn<0Zm;)_)Spe|wiAmga0jrtZ;;(H}=>Sf-!0U6UftM^%ipbEHGd-nv*kH+7*9?nvBkoVoPg(?ger@efnF!l0CXG=E(b$
zK4X26cMhmF0xk6*dQQuJ3-ZT{<($#-26?(FgWaP7W^?O^rbUhAQf#UHpNvICKEyre
z(+UC+pWDE_b__86rBB**)Xgz5EIU0Lm|L$?todf)4-)}ClhVo8Cku_@ROoncM2Ytbk~rM
zGyLz7$^r3ueYiKloItQE!KN{R#?#XSeW(7$eE`Q;ZfH-f{Jl_@BdBM~Sur%zeWm8T
zqsad>R%;aiXYV9TNr;Pqn8NN3p=9WQ3PjjUl?KwG1z$1yGu?@=!u~{%+JGPrHeGqd
zr9nNR^8|qXf01p-{g^IoB&-rghMPpdAFz$_bNYXVM8W*q`gESy
zlQEp5A`dM!)}apI(k^YDDmO2QHyz1-k_RmdZ}!1UbGtlYv7B%C
z-elYr1&Q(_r0;AEq!6uGVAC{GQ;WVs&end{8unrSuus6@=~Qs7^Ko&8@7Fuz5-a?{
z4|$Z?j)ai}tMJufULXZp&GxRmttivgTG+G?c^pP~fRPP#~is)TIjA
zUJQWDGV1YlMe<7u+x!24KlJ)`JN1!gxznK`87DkWb0#PK7Hqn*=ne%(cm4-rm=>Oi
z8}fLJ#eA}~uwQx48Uq7^MZf*tfZ$|CqB}Wn$6eir*6p;kzv8^~cMor_PX*L!oy$s`
zFZa7y`@T`EZ2Vc`YW5;
zn3D5Tuo`}SucTBZdzT_ZskgJMtGSg>5ciP|I$(SA4D+KzMo)8+3?6%m9kY&&VLtl5
zOwa2RdR*+h1p6u%EiDsbg2#fXh9BQWlTylNt{75ZoDjrn1oiq%^hN^
z+>y>>+3?AS88K@$hAx|V6cr3OL(PC%1ob8sM~3P=izS3
z4&+AcVmY@c@%)A5q96UFka^SO`4z+bI3OBr3^#iQ(lC`hd>^)?
z6F^Iy>9VnJR*tjJmWfveFT=5@9FvZA=L8Dx;w1tu*{IlZp{b#Ao*oV^wcRNxfslV3
z^6-|HlG=Jle*bdUCRpPGA@vwa&o@P!`kri01zbaEM$_wCB~nN7)Hyd=M(jp&)soX}
z%IeP-7j-XHaN=`|o1I^6oG|)ks=#|x)zqHbtoBBvNk>iAJNIjUXM<0VpA6tyAk!q0
zWw%#VwOKge)5i768^c+8HMdx9el#a;4tyi?DE9{hqW^|Q3CxD)!FO|Ys6)$u=eO=*ICO7vv!EV6
zXKI_ij!Z4-<(BsM_m6vbg3NW8b)tW{#XAAegUj>Y`1Y8>RCeyQ_=X&;o{`yZqubS=
zS8Qvl@VVutl0^fSyz%+ZtZ3G5ntk!3m^G`>1Ff_xVqj%#6)s_2kxbzgbM8F)4|@S<
zCjLj~?#={b@%Cqh{U>FspUPH)1#22vuid&6$FRj?xV#*%-G*zQ{7PB%1DS80n5?HCX)V*H|)s
zTEdpOqV&Eor%R6YDgsbMyd7@R`gMZKPF4Qt*%ANjki5V{dx4X^W_M#X~B_53}#h=+ld+ia^g6a;&-KewMb%bm*+S}
z&|?jiQ)yOTUS1yPhO0b491TjR0h=({dkaRIsGQe+kgp!b(8ho!0gGS^<~@)YzAVU(
z(sr*}g9s(V$l)$$3%;U|)D##rS!Ik`x~%wg)}`+*qZq||N^aXsBqMRPW#G!!m-v4p
zH~lw)7Sqwor9DVXcrs7KBim}$-nb|o^m`KVo`3^$vb`q04-2@8e~iLeUtT2L@N@5S
z7H}QU32z&AoI4CS9mOQ>1CE*;>{ftTuU*D?E)nQK{b>CqYM}w3_dQ1ck<0hl0$g|?
zIeQpu@9Rg7@7oWbE2fWsCi^IE@`a(Yp=CAE1Ae+i$QyiuZU;mvtY93M>%^NY`Yoyq
zGC}DP{>|P>;4XDjMQv0ROpmKb4Jn
zz!445u(wgr+KU{co547G&4(3mU*e+m9}dK+#G7w|<@wK3H!Pt;QXic?vHH
z&dKA}&vg|r06nWErJoWsZneA1h|*91JgTYD;!`OO?jm{An$EusxRjOActc)$K(P@z
z%{~~!ZVR7DM7&KJ0XXZ9!pQUQbovCY_JjxM?ltz@L7@!0SO81eTsB^&_ss;2+)3(5
z6wv0sKKm6SdaSkdnM8|p-+k4eh;eIn=nZixCU#OZ-JM4O8NiPF`jjA!deLA}+!4Ls
zgkQef=#$&5A6gMq72~P^eBscKp$Z
zO0j;&{V~~T0B{dxDbkO@xDQUIEJ$jf1yqRQB(1mX0%`14wFy%63$#GHUMpQbafcjx
zSUYIie#$&~WO{mXu_a(x-s3`1)nlK#K>0P#T9UWOWo#m^Q*rIX3Ofzk0nropO4%W+
zo3l27EhKBkrd3XTq~xf!65xyJa|N6=#kwBPS$8qzBWGea^-2GwGKnJK}pGUOYs3<^q?Wv+jWOkklMY*WbY}E1ceNJXrRu>Z|^)4l)Orr6?f$
zj@#r-PW4AJslQ2&1(yP;QD>#quQw|LUMSy8;F1EZvQGQ@kcY#J3(Z*P@mCZT?n)~N
z>LJN^j&L~W<=MT%$huk9<_tc}(MEQf7Oy(yIT~Dt2^x(C(A8qY`jfmiizh!XmGtqO
z`bJM1lJYthy6yksU`nv+<2#K*g+!fzQ6TwqKa8FG^l7(ra9l5#?z|1
z#h~+Bp%cP(ov!`{x!c^ji9O@MhgkwU+p4HX<~`)MNr#c{^m$yDm>$_)&y
z8PLaHsf$-BuH$Eg%A$l5#YRj5i7L;rOHEFhh~{sHC17eC$66!ow6i_^;x6oAn)ze*
zF;m^_&!e7g`hX{C0PsFe5(?L{Sj^Vk^Yg)@5PN|}z;Y;m%WiWNud4nC5Oe!rnzXRt
zcK;9WHDs+s4^y`RkjDIWT;NgwlG5l7U{$zr+%k49*bC&G#pXEzKv~xzRerAwNt}-U
zUwUH#^fs0OIpiq-CjhJokC`~zRtlJ|1V&T{1Zaq^$J`1FIj_y8^}DfS0K54sPx}v-
zQi#onSNQ7ynRqcG_G_tY=@0`WqbOqy%;AUOP{VgE!I&P#7erYI1<2t*ig?%FLUWJo
zPqwWxc%DqUP+n70Q^>JwJhu{++tEOX75DrydB+-1DJHIcjSqL;DX71`C}c3WxEN$G
zf$sO30f?!t=3*mf#drXBO`5stv007QYs4`mF`F6MZ14FONd>qn&j3%AWmb4D;=`*>
z6*L5c=%`uV$q2v8wwaC&)AKTS0YwcOh146h=8Nfz>iZ6d)g5x!OmGF_ZXxh2J(r^b
z*JE^(dwb4vHs%_)D8o@Iq(=F^bWxhpw)pvUzB5N6FYE-!piM={cjA=(MSN#`Aj{Ih
zV$%PC!SFHmuK>-VNF+GqQUvvEGJ_T-102H2T0`Niku9T$5JoA8Kpw@=XahT54oB8I
z>*A58^*2n39@kFeK@Y8d5}aUotCKR0CVe~k><+AiPv*jqdoxWII;_w~{Dp5M3o1W_
z*=pex!5SC_R)|^$cPPuGr3y{}R5p?@Txq4p^ENG5HioSz$D&FzbwhO9Pg#hz_}kC>olCl`_w%OJN~w*vfI&NAEsDFw(2_`zt*WYHy0M_C|7E
z6!Cw>7?KT&Q6CGLBn-xki=%RqDFd?Ji53VzIxRT`8>7;uOSAGv!MrS~oT>BczuJPM
zxNKI?gNqXZ*YlbRKn{cK-|r=5@1Xr24U^I){$0FdO$WmJrh0>#9V{z9RW
zEfN~fNaX4>)6=(zis6m-Joa1IQ{vlb?+|KNOX2cO>7v;?L>wjTx&V8WFvGNA50F$#
z<*MzKBRMKlnpP%drITf*(vp&r^8$D(u