Beispiel #1
0
#                'B' : [ ('node D', 'rtt=2, bw=9') ],
#
#                'C' : [],
#
#                'node D' : []
#        }
# The meaning is clear: you're specifying the links between nodes and their
# properties. In this example, the graph is:
#
#               A -- B -- D
#               |
#               C
#
#  Links are symmetric
#
N = Net()
N.net_file_load('net1')
N.net_dot_dump(open('net1.dot', 'w'))

# Activate the simulator
sim.sim_activate()


def run_sim():
    # Fill the options to pass to the nodes.
    s = Settings()
    s.SIMULATED = True
    s.IP_VERSION = 4
    s.NICS = []
    s.EXCLUDE_NICS = []
Beispiel #2
0
import sys
sys.path.append('../../')

import md5
import random
from random import randint
import pdb

from ntk.sim.net import Net

random.seed(1)

# load from file
N = Net()
N.net_file_load('net1')
N.net_dot_dump(open('net1.dot', 'w'))

# rand net
N1 = Net()
N1.rand_net_build(16)
N1.net_dot_dump(open('net1-rand.dot', 'w'))

# mesh net
N2 = Net()
N2.mesh_net_build(4)
N2.net_dot_dump(open('net1-mesh.dot', 'w'))

# complete net
N3 = Net()
N3.complete_net_build(8)
N3.net_dot_dump(open('net1-complete.dot', 'w'))