Skip to content

Commit

Permalink
Merge pull request #34 from nttcom/feature/update_example
Browse files Browse the repository at this point in the history
Update pola example
  • Loading branch information
watal authored Nov 28, 2022
2 parents 8ab47fc + 8fa8f20 commit a7f7c37
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 30 deletions.
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
12 changes: 12 additions & 0 deletions .github/workflows/editerconfig-checker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: EditorConfig Checker

on:
push:

jobs:
editorconfig:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: editorconfig-checker/action-editorconfig-checker@main
- run: editorconfig-checker
2 changes: 2 additions & 0 deletions .github/workflows/ghcr.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Push Docker image

on:
push:
branches-ignore:
Expand Down
2 changes: 1 addition & 1 deletion build/package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ docker run -itd --network pcep_net --ip <PCE Address> \

# Connect the container's PCC to the network
docker network connect pcep_net <PCC container name>
```
```
17 changes: 17 additions & 0 deletions examples/package/frr.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM frrouting/frr:latest
LABEL maintainer "Motoki TAKENAKA <[email protected]>"

SHELL ["/bin/bash", "-l", "-c"]

# Install packages
RUN apk update \
&& apk add tcpdump

# Setup FRRouting
RUN sed -i -e 's/=no/=yes/g' /etc/frr/daemons \
&& sed -i -e 's/pathd_options=" -A 127.0.0.1"/pathd_options=" -A 127.0.0.1 -M pathd_pcep"/g' /etc/frr/daemons \
&& touch /etc/frr/vtysh.conf \
&& echo "service integrated-vtysh-config" >> /etc/frr/vtysh.conf \
&& mkdir /var/log/frr \
&& touch /var/log/frr/frr.log \
&& chmod 766 /var/log/frr/frr.log
8 changes: 8 additions & 0 deletions examples/package/host_ubuntu.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM ubuntu:20.04
LABEL maintainer "Motoki TAKENAKA <[email protected]>"

SHELL ["/bin/bash", "-c"]

# Install packages
RUN apt update \
&& apt install -y iproute2 iperf iputils-ping tcpdump tmux traceroute vim
7 changes: 7 additions & 0 deletions examples/package/pola.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM ghcr.io/nttcom/pola:latest
LABEL maintainer "Motoki TAKENAKA <[email protected]>"

SHELL ["/bin/bash", "-c"]

RUN apt update \
&& apt install -y iputils-ping tcpdump tmux vim
24 changes: 14 additions & 10 deletions examples/sr-mpls_l3vpn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,31 +43,35 @@ Create policy1.yaml (Apply Segment List 16002/16004/16003 to pe01)
```
```
srPolicy:
name: name
peerAddr: 10.0.255.1
name: policy1
pcepSessionAddr: 10.0.255.1
srcAddr: 10.255.0.1
dstAddr: 10.255.0.3
color: 1
segmentlist:
segmentList:
- sid: 16002
nai: 10.255.0.2
- sid: 16004
nai: 10.255.0.4
nai: 10.255.0.4
- sid: 16003
nai: 10.255.0.3
```

Apply and check SR Policy
```
# pola lsp add -f policy1.yaml
# pola sr-policy add -f policy1.yaml --no-link-state
success!
# pola lsp list
lsp(0):
peerAddr: 10.0.255.1
policyName: name
# pola sr-policy list
LSP(0):
PcepSessionAddr: 10.0.255.1
PolicyName: policy1
SrcAddr: 10.0.255.1
DstAddr: 10.255.0.3
path: 16002 -> 16004 -> 16003
Color: 0
Preference: 0
DstAddr: 10.255.0.3
SegmentList: 16002 -> 16004 -> 16003
```

Expand Down
36 changes: 17 additions & 19 deletions examples/sr-mpls_l3vpn/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,58 @@ preinit:
- cmd: modprobe mpls_router
- cmd: modprobe mpls_gso
- cmd: modprobe mpls_iptunnel
# Install Pola Docker Images
- cmd: NAME_IMAGE=pola:latest
- cmd: if [ "$(docker image ls -q $NAME_IMAGE)" = "" ]; then docker build -t $NAME_IMAGE -f ../package/pola.Dockerfile ../package;fi
# Install FRR Docker Images
- cmd: NAME_IMAGE=frr:latest
- cmd: if [ "$(docker image ls -q $NAME_IMAGE)" = "" ]; then docker build -t $NAME_IMAGE -f ../package/frr.Dockerfile ../package;fi
# Install host_ubuntu Docker Images
- cmd: NAME_IMAGE=host_ubuntu:latest
- cmd: if [ "$(docker image ls -q $NAME_IMAGE)" = "" ]; then docker build -t $NAME_IMAGE -f ../package/host_ubuntu.Dockerfile ../package;fi


postinit:
- cmds:
- cmd: docker cp polad/polad.yaml pola:/config.yaml

nodes:
- name: pola
image: watal/pola:latest
image: pola:latest
interfaces:
- { name: net0, type: bridge, args: Switch }
- name: pe01
image: watal/frr:latest
image: frr:latest
interfaces:
- { name: net0, type: direct, args: p01#net0 }
- { name: net1, type: direct, args: p02#net0 }
- { name: net2, type: direct, args: host01#net0 }
- { name: net3, type: bridge, args: Switch }
- name: pe02
image: watal/frr:latest
image: frr:latest
interfaces:
- { name: net0, type: direct, args: p01#net1 }
- { name: net1, type: direct, args: p02#net1 }
- { name: net2, type: direct, args: host02#net0 }
- { name: net3, type: bridge, args: Switch }
- name: p01
image: watal/frr:latest
image: frr:latest
interfaces:
- { name: net0, type: direct, args: pe01#net0 }
- { name: net1, type: direct, args: pe02#net0 }
- { name: net2, type: direct, args: p02#net2 }
- name: p02
image: watal/frr:latest
image: frr:latest
interfaces:
- { name: net0, type: direct, args: pe01#net1 }
- { name: net1, type: direct, args: pe02#net1 }
- { name: net2, type: direct, args: p01#net2 }
- name: host01
image: watal/ubuntu:20.04
image: host_ubuntu:latest
interfaces:
- { name: net0, type: direct, args: pe01#net2 }
- name: host02
image: watal/ubuntu:20.04
image: host_ubuntu:latest
interfaces:
- { name: net0, type: direct, args: pe02#net2 }

Expand All @@ -62,9 +72,6 @@ node_configs:
- cmd: '/usr/local/go/bin/polad -f config.yaml > /dev/null 2>&1 &'
- name: pe01
cmds:
- cmd: /usr/lib/frr/frr start
- cmd: sed -i -e 's/=no/=yes/g' /etc/frr/daemons
- cmd: /usr/lib/frr/frrinit.sh restart
- cmd: sysctl -w net.ipv4.ip_forward=1
- cmd: sysctl -w net.mpls.conf.lo.input=1
- cmd: sysctl -w net.mpls.conf.net0.input=1
Expand Down Expand Up @@ -145,9 +152,6 @@ node_configs:
-c 'exit'
- name: pe02
cmds:
- cmd: /usr/lib/frr/frr start
- cmd: sed -i -e 's/=no/=yes/g' /etc/frr/daemons
- cmd: /usr/lib/frr/frrinit.sh restart
- cmd: sysctl -w net.ipv4.ip_forward=1
- cmd: sysctl -w net.mpls.conf.lo.input=1
- cmd: sysctl -w net.mpls.conf.net0.input=1
Expand Down Expand Up @@ -207,9 +211,6 @@ node_configs:
-c 'exit'
- name: p01
cmds:
- cmd: /usr/lib/frr/frr start
- cmd: sed -i -e 's/=no/=yes/g' /etc/frr/daemons
- cmd: /usr/lib/frr/frrinit.sh restart
- cmd: sysctl -w net.ipv4.ip_forward=1
- cmd: sysctl -w net.mpls.conf.lo.input=1
- cmd: sysctl -w net.mpls.conf.net0.input=1
Expand Down Expand Up @@ -248,9 +249,6 @@ node_configs:
-c 'exit'
- name: p02
cmds:
- cmd: /usr/lib/frr/frr start
- cmd: sed -i -e 's/=no/=yes/g' /etc/frr/daemons
- cmd: /usr/lib/frr/frrinit.sh restart
- cmd: sysctl -w net.ipv4.ip_forward=1
- cmd: sysctl -w net.mpls.conf.lo.input=1
- cmd: sysctl -w net.mpls.conf.net0.input=1
Expand Down

0 comments on commit a7f7c37

Please sign in to comment.