jedelman8/cpal — pull request #14 by IPyandy (2014-04-02 16:23:10+00:00)
Title: updated getHostname, added getCPU

updated getHostname() to use JSON instead of text, much easier to parse.

```bash
$ python main.py -i 10.17.31.51 -m arista -n 'SW1' -f getHostname
eos-sw01
```

added getCPU method, returns entire line of cpu.
```bash
$ python main.py -i 10.17.31.51 -m arista -n 'SW1' -f getCPU
Cpu(s): 11.2%us, 1.4%sy, 0.0%ni, 87.2%id, 0.2%wa, 0.0%hi, 0.0%si, 0.0%st
```

This can be changed to return only:

```bash
Cpu(s): 11.2%us
```
or just
```bash
11.2%us
```

First one is much more verbose, but let me know and I can commit the change before merging.

added getFacts to device(), to streamline the calling of getFacts a bit and allow to be called with the -f switch, added some pretty code to createDevice() to allow printing of complex data like dictionaries for testing.

```bash
$ python main.py -i 10.17.31.51 -m arista -n 'SW1' -f getFacts
!
python main.py -i 10.17.31.51 -m arista -n 'SW1' -f getFacts
{ 'connect_ip': '10.17.31.51',
'cpu_utilization': u'Cpu(s): 11.0%us, 1.4%sy, 0.0%ni, 87.4%id, 0.1%wa, 0.0%hi, 0.0%si, 0.0%st',
'free_system_memory': 1284928,
'hostname': u'eos-sw01',
'platform': u'DCS-7050T-64-R',
'serial_number': u'JPE13020644',
'system_uptime': u' 2:45',
'total_sytem_memory': 3990500,
'var_name': 'dev',
'vendor': 'arista'}
```