from sys import argv
import csv
import getpass
import netmiko
from netmiko import ConnectHandler

# Creditials
username = input('Username: ')
password = getpass.getpass('Password: ')
#ikepsk = input ('IKE Pre-shared-key: ')

# Define Nodes
script, csv_file = argv
reader = csv.DictReader(open(csv_file, 'rt'))

# Define all Hubs
all_hubs = []
for line in reader:
    all_hubs.append(line)


#Configure vrf
for devices in all_hubs:
    devices['username'] = username
    devices['password'] = password
    net_connect = ConnectHandler(**devices)
    config_commands = ['do show dmvpn', 'do show ip int brief | i up']
    output = net_connect.send_config_set(config_commands)
    print(output)