-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPriorityEtherSwitch.ned
63 lines (59 loc) · 2.22 KB
/
PriorityEtherSwitch.ned
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//
package backbone;
import inet.linklayer.IMACRelayUnit;
import inet.linklayer.IEtherMAC;
//
// Model of an Ethernet switch.
//
// The duplexChannel attributes of the MACs must be set according to the
// medium connected to the port; if collisions are possible (it's a bus or hub)
// it must be set to false, otherwise it can be set to true.
// By default used half duples CSMA/CD mac
//
// This model does not contain the spanning tree algorithm.
//
module PriorityEtherSwitch
{
parameters:
@node();
@labels(node,ethernet-node);
@display("i=device/switch");
bool csmacdSupport = default(true); // by default use CSMA/CD
string macType = default(csmacdSupport ? "EtherMAC" : "EtherMACFullDuplex"); // ~EtherMAC or ~EtherMACFullDuplex
string relayUnitType = default("PriorityMACRelayUnitNP");
gates:
inout ethg[] @labels(EtherFrame-conn);
submodules:
relayUnit: <relayUnitType> like IMACRelayUnit {
parameters:
@display("p=200,50");
gates:
lowerLayerIn[sizeof(ethg)];
lowerLayerOut[sizeof(ethg)];
}
mac[sizeof(ethg)]: <macType> like IEtherMAC {
parameters:
promiscuous = true;
queueModule = "";
@display("p=70,150,row;q=txQueue");
}
connections:
for i=0..sizeof(ethg)-1 {
mac[i].upperLayerIn <-- relayUnit.lowerLayerOut[i];
mac[i].upperLayerOut --> relayUnit.lowerLayerIn[i];
mac[i].phys <--> ethg[i];
}
}