Skip to content

Commit

Permalink
add interoperability containerlab
Browse files Browse the repository at this point in the history
  • Loading branch information
rcgoodfellow committed Apr 26, 2024
1 parent 264d5a2 commit e911b1c
Show file tree
Hide file tree
Showing 20 changed files with 713 additions and 1 deletion.
1 change: 1 addition & 0 deletions clab/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
clab-pop
4 changes: 4 additions & 0 deletions clab/cdn-set-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

curl -s 'http://admin:NokiaSrl1!@clab-pop-cdn/jsonrpc' -d @cdn.json
echo;
152 changes: 152 additions & 0 deletions clab/cdn.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
{
"jsonrpc": "2.0",
"id": 0,
"method": "set",
"params": {
"commands": [
{
"action": "update",
"path": "/",
"value":
{
"interface": [
{
"name": "ethernet-1/1",
"subinterface": [
{
"index": 0,
"admin-state": "enable",
"ipv4": {
"admin-state": "enable",
"address": [
{
"ip-prefix": "169.254.20.1/30",
"primary": [null]
}
]
}
}
]
},
{
"name": "ethernet-1/2",
"subinterface": [
{
"index": 0,
"type": "routed",
"admin-state": "enable",
"ipv4": {
"admin-state": "enable",
"address": [
{
"ip-prefix": "2.3.4.5/24"
}
]
}
}
]
}
],
"network-instance": [
{
"name": "default",
"interface": [
{
"name": "ethernet-1/1.0"
},
{
"name": "ethernet-1/2.0"
}
],
"protocols": {
"bgp": {
"admin-state": "enable",
"autonomous-system": 64501,
"export-policy": "all",
"router-id": "2.3.4.5",
"afi-safi": [
{
"afi-safi-name": "ipv4-unicast",
"admin-state": "enable"
}
],
"group": [
{
"group-name": "oxpop",
"admin-state": "enable",
"afi-safi": [
{
"afi-safi-name": "ipv4-unicast",
"admin-state": "enable"
}
],
"trace-options": {
"flag": [
{
"name": "events"
}
]
}
}
],
"neighbor": [
{
"peer-address": "169.254.20.2",
"description": "oxide point of presence",
"peer-as": 65547,
"peer-group": "oxpop",
"authentication": {
"password": "$aes1$ATTuNB0NU2L7AW8=$HpBACI63gldrmF9SBkiuPQ=="
},
"multihop": {
"admin-state": "enable",
"maximum-hops": 255
},
"local-as": {
"as-number": 64501
}
}
]
}
},
"static-routes": {
"admin-state": "enable",
"route": [
{
"prefix": "0.0.0.0/0",
"admin-state": "enable",
"next-hop-group": "upstream"
}
]
},
"next-hop-groups": {
"group": [
{
"name": "upstream",
"admin-state": "enable",
"nexthop": [
{
"index": 1,
"ip-address": "2.3.4.1"
}
]
}
]
}
}
],
"routing-policy": {
"policy": [
{
"name": "all",
"default-action": {
"policy-result": "accept"
}
}
]
}
}
}
]
}
}
17 changes: 17 additions & 0 deletions clab/get-bgp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

curl -s 'http://admin:NokiaSrl1!@clab-pop-transit/jsonrpc' -d @- <<EOF | jq
{
"jsonrpc": "2.0",
"id": 0,
"method": "get",
"params": {
"commands": [
{
"path": "/network-instance[name=default]/protocols/bgp",
"datastore": "state"
}
]
}
}
EOF
17 changes: 17 additions & 0 deletions clab/get-imported.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

curl -s 'http://admin:NokiaSrl1!@clab-pop-transit/jsonrpc' -d @- <<EOF | jq
{
"jsonrpc": "2.0",
"id": 0,
"method": "get",
"params": {
"commands": [
{
"path": "/network-instance[name=default]/protocols/bgp/neighbor[peer-address=169.254.20.2]/afi-safi[afi-safi-name=ipv4-unicast]/received-routes",
"datastore": "state"
}
]
}
}
EOF
17 changes: 17 additions & 0 deletions clab/get-rib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

curl -s 'http://admin:NokiaSrl1!@clab-pop-transit/jsonrpc' -d @- <<EOF | jq
{
"jsonrpc": "2.0",
"id": 0,
"method": "get",
"params": {
"commands": [
{
"path": "/network-instance[name=default]/bgp-rib/afi-safi[afi-safi-name=ipv4-unicast]",
"datastore": "state"
}
]
}
}
EOF
6 changes: 6 additions & 0 deletions clab/lab-init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

./transit-set-config.sh
./cdn-set-config.sh
./pcloud-set-config.sh
./mgd-setup.sh
3 changes: 3 additions & 0 deletions clab/mgd-addr.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

addr=`host -t A -4 clab-pop-oxpop | awk '{print $4}'`
11 changes: 11 additions & 0 deletions clab/mgd-setup-bad-asn.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

addr=`host -t A -4 clab-pop-oxpop | awk '{print $4}'`

~/src/maghemite/target/debug/mgadm -a $addr \
bgp add-router 65547 1701 0.0.0.0:0

~/src/maghemite/target/debug/mgadm -a $addr \
bgp add-neighbor 65547 transit 169.254.20.1 qsfp0 \
--remote-asn 64502 \
--min-ttl 255
17 changes: 17 additions & 0 deletions clab/mgd-setup-ibgp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

addr=`host -t A -4 clab-pop-oxpop | awk '{print $4}'`

~/src/maghemite/target/debug/mgadm -a $addr \
bgp add-router 64501 1701 0.0.0.0:0

~/src/maghemite/target/debug/mgadm -a $addr \
bgp add-neighbor 64501 transit 169.254.20.1 qsfp0 \
--remote-asn 64501 \
--min-ttl 255 \
--md5-auth-key hypermuffin \
--hold-time 900 \
--keepalive-time 300 \
--communities 3081893 \
--local-pref 47 \
--med 99
39 changes: 39 additions & 0 deletions clab/mgd-setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

addr=`host -t A -4 clab-pop-oxpop | awk '{print $4}'`

~/src/maghemite/target/debug/mgadm -a $addr \
bgp add-router 65547 1701 0.0.0.0:0

# transit
~/src/maghemite/target/debug/mgadm -a $addr \
bgp add-neighbor 65547 transit 169.254.10.1 qsfp0 \
--remote-asn 64500 \
--min-ttl 255 \
--md5-auth-key hypermuffin \
--hold-time 900 \
--keepalive-time 300 \
--communities 1287493 \
--med 99

# cdn
~/src/maghemite/target/debug/mgadm -a $addr \
bgp add-neighbor 65547 cdn 169.254.20.1 qsfp1 \
--remote-asn 64501 \
--min-ttl 255 \
--md5-auth-key hypermuffin \
--hold-time 900 \
--keepalive-time 300 \
--communities 3081893 \
--med 99

# public cloud
~/src/maghemite/target/debug/mgadm -a $addr \
bgp add-neighbor 65547 pcloud 169.254.30.1 qsfp2 \
--remote-asn 64502 \
--min-ttl 255 \
--md5-auth-key hypermuffin \
--hold-time 900 \
--keepalive-time 300 \
--communities 8675309 \
--med 99
30 changes: 30 additions & 0 deletions clab/oxpop.clab.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: pop
topology:
nodes:
transit:
kind: nokia_srlinux
image: ghcr.io/nokia/srlinux
cdn:
kind: nokia_srlinux
image: ghcr.io/nokia/srlinux
pcloud:
kind: nokia_srlinux
image: ghcr.io/nokia/srlinux
oxpop:
kind: linux
image: ubuntu:22.04
binds:
- /home/ry/src/maghemite/target/debug/mgd:/opt/oxide/mgd
- ./run-mgd.sh:/opt/oxide/run-mgd.sh
ports:
- 4676:4676/tcp
cmd: /opt/oxide/run-mgd.sh
links:
- endpoints: ["transit:e1-1", "oxpop:eth1"]
- endpoints: ["transit:e1-2", "host:transit_e1-2"]

- endpoints: ["cdn:e1-1", "oxpop:eth2"]
- endpoints: ["cdn:e1-2", "host:cdn_e1-2"]

- endpoints: ["pcloud:e1-1", "oxpop:eth3"]
- endpoints: ["pcloud:e1-2", "host:pcloud_e1-2"]
4 changes: 4 additions & 0 deletions clab/pcloud-set-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

curl -s 'http://admin:NokiaSrl1!@clab-pop-pcloud/jsonrpc' -d @pcloud.json
echo;
Loading

0 comments on commit e911b1c

Please sign in to comment.