ON THIS PAGE
Juniper Junos Configlet Interface-Level Example on 4.0.2: gigether-options
Juniper Junos Configlet Example on 4.0.2: MTU (section Interface-Level: Delete)
Juniper Junos Configlet Example on 4.0.2 Example: SNMP (multiple sections)
Juniper Junos Configlet Example on 4.0.1 and 4.0.0: NTP (section SYSTEM)
Arista EOS Configlet Example: Interface Speed (section INTERFACE)
Enterprise SONiC Configlet Example: Static Route (section FRR)
Enterprise SONiC Configlet Example: sonic-cli Commands (section SYSTEM)
Configlet Examples (Design)
Juniper Junos Configlet Interface-Level Example on 4.0.2: gigether-options
When you're creating an interface-level configlet during the design phase, you won't
know interface names. It's not until you're working in the blueprint that you'll
have that information. Interface-level configlets for Junos are designed for you to
enter details without including the set interface
command. For
example, to change Junos interface "gigether-options", you can use a interface-level
hierarchical or set configlet.
gigether-options no-auto-negotiation gigether-options fec none
gigether-options { no-auto-negotiation; fec none; }
When you import the configlet into your blueprint, you'll specify interfaces such as
xe-0/0/0
. For a Junos Interface-Level set configlet Apstra
software will prepend the set commands:
set interfaces xe-0/0/0 gigether-options no-auto-negotiation set interfaces xe-0/0/0 gigether-options fec none
For a Junos Interface-Level hierarchical configlet Apstra software will load Junos structured configuration:
interfaces { xe-0/0/0 { gigether-options { no-auto-negotiation; fec none; } } }
Juniper Junos Configlet Example on 4.0.2: MTU (section Interface-Level: Delete)
If you want to use a Junos interface-level configlet to remove an existing
configuration, you can use an interface level delete configlet. Like the interface
level set configlet, when you are creating the configlet during the design phase,
you won't know interface names. It's not until you're working in the blueprint that
you'll have that information. Interface-level delete configlets for Junos are
designed for you to enter details without including the delete
interface
command. For example, to remove the Junos interface "mtu"
configuration.
mtu
When you import the configlet into your blueprint, you'll specify interfaces such as
xe-0/0/0
. For a Junos Interface-Level delete configlet Apstra
software will prepend the delete commands:
delete interfaces xe-0/0/0 mtu
Juniper Junos Configlet Example on 4.0.2 Example: SNMP (multiple sections)
You can create a configlet with a generator at the Top-Level to enable SNMP. To avoid
SNMP alarms on server-facing interfaces, for example, you can create a second
generator at the Interface-Level to set up no-traps
.
Top-Level template text is validated to begin with ‘set’ or ‘delete’. See below for example text.
set snmp community public authorization read-only set snmp description “this is configlet test” set snmp location “Apstra DC” set snmp contact “june at juniper dot net” set snmp trap-group authentication-traps targets 10.0.10.1 set snmp trap-group authentication-traps targets 192.168.15.27 set snmp trap-group authentication-traps categories authentication
Interface-Level template text is not validated because it's not a complete CLI command. See below for example text.
no-traps
When you import the configlet into your blueprint, you'll specify interfaces such as
ex-0/0/0
and Apstra software will prepend the set command as
.
set interface xe-0/0/0 no-traps
Juniper Junos Configlet Example on 4.0.1 and 4.0.0: NTP (section SYSTEM)
Sample text for configuring NTP servers on Junos devices. (On Apstra version 4.0.2 SYSTEM is called Top-Level/Hierarchical.)
system { ntp { boot-server 10.1.4.1; server 10.1.4.2; } }
Cisco NX-OS Configlet Example: Syslog (section SYSTEM)
Sample text for configuring Syslog on NX-OS devices.
logging server 192.168.0.30 logging facility local3 logging trap warning
no logging server 192.168.0.30 no logging facility local3 no logging trap warning
Arista EOS Configlet Example: NTP (section SYSTEM)
Sample text for configuring NTP servers on EOS devices. This configlet uses property sets for the NTP server IP addresses.
ntp server {{NTP_SERVER_1}} ntp server {{NTP_SERVER_2}}
no ntp server {{NTP_SERVER_1}} no ntp server {{NTP_SERVER_2}}
Arista EOS Configlet Example: Interface Speed (section INTERFACE)
Sample text for applying 'speed auto' to an interface. (You specify devices and interfaces when you import the configlet into a blueprint.)
speed auto
no speed auto
Enterprise SONiC Configlet Example: NTP (section SYSTEM)
Sample text for using the config
command to set up an NTP server to
use mgmt VRF on SONiC devices.
sonic-db-cli CONFIG_DB hset 'NTP |global' vrf mgmt config ntp add {{ntp_server}}
config ntp del {{ntp_server}}
Enterprise SONiC Configlet Example: SNMP (section SYSTEM)
Sample text for using the config
command to set up an SNMP snmptrap
to use mgmt VRF on SONiC devices.
config snmptrap modify 2 {{SNMP_SERVER}} -v mgmt -c mypass
config snmptrap del 2
Enterprise SONiC Configlet Example: Syslog (section SYSTEM)
Sample text for using the config
command to set the Syslog server
for SONiC devices.
config syslog add {{syslog_host}}
config syslog del {{syslog_host}}
Enterprise SONiC Configlet Example: Static Route (section FRR)
Sample text for adding a static route
ip route 4.2.2.2/32 {{static_route_next_hop}} ip route 4.2.2.3/32 {{static_route_next_hop}}
Enterprise SONiC Configlet Example: sonic-cli Commands (section SYSTEM)
Sample text for using the sonic-cli
command to set up the
delay-restore
option for SONiC mclag
. Put
sudo -u admin
at the beginning, and single quotes around
phrases with spaces in each sonic-cli command, and <
/dev/console
at the end.
sudo -u admin sonic-cli -c config -c 'mclag domain 1' -c 'delay-restore 600' < /dev/console
sudo -u admin sonic-cli -c config -c 'mclag domain 1' -c 'no delay-restore' < /dev/console
Cumulus Linux Configlet Example: NTP (section SYSTEM)
By default, NTP in Cumulus runs in the default VRF. Certain scenarios require NTP to run in the mgmt VRF. Services in the default VRF must be stopped, then services in the mgmt VRF must be started. You can apply NTP configuration on the management VRF with the following CLI commands:
systemctl stop ntp.service systemctl disable ntp.service systemctl daemon-reload systemctl start ntp@mgmt.service systemctl enable ntp@mgmt.service
systemctl stop ntp@mgmt.service systemctl disable ntp@mgmt.service systemctl daemon-reload systemctl start ntp.service systemctl enable ntp.service
Cumulus Linux Configlet Example: SNMP (section SYSTEM)
Sample text for setting up an SNMP server on Cumulus Linux that uses NCLU. Note the
net commit
command:
net add snmp-server listening-address 172.20.40.10 net add snmp-server readonly-community MyCommunity access 10.0.0.1 net commit
net del snmp-server listening-address 172.20.40.10 net del snmp-server readonly-community MyCommunity access 10.0.0.1 net commit
Cumulus Linux Configlet Example: Static Route (section FRR)
Sample text for adding a static route
vrf SZ_ART_DR ip route 10.90.0.0/16 10.136.118.24
When you look at the rendered config for the device, the configlet content is shown at the end of the routing section.
Cumulus Linux Configlet Example: Syslog (section FILE)
A text file replaces the contents of a targeted file with the contents in the file referenced by the configlet. For example, to configure a Syslog server with enabled management VRF, add the configuration below (it can require double quotation marks as below):
cumulus@switch:~$ cat /etc/rsyslog.d/11-remotesyslog.conf ## Copy all messages to the remote syslog server at 192.168.0.254 port 514 action(type="omfwd" Target="192.168.0.254" Device="mgmt" Port="514" Protocol="udp")
Each double quotation mark must be preceded by three (3) backslashes. Three backslashes are needed because double quotes must be escaped and backslashes need escaping as well. The following template text shows how to apply a File configlet that contains double quotation marks.
*.* @192.168.0.253:514 #UDP *.* @192.168.0.254:514 #UDP action(type=\\\"omfwd\\\" Target=\\\"192.168.0.254\\\" Device=\\\"mgmt\\\" Port=\\\"514\\\" Protocol=\\\"udp\\\")
/etc/rsyslog.d/11-remotesyslog.conf