Beispiel #1
0
def build_anm(topology_name):
    print "Building anm for %s" % topology_name
    dirname, filename = os.path.split(os.path.abspath(__file__))
    input_filename = os.path.join(dirname, "%s.graphml" % topology_name)

    anm = autonetkit.ANM()
    input_graph = graphml.load_graphml(input_filename)

    import autonetkit.build_network as build_network
    anm = build_network.initialise(input_graph)
    anm = build_network.apply_design_rules(anm)
    return anm
import autonetkit
import os
import autonetkit.load.graphml as graphml
import shutil

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")
input_graph = graphml.load_graphml(input_file)

import autonetkit.build_network as build_network
anm = build_network.initialise(input_graph)
anm = build_network.apply_design_rules(anm)
anm.save()
anm_restored =  autonetkit.ANM()
anm_restored.restore_latest()
g_phy_original = anm['phy']
g_phy_restored = anm_restored['phy']
assert(all(n in g_phy_restored for n in g_phy_original))

#TODO: do more extensive deep check of parameters

import autonetkit.console_script as console_script
render_hostname = "localhost"

nidb = console_script.create_nidb(anm)
Beispiel #3
0
import json
import sys
import autonetkit.log as log
from autonetkit.collection.utils import get_results
import pkg_resources
import autonetkit.collection.process as ank_process
import autonetkit.ank_messaging as ank_messaging
import autonetkit

import pkg_resources
parse_template = pkg_resources.resource_filename("autonetkit",
                                                 "textfsm/linux/traceroute")

anm = autonetkit.ANM()
anm.restore_latest()

nidb = autonetkit.NIDB()
nidb.restore_latest()
print list(nidb.nodes())

autonetkit.update_http(anm, nidb)

emulation_server = "115.146.93.18"
command_list = []

import autonetkit.collection.process as ank_process
reverse_mappings = ank_process.build_reverse_mappings_from_nidb(nidb)

import random
dest_node = random.choice(list(nidb.routers()))
#dest_node = nidb.node("as1r1")