-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsrl_netbox.yaml
192 lines (178 loc) · 5.5 KB
/
srl_netbox.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# This Containerlab configuration, 'lab01', sets up a network simulation environment with spine and leaf switches.
# The key component is Netbox, which manages the network inventory. Netbox waits for its dependencies (PostgreSQL and Redis)
# to be ready, then initializes and creates an admin user.
name: lab01
prefix: ""
mgmt:
network: lab01
bridge: lab01
ipv4-subnet: 172.20.21.0/24
topology:
kinds:
srl:
image: ghcr.io/nokia/srlinux:24.3.2
linux:
image: ghcr.io/hellt/network-multitool
nodes:
lab01-l1:
kind: srl
type: ixrd2
mgmt-ipv4: 172.20.21.11
labels:
graph-level: 2
graph-icon: switch
lab01-l2:
kind: srl
type: ixrd2
mgmt-ipv4: 172.20.21.12
labels:
graph-level: 2
graph-icon: switch
lab01-l3:
kind: srl
type: ixrd2
mgmt-ipv4: 172.20.21.13
labels:
graph-level: 2
graph-icon: switch
lab01-l4:
kind: srl
type: ixrd2
mgmt-ipv4: 172.20.21.14
labels:
graph-level: 2
graph-icon: switch
lab01-s1:
kind: srl
type: ixrd3l
mgmt-ipv4: 172.20.21.101
labels:
graph-level: 1
graph-icon: switch
lab01-s2:
kind: srl
type: ixrd3l
mgmt-ipv4: 172.20.21.102
labels:
graph-level: 1
graph-icon: switch
lab01-client1:
kind: linux
mgmt-ipv4: 172.20.21.133
labels:
graph-level: 3
graph-icon: host
exec:
- ip link add bond0 type bond mode 802.3ad
- ip link set addr 00:c1:ab:00:01:21 dev bond0
- ip link add link bond0 name bond0.201 type vlan id 201
- ip addr add 10.20.1.2/24 dev bond0.201
- ip link set eth1 down
- ip link set eth2 down
- ip link set eth1 master bond0
- ip link set eth2 master bond0
- ip link set eth1 up
- ip link set eth2 up
- ip link set bond0 up
- ip route add 10.20.2.0/24 via 10.20.1.254
lab01-client2:
kind: linux
mgmt-ipv4: 172.20.21.134
labels:
graph-level: 3
graph-icon: host
exec:
- ip link add bond0 type bond mode 802.3ad
- ip link set addr 00:c1:ab:00:01:22 dev bond0
- ip link add link bond0 name bond0.202 type vlan id 202
- ip addr add 10.20.2.2/24 dev bond0.202
- ip link set eth1 down
- ip link set eth2 down
- ip link set eth1 master bond0
- ip link set eth2 master bond0
- ip link set eth1 up
- ip link set eth2 up
- ip link set bond0 up
- ip route add 10.20.1.0/24 via 10.20.2.254
### Netbox ###
# Configuration for PostgreSQL, Redis, and Netbox for network inventory management
postgres:
kind: linux
image: docker.io/postgres:16-alpine
env:
POSTGRES_DB: netbox
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
redis:
kind: linux
image: docker.io/redis:7-alpine
netbox:
# Netbox configuration with dependencies on postgres and redis
kind: linux
image: lscr.io/linuxserver/netbox:3.6.9
env:
PUID: 0
PGID: 0
TZ: Etc/UTC
SKIP_SUPERUSER: false
SUPERUSER_EMAIL: admin@admin.com
SUPERUSER_NAME: admin
SUPERUSER_PASSWORD: admin
SUPERUSER_API_TOKEN: c4cd2e9bf74869feb061eba14b090b4811353d9c
ALLOWED_HOST: "*"
DEBUG: true
DB_NAME: netbox
DB_USER: postgres
DB_PASSWORD: postgres
DB_HOST: postgres
DB_PORT: 5432
REDIS_HOST: redis
REDIS_PORT: 6379
ports:
- 8000:8000
healthcheck:
test: ["CMD-SHELL", "curl -f http://netbox:8000/api/ || exit 1"]
timeout: 10
retries: 100
stages:
create:
wait-for:
- node: postgres
stage: create
- node: redis
stage: create
healthy:
exec:
on-exit:
- sh -c "echo \"from django.contrib.auth.models import User; from users.models import Token; User.objects.get(username='admin').tokens.create(key='c4cd2e9bf74869feb061eba14b090b4811353d9c')\" | /app/netbox/netbox/manage.py shell --interface python"
binds:
- config/configuration.py:/config/configuration.py
- nokia-srl-netbox-scripts:/config/scripts
netbox_importer:
kind: linux
image: flosch62/netbox-importer:latest
env:
REPO_URL: https://github.com/netbox-community/devicetype-library.git
NETBOX_URL: http://netbox:8000
NETBOX_TOKEN: c4cd2e9bf74869feb061eba14b090b4811353d9c
IGNORE_SSL_ERRORS: False
# https_proxy: http://10.158.100.1:8080
entrypoint: ./nb-dt-import.py --vendors Nokia
stages:
create:
wait-for:
- node: netbox
stage: healthy
links:
- endpoints: ["lab01-l1:e1-50", "lab01-s1:e1-1"]
- endpoints: ["lab01-l1:e1-49", "lab01-s2:e1-1"]
- endpoints: ["lab01-l2:e1-50", "lab01-s1:e1-2"]
- endpoints: ["lab01-l2:e1-49", "lab01-s2:e1-2"]
- endpoints: ["lab01-l3:e1-50", "lab01-s1:e1-3"]
- endpoints: ["lab01-l3:e1-49", "lab01-s2:e1-3"]
- endpoints: ["lab01-l4:e1-50", "lab01-s1:e1-4"]
- endpoints: ["lab01-l4:e1-49", "lab01-s2:e1-4"]
- endpoints: ["lab01-client1:eth1", "lab01-l1:e1-1"]
- endpoints: ["lab01-client1:eth2", "lab01-l2:e1-1"]
- endpoints: ["lab01-client2:eth1", "lab01-l3:e1-1"]
- endpoints: ["lab01-client2:eth2", "lab01-l4:e1-1"]