Now, we are ready to take a look around the usage. Let's start by connecting to the EOS node by creating an object:
Python 3.5.2 (default, Nov 17 2016, 17:05:23)[GCC 5.4.0 20160609] on linuxType "help", "copyright", "credits" or "license" for more information.>>> import pyeapi>>> arista1 = pyeapi.connect_to('Arista1')
We can execute show commands to the node and receive the output back:
>>> import pprint>>> pprint.pprint(arista1.enable('show hostname'))[{'command': 'show hostname', 'encoding': 'json', 'result': {'fqdn': 'arista1', 'hostname': 'arista1'}}]
The configuration field can be either a single command or a list of commands using the config() method:
>>> arista1.config('hostname arista1-new')[{}]>>> pprint.pprint(arista1.enable('show ...