Ejemplo n.º 1
0
def get_hsrp_status():
    """Gets mac and arp tables. Concatinates into one"""

    # Delete table data
    DbOps.delete_rows('hsrp_front_end', device)

    try:
        for interface in send_command(
                'show standby brief | ex Interface').splitlines():
            if len(interface.split()) == 0:
                continue
            else:
                try:
                    DbOps.update_hsrp_table(device,
                                            interface.split()[0],
                                            interface.split()[1],
                                            interface.split()[2],
                                            interface.split()[3],
                                            interface.split()[4],
                                            interface.split()[5],
                                            interface.split()[6],
                                            interface.split()[7])
                except IndexError:
                    pass
    except AttributeError:
        pass
Ejemplo n.º 2
0
def get_span_root():
    """Gets mac and arp tables. Concatinates into one"""

    # Delete table data
    DbOps.delete_rows('spanningtree_front_end', device)

    try:
        for vlan in send_command(
                'show spanning-tree root | ex Vlan|-|Root').splitlines():

            if len(vlan.split()) == 0:
                continue
            elif len(vlan.split()) == 7:
                DbOps.update_spann_tree_table(device,
                                              vlan.split()[0].strip('VLAN'),
                                              vlan.split()[1],
                                              vlan.split()[2],
                                              vlan.split()[3], '')
            elif len(vlan.split()) == 8:
                DbOps.update_spann_tree_table(device,
                                              vlan.split()[0].strip('VLAN'),
                                              vlan.split()[1],
                                              vlan.split()[2],
                                              vlan.split()[3],
                                              vlan.split()[7])
    except AttributeError:
        pass
Ejemplo n.º 3
0
def get_ospf_routers():
    """Gets mac and arp tables. Concatinates into one"""

    process, router_id = None, None

    # Delete table data
    DbOps.delete_rows('ospfrouters_front_end', device)

    try:
        for line in send_command(
                'show ip ospf border-routers | ex Codes|Internal|Base'
        ).splitlines():
            if len(line.split()) == 0:
                continue
            elif line.split()[0] == 'OSPF':
                router_id = line.split()[4].strip(')').strip('(')
                process = line.split()[7].strip(')')
            elif len(line.split()) == 11:
                DbOps.update_ospf_router_table(
                    device, process, router_id,
                    line.split()[1],
                    line.split()[0],
                    line.split()[2].strip(']').strip('['),
                    line.split()[4].strip(','),
                    line.split()[5].strip(','),
                    line.split()[6].strip(','),
                    f'{line.split()[7]} {line.split()[8].strip(",")}',
                    line.split()[10])
    except AttributeError:
        pass
Ejemplo n.º 4
0
def get_qos_interfaces():
    """Gets QOS configurations"""

    # Deletes table data
    DbOps.delete_rows('InterfaceQos_front_end', device)
    make_ints_lists = is_instance(get_stats())

    for i in make_ints_lists:
        if i.get("diffserv-target-entry", {}).get("direction", {}):
            for index, stat in enumerate(
                    i.get("diffserv-target-entry",
                          {}).get("diffserv-target-classifier-statistics",
                                  {})):
                DbOps.update_qos_table(
                    device, i['name'],
                    i.get('diffserv-target-entry', {}).get('policy-name', {}),
                    i.get('diffserv-target-entry', {}).get('direction', {}),
                    stat.get('classifier-entry-name', {}),
                    stat.get("classifier-entry-statistics",
                             {}).get("classified-rate", {}),
                    stat.get('classifier-entry-statistics',
                             {}).get('classified-bytes', {}),
                    stat.get('classifier-entry-statistics',
                             {}).get('classified-pkts', {}),
                    stat.get('queuing-statistics', {}).get('output-bytes', {}),
                    stat.get('queuing-statistics', {}).get('output-pkts', {}),
                    stat.get('queuing-statistics', {}).get('drop-pkts', {}),
                    stat.get('queuing-statistics', {}).get('drop-bytes', {}),
                    stat.get('queuing-statistics',
                             {}).get('wred-stats',
                                     {}).get('early-drop-pkts', {}),
                    stat.get('queuing-statistics',
                             {}).get('wred-stats',
                                     {}).get('early-drop-bytes', {}))
Ejemplo n.º 5
0
def get_vlans():
    """Get vlans"""

    # Deletes table data
    DbOps.delete_rows('vlans_front_end', device)

    try:
        for vlan in send_command('show vlan brief').splitlines():
            if len(vlan.split()) == 0:
                continue
            elif vlan.split()[0] == '^':
                break
            elif vlan.split()[0] == 'VLAN':
                continue
            elif vlan.split()[0] == '----':
                continue

            # Get vlan ports
            if vlan.split()[0].rfind("/") != -1:
                vlan_ports = ' '.join(vlan.split())
            else:
                vlan_ports = ' '.join(vlan.split()[3:])

            # Compare vlan id (show vlan) to vlan priority. Use indexing since vlan prio is VLAN + 4 ints, 0000
            for prio in send_command(
                    'show spanning-tree bridge priority').splitlines():
                if len(prio.split()) == 0:
                    continue
                elif vlan.split()[0] == prio.split()[0][5:]:
                    DbOps.update_vlan_table(device,
                                            vlan.split()[0],
                                            prio.split()[1],
                                            vlan.split()[1],
                                            vlan.split()[2], vlan_ports)
                    break
                elif vlan.split()[0] == prio.split()[0][6:]:
                    DbOps.update_vlan_table(device,
                                            vlan.split()[0],
                                            prio.split()[1],
                                            vlan.split()[1],
                                            vlan.split()[2], vlan_ports)
                    break
                elif vlan.split()[0] == prio.split()[0][7]:
                    DbOps.update_vlan_table(device,
                                            vlan.split()[0],
                                            prio.split()[1],
                                            vlan.split()[1],
                                            vlan.split()[2], vlan_ports)
                    break
                else:
                    DbOps.update_vlan_table(device,
                                            vlan.split()[0], 'N/A',
                                            vlan.split()[1],
                                            vlan.split()[2], vlan_ports)
                    break

    except AttributeError:
        pass
Ejemplo n.º 6
0
def get_mac_arp_table():
    """Gets mac and arp tables. Concatinates into one"""

    mac_table = []
    arp_table = []

    # Delete table data
    DbOps.delete_rows('arpmac_front_end', device)

    try:
        for mac in send_command(
                'show mac address-table | ex Vlan|All|Total|%|-').splitlines():

            try:
                mac_table.append({
                    'vlan': mac.split()[0],
                    'address': mac.split()[1],
                    'type': mac.split()[2],
                    'interface': mac.split()[3]
                })
            except IndexError:
                continue

        for arp in send_command(
                'show ip arp | ex Protocol|Total|%').splitlines():
            try:
                arp_table.append({
                    'protocol': arp.split()[0],
                    'ip': arp.split()[1],
                    'age': arp.split()[2],
                    'mac': arp.split()[3],
                    'interface': arp.split()[5]
                })
            except IndexError:
                continue

        # Check to see if mac has an arp entry. If so, add k/v to existing dictionary
        if mac_table:
            for mac in mac_table:
                for entry in arp_table:
                    if mac.get('address') == entry.get('mac'):
                        mac['ip'] = entry.get('ip')
                        mac['ip_int'] = entry.get('interface')
                        break
                    else:
                        mac['ip'] = 'None'
                        mac['ip_int'] = 'None'

        if mac_table:
            for i in mac_table:
                DbOps.update_mac_arp_table(device, i['vlan'], i['address'],
                                           i['type'], i['interface'],
                                           i.get('ip'), i.get('ip_int'))
    except AttributeError:
        pass
Ejemplo n.º 7
0
def get_cdp_neighbors():
    """Gets mac and arp tables. Concatinates into one"""

    neighbors = []
    name = None
    local_port = None
    remote_port = None

    try:
        for neighbor in send_command('show cdp neighbors').splitlines():
            try:
                if not neighbor:
                    continue
                elif neighbor.split()[0] == "":
                    continue
                elif neighbor.split()[0] == 'Capability':
                    continue
                elif neighbor.split()[0] == 'Device':
                    continue
                if len(neighbor.split()) == 1:
                    name = neighbor.split()[0]
                elif len(neighbor.split()) == 7:
                    remote_port = neighbor.split()[5] + neighbor.split()[6]
                    local_port = neighbor.split()[0] + neighbor.split()[1]
                elif len(neighbor.split()) == 8:
                    remote_port = neighbor.split()[6] + neighbor.split()[7]
                    local_port = neighbor.split()[0] + neighbor.split()[1]
                elif len(neighbor.split()) == 9:
                    remote_port = neighbor.split()[7] + neighbor.split()[8]
                    local_port = neighbor.split()[0] + neighbor.split()[1]

            except IndexError:
                continue

            if remote_port is not None:
                neighbors.append({
                    'name': name,
                    'local-port': local_port,
                    'remote-port': remote_port
                })
                name = None
                local_port = None
                remote_port = None

        # Delete table data
        DbOps.delete_rows('cdp_front_end', device)
        for i in neighbors:
            db_session = DbOps.update_cdp_table(device, i['name'],
                                                i['local-port'],
                                                i['remote-port'])

    except AttributeError:
        pass
Ejemplo n.º 8
0
def get_vrfs():
    """Get device model"""

    # Delete table data
    DbOps.delete_rows('vrfs_front_end', device)

    try:
        for i in send_command('show vrf').splitlines():
            try:
                if i.rfind('Name') == -1:
                    db_session = DbOps.update_vrfs_table(device, i.split()[0])
            except IndexError:
                pass
    except AttributeError:
        pass
Ejemplo n.º 9
0
def get_ospf_status():
    """Gets OSPF neighbor statuses"""

    neighbor_status = collections.defaultdict(list)

    # Delete table data
    DbOps.delete_rows('ospf_front_end', device)

    try:
        if send_command('show ip ospf neighbor').splitlines():
            for i in send_command('show ip ospf neighbor').splitlines():
                try:
                    neighbor = ipaddress.ip_address(i.split()[0])
                    neighbor_status[neighbor].append({
                        "NeighborID":
                        i.split()[0],
                        'State':
                        i.split()[2].strip("/"),
                        'Address':
                        i.split()[5],
                        'Interface':
                        i.split()[6]
                    })
                except (IndexError, ValueError):
                    pass
        else:
            if send_command('show ip ospf').splitlines():
                neighbor_status['neighbor'].append({
                    "NeighborID": 'No Established Neighbors',
                    'State': 'None',
                    'Address': 'None',
                    'Interface': 'None'
                })
            else:
                neighbor_status = []

        if neighbor_status:
            for k, v in neighbor_status.items():
                for i in v:
                    db_session = DbOps.update_ospf_table(
                        device, i['NeighborID'], i['State'], i['Address'],
                        i['Interface'])

    except AttributeError:
        pass
Ejemplo n.º 10
0
def get_ospf_processes():
    """Get OSPF processes"""

    # Delete table data
    DbOps.delete_rows('ospfProcess_front_end', device)

    try:
        if send_command('show ip ospf | i Process').splitlines():
            for process in send_command(
                    'show ip ospf | i Process').splitlines():
                try:
                    DbOps.update_ospf_process_table(
                        device,
                        process.split('"')[1].split()[1])
                except IndexError:
                    continue
    except AttributeError:
        pass
Ejemplo n.º 11
0
def get_prefix_lists():
    """View current prefix-list, match statemnt combinations."""

    # Deletes table data
    DbOps.delete_rows('PrefixList_front_end', device)
    prefix_lists = get_prefix_config()

    try:
        for prefix_list in prefix_lists:
            lists = is_instance(prefix_list.get("seq", {}))
            for sequence in lists:
                DbOps.update_prefix_table(device, prefix_list.get("name"),
                                          sequence.get("no"),
                                          sequence.get("action"),
                                          sequence.get("ge", ''),
                                          sequence.get("le"))
    except AttributeError:
        pass
Ejemplo n.º 12
0
def get_dmvpn_info():
    """Gets dmvpn peers, attributes, status, writes to DB"""

    interface = None
    # Delete table data
    DbOps.delete_rows('dmvpncount_front_end', device)

    for line in send_command('show dmvpn | i Interface|Type').splitlines():
        if len(line.split()) == 0:
            continue
        elif len(line.split()) == 5:
            interface = line.split()[1].strip(',')
            get_dmvpn_interface(session, interface, device)
        elif len(line.split()) == 3:
            router_type = line.split(':')[1].split(',')[0]
            peer_count = line.split()[2].strip('Peers:').strip(',')
            DbOps.update_dmvpn_count(device, interface, router_type,
                                     peer_count)
Ejemplo n.º 13
0
def get_dmvpn():
    """Gets dmvpn peers, attributes, status, writes to DB"""

    interface, router_type = None, None

    # Delete table data
    DbOps.delete_rows('dmvpn_front_end', device)

    for line in send_command('show dmvpn | b Interface').splitlines():
        if len(line.split()) == 0 or '-' in line or '#' in line:
            continue
        elif len(line.split()) == 6:
            DbOps.update_dmvpn_table(device,
                                     line.split()[1],
                                     line.split()[2],
                                     line.split()[3],
                                     line.split()[4],
                                     line.split()[5])
Ejemplo n.º 14
0
def get_dmvpn_interface(session, interface, device):
    """Get route-map names"""

    ip_add, tunnel_source, tunnel_mode, network_id, holdtime, profile, nhrp_shortcut, nhrp_red = None, None, None, None, \
                                                                                                 None, None, None, None

    DbOps.delete_rows('dmvpninterfaces_front_end', device)

    try:
        for line in send_command(
                f'show run interface {interface} | ex Current|Building|!',
                session).splitlines():
            if len(line.split()) == 0:
                continue
            elif '^' == line.split()[0]:
                break
            elif 'network-id' in line:
                network_id = line.split()[3]
            elif 'interface' in line:
                pass
            elif 'address' in line:
                ip_add = f'{line.split()[2]} {line.split()[3]}'
            elif 'source' in line:
                tunnel_source = line.split()[2]
            elif 'mode' in line:
                tunnel_mode = f'{line.split()[2]} {line.split()[3]}'
            elif 'protection' in line:
                profile = line.split()[4]
                DbOps.update_dmvpn_interfaces(device, interface, ip_add,
                                              tunnel_source, tunnel_mode,
                                              network_id, holdtime, profile,
                                              nhrp_shortcut, nhrp_red)
            elif 'holdtime' in line:
                holdtime = line.split()[3]

            # Check dmvpn phase commands
            if 'shortcut' in line:
                nhrp_shortcut = line.split()[2]
            if 'redirect' in line:
                nhrp_red = line.split()[2]

    except AttributeError:
        pass
Ejemplo n.º 15
0
def get_route_maps():
    """Get route-map names"""

    map_name = None

    # Deletes table data
    DbOps.delete_rows('routeMaps_front_end', device)

    try:
        for line in send_command('show route-map | i route-map').splitlines():
            if not list(enumerate(line.split(), 0)):
                continue
            elif line.split()[0] == '^':
                break
            elif line.split()[1] != map_name:
                DbOps.update_route_maps(device, line.split()[1])

            map_name = line.split()[1]
    except AttributeError:
        pass
Ejemplo n.º 16
0
def get_arp():
    """Get ARP table"""

    # Delete table data
    DbOps.delete_rows('arp_front_end', device)

    try:
        for i in send_command('show ip arp').splitlines():
            try:
                if i.split()[0] != 'Protocol':
                    DbOps.update_arp_table(device,
                                           i.split()[0],
                                           i.split()[1],
                                           i.split()[2],
                                           i.split()[3],
                                           i.split()[4],
                                           i.split()[5])
            except IndexError:
                pass
    except AttributeError:
        pass
Ejemplo n.º 17
0
def get_access_ports():
    """Get trunks"""

    # Deletes table data
    DbOps.delete_rows('accessInterfaces_front_end', device)

    try:
        for line in send_command(
                'show interfaces status | ex Port').splitlines():
            if len(line.split()) == 0:
                continue
            elif line.split()[0] == '^':
                break
            else:
                if len(line.split()) == 7:
                    DbOps.update_access_interfaces_table(
                        device,
                        line.split()[0],
                        line.split()[1],
                        line.split()[2],
                        line.split()[3],
                        line.split()[4],
                        line.split()[5])
                elif len(line.split()) == 6:
                    DbOps.update_access_interfaces_table(
                        device,
                        line.split()[0], 'N/A',
                        line.split()[1],
                        line.split()[2],
                        line.split()[4],
                        line.split()[5])
                elif len(line.split()) == 5:
                    DbOps.update_access_interfaces_table(
                        device,
                        line.split()[0], 'N/A',
                        line.split()[1],
                        line.split()[2],
                        line.split()[4], 'N/A')
    except AttributeError:
        pass
Ejemplo n.º 18
0
def get_port_channels():
    """Get port-channels"""

    port_channels = []

    # Deletes table data
    DbOps.delete_rows('PoChannels_front_end', device)

    for ints in trunk_types:
        print(ints)
        try:
            # If data structure is a dict. This funtion with convert to a list. Dictionaries occur when there is one of something returned
            make_list = is_in_list(
                get_config()[0]["native"]["interface"].get(ints))
            print(make_list)
            for interface in make_list:
                print(interface)
                if interface is None:
                    continue
                elif interface.get("channel-group", {}).get("number", {}):
                    port_channels.append({
                        'interface':
                        ints + interface.get("name"),
                        'group':
                        interface.get('channel-group').get('number'),
                        'mode':
                        interface.get('channel-group').get('mode')
                    })
        except TypeError:
            pass

    # Iterate through trunk list and interface state. Comapre interface banes and get interface state. Write to database
    for interface in port_channels:
        for port in get_stats():
            if interface.get('interface') == port.get('name'):
                DbOps.update_pochannel_table(device, interface['interface'],
                                             interface['group'],
                                             interface['mode'],
                                             port.get('admin-status'),
                                             port.get('oper-status'))
Ejemplo n.º 19
0
def get_bgp_status():
    """Gets BGF neighbor statuses"""

    local_as = ['Null']

    # Delete table data
    DbOps.delete_rows('bgp_front_end', device)

    try:
        for i in send_command('show ip bgp summary').splitlines():
            if i.rfind('local AS number') != -1:
                local_as = i.split()[-1:]
            try:
                ipaddress.ip_address(i.split()[0])
                DbOps.update_bgp_table(device,
                                       i.split()[0],
                                       i.split()[2],
                                       i.split()[8],
                                       i.split()[9], local_as)
            except (IndexError, ValueError):
                pass
    except AttributeError:
        pass
Ejemplo n.º 20
0
def get_qos_interfaces():
    """Gets one interface with policies, queues, and stats"""

    policies = collections.defaultdict(list)

    # Deletes table data
    DbOps.delete_rows('InterfaceQos_front_end', device)
    make_ints_lists = is_instance(get_stats())

    for i in make_ints_lists:
        if i.get("diffserv-target-entry", {}).get("direction", {}):
            queues = collections.defaultdict(list)
            policy_detials = {
                'Policy_name':
                i.get('diffserv-target-entry', {}).get('policy-name', {}),
                'Direction':
                i.get('diffserv-target-entry', {}).get('direction', {})
            }
            policies[i['name']].append(policy_detials)
            for index, stat in enumerate(
                    i.get("diffserv-target-entry",
                          {}).get("diffserv-target-classifier-statistics",
                                  {})):
                # Creates list and resets at each iteration
                queue = {
                    'queue_name':
                    stat.get('classifier-entry-name', {}),
                    'rate':
                    stat.get("classifier-entry-statistics",
                             {}).get("classified-rate", {}),
                    'bytes':
                    stat.get('classifier-entry-statistics',
                             {}).get('classified-bytes', {}),
                    'packets':
                    stat.get('classifier-entry-statistics',
                             {}).get('classified-pkts', {}),
                    'out_bytes':
                    stat.get('queuing-statistics', {}).get('output-bytes', {}),
                    'out_packets':
                    stat.get('queuing-statistics', {}).get('output-pkts', {}),
                    'drop_packets':
                    stat.get('queuing-statistics', {}).get('drop-pkts', {}),
                    'drop_bytes':
                    stat.get('queuing-statistics', {}).get('drop-bytes', {}),
                    'wred_drops_pkts':
                    stat.get('queuing-statistics',
                             {}).get('wred-stats',
                                     {}).get('early-drop-pkts', {}),
                    'wred_drop_bytes':
                    stat.get('queuing-statistics',
                             {}).get('wred-stats',
                                     {}).get('early-drop-bytes', {})
                }
                # Write dictionary values to list, add string formatting
                # Write list as value to key which is our policy name
                queues['queues'].append(queue)
                policies[i['name']].append(queues)

    # Read policy dictionaries and write to database
    for k, v in policies.items():
        for stat in v[1]['queues']:
            DbOps.update_qos_table(device, k, v[0]['Policy_name'],
                                   v[0]['Direction'], stat['queue_name'],
                                   stat['rate'], stat['bytes'],
                                   stat['packets'], stat['out_bytes'],
                                   stat['out_packets'], stat['drop_packets'],
                                   stat['drop_bytes'], stat['wred_drops_pkts'],
                                   stat['wred_drop_bytes'])
Ejemplo n.º 21
0
def get_trunk_ports(ssh_port, username, password, device):
    """Get trunk ports. Uses NETCONF and Netmiko """

    trunks = []

    # Deletes table data
    DbOps.delete_rows('Trunks_front_end', device)

    for ints in interface_types:
        try:
            current_interfaces = get_config()[0]["native"]["interface"].get(
                ints)
            make_list = is_in_list(current_interfaces)
            for interface in make_list:
                if interface is None:
                    continue

                if interface.get("switchport",
                                 {}).get("trunk",
                                         {}).get("allowed",
                                                 {}).get("vlan",
                                                         {}).get("vlans", {}):
                    # Use netconf interface name to get vlans using netmiko. I find netconf can be untrustworthy sometimes
                    vlans = GetWithNetmiko.indivisual_poll(
                        username,
                        password,
                        device,
                        ssh_port,
                        'trunk_helper',
                        interface=ints + interface.get('name'))
                    # Write dictionary to list and join our vlan list returned from netmiko funtion
                    trunks.append({
                        'interface': ints + interface.get('name'),
                        'vlans': ', '.join(vlans),
                        'cdp': interface.get('name')
                    })

                elif interface.get("switchport",
                                   {}).get("trunk",
                                           {}).get("allowed",
                                                   {}).get("vlan",
                                                           {}).get("add", {}):
                    # Use netconf interface name to get vlans using netmiko. I find netconf can be untrustworthy sometimes
                    vlans = GetWithNetmiko.indivisual_poll(
                        username,
                        password,
                        device,
                        ssh_port,
                        'trunk_helper',
                        interface=ints + interface.get('name'))
                    # Write dictionary to list and join our vlan list returned from netmiko funtion
                    trunks.append({
                        'interface': ints + interface.get('name'),
                        'vlans': ', '.join(vlans),
                        'cdp': interface.get('name')
                    })
        except TypeError:
            pass

    # Iterate through trunk list and interface state. Comapre interface banes and get interface state. Write to database
    for interface in trunks:
        for port in get_stats():
            if interface.get('interface') == port.get('name'):
                DbOps.update_trunks_table(device, interface['interface'],
                                          interface['vlans'],
                                          port.get('admin-status'),
                                          port.get('oper-status'))
Ejemplo n.º 22
0
def get_ip_interfaces(management_ip=None):
    """Gets interface ips addresses"""

    interface_info = []
    unassigned_interfaces = ['Tunnel', 'Loopback', 'Vlan']
    interface_num = []

    for ints in interface_types:
        try:
            current_interfaces = get_config()[0]["native"]["interface"].get(
                ints)
            # If data structure is a dict. This funtion with convert to a list. Dictionaries occur when there is one of something returned
            make_ip_list = is_in_list(current_interfaces)
            for ip in make_ip_list:
                if ip is None:
                    pass
                elif ip.get("ip", {}).get("address", {}):
                    address = ipaddress.ip_interface(
                        ip.get('ip', '').get('address').get('primary').get(
                            'address') + '/' + ip.get('ip', '').get(
                                'address').get('primary').get('mask'))

                    parsed_info = get_interface_stats(ints + ip.get('name'),
                                                      ip=address)
                    interface_info.append(parsed_info)

                    if ip.get('ip', '').get('address').get('primary').get(
                            'address') == management_ip:
                        nuclear_int = ints + ip.get('name')
                else:
                    try:
                        parsed_info = get_interface_stats(ints +
                                                          ip.get('name'),
                                                          ip='Not Assigned')
                        interface_info.append(parsed_info)
                    except TypeError:
                        pass

                    try:
                        unassigned_interfaces.append(ints + ip.get('name'))
                        interface_num.append(ip.get('name'))
                    except TypeError:
                        pass
        except TypeError:
            pass

    # Deletes table data
    DbOps.delete_rows('Interfaces_front_end', device)
    for i in interface_info:
        for k, v in i.items():
            DbOps.update_ip_interface_table(device, k,
                                            str(v['IP']) + ' | ' + v['MAC'],
                                            v['Admin'], v['Operational'],
                                            v['Speed'],
                                            v['Last Change'].split('.')[0],
                                            v['In Octets'], v['Out Octets'])
    # Deletes table data
    DbOps.delete_rows('UnassignedInterfaces_front_end', device)
    # Write unassigned interfaces to the DB
    for interface in unassigned_interfaces:
        DbOps.update_unassigned_interfaces(device, interface)