.. figure:: images/ConfiBack.png :alt: ConfiBack Logo :align: left :height: 32pt :width: 32pt Keyword macros ============== What is Keyword macro? ---------------------- Keyword macro is a tool to insert variable values to :doc:`profile command `, make special commands or flag command, which returns device's configuration to backup. Types of Keyword macros ----------------------- .. attribute:: customizable Keyword macro, which name is expected by application, but it's value is customizable. .. attribute:: functional Keyword macro/flag used for special command, which directs application code. Typically keyword *backup* means, that output of this command will be saved, because it contains device configuration. By default, output of commands is not processed. .. attribute:: internal Keyword macro, which is defined internally in application and it shouldn't be redefined. .. attribute:: specific Keyword macro, which is defined by ConfiBack user. Can contain eg. TFTP server address, or any custom value. Creating and managing Keyword macros ------------------------------------ To create or manage keyword macro go to device list and open device edit form, because keyword macro values are specific for every device. There you can enter name of keyword macro (without braces!) and its value. Typically the minimum is a password keyword macro. Keyword macro usage ------------------- To use keyword macro in command, you have to enclose it by braces. Example: .. code:: copy startup-config tftp {tftpaddress} configrepo/{devicename}-startup.cfg **Explanation:** There are two keyword macros ``{tftpaddress}`` - user defined :attr:`specific` macro, and ``{devicename}`` - an :attr:`internal` keyword macro. .. _keyword-macros-table: Keyword macros table -------------------- .. csv-table:: :header: "Keyword", "Meaning", "Usage", "Type" :widths: 10, 20, 60, 10 ".. attribute:: backup", "Save output", "Place it to beginning of command to flag, that result should be saved as configuration backup.", ":attr:`functional`" ".. attribute:: ftp>192.168.1.1", "FTP command", "In Telnet+TFTP+FTP profile to open FTP and get backup file. This command should come after configuration export to TFTP server.", ":attr:`functional`" ".. attribute:: sleep>10", "Wait for 10 seconds", "Do not send next command in the profile until 10 seconds (customizable value) not timed out. Usable after issuing copy tftp command, where it takes long.", ":attr:`functional`" ".. attribute:: blank", "An empty value", "When you want to send Enter without any command, place it as command. It'll be replaced by empty string.", ":attr:`internal`" ".. attribute:: devicename","Name of device", "A way how to diversify filenames of configuration export (Telnet+TFTP+FTP). Place it as a file name or directory name (if directory exists).", ":attr:`internal`" ".. attribute:: username", "User's name", "In Telnet profile to authentify access to device, if required.", ":attr:`customizable`" ".. attribute:: password", "Password", "In Telnet profile to authentify access to device. Or in Telnet or SSH profile to enter password after *enable* command.", ":attr:`customizable`" ".. attribute:: mykw", "My specific", "User defined keyword macro, eg. for IP address of TFTP server.", ":attr:`specific`" Special keyword macros ---------------------- .. csv-table:: :header: "Keyword", "Meaning", "Usage", "Type" :widths: 10, 20, 60, 10 ".. attribute:: binary", "Binary backup", "When backup file is binary, define this keyword macro for desired device.", ":attr:`customizable` :attr:`functional`" **binary** Flags device, that it has binary backups. Value is not examined. If the *binary* is present in device keyword macros, application automatically encodes input to base64 (and save it to database). Downloading configuration automatically decodes file back. .. note:: This keyword macro is not intended to use in Profile Commands.