<gh_stars>0
from netmiko import ConnectHandler
import csv
import time

username = 'device.expert'
password = '<PASSWORD>'

def run(region):
    data = []
    nevada = {'device_type': 'cisco_ios', 'host': '10.230.230.14', 'username': username, 'password': password}
    nevada_connect = ConnectHandler(**nevada)
    arizona = {'device_type': 'cisco_ios', 'host': '10.230.230.50', 'username': username, 'password': password}
    arizona_connect = ConnectHandler(**arizona)

    with open('data/tunnels/' + region + '.csv', 'r') as file:
        reader = csv.reader(file)
        for row in reader:
            if row[2] == "nevada":
                output = nevada_connect.send_command('sh run int ' + row[0])
                ## Checks if policy maps exists
                if output.split()[-4] == "service-policy":
                    policy_map = output.split()[-4] + " " + output.split()[-3] + " " + output.split()[-2]
                    data.append({"name": row[0], "desc": row[1], "status": policy_map})
                else:
                    data.append({"name": row[0], "desc": row[1], "status": "no qos"})
            if row[2] == "arizona":
                output = arizona_connect.send_command('sh run int ' + row[0])
                if output.split()[-4] == "service-policy":
                    policy_map = output.split()[-4] + " " + output.split()[-3] + " " + output.split()[-2]
                    data.append({"name": row[0], "desc": row[1], "status": policy_map})
                else:
                    data.append({"name": row[0], "desc": row[1], "status": "no qos"})
    return data
from netmiko import ConnectHandler
import csv
import time

username = 'device.expert'
password = '<PASSWORD>'

def run(region):
    data = []
    nevada = {'device_type': 'cisco_ios', 'host': '10.230.230.14', 'username': username, 'password': password}
    nevada_connect = ConnectHandler(**nevada)
    arizona = {'device_type': 'cisco_ios', 'host': '10.230.230.50', 'username': username, 'password': password}
    arizona_connect = ConnectHandler(**arizona)

    with open('data/tunnels/' + region + '.csv', 'r') as file:
        reader = csv.reader(file)
        for row in reader:
            if row[2] == "nevada":
                output = nevada_connect.send_command('sh run int ' + row[0])
                ## Checks if policy maps exists
                if output.split()[-4] == "service-policy":
                    policy_map = output.split()[-4] + " " + output.split()[-3] + " " + output.split()[-2]
                    data.append({"name": row[0], "desc": row[1], "status": policy_map})
                else:
                    data.append({"name": row[0], "desc": row[1], "status": "no qos"})
            if row[2] == "arizona":
                output = arizona_connect.send_command('sh run int ' + row[0])
                if output.split()[-4] == "service-policy":
                    policy_map = output.split()[-4] + " " + output.split()[-3] + " " + output.split()[-2]
                    data.append({"name": row[0], "desc": row[1], "status": policy_map})
                else:
                    data.append({"name": row[0], "desc": row[1], "status": "no qos"})
    return data
## Checks if policy maps exists