Beispiel #1
0
def load_graphml(input_data):
    #TODO: allow default properties to be passed in as dicts


    try:
        graph = nx.read_graphml(input_data)
    except IOError, e:
        acceptable_errors = set([
            2, # no such file or directory
            36, # input string too long for filename
            63, # input string too long for filename
            ])
        if e.errno in acceptable_errors:
            # try as data string rather than filename string
            try:
                input_pseduo_fh = StringIO(input_data) # load into filehandle to networkx
                graph = nx.read_graphml(input_pseduo_fh)
            except IOError:
                raise autonetkit.exception.AnkIncorrectFileFormat
            except IndexError:
                raise autonetkit.exception.AnkIncorrectFileFormat
        else:
            try:
                import autonetkit.console_script as cs
                input_data=cs.parse_options().file
                graph = nx.read_graphml(input_data)
            except IOError:
                raise e
Beispiel #2
0
def compare_output_expected(topology_name, automated=True):
    log.info("Testing %s" % topology_name)
    input_filename = "%s.graphml" % topology_name

    dirname, filename = os.path.split(os.path.abspath(__file__))
    input_file = os.path.join(dirname, input_filename)

    arg_string = "-f %s --quiet --render" % input_file
    args = console_script.parse_options(arg_string)

    console_script.main(args)
Beispiel #3
0
def compare_output_expected(topology_name, automated=True):
    log.info("Testing %s" % topology_name)
    input_filename = "%s.graphml" % topology_name

    dirname, filename = os.path.split(os.path.abspath(__file__))
    input_file = os.path.join(dirname, input_filename)

    arg_string = "-f %s --quiet --render" % input_file
    args = console_script.parse_options(arg_string)

    console_script.main(args)
def test():
    # stdio redirect from stackoverflow.com/q/2654834

    #TODO: add feature that reports if only IP addresses have changed: match the diff to an IP regex
    dirname, filename = os.path.split(os.path.abspath(__file__))

    input_file = os.path.join(dirname, "small_internet.graphml")
    print input_file

    arg_string = "-f %s --diff --render" % input_file
    args = console_script.parse_options(arg_string)

    console_script.main(args)

    #TODO: test output works
import autonetkit.console_script as console_script
import subprocess
import os
import sys
#from cStringIO import StringIO
import shutil
import autonetkit.log as log
import autonetkit

# stdio redirect from stackoverflow.com/q/2654834

#TODO: add feature that reports if only IP addresses have changed: match the diff to an IP regex

automated = True # whether to open ksdiff, log to file...
if __name__ == "__main__":
    automated = False

dirname, filename = os.path.split(os.path.abspath(__file__))

anm =  autonetkit.ANM()
input_file = os.path.join(dirname, "small_internet.graphml")
print input_file

arg_string = "-f %s --diff --render" % input_file
args = console_script.parse_options(arg_string)

console_script.main(args)
Beispiel #6
0
import autonetkit.console_script as console_script
import subprocess
import os
import sys
#from cStringIO import StringIO
import shutil
import autonetkit.log as log
import autonetkit

# stdio redirect from stackoverflow.com/q/2654834

#TODO: add feature that reports if only IP addresses have changed: match the diff to an IP regex

automated = True # whether to open ksdiff, log to file...
if __name__ == "__main__":
    automated = False

dirname, filename = os.path.split(os.path.abspath(__file__))

anm =  autonetkit.ANM()
input_file = os.path.join(dirname, "small_internet.graphml")
print input_file

arg_string = "-f %s --diff --render" % input_file
args = console_script.parse_options(arg_string)

console_script.main(args)

#TODO: test output works