123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316 |
- //
- // Copyright (C) 2003 CTIE, Monash University
- //
- // This program is free software; you can redistribute it and/or
- // modify it under the terms of the GNU General Public License
- // as published by the Free Software Foundation; either version 2
- // of the License, or (at your option) any later version.
- //
- // This program is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- // GNU General Public License for more details.
- //
- // You should have received a copy of the GNU General Public License
- // along with this program; if not, write to the Free Software
- // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- //
- package inet.examples.ethernet.lans;
- import inet.common.misc.ThruputMeteringChannel;
- import inet.linklayer.ethernet.EtherBus;
- import inet.linklayer.ethernet.EtherHub;
- import inet.node.ethernet.EtherHost;
- import inet.node.ethernet.EtherSwitch;
- import ned.DatarateChannel;
- //
- // Sample Ethernet LAN containing eight hosts, a switch and a bus.
- //
- network MixedLAN
- {
- types:
- channel C extends ThruputMeteringChannel
- {
- delay = 01us;
- datarate = 100Mbps;
- }
- submodules:
- bus: EtherBus {
- parameters:
- positions = "10 20 24 35 40 48";
- propagationSpeed = 2e8 mps; // 1us = 200m
- @display("p=277,182;b=424,6;o=#408060");
- gates:
- ethg[6];
- }
- busHostA: EtherHost {
- parameters:
- @display("p=122,118");
- }
- busHostB: EtherHost {
- parameters:
- @display("p=210,118");
- }
- busHostC: EtherHost {
- parameters:
- @display("p=338,238");
- }
- busHostD: EtherHost {
- parameters:
- @display("p=426,238");
- }
- switchHostA: EtherHost {
- parameters:
- @display("p=82,300");
- }
- switchHostB: EtherHost {
- parameters:
- @display("p=162,300");
- }
- switchHostC: EtherHost {
- parameters:
- @display("p=234,300");
- }
- switchHostD: EtherHost {
- parameters:
- @display("p=306,300");
- }
- switch: EtherSwitch {
- parameters:
- @display("p=194,236");
- gates:
- ethg[5];
- }
- hubHostA: EtherHost {
- parameters:
- @display("p=297,55");
- }
- hubHostB: EtherHost {
- parameters:
- @display("p=365,55");
- }
- hubHostC: EtherHost {
- parameters:
- @display("p=430,55");
- }
- hub: EtherHub {
- parameters:
- @display("p=362,132");
- gates:
- ethg[4];
- }
- connections:
- bus.ethg[0] <--> C <--> busHostA.ethg;
- bus.ethg[1] <--> C <--> busHostB.ethg;
- bus.ethg[2] <--> C <--> switch.ethg[4];
- bus.ethg[3] <--> C <--> busHostC.ethg;
- bus.ethg[4] <--> C <--> hub.ethg[3];
- bus.ethg[5] <--> C <--> busHostD.ethg;
- switch.ethg[0] <--> C <--> switchHostA.ethg;
- switch.ethg[1] <--> C <--> switchHostB.ethg;
- switch.ethg[2] <--> C <--> switchHostC.ethg;
- switch.ethg[3] <--> C <--> switchHostD.ethg;
- hub.ethg[0] <--> { delay = 0.1us; datarate = 100Mbps; } <--> hubHostA.ethg;
- hub.ethg[1] <--> { delay = 0.3us; datarate = 100Mbps; } <--> hubHostB.ethg;
- hub.ethg[2] <--> { delay = 0.2us; datarate = 100Mbps; } <--> hubHostC.ethg;
- }
- //
- // Sample Ethernet LAN: two hosts directly connected to each other
- // via twisted pair.
- //
- network TwoHosts
- {
- submodules:
- hostA: EtherHost {
- parameters:
- @display("p=60,160");
- }
- hostB: EtherHost {
- parameters:
- @display("p=200,140");
- }
- connections:
- hostA.ethg <--> { delay = 0.5us; datarate = 100Mbps; } <--> hostB.ethg;
- }
- //
- // Sample Ethernet LAN: four hosts connected to a switch.
- //
- network SwitchedLAN
- {
- types:
- channel C extends DatarateChannel
- {
- delay = 0.1us;
- datarate = 100Mbps;
- }
- submodules:
- hostA: EtherHost {
- parameters:
- @display("p=161,55");
- }
- hostB: EtherHost {
- parameters:
- @display("p=253,125");
- }
- hostC: EtherHost {
- parameters:
- @display("p=158,199");
- }
- hostD: EtherHost {
- parameters:
- @display("p=59,127");
- }
- switch: EtherSwitch {
- parameters:
- @display("p=162,124");
- gates:
- ethg[4];
- }
- connections:
- switch.ethg[0] <--> C <--> hostA.ethg;
- switch.ethg[1] <--> C <--> hostB.ethg;
- switch.ethg[2] <--> C <--> hostC.ethg;
- switch.ethg[3] <--> C <--> hostD.ethg;
- }
- //
- // Sample Ethernet LAN: four hosts connected by a hub.
- //
- network HubLAN
- {
- submodules:
- hostA: EtherHost {
- parameters:
- @display("p=161,55");
- }
- hostB: EtherHost {
- parameters:
- @display("p=253,125");
- }
- hostC: EtherHost {
- parameters:
- @display("p=158,199");
- }
- hostD: EtherHost {
- parameters:
- @display("p=59,127");
- }
- hub: EtherHub {
- parameters:
- @display("p=162,124");
- gates:
- ethg[4];
- }
- connections:
- hub.ethg[0] <--> { delay = 0.1us; datarate = 100Mbps; } <--> hostA.ethg;
- hub.ethg[1] <--> { delay = 0.3us; datarate = 100Mbps; } <--> hostB.ethg;
- hub.ethg[2] <--> { delay = 0.4us; datarate = 100Mbps; } <--> hostC.ethg;
- hub.ethg[3] <--> { delay = 0.2us; datarate = 100Mbps; } <--> hostD.ethg;
- }
- //
- // Sample Ethernet LAN: four hosts on a bus.
- //
- network BusLAN
- {
- types:
- channel C extends DatarateChannel
- {
- delay = 0;
- datarate = 10Mbps;
- }
- submodules:
- hostA: EtherHost {
- parameters:
- @display("p=100,150");
- }
- hostB: EtherHost {
- parameters:
- @display("p=200,150");
- }
- hostC: EtherHost {
- parameters:
- @display("p=300,150");
- }
- hostD: EtherHost {
- parameters:
- @display("p=400,150");
- }
- bus: EtherBus {
- parameters:
- positions = "0 10 20 30";
- propagationSpeed = 2e8 mps;
- @display("p=250,100;b=400,6;o=#408060");
- gates:
- ethg[4];
- }
- connections:
- bus.ethg[0] <--> C <--> hostA.ethg;
- bus.ethg[1] <--> C <--> hostB.ethg;
- bus.ethg[2] <--> C <--> hostC.ethg;
- bus.ethg[3] <--> C <--> hostD.ethg;
- }
- network SwitchedDuplexLAN
- {
- types:
- channel ethernetline extends DatarateChannel
- {
- parameters:
- delay = 0.1us;
- datarate = 10Mbps;
- }
- module EtherHostFullDuplex extends EtherHost
- {
- parameters:
- csmacdSupport = false;
- }
- module EtherSwitchFullDuplex extends EtherSwitch
- {
- parameters:
- csmacdSupport = false;
- }
- submodules:
- hostA: EtherHostFullDuplex {
- parameters:
- @display("p=161,55");
- }
- hostB: EtherHostFullDuplex {
- parameters:
- @display("p=253,125");
- }
- hostC: EtherHostFullDuplex {
- parameters:
- @display("p=158,199");
- }
- hostD: EtherHostFullDuplex {
- parameters:
- @display("p=59,127");
- }
- switch: EtherSwitchFullDuplex {
- parameters:
- @display("p=162,124");
- gates:
- ethg[4];
- }
- connections:
- switch.ethg[0] <--> ethernetline <--> hostA.ethg;
- switch.ethg[1] <--> ethernetline <--> hostB.ethg;
- switch.ethg[2] <--> ethernetline <--> hostC.ethg;
- switch.ethg[3] <--> ethernetline <--> hostD.ethg;
- }
|