-
Notifications
You must be signed in to change notification settings - Fork 9
183 lines (171 loc) · 5.71 KB
/
wf.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
name: deploy
on:
workflow_dispatch:
push:
tags:
- v*
jobs:
install_containerlab:
runs-on:
- self-hosted
- kss
steps:
- run: bash -c "$(curl -sL https://get-clab.srlinux.dev)"
install_gnmic:
runs-on:
- self-hosted
- kss
steps:
- run: bash -c "$(curl -sL https://get-gnmic.kmrd.dev)"
deploy_lab:
runs-on:
- self-hosted
- kss
needs:
- install_containerlab
- install_gnmic
steps:
- uses: actions/checkout@v2
- run: sudo clab deploy -t nanog83.clab.yaml --reconfigure
configure_interfaces:
runs-on:
- self-hosted
- kss
needs:
- deploy_lab
steps:
- run: |
gnmic --log \
-a $(docker ps -f label=clab-node-kind=srl -f label=containerlab=nanog83 --format {{.Names}} | paste -s -d, -) \
--tls-ca clab-nanog83/ca/root/root-ca.pem \
-u admin \
-p admin \
-e json_ietf \
set \
--request-file config/1.interfaces/interfaces_template.gotmpl \
--request-vars config/1.interfaces/interfaces_template_vars.yaml
configure_subinterfaces:
runs-on:
- self-hosted
- kss
needs:
- configure_interfaces
steps:
- run: |
gnmic --log \
-a $(docker ps -f label=clab-node-kind=srl -f label=containerlab=nanog83 --format {{.Names}} | paste -s -d, -) \
--tls-ca clab-nanog83/ca/root/root-ca.pem \
-u admin \
-p admin \
-e json_ietf \
set \
--request-file config/1.interfaces/subinterfaces_template.gotmpl \
--request-vars config/1.interfaces/interfaces_template_vars.yaml
configure_routing_policy:
runs-on:
- self-hosted
- kss
needs:
- deploy_lab
steps:
- run: |
gnmic --log \
-a $(docker ps -f label=clab-node-kind=srl -f label=containerlab=nanog83 --format {{.Names}} | paste -s -d, -) \
--tls-ca clab-nanog83/ca/root/root-ca.pem \
-u admin \
-p admin \
-e json_ietf \
set \
--request-file config/2.routing-policy/routing_policy_prefix_set_template.gotmpl \
--request-file config/2.routing-policy/routing_policy_policy_template.gotmpl \
--request-vars config/2.routing-policy/routing_policy_vars.yaml
configure_network_instance:
runs-on:
- self-hosted
- kss
needs:
- configure_subinterfaces
- configure_routing_policy
steps:
- run: |
gnmic --log \
-a $(docker ps -f label=clab-node-kind=srl -f label=containerlab=nanog83 --format {{.Names}} | paste -s -d, -) \
--tls-ca clab-nanog83/ca/root/root-ca.pem \
-u admin \
-p admin \
-e json_ietf \
set \
--request-file config/3.network-instance/network_instance_template.gotmpl \
--request-vars config/3.network-instance/network_instance_template_vars.yaml
configure_bgp:
runs-on:
- self-hosted
- kss
needs:
- configure_network_instance
steps:
- run: |
gnmic --log \
-a $(docker ps -f label=clab-node-kind=srl -f label=containerlab=nanog83 --format {{.Names}} | paste -s -d, -) \
--tls-ca clab-nanog83/ca/root/root-ca.pem \
-u admin \
-p admin \
-e json_ietf \
set \
--request-file config/3.network-instance/network_instance_bgp_template.gotmpl \
--request-vars config/3.network-instance/network_instance_template_vars.yaml
check_bgp_status:
runs-on:
- self-hosted
- kss
needs:
- configure_bgp
steps:
- run: |
sleep 5
for node in $(docker ps -f label=clab-node-kind=srl -f label=containerlab=nanog83 --format {{.Names}})
do
bgp_state=$(
gnmic -a $node \
--tls-ca clab-nanog83/ca/root/root-ca.pem \
-u admin \
-p admin \
-e ascii \
--format flat \
get \
--path /network-instance[name=default]/protocols/bgp/oper-state | awk '{print $NF}'
)
if [ $bgp_state != "up" ]; then
printf "unexpected BGP state for node $node : ${bgp_state^^} (ノ ゜Д゜)ノ ︵ ┻━┻\n"
exit 1
fi
printf "$(date): \\U1F44D $node BGP state is ${bgp_state^^} \n"
done
check_bgp_neighbors:
runs-on:
- self-hosted
- kss
needs:
- check_bgp_status
steps:
- run: |
sleep 15
for node in $(docker ps -f label=clab-node-kind=srl -f label=containerlab=nanog83 -f label=clab-node-group=spines --format {{.Names}})
do
num_neighbors=$(
gnmic -a $node \
--tls-ca clab-nanog83/ca/root/root-ca.pem \
-u admin \
-p admin \
-e ascii \
--format flat \
get \
--path /network-instance[name=default]/protocols/bgp/neighbor/ipv4-unicast/oper-state | grep neighbor | wc -l
)
if [ "$num_neighbors" -ne "6" ]
then
printf "unexpected number of neighbors for node $node : $num_neighbors (ノ ゜Д゜)ノ ︵ ┻━┻\n"
exit 1
fi
printf "$(date): \\U1F44D $node has $num_neighbors BGP neighbors \n"
done