import json from .rogue import Rogue try: from config import log_level except: log_level = 6 finally: from mlib.__debug import Console console = Console(log_level) class Settings: def __init__(self): self.rogue = Rogue() def toJSON(self): return json.dumps(self, default=lambda o: o.__dict__)
session_file = "" backup_directory = "./org_backup/" org_id = "" #### IMPORTS #### import mlib as mist_lib from mlib.__debug import Console from mlib import cli from tabulate import tabulate import json import os.path #### CONSTANTS #### console = Console(6) backup_file = "./org_conf_file.json" file_prefix = ".".join(backup_file.split(".")[:-1]) #### GLOBAL VARS #### rftemplate_id_dict = {} site_id_dict = {} sitegroup_id_dict = {} map_id_dict = {} deviceprofile_id_dict = {} template_id_dict = {} mxtunnel_id_dict = {} wxtunnel_id_dict = {}
#### IMPORTS #### import mlib as mist_lib from mlib import cli from mlib.__debug import Console import csv import datetime console = Console(7) hours_to_report = 96 csv_delimiter = "," csv_file = "report_app_usage.csv" def _get_clients_list(mist_session, site_id): clients = mist_lib.sites.stats.clients(mist_session, site_id)["result"] return clients def _get_site_name(mist_session, site_id): site_info = mist_lib.sites.info.get(mist_session, site_id)["result"] return site_info["name"] def _convert_numbers(size): # 2**10 = 1024 power = 2**10 n = 0 power_labels = {0: '', 1: 'K', 2: 'M', 3: 'G', 4: 'T'} while size > power: size /= power