Skip to content

Commit 648b19c

Browse files
committed
Spice up main example as well
Signed-off-by: Joachim Wiberg <[email protected]>
1 parent 6ccdae1 commit 648b19c

File tree

1 file changed

+37
-10
lines changed

1 file changed

+37
-10
lines changed

_tabs/example.md

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,52 +3,79 @@ icon: fas fa-terminal
33
order: 2
44
---
55

6-
The CLI configure context is automatically generated from the loaded
7-
YANG models and their corresponding [sysrepo][2] plugins. The following
8-
is brief example of how to set the IP address of an interface:
6+
The CLI configure context is generated from the loaded [YANG][1] models
7+
and their corresponding [sysrepo][2] plugins. The following is brief
8+
example of how to set the IP address of an interface.
99

10-
```
10+
> The `<TAB>` shown here means press the Tab key to show possible
11+
> command completions.
12+
{: .prompt-tip }
13+
14+
```console
1115
admin@infix-12-34-56:/> configure
1216
admin@infix-12-34-56:/config/> edit interface eth0
1317
admin@infix-12-34-56:/config/interface/eth0/> set ipv4 <TAB>
1418
address autoconf bind-ni-name enabled
15-
forwarding mtu neighbor
19+
forwarding mtu neighbor
1620
admin@infix-12-34-56:/config/interface/eth0/> set ipv4 address 192.168.2.200 prefix-length 24
1721
admin@infix-12-34-56:/config/interface/eth0/> show
1822
type ethernet;
1923
ipv4 {
2024
address 192.168.2.200 {
21-
prefix-length 24;
25+
prefix-length 24
2226
}
2327
}
2428
ipv6
29+
```
30+
31+
Whenever you've made a change in configure context, you can see inspect
32+
the modifications with the `diff` command:
33+
34+
35+
```diff
2536
admin@infix-12-34-56:/config/interface/eth0/> diff
2637
interfaces {
2738
interface eth0 {
2839
+ ipv4 {
2940
+ address 192.168.2.200 {
30-
+ prefix-length 24;
41+
+ prefix-length 24
3142
+ }
3243
+ }
3344
}
3445
}
46+
```
47+
48+
To activate the changes you can issue the `leave` command anywhere.
49+
(Use the `abort` command to cancel all changes.) Inspect the changes
50+
made, and remember to save your changes to `startup-config`.
51+
52+
```console
3553
admin@infix-12-34-56:/config/interface/eth0/> leave
3654
admin@infix-12-34-56:/> show interfaces
3755
INTERFACE PROTOCOL STATE DATA
38-
eth0 ethernet UP 52:54:00:12:34:56
39-
ipv4 192.168.2.200/24 (static)
40-
ipv6 fe80::5054:ff:fe12:3456/64 (link-layer)
4156
lo ethernet UP 00:00:00:00:00:00
4257
ipv4 127.0.0.1/8 (static)
4358
ipv6 ::1/128 (static)
59+
eth0 ethernet UP 52:54:00:12:34:56
60+
ipv4 192.168.2.200/24 (static)
61+
ipv6 fe80::5054:ff:fe12:3456/64 (link-layer)
4462
admin@infix-12-34-56:/> copy running-config startup-config
4563
```
4664

65+
> In the CLI all changes are made to the `running-config`, providing you
66+
> with a basic "undo" mechanism -- in case you make a change that locks
67+
> you out, e.g., changing IP address on the same interface used to log
68+
> in to the device -- you can simply reboot the device to get back to
69+
> the previous state.
70+
{: .prompt-tip }
71+
72+
4773
Curious? Continue reading:
4874
- [CLI Introduction][3]
4975
- [Networking Lego®][6]
5076

5177

78+
[1]: https://datatracker.ietf.org/doc/html/rfc7950
5279
[2]: https://www.sysrepo.org/
5380
[3]: https://github.com/kernelkit/infix/tree/main/doc/cli
5481
[6]: https://github.com/kernelkit/infix/blob/main/doc/networking.md

0 commit comments

Comments
 (0)