srl-labs / srl-controller

k8s controller for SR Linux nodes scheduled by KNE
BSD 3-Clause "New" or "Revised" License
16 stars 3 forks source link

add support for startup-config passed in `cli` and `partial-json` formats #23

Closed hellt closed 1 year ago

hellt commented 1 year ago

Currently startup-config can only be provided as a full configuration extracted from a running system in a json format (from /etc/opt/srlinux/config.json).

Even the factory config of SR Linux counts thousands of lines, since security and ACL policies are provided in full for v4/v6 protocols. Using those bulky files as startup is not always easy as it is not evident what was added to the startup config by the user and what comes from default settings.

We have to add a more flexible solution where startup configs can be provided in the two additional formats.

CLI

As either a list of full-context set / ... commands or a regular CLI blob. Such file needs to be read by srl-controller and executed via scrapligo, or copied over to the srlinux node and executed as sr_cli <commands>

Partial JSON

A trimmed down version of the config.json where only parts that a user adds are present. Such config can be loaded via sr_cli load file <path> merge

Considerations

Before implementing any of those additions, we need to make sure that srl-controller also waits for Srl nodes to boot

hellt commented 1 year ago

done in #37 partial json is not supported, and cli snippets are added on top in the merge fashion if the full config is needed to be provided in the CLI format, then on the first line of the file it should be delete / followed by the CLI commands