File Examples/Ethernet/LANs/LargeNet.ned
Contains:
import
"EtherBus",
"EtherHub",
"EtherHost",
"EtherSwitch",
"ChannelInstaller";
channel cable
delay 0.1us
endchannel
module SmallLAN
parameters:
h: numeric const;
gates:
in: in;
out: out;
submodules:
hub: EtherHub;
display: "i=device/switch";
host: EtherHost[h];
display: "i=device/pc2_s";
connections:
for i=0..h-1 do
hub.out++ --> cable --> host[i].in;
hub.in++ <-- cable <-- host[i].out;
endfor
hub.out++ --> out;
hub.in++ <-- in;
endmodule
module MediumLAN
parameters:
n: numeric const,
h: numeric const;
gates:
in: in;
out: out;
submodules:
switch: EtherSwitch;
display: "i=switch2";
host: EtherHost[n];
display: "i=device/pc2_s";
hub: EtherHub;
display: "i=device/switch";
hhost: EtherHost[h];
display: "i=device/pc2_s";
connections:
for i=0..n-1 do
switch.out++ --> cable --> host[i].in;
switch.in++ <-- cable <-- host[i].out;
endfor
switch.out++ --> out;
switch.in++ <-- in;
for i=0..h-1 do
hub.out++ --> cable --> hhost[i].in;
hub.in++ <-- cable <-- hhost[i].out;
endfor
switch.out++ --> cable --> hub.in++;
switch.in++ <-- cable <-- hub.out++;
endmodule
module LargeLAN
parameters:
n: numeric const,
h: numeric const,
b: numeric const;
gates:
in: in;
out: out;
submodules:
switch: EtherSwitch;
display: "i=switch2";
host: EtherHost[n];
display: "i=device/pc2_s";
hub: EtherHub;
display: "i=device/switch";
hhost: EtherHost[h];
display: "i=device/pc2_s";
bus: EtherBus;
parameters:
positions = "5 10 15",
propagationSpeed = 200000000;
display: "b=424,6;o=#408060";
bhost: EtherHost[b];
display: "p=,,r;i=device/pc2_s";
connections:
for i=0..n-1 do
switch.out++ --> cable --> host[i].in;
switch.in++ <-- cable <-- host[i].out;
endfor
switch.out++ --> out;
switch.in++ <-- in;
for i=0..h-1 do
hub.out++ --> cable --> hhost[i].in;
hub.in++ <-- cable <-- hhost[i].out;
endfor
switch.out++ --> cable --> hub.in++;
switch.in++ <-- cable <-- hub.out++;
for i=0..b-1 do
bus.out++ --> bhost[i].in;
bus.in++ <-- bhost[i].out;
endfor
bus.out++ --> hub.in++;
bus.in++ <-- hub.out++;
endmodule
module LargeNet
parameters:
n: numeric const,
bbs, bbm, bbl: numeric const,
as, am, al: numeric const,
bs, bm, bl: numeric const,
cs, cm, cl: numeric const,
ds, dm, dl: numeric const;
submodules:
switchBB: EtherSwitch[n];
display: "i=ball2_s";
slanBB: SmallLAN[n*bbs];
display: "i=cloud_s";
mlanBB: MediumLAN[n*bbm];
display: "i=cloud_s";
llanBB: LargeLAN[n*bbl];
display: "i=cloud";
switchA: EtherSwitch;
display: "i=ball2_s";
serverA: EtherHost;
display: "i=device/pc2_s";
slanA: SmallLAN[as];
display: "i=cloud_s";
mlanA: MediumLAN[am];
display: "i=cloud_s";
llanA: LargeLAN[al];
display: "i=cloud";
switchB: EtherSwitch;
display: "i=ball2_s";
serverB: EtherHost;
display: "i=device/pc2_s";
slanB: SmallLAN[bs];
display: "i=cloud_s";
mlanB: MediumLAN[bm];
display: "i=cloud_s";
llanB: LargeLAN[bl];
display: "i=cloud";
switchC: EtherSwitch;
display: "i=ball2_s";
serverC: EtherHost;
display: "i=device/pc2_s";
slanC: SmallLAN[cs];
display: "i=cloud_s";
mlanC: MediumLAN[cm];
display: "i=cloud_s";
llanC: LargeLAN[cl];
display: "i=cloud";
switchD: EtherSwitch;
display: "i=ball2_s";
serverD: EtherHost;
display: "i=device/pc2_s";
slanD: SmallLAN[ds];
display: "i=cloud_s";
mlanD: MediumLAN[dm];
display: "i=cloud_s";
llanD: LargeLAN[dl];
display: "i=cloud";
connections nocheck:
for k=0..n-1, i=0..bbs-1 do
switchBB[k].out++ --> cable --> slanBB[k*bbs+i].in;
switchBB[k].in++ <-- cable <-- slanBB[k*bbs+i].out;
endfor
for k=0..n-1, i=0..bbm-1 do
switchBB[k].out++ --> cable --> mlanBB[k*bbm+i].in;
switchBB[k].in++ <-- cable <-- mlanBB[k*bbm+i].out;
endfor
for k=0..n-1, i=0..bbl-1 do
switchBB[k].out++ --> cable --> llanBB[k*bbl+i].in;
switchBB[k].in++ <-- cable <-- llanBB[k*bbl+i].out;
endfor
for k=0..n-2 do
switchBB[k].out++ --> cable --> switchBB[k+1].in++;
switchBB[k].in++ <-- cable <-- switchBB[k+1].out++;
endfor
for i=0..as-1 do
switchA.out++ --> cable --> slanA[i].in;
switchA.in++ <-- cable <-- slanA[i].out;
endfor
for i=0..am-1 do
switchA.out++ --> cable --> mlanA[i].in;
switchA.in++ <-- cable <-- mlanA[i].out;
endfor
for i=0..al-1 do
switchA.out++ --> cable --> llanA[i].in;
switchA.in++ <-- cable <-- llanA[i].out;
endfor
switchA.out++ --> cable --> serverA.in;
switchA.in++ <-- cable <-- serverA.out;
for i=0..bs-1 do
switchB.out++ --> cable --> slanB[i].in;
switchB.in++ <-- cable <-- slanB[i].out;
endfor
for i=0..bm-1 do
switchB.out++ --> cable --> mlanB[i].in;
switchB.in++ <-- cable <-- mlanB[i].out;
endfor
for i=0..bl-1 do
switchB.out++ --> cable --> llanB[i].in;
switchB.in++ <-- cable <-- llanB[i].out;
endfor
switchB.out++ --> cable --> serverB.in;
switchB.in++ <-- cable <-- serverB.out;
for i=0..cs-1 do
switchC.out++ --> cable --> slanC[i].in;
switchC.in++ <-- cable <-- slanC[i].out;
endfor
for i=0..cm-1 do
switchC.out++ --> cable --> mlanC[i].in;
switchC.in++ <-- cable <-- mlanC[i].out;
endfor
for i=0..cl-1 do
switchC.out++ --> cable --> llanC[i].in;
switchC.in++ <-- cable <-- llanC[i].out;
endfor
switchC.out++ --> cable --> serverC.in;
switchC.in++ <-- cable <-- serverC.out;
for i=0..ds-1 do
switchD.out++ --> cable --> slanD[i].in;
switchD.in++ <-- cable <-- slanD[i].out;
endfor
for i=0..dm-1 do
switchD.out++ --> cable --> mlanD[i].in;
switchD.in++ <-- cable <-- mlanD[i].out;
endfor
for i=0..dl-1 do
switchD.out++ --> cable --> llanD[i].in;
switchD.in++ <-- cable <-- llanD[i].out;
endfor
switchD.out++ --> cable --> serverD.in;
switchD.in++ <-- cable <-- serverD.out;
switchA.out++ --> cable --> switchB.in++;
switchA.in++ <-- cable <-- switchB.out++;
switchB.out++ --> cable --> switchC.in++;
switchB.in++ <-- cable <-- switchC.out++;
switchC.out++ --> cable --> switchD.in++;
switchC.in++ <-- cable <-- switchD.out++;
switchB.out++ --> cable --> switchBB[4].in++;
switchB.in++ <-- cable <-- switchBB[4].out++;
endmodule
network largeNet : LargeNet
endnetwork