Skip to content

Update Interface for SRv6 Dynamic Path Calculation #230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
640 changes: 430 additions & 210 deletions api/pola/v1/pola.pb.go

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions api/pola/v1/pola.proto
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,24 @@ message SRPolicyList {
repeated SRPolicy sr_policies = 1;
}

message LsSrv6SID {
repeated SID sids = 1;
uint32 endpoint_behavior = 2;
repeated MultiTopoID multi_topo_ids = 3;
uint32 service_type = 4;
uint32 traffic_type = 5;
uint32 opaque_type = 6;
bytes value = 7;
}

message SID {
string sid = 1;
}

message MultiTopoID {
uint32 multi_topo_id = 1;
}

message LsPrefix {
string prefix = 1;
uint32 sid_index = 2;
Expand Down Expand Up @@ -123,6 +141,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 {
Expand Down
42 changes: 30 additions & 12 deletions api/pola/v1/pola_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 28 additions & 2 deletions cmd/pola/grpc/grpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
Loading