Skip to content

Commit

Permalink
Add examples
Browse files Browse the repository at this point in the history
  • Loading branch information
slankdev committed Feb 2, 2020
1 parent 2c6fc3a commit b17119e
Show file tree
Hide file tree
Showing 210 changed files with 15,112 additions and 0 deletions.
116 changes: 116 additions & 0 deletions examples/basic_bfd/spec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# http://www.asciiflow.com

nodes:
- name: R1
image: slankdev/frr
interfaces:
- { name: net0, type: direct, args: R2#net0 }
- { name: net1, type: direct, args: R3#net0 }
- name: R2
image: slankdev/frr
interfaces:
- { name: net0, type: direct, args: R1#net0 }
- { name: net1, type: direct, args: R4#net0 }
- name: R3
image: slankdev/frr
interfaces:
- { name: net0, type: direct, args: R1#net1 }
- { name: net1, type: direct, args: R4#net1 }
- name: R4
image: slankdev/frr
interfaces:
- { name: net0, type: direct, args: R2#net1 }
- { name: net1, type: direct, args: R3#net1 }

node_configs:
- name: R1
cmds:
- cmd: /usr/lib/frr/frr start
- cmd: >-
vtysh -c 'conf t'
-c 'interface lo'
-c ' ip address 10.255.0.1/32'
-c 'exit'
-c 'interface net0'
-c ' ip address 10.0.0.1/30'
-c ' ip ospf bfd'
-c 'exit'
-c 'interface net1'
-c ' ip address 10.0.0.5/30'
-c ' ip ospf bfd'
-c 'exit'
-c 'router ospf'
-c ' network 10.0.0.0/30 area 0'
-c ' network 10.0.0.4/30 area 0'
-c 'exit'
- name: R2
cmds:
- cmd: /usr/lib/frr/frr start
- cmd: >-
vtysh -c 'conf t'
-c 'interface lo'
-c ' ip address 10.255.0.2/32'
-c 'exit'
-c 'interface net0'
-c ' ip address 10.0.0.2/30'
-c ' ip ospf bfd'
-c 'exit'
-c 'interface net1'
-c ' ip address 10.0.0.9/30'
-c ' ip ospf bfd'
-c 'exit'
-c 'router ospf'
-c ' network 10.0.0.0/30 area 0'
-c ' network 10.0.0.8/30 area 0'
-c 'exit'
- name: R3
cmds:
- cmd: /usr/lib/frr/frr start
- cmd: >-
vtysh -c 'conf t'
-c 'interface lo'
-c ' ip address 10.255.0.3/32'
-c 'exit'
-c 'interface net0'
-c ' ip address 10.0.0.6/30'
-c ' ip ospf bfd'
-c 'exit'
-c 'interface net1'
-c ' ip address 10.0.0.13/30'
-c ' ip ospf bfd'
-c 'exit'
-c 'router ospf'
-c ' network 10.0.0.4/30 area 0'
-c ' network 10.0.0.12/30 area 0'
- name: R4
cmds:
- cmd: /usr/lib/frr/frr start
- cmd: >-
vtysh -c 'conf t'
-c 'interface lo'
-c ' ip address 10.255.0.4/32'
-c 'exit'
-c 'interface net0'
-c ' ip address 10.0.0.10/30'
-c ' ip ospf bfd'
-c 'exit'
-c 'interface net1'
-c ' ip address 10.0.0.14/30'
-c ' ip ospf bfd'
-c 'exit'
-c 'router ospf'
-c ' network 10.0.0.8/30 area 0'
-c ' network 10.0.0.12/30 area 0'
test:
- cmds:
## P2P Link test
- cmd: docker exec R1 ping -c2 10.0.0.2
- cmd: docker exec R1 ping -c2 10.0.0.6
- cmd: docker exec R2 ping -c2 10.0.0.1
- cmd: docker exec R2 ping -c2 10.0.0.10
- cmd: docker exec R3 ping -c2 10.0.0.5
- cmd: docker exec R3 ping -c2 10.0.0.14
- cmd: docker exec R4 ping -c2 10.0.0.9
- cmd: docker exec R4 ping -c2 10.0.0.13

Binary file added examples/basic_bfd/topo.jpeg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions examples/basic_bgp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

# BGP Playground


25 changes: 25 additions & 0 deletions examples/basic_bgp/hv_bgp_dcn/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

# HV route advertisement study for BGP-DCN

- [GOOD reference about routing-info manupulation by @ukinau](https://engineering.linecorp.com/ja/blog/openstack-summit-vancouver-2018-recap-2-2/)
- [GOOD reference about proxy arp by @ukinau](https://qiita.com/ukinau/items/cb25588fb0c276a009dc)

![](topo.png)

```
docker exec TOR vtysh -c 'show bgp ipv4 unicast'
BGP table version is 4, local router ID is 10.255.0.99, vrf id 0
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.1/32 0.0.0.0 0 32768 ?
*> 10.0.0.11/32 dn1 0 0 65001 ?
*> 10.0.0.12/32 dn1 0 0 65001 ?
*> 10.0.0.13/32 dn1 0 0 65001 ?
Displayed 4 routes and 4 total paths
```

98 changes: 98 additions & 0 deletions examples/basic_bgp/hv_bgp_dcn/spec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@

nodes:
- name: TOR
image: slankdev/frr
interfaces:
- { name: dn1, type: direct, args: HV1#up1 }
- name: HV1
image: slankdev/frr
interfaces:
- { name: up1, type: direct, args: TOR#dn1 }
- { name: dn1, type: direct, args: VM1#net0 }
- { name: dn2, type: direct, args: VM2#net0 }
- { name: dn3, type: direct, args: VM3#net0 }
- name: VM1
image: slankdev/frr
interfaces:
- { name: net0, type: direct, args: HV1#dn1 }
- name: VM2
image: slankdev/frr
interfaces:
- { name: net0, type: direct, args: HV1#dn2 }
- name: VM3
image: slankdev/frr
interfaces:
- { name: net0, type: direct, args: HV1#dn3 }

node_configs:
- name: TOR
cmds:
- cmd: sh -c "enable_seg6_router.py | sh"
- cmd: ip addr add 1.1.1.1/32 dev lo
- cmd: /usr/lib/frr/frr start
- cmd: >-
vtysh -c 'conf t'
-c 'interface dn1'
-c ' ipv6 nd ra-interval 3'
-c ' no ipv6 nd suppress-ra'
-c '!'
-c 'router bgp 65099'
-c ' bgp router-id 10.255.0.99'
-c ' bgp bestpath as-path multipath-relax'
-c ' neighbor PEER peer-group'
-c ' neighbor PEER remote-as external'
-c ' neighbor dn1 interface peer-group PEER'
-c '!'
-c ' address-family ipv4 unicast'
-c ' neighbor dn1 activate'
-c ' redistribute connected'
-c ' exit-address-family'
- name: HV1
cmds:
- cmd: sh -c "enable_seg6_router.py | sh"
- cmd: ip addr add 10.0.0.1/24 dev dn1
- cmd: ip addr add 10.0.0.1/24 dev dn2
- cmd: ip addr add 10.0.0.1/24 dev dn3
- cmd: ip route add 10.0.0.11 dev dn1
- cmd: ip route add 10.0.0.12 dev dn2
- cmd: ip route add 10.0.0.13 dev dn3
- cmd: sysctl -w net.ipv4.conf.dn1.proxy_arp=1
- cmd: sysctl -w net.ipv4.conf.dn2.proxy_arp=1
- cmd: sysctl -w net.ipv4.conf.dn3.proxy_arp=1
- cmd: /usr/lib/frr/frr start
- cmd: >-
vtysh -c 'conf t'
-c 'interface up1'
-c ' ipv6 nd ra-interval 3'
-c ' no ipv6 nd suppress-ra'
-c '!'
-c 'router bgp 65001'
-c ' bgp router-id 10.255.0.1'
-c ' bgp bestpath as-path multipath-relax'
-c ' neighbor PEER peer-group'
-c ' neighbor PEER remote-as external'
-c ' neighbor up1 interface peer-group PEER'
-c ' !'
-c ' address-family ipv4 unicast'
-c ' redistribute kernel route-map TO_TOR'
-c ' neighbor up1 route-map TO_TOR out'
-c ' exit-address-family'
-c '!'
-c 'route-map TO_TOR permit 1'
-c 'match ip address prefix-len 32'
-c 'exit'
- name: VM1
cmds:
- cmd: ip addr add 10.0.0.11/24 dev net0
- cmd: ip route add default via 10.0.0.1
- name: VM2
cmds:
- cmd: ip addr add 10.0.0.12/24 dev net0
- cmd: ip route add default via 10.0.0.1
- name: VM3
cmds:
- cmd: ip addr add 10.0.0.13/24 dev net0
- cmd: ip route add default via 10.0.0.1

Binary file added examples/basic_bgp/hv_bgp_dcn/topo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions examples/basic_bgp/hv_bgp_dcn_isol/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

sh:
docker exec TOR vtysh -c 'show bgp ipv4 vpn'
25 changes: 25 additions & 0 deletions examples/basic_bgp/hv_bgp_dcn_isol/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

# HV route advertisement study for BGP-DCN

- [GOOD reference about routing-info manupulation by @ukinau](https://engineering.linecorp.com/ja/blog/openstack-summit-vancouver-2018-recap-2-2/)
- [GOOD reference about proxy arp by @ukinau](https://qiita.com/ukinau/items/cb25588fb0c276a009dc)

![](topo.png)

```
docker exec TOR vtysh -c 'show bgp ipv4 unicast'
BGP table version is 4, local router ID is 10.255.0.99, vrf id 0
Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 1.1.1.1/32 0.0.0.0 0 32768 ?
*> 10.0.0.11/32 dn1 0 0 65001 ?
*> 10.0.0.12/32 dn1 0 0 65001 ?
*> 10.0.0.13/32 dn1 0 0 65001 ?
Displayed 4 routes and 4 total paths
```

0 comments on commit b17119e

Please sign in to comment.