# Path: luna/config.py



from luna.config import db_name
import logging
import pymongo
import ConfigParser
import urllib
import sys
import os
import errno
import subprocess
import ssl
    content_array = [['' for x in range(num_col)]
                     for y in range(total_num_of_new_lines - 1)]

    for i in range(num_col):
        for j in range(len(header_tmp[i])):
            header_array[j][i] = header_tmp[i][j]
    relative_pointer = 0
    for content_line in content_tmp:
        for i in range(num_col):
            for j in range(len(content_line[i])):
                content_array[relative_pointer + j][i] = content_line[i][j]
        relative_pointer += content_line[-1] - 1

    return (lengths, header_array, content_array)


def list_cached_macs(switch_id=None, mongo_db=None):
    """
    Used for list macs exist in switch_mac collection
    """
    logging.basicConfig(level=logging.INFO)
    logger = logging.getLogger(__name__)
    if not mongo_db:
        try:
            mongo_client = pymongo.MongoClient(**get_con_options())
        except:
            err_msg = "Unable to connect to MongoDB."
            logger.error(err_msg)
            raise RuntimeError, err_msg
        logger.debug("Connection to MongoDB was successful.")

# Path: luna/config.py



# Path: luna/utils/helpers.py
from luna.config import db_name
import logging
import pymongo
import ConfigParser
import urllib
import sys
import os
import errno
import subprocess
import ssl

    content_array = [['' for x in range(num_col)]
                     for y in range(total_num_of_new_lines - 1)]

    for i in range(num_col):
        for j in range(len(header_tmp[i])):
            header_array[j][i] = header_tmp[i][j]
    relative_pointer = 0
    for content_line in content_tmp:
        for i in range(num_col):
            for j in range(len(content_line[i])):
                content_array[relative_pointer + j][i] = content_line[i][j]
        relative_pointer += content_line[-1] - 1

    return (lengths, header_array, content_array)


def list_cached_macs(switch_id=None, mongo_db=None):
    """
    Used for list macs exist in switch_mac collection
    """
    logging.basicConfig(level=logging.INFO)
    logger = logging.getLogger(__name__)
    if not mongo_db:
        try:
            mongo_client = pymongo.MongoClient(**get_con_options())
        except:
            err_msg = "Unable to connect to MongoDB."
            logger.error(err_msg)
            raise RuntimeError, err_msg
        logger.debug("Connection to MongoDB was successful.")

        mongo_db = mongo_client[db_name]