state to up >>> cli.clip('show clock') '\n*18:11:53.989 UTC Mon Mar 13 2017\n' >>> output=cli.cli('show clock') >>> print(output) *18:12:04.705 UTC Mon Mar 13 2017 cli.clip(command) —This function works exactly the same as the cli.cli(command) function, except that it prints the resulting text to stdout rather than returning it. The following is sample output from the cli.clip(command) function: >>> cli >>> cli.clip('configure terminal; interface loopback 11; ip address 10.11.11.11 255.255.255.255') *Mar 13 18:42:35.954: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback11, changed state to up *Mar 13 18:42:35.954: %LINK-3-UPDOWN:
Interface Loopback11, changed state to up >>> cli.clip('show clock') *18:13:35.313 UTC Mon Mar 13 2017 >>> output=cli.clip('show clock') *18:19:26.824 UTC Mon Mar 13 2017 >>> print (output) None cli.execute(command) —This function executes a single EXEC command and returns the output; however, does not print the resulting text No semicolons or newlines are allowed as part of this command. Use a Python list with a for-loop to execute this function more than once. The following is sample output from the cli.execute(command) function: >>> cli.execute("show clock") '15:11:20.816 UTC Thu Jun 8 2017' >>> >>> cli.execute('show clock'; 'show ip interface brief') File " ", line 1 ^ SyntaxError:
invalid syntax >>> cli.execute('show clock'; 'show ip interface brief') cli.executep(command) —This function executes a single command and prints the resulting text to stdout rather than returning it. The following is sample output from the cli.executep(command) function: >>> cli.executep('show clock') *18:46:28.796 UTC Mon Mar 13 2017 >>> output=cli.executep('show clock') *18:46:36.399 UTC Mon Mar 13 2017 >>> print(output) None cli.configure(command) —This function configures the device with the configuration available in commands. It returns a list of named tuples that contains the command and its result as shown below:
Shells and Scripting Cisco Python Module to Execute IOS CLI Commands Programmability Configuration Guide, Cisco IOS XE 17.16.x 136