#!/usr/bin/env python

from netmiko import ConnectHandler

pynet_rtr2={
    'device_type': 'cisco_ios',
    'ip': '184.105.247.71',
    'username': 'pyclass',
    'password': '88newclass'}

def main(pre_show, post_show, config_commands ,**device):
    connection = ConnectHandler(**device)
    prompt = connection.find_prompt()
    print hasattr(config_commands,'__iter__')
    print prompt
    output=connection.send_command(pre_show)
    print output
    for config in config_commands:
        output = connection.send_config_set(config_commands=config)
        print output
    output = connection.send_command(post_show)
    print output

config = ['logging buffered 4096']
pre_maintenance = 'show log'
post_maintenance = 'show log'

main(pre_show = pre_maintenance,post_show=post_maintenance, config_commands=config, **pynet_rtr2)

