Skip to content

Commit 71ca0f5

Browse files
sajusalhellt
andauthored
gNOI software upgrade (#202)
* Added gnoi sofware upgrade * formatting and gnoi in the toc --------- Co-authored-by: hellt <[email protected]>
1 parent e5f75ea commit 71ca0f5

File tree

2 files changed

+397
-0
lines changed

2 files changed

+397
-0
lines changed

docs/mgmt/gnoi_sw_upgrade.md

Lines changed: 395 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,395 @@
1+
# Software Upgrade using gNOI
2+
3+
SR Linux is a modern Network Operating System (NOS), and it should come as no surprise that modern management tools like [gRPC](https://grpc.io) can be used to manage switches or routers running this NOS.
4+
5+
In this article, we provide a step-by-step guide to perform a software upgrade (or a downgrade) using the gRPC gNOI service.
6+
7+
gRPC is an HTTP/2-based RPC (Remote Procedure Call) framework that allows for the management and operation of a destination device. gRPC operates using a client-server model. In the networking world, the server is typically a switch or router.
8+
9+
Within the gRPC framework, the following services are defined for specific functions. Each service has a set of defined RPCs, and each RPC has a set of inputs and output methods.
10+
11+
- **gNMI** (gRPC-based Network Management Interface):
12+
gNMI RPCs can be used to configure, retrieve state, or stream telemetry from a destination device. This is by far the most popular gRPC service in the networking industry today.
13+
14+
- **gNOI** (gRPC-based Network Operations Interface):
15+
gNOI RPCs can be used to manage device operations such as ping, traceroute, reboot, and software upgrade.
16+
17+
- **gNSI** (gRPC-based Network Security Interface):
18+
gNSI RPCs can be used to manage security and accounting-related configuration.
19+
20+
- **gRIBI** (gRPC-based Routing Information Base Injection):
21+
gRIBI RPCs can be used to inject routes into the device RIB for traffic steering and traffic engineering.
22+
23+
Refer to the [gNxI](https://gnxi.srlinux.dev) page for details on each RPC.
24+
25+
## gNOI
26+
27+
When focusing on gNOI, it has a wide variety of RPCs to operate the device.
28+
29+
- [System](https://gnxi.srlinux.dev/gnoi/system) RPCs are used for actions like ping, traceroute and device reboot
30+
31+
- [File](https://gnxi.srlinux.dev/gnoi/file) service RPCs are used to transfer files to or from the device
32+
33+
- [OS](https://gnxi.srlinux.dev/gnoi/os) service RPCs are used for software image transfer and software upgrade
34+
35+
- [Healthz](https://gnxi.srlinux.dev/gnoi/healthz) service RPCs are used to obtain the health of hardware components
36+
37+
- [Factory Reset](https://gnxi.srlinux.dev/gnoi/factory_reset) RPCs are used to perform a factory reset of the device
38+
39+
- [Packet Link Qualification](https://gnxi.srlinux.dev/gnoi/packet_link_qualification) RPCs are used to check the health of a link
40+
41+
## gNOI OS Service
42+
43+
gNOI OS RPCs can be used to manage the software upgrade of a device.
44+
45+
The OS service supports the following RPCs:
46+
47+
- [Verify](https://gnxi.srlinux.dev/gnoi/os#VerifyRequest) RPC: to check the current software version running on the device
48+
49+
- [Install](https://gnxi.srlinux.dev/gnoi/os#InstallRequest) RPC: to transfer a software image to the device
50+
51+
- [Activate](https://gnxi.srlinux.dev/gnoi/os#ActivateRequest) RPC: to activate a software version on the device and optionally reboot the device to activate the new version
52+
53+
## Software upgrade procedure
54+
55+
Now let's use gNOI RPCs to perform a software upgrade of SR Linux.
56+
57+
### Device and version
58+
59+
Our device under test (DUT) is a 7220 IXR-H3 running SR Linux version `24.10.5` with a management IP of `10.0.1.204`.
60+
61+
```srl hl_lines="4 9"
62+
A:admin@srlinux# show version
63+
---------------------------------------------------------
64+
Hostname : srlinux
65+
Chassis Type : 7220 IXR-H3
66+
Part Number : 3HE16425AARA01
67+
Serial Number : NK222511561
68+
System HW MAC Address: AC:8F:F8:70:0A:52
69+
OS : SR Linux
70+
Software Version : v24.10.5
71+
Build Number : 344-g1c1a8d80ff4
72+
Architecture : x86_64
73+
Last Booted : 2025-12-03T04:55:56.926Z
74+
Total Memory : 32086031 kB
75+
Free Memory : 29913683 kB
76+
---------------------------------------------------------
77+
```
78+
79+
We will use [gNOIc](https://gnoic.kmrd.dev) as the gNOI client.
80+
81+
To install the client on a VM, run:
82+
83+
```bash
84+
bash -c "$(curl -sL https://get-gnoic.kmrd.dev)"
85+
```
86+
87+
To verify the gNOIc installation and version, run:
88+
89+
```bash
90+
gnoic version
91+
```
92+
93+
/// warning
94+
95+
A software upgrade cannot be executed on an SR Linux docker image in Containerlab. A physical device is required for this purpose.
96+
///
97+
98+
### Enable gNOI service in SR Linux
99+
100+
gNOI service configuration is under gRPC. To simplify our process, we will use unencrypted (non-TLS) communication between gNOI client and the switch.
101+
102+
The gRPC configuration on our DUT is as follows:
103+
104+
```srl
105+
set / system grpc-server mgmt admin-state enable
106+
set / system grpc-server mgmt network-instance mgmt
107+
set / system grpc-server mgmt services [ gnmi gnoi gnsi ]
108+
```
109+
110+
This configuration allows all gNOI RPCs from the client. Optionally, you can also selectively enable specific gNOI services like gnoi.file.
111+
112+
### Check gNOI communication
113+
114+
Before we start the software upgrade process, let's verify the gNOI communication between the client and the switch.
115+
116+
We will use the gNOI System time RPC to get the current timestamp of the switch.
117+
118+
On the VM where the gnoic client is installed, run:
119+
120+
///tab | gNOIc command
121+
122+
```bash
123+
gnoic -a 10.0.1.204 -u admin -p admin --insecure system time
124+
```
125+
126+
///
127+
///tab | Expected output
128+
129+
```bash
130+
+------------------+-----------------------------------------+---------------------+
131+
| Target Name | Time | Timestamp |
132+
+------------------+-----------------------------------------+---------------------+
133+
| 10.0.1.204:57400 | 2025-12-02 19:23:50.356281777 -0600 CST | 1764725030356281777 |
134+
+------------------+-----------------------------------------+---------------------+
135+
```
136+
137+
///
138+
139+
We have now verified the communication between the gNOIc client and the switch.
140+
141+
### Verify current software version
142+
143+
Now, let's verify the current software version running on the switch.
144+
145+
We will use the gNOI OS verify RPC for this purpose.
146+
147+
On the VM, run:
148+
149+
///tab | gNOIc command
150+
151+
```bash
152+
gnoic -a 10.0.1.204 -u admin -p admin --insecure os verify
153+
```
154+
155+
///
156+
///tab | Expected output
157+
158+
```bash
159+
+------------------+-------------+---------------------+
160+
| Target Name | Version | Activation Fail Msg |
161+
+------------------+-------------+---------------------+
162+
| 10.0.1.204:57400 | 24.10.5-344 | |
163+
+------------------+-------------+---------------------+
164+
```
165+
166+
///
167+
168+
We verified that the current version is 24.10.5.
169+
170+
### Transfer new software image
171+
172+
Our objective is to upgrade the switch to SR Linux `25.10.1`.
173+
174+
The software image file is locally available on the VM.
175+
176+
We will use the gNOI OS Install RPC to transfer the image to the switch.
177+
178+
The Install RPC is a synchronous RPC that transfers the image in chunks and performs a checksum at the end of the transfer.
179+
180+
/// admonition
181+
type: info
182+
Starting with SR Linux 25.3, there is a rate limit applied by default for synchronous RPCs. Before attempting an OS Install RPC on versions 25.3 or later, increase the rate limit under `system grpc-server <name> rate-limit`.
183+
///
184+
185+
On the VM, run:
186+
187+
///tab | gNOIc command
188+
189+
```bash
190+
gnoic -a 10.0.1.204 -u admin -p admin --insecure os install --version srlinux_25.10.1-399 --pkg gnoi/srlinux-25.10.1-399.bin
191+
```
192+
193+
///
194+
/// tab | Expected output
195+
196+
```bash
197+
INFO[0000] starting install RPC
198+
INFO[0000] target "10.0.1.204:57400": starting Install stream
199+
INFO[0000] target "10.0.1.204:57400": TransferProgress bytes_received:5242880
200+
INFO[0000] target "10.0.1.204:57400": TransferProgress bytes_received:10485760
201+
<snip>
202+
INFO[0029] target "10.0.1.204:57400": TransferProgress bytes_received:1599078400
203+
INFO[0029] target "10.0.1.204:57400": TransferProgress bytes_received:1604321280
204+
INFO[0029] target "10.0.1.204:57400": TransferProgress bytes_received:1609564160
205+
INFO[0029] target "10.0.1.204:57400": TransferProgress bytes_received:1614807040
206+
INFO[0029] target "10.0.1.204:57400": sending TransferEnd
207+
INFO[0029] target "10.0.1.204:57400": TransferProgress bytes_received:1620049920
208+
INFO[0029] target "10.0.1.204:57400": TransferContent done...
209+
```
210+
211+
///
212+
213+
### Taking a configuration backup
214+
215+
Before we activate the new software version, it is best practice to take a configuration backup and store it outside the switch.
216+
217+
We will use the gNOI File Get RPC for this purpose. This RPC will transfer the SR Linux configuration file to the VM under the `gnoi/config-24-10-backup` directory.
218+
219+
On the VM, run:
220+
221+
/// tab | gNOIc command
222+
223+
```bash
224+
gnoic -a 10.0.1.204 -u admin -p admin --insecure file get --file /etc/opt/srlinux/config.json --dst gnoi/config-24-10-backup
225+
```
226+
227+
///
228+
/// tab | Expected output
229+
230+
```bash
231+
INFO[0000] "10.0.1.204:57400" received 64000 bytes
232+
INFO[0000] "10.0.1.204:57400" received 18171 bytes
233+
INFO[0000] "10.0.1.204:57400" file "/etc/opt/srlinux/config.json" saved
234+
```
235+
236+
///
237+
/// tab | Check on VM
238+
239+
```bash
240+
ls -lrt gnoi/config-24-10-backup/etc/opt/srlinux/config.json
241+
```
242+
243+
///
244+
/// tab | Expected output
245+
246+
```bash
247+
-rw-r--r-- 1 root root 82171 Dec 9 22:23 gnoi/config-24-10-backup/etc/opt/srlinux/config.json
248+
```
249+
250+
///
251+
252+
### Activate new software version
253+
254+
After successfully transferring the software image, we can proceed to activate the software image.
255+
256+
We will use the gNOI OS Activate RPC for this purpose.
257+
258+
/// admonition
259+
type: info
260+
By default, the Activate RPC will perform a reboot of the device to activate the new software. To avoid a reboot during activation (and perform reboot at a later time), use the `--no-reboot` flag in the gnoic command.
261+
///
262+
263+
Run the following command to activate the new software with a device reboot.
264+
265+
/// tab | gNOIc command
266+
267+
```bash
268+
gnoic -a 10.0.1.204 -u admin -p admin --insecure os activate --version 25.10.1-399
269+
```
270+
271+
///
272+
/// tab | Expected output
273+
274+
```bash
275+
INFO[0004] target "10.0.1.204:57400" activate response "activate_ok:{}"
276+
```
277+
278+
///
279+
280+
### Verify software version
281+
282+
After the device boots up successfully, verify the current software version of the device and confirm that the software upgrade was a success.
283+
284+
///tab | gNOIc command
285+
286+
```bash
287+
gnoic -a 10.0.1.204 -u admin -p admin --insecure os verify
288+
```
289+
290+
///
291+
///tab | Expected output
292+
293+
```bash
294+
+------------------+-------------+---------------------+
295+
| Target Name | Version | Activation Fail Msg |
296+
+------------------+-------------+---------------------+
297+
| 10.0.1.204:57400 | 25.10.1-399 | |
298+
+------------------+-------------+---------------------+
299+
```
300+
301+
///
302+
303+
/// admonition
304+
type: success
305+
We have successfully upgraded the device to 25.10
306+
///
307+
308+
## Software downgrade procedure
309+
310+
The downgrade procedure is similar to the upgrade process using the same gNOI OS RPCs.
311+
312+
For our example, we will downgrade to our original version `24.10.5`.
313+
314+
### Restore configuration backup
315+
316+
Before downgrading the device, it is important to restore the original configuration from `24.10.5`.
317+
318+
We will use gNOI File Put RPC to transfer the configuration backup available on the VM to the switch. The file will be transferred to the `/tmp` directory. The file can then be copied over to overwrite the `/etc/opt/srlinux/config.json` file.
319+
320+
/// tab | gNOIc command
321+
322+
```bash
323+
gnoic -a 10.0.1.204 -u admin -p admin --insecure file put --file gnoi/config-24-10-backup/etc/opt/srlinux/config.json --dst /tmp/config.json
324+
```
325+
326+
///
327+
/// tab | Expected output
328+
329+
```bash
330+
INFO[0000] "10.0.1.204:57400" sending file="gnoi/config-24-10-backup/etc/opt/srlinux/config.json" hash
331+
INFO[0000] "10.0.1.204:57400" file "gnoi/config-24-10-backup/etc/opt/srlinux/config.json" written successfully
332+
```
333+
334+
///
335+
336+
Log in to the switch and run the below command to overwrite the default configuration file with the backup.
337+
338+
```bash
339+
bash cp /tmp/config.json /etc/opt/srlinux/config.json
340+
```
341+
342+
### Transfer software image
343+
344+
If the device is being downgraded to a different software release, transfer the image using the previously mentioned example.
345+
346+
### Activate the downgrade
347+
348+
We will use the same gNOI OS Activate RPC.
349+
350+
On the VM, run:
351+
352+
/// tab | gNOIc command
353+
354+
```bash
355+
gnoic -a 10.0.1.204 -u admin -p admin --insecure os activate --version 24.10.5-344
356+
```
357+
358+
///
359+
/// tab | Expected output
360+
361+
```bash
362+
INFO[0003] target "10.0.1.204:57400" activate response "activate_ok:{}"
363+
```
364+
365+
///
366+
367+
### Verify the current version
368+
369+
///tab | gNOIc command
370+
371+
```bash
372+
gnoic -a 10.0.1.204 -u admin -p admin --insecure os verify
373+
```
374+
375+
///
376+
///tab | Expected output
377+
378+
```bash
379+
+------------------+-------------+---------------------+
380+
| Target Name | Version | Activation Fail Msg |
381+
+------------------+-------------+---------------------+
382+
| 10.0.1.204:57400 | 24.10.5-344 | |
383+
+------------------+-------------+---------------------+
384+
```
385+
386+
///
387+
388+
/// admonition
389+
type: success
390+
We have successfully downgraded the device to 24.10.5
391+
///
392+
393+
## Summary
394+
395+
Software upgrade automation is not an easy task. In this article, we showcased how modern tools like gRPC can be used to simplify and automate a software upgrade process from a remote client.

0 commit comments

Comments
 (0)