Skip to content
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
1,818 changes: 734 additions & 1,084 deletions api/pola/v1/pola.pb.go

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions api/pola/v1/pola.proto
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ enum SRPolicyType {
SR_POLICY_TYPE_DYNAMIC = 2;
}

message Waypoint {
string router_id = 1;
string sid = 2; // optional: explicit SID override
}

message SRPolicy {
bytes pcep_session_addr = 1;
bytes src_addr = 2;
Expand All @@ -43,6 +48,7 @@ message SRPolicy {
SRPolicyType type = 9;
repeated Segment segment_list = 10;
MetricType metric = 11;
repeated Waypoint waypoints = 12;
}

message CreateSRPolicyRequest {
Expand Down
2 changes: 1 addition & 1 deletion api/pola/v1/pola_grpc.pb.go

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

17 changes: 16 additions & 1 deletion cmd/pola/sr_policy_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@
SIDStructure string `yaml:"sidStructure"`
}

type Waypoint struct {
RouterID string `yaml:"routerID"`
SID string `yaml:"sid"` // optional: fixed SID override
}

type SRPolicy struct {
PCEPSessionAddr netip.Addr `yaml:"pcepSessionAddr"`
SrcAddr netip.Addr `yaml:"srcAddr"`
Expand All @@ -81,6 +86,7 @@
Color uint32 `yaml:"color"`
Type string `yaml:"type"`
Metric string `yaml:"metric"`
Waypoints []Waypoint `yaml:"waypoints"`
}

type InputFormat struct {
Expand Down Expand Up @@ -154,7 +160,7 @@
return nil
}

func addSRPolicyWithSIDValidation(input InputFormat) error {

Check failure on line 163 in cmd/pola/sr_policy_add.go

View workflow job for this annotation

GitHub Actions / Lint

cyclomatic complexity 17 of func `addSRPolicyWithSIDValidation` is high (> 15) (gocyclo)
sampleInputDynamic := "#case: dynamic path\n" +
"asn: 65000\n" +
"srPolicy:\n" +
Expand Down Expand Up @@ -189,6 +195,7 @@
var srPolicyType pb.SRPolicyType
var metric pb.MetricType
var segmentList []*pb.Segment
var waypoints []*pb.Waypoint
switch input.SRPolicy.Type {
case "explicit":
if len(input.SRPolicy.SegmentList) == 0 {
Expand Down Expand Up @@ -220,7 +227,14 @@
default:
return fmt.Errorf("invalid input `metric`")
}

if len(input.SRPolicy.Waypoints) != 0 {
for _, wp := range input.SRPolicy.Waypoints {
waypoints = append(waypoints, &pb.Waypoint{
RouterId: wp.RouterID,
Sid: wp.SID, // optional
})
}
}
default:
return fmt.Errorf("invalid input `type`")
}
Expand All @@ -234,6 +248,7 @@
Type: srPolicyType,
SegmentList: segmentList,
Metric: metric,
Waypoints: waypoints,
}
inputData := &pb.CreateSRPolicyRequest{
SrPolicy: srPolicy,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
# SRv6 uSID Dynamic Path

Example topology powered by [Containerlab](https://containerlab.dev/)

![Topology](./topo.png)

## 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
```

Clone and build the modified branches:

* Pola PCE: [watal/pola feature/ietf124-srv6-sfc branch](https://github.com/watal/pola/tree/feature/ietf124-srv6-sfc)
* Add the following to `go.mod`:

```text
replace github.com/osrg/gobgp/v4 => ../gobgp # adjust path to your local gobgp
```

* GoBGP: [watal/gobgp feature/bgp-ls-service-segments branch](https://github.com/watal/gobgp/tree/feature/bgp-ls-service-segments)

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-server bash
# gobgpd -f /gobgpd.yml
```

```bash
$ sudo docker exec -it clab-dynamic-path-gobgp-client 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
```

Apply and check SR Policy

```bash
# pola sr-policy add -f /pe02-policy1.yaml -p 50052
success!

# pola sr-policy list -p 50052
root@pola:/# ./pola -p 50052 sr-policy list
Session: fd00::2
PolicyName: DYNAMIC-POLICY
SrcAddr: fd00:ffff::2
DstAddr: fd00:ffff::1
Color: 100
Preference: 0
SegmentList: fcbb:bb00:1004:: -> 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<c6> 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<c6>
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: 2
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:1001::
SID type: srv6-sid, Value: fcbb:bb00:1001::
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
global:
config:
as: 65000
router-id: "10.255.0.255"
neighbors:
- config:
peer-as: 65000
neighbor-address: "fd00::4"
afi-safis:
- config:
afi-safi-name: ls
transport:
config:
local-address: "fd00::5"
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
global:
config:
as: 65000
router-id: "10.255.0.254"
neighbors:
- config:
peer-as: 65000
neighbor-address: "fd00::1"
afi-safis:
- config:
afi-safi-name: ls
transport:
config:
local-address: "fd00::4"
- config:
peer-as: 65000
neighbor-address: "fd00::5"
afi-safis:
- config:
afi-safi-name: ls
transport:
config:
local-address: "fd00::4"
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
global:
pcep:
address: "fd00::3"
port: 4189
grpcServer:
address: "127.0.0.1"
port: 50052
log:
path: "/var/log/pola/"
debug: true
name: "polad.log"
ted:
enable: true
source: "gobgp"
gobgp:
grpcClient:
address: "10.0.0.4"
port: 50051
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
asn: 65000
srPolicy:
pcepSessionAddr: "fd00::2"
srcRouterID: "0000.0001.0002"
dstRouterID: "0000.0001.0001"
name: "DYNAMIC-POLICY"
color: 100
type: dynamic
metric: igp
waypoints:
- routerID: "0000.0001.0003"
- routerID: "0000.0001.0004"
- routerID: "0000.0001.0003"
sid: "fcbb:bb00:1003::"
Loading
Loading