Call for Contributions

This section needs improvements, examples and explanations.

Please take a look at the Contributing Guide for our Write Documentation.

Salt

VyOS supports op-mode and configuration via salt.

Without proxy it requires VyOS minion configuration and supports op-mode data:

set service salt-minion id 'r14'
set service salt-minion master '192.0.2.250'

Check salt-keys on the salt master

/ # salt-key --list-all
Accepted Keys:
r11
Denied Keys:
Unaccepted Keys:
r14
Rejected Keys:

Accept minion key

/ # salt-key --accept r14
The following keys are going to be accepted:
Unaccepted Keys:
r14
Proceed? [n/Y] y
Key for minion r14 accepted.

Check that salt master can communicate with minions

/ # salt '*' test.ping
r14:
    True
r11:
    True

At this step we can get some op-mode information from VyOS nodes:

/ # salt '*' network.interface eth0
r11:
    |_
      ----------
      address:
          192.0.2.11
      broadcast:
          192.0.2.255
      label:
          eth0
      netmask:
          255.255.255.0
r14:
    |_
      ----------
      address:
          192.0.2.14
      broadcast:
          192.0.2.255
      label:
          eth0
      netmask:
          255.255.255.0


/ # salt r14 network.arp
r14:
    ----------
    aa:bb:cc:dd:f3:db:
        192.0.2.1
    aa:bb:cc:dd:2e:80:
        203.0.113.1

Netmiko-proxy

It is possible to configure VyOS via netmiko proxy module. It requires a minion with installed packet python3-netmiko module who has a connection to VyOS nodes. Salt-minion have to communicate with salt master

Configuration

Salt master configuration:

/ # cat /etc/salt/master
file_roots:
  base:
    - /srv/salt/states

pillar_roots:
  base:
    - /srv/salt/pillars

Structure of /srv/salt:

/ # tree /srv/salt/
/srv/salt/
|___ pillars
|      |__ r11-proxy.sls
|      |__ top.sls
|___ states
       |__ commands.txt

top.sls

/ # cat /srv/salt/pillars/top.sls
base:
  r11-proxy:
    - r11-proxy

r11-proxy.sls Includes parameters for connecting to salt-proxy minion

/ # cat /srv/salt/pillars/r11-proxy.sls
proxy:
  proxytype: netmiko # how to connect to proxy minion, change it
  device_type: vyos  #
  host: 192.0.2.250
  username: user
  password: secret_passwd

commands.txt

/ # cat /srv/salt/states/commands.txt
set interfaces ethernet eth0 description 'WAN'
set interfaces ethernet eth1 description 'LAN'

Check that proxy minion is alive:

/ # salt r11-proxy test.ping
r11-proxy:
    True
/ #

Examples

Example of op-mode:

/ # salt r11-proxy netmiko.send_command 'show interfaces ethernet eth0 brief' host=192.0.2.14 device_type=vyos username=vyos password=vyos
r11-proxy:
    Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down
    Interface        IP Address                        S/L  Description
    ---------        ----------                        ---  -----------
    eth0             192.0.2.14/24                     u/u  Upstream
/ #

Example of configuration:

/ # salt r11-proxy netmiko.send_config config_commands=['set interfaces ethernet eth0 description Link_to_WAN'] commit=True host=192.0.2.14 device_type=vyos username=vyos password=vyos
r11-proxy:
    configure
    set interfaces ethernet eth0 description Link_to_WAN
    [edit]
    vyos@r14# commit
    [edit]
    vyos@r14#
/ #

Example of configuration commands from the file “/srv/salt/states/commands.txt”

/ # salt r11-proxy netmiko.send_config config_file=salt://commands.txt commit=True host=192.0.2.11 device_type=vyos username=vyos password=vyos
r11-proxy:
    configure
    set interfaces ethernet eth0 description 'WAN'
    [edit]
    vyos@r1# set interfaces ethernet eth1 description 'LAN'
    [edit]
    vyos@r1# commit
    [edit]
    vyos@r1#
/ #