Esempio n. 1
0
from nessi.devices import NIC
from nessi.dlc import FullDuplexPhy, PointToPointDL
from nessi.media import PtPLink
from nessi.media import ErrorPtPLink
from nessi.checksums import *
try:
    import psyco
    psyco.full()
except ImportError:
    pass

# ---------------------------------------------------------------------------
# Create the network

goodlink = PtPLink()
badlink = ErrorPtPLink()

hosts = []
# Create two nodes
for i in range(2):
    h = Host()
    h.hostname = "host" + str(i)
    # On each node, create two interfaces, eth0 and eth1
    for j in range(2):
        niu = NIC()
        h.addDevice(niu, "eth" + str(j))
        niu.addProtocol(FullDuplexPhy(), "phy")
        niu.addProtocol(PointToPointDL(), "dl")
    # eth0 is attached to the errored link, eth1 to the error-free link
    h.eth0.attachToMedium(badlink, 100.0 * i)
    h.eth1.attachToMedium(goodlink, 10.0 * i)  # The good link is shorter
Esempio n. 2
0
from nessi.devices import NIC
from nessi.dlc import FullDuplexPhy, PointToPointDL 
from nessi.media import PtPLink
from nessi.media import ErrorPtPLink
from nessi.checksums import *
try:
    import psyco
    psyco.full()
except ImportError:
    pass

# ---------------------------------------------------------------------------
# Create the network

goodlink = PtPLink()
badlink = ErrorPtPLink()

hosts=[]
# Create two nodes
for i in range(2):
    h = Host()
    h.hostname = "host"+str(i)
    # On each node, create two interfaces, eth0 and eth1
    for j in range(2):
        niu = NIC()
        h.addDevice(niu,"eth"+str(j))
        niu.addProtocol(FullDuplexPhy(), "phy")
        niu.addProtocol(PointToPointDL(), "dl")
    # eth0 is attached to the errored link, eth1 to the error-free link
    h.eth0.attachToMedium(badlink, 100.0*i)
    h.eth1.attachToMedium(goodlink, 10.0*i) # The good link is shorter
Esempio n. 3
0
from nessi.simulator import *
from nessi.nodes import Host
from nessi.media import ErrorPtPLink
from nessi.devices import NIC
from nessi.dlc import FullDuplexPhy
from nessi.arq import StopAndGoDL, GoBackNDL, SelectiveRepeatDL
from nessi.trafficgen import DLFlooder, TrafficSink
try:
    import psyco
    psyco.full()
except ImportError:
    pass

# ---------------------------------------------------------------------------
# Create the network
link = ErrorPtPLink()
hosts = []
# Create two nodes
for i in range(2):
    h = Host()
    h.hostname = "host" + str(i + 1)
    niu = NIC()
    h.addDevice(niu, "eth0")
    niu.addProtocol(FullDuplexPhy(), "phy")
    niu.addProtocol(StopAndGoDL(), "dl")  # CHANGE HERE FOR A DIFFERENT ARQ
    h.eth0.attachToMedium(link, 1000000.0 * i)  # Length: 1000 km
    hosts.append(h)

# For convenience, use short variable names for the hosts
h1, h2 = hosts