update package structure, move non-executables to lib
This commit is contained in:
parent
629adc13cb
commit
c74b7b95fb
19
backend.py
19
backend.py
|
@ -6,20 +6,19 @@ https://github.com/ffnord/ffmap-backend
|
|||
import argparse
|
||||
import json
|
||||
import os
|
||||
import networkx as nx
|
||||
from datetime import datetime
|
||||
|
||||
import networkx as nx
|
||||
from networkx.readwrite import json_graph
|
||||
|
||||
import alfred
|
||||
import nodes
|
||||
import graph
|
||||
from batman import Batman
|
||||
from rrddb import RRD
|
||||
from lib import alfred, graph, nodes
|
||||
from lib.batman import Batman
|
||||
from lib.rrddb import RRD
|
||||
|
||||
|
||||
def main(params):
|
||||
nodes_fn = os.path.join(params['destination_directory'], 'nodes.json')
|
||||
graph_fn = os.path.join(params['destination_directory'], 'graph.json')
|
||||
nodes_fn = os.path.join(params['dest_dir'], 'nodes.json')
|
||||
graph_fn = os.path.join(params['dest_dir'], 'graph.json')
|
||||
|
||||
now = datetime.utcnow().replace(microsecond=0)
|
||||
|
||||
|
@ -77,7 +76,7 @@ def main(params):
|
|||
if params['rrd']:
|
||||
script_directory = os.path.dirname(os.path.realpath(__file__))
|
||||
rrd = RRD(os.path.join(script_directory, 'nodedb'),
|
||||
os.path.join(params['destination_directory'], 'nodes'))
|
||||
os.path.join(params['dest_dir'], 'nodes'))
|
||||
rrd.update_database(nodedb['nodes'])
|
||||
rrd.update_images()
|
||||
|
||||
|
@ -92,7 +91,7 @@ if __name__ == '__main__':
|
|||
parser.add_argument('-m', '--mesh', action='append',
|
||||
default=['bat0'],
|
||||
help='batman mesh interface (defaults to bat0)')
|
||||
parser.add_argument('-d', '--destination-directory', action='store',
|
||||
parser.add_argument('-d', '--dest-dir', action='store',
|
||||
help='destination directory for generated files',
|
||||
required=True)
|
||||
parser.add_argument('--vpn', action='append', metavar='MAC',
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import os
|
||||
import subprocess
|
||||
from RRD import RRD, DS, RRA
|
||||
|
||||
from lib.RRD import DS, RRA, RRD
|
||||
|
||||
|
||||
class GlobalRRD(RRD):
|
|
@ -1,6 +1,7 @@
|
|||
import os
|
||||
import subprocess
|
||||
from RRD import RRD, DS, RRA
|
||||
|
||||
from lib.RRD import DS, RRA, RRD
|
||||
|
||||
|
||||
class NodeRRD(RRD):
|
1
lib/__init__.py
Normal file
1
lib/__init__.py
Normal file
|
@ -0,0 +1 @@
|
|||
__author__ = 'hexa'
|
|
@ -1,7 +1,9 @@
|
|||
import networkx as nx
|
||||
from functools import reduce
|
||||
from itertools import chain
|
||||
from nodes import build_mac_table
|
||||
|
||||
import networkx as nx
|
||||
|
||||
from lib.nodes import build_mac_table
|
||||
|
||||
|
||||
def import_vis_data(graph, nodes, vis_data):
|
|
@ -1,8 +1,9 @@
|
|||
#!/usr/bin/env python3
|
||||
import time
|
||||
import os
|
||||
from GlobalRRD import GlobalRRD
|
||||
from NodeRRD import NodeRRD
|
||||
|
||||
from lib.GlobalRRD import GlobalRRD
|
||||
from lib.NodeRRD import NodeRRD
|
||||
|
||||
|
||||
class RRD(object):
|
Loading…
Reference in a new issue