Esempio n. 1
0
 def ospf_topology(self,
                   ip_seed_router,
                   process_id='1',
                   area='0',
                   filename="pruebayed"):
     ospf_db = ospf_database(ip_seed_router=ip_seed_router,
                             isp=self,
                             process_id=process_id,
                             area=area)
     ospf_db.get_yed_file(filename=filename)
Esempio n. 2
0
 def ospf_topology_vs(self,
                      ip_seed_router,
                      process_id='1',
                      area='0',
                      shelve_name="tesst_ospf",
                      network_name="_ospf_ufinet_regional"):
     self.verbose.warning(f"shelve_name {shelve_name}")
     ospf_db = ospf_database(ip_seed_router=ip_seed_router,
                             isp=self,
                             process_id=process_id,
                             area=area,
                             network_name=network_name,
                             interface_method='',
                             source='db')
     with shelve.open(shelve_name) as sh:
         dict_ospf = ospf_db.get_vs()
         sh.clear()
         sh["db"] = dict_ospf
         sh.close()
         return dict_ospf
Esempio n. 3
0
    "ip_seed_router": "172.16.30.5", "process_id": '1', "area": '0',
    'network_name': '_ospf_ufinet_regional'
}
guatemala = {
    "ip_seed_router": "172.17.22.52",
    "process_id": '502', "area": '502008', 'network_name': 'RCE_GUATEMALA'
}
lista = []
pf = PerformanceLog('24 hours diagram')
threads = []
dbs = []
data_final = []
for i in range(0, 24):
    period_start = date_list[i]
    period_end = date_list[i + 1]
    dbd = ospf_database(isp=isp, source='delay_start', period_start=period_start, period_end=period_end, **regional)
    dbs.append(dbd)
    t = Thread(target=dbd.delay_start)
    t.start()
    threads.append(t)

for t in threads:
    t.join()

for dbd in dbs:
    data = dbd.get_vs()
    data_final.append({'period': f'{dbd.period_start} - {dbd.period_end}', 'data': data})

pf.flag('end')

pf.print_intervals()
Esempio n. 4
0
def diagrama_intervalos_json():
    covertidor = {
        "guatemala": "RCE_GUATEMALA",
        "_ospf_ufinet_regional": "_ospf_ufinet_regional"
    }
    request.get_json()
    network = covertidor[request.json['network']]
    tipo_periodo = request.json['tipo_periodo']
    period_start = request.json['date']
    if period_start == "":
        period_start = str(datetime.datetime.today()).split(' ')[0]

    isp = ISP()
    isp.master = master
    base = datetime.datetime.strptime(period_start, '%Y-%m-%d')
    date_list = [
        str(base + datetime.timedelta(**{tipo_periodo: x}))
        for x in range(0, 25)
    ]

    data_red = {
        "_ospf_ufinet_regional": {
            "ip_seed_router": "172.16.30.5",
            "process_id": '1',
            "area": '0',
            'network_name': '_ospf_ufinet_regional'
        },
        "RCE_GUATEMALA": {
            "ip_seed_router": "172.17.22.52",
            "process_id": '502',
            "area": '502008',
            'network_name': 'RCE_GUATEMALA'
        }
    }
    pf = PerformanceLog('24 hours diagram')
    threads = []
    dbs = []
    data_final = []
    for i in range(0, 24):
        period_start = date_list[i]
        period_end = date_list[i + 1]
        dbd = ospf_database(isp=isp,
                            source='delay_start',
                            period_start=period_start,
                            period_end=period_end,
                            **data_red[network])
        dbs.append(dbd)
        t = Thread(target=dbd.delay_start)
        t.start()
        threads.append(t)

    for t in threads:
        t.join()

    for dbd in dbs:
        data = dbd.get_vs()
        data_final.append({
            'period': f'{dbd.period_start} - {dbd.period_end}',
            'vs': data
        })
    pf.flag('end')
    pf.print_intervals()

    return jsonify(data_final)
Esempio n. 5
0
from config.Master import Master
from model.ospf_database import ospf_database

isp = ISP()
isp.master = Master()
data_networks = {
    'regional': {
        "ip_seed_router": "172.16.30.5",
        "process_id": '1',
        "area": '0',
        'network_name': '_ospf_ufinet_regional'
    },
    'guatemala': {
        "ip_seed_router": "172.17.22.52",
        "process_id": '502',
        "area": '502008',
        'network_name': 'RCE_GUATEMALA'
    }
}

devices_ips = []
for name, kwargs_network in data_networks.items():
    dbd = ospf_database(isp=isp, source='real_time', **kwargs_network)
    dbd.save_state()
    devices_ips.extend(list(dbd.devices.devices.keys()))
    del dbd
devices_ips = list({ip for ip in devices_ips})
with open('hosts/interfaces/all_network_ospf_devices', 'w') as f:
    devices_ips.append('\n\n\n')
    f.write("\n".join(devices_ips))