Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions Config.in
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ config INFIX_ARCH
default "riscv64" if BR2_riscv
default "x86_64" if BR2_x86_64

menu "Packages"

source "$BR2_EXTERNAL_INFIX_PATH/package/Config.in"

endmenu

source "$BR2_EXTERNAL_INFIX_PATH/package/Config.in.host"
source "$BR2_EXTERNAL_INFIX_PATH/board/common/Config.in"
36 changes: 36 additions & 0 deletions board/common/post-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,37 @@ common=$(dirname "$(readlink -f "$0")")
. "$BR2_CONFIG" 2>/dev/null
. "$TARGET_DIR/usr/lib/os-release"

# Extract list of loaded YANG modules and their features for yangdoc.html
mkyangdoc()
{
cmd="yangdoc -o $1 -p $TARGET_DIR/usr/share/yang"

# shellcheck disable=SC2155
export SYSREPO_SHM_PREFIX="yangdoc"
while IFS= read -r line; do
if echo "$line" | grep -q '^[a-z]'; then
module=$(echo "$line" | awk '{print $1}')
cmd="$cmd -m $module"
feature=$(echo "$line" | awk -F'|' '{print $8}' | sed 's/^ *//;s/ *$//')
if [ -n "$feature" ]; then
feature_list=$(echo "$feature" | tr ' ' '\n')
for feat in $feature_list; do
cmd="$cmd -e $feat"
done
fi
fi
done <<EOF
$(sysrepoctl -l; rm -f /dev/shm/${SYSREPO_SHM_PREFIX}*)
EOF

# Ignore a few top-level oddballs not used by core Infix
cmd="$cmd -x supported-algorithms"

# Execute the command
echo "Calling: $cmd"
$cmd
}

if [ -n "${ID_LIKE}" ]; then
ID="${ID} ${ID_LIKE}"
fi
Expand Down Expand Up @@ -85,3 +116,8 @@ grep -qsE '^/bin/false$$' "$TARGET_DIR/etc/shells" \
# Allow clish (symlink to /usr/bin/klish) to be a login shell
grep -qsE '^/bin/clish$$' "$TARGET_DIR/etc/shells" \
|| echo "/bin/clish" >> "$TARGET_DIR/etc/shells"

# Create YANG documentation
if [ "$BR2_PACKAGE_HOST_PYTHON_YANGDOC" = "y" ]; then
mkyangdoc "$BINARIES_DIR/yangdoc.html"
fi
1 change: 1 addition & 0 deletions configs/aarch64_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ BR2_PACKAGE_PODMAN_DRIVER_VFS=y
BR2_PACKAGE_TETRIS=y
BR2_PACKAGE_ROUSETTE=y
BR2_PACKAGE_LIBINPUT=y
BR2_PACKAGE_HOST_PYTHON_YANGDOC=y
DISK_IMAGE_BOOT_BIN=y
TRUSTED_KEYS=y
TRUSTED_KEYS_DEVELOPMENT=y
Expand Down
1 change: 1 addition & 0 deletions configs/r2s_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -184,5 +184,6 @@ BR2_PACKAGE_PODMAN_DRIVER_VFS=y
BR2_PACKAGE_TETRIS=y
BR2_PACKAGE_ROUSETTE=y
BR2_PACKAGE_LIBINPUT=y
BR2_PACKAGE_HOST_PYTHON_YANGDOC=y
# SIGN_ENABLED is not set
# GNS3_APPLIANCE is not set
1 change: 1 addition & 0 deletions configs/x86_64_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ BR2_PACKAGE_PODMAN_DRIVER_DEVICEMAPPER=y
BR2_PACKAGE_PODMAN_DRIVER_VFS=y
BR2_PACKAGE_TETRIS=y
BR2_PACKAGE_ROUSETTE=y
BR2_PACKAGE_HOST_PYTHON_YANGDOC=y
TRUSTED_KEYS=y
TRUSTED_KEYS_DEVELOPMENT=y
GNS3_APPLIANCE_RAM=512
Expand Down
22 changes: 17 additions & 5 deletions doc/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Change Log
All notable changes to the project are documented in this file.


[v24.06.0][UNRELEASED]
----------------------
[v24.06.0][] - 2024-06-28
-------------------------

> **Note:** this release contains **breaking changes** in YANG models
> that are incompatible with existing configuration files. So, after
Expand Down Expand Up @@ -49,15 +49,27 @@ All notable changes to the project are documented in this file.
- Issue #178: add early boot script to migrate configuration files of
older version to new syntax. Initial, rudimentary support, for the
change in shell types
- Issue #308: add `version` field to ietf-system.yang to be able to
detect the configuration file version.
- Issue #308: add `version` field to configuration file using a new
model, infix-meta.yang. Used to trigger migration from older formats
to newer on future breaking changes
- Issue #432: extract YANG documentation at build time. Part of the
release tarballs is now `yangdoc.html` for the complete tree of all
YANG configuration, operational data, RPCs, and notification nodes
- Issue #435: add support for `$factory$` password hash. This allows
backing up configuration files with device specific passwords. Upon
restore to another device this ensures the replacement's password is
used instead of the originals'
- Issue #435: add support for hostname format specifiers. The default
hostname configuration is now `%h-%m` to encode, `infix-c0-ff-ee`
- Issue #447: add support for [yescrypt][], `$y$` hashes
- Issue #435: support for "empty" NETCONF host keys. Primarily used in
static factory-config setups. When a configuration is detected with
this, the automatically generated, device specific 2048 bit RSA host
key pair is used. With this, vendor/product specific factory-config
is now fully supported. See `src/confd/README.md`
- Issue #447: add support for [yescrypt][], `$y$` hashes. This also
adds support for `$0$cleartext` password according to ietf-system.yang
- Issue #455: split CLI tutorial into multiple files for easy access
from the CLI admin-exec context using the `help` command
- Issue #478: add operational support for ietf-system.yang, reading
actual hostname and passwords after issue #435
- Merge infix-shell-types.yang with infix-system.yang
Expand Down
3 changes: 2 additions & 1 deletion doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ the `help` command.

- **CLI Topics**
- [Introduction to the CLI](cli/introduction.md)
- [CLI User's Guide](cli/tutorial.md)
- [Configuring using the CLI](cli/configure.md)
- [Quick Overview](cli/quick.md)
- [Upgrading the Software](cli/upgrade.md)
- **Infix User Guide**
- [Introduction](introduction.md)
- [System Configuration](system.md)
Expand Down
110 changes: 0 additions & 110 deletions doc/cli/tutorial.md → doc/cli/configure.md
Original file line number Diff line number Diff line change
@@ -1,109 +1,3 @@
User Guide
==========

The command line interface (CLI, see-ell-aye) implements a CISCO-like,
or Juniper Networks JunOS-like, CLI for UNIX systems.

New users always get the CLI as the default "shell" when logging in, but
the default `admin` user logs in to `bash`. To access the CLI, type:

cli

Key commands available in any context are:

help
show

For each command it also possible to press the `?` key and `TAB` to get
more help and suggestions for completion.

> **Note:** for the sake of brevity, the hostname in the following examples
> has been shortened to `host`. The default name is composed from a product
> specific string followed by the last three octets of the system base MAC
> address, e.g., `switch-12-34-56`. An example of how to change the hostname
> is included below.


Admin Exec
----------

The top-level context after logging in and starting the CLI is the
admin-exec or "main" context. It is used for querying system status,
managing configuration files/profiles and doing advanced debugging.

Available commands can be seen by pressing `?` at the prompt:

```
admin@host:/>
configure Create new candidate-config based on running-config
copy Copy configuration, e.g., copy running-config startup-config
exit Exit from CLI (log out)
factory-reset Restore the system to factory default state
follow Monitor a log file, use Ctrl-C to abort
help Help system (also try '?' key)
logout Alias to exit
netcalc IP subnet calculator
password Password tools
ping Ping a network host or multicast group
poweroff Poweroff system (system policy may yield reboot)
reboot Reboot system
set Set operations, e.g., current date/time
shell Enter system shell
show Show system status and configuration files
tcpdump Capture network traffic
upgrade Install a software update bundle
```

To get more help for a given command, type the command, a space, and
then tap `?` again. You can also tap the `Tab` key to see available
argument completions.

### Upgrading the Software

The admin-exec command `upgrade` can be used to install software images, or
bundles. A bundle is a signed and self-contained package that carries all the
information necessary to determine if it holds a bootloader, a Linux image, or
even both.

To install a new software image to the currently *inactive* partition[^1], we
use the `upgrade` command and a URI to a ftp/tftp/sftp or http/https server
that hosts the file:

```
admin@host:/> upgrade tftp://192.168.122.1/firmware-x86_64-v23.11.pkg
installing
0% Installing
0% Determining slot states
20% Determining slot states done.
20% Checking bundle
20% Verifying signature
40% Verifying signature done.
40% Checking bundle done.
40% Checking manifest contents
60% Checking manifest contents done.
60% Determining target install group
80% Determining target install group done.
80% Updating slots
80% Checking slot rootfs.1
90% Checking slot rootfs.1 done.
90% Copying image to rootfs.1
99% Copying image to rootfs.1 done.
99% Updating slots done.
100% Installing done.
Installing `tftp://192.168.122.1/firmware-x86_64-v23.11.pkg` succeeded
admin@host:/>
```

The secondary partition (`rootfs.1`) has now been upgraded and will be used as
the *active* partition on the next boot. Leaving the primary partition, with
the version we are currently running, intact in case of trouble.

[^1]: It is not possible to upgrade the partition we booted from. Thankfully
the underlying "rauc" subsystem keeps track of this. Hence, to upgrade
both partitions you must reboot to the new version (to verify it works)
and then repeat the same command.


Configure Context
-----------------

Expand Down Expand Up @@ -382,7 +276,3 @@ is filtered, except LLDP frames as shown above.
> **Note:** the bridge can be named anything, provided the interface
> name is not already taken. However, for any name outside the pattern
> `br[0-9]+`, you have to set the interface type manually to `bridge`.



[1]: https://src.libcode.org/pkun/klish
116 changes: 95 additions & 21 deletions doc/cli/introduction.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Introduction

The command line interface (CLI, see-ell-i) is the traditional way of
The command line interface (CLI, see-ell-aye) implements a CISCO-like,
or Juniper Networks JunOS-like, CLI. It is the traditional way of
interacting with single network equipment like switches and routers.
Today more advanced graphical NETCONF-based tools are available that
allows for managing entire fleets of installed equipment.
Expand All @@ -9,34 +10,107 @@ Nevertheless, when it comes to initial deployment and debugging, it
is very useful to know how to navigate and use the CLI. This very
short guide intends to help you with that.


## About

New users usually get the CLI as the default "shell" when logging in,
but the default `admin` user logs in to `bash`. To access the CLI,
type:

```
admin@host-12-34-56:~$ cli

See the 'help' command for an introduction to the system

admin@host-12-34-56:/>
```

The prompt (beginning of the line) changes slightly. Key commands
available in any context are:

```
admin@host-12-34-56:/> help # Try: Tab or ?
...
admin@host-12-34-56:/> show # Try: Tab or ?
admin@host-12-34-56:/> # Try: Tab or ?
```

> **Tip:** Even on an empty command line you can tap the Tab or ? keys.
> See `help keybindings` for more tips!


## Key Concepts

The two modes in the CLI are the admin-exec and the configure context.

When logging in to the system, be it from console or SSH, you first have
a stopover in a UNIX shell, usually Bash. Type `cli` to enter the CLI
and finally land in admin-exec. Here you can inspect system status and
do operations to debug networking issues, e.g. ping. You can also enter
configure context by typing: `configure`

The system has several datastores (or files):

- `factory-config` consists of a set of default configurations, some
static and others generated per-device, e.g., a unique hostname and
number of ports/interfaces. This file is generated at boot.
- `startup-config` is created from `factory-config` at boot if it does
not exist. It is loaded as the system configuration on each boot.
- `running-config` is what is actively running on the system. If no
changes have been made since the system booted, it is the same as
`startup-config`.
The top-level context after logging in and starting the CLI is the
admin-exec or "main" context. It is used for querying system status,
managing configuration files/profiles and doing advanced debugging.

Available commands can be seen by pressing `?` at the prompt:

```
admin@host:/>
configure Create new candidate-config based on running-config
copy Copy file or configuration, e.g., copy running-config startup-config
dir List available configuration files
exit Exit from CLI (log out)
factory-reset Restore the system to factory default state
follow Monitor a log file, use Ctrl-C to abort
help Help system (try also the '?' key)
logout Alias to exit
netcalc IP subnet calculator, with subnetting
password Password tools
ping Ping a network host or multicast group
poweroff Poweroff system (system policy may yield reboot)
reboot Reboot system
remove Remove a configuration file
set Set operations, e.g., current date/time
show Show system status and configuration files
tcpdump Capture network traffic
upgrade Install a software update bundle from remote or local file
```

The system has three *main datastores* (or files): *factory*, *startup*,
and *running* that can be managed and inspected using the `copy`,
`show`, and `configure` commands. The traditional names used in the CLI
for these are listed below:

- `factory-config` the default configuration from factory for the
device, i.e., what the system returns to after a `factory-reset`
- `startup-config` created from `factory-config` at first boot after
factory reset. Loaded as the system configuration on each boot
- `running-config` what is actively running on the system. If no
changes have been made since boot, it is the same as `startup-config`
- `candidate-config` is created from `running-config` when entering the
configure context. Any changes made here can be discarded (`abort`,
`rollback`) or committed (`commit`, `leave`) to `running-config`.
`rollback`) or committed (`commit`, `leave`) to `running-config`

Edit the *running* configuration using the `configure` command. This
copies *running* to *candidate*, a temporary datastore, where changes
are made:

```
admin@host-12-34-56:/> configure
admin@host-12-34-56:/config/> ... # Try: Tab or ?
admin@host-12-34-56:/config/> leave
```

The `leave` command activates the changes by issuing a transaction to,
essentially, copy the *candidate* back to *running*. Depending on the
changes made, this can take a few seconds. If the changes are invalid,
i.e., not correct according to the underlying YANG models, a warning is
shown and the session remains in configure context. Use the `abort`
command to cancel your changes, or investigate further with the `diff`
command (see more below).

To save configuration changes made to the `running-config` so the system
will use them consecutive reboots, use the `copy` command:
To save configuration changes made to the `running-config` to persistent
store, so the system will use them for consecutive reboots, use the
`copy` command:

admin@host-12-34-56:/> copy running-config startup-config
```
admin@host-12-34-56:/> copy running-config startup-config
```

In *configure context* the following commands are available:

Expand Down
Loading