├── .nedfolders ├── simulations ├── __init__.py ├── processing_scripts │ ├── bash_scripts.pyc │ └── processing_functions.pyc └── configurations │ └── LoadBalancing │ └── demo.py ├── src ├── package.ned └── model │ ├── node │ ├── resequencingLayer │ │ ├── test │ │ │ ├── ResequencingTest.ini │ │ │ └── TestNetworkForResequencer.ned │ │ ├── .tkenvrc │ │ ├── Resequencer.ned │ │ ├── SequenceNumberResequencer.ned │ │ ├── HybridResequencer.ned │ │ └── HybridResequencer.h │ ├── schedulingLayer │ │ ├── .tkenvrc │ │ ├── SchedulingPacket.h │ │ ├── Demultiplexer.ned │ │ ├── Multiplexer.ned │ │ ├── schedFromFile │ │ │ ├── testScript.txt │ │ │ ├── exampleRateSchedule.txt │ │ │ └── ScheduleFromFile.h │ │ ├── SchedulingLayerInterface.ned │ │ ├── SchedulingMessage.msg │ │ ├── EmptySchedulingLayer.ned │ │ ├── proxy │ │ │ ├── RequestPacket.msg │ │ │ ├── ResponsePacket.msg │ │ │ ├── RequestPacket.h │ │ │ ├── ResponsePacket.h │ │ │ └── proxy.ned │ │ ├── Controller.ned │ │ ├── Multiplexer.h │ │ ├── Demultiplexer.h │ │ ├── SchedulingAlgorithm.h │ │ ├── SchedulingPacket.msg │ │ ├── SchedulingAlgorithm.ned │ │ └── SchedulingController.h │ ├── applicationLayer │ │ ├── messageApplication │ │ │ ├── trafficPatterns │ │ │ │ ├── TrafficPatterns.h │ │ │ │ ├── TrafficPattern.cc │ │ │ │ ├── TP_AllToAll.h │ │ │ │ ├── TP_LBDestImbalance.h │ │ │ │ ├── TP_PairedPodPermutation.h │ │ │ │ ├── TrafficPattern.h │ │ │ │ ├── TP_PairedPermutation.h │ │ │ │ ├── TP_AllToAllVictimTenant.h │ │ │ │ ├── TP_AllToAllPartition.h │ │ │ │ ├── TP_AllToAll.cc │ │ │ │ └── TP_AllToAllVictimTenant.cc │ │ │ ├── ActiveMessage.ned │ │ │ ├── UpdateSendingRateMessage.msg │ │ │ ├── UpdateQueueSizeMessage.msg │ │ │ ├── exampleMessageScript.txt │ │ │ ├── AppMessage.h │ │ │ ├── AppMessage.cc │ │ │ ├── MAAdjustQueueSizeToRate.h │ │ │ └── MAAdjustQueueSizeToRate.ned │ │ ├── TCPAppInterface.ned │ │ ├── SimpleUDPApplicationNode.ned │ │ ├── TCPMessageApplication │ │ │ └── TCPMessageApplication.ned │ │ └── BklgSchedApplication │ │ │ ├── BklgSchedApplication.ned │ │ │ └── ServerBacklog.ned │ ├── server │ │ ├── Server.ned │ │ └── TrafficScriptApplication.ned │ ├── control │ │ ├── ModuleWithControlPort.ned │ │ ├── ControlLogic.ned │ │ └── ControlLogic.h │ ├── linkLayer │ │ ├── Path.ned │ │ ├── Path.h │ │ ├── LinkLayerInterface.ned │ │ ├── Path.cc │ │ ├── ServerPortQueue.ned │ │ ├── MPLoadBalancer.h │ │ └── ServerPortQueue.h │ ├── transportLayer │ │ ├── InetTCPWrapper.ned │ │ ├── InetTCP.ned │ │ ├── SimpleUDP.ned │ │ ├── SimpleUDP.h │ │ ├── EmptyTCP.ned │ │ ├── InetTCPWrapper.h │ │ ├── InetTCPConnectionWrapper.h │ │ ├── SimpleUDP.cc │ │ └── TCPInterface.ned │ └── networkLayer │ │ ├── VirtualIP.ned │ │ ├── NetworkLayer.ned │ │ ├── NetworkLayerBase.h │ │ ├── VirtualIP.h │ │ ├── VirtualIP.cc │ │ └── NetworkLayerBase.cc │ ├── common │ ├── .tkenvrc │ ├── set.cc │ ├── PacketDropper.ned │ ├── DCUtilities.h │ ├── std_includes.h │ ├── ServerBuffer.ned │ ├── PacketDropper.h │ ├── DCCommon.cc │ ├── FatTreeNode.h │ ├── DCUtilities.cc │ ├── FatTreeNode.ned │ ├── BandwidthMeter.h │ ├── BandwidthMeter.ned │ ├── FatTreeNode.cc │ ├── ServerBuffer.h │ └── ServerStream.ned │ ├── packets │ ├── DCN_IPPacket.cc │ ├── DCN_TCPPacket.cc │ ├── DCN_UDPPacket.cc │ ├── ControlMessage.cc │ ├── DCN_EthPacket.cc │ ├── DCN_IPPacket.msg │ ├── DCN_UDPPacket.msg │ ├── DCN_TCPPacket.msg │ ├── ControlMessage.h │ ├── DCN_IPPacket.h │ ├── DCN_TCPPacket.h │ ├── DCN_UDPPacket.h │ ├── ControlMessage.msg │ ├── DCN_EthPacket.h │ ├── DCN_EthPacket.msg │ └── DCN_TCPPacket_m.h │ ├── link │ ├── DCLink.cc │ └── DCLink.h │ ├── switch │ ├── ControlProcessor.ned │ ├── SwitchPortQueue.h │ └── ControlProcessor.h │ └── networks │ ├── fattree │ └── recursive │ │ ├── FatTree.ned │ │ └── ServerNode.ned │ ├── testNetworks │ ├── TCPClientServerInet.ned │ ├── TCPClientServerTest.ned │ └── PacketSizeTest.ned.renamed_to_avoid_warnings │ └── .tkenvrc ├── doc └── build_instructions.pdf ├── README.md ├── .oppbuildspec ├── BuildFatTree ├── README ├── .depend ├── Makefile ├── server.h ├── connection.h ├── ethernet_node.h ├── connection.cc ├── ethernet_switch.h ├── main.cc └── server.cc ├── Makefile.vc ├── .gitignore ├── .project └── makemakefiles /.nedfolders: -------------------------------------------------------------------------------- 1 | src 2 | -------------------------------------------------------------------------------- /simulations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/package.ned: -------------------------------------------------------------------------------- 1 | package datacenter; 2 | 3 | @license(LGPL); 4 | -------------------------------------------------------------------------------- /doc/build_instructions.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haitjema/DataCenter/HEAD/doc/build_instructions.pdf -------------------------------------------------------------------------------- /src/model/node/resequencingLayer/test/ResequencingTest.ini: -------------------------------------------------------------------------------- 1 | [General] 2 | network = TestNetworkForResequencer 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | DataCenter 2 | ========== 3 | 4 | A lightweight packet-level OMNeT++ simulator designed to simulate large FatTree data center networks. 5 | -------------------------------------------------------------------------------- /simulations/processing_scripts/bash_scripts.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haitjema/DataCenter/HEAD/simulations/processing_scripts/bash_scripts.pyc -------------------------------------------------------------------------------- /simulations/processing_scripts/processing_functions.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/haitjema/DataCenter/HEAD/simulations/processing_scripts/processing_functions.pyc -------------------------------------------------------------------------------- /src/model/common/.tkenvrc: -------------------------------------------------------------------------------- 1 | # Partial Tkenv config file -- see $HOME/.tkenvrc as well 2 | inspector "LogicalTree_4_2_3" "LogicalTree_4_2_3" "2" "2032x823+5+27:normal" 3 | 4 | -------------------------------------------------------------------------------- /src/model/node/resequencingLayer/.tkenvrc: -------------------------------------------------------------------------------- 1 | # Partial Tkenv config file -- see $HOME/.tkenvrc as well 2 | inspector "TestNetworkForResequencer" "TestNetworkForResequencer" "2" "772x283+371+244:normal" 3 | 4 | -------------------------------------------------------------------------------- /src/model/node/schedulingLayer/.tkenvrc: -------------------------------------------------------------------------------- 1 | # Partial Tkenv config file -- see $HOME/.tkenvrc as well 2 | inspector "FatTree_4_2_3" "FatTree_4_2_3" "2" "643x284+5+27:normal" 3 | inspector "TestNetworkForSchedulingLayer" "TestNetworkForSchedulingLayer" "2" "799x339+1120+22:normal" 4 | inspector "TestNetworkForSchedulingLayer.schedulingLayer" "SchedulingLayer" "2" "805x492+1118+414:normal" 5 | 6 | -------------------------------------------------------------------------------- /.oppbuildspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /BuildFatTree/README: -------------------------------------------------------------------------------- 1 | This folder contains a simple command line utility to generate NED files 2 | for FatTree networks. While originally intended to be more general, it 3 | can currently only generate fully provisioned (i.e. full bisection 4 | bandwidth) FatTrees with uniformly sized links and switches. 5 | As a result, the only arguments are the number of ports per switch 6 | and the number of levels. 7 | 8 | Note this utility depends on several files form the src/model tree 9 | and expects this path to be one level up. -------------------------------------------------------------------------------- /BuildFatTree/.depend: -------------------------------------------------------------------------------- 1 | connection.o: connection.cc std_includes.h node_id.h ethernet_node.h \ 2 | connection.h 3 | ethernet_node.o: ethernet_node.cc std_includes.h node_id.h \ 4 | ethernet_node.h 5 | ethernet_switch.o: ethernet_switch.cc std_includes.h node_id.h \ 6 | ethernet_node.h ethernet_switch.h 7 | fat_tree.o: fat_tree.cc std_includes.h node_id.h ethernet_node.h \ 8 | ethernet_switch.h server.h connection.h fat_tree.h 9 | main.o: main.cc std_includes.h node_id.h ethernet_node.h \ 10 | ethernet_switch.h fat_tree.h 11 | node_id.o: node_id.cc std_includes.h node_id.h 12 | server.o: server.cc std_includes.h node_id.h ethernet_node.h server.h 13 | -------------------------------------------------------------------------------- /Makefile.vc: -------------------------------------------------------------------------------- 1 | all: checkmakefiles 2 | cd src && $(MAKE) -f Makefile.vc 3 | 4 | clean: checkmakefiles 5 | cd src && $(MAKE) -f Makefile.vc clean 6 | 7 | cleanall: checkmakefiles 8 | cd src && $(MAKE) -f Makefile.vc MODE=release clean 9 | cd src && $(MAKE) -f Makefile.vc MODE=debug clean 10 | 11 | makefiles: 12 | cd src && call opp_nmakemake -f --deep 13 | 14 | checkmakefiles: 15 | @if not exist src\Makefile.vc ( \ 16 | echo. && \ 17 | echo ============================================================================ && \ 18 | echo src/Makefile.vc does not exist. Please use the following command to generate it: && \ 19 | echo nmake -f Makefile.vc makefiles && \ 20 | echo ============================================================================ && \ 21 | echo. && \ 22 | exit 1 ) 23 | -------------------------------------------------------------------------------- /BuildFatTree/Makefile: -------------------------------------------------------------------------------- 1 | VPATH = src:../src/model/common 2 | TARGET := BuildFatTree 3 | SRCS := connection.cc ethernet_node.cc ethernet_switch.cc fat_tree.cc main.cc node_id.cc server.cc 4 | OBJS := ${SRCS:.cc=.o} 5 | DEPS := ${SRCS:.cc=.dep} 6 | XDEPS := $(wildcard ${DEPS}) 7 | 8 | CC = g++ 9 | CCFLAGS = -g -Wall -Werror 10 | LDFLAGS = 11 | LIBS = 12 | 13 | .PHONY: all clean distclean 14 | all:: ${TARGET} 15 | 16 | ifneq (${XDEPS},) 17 | include ${XDEPS} 18 | endif 19 | 20 | ${TARGET}: ${OBJS} 21 | ${CC} ${LDFLAGS} -o $@ $^ ${LIBS} 22 | 23 | ${OBJS}: %.o: %.cc %.dep 24 | ${CC} ${CCFLAGS} -o $@ -c $< 25 | 26 | ${DEPS}: %.dep: %.cc Makefile 27 | ${CC} ${CCFLAGS} -MM $< > $@ 28 | 29 | clean:: 30 | -rm -f *~ *.o *.dep ${TARGET} 31 | 32 | distclean:: clean 33 | -------------------------------------------------------------------------------- /src/model/packets/DCN_IPPacket.cc: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #include "DCN_IPPacket.h" 17 | 18 | Register_Class(DCN_IPPacket); 19 | -------------------------------------------------------------------------------- /src/model/packets/DCN_TCPPacket.cc: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #include "DCN_TCPPacket.h" 17 | 18 | Register_Class(DCN_TCPPacket); 19 | -------------------------------------------------------------------------------- /src/model/packets/DCN_UDPPacket.cc: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #include "DCN_UDPPacket.h" 17 | 18 | Register_Class(DCN_UDPPacket); 19 | -------------------------------------------------------------------------------- /src/model/packets/ControlMessage.cc: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #include "ControlMessage.h" 17 | 18 | Register_Class(ControlMessage); 19 | -------------------------------------------------------------------------------- /BuildFatTree/server.h: -------------------------------------------------------------------------------- 1 | /* 2 | * server.h 3 | * BuildFatTree 4 | * 5 | * Created by Mart on 5/19/11. 6 | * Copyright 2011 Washington University in St. Louis. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef SERVER_H_ 11 | #define SERVER_H_ 12 | 13 | class Server : public EthNode 14 | { 15 | public: 16 | explicit Server(const SubTreeID& server_id, uint depth); // must use explicit or c++ assumes function can be used as a conversion 17 | virtual ~Server(); 18 | 19 | virtual std::string get_type() const { return "Server"; } 20 | 21 | void incServerObjects(); 22 | void decServerObjects(); 23 | 24 | virtual std::string NedType() { return " like Server"; } 25 | virtual std::string NedPort(uint port_number); 26 | protected: 27 | void PrintNedParameters(); 28 | void PrintNedGates(); 29 | }; 30 | 31 | #endif // SERVER_H_ 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/model/node/applicationLayer/messageApplication/trafficPatterns/TrafficPatterns.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef TRAFFIC_PATTERNS_H_ 17 | #define TRAFFIC_PATTERNS_H_ 18 | 19 | 20 | 21 | #endif /* TRAFFIC_PATTERNS_H_ */ 22 | -------------------------------------------------------------------------------- /src/model/node/server/Server.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.server; 17 | 18 | moduleinterface Server 19 | { 20 | parameters: 21 | int address; 22 | gates: 23 | inout port; 24 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled source # 2 | ################### 3 | *.com 4 | *.class 5 | *.dll 6 | *.exe 7 | *.o 8 | *.so 9 | *.pyc 10 | # Make stuff 11 | *.dep 12 | 13 | # Packages # 14 | ############ 15 | # it's better to unpack these files and commit the raw source 16 | # git has its own built in compression methods 17 | *.7z 18 | *.dmg 19 | *.gz 20 | *.iso 21 | *.jar 22 | *.rar 23 | *.tar 24 | *.zip 25 | 26 | # Logs and databases # 27 | ###################### 28 | *.log 29 | *.sql 30 | *.sqlite 31 | 32 | # OS generated files # 33 | ###################### 34 | .DS_Store 35 | .DS_Store? 36 | ._* 37 | .Spotlight-V100 38 | .Trashes 39 | ehthumbs.db 40 | Thumbs.db 41 | 42 | # OMNeT++ generated files # 43 | ##################### 44 | *_m.cc 45 | *_m.h 46 | out/* 47 | src/DataCenter 48 | DataCenter 49 | *.vci 50 | *.vec 51 | *.sca 52 | *.anf 53 | BuildFatTree/BuildFatTree 54 | 55 | # Other 56 | .metadata 57 | .ropeproject 58 | .settings 59 | .tkenvrc 60 | -------------------------------------------------------------------------------- /src/model/node/applicationLayer/messageApplication/ActiveMessage.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.applicationLayer.messageApplication; 17 | 18 | simple ActiveMessage 19 | { 20 | parameters: 21 | @class(ActiveMessage); 22 | } -------------------------------------------------------------------------------- /src/model/node/schedulingLayer/SchedulingPacket.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef SCHEDULINGPACKET_H_ 17 | #define SCHEDULINGPACKET_H_ 18 | 19 | #include "SchedulingPacket_m.h" 20 | 21 | typedef double bklg_t; 22 | typedef double rate_t; 23 | 24 | #endif /* SCHEDULINGPACKET_H_ */ 25 | -------------------------------------------------------------------------------- /src/model/node/schedulingLayer/Demultiplexer.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.schedulingLayer; 17 | 18 | simple Demultiplexer 19 | { 20 | parameters: 21 | @display("i=block/fork"); 22 | gates: 23 | input in; 24 | output out[]; 25 | } 26 | -------------------------------------------------------------------------------- /src/model/node/schedulingLayer/Multiplexer.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.schedulingLayer; 17 | 18 | simple Multiplexer 19 | { 20 | parameters: 21 | @display("i=block/join"); 22 | gates: 23 | input in[]; 24 | output out; 25 | } 26 | -------------------------------------------------------------------------------- /src/model/common/set.cc: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #include "set.h" 17 | 18 | template T sum(const Set& S) { 19 | T val=0; for (size_t i=0; i uint len(const Set& S) { return S.size(); } 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/model/node/control/ModuleWithControlPort.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.control; 17 | import datacenter.model.common.FatTreeNode; 18 | 19 | simple ModuleWithControlPort extends FatTreeNode 20 | { 21 | @class(ModuleWithControlPort); 22 | gates: 23 | input control @directIn; 24 | } 25 | 26 | -------------------------------------------------------------------------------- /src/model/node/schedulingLayer/schedFromFile/testScript.txt: -------------------------------------------------------------------------------- 1 | # Script: testScript.txt 2 | # Generated by SG_PermutationTraffic at time: Tue Sep 25 00:44:10 2012 3 | # Number of servers = 16, levels = 3, paths = 4 4 | # Message format is as follows: 5 | # ;;;;; 6 | 0; 9; 0; 0 s; 1.07374e+10 bytes; 0 bps 7 | 1; 4; 0; 0 s; 1.07374e+10 bytes; 0 bps 8 | 2; 7; 0; 0 s; 1.07374e+10 bytes; 0 bps 9 | 3; 12; 0; 0 s; 1.07374e+10 bytes; 0 bps 10 | 4; 13; 0; 0 s; 1.07374e+10 bytes; 0 bps 11 | 5; 8; 0; 0 s; 1.07374e+10 bytes; 0 bps 12 | 6; 14; 0; 0 s; 1.07374e+10 bytes; 0 bps 13 | 7; 1; 0; 0 s; 1.07374e+10 bytes; 0 bps 14 | 8; 5; 0; 0 s; 1.07374e+10 bytes; 0 bps 15 | 9; 14; 0; 0 s; 1.07374e+10 bytes; 0 bps 16 | 10; 15; 0; 0 s; 1.07374e+10 bytes; 0 bps 17 | 11; 0; 0; 0 s; 1.07374e+10 bytes; 0 bps 18 | 12; 8; 0; 0 s; 1.07374e+10 bytes; 0 bps 19 | 13; 4; 0; 0 s; 1.07374e+10 bytes; 0 bps 20 | 14; 6; 0; 0 s; 1.07374e+10 bytes; 0 bps 21 | 15; 10; 0; 0 s; 1.07374e+10 bytes; 0 bps 22 | -------------------------------------------------------------------------------- /src/model/common/PacketDropper.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.common; 17 | 18 | // This simple module drops packets 19 | simple PacketDropper 20 | { 21 | parameters: 22 | @display("i=old/x_cross"); 23 | string dropScript = default(""); 24 | gates: 25 | inout port[2]; 26 | } 27 | -------------------------------------------------------------------------------- /src/model/node/linkLayer/Path.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.linkLayer; 17 | 18 | simple Path 19 | { 20 | parameters: 21 | @signal[pathBytes](type="long"); 22 | @statistic[pathBytes](title="packet byte length sent on path";unit=bytes;record=vector?,count?,sum?,histogram?;interpolationmode=none); 23 | } 24 | -------------------------------------------------------------------------------- /src/model/node/transportLayer/InetTCPWrapper.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.transportLayer; 17 | 18 | //import inet.transport.tcp.ITCP; 19 | //import inet.transport.tcp.TCP; 20 | 21 | simple InetTCPWrapper extends InetTCP like TCPInterface 22 | { 23 | parameters: 24 | @class(InetTCPWrapper); 25 | } 26 | -------------------------------------------------------------------------------- /BuildFatTree/connection.h: -------------------------------------------------------------------------------- 1 | /* 2 | * connection.h 3 | * BuildFatTree 4 | * 5 | * Created by Mart Haitjema on 5/24/11. 6 | * Copyright 2011 Washington University in St. Louis. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef CONNECTION_H_ 11 | #define CONNECTION_H_ 12 | 13 | // XXX No longer need this 14 | enum CONNECTION_TYPE { 15 | ETH_1_GBPS, 16 | ETH_10_GBPS 17 | }; 18 | 19 | // Default link rate in bps 20 | #define DEFAULT_DATARATE (1*GBPS) 21 | // Default link delay in nanoseconds 22 | #define DEFAULT_DELAY (0*NS) 23 | 24 | std::string datarateNedStr(ulong datarate); 25 | std::string delayNedStr(double delay); 26 | 27 | class Connection 28 | { 29 | public: 30 | Connection(const std::string &type, EthPort *, EthPort *, ulong datarate_=DEFAULT_DATARATE, double delay=DEFAULT_DELAY); 31 | virtual ~Connection(); 32 | 33 | void PrintNed(); 34 | 35 | private: 36 | std::string type_; 37 | EthPort *port1_; 38 | EthPort *port2_; 39 | ulong datarate_; 40 | double delay_; 41 | }; 42 | 43 | #endif // CONNECTION_H_ 44 | -------------------------------------------------------------------------------- /src/model/node/networkLayer/VirtualIP.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.networkLayer; 17 | 18 | simple VirtualIP like NetworkLayerNode 19 | { 20 | parameters: 21 | @class(VirtualIP); 22 | int address; 23 | gates: 24 | inout tcp; 25 | inout udp; 26 | inout lower_layer; 27 | } 28 | -------------------------------------------------------------------------------- /src/model/node/applicationLayer/messageApplication/UpdateSendingRateMessage.msg: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | cplusplus {{ 17 | #include "ControlMessage.h" 18 | }} 19 | message ControlMessage; 20 | 21 | message UpdateSendingRateMessage extends ControlMessage { 22 | type enum(ControlMessageType) = UPDATE_SENDING_RATE_MSG; 23 | double sendingRate; 24 | }; 25 | -------------------------------------------------------------------------------- /src/model/node/control/ControlLogic.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.control; 17 | import datacenter.model.common.FatTreeNode; 18 | 19 | simple ControlLogic extends FatTreeNode 20 | { 21 | @class(ControlLogic); 22 | @display("i=block/dispatch"); 23 | gates: 24 | input control @directIn; 25 | inout otherServers; 26 | } 27 | -------------------------------------------------------------------------------- /src/model/node/applicationLayer/messageApplication/UpdateQueueSizeMessage.msg: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | cplusplus {{ 17 | #include "ControlMessage.h" 18 | }} 19 | message ControlMessage; 20 | 21 | message UpdateQueueSizeMessage extends ControlMessage { 22 | type enum(ControlMessageType) = UPDATE_QUEUE_SIZE_MSG; 23 | long queueSizePkts; 24 | long queueSizeBytes; 25 | }; 26 | -------------------------------------------------------------------------------- /src/model/node/linkLayer/Path.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef PATH_H_ 17 | #define PATH_H_ 18 | 19 | class Path : public cSimpleModule { 20 | public: 21 | Path(); 22 | virtual ~Path(); 23 | virtual void initialize(); 24 | 25 | virtual void performAccounting(DCN_EthPacket *pkt); 26 | protected: 27 | simsignal_t pathBytesSignal; 28 | }; 29 | 30 | #endif /* PATH_H_ */ 31 | -------------------------------------------------------------------------------- /src/model/packets/DCN_EthPacket.cc: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #include "DCN_EthPacket.h" 17 | 18 | Register_Class(DCN_EthPacket); 19 | 20 | void DCN_EthPacket::setPayloadLengthBytes(int64 payloadBytes) 21 | { 22 | setPayload(payloadBytes); 23 | int64 rawSize = payloadBytes + getOverheadBytes(); 24 | setByteLength((rawSize < DCN_MIN_PACKET_SIZE) ? DCN_MIN_PACKET_SIZE : rawSize); 25 | } 26 | -------------------------------------------------------------------------------- /src/model/node/transportLayer/InetTCP.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.transportLayer; 17 | //import inet.transport.tcp.ITCP; 18 | import inet.transport.ITCP; 19 | import inet.transport.tcp.TCP; 20 | 21 | 22 | simple InetTCP extends TCP like TCPInterface 23 | { 24 | parameters: 25 | mss = default(1452); // XXX MSS = MTU - HEADERS (IP & TCP) 26 | } 27 | 28 | -------------------------------------------------------------------------------- /src/model/packets/DCN_IPPacket.msg: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | enum IPProtocolId; 17 | 18 | cplusplus {{ 19 | #include "DCN_EthPacket.h" 20 | }} 21 | packet DCN_EthPacket; 22 | 23 | packet DCN_IPPacket extends DCN_EthPacket 24 | { 25 | @customize(true); 26 | kind enum(DCN_EthPacketType) = DCN_IP_PACKET; 27 | unsigned short transportProtocol enum(IPProtocolId) = IP_PROT_NONE; 28 | } 29 | -------------------------------------------------------------------------------- /src/model/node/schedulingLayer/SchedulingLayerInterface.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.schedulingLayer; 17 | 18 | moduleinterface SchedulingLayerInterface 19 | { 20 | parameters: 21 | @display("i=block/subqueue"); 22 | int address; 23 | //string SchedulingAlgorithm; 24 | gates: 25 | inout upper_layer; 26 | inout lower_layer; 27 | } -------------------------------------------------------------------------------- /src/model/node/applicationLayer/TCPAppInterface.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.applicationLayer; 17 | //import inet.applications.tcpapp.TCPApp; 18 | import inet.applications.ITCPApp; 19 | 20 | //moduleinterface TCPAppInterface extends TCPApp 21 | moduleinterface TCPAppInterface extends ITCPApp 22 | { 23 | parameters: 24 | bool enabled; 25 | int address; 26 | } 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/model/node/applicationLayer/messageApplication/trafficPatterns/TrafficPattern.cc: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | #include "DCCommon.h" 16 | #include "TrafficPattern.h" 17 | 18 | 19 | //TrafficPattern::TrafficPattern(const SubTreeID &node_id, double messageSize) : node_id_(node_id), messageSize_(messageSize) 20 | TrafficPattern::TrafficPattern() 21 | { 22 | } 23 | 24 | 25 | TrafficPattern::~TrafficPattern() 26 | { 27 | } 28 | -------------------------------------------------------------------------------- /src/model/link/DCLink.cc: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #include "DCCommon.h" 17 | #include "DCLink.h" 18 | 19 | Define_Channel(DCLink); 20 | 21 | DCLink::DCLink() 22 | { 23 | } 24 | 25 | void DCLink::processMessage(cMessage *msg, simtime_t t, result_t &result) 26 | { 27 | cDatarateChannel::processMessage(msg, t, result); 28 | if (!msg->isPacket()) result.delay = 0; 29 | } 30 | 31 | DCLink::~DCLink() 32 | { 33 | } 34 | 35 | -------------------------------------------------------------------------------- /src/model/node/transportLayer/SimpleUDP.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.transportLayer; 17 | 18 | simple SimpleUDP 19 | { 20 | parameters: 21 | @class(SimpleUDP); 22 | 23 | @display("i=block/wheelbarrow"); 24 | gates: 25 | //inout upper_layer[]; // XXX TODO: extend to support multiple applications? 26 | inout upper_layer; 27 | inout lower_layer; 28 | } 29 | -------------------------------------------------------------------------------- /src/model/node/applicationLayer/SimpleUDPApplicationNode.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.applicationLayer; 17 | 18 | moduleinterface SimpleUDPApplicationNode 19 | { 20 | parameters: 21 | bool enabled; 22 | int address; 23 | @display("i=block/app"); 24 | gates: 25 | // inout upper_layer; // Application is at the top of the stack 26 | inout lower_layer; 27 | } 28 | 29 | -------------------------------------------------------------------------------- /src/model/common/DCUtilities.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef DCUTILITIES_H_ 17 | #define DCUTILITIES_H_ 18 | #include 19 | 20 | // Uses the Boost libraries to build a directory tree 21 | bool dirExists(const char *path); 22 | std::string fullPath(const char *file_or_dir); 23 | bool isDirectory(const char *dir); 24 | bool isRegularFile(const char *file); 25 | void createDirectories(const char *path); 26 | 27 | #endif /* DCUTILITIES_H_ */ 28 | -------------------------------------------------------------------------------- /src/model/link/DCLink.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef DCLINK_H_ 17 | #define DCLINK_H_ 18 | 19 | // I extended cDatarateChannel so that messages that are not packets (e.g. control messages) 20 | // experience no delay. 21 | 22 | class DCLink : public cDatarateChannel { 23 | public: 24 | DCLink(); 25 | virtual void processMessage(cMessage *msg, simtime_t t, result_t &result); 26 | 27 | virtual ~DCLink(); 28 | }; 29 | 30 | #endif /* DCLINK_H_ */ 31 | -------------------------------------------------------------------------------- /src/model/node/schedulingLayer/SchedulingMessage.msg: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | cplusplus {{ 17 | #include "ControlMessage.h" 18 | }} 19 | message ControlMessage; 20 | 21 | // Meant to encapsulate a scheduling packet so that we can deliver scheduling 22 | // packets as control messages (simulate scheduling without control overhead) 23 | message SchedulingControlMessage extends ControlMessage { 24 | type enum(ControlMessageType) = SCHEDULING_CONTROL_MSG; 25 | 26 | }; 27 | -------------------------------------------------------------------------------- /src/model/node/schedulingLayer/EmptySchedulingLayer.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.schedulingLayer; 17 | 18 | module EmptySchedulingLayer like SchedulingLayerInterface 19 | { 20 | parameters: 21 | @display("i=block/subqueue"); 22 | int address; 23 | //string schedAlgorithm; 24 | gates: 25 | inout upper_layer; 26 | inout lower_layer; 27 | connections: 28 | upper_layer <--> lower_layer; 29 | } 30 | -------------------------------------------------------------------------------- /src/model/node/control/ControlLogic.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef CONTROLLOGIC_H_ 17 | #define CONTROLLOGIC_H_ 18 | 19 | class ControlLogic : public FatTreeNode { 20 | public: 21 | ControlLogic(); 22 | virtual void initialize(); 23 | virtual void handleMessage(cMessage *msg); 24 | virtual ~ControlLogic(); 25 | protected: 26 | 27 | cModule *serverModule; 28 | cGate *controlGate; 29 | cGate *otherServersGate_in; 30 | cGate *otherServersGate_out; 31 | }; 32 | 33 | #endif /* CONTROLLOGIC_H_ */ 34 | -------------------------------------------------------------------------------- /src/model/node/applicationLayer/messageApplication/trafficPatterns/TP_AllToAll.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | #ifndef TP_ALLTOALL_H_ 16 | #define TP_ALLTOALL_H_ 17 | 18 | #include "TrafficPattern.h" 19 | 20 | 21 | class TP_AllToAll : public TrafficPattern { 22 | public: 23 | virtual AppMessageVector createTraffic(const SubTreeID &node_id, double messageSize); 24 | protected: 25 | virtual void addMessagesForServer(uint server_address, AppMessageVector &messages); 26 | }; 27 | 28 | 29 | #endif /* TP_ALLTOALL_H_ */ 30 | -------------------------------------------------------------------------------- /src/model/packets/DCN_UDPPacket.msg: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | enum IPProtocolId; 17 | 18 | cplusplus {{ 19 | #include "DCN_IPPacket.h" 20 | 21 | #define UDP_OVERHEAD (IP_OVERHEAD + UDP_HEADER_SIZE) 22 | #define MAX_UDP_PAYLOAD (ETHER_MAX_SEG_SIZE - UDP_OVERHEAD) 23 | 24 | }} 25 | 26 | 27 | 28 | packet DCN_IPPacket; 29 | 30 | packet DCN_UDPPacket extends DCN_IPPacket 31 | { 32 | @customize(true); 33 | kind enum(DCN_EthPacketType) = DCN_UDP_PACKET; 34 | transportProtocol = IP_PROT_UDP; 35 | } 36 | -------------------------------------------------------------------------------- /src/model/node/transportLayer/SimpleUDP.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef SIMPLEUDP_H_ 17 | #define SIMPLEUDP_H_ 18 | 19 | class SimpleUDP : public cSimpleModule 20 | { 21 | public: 22 | SimpleUDP(); 23 | virtual ~SimpleUDP(); 24 | 25 | 26 | virtual void initialize(); 27 | virtual void handleMessage(cMessage *msg); 28 | 29 | protected: 30 | cGate *lowerLayerIn_; 31 | cGate *lowerLayerOut_; 32 | cGate *upperLayerIn_; 33 | cGate *upperLayerOut_; 34 | 35 | }; 36 | 37 | #endif /* SIMPLEUDP_H_ */ 38 | -------------------------------------------------------------------------------- /src/model/node/schedulingLayer/proxy/RequestPacket.msg: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | cplusplus {{ 16 | #include "SchedulingPacket.h" 17 | typedef double bklg_t; 18 | typedef double rate_t; 19 | }} 20 | packet SchedulingPacket; 21 | 22 | class noncobject bklg_t; 23 | class noncobject rate_t; 24 | 25 | packet RequestPacket extends SchedulingPacket { 26 | @customize(true); 27 | schedPktType = SCHEDULING_REQUEST; // Defined in SchedulingPacket.msg 28 | rate_t request; // requested rate 29 | bklg_t bklg; // backlog 30 | } 31 | -------------------------------------------------------------------------------- /src/model/node/applicationLayer/messageApplication/trafficPatterns/TP_LBDestImbalance.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | #ifndef TP_LBDESTIMBALANCE_H 16 | #define TP_LBDESTIMBALANCE_H 17 | 18 | #include "TrafficPattern.h" 19 | 20 | 21 | class TP_LBDestImbalance : public TrafficPattern { 22 | public: 23 | virtual AppMessageVector createTraffic(const SubTreeID &node_id, double messageSize); 24 | protected: 25 | void addMessagesForServer(uint server_address, AppMessageVector &messages); 26 | }; 27 | 28 | 29 | #endif /* TP_LBDESTIMBALANCE_H */ 30 | -------------------------------------------------------------------------------- /src/model/node/schedulingLayer/proxy/ResponsePacket.msg: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | cplusplus {{ 16 | #include "SchedulingPacket.h" 17 | typedef double bklg_t; 18 | typedef double rate_t; 19 | }} 20 | packet SchedulingPacket; 21 | 22 | class noncobject bklg_t; 23 | class noncobject rate_t; 24 | 25 | packet ResponsePacket extends SchedulingPacket { 26 | @customize(true); 27 | schedPktType = SCHEDULING_RESPONSE; // Defined in SchedulingPacket.msg 28 | bklg_t share; // Minimum share along path 29 | rate_t rate; // Allowed sending rate 30 | } 31 | -------------------------------------------------------------------------------- /src/model/packets/DCN_TCPPacket.msg: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | enum IPProtocolId; 17 | 18 | cplusplus {{ 19 | #include "DCN_IPPacket.h" 20 | }} 21 | packet DCN_IPPacket; 22 | 23 | // XXX I might not want this because in VirtualIP, it's more clear if I use DCN_IPPacket to encapsulate 24 | // a TCP segment than if I use a DCN_TCPPacket class to encapsulate a TCPSegment 25 | 26 | packet DCN_TCPPacket extends DCN_IPPacket 27 | { 28 | @customize(true); 29 | kind enum(DCN_EthPacketType) = DCN_TCP_PACKET; 30 | transportProtocol = IP_PROT_TCP; 31 | } 32 | -------------------------------------------------------------------------------- /src/model/node/applicationLayer/messageApplication/trafficPatterns/TP_PairedPodPermutation.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | #ifndef TP_PAIREDPODPERMUTATION_H_ 16 | #define TP_PAIREDPODPERMUTATION_H_ 17 | 18 | #include "TrafficPattern.h" 19 | 20 | 21 | class TP_PairedPodPermutation : public TrafficPattern { 22 | public: 23 | virtual AppMessageVector createTraffic(const SubTreeID &node_id, double messageSize); 24 | protected: 25 | virtual void createPodPermutation(uint_vec_t &serverAssignments); 26 | }; 27 | 28 | 29 | #endif /* TP_PAIREDPODPERMUTATION_H_ */ 30 | -------------------------------------------------------------------------------- /src/model/node/applicationLayer/messageApplication/trafficPatterns/TrafficPattern.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | #ifndef TRAFFICPATTERN_H_ 16 | #define TRAFFICPATTERN_H_ 17 | 18 | #include "AppMessage.h" 19 | #include "node_id.h" 20 | 21 | 22 | class TrafficPattern { 23 | public: 24 | TrafficPattern(); 25 | virtual ~TrafficPattern(); 26 | virtual AppMessageVector createTraffic(const SubTreeID &node_id, double messageSize=0) = 0; 27 | protected: 28 | SubTreeID node_id_; 29 | double messageSize_; 30 | }; 31 | 32 | 33 | #endif /* TRAFFICPATTERN_H_ */ 34 | -------------------------------------------------------------------------------- /src/model/node/linkLayer/LinkLayerInterface.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.linkLayer; 17 | 18 | moduleinterface LinkLayerInterface 19 | { 20 | parameters: 21 | int address; 22 | int number_of_paths; // This is a global that should be in the network NED file 23 | bool measureBandwidth; 24 | string LoadBalancerType; 25 | @display("i=block/network"); 26 | gates: 27 | inout upper_layer; 28 | inout lower_layer; // Must be directly connected to the transmission channel 29 | inout control; 30 | } 31 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | DataCenter 4 | 5 | 6 | inet 7 | 8 | 9 | 10 | org.omnetpp.cdt.MakefileBuilder 11 | 12 | 13 | 14 | 15 | org.omnetpp.scave.builder.vectorfileindexer 16 | 17 | 18 | 19 | 20 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 21 | clean,full,incremental, 22 | 23 | 24 | 25 | 26 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 27 | full,incremental, 28 | 29 | 30 | 31 | 32 | 33 | org.eclipse.cdt.core.cnature 34 | org.eclipse.cdt.core.ccnature 35 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 36 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 37 | org.omnetpp.main.omnetppnature 38 | 39 | 40 | -------------------------------------------------------------------------------- /src/model/node/linkLayer/Path.cc: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #include "DCCommon.h" 17 | #include "Path.h" 18 | 19 | Path::Path() 20 | { 21 | } 22 | 23 | void Path::initialize() 24 | { 25 | LOG(DEBUG) << typeid(this).name() << endl; 26 | pathBytesSignal = registerSignal("pathBytes"); 27 | } 28 | 29 | void Path::performAccounting(DCN_EthPacket *pkt) 30 | { 31 | Enter_Method("Path %d chosen", getIndex()); 32 | EVF << " emit " << (long)pkt->getByteLength() << endl; 33 | emit(pathBytesSignal, (long)pkt->getByteLength()); 34 | } 35 | 36 | Path::~Path() 37 | { 38 | } 39 | 40 | Define_Module(Path); 41 | -------------------------------------------------------------------------------- /src/model/common/std_includes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StdIncludes.h 3 | * FatTreeBuilder 4 | * 5 | * Created by mah5 on 5/17/11. 6 | * Copyright 2011 Washington University in St. Louis. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef STD_INCLUDES_H_ 11 | #define STD_INCLUDES_H_ 12 | 13 | #include 14 | #include 15 | 16 | #include // XXX necessary? 17 | #include // XXX necessary? 18 | 19 | #include // XXX necessary? 20 | #include 21 | #include 22 | #include 23 | 24 | typedef unsigned int uint; 25 | typedef unsigned long long ulong; 26 | 27 | // TODO: replace these with UnitConversion class in unitconversion.h 28 | #define KILO 1000 29 | #define MEGA (1000*KILO) 30 | #define GIGA (1000*MEGA) 31 | 32 | #define MS (1.0/KILO) 33 | #define US (1.0/MEGA) 34 | #define NS (1.0/GIGA) 35 | 36 | #define KiB (1024) 37 | #define MiB (1024*KiB) 38 | #define GiB (1024*MiB) 39 | 40 | #define BITS_PER_BYTE 8 41 | #define KBPS KILO 42 | #define MBPS MEGA 43 | #define GBPS GIGA 44 | 45 | 46 | using namespace std; 47 | 48 | //#define DEBUG 49 | #define ERROR_CHECKING 50 | 51 | #ifdef DEBUG 52 | #define log cout 53 | #else 54 | // disables all log messages 55 | #define log if (false) cout 56 | #endif 57 | 58 | 59 | #endif // STD_INCLUDES_H_ 60 | -------------------------------------------------------------------------------- /src/model/node/schedulingLayer/Controller.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.schedulingLayer; 17 | import datacenter.model.common.FatTreeNode; 18 | 19 | simple Controller extends FatTreeNode 20 | { 21 | parameters: 22 | @display("i=block/wrxtx"); 23 | @class(SchedulingController); 24 | //int address; 25 | string SchedulingAlgorithm = default("SchedulingAlgorithm"); // XXX Remove 26 | double VOQTimeout @unit(s) = default(0s); // 0 to disable 27 | gates: 28 | input control @directIn; 29 | input in; 30 | output out; 31 | } 32 | -------------------------------------------------------------------------------- /src/model/node/resequencingLayer/Resequencer.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.resequencingLayer; 17 | 18 | moduleinterface ResequencingLayerInterface 19 | { 20 | parameters: 21 | @display("i=old/ring"); 22 | int address; 23 | gates: 24 | inout upper_layer; 25 | inout lower_layer; 26 | } 27 | 28 | module EmptyResequencingLayer like ResequencingLayerInterface 29 | { 30 | parameters: 31 | @display("i=old/ring"); 32 | int address; 33 | gates: 34 | inout upper_layer; 35 | inout lower_layer; 36 | connections: 37 | upper_layer <--> lower_layer; 38 | } 39 | -------------------------------------------------------------------------------- /src/model/node/applicationLayer/messageApplication/trafficPatterns/TP_PairedPermutation.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | #ifndef TP_PAIREDPERMUTATION_H_ 16 | #define TP_PAIREDPERMUTATION_H_ 17 | 18 | #include "TrafficPattern.h" 19 | 20 | 21 | class TP_PairedPermutation : public TrafficPattern { 22 | public: 23 | virtual AppMessageVector createTraffic(const SubTreeID &node_id, double messageSize=0); 24 | protected: 25 | virtual void createPermutationPair(uint_vec_t &serverAssignments); 26 | virtual void reassignServersPairedInSameSubtree(uint_vec_t &serverAssignments); 27 | }; 28 | 29 | 30 | #endif /* TP_PAIREDPERMUTATION_H_ */ 31 | -------------------------------------------------------------------------------- /src/model/node/applicationLayer/messageApplication/trafficPatterns/TP_AllToAllVictimTenant.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | #ifndef TP_ALLTOALLVICTIMTENANT_H_ 16 | #define TP_ALLTOALLVICTIMTENANT_H_ 17 | 18 | #include "TP_AllToAllPartition.h" 19 | 20 | 21 | class TP_AllToAllVictimTenant : public TP_AllToAllPartition { 22 | public: 23 | virtual AppMessageVector createTraffic(const SubTreeID &node_id, double messageSize); 24 | protected: 25 | virtual void addMessagesForMaliciousServer(uint server_address, uint_vec_t &partition, AppMessageVector &messages); 26 | typedef std::vector PartitionVector; 27 | }; 28 | 29 | #endif /* TP_ALLTOALLVICTIMTENANT_H_ */ 30 | -------------------------------------------------------------------------------- /src/model/node/networkLayer/NetworkLayer.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.networkLayer; 17 | 18 | moduleinterface NetworkLayerNode 19 | { 20 | parameters: 21 | @display("i=block/network"); 22 | int address; 23 | gates: 24 | //inout upper_layer[]; 25 | inout tcp; 26 | inout udp; 27 | inout lower_layer; 28 | } 29 | 30 | module EmptyNetworkLayer like NetworkLayerNode 31 | { 32 | parameters: 33 | @display("i=block/network;bgb=87,89"); 34 | @class(NetworkLayerBase); 35 | int address; 36 | gates: 37 | //inout upper_layer[]; 38 | inout tcp; 39 | inout udp; 40 | inout lower_layer; 41 | } 42 | -------------------------------------------------------------------------------- /src/model/node/transportLayer/EmptyTCP.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.transportLayer; 17 | 18 | module EmptyTCP like TCPInterface 19 | { 20 | parameters: 21 | int mss = 0; // Maximum Segment Size (RFC 793) (header option) 22 | @display("i=block/wheelbarrow"); 23 | gates: 24 | input appIn[] @labels(TCPCommand/down); 25 | input ipIn @labels(TCPSegment,IPControlInfo/up); 26 | input ipv6In @labels(TCPSegment,IPv6ControlInfo/up); 27 | output appOut[] @labels(TCPCommand/up); 28 | output ipOut @labels(TCPSegment,IPControlInfo/down); 29 | output ipv6Out @labels(TCPSegment,IPv6ControlInfo/down); 30 | connections allowunconnected: 31 | } 32 | -------------------------------------------------------------------------------- /src/model/switch/ControlProcessor.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.switch; 17 | import datacenter.model.common.FatTreeNode; 18 | 19 | simple ControlProcessor extends FatTreeNode 20 | { 21 | parameters: 22 | @class(ControlProcessor); 23 | string switch_id; 24 | volatile double processingDelay @unit(s) = default(0); // Simulates processing delay in switch 25 | int depth; 26 | int sub_tree_id; // the sub-tree id of this switch 27 | bool useDirectMsgSending; 28 | 29 | 30 | @display("i=block/switch"); 31 | gates: 32 | input down_port_in[]; 33 | output down_port_out[]; 34 | input up_port_in[]; 35 | output up_port_out[]; 36 | } 37 | -------------------------------------------------------------------------------- /src/model/common/ServerBuffer.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.common; 17 | 18 | simple ServerBuffer 19 | { 20 | parameters: 21 | @display("i=block/boundedqueue"); 22 | @class(ServerBuffer); 23 | int queueSizePackets = default(0); // max number of packets; 0 means no limit 24 | int queueSizeBytes @unit(bytes) = default(0 bytes); // max number of packets; 0 means no limit 25 | bool emitStatsOnGlobalSignal = default(false); // added for BklgSchedApplication 26 | 27 | @signal[qlenPkts](type="long"); 28 | @signal[qlenBytes](type="long"); 29 | @signal[drop](type="long"); 30 | @signal[rxBytes](type="long"); 31 | @signal[txBytes](type="long"); 32 | } 33 | -------------------------------------------------------------------------------- /src/model/networks/fattree/recursive/FatTree.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | // This module builds the FatTree recursively 17 | // Large topologies take a long time to setup and simulations of these recursively 18 | // produced topologies is considerably slower, which is likely due to the large number 19 | // of compound objects. 20 | 21 | package datacenter.model.networks.fattree.recursive; 22 | 23 | network FatTree extends SubFatTreeNode like SubFatTree 24 | { 25 | parameters: 26 | depth = 0; 27 | sub_tree_id = 0; 28 | sub_tree_string = ""; 29 | num_up_ports = 0; 30 | num_down_ports = tor_switch_down_ports * (switch_down_ports^middle_layers) * down_ports_per_switch; 31 | 32 | down_ports_per_switch = int_switch_down_ports; 33 | up_ports_per_switch = 0; 34 | } 35 | -------------------------------------------------------------------------------- /src/model/packets/ControlMessage.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef CONTROLMESSAGE_H_ 17 | #define CONTROLMESSAGE_H_ 18 | 19 | #include "ControlMessage_m.h" 20 | 21 | class ControlMessage : public ControlMessage_Base { 22 | public: 23 | ControlMessage(const char *name=NULL, int kind=0) : ControlMessage_Base(name,kind) { } 24 | ControlMessage(const ControlMessage& other) : ControlMessage_Base(other.getName()) { operator=(other); } 25 | ControlMessage& operator=(const ControlMessage& other) { ControlMessage_Base::operator=(other); return *this; } 26 | virtual ControlMessage *dup() const { return new ControlMessage(*this); } 27 | virtual bool isBroadcast() { return (dstAddr_var >= (uint)BROADCAST_ADDRESS_RANGE); } 28 | }; 29 | 30 | #endif /* CONTROLMESSAGE_H_ */ 31 | -------------------------------------------------------------------------------- /src/model/node/schedulingLayer/proxy/RequestPacket.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef REQUESTPACKET_H_ 17 | #define REQUESTPACKET_H_ 18 | 19 | #include "RequestPacket_m.h" 20 | 21 | // Link-Proxy Request Packet 22 | class RequestPacket : public RequestPacket_Base 23 | { 24 | public: 25 | RequestPacket(const char *name=NULL, int kind=0) : RequestPacket_Base(name, kind) {} 26 | RequestPacket(const RequestPacket& other) : RequestPacket_Base(other) {} 27 | RequestPacket& operator=(const RequestPacket& other) { RequestPacket_Base::operator=(other); return *this; } 28 | virtual RequestPacket *dup() { return new RequestPacket(*this); } 29 | bklg_t &bklg() { return bklg_var; } 30 | rate_t &request() { return request_var; } 31 | }; 32 | 33 | #endif /* REQUESTPACKET_H_ */ 34 | -------------------------------------------------------------------------------- /src/model/networks/testNetworks/TCPClientServerInet.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.networks.testNetworks; 17 | 18 | import ned.DatarateChannel; 19 | //import inet.networklayer.autorouting.FlatNetworkConfigurator; 20 | import inet.networklayer.autorouting.ipv4.FlatNetworkConfigurator; 21 | import inet.nodes.inet.StandardHost; 22 | 23 | 24 | network TCPClientServerInet 25 | { 26 | submodules: 27 | client1: StandardHost { 28 | @display("p=112,84"); 29 | } 30 | server: StandardHost { 31 | @display("p=304,84"); 32 | } 33 | configurator: FlatNetworkConfigurator { 34 | @display("p=215,152"); 35 | } 36 | connections: 37 | client1.pppg++ <--> DatarateChannel <--> server.pppg++; 38 | } 39 | -------------------------------------------------------------------------------- /src/model/node/schedulingLayer/proxy/ResponsePacket.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef RESPONSEPACKET_H_ 17 | #define RESPONSEPACKET_H_ 18 | 19 | #include "ResponsePacket_m.h" 20 | 21 | // Link-Proxy Response Packet 22 | class ResponsePacket : public ResponsePacket_Base 23 | { 24 | public: 25 | ResponsePacket(const char *name=NULL, int kind=0) : ResponsePacket_Base(name, kind) {} 26 | ResponsePacket(const ResponsePacket& other) : ResponsePacket_Base(other) {} 27 | ResponsePacket& operator=(const ResponsePacket& other) { ResponsePacket_Base::operator=(other); return *this; } 28 | virtual ResponsePacket *dup() { return new ResponsePacket(*this); } 29 | bklg_t &share() { return share_var; } 30 | rate_t &rate() { return rate_var; } 31 | }; 32 | 33 | #endif /* RESPONSEPACKET_H_ */ 34 | -------------------------------------------------------------------------------- /src/model/node/applicationLayer/messageApplication/exampleMessageScript.txt: -------------------------------------------------------------------------------- 1 | # Message script is a set of application messages M where a messsage Mijk is the kth message from server i to server j 2 | # Each message has the following information in it: 3 | # source: the sending server i 4 | # destination: the receiving server j 5 | # messageNum: the message number k 6 | # startTime: the earliest time at which the message can be sent in seconds 7 | # messageSize: the size of the message in bytes 8 | # messageRate: an optional limit on the rate at which the message should be sent (0 = no limit) 9 | 10 | # Message format is as follows: 11 | # ;;;;; 12 | 13 | 0; 8; 0; 0 s; 200 MiB; 1 Gbps 14 | 1; 9; 0; 0 s; 200 MiB; 1 Gbps 15 | 2; 10; 0; 0 s; 200 MiB; 1 Gbps 16 | 3; 11; 0; 0 s; 200 MiB; 1 Gbps 17 | 4; 12; 0; 0 s; 200 MiB; 1 Gbps 18 | 5; 13; 0; 0 s; 200 MiB; 1 Gbps 19 | 6; 14; 0; 0 s; 200 MiB; 1 Gbps 20 | 7; 15; 0; 0 s; 200 MiB; 1 Gbps 21 | 8; 0; 0; 0 s; 200 MiB; 1 Gbps 22 | 9; 1; 0; 0 s; 200 MiB; 1 Gbps 23 | 10; 2; 0; 0 s; 200 MiB; 1 Gbps 24 | 11; 3; 0; 0 s; 200 MiB; 1 Gbps 25 | 12; 4; 0; 0 s; 200 MiB; 1 Gbps 26 | 13; 5; 0; 0 s; 200 MiB; 1 Gbps 27 | 14; 6; 0; 0 s; 200 MiB; 1 Gbps 28 | 15; 7; 0; 0 s; 200 MiB; 1 Gbps 29 | 30 | 31 | 0; 1; 2; 0 s; 1 MiB; 100 Mbps # After parsing, entries automatically ordered chronologically 32 | 0; 1; 1; 500 ms; 5 MiB + 100 KiB; 3 Mbps + 100 kbps 33 | 1; 2; 3; 1.5 s; 1 GiB; 1 Gbps 34 | 0; 1; 3; 2s - 100us ; 500 KiB; 100 Mbps 35 | -------------------------------------------------------------------------------- /src/model/packets/DCN_IPPacket.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef IPPACKET_H_ 17 | #define IPPACKET_H_ 18 | 19 | #include "DCN_IPPacket_m.h" 20 | 21 | 22 | //virtual int64 getOverheadBytes() { return ETHER_FRAME_SIZE; } 23 | class DCN_IPPacket : public DCN_IPPacket_Base 24 | { 25 | public: 26 | DCN_IPPacket(const char *name=NULL, int kind=0) : DCN_IPPacket_Base(name,kind) { setByteLength(DCN_MIN_PACKET_SIZE); } 27 | DCN_IPPacket(const DCN_IPPacket& other) : DCN_IPPacket_Base(other.getName()) { operator=(other); } 28 | DCN_IPPacket& operator=(const DCN_IPPacket& other) { DCN_IPPacket_Base::operator=(other); return *this; } 29 | virtual DCN_IPPacket *dup() const { return new DCN_IPPacket(*this); } 30 | virtual int64 getOverheadBytes() { return ETHER_FRAME_SIZE + IP_HEADER_SIZE; } 31 | }; 32 | 33 | 34 | #endif /* IPPACKET_H_ */ 35 | -------------------------------------------------------------------------------- /src/model/common/PacketDropper.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef PACKETDROPPER_H_ 17 | #define PACKETDROPPER_H_ 18 | 19 | class PacketDropper : public cSimpleModule 20 | { 21 | public: 22 | PacketDropper(); 23 | virtual ~PacketDropper(); 24 | virtual void initialize(); 25 | virtual void handleMessage(cMessage *msg); 26 | 27 | protected: 28 | cGate *port1in_; 29 | cGate *port1out_; 30 | cGate *port2in_; 31 | cGate *port2out_; 32 | 33 | virtual void parseScript(const char *script); 34 | virtual void handleDropEvent(); 35 | struct Command 36 | { 37 | simtime_t dropTime; 38 | int numPktsToDrop; 39 | }; 40 | typedef std::list CommandVector; 41 | CommandVector commands; 42 | cMessage *dropPacketEvent; 43 | int numPktsToDrop; 44 | simsignal_t dropPktSignal; 45 | }; 46 | 47 | #endif /* PACKETDROPPER_H_ */ 48 | -------------------------------------------------------------------------------- /src/model/node/schedulingLayer/Multiplexer.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef MULTIPLEXER_H_ 17 | #define MULTIPLEXER_H_ 18 | 19 | #include "SchedulingController.h" 20 | class SchedulingController; 21 | class VirtualOutputQueue; 22 | 23 | 24 | class Multiplexer : public cSimpleModule { 25 | public: 26 | Multiplexer(); 27 | virtual ~Multiplexer(); 28 | 29 | virtual void initialize(); 30 | virtual void handleMessage(cMessage *msg); 31 | 32 | virtual void connectToVoq(VirtualOutputQueue *voq); 33 | virtual void disconnectFromVoq(VirtualOutputQueue *voq); 34 | 35 | protected: 36 | // Helper methods 37 | cGate * lookupVoqGate(uint destAddr); 38 | 39 | protected: 40 | // Attributes 41 | SchedulingController *controller_; 42 | cGate *outGate_; 43 | VOQGateMap voqGates_; 44 | GateList freeVoqGates_; 45 | 46 | }; 47 | 48 | #endif /* MULTIPLEXER_H_ */ 49 | -------------------------------------------------------------------------------- /src/model/packets/DCN_TCPPacket.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef TCPPACKET_H_ 17 | #define TCPPACKET_H_ 18 | 19 | #include "DCN_TCPPacket_m.h" 20 | 21 | 22 | //virtual int64 getOverheadBytes() { return ETHER_FRAME_SIZE; } 23 | class DCN_TCPPacket : public DCN_TCPPacket_Base 24 | { 25 | public: 26 | DCN_TCPPacket(const char *name=NULL, int kind=0) : DCN_TCPPacket_Base(name,kind) { setByteLength(DCN_MIN_PACKET_SIZE); } 27 | DCN_TCPPacket(const DCN_TCPPacket& other) : DCN_TCPPacket_Base(other.getName()) { operator=(other); } 28 | DCN_TCPPacket& operator=(const DCN_TCPPacket& other) { DCN_TCPPacket_Base::operator=(other); return *this; } 29 | virtual DCN_TCPPacket *dup() const { return new DCN_TCPPacket(*this); } 30 | virtual int64 getOverheadBytes() { return ETHER_FRAME_SIZE + IP_HEADER_SIZE; } 31 | }; 32 | 33 | 34 | 35 | #endif /* TCPPACKET_H_ */ 36 | 37 | -------------------------------------------------------------------------------- /src/model/packets/DCN_UDPPacket.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef UDPPACKET_H_ 17 | #define UDPPACKET_H_ 18 | 19 | #include "DCN_UDPPacket_m.h" 20 | 21 | //virtual int64 getOverheadBytes() { return ETHER_FRAME_SIZE; } 22 | class DCN_UDPPacket : public DCN_UDPPacket_Base 23 | { 24 | public: 25 | DCN_UDPPacket(const char *name=NULL, int kind=0) : DCN_UDPPacket_Base(name,kind) { setByteLength(DCN_MIN_PACKET_SIZE); } 26 | DCN_UDPPacket(const DCN_UDPPacket& other) : DCN_UDPPacket_Base(other.getName()) { operator=(other); } 27 | DCN_UDPPacket& operator=(const DCN_UDPPacket& other) { DCN_UDPPacket_Base::operator=(other); return *this; } 28 | virtual DCN_UDPPacket *dup() const { return new DCN_UDPPacket(*this); } 29 | virtual int64 getOverheadBytes() { return ETHER_FRAME_SIZE + IP_HEADER_SIZE + UDP_HEADER_SIZE; } 30 | }; 31 | 32 | 33 | #endif /* UDPPACKET_H_ */ 34 | -------------------------------------------------------------------------------- /src/model/common/DCCommon.cc: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #include "DCCommon.h" 17 | 18 | //---------------------------------------------------------------------------------------------------- 19 | // Flow 20 | //---------------------------------------------------------------------------------------------------- 21 | 22 | std::ostream& operator<<(std::ostream& os, const Flow& f) { os << "f(" << f.src << "," << f.dst << ")"; return os; } 23 | std::string flowName(const Flow flow) { sstring out; out << flow; return out.str(); } 24 | bool operator==(const Flow& a, const Flow& b) { return a.raw_value == b.raw_value; } 25 | bool operator!=(const Flow& a, const Flow& b) { return a.raw_value != b.raw_value; } 26 | bool operator<(const Flow& a, const Flow& b) { return a.raw_value < b.raw_value; } 27 | bool operator>(const Flow& a, const Flow& b) { return a.raw_value > b.raw_value; } 28 | 29 | -------------------------------------------------------------------------------- /src/model/node/applicationLayer/messageApplication/AppMessage.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef APPMESSAGE_H_ 17 | #define APPMESSAGE_H_ 18 | 19 | class AppMessage 20 | { 21 | public: 22 | // Mijk = kth message from server i to server j 23 | uint source; // i 24 | uint destination; // j 25 | uint messageNum; // k 26 | simtime_t startTime; // earliest start time 27 | double messageSize; // message size 28 | double messageRate; // optional limit on sending rate of message (0 = no limit) 29 | friend std::ostream & operator <<(std::ostream &, const AppMessage *); 30 | }; 31 | 32 | 33 | typedef std::vector AppMessageVector; 34 | bool sortByStartTime(AppMessage *msg1, AppMessage *msg2); 35 | std::ostream & operator <<(std::ostream &, const AppMessageVector &); 36 | 37 | 38 | #endif /* APPMESSAGE_H_ */ 39 | -------------------------------------------------------------------------------- /src/model/node/networkLayer/NetworkLayerBase.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef NETWORKLAYERBASE_H_ 17 | #define NETWORKLAYERBASE_H_ 18 | 19 | #include "TCPSegment.h" 20 | 21 | class NetworkLayerBase : public cSimpleModule 22 | { 23 | public: 24 | NetworkLayerBase(); 25 | virtual ~NetworkLayerBase(); 26 | 27 | virtual void initialize(); 28 | virtual void handleMessage(cMessage *msg); 29 | 30 | virtual void fromTcp(cMessage *msg); 31 | virtual void fromUdp(cMessage *msg); 32 | virtual void toTcp(DCN_IPPacket *msg); 33 | virtual void toUdp(DCN_IPPacket *msg); 34 | 35 | protected: 36 | cGate *tcpGateIn_; // From TCP module 37 | cGate *tcpGateOut_; // To TCP module 38 | cGate *udpGateIn_; // From UDP module 39 | cGate *udpGateOut_; // To UDP module 40 | cGate *lowerLayerIn_; 41 | cGate *lowerLayerOut_; 42 | //cGate *rawGate_; // Accept raw DCN packets 43 | }; 44 | 45 | #endif /* NETWORKLAYERBASE_H_ */ 46 | -------------------------------------------------------------------------------- /src/model/common/FatTreeNode.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef FAT_TREE_NODE_H_ 17 | #define FAT_TREE_NODE_H_ 18 | 19 | #include "node_id.h" 20 | class FatTreeParameters; 21 | class TopologyParameters; 22 | class FatTreeNode; 23 | 24 | // This class wraps the FatTreeParameters to allow simple objects 25 | // to read the global Topology parametes from the NED files 26 | class TopologyParameters : public FatTreeParameters 27 | { 28 | public: 29 | TopologyParameters(cSimpleModule *parent); 30 | ~TopologyParameters(); 31 | 32 | private: 33 | cSimpleModule *parent_; 34 | }; 35 | 36 | 37 | class FatTreeNode : public cSimpleModule, public FatTreeParameters 38 | { 39 | public: 40 | FatTreeNode(); 41 | 42 | virtual void initialize(); 43 | virtual uint getAddress() { return address_; } 44 | ~FatTreeNode(); 45 | 46 | protected: 47 | SubTreeID node_id_; 48 | uint address_; 49 | }; 50 | 51 | #endif /* FAT_TREE_NODE_H_ */ 52 | -------------------------------------------------------------------------------- /src/model/packets/ControlMessage.msg: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | cplusplus {{ 17 | // Switches flood the message 18 | #define BROADCAST_ADDRESS ((uint)-1) 19 | // Message is desitined for all switches 20 | #define BROADCAST_SWITCHES ((uint)-2) 21 | // Anything less than the value of this constant is assumed to be a regular address 22 | #define BROADCAST_ADDRESS_RANGE ((uint)-2) 23 | 24 | }} 25 | 26 | enum ControlMessageType 27 | { 28 | CONTROL_MESSAGE_BASE_KIND = 1; 29 | TRAFFIC_SOURCE_CONTROL_MSG = 2; 30 | UPDATE_SENDING_RATE_MSG = 3; 31 | UPDATE_QUEUE_SIZE_MSG = 4; 32 | SCHEDULING_CONTROL_MSG = 5; 33 | TENANT_SERVERS_MSG = 6; 34 | } 35 | 36 | 37 | message ControlMessage { 38 | @customize(true); 39 | unsigned int srcAddr; 40 | unsigned int dstAddr; 41 | string srcSubModule; 42 | string dstSubModule; 43 | unsigned short type enum(ControlMessageType) = CONTROL_MESSAGE_BASE_KIND; 44 | }; 45 | -------------------------------------------------------------------------------- /src/model/node/resequencingLayer/test/TestNetworkForResequencer.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.resequencingLayer.test; 17 | import datacenter.model.node.resequencingLayer.*; 18 | 19 | network TestNetworkForResequencer 20 | { 21 | parameters: 22 | 23 | @display("bgb=398,176"); 24 | submodules: 25 | resequencer: SequenceNumberResequencer { 26 | parameters: 27 | Timeout = 5ms; 28 | UseAdaptiveTimeout = false; 29 | BufferTimeout = 1s; 30 | @display("p=259,74"); 31 | } 32 | 33 | //trafficSourceSink: TestTrafficSource { 34 | // parameters: 35 | // @display("p=99,74"); 36 | //} 37 | 38 | connections: 39 | // resequencer.lower_layer <--> trafficSourceSink.lower_layer; 40 | // resequencer.upper_layer <--> trafficSourceSink.upper_layer; 41 | 42 | } 43 | -------------------------------------------------------------------------------- /src/model/node/transportLayer/InetTCPWrapper.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef INETTCPWRAPPER_H_ 17 | #define INETTCPWRAPPER_H_ 18 | 19 | #include "TCP.h" 20 | #include "InetTCPConnectionWrapper.h" 21 | 22 | class InetTCPConnectionWrapper; 23 | 24 | cPacket *encapsulateTCPinDCN_EthPacket(cPacket *tcpPacket); 25 | cPacket *decapsulateTCPfromDCN_EthPacket(cPacket *dcnPacket); 26 | 27 | class InetTCPWrapper : public INET_API TCP { 28 | public: 29 | InetTCPWrapper(); 30 | virtual ~InetTCPWrapper(); 31 | 32 | virtual void initialize(); 33 | virtual void handleMessage(cMessage *msg); 34 | virtual void send(cMessage *msg, const char *gatename); 35 | virtual TCPConnection *createConnection(int appGateIndex, int connId); 36 | 37 | protected: 38 | typedef std::map TcpAppConnMap; 39 | typedef std::map TcpConnMap; 40 | }; 41 | 42 | #endif /* INETTCPWRAPPER_H_ */ 43 | -------------------------------------------------------------------------------- /simulations/configurations/LoadBalancing/demo.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import logging 3 | import os 4 | import sys 5 | 6 | sys.path.append(os.path.abspath("../../../")) 7 | from simulations.run_scripts import run_scripts 8 | from simulations.common.lib_common import check_file 9 | 10 | mlog = logging.getLogger('simulations.configurations.loadbalancing') 11 | logging.basicConfig() 12 | 13 | ini_file = check_file('demo.ini') 14 | configs, runs = run_scripts.configs_and_runs(ini_file) 15 | 16 | 17 | # Use the # of CPU cores to determine the number of runs to launch in parallel. 18 | parallel = run_scripts.num_cores() 19 | 20 | for config in configs: 21 | mlog.info("ini_file='%s', config='%s'", 22 | os.path.basename(ini_file), config) 23 | run_scripts.batch_run_python(ini_file, config, runs, run_offset=0, 24 | result_dir=None, parallel=parallel, 25 | check_output=True, compress_results=False) 26 | 27 | 28 | # project_path = "../../../" 29 | # bin = os.path.join(project_path, "src/DataCenter") 30 | # src_path = os.path.join(project_path, "src") 31 | # inet_path = "../../../../inet" 32 | # inet_lib = os.path.join(inet_path, "src/inet") 33 | # src_paths = [src_path, os.path.join(inet_path, "src"), 34 | # os.path.join(inet_path, "examples")] 35 | 36 | # env = "Cmdenv" 37 | # run = 4559 38 | # ini_file = "Throughput_vs_OfferedLoad.ini" 39 | # config = "MPLoadBalancer" 40 | 41 | # repititions = 1 42 | 43 | 44 | # run_cmd = "%s -u %s -l %s -n %s " % (bin, env, inet_lib, ":".join(src_paths)) 45 | # run_cmd += "-c %s -r %s %s" % (config, run, ini_file) 46 | # print run_cmd 47 | 48 | -------------------------------------------------------------------------------- /src/model/node/applicationLayer/TCPMessageApplication/TCPMessageApplication.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.applicationLayer.TCPMessageApplication; 17 | import datacenter.model.node.applicationLayer.TCPAppInterface; 18 | import datacenter.model.common.FatTreeNode; 19 | import datacenter.model.node.applicationLayer.messageApplication.MessageApplication; 20 | //import inet.applications.tcpapp.TCPApp; 21 | import inet.applications.ITCPApp; 22 | 23 | simple TCPMessageApplication extends MessageApplication like TCPAppInterface 24 | { 25 | parameters: 26 | @class(TCPMessageApplication); 27 | enabled = default(true); 28 | int listenPort = default(10000); 29 | // How frequently to get status from socekts for statistics collection 30 | double getStatusPeriod @unit(s) = default(1ms); 31 | gates: 32 | input tcpIn @labels(TCPCommand/up); 33 | output tcpOut @labels(TCPCommand/down); 34 | } 35 | -------------------------------------------------------------------------------- /src/model/node/networkLayer/VirtualIP.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef VIRTUALIP_H_ 17 | #define VIRTUALIP_H_ 18 | 19 | #include "DCCommon.h" 20 | #include "NetworkLayerBase.h" 21 | 22 | // INET includes 23 | #include "IPv4Address.h" // May not be necessary if we don't end up using IPAddress address 24 | 25 | typedef IPv4Address IPAddress; // 9/23/2012 change to get it to work with INET 2.0 26 | 27 | IPAddress convertDCAddressToIP(uint address); 28 | 29 | uint convertIPAddressToDC(IPAddress address); 30 | 31 | class VirtualIP : public NetworkLayerBase { 32 | public: 33 | VirtualIP(); 34 | virtual ~VirtualIP(); 35 | 36 | virtual void initialize(); 37 | 38 | virtual void fromTcp(cMessage *msg); 39 | virtual void fromUdp(cMessage *msg); 40 | virtual void toTcp(DCN_IPPacket *msg); 41 | virtual void toUdp(DCN_IPPacket *msg); 42 | 43 | protected: 44 | 45 | IPAddress address; 46 | 47 | // Any statistics? 48 | 49 | }; 50 | 51 | #endif /* VIRTUALIP_H_ */ 52 | -------------------------------------------------------------------------------- /src/model/node/applicationLayer/messageApplication/trafficPatterns/TP_AllToAllPartition.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | #ifndef TP_ALLTOALLPARTITION_H_ 16 | #define TP_ALLTOALLPARTITION_H_ 17 | 18 | #include "TrafficPattern.h" 19 | 20 | 21 | class TP_AllToAllPartition : public TrafficPattern { 22 | public: 23 | virtual AppMessageVector createTraffic(const SubTreeID &node_id, double messageSize); 24 | virtual void setPartitionSize(uint partitionSize=0) { 25 | if (partitionSize == 0) { 26 | partitionSize = node_id_.getNumberOfServers()/node_id_.getDownRadix(0); 27 | } else { 28 | this->partitionSize = partitionSize; 29 | } 30 | } 31 | protected: 32 | virtual void addMessagesForServer(uint server_address, uint_vec_t &partition, AppMessageVector &messages); 33 | typedef std::vector PartitionVector; 34 | PartitionVector partitionServers(uint partitionSize); 35 | uint partitionSize; 36 | }; 37 | 38 | #endif /* TP_ALLTOALLPARTITION_H_ */ 39 | -------------------------------------------------------------------------------- /src/model/node/schedulingLayer/Demultiplexer.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef DEMULTIPLEXER_H_ 17 | #define DEMULTIPLEXER_H_ 18 | 19 | #include "SchedulingController.h" 20 | class SchedulingController; 21 | class VirtualOutputQueue; 22 | 23 | 24 | // This module just keeps track of which gate corresponds to which VOQ 25 | // The controller does all the work of actually managing the VOQs 26 | 27 | class Demultiplexer : public cSimpleModule { 28 | public: 29 | Demultiplexer(); 30 | virtual ~Demultiplexer(); 31 | 32 | virtual void initialize(); 33 | virtual void handleMessage(cMessage *msg); 34 | 35 | virtual void connectToVoq(VirtualOutputQueue *voq); 36 | virtual void disconnectFromVoq(VirtualOutputQueue *voq); 37 | 38 | protected: 39 | // Helper methods 40 | cGate * lookupVoqGate(uint destAddr); 41 | 42 | protected: 43 | // Attributes 44 | SchedulingController *controller_; 45 | VOQGateMap voqGates_; 46 | GateList freeVoqGates_; 47 | }; 48 | 49 | #endif /* DEMULTIPLEXER_H_ */ 50 | -------------------------------------------------------------------------------- /src/model/node/applicationLayer/messageApplication/AppMessage.cc: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #include "DCCommon.h" 17 | #include "AppMessage.h" 18 | 19 | 20 | bool sortByStartTime(AppMessage *msg1, AppMessage *msg2) 21 | { return (msg1->startTime > msg2->startTime); } 22 | 23 | std::ostream & operator <<(std::ostream &os, const AppMessage *appMsg) 24 | { 25 | os << "Application message:\n" 26 | << "source = " << appMsg->source << "\n" 27 | << "destination = " << appMsg->destination << "\n" 28 | << "messageNum = " << appMsg->messageNum << "\n" 29 | << "startTime = " << appMsg->startTime << "\n" 30 | << "messageSize = " << appMsg->messageSize << "\n" 31 | << "messageRate = " << appMsg->messageRate << endl; 32 | return os; 33 | } 34 | 35 | std::ostream & operator <<(std::ostream &os, const AppMessageVector &appMsgVec) 36 | { 37 | for (AppMessageVector::const_iterator i=appMsgVec.begin(); i != appMsgVec.end(); ++i) { os << *(i); } 38 | return os; 39 | } 40 | 41 | -------------------------------------------------------------------------------- /src/model/packets/DCN_EthPacket.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef DCNPACKET_H_ 17 | #define DCNPACKET_H_ 18 | 19 | #include "DCN_EthPacket_m.h" 20 | 21 | 22 | class DCN_EthPacket : public DCN_EthPacket_Base 23 | { 24 | public: 25 | DCN_EthPacket(const char *name=NULL, int kind=0) : DCN_EthPacket_Base(name,kind) { setByteLength(DCN_MIN_PACKET_SIZE); } 26 | DCN_EthPacket(const DCN_EthPacket& other) : DCN_EthPacket_Base(other.getName()) { operator=(other); } 27 | DCN_EthPacket& operator=(const DCN_EthPacket& other) { DCN_EthPacket_Base::operator=(other); return *this; } 28 | virtual DCN_EthPacket *dup() const { return new DCN_EthPacket(*this); } 29 | virtual int64 getOverheadBytes() { return ETHER_FRAME_SIZE; } 30 | virtual void setPayloadLengthBytes(int64 payloadBytes); 31 | bool isDataPacket() { return dataPacket_var; } 32 | protected: 33 | // Made setPayload protected because you should be using setPayloadLengthBytes 34 | virtual void setPayload(unsigned short payload) { this->payload_var = payload; } 35 | }; 36 | 37 | 38 | 39 | #endif /* DCNPACKET_H_ */ 40 | -------------------------------------------------------------------------------- /src/model/node/applicationLayer/BklgSchedApplication/BklgSchedApplication.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.applicationLayer.BklgSchedApplication; 17 | import datacenter.model.common.FatTreeNode; 18 | import datacenter.model.node.applicationLayer.SimpleUDPApplicationNode; 19 | import datacenter.model.node.applicationLayer.messageApplication.MessageApplication; 20 | 21 | simple BklgSchedApplication extends MessageApplication like SimpleUDPApplicationNode 22 | { 23 | parameters: 24 | @class(BklgSchedApplication); 25 | //string backlogSchedule = default(""); 26 | //messageScript = backlogSchedule; // XXX Doesn't work 27 | @signal[finishTime](type="simtime_t"); 28 | @statistic[finishTime](title="time when server is done sending/receiving all backlog in schedule";unit=s;record=last?;interpolationmode=none); 29 | double StatisticsInterval @unit(s) = default(0); // XXX 30 | // Modules that listen for this signal must have emitStatsOnGlobalSignal = true set 31 | // These modules include anything derived from ServerBuffer and L2Queue 32 | } 33 | -------------------------------------------------------------------------------- /src/model/common/DCUtilities.cc: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #include "DCUtilities.h" 17 | #include 18 | #include 19 | #include 20 | #include 21 | using namespace boost::filesystem; 22 | 23 | bool dirExists(const char *dir) 24 | { 25 | struct stat st; 26 | return (stat(dir,&st) == 0); 27 | } 28 | 29 | std::string fullPath(const char *file_or_dir) 30 | { 31 | path p = file_or_dir; 32 | path full_path = absolute(p); 33 | full_path.remove_filename(); 34 | if (is_directory(full_path)) { 35 | full_path = absolute(full_path); 36 | } 37 | return full_path.string(); 38 | } 39 | 40 | bool isDirectory(const char *dir) 41 | { 42 | path p(dir); 43 | path full_path = absolute(p); 44 | return is_directory(p); 45 | } 46 | 47 | bool isRegularFile(const char *file) 48 | { 49 | path p(file); 50 | return is_regular_file(p); 51 | } 52 | 53 | void createDirectories(const char *dir) 54 | { 55 | std::cout << "Creating directory " << dir << "\n"; 56 | boost::filesystem::create_directories(dir); 57 | } 58 | -------------------------------------------------------------------------------- /src/model/node/resequencingLayer/SequenceNumberResequencer.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.resequencingLayer; 17 | 18 | // Sequence Number Based Resequencer 19 | simple SequenceNumberResequencer like ResequencingLayerInterface 20 | { 21 | parameters: 22 | @display("i=old/ring"); 23 | int address; 24 | // Timeout specifies how long resequencer should wait for a missing packet 25 | double Timeout @unit("s") = default(1ms); // TODO determine appropriate default 26 | // Adaptively adjust the resequencing timeouts to match observed network delay 27 | bool UseAdaptiveTimeout = default(false); 28 | 29 | // BufferTimeout determines how long resequencing state will be maintained for a given sender 30 | // Note: If you set this to 0 the resequencer will not automatically timeout buffers but 31 | // other modules (e.g. scheduling layer) may still remove the buffers 32 | double BufferTimeout @unit("s") = default(10s); // TODO determine appropriate default 33 | gates: 34 | inout upper_layer; 35 | inout lower_layer; 36 | } 37 | -------------------------------------------------------------------------------- /src/model/node/schedulingLayer/schedFromFile/exampleRateSchedule.txt: -------------------------------------------------------------------------------- 1 | # This is an example rate schedule script 2 | # The format is as follows: 3 | # ;;; 4 | # Rates are assumed to between hosts and at times not specified in file. 5 | 6 | 0 s; 0; 0; 1 Mbps 7 | 0 s; 0; 1; 1 Mbps 8 | 0 s; 0; 2; 1 Mbps 9 | 0 s; 0; 3; 1 Mbps 10 | 0 s; 1; 0; 1 Mbps 11 | 0 s; 1; 1; 1 Mbps 12 | 0 s; 1; 2; 1 Mbps 13 | 0 s; 1; 3; 1 Mbps 14 | 0 s; 2; 0; 1 Mbps 15 | 0 s; 2; 1; 1 Mbps 16 | 0 s; 2; 2; 1 Mbps 17 | 0 s; 2; 3; 1 Mbps 18 | 0 s; 3; 0; 1 Mbps 19 | 0 s; 3; 1; 1 Mbps 20 | 0 s; 3; 2; 1 Mbps 21 | 0 s; 3; 3; 1 Mbps 22 | 23 | 0.1 s; 0; 0; 2 Mbps 24 | 0.1 s; 0; 1; 2 Mbps 25 | 0.1 s; 0; 2; 2 Mbps 26 | 0.1 s; 0; 3; 2 Mbps 27 | 0.1 s; 1; 0; 2 Mbps 28 | 0.1 s; 1; 1; 2 Mbps 29 | 0.1 s; 1; 2; 2 Mbps 30 | 0.1 s; 1; 3; 2 Mbps 31 | 0.1 s; 2; 0; 2 Mbps 32 | 0.1 s; 2; 1; 2 Mbps 33 | 0.1 s; 2; 2; 2 Mbps 34 | 0.1 s; 2; 3; 2 Mbps 35 | 0.1 s; 3; 0; 2 Mbps 36 | 0.1 s; 3; 1; 2 Mbps 37 | 0.1 s; 3; 2; 2 Mbps 38 | 0.1 s; 3; 3; 2 Mbps 39 | 40 | 0.2 s; 0; 0; 3 Mbps 41 | 0.2 s; 0; 1; 3 Mbps 42 | 0.2 s; 0; 2; 3 Mbps 43 | 0.2 s; 0; 3; 3 Mbps 44 | 0.2 s; 1; 0; 3 Mbps 45 | 0.2 s; 1; 1; 3 Mbps 46 | 0.2 s; 1; 2; 3 Mbps 47 | 0.2 s; 1; 3; 3 Mbps 48 | 0.2 s; 2; 0; 3 Mbps 49 | 0.2 s; 2; 1; 3 Mbps 50 | 0.2 s; 2; 2; 3 Mbps 51 | 0.2 s; 2; 3; 3 Mbps 52 | 0.2 s; 3; 0; 3 Mbps 53 | 0.2 s; 3; 1; 3 Mbps 54 | 0.2 s; 3; 2; 3 Mbps 55 | 0.2 s; 3; 3; 3 Mbps 56 | 57 | 0.3 s; 0; 0; 4 Mbps 58 | 0.3 s; 0; 1; 4 Mbps 59 | 0.3 s; 0; 2; 4 Mbps 60 | 0.3 s; 0; 3; 4 Mbps 61 | 0.3 s; 1; 0; 4 Mbps 62 | 0.3 s; 1; 1; 4 Mbps 63 | 0.3 s; 1; 2; 4 Mbps 64 | 0.3 s; 1; 3; 4 Mbps 65 | 0.3 s; 2; 0; 4 Mbps 66 | 0.3 s; 2; 1; 4 Mbps 67 | 0.3 s; 2; 2; 4 Mbps 68 | 0.3 s; 2; 3; 4 Mbps 69 | 0.3 s; 3; 0; 4 Mbps 70 | 0.3 s; 3; 1; 4 Mbps 71 | 0.3 s; 3; 2; 4 Mbps 72 | 0.3 s; 3; 3; 4 Mbps 73 | -------------------------------------------------------------------------------- /src/model/networks/fattree/recursive/ServerNode.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.networks.fattree.recursive; 17 | import ned.DatarateChannel; 18 | import datacenter.model.switch.EthSwitch; 19 | import datacenter.model.node.server.*; 20 | 21 | network ServerNode like SubFatTree 22 | { 23 | parameters: 24 | int depth; 25 | int sub_tree_id; 26 | string sub_tree_string; 27 | int num_up_ports = 1; 28 | int num_down_ports = 1; 29 | string ServerType = default(TCPClientServer); 30 | 31 | int server_switch_link_speed @unit(bps); 32 | 33 | 34 | gates: 35 | inout up_port[num_up_ports]; 36 | 37 | types: 38 | channel ServerSwitchLink extends DatarateChannel 39 | { 40 | datarate = server_switch_link_speed; 41 | } 42 | 43 | submodules: 44 | server : like Server { 45 | parameters: 46 | address = sub_tree_id; 47 | gates: 48 | } 49 | 50 | connections: 51 | server.port <--> ServerSwitchLink <--> up_port[0]; 52 | } 53 | -------------------------------------------------------------------------------- /src/model/node/transportLayer/InetTCPConnectionWrapper.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef INETTCPCONNECTIONWRAPPER_H_ 17 | #define INETTCPCONNECTIONWRAPPER_H_ 18 | 19 | // To encapsulate TCP packets before sending them I need to trap the packets 20 | // on TCP's send call. TCPConnection is the class that TCP's send method. 21 | // Unfortunately when TCPConnection calls send, it calls send() in TCP and not 22 | // in my wrapper class because send was not declared as a virtual in TCP. 23 | // This means that in order to call my wrapper's send I have to either 24 | // modify INET's TCP class or write a wrapper that extends their TCPConnection class 25 | 26 | #include "TCPConnection.h" 27 | #include "InetTCPWrapper.h" 28 | 29 | class InetTCPWrapper; 30 | 31 | class InetTCPConnectionWrapper : public TCPConnection { 32 | public: 33 | InetTCPConnectionWrapper(); 34 | InetTCPConnectionWrapper(InetTCPWrapper *mod, int appGateIndex, int connId); 35 | virtual ~InetTCPConnectionWrapper(); 36 | virtual void sendToIP(TCPSegment *tcpseg); 37 | protected: 38 | InetTCPWrapper *tcpMain; // TCP module 39 | }; 40 | 41 | #endif /* INETTCPCONNECTIONWRAPPER_H_ */ 42 | -------------------------------------------------------------------------------- /src/model/node/schedulingLayer/proxy/proxy.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.schedulingLayer.proxy; 17 | 18 | simple LinkProxy 19 | { 20 | parameters: 21 | @display("i=block/rightarrow"); 22 | @class(LinkProxy); 23 | @signal[TotalAllocatedRate](type="long"); 24 | @signal[TotalAllowedRate](type="long"); 25 | @signal[ControlOverhead](type="long"); 26 | @signal[TotalBacklog](type="long"); 27 | @signal[NumFlows](type="int"); 28 | @statistic[TotalAllocatedRate](title="Total allocated rate at the link";unit=bps;record=vector?,timeavg?,max?;interpolationmode=sample-hold); 29 | @statistic[TotalAllowedRate](title="Total allowed rate at the link";unit=bps;record=vector?,timeavg?,max?;interpolationmode=sample-hold); 30 | @statistic[ControlOverhead](title="Total control overhead at the link";unit=bps;record=vector?,timeavg?,max?;interpolationmode=sample-hold); 31 | @statistic[NumFlows](title="Number of flows at the link";record=vector?;interpolationmode=none); 32 | @statistic[TotalBacklog](title="Total backlog on the link";unit=bytes;record=vector?;interpolationmode=none); 33 | } -------------------------------------------------------------------------------- /src/model/common/FatTreeNode.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.common; 17 | 18 | // Any component that needs to understand the construction of the FatTree and the addressing scheme 19 | // being used should extend this class 20 | simple FatTreeNode 21 | { 22 | parameters: 23 | int address; 24 | 25 | // Topology parameters 26 | int tree_depth; // Number of levels in the FatTree 27 | int int_switch_down_ports; // Number of down-ports at top of rack switches (i.e. # of "pods") 28 | int tor_switch_up_ports; // Number of up ports at top of rack switches 29 | int tor_switch_down_ports; // Number of down ports at top of rack switches (i.e. # servers per switch) 30 | int switch_up_ports; // Number of up-ports per switch 31 | int switch_down_ports; // Number of down-ports per switch 32 | int number_of_paths = default( tor_switch_up_ports * (switch_up_ports ^ (tree_depth - 2)) ); // The number of paths available, default is all 33 | int switch_switch_link_speed @unit(bps); // Speed of switch-to-switch links (1*GBPS or 10*GBPS) 34 | int server_switch_link_speed @unit(bps); // Speed of server-to-switch links (1*GBPS or 10*GBPS) 35 | } 36 | -------------------------------------------------------------------------------- /src/model/node/resequencingLayer/HybridResequencer.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.resequencingLayer; 17 | import datacenter.model.common.FatTreeNode; 18 | 19 | // Hybrid sequence and time-based resequencer 20 | simple HybridResequencer like ResequencingLayerInterface //extends FatTreeNode like ResequencingLayerInterface 21 | { 22 | parameters: 23 | @display("i=old/ring"); 24 | int address; 25 | double AgeThreshold @unit("s") = default(1ms); 26 | double ClockSkew @unit("s") = default(0us); 27 | // Adaptively adjust the resequencing timeouts to match observed network delay 28 | bool UseAdaptiveAgeThreshold = default(false); 29 | bool ignoreSchedulingPackets = default(false); 30 | // BufferTimeout determines how long resequencing state will be maintained for a given sender 31 | // Note: If you set this to 0 the resequencer will not automatically timeout buffers but 32 | // other modules (e.g. scheduling layer) may still remove the buffers 33 | double BufferTimeout @unit("s") = default(10s); // TODO determine appropriate default 34 | gates: 35 | inout upper_layer; 36 | inout lower_layer; 37 | } 38 | -------------------------------------------------------------------------------- /src/model/node/transportLayer/SimpleUDP.cc: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #include "DCCommon.h" 17 | #include "SimpleUDP.h" 18 | 19 | Define_Module(SimpleUDP); 20 | 21 | SimpleUDP::SimpleUDP() 22 | { 23 | 24 | } 25 | 26 | void SimpleUDP::initialize() 27 | { 28 | LOG(DEBUG) << endl; 29 | lowerLayerIn_ = gate("lower_layer$i"); 30 | lowerLayerOut_ = gate("lower_layer$o"); 31 | upperLayerIn_ = gate("upper_layer$i"); 32 | upperLayerOut_ = gate("upper_layer$o"); 33 | 34 | } 35 | 36 | void SimpleUDP::handleMessage(cMessage *msg) 37 | { 38 | // We expect all incoming packets to be of type DCN_UDPPacket 39 | // regardless of whether they came form the application or the networking layer 40 | // For now we simply forward the packets 41 | // In the future, we may support multiple applications above and then here we will 42 | // demultiplex/multiplex packets based on port numbers 43 | 44 | 45 | DCN_UDPPacket *udpPacket = check_and_cast(msg); 46 | if (udpPacket->getArrivalGate() == upperLayerIn_) { 47 | send(udpPacket, lowerLayerOut_); 48 | } else { // It came from lowerLayerIn_ 49 | send(udpPacket, upperLayerOut_); 50 | } 51 | } 52 | 53 | SimpleUDP::~SimpleUDP() 54 | { 55 | 56 | } 57 | -------------------------------------------------------------------------------- /src/model/node/transportLayer/TCPInterface.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.transportLayer; 17 | 18 | //import inet.transport.tcp.ITCP; 19 | import inet.transport.ITCP; 20 | 21 | // XXX There is a bug in OMNET with extending module interfaces 22 | // I am suppose to be able to have TCPInterface extend ITCP here. 23 | // However, if I do so, NED files that use TCPInterface will not 24 | // recognize the gates that are inherited from ITCP. 25 | 26 | moduleinterface TCPInterface 27 | { 28 | parameters: 29 | int mss; // Maximum Segment Size (RFC 793) (header option) 30 | @display("i=block/wheelbarrow"); 31 | gates: 32 | input appIn[] @labels(TCPCommand/down); 33 | input ipIn @labels(TCPSegment,IPControlInfo/up); 34 | input ipv6In @labels(TCPSegment,IPv6ControlInfo/up); 35 | output appOut[] @labels(TCPCommand/up); 36 | output ipOut @labels(TCPSegment,IPControlInfo/down); 37 | output ipv6Out @labels(TCPSegment,IPv6ControlInfo/down); 38 | } 39 | 40 | 41 | moduleinterface TCPInterface2 extends ITCP 42 | { 43 | parameters: 44 | int mss; // Maximum Segment Size (RFC 793) (header option) 45 | gates: 46 | 47 | } -------------------------------------------------------------------------------- /BuildFatTree/ethernet_node.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ethernet_node.h 3 | * BuildFatTree 4 | * 5 | * Created by Mart Haitjema on 5/19/11. 6 | * Copyright 2011 Washington University in St. Louis. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef ETHERNET_NODE_H_ 11 | #define ETHERNET_NODE_H_ 12 | 13 | class EthNode; 14 | 15 | class EthPort 16 | { 17 | public: 18 | EthPort(EthNode *parent_node, uint port_number); 19 | virtual ~EthPort(); 20 | 21 | EthNode *get_node(); 22 | uint get_port_number() {return port_number_;} 23 | 24 | void incEthPortObjects(); 25 | void decEthPortObjects(); 26 | 27 | protected: 28 | EthNode *node_; // node that this port belongs to 29 | uint port_number_; 30 | }; 31 | 32 | 33 | class EthNode 34 | { 35 | public: 36 | EthNode(const SubTreeID &node_id, uint number_of_ports, uint depth); 37 | EthNode(); 38 | virtual ~EthNode(); 39 | 40 | void incEthNodeObjects(); 41 | void decEthNodeObjects(); 42 | 43 | virtual std::string get_type() const = 0; 44 | const SubTreeID &get_node_id() {return node_id_;} 45 | 46 | virtual uint get_number_of_ports(); 47 | virtual EthPort *get_up_link_port(uint port_number); 48 | virtual EthPort *get_port(uint port_number); 49 | 50 | virtual void PrintNed(uint position_offset = 0); 51 | virtual void PrintNedConnections(); 52 | virtual std::string NedType() { return get_type();} 53 | virtual std::string NedName(); 54 | virtual std::string NedPort(uint port_number); 55 | 56 | virtual std::string getString() const; 57 | friend std::ostream & operator <<(std::ostream &, const EthNode &); 58 | 59 | protected: 60 | virtual void PrintNedParameters(); 61 | virtual void PrintNedGates(); 62 | virtual void PrintNedPosition(uint position_offset); 63 | virtual std::string indent(uint numIndent = 1); 64 | 65 | std::string indent_; 66 | SubTreeID node_id_; 67 | uint depth_; 68 | private: 69 | vector ports_; 70 | }; 71 | 72 | 73 | #endif // ETHERNET_NODE_H_ 74 | -------------------------------------------------------------------------------- /src/model/node/applicationLayer/messageApplication/trafficPatterns/TP_AllToAll.cc: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | #include "DCCommon.h" 16 | #include "TP_AllToAll.h" 17 | 18 | 19 | AppMessageVector TP_AllToAll::createTraffic(const SubTreeID &node_id, double messageSize) 20 | { 21 | node_id_ = node_id; messageSize_ = messageSize; 22 | AppMessageVector messages; 23 | for (uint i = 0; i < node_id_.getNumberOfServers(); i++) { 24 | uint server_address = i; 25 | addMessagesForServer(server_address, messages); 26 | } 27 | return messages; 28 | } 29 | 30 | 31 | void TP_AllToAll::addMessagesForServer(uint server_address, AppMessageVector &messages) 32 | { 33 | for (uint i = 0; i < node_id_.getNumberOfServers(); i++) { 34 | if (i == server_address) continue; 35 | AppMessage *msg = new AppMessage(); 36 | msg->source = server_address; 37 | msg->destination = i; 38 | msg->messageNum = 0; 39 | msg->startTime = 0; 40 | //msg->messageSize = (double)10*1024*1024*1024*8; // 10 GiB (large enough for 1 second at 1 Gbps), XXX Find a better way to do this 41 | msg->messageSize = messageSize_; 42 | msg->messageRate = 0; // Unlimited 43 | messages.push_back(msg); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/model/node/server/TrafficScriptApplication.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.server; 17 | 18 | import datacenter.model.node.server.*; 19 | import datacenter.model.node.applicationLayer.SimpleUDPApplicationNode; 20 | import datacenter.model.node.applicationLayer.*; 21 | import datacenter.model.node.applicationLayer.trafficScriptApplication.*; 22 | import datacenter.model.node.applicationLayer.messageApplication.*; 23 | import datacenter.model.node.transportLayer.*; 24 | import datacenter.model.node.networkLayer.*; 25 | import datacenter.model.node.schedulingLayer.*; 26 | import datacenter.model.node.resequencingLayer.*; 27 | import datacenter.model.node.linkLayer.*; 28 | import datacenter.model.node.control.*; 29 | 30 | 31 | module TrafficScriptServer extends ServerBase 32 | { 33 | parameters: 34 | string ApplicationType = default("trafficScriptApplication"); 35 | 36 | submodules: 37 | simpleUDPApplication : like SimpleUDPApplicationNode { 38 | parameters: 39 | enabled = default(true); 40 | address = address; 41 | @display("p=225,25"); 42 | } 43 | 44 | connections allowunconnected: 45 | simpleUDPApplication.lower_layer <--> udp.upper_layer; 46 | } -------------------------------------------------------------------------------- /src/model/node/applicationLayer/messageApplication/MAAdjustQueueSizeToRate.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef MAADJUSTQUEUESIZETORATE_H_ 17 | #define MAADJUSTQUEUESIZETORATE_H_ 18 | 19 | #include "MAAdjustRateToThreshold.h" 20 | 21 | class MA_AdjustQueueSizeToRate : public MA_AdjustRateToThreshold 22 | { 23 | public: 24 | MA_AdjustQueueSizeToRate(); 25 | virtual ~MA_AdjustQueueSizeToRate(); 26 | //virtual void handleMessage(cMessage *msg); 27 | virtual void handleControlMessage(ControlMessage *cmsg); 28 | virtual void receiveSignal(cComponent *source, simsignal_t signalID, unsigned long l); 29 | 30 | protected: 31 | virtual void initializeListener(); 32 | //virtual void autoAdjust(); // XXX 33 | virtual void checkNetworkLoss(); 34 | virtual void startMeasurement(); 35 | virtual void autoAdjust_UseMM1Estimation(); 36 | virtual void autoAdjust_DecrementToFindValue(); 37 | ulong lastK_underThrehsold; 38 | ulong lastK_overThreshold; 39 | simsignal_t lossMatchesMM1KwithRhoSignal; 40 | 41 | simsignal_t updateQueueSizeBytesSignal; 42 | simsignal_t updateQueueSizePktsSignal; 43 | simsignal_t maxQlenBytesSignal_; 44 | simsignal_t maxQlenPktsSignal_; 45 | ulong maxQlenBytes_; 46 | ulong maxQlenPkts_; 47 | }; 48 | 49 | #endif /* MAADJUSTQUEUESIZETORATE_H_ */ 50 | -------------------------------------------------------------------------------- /makemakefiles: -------------------------------------------------------------------------------- 1 | # 2 | # Usage: 3 | # make -f makemakefiles 4 | # or, for Microsoft Visual C++: 5 | # nmake -f makemakefiles MMOPT=-n 6 | # 7 | 8 | MAKEMAKE=opp_makemake $(MMOPT) 9 | 10 | INET_PROJ=../inet 11 | 12 | all: 13 | $(MAKEMAKE) -KINET_PROJ=$(INET_PROJ) -f --deep -O out -d src -Xout -I/opt/local/include -L/opt/local/lib -L../inet/out/$(CONFIGNAME)/src -linet -DINET_IMPORT -KINET_PROJ=../inet 14 | cd src && $(MAKEMAKE) -KINET_PROJ=$(INET_PROJ) -f --deep -I/opt/local/include -I../../inet/src/linklayer/ethernet -I../../inet/src/linklayer/ieee80211/radio -I../../inet/src/networklayer/common -I../../inet/src/networklayer/icmpv6 -I../../inet/src -I../../inet/src/world/obstacles -I../../inet/src/networklayer/xmipv6 -I../../inet/src/mobility -I../../inet/src/networklayer/contract -I../../inet/src/networklayer/manetrouting/base -I../../inet/src/networklayer/autorouting/ipv4 -I../../inet/src/linklayer/ieee80211/mgmt -I../../inet/src/util -I../../inet/src/transport/contract -I../../inet/src/linklayer/common -I../../inet/src/status -I../../inet/src/linklayer/radio/propagation -I../../inet/src/linklayer/ieee80211/radio/errormodel -I../../inet/src/linklayer/radio -I../../inet/src/util/headerserializers/tcp -I../../inet/src/networklayer/ipv4 -I../../inet/src/util/headerserializers/ipv4 -I../../inet/src/base -I../../inet/src/util/headerserializers -I../../inet/src/world/radio -I../../inet/src/linklayer/ieee80211/mac -I../../inet/src/networklayer/ipv6 -I../../inet/src/transport/sctp -I../../inet/src/util/headerserializers/udp -I../../inet/src/networklayer/ipv6tunneling -I../../inet/src/applications/pingapp -I../../inet/src/battery/models -I../../inet/src/util/headerserializers/sctp -I../../inet/src/linklayer/contract -I../../inet/src/networklayer/arp -I../../inet/src/transport/tcp_common -I../../inet/src/transport/udp -I../../inet/src/transport/tcp/queues -I../../inet/src/transport/tcp -I../../inet/src/applications/tcpapp -L/opt/local/lib -L../../inet/out/$(CONFIGNAME)/src -lboost_system-mt -lboost_filesystem-mt -linet -DINET_IMPORT -KINET_PROJ=../../inet 15 | -------------------------------------------------------------------------------- /src/model/switch/SwitchPortQueue.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef SWITCHPORTQUEUE_H_ 17 | #define SWITCHPORTQUEUE_H_ 18 | 19 | #include "L2Queue.h" 20 | 21 | class ControlProcessor; 22 | 23 | class SwitchPortQueue : public L2Queue { 24 | public: 25 | SwitchPortQueue(); 26 | virtual ~SwitchPortQueue(); 27 | virtual void initialize(int stage); 28 | virtual void dropPacket(DCN_EthPacket *pkt); 29 | virtual void updateQueueSize(long queueSizeBytes, long queueSizePkts); 30 | virtual void handleMessageDirect(cMessage *msg); // Direct method wrapper for handleMessage() 31 | virtual void passUpwards(cMessage *msg); 32 | virtual uint getSwitchLevel(); 33 | virtual uint getStage(); 34 | //virtual void handleMessage(cMessage *msg); 35 | protected: 36 | // If a packet is dropped, these signals tell you the src/dst host of the dropped packet 37 | simsignal_t dropPktSrcHostSignal; 38 | simsignal_t dropPktDstHostSignal; 39 | simsignal_t dropPktPtrSignal; 40 | simsignal_t updateQueueSizeBytesSignal; 41 | simsignal_t updateQueueSizePktsSignal; 42 | ControlProcessor *cp_; 43 | bool useDirectMsgSending_; 44 | bool isUpPort; // Am I an upward facing port? 45 | uint portIndex_; 46 | 47 | 48 | // To see which source's packets gets dropped 49 | /* 50 | simsignal_t rxPktSrcSignal; 51 | simsignal_t rxPktDstSignal; 52 | simsignal_t rxPktPrioritySignal;*/ 53 | }; 54 | 55 | #endif /* SWITCHPORTQUEUE_H_ */ 56 | -------------------------------------------------------------------------------- /src/model/networks/.tkenvrc: -------------------------------------------------------------------------------- 1 | # Partial Tkenv config file -- see $HOME/.tkenvrc as well 2 | inspector "simulation.scheduled-events." "TrafficSourceControlMessage" "1" "549x314+591+222:normal" 3 | inspector "simulation.scheduled-events." "TrafficSourceControlMessage" "1" "549x314+591+222:normal" 4 | inspector "simulation.scheduled-events." "TrafficSourceControlMessage" "1" "549x314+591+222:normal" 5 | inspector "simulation.scheduled-events." "TrafficSourceControlMessage" "1" "549x314+591+222:normal" 6 | inspector "simulation.scheduled-events." "TrafficSourceControlMessage" "1" "549x314+591+222:normal" 7 | inspector "simulation.scheduled-events." "TrafficSourceControlMessage" "1" "549x314+591+222:normal" 8 | inspector "simulation.scheduled-events." "TrafficSourceControlMessage" "1" "549x314+591+222:normal" 9 | inspector "simulation.scheduled-events." "TrafficSourceControlMessage" "1" "549x314+591+222:normal" 10 | inspector "simulation.scheduled-events." "TrafficSourceControlMessage" "1" "549x314+591+222:normal" 11 | inspector "simulation.scheduled-events." "TrafficSourceControlMessage" "1" "549x314+591+222:normal" 12 | inspector "simulation.scheduled-events." "TrafficSourceControlMessage" "1" "549x314+591+222:normal" 13 | inspector "simulation.scheduled-events." "TrafficSourceControlMessage" "1" "549x314+591+222:normal" 14 | inspector "simulation.scheduled-events." "TrafficSourceControlMessage" "1" "549x314+591+222:normal" 15 | inspector "simulation.scheduled-events." "TrafficSourceControlMessage" "1" "549x314+591+222:normal" 16 | inspector "simulation.scheduled-events." "TrafficSourceControlMessage" "1" "549x314+591+222:normal" 17 | inspector "FatTree_4_2_3" "FatTree_4_2_3" "2" "2032x824+5+27:normal" 18 | inspector "PacketSizeTest" "PacketSizeTest" "2" "986x369+5+27:normal" 19 | inspector "FatTree" "FatTree" "2" "627x318+5+27:normal" 20 | inspector "FatTree.subTree[0].subTree[0].subTree[0]" "ToR" "1" "986x687+244+603:normal" 21 | inspector "FatTree.subTree[0].subTree[0].subTree[0]" "ToR" "2" "669x417+249+553:normal" 22 | inspector "simulation.scheduled-events." "TrafficSourceControlMessage" "1" "549x314+591+222:normal" 23 | 24 | -------------------------------------------------------------------------------- /BuildFatTree/connection.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * connection.cpp 3 | * BuildFatTree 4 | * 5 | * Created by Mart Haitjema on 5/24/11. 6 | * Copyright 2011 Washington University in St. Louis. All rights reserved. 7 | * 8 | */ 9 | 10 | #include "../src/model/common/std_includes.h" 11 | #include "../src/model/common/node_id.h" 12 | #include "ethernet_node.h" 13 | #include "connection.h" 14 | 15 | 16 | std::string datarateNedStr(ulong datarate) 17 | { 18 | std::ostringstream datarateStr; 19 | if (datarate%GBPS == 0) { 20 | datarateStr << datarate/GBPS << " Gbps"; 21 | } else if (datarate%MBPS == 0) { 22 | datarateStr << datarate/MBPS << " Mbps"; 23 | } else if (datarate%KBPS == 0) { 24 | datarateStr << datarate/KBPS << " Kbps"; 25 | } else { 26 | datarateStr << datarate << " bps"; 27 | } 28 | return datarateStr.str(); 29 | } 30 | 31 | std::string delayNedStr(double delay) 32 | { 33 | std::ostringstream delayStr; 34 | if (delay == ceil(delay/MS)*MS) { 35 | delayStr << delay/MS <<"ms"; 36 | } else if (delay == ceil(delay/US)*US) { 37 | delayStr << delay/US <<"us"; 38 | } else if (delay == ceil(delay/NS)*NS) { 39 | delayStr << delay/NS <<"ns"; 40 | } else { 41 | delayStr << delay <<"s"; 42 | } 43 | return delayStr.str(); 44 | } 45 | 46 | Connection::Connection(const std::string &type, EthPort *port1, EthPort *port2, ulong datarate, double delay) 47 | : type_(type), port1_(port1), port2_(port2), datarate_(datarate), delay_(delay) 48 | { 49 | log << "Connection::Connection(uint type, EthPort *port1, EthPort *port2, ulong datarate)" << endl; 50 | } 51 | 52 | void Connection::PrintNed() 53 | { 54 | EthNode* node1 = port1_->get_node(); 55 | EthNode* node2 = port2_->get_node(); 56 | cout << " " << node1->NedPort(port1_->get_port_number()); 57 | cout << " <--> DCLink { datarate=" << datarateNedStr(datarate_) << "; delay=" << delayNedStr(delay_) << "; } <--> "; 58 | cout << node2->NedPort(port2_->get_port_number()) << ";" << endl; 59 | } 60 | 61 | Connection::~Connection() 62 | { 63 | log << "Connection::~Connection()\n"; 64 | } 65 | -------------------------------------------------------------------------------- /src/model/node/applicationLayer/messageApplication/MAAdjustQueueSizeToRate.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.applicationLayer.messageApplication; 17 | 18 | 19 | simple MAAdjustQueueSizeToRate extends MAAdjustRateToThreshold 20 | { 21 | parameters: 22 | @class(MA_AdjustQueueSizeToRate); 23 | // By default, use M/M/1/K model to guide the value of K (queue size pkts) based on loss measurements 24 | // Alternative is to decrement K until the threshold is exceeded which can take much longer. 25 | useMM1K_estimation = default(true); 26 | precision = default(5); // Since the queue size K is an integer, precision only refers to the precision of the value of rho with MM1K estimation and not the value being adjusted 27 | @signal[updateQueueSizeBytes](type="long"); 28 | @signal[updateQueueSizePkts](type="long"); 29 | @signal[lossMatchesMM1KwithRho](type="double"); // Only applies when using MM1K estimation to find queue size 30 | @statistic[updateQueueSizeBytes](title="updated max byte limit for queue";unit=bytes;record=vector?,count?,min?,max?,last?;interpolationmode=none); 31 | @statistic[updateQueueSizePkts](title="updated max packet limit for queue";record=vector?,count?,min?,max?,last?;interpolationmode=none); 32 | @statistic[lossMatchesMM1KwithRho](title="observed loss matches M/M/1/K queue with this traffic intensity";record=vector?,count?,min?,max?,last?;interpolationmode=none); 33 | } -------------------------------------------------------------------------------- /src/model/node/applicationLayer/BklgSchedApplication/ServerBacklog.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.applicationLayer.BklgSchedApplication; 17 | import datacenter.model.common.*; 18 | 19 | simple SendBacklog extends SendStream 20 | { 21 | parameters: 22 | @class(SendBacklog); 23 | @signal[BytesToSend](type="long"); 24 | @signal[BytesSent](type="long"); 25 | @signal[flowFinishTime](type="simtime_t"); 26 | @statistic[BytesToSend](title="bytes left in schedule";unit=bytes;record=vector?,last?;interpolationmode=none); 27 | @statistic[BytesSent](title="bytes that have arrived";unit=bytes;record=vector?,last?;interpolationmode=none); 28 | @statistic[flowFinishTime](title="time when flow is done sending all backlog in schedule";unit=s;record=last?;interpolationmode=none); 29 | } 30 | 31 | simple ReceiveBacklog extends ReceiveStream 32 | { 33 | parameters: 34 | @class(ReceiveBacklog); 35 | @signal[BytesToReceive](type="long"); 36 | @signal[BytesReceived](type="long"); 37 | @signal[flowFinishTime](type="simtime_t"); 38 | @statistic[BytesToReceive](title="bytes left to receive";unit=bytes;record=vector?,last?;interpolationmode=none); 39 | @statistic[BytesReceived](title="bytes received";unit=bytes;record=vector?,last?;interpolationmode=none); 40 | @statistic[flowFinishTime](title="time when flow is done receiving all backlog in schedule";unit=s;record=last?;interpolationmode=none); 41 | } 42 | -------------------------------------------------------------------------------- /src/model/node/schedulingLayer/SchedulingAlgorithm.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef SCHEDULINGALGORITHM_H_ 17 | #define SCHEDULINGALGORITHM_H_ 18 | 19 | #include "SchedulingPacket.h" 20 | #include "SchedulingController.h" 21 | #include "VirtualOutputQueue.h" 22 | 23 | class SchedulingController; 24 | class VirtualOutputQueue; 25 | 26 | class SchedulingAlgorithm : public cSimpleModule 27 | { 28 | public: 29 | // The following are required because we subclassed from cOwnedObject 30 | virtual ~SchedulingAlgorithm(); 31 | virtual void initialize(int stage); 32 | int numInitStages() const { return 2; } 33 | 34 | // Called after the controller has allocated a VOQ 35 | virtual void newVoqAllocated(VirtualOutputQueue *voq); 36 | // Called before the controller removes a VOQ 37 | virtual void voqTimedOut(VirtualOutputQueue *voq); 38 | // Called when the controller receives a scheduling packet 39 | virtual void handleSchedulingPacket(SchedulingPacket *pkt); 40 | protected: 41 | SchedulingController *controller_; 42 | uint address_; 43 | protected: 44 | uint64 linkRate_; 45 | uint64 rxRateToAllocate_; 46 | uint64 txRateToAllocate_; 47 | uint64 minVoqSendRate_; 48 | uint64 reserveBandwidth_; 49 | double OversubscriptionFactor_; 50 | typedef std::map SchedRateMap; 51 | typedef std::map SchedBacklogMap; 52 | SchedRateMap serverRateAssignments_; 53 | SchedBacklogMap serverBacklogs_; 54 | }; 55 | 56 | #endif /* SCHEDULINGALGORITHM_H_ */ 57 | -------------------------------------------------------------------------------- /src/model/node/linkLayer/ServerPortQueue.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.linkLayer; 17 | import datacenter.model.common.L2Queue; 18 | 19 | simple ServerPortQueue extends L2Queue 20 | { 21 | parameters: 22 | int address; 23 | bool measureBandwidth = default(true); 24 | bool setTimestamp = default(true); 25 | bool recordStreamStatistics = default(false); 26 | int limitStatsToEveryPServers = default(0); // Only collect stats for every p'th server 27 | qlenPktsSignalName = default("serverQlenPkts"); 28 | qlenBytesSignalName = default("serverQlenBytes"); 29 | queueingTimeSignalName = default("serverQueueingTime"); 30 | busySignalName = default("serverBusy"); 31 | txBytesSignalName = default("serverPortTxBytes"); 32 | rxBytesSignalName = default("serverPortRxBytes"); 33 | dropSignalName = default("serverDrop"); 34 | 35 | @class(ServerPortQueue); 36 | @signal[sendInterval](type="simtime_t"); 37 | @signal[pktDestTx](type="int"); 38 | @signal[pktDestRx](type="int"); 39 | @statistic[sendInterval](title="interval between packet transmission";unit=bytes;record=vector?,count?,sum?;interpolationmode=none); 40 | @statistic[pktDestTx](title="destination address of transmitted packet";record=vector?,count?;interpolationmode=none); 41 | @statistic[pktDestRx](title="source address of received packet";record=vector?,count?;interpolationmode=none); 42 | 43 | gates: 44 | inout control; 45 | } 46 | 47 | -------------------------------------------------------------------------------- /src/model/node/networkLayer/VirtualIP.cc: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #include "DCCommon.h" 17 | #include "node_id.h" // XXX needed? 18 | #include "VirtualIP.h" 19 | //#include "IPControlInfo.h" 20 | //#include "IPDatagram.h" 21 | #include "IPv4ControlInfo.h" // change needed with INET 2 22 | #include "IPv4Datagram.h" 23 | 24 | #include "InetTCPWrapper.h" 25 | 26 | IPAddress convertDCAddressToIP(uint address) 27 | { 28 | return IPAddress(address + 1); 29 | } 30 | 31 | uint convertIPAddressToDC(IPAddress address) 32 | { 33 | return (uint)(address.getInt() - 1); 34 | } 35 | 36 | VirtualIP::VirtualIP() 37 | { 38 | 39 | } 40 | 41 | void VirtualIP::initialize() 42 | { 43 | NetworkLayerBase::initialize(); 44 | 45 | LOG(DEBUG) << typeid(this).name() << endl; 46 | 47 | address.set((uint32)par("address")); 48 | } 49 | 50 | void VirtualIP::fromTcp(cMessage *msg) 51 | { 52 | cPacket *transportPacket = check_and_cast(msg); 53 | cPacket *networkPacket = encapsulateTCPinDCN_EthPacket(transportPacket); 54 | NetworkLayerBase::fromTcp(networkPacket); 55 | } 56 | 57 | void VirtualIP::fromUdp(cMessage *msg) 58 | { 59 | NetworkLayerBase::fromUdp(msg); 60 | } 61 | 62 | void VirtualIP::toTcp(DCN_IPPacket *msg) 63 | { 64 | cPacket *transportPacket = decapsulateTCPfromDCN_EthPacket(msg); 65 | send(transportPacket, tcpGateOut_); 66 | } 67 | 68 | void VirtualIP::toUdp(DCN_IPPacket *msg) 69 | { 70 | NetworkLayerBase::toUdp(msg); 71 | } 72 | 73 | 74 | VirtualIP::~VirtualIP() 75 | { 76 | 77 | } 78 | 79 | Define_Module(VirtualIP); 80 | -------------------------------------------------------------------------------- /src/model/common/BandwidthMeter.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef BANDWIDTHMETER_H_ 17 | #define BANDWIDTHMETER_H_ 18 | 19 | // This module measures throughput and is modeled after INET's "ThruputMeter" module 20 | // It can be dropped in and connected between modules to measure throughput on a path 21 | // Or it can be left unconnected. 22 | 23 | class BandwidthMeter : public cSimpleModule 24 | { 25 | public: 26 | BandwidthMeter(); 27 | virtual ~BandwidthMeter(); 28 | 29 | virtual void initialize(); 30 | virtual void handleMessage(cMessage *msg); 31 | virtual void updateStats(simtime_t now, unsigned long bits); // Call this method if using direct method calls (tight-coupling, module is not connected) 32 | 33 | protected: 34 | virtual void measureBandwidth(); 35 | 36 | protected: 37 | uint batchSize_; // number of packets in a batch 38 | simtime_t maxInterval_; // max length of measurement interval (measurement ends 39 | // if either batchSize or maxInterval is reached, whichever 40 | // is reached first) 41 | 42 | // current measurement interval 43 | simtime_t intvlStartTime_; 44 | simtime_t intvlLastPkTime_; 45 | unsigned long bitsInInterval_; 46 | unsigned long pktsInInterval_; 47 | 48 | simsignal_t bandwidthSignal; 49 | simsignal_t packetRateSignal; 50 | 51 | cMessage *bandwidthMeasurementEvent; 52 | simtime_t bandwidthMeasureInterval_; 53 | 54 | cGate *inGate_, *outGate_; 55 | 56 | 57 | }; 58 | 59 | #endif /* BANDWIDTHMETER_H_ */ 60 | -------------------------------------------------------------------------------- /src/model/node/schedulingLayer/SchedulingPacket.msg: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | 17 | cplusplus {{ 18 | #include "DCN_EthPacket.h" 19 | }} 20 | packet DCN_EthPacket; 21 | 22 | enum SchedulingPacketTypes 23 | { 24 | SCHEDULING_BACKLOG_REPORT = 0; 25 | SCHEDULING_RATE_ASSIGNMENT = 1; 26 | SCHEDULING_COMPLETE_BACKLOG = 2; 27 | SCHEDULING_PKT_ASYNCHRONOUS = 3; 28 | SCHEDULING_PKT_CHARNY = 4; 29 | SCHEDULING_PKT_MC = 5; 30 | SCHEDULING_BKLG_PROP_REQ = 6; 31 | SCHEDULING_BKLG_PROP_RESP = 7; 32 | SCHEDULING_REQUEST = 8; 33 | SCHEDULING_RESPONSE = 9; 34 | } 35 | 36 | packet SchedulingPacket extends DCN_EthPacket 37 | { 38 | kind = DCN_SCHEDULING_PACKET; 39 | unsigned short schedPktType enum(SchedulingPacketTypes); 40 | dataPacket = false; 41 | } 42 | 43 | packet BacklogReport extends SchedulingPacket 44 | { 45 | schedPktType = SCHEDULING_BACKLOG_REPORT; 46 | unsigned long backlog; 47 | } 48 | 49 | packet RateAssignment extends SchedulingPacket 50 | { 51 | schedPktType = SCHEDULING_RATE_ASSIGNMENT; 52 | unsigned long rateAssignment; 53 | } 54 | 55 | packet CompleteBacklogReport extends SchedulingPacket 56 | { 57 | schedPktType = SCHEDULING_COMPLETE_BACKLOG; 58 | unsigned long backlog[]; 59 | } 60 | 61 | // XXX Not yet used... 62 | packet AsynchronousSchedulingPacket extends SchedulingPacket 63 | { 64 | schedPktType = SCHEDULING_PKT_ASYNCHRONOUS; 65 | unsigned long stampedRate; 66 | bool ubit; 67 | unsigned long backlog; // Additional field used by backlog-proportional algorithm 68 | } 69 | -------------------------------------------------------------------------------- /src/model/node/schedulingLayer/schedFromFile/ScheduleFromFile.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef SCHEDULEFROMFILE_H_ 17 | #define SCHEDULEFROMFILE_H_ 18 | 19 | #include "SchedulingAlgorithm.h" 20 | 21 | class RSMessage 22 | { 23 | public: 24 | // Mijk = kth message from server i to server j 25 | simtime_t startTime; // earliest start time 26 | uint source; // i 27 | uint destination; // j 28 | double rate; 29 | friend std::ostream & operator <<(std::ostream &, const RSMessage *); 30 | }; 31 | 32 | typedef std::vector RSMessageVector; 33 | bool sortByStartTime(RSMessage *msg1, RSMessage *msg2); 34 | std::ostream & operator <<(std::ostream &, const RSMessageVector &); 35 | 36 | class ScheduleFromFile : public SchedulingAlgorithm { 37 | public: 38 | ScheduleFromFile(); 39 | virtual ~ScheduleFromFile(); 40 | virtual void initialize(int stage); 41 | virtual void handleMessage(cMessage *msg); 42 | 43 | virtual void setScheduledRate(RSMessage *msg); 44 | 45 | // Called after the controller has allocated a VOQ 46 | virtual void newVoqAllocated(VirtualOutputQueue *voq) {} 47 | // Called before the controller removes a VOQ 48 | virtual void voqTimedOut(VirtualOutputQueue *voq) {} 49 | // Called when the controller receives a scheduling packet 50 | virtual void handleSchedulingPacket(SchedulingPacket *pkt) {} 51 | protected: 52 | void parseScript(const char *script); 53 | RSMessageVector scheduledRates; 54 | cMessage *startNextScheduledRate; 55 | }; 56 | 57 | #endif /* SCHEDULEFROMFILE_H_ */ 58 | -------------------------------------------------------------------------------- /src/model/switch/ControlProcessor.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef CONTROLPROCESSOR_H_ 17 | #define CONTROLPROCESSOR_H_ 18 | 19 | #include "FatTreeNode.h" 20 | 21 | class SwitchPortQueue; 22 | 23 | class ControlProcessor : public FatTreeNode 24 | { 25 | public: 26 | virtual void initialize(); 27 | virtual void handleMessage(cMessage *msg); 28 | virtual ~ControlProcessor(); 29 | virtual void downPortDirectIn(cMessage *msg, uint port); 30 | virtual void upPortDirectIn(cMessage *msg, uint port); 31 | virtual uint getSwitchLevel() { return depth_; } 32 | virtual uint getNumLevels() { return node_id_.getDepth(); } 33 | 34 | protected: 35 | // NED specified parameters: 36 | simtime_t processingDelay_; 37 | std::string switch_id_; 38 | uint switchIndex_; 39 | uint depth_; 40 | 41 | // Number of each type of port 42 | int number_of_down_ports_; 43 | int number_of_up_ports_; 44 | 45 | // Base gate ID for each type of port 46 | int down_port_in_base_id_; 47 | int down_port_out_base_id_; 48 | int up_port_in_base_id_; 49 | int up_port_out_base_id_; 50 | 51 | std::vector downPortQueues_; 52 | std::vector upPortQueues_; 53 | bool useDirectMsgSending_; 54 | 55 | bool IsDownPort(int gate_id); 56 | bool IsUpPort(int gate_id); 57 | int lookupGateID(uint destAddr, uint path); 58 | SwitchPortQueue* lookupQueue(uint destAddr, uint path); 59 | int lookup(uint destAddr, uint path); 60 | void localDelivery(cMessage *msg); 61 | void flood(cMessage *msg); 62 | void updateQueueSize(cMessage *msg); 63 | 64 | }; 65 | 66 | 67 | #endif /* CONTROLPROCESSOR_H_ */ 68 | -------------------------------------------------------------------------------- /src/model/common/BandwidthMeter.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.common; 17 | 18 | simple BandwidthMeter 19 | { 20 | parameters: 21 | @display("i=block/timer_vs"); 22 | string bandwidthSignalName = default("bandwidth"); 23 | string packetRateSignalName = default("packetRate"); 24 | 25 | // Interval at which to emit rx/tx bandwidth measurements 26 | // XXX Important! using the periodic measurement interval below causes an event 27 | // to be placed on the queue with the specified interval. Not only is this ineffecitent 28 | // but the simulation will never terminate. 29 | double bandwidthMeasureInterval @unit(seconds) = default(0 s); // 0 Means don't use interval 30 | 31 | // Instead of using a fixed period, specify the batchSize and max interval but 32 | // let the period be flexible and let measurements be triggered by activity 33 | int bandwidthMeasurementBatchSize = default(50); // Size of the measurement period in terms of packets 34 | double maxBandwidthMeasureInterval @unit("s") = default(1s); // Size of the measurement period in terms of seconds 35 | 36 | @signal[packetRate](type="double"); // with timestamp 37 | @signal[bandwidth](type="double"); // with timestamp 38 | @statistic[packetRate](title="packets per second";record=vector?,min?,max?,mean?;interpolationmode=none); 39 | @statistic[bandwidth](title="bits per second";record=vector?,min?,max?,mean?;interpolationmode=none); 40 | 41 | gates: 42 | input in; 43 | output out; 44 | } -------------------------------------------------------------------------------- /BuildFatTree/ethernet_switch.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ethernet_switch.h 3 | * BuildFatTree 4 | * 5 | * Created by Mart Haitjema on 5/18/11. 6 | * Copyright 2011 Washington University in St. Louis. All rights reserved. 7 | * 8 | */ 9 | 10 | #ifndef ETHERNET_SWITCH_H_ 11 | #define ETHERNET_SWITCH_H_ 12 | 13 | #define DEFAULT_QUEUE_SIZE_BYTES 32*KiB 14 | #define DEFAULT_QUEUE_SIZE_PKTS 0 15 | 16 | std::string bytesNedStr(ulong bytes); 17 | 18 | class EthSwitch : public EthNode 19 | { 20 | public: 21 | EthSwitch(uint number_of_up_link_ports, 22 | uint number_of_down_link_ports, 23 | const SubTreeID& node_id, 24 | uint depth, uint index = 0); 25 | ~EthSwitch(); 26 | 27 | virtual std::string get_type() const { return "Switch"; } 28 | 29 | bool is_down_link_port(uint port_number); 30 | bool is_up_link_port(uint port_number); 31 | EthPort *get_up_link_port(uint port_number); 32 | EthPort *get_down_link_port(uint port_number); 33 | uint get_index() { return index_; } 34 | void set_index(uint index) { index_ = index; } 35 | 36 | virtual void PrintNedParameters(); 37 | virtual void PrintNedQueueParameters(); 38 | void PrintNedType(); 39 | virtual std::string NedType() { return "EthSwitch"; } 40 | virtual std::string NedPort(uint port_number); 41 | 42 | virtual std::string getString() const; 43 | 44 | protected: 45 | virtual void PrintNedGates(); 46 | 47 | private: 48 | uint number_of_up_link_ports_; 49 | uint number_of_down_link_ports_; 50 | uint index_; // The index of the switch at its sub-tree 51 | }; 52 | 53 | class LogicalSwitch : public EthSwitch 54 | { 55 | public: 56 | LogicalSwitch(uint number_of_up_link_ports, uint number_of_down_link_ports, const SubTreeID& node_id, uint depth, uint index = 0); 57 | void setPhysUpLinksRepresented(uint PhysUpLinksRepresented) { PhysUpLinksRepresented_ = PhysUpLinksRepresented; } 58 | void setPhysDownLinksRepresented(uint PhysDownLinksRepresented) { PhysDownLinksRepresented_ = PhysDownLinksRepresented; } 59 | uint getPhysUpLinksRepresented() { return PhysUpLinksRepresented_; } 60 | uint getPhysDownLinksRepresented() { return PhysDownLinksRepresented_; } 61 | void PrintNedQueueParameters(); 62 | protected: 63 | uint PhysUpLinksRepresented_; 64 | uint PhysDownLinksRepresented_; 65 | }; 66 | 67 | #endif // ETHERNET_SWITCH_H_ 68 | -------------------------------------------------------------------------------- /src/model/node/linkLayer/MPLoadBalancer.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef MPLOADBALANCER_H_ 17 | #define MPLOADBALANCER_H_ 18 | 19 | #include "LoadBalancer.h" 20 | #include "node_id.h" 21 | 22 | typedef std::vector LinkCredits; 23 | std::ostream & operator <<(std::ostream &, const LinkCredits &); 24 | 25 | class MP_Node : public SubTreeID { 26 | public: 27 | MP_Node(const SubTreeID &ID, uint depth); 28 | MP_Node(const MP_Node &node, uint daddr, uint depth); 29 | ~MP_Node(); 30 | void initialize(); 31 | 32 | std::string getString() const; 33 | friend std::ostream & operator <<(std::ostream &, const SubTreeID &); 34 | 35 | int creditsOnPath(uint daddr, uint path); 36 | void performAccounting(DCN_EthPacket *pkt, uint path, uint quantum); 37 | void newQuantum(uint quantum); 38 | void deleteTree(); 39 | 40 | protected: 41 | uint linkForPath(uint path) { return path/(getNumberOfPaths()/numLinks_); } 42 | uint depth_; 43 | uint numLinks_; 44 | LinkCredits linkCredits_; 45 | MP_Node *parentSubTree_; 46 | std::vector childSubTrees_; 47 | }; 48 | 49 | // Note: While MPLoadBalancer conceptually extends TPLoadBalancer and uses the 50 | // same parameters, the implementation is different enough that we have to go 51 | // back to round-robin to find their common ancestor. 52 | class MPLoadBalancer : public RRLoadBalancer { 53 | public: 54 | MPLoadBalancer() {} 55 | ~MPLoadBalancer(); 56 | void initialize(); 57 | uint choosePath(DCN_EthPacket *pkt); 58 | void deleteTree(); 59 | 60 | protected: 61 | uint quantum_; 62 | MP_Node *mySubTree_; 63 | int pktsInRound_; 64 | }; 65 | 66 | #endif /* MPLOADBALANCER_H_ */ 67 | -------------------------------------------------------------------------------- /src/model/node/linkLayer/ServerPortQueue.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef SERVERPORTQUEUE_H_ 17 | #define SERVERPORTQUEUE_H_ 18 | 19 | #include "ServerStream.h" 20 | #include "BandwidthMeter.h" 21 | 22 | #include "L2Queue.h" 23 | 24 | class ServerPortQueue : public L2Queue 25 | { 26 | public: 27 | ServerPortQueue(); 28 | virtual ~ServerPortQueue(); 29 | virtual void initialize(int stage); 30 | virtual void handleMessage(cMessage *msg); 31 | virtual void startTransmitting(DCN_EthPacket *pkt); 32 | virtual void finishTransmitting(); 33 | protected: 34 | uint address_; 35 | int64_t bitsOnWire; 36 | bool setTimestamp_; 37 | BandwidthMeter *rxMeter_; 38 | BandwidthMeter *txMeter_; 39 | public: 40 | // XXX These signals are declared public so that when a listener traps them, 41 | // it doesn't have to use getSignalName to figure out what it is since 42 | // profiling revealed that to be a bottleneck. 43 | simsignal_t sendIntervalSignal; // XXX Necessary? 44 | simsignal_t pktDestTx; 45 | simsignal_t pktDestRx; 46 | simsignal_t rxPacketPtrSignal_; // XXX 47 | simsignal_t txPacketPtrSignal_; // XXX 48 | protected: 49 | cGate *controlGate_in; 50 | cGate *controlGate_out; 51 | 52 | // Per stream statistics 53 | bool recordStreamStatistics_; 54 | int limitStatsToEveryPServers; 55 | SendStreamMap sendingStreams; // for streams where we are the sending end point, indexed by other server's address 56 | ReceiveStreamMap receivingStreams; // for streams where we are the receiving end point, indexed by other server's address 57 | virtual void recordSendStream(DCN_EthPacket *pkt); 58 | virtual void recordReceiveStream(DCN_EthPacket *pkt); 59 | }; 60 | 61 | #endif /* SERVERPORTQUEUE_H_ */ 62 | -------------------------------------------------------------------------------- /src/model/packets/DCN_EthPacket.msg: -------------------------------------------------------------------------------- 1 | // 2 | // This file is part of an OMNeT++/OMNEST simulation example. 3 | // 4 | // Copyright (C) 1992-2008 Andras Varga 5 | // 6 | // This file is distributed WITHOUT ANY WARRANTY. See the file 7 | // `license' for details on this and other legal matters. 8 | // 9 | 10 | 11 | // So that I can use the defined fields from INET IP packets 12 | cplusplus {{ 13 | //#include "IPDatagram_m.h" 14 | #include "IPv4Datagram_m.h" 15 | #include "IPvXAddress.h" 16 | #include "IPProtocolId_m.h" 17 | 18 | 19 | enum IPProtocolId; 20 | 21 | 22 | #define SEQUENCE_NO_BITS 32 23 | 24 | // Assume a packet in our data center network is an IP packet 25 | // where the timestamp option has been used to store: 26 | // - a 32-bit sequence number 27 | // - a 32-bit timestamp 28 | 29 | // Ethernet Frame size 30 | #define UDP_HEADER_SIZE 8 31 | #define IP_HEADER_SIZE (IP_HEADER_BYTES + 8) // IP_HEADER_BYTES = 20 defined in INET, 8 extra for timestamp & seq. no. 32 | #define ETHER_FRAME_SIZE 38 33 | #define ETHER_MIN_PAYLOAD 46 34 | #define ETHER_MAX_SEG_SIZE 1500 35 | #define DCN_MIN_PACKET_SIZE (ETHER_MIN_PAYLOAD + ETHER_FRAME_SIZE) 36 | #define IP_OVERHEAD IP_HEADER_SIZE //(ETHER_FRAME_SIZE + IP_HEADER_SIZE) 37 | 38 | 39 | }} 40 | 41 | 42 | enum DCN_EthPacketType 43 | { 44 | DCN_ETH_PACKET = 0; 45 | DCN_SCHEDULING_PACKET = 1; 46 | DCN_IP_PACKET = 2; 47 | DCN_UDP_PACKET = 3; 48 | DCN_TCP_PACKET = 4; 49 | } 50 | 51 | // 52 | // Represents a packet in the DC Network. 53 | // 54 | packet DCN_EthPacket 55 | { 56 | @customize(true); // will declare the message as DCN_EthPacket_Base which I can then extend 57 | // Note: the order of these fields could be important due to padding 58 | // declaring an int then short then int then short would require more memory then 59 | // declaring int, int, short, short 60 | unsigned int srcAddr; 61 | unsigned int destAddr; 62 | 63 | unsigned int sequenceNo; 64 | //unsigned int timestamp; // We'll use cMessage's timestamp 65 | 66 | // Need this field because pkt size might be less than min. Ether frame size 67 | unsigned short payload; // (bytes) 68 | 69 | unsigned short path; 70 | // To save memory, we'll use the kind field from cMessage to determine the packet type (e.g. data vs scheduling) 71 | unsigned short kind enum(DCN_EthPacketType) = DCN_ETH_PACKET; 72 | //int pktSize; 73 | bool dataPacket = true; 74 | } 75 | 76 | -------------------------------------------------------------------------------- /BuildFatTree/main.cc: -------------------------------------------------------------------------------- 1 | #include "../src/model/common/std_includes.h" 2 | #include "../src/model/common/node_id.h" 3 | #include "ethernet_node.h" 4 | #include "ethernet_switch.h" 5 | #include "fat_tree.h" 6 | 7 | 8 | void print_usage(char *name) 9 | { 10 | cout << "Usage: " << name << ": \n"; 11 | cout << "Builds an OMNet++ NED file to represent the FatTree(m,n).\n"; 12 | cout << "m = # ports per switch (m must be a power of 2)\n"; 13 | cout << "n = # of levels in FatTree (e.g. N = 3 means 3 layers of switches + hosts)\n"; 14 | cout << "\nThe -l option can be used to create the equivalent logical tree instead.\n\n"; 15 | } 16 | 17 | int main(int argc, char* argv[]) 18 | { 19 | uint m; uint n; uint lflag = 0; 20 | 21 | int c; opterr = 0; 22 | while ((c = getopt (argc, argv, "l")) != -1){ 23 | switch (c) { 24 | case 'l': 25 | lflag = 1; 26 | break; 27 | case '?': 28 | if (isprint (optopt)) { 29 | fprintf (stderr, "Unknown option `-%c'.\n", optopt); 30 | } else { 31 | fprintf (stderr, "Unknown option character `\\x%x'.\n", optopt); 32 | return 1; 33 | } 34 | default: 35 | abort(); 36 | } 37 | } 38 | 39 | if (argc - optind != 2) { 40 | print_usage(argv[0]); 41 | return 1; 42 | } else { 43 | m = (uint)atoi(argv[argc-2]); 44 | n = (uint)atoi(argv[argc-1]); 45 | } 46 | 47 | BuildFatTreeParameters p; 48 | p.int_switch_down_ports = m; 49 | //p.int_switches = 4; // XXX 50 | p.tor_switch_down_ports = m/2; 51 | p.switch_down_ports = m/2; 52 | if (lflag) { 53 | p.switch_up_ports = 1; 54 | p.tor_switch_up_ports = 1; 55 | } else { 56 | p.switch_up_ports = m/2; 57 | p.tor_switch_up_ports = m/2; 58 | } 59 | p.tree_depth = n; 60 | p.server_switch_link_speed = 1*GBPS; 61 | p.switch_switch_link_speed = 1*GBPS; 62 | 63 | log << "m = " << m << " n = " << n << " logical tree = " << lflag << endl; 64 | log << "Constructing tree...\n\n\n"; 65 | SubFatTree *t = NULL; 66 | if (lflag) { 67 | t = new LogicalTree(p); 68 | } else { 69 | t = new FatTree(p); 70 | } 71 | t->Init(); // Construct the FatTree 72 | t->PrintNed(50); // 50 is the display offset from the left edge of the screen 73 | delete t; 74 | 75 | return 0; 76 | } 77 | 78 | -------------------------------------------------------------------------------- /src/model/common/FatTreeNode.cc: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #include "DCCommon.h" 17 | #include "node_id.h" 18 | #include "FatTreeNode.h" 19 | 20 | TopologyParameters::TopologyParameters(cSimpleModule *parent) : parent_(parent) 21 | { 22 | // Read the parameters from the NED file 23 | tree_depth = parent_->par("tree_depth"); 24 | //int_switches = parent_->par("int_switches"); 25 | int_switch_down_ports = parent_->par("int_switch_down_ports"); 26 | tor_switch_up_ports = parent_->par("tor_switch_up_ports"); 27 | tor_switch_down_ports = parent_->par("tor_switch_down_ports"); 28 | switch_up_ports = parent_->par("switch_up_ports"); 29 | switch_down_ports = parent_->par("switch_down_ports"); 30 | switch_switch_link_speed = parent_->par("switch_switch_link_speed"); 31 | server_switch_link_speed = parent_->par("server_switch_link_speed"); 32 | } 33 | 34 | TopologyParameters::~TopologyParameters() 35 | { 36 | 37 | } 38 | 39 | FatTreeNode::FatTreeNode() 40 | { 41 | 42 | } 43 | 44 | void FatTreeNode::initialize() 45 | { 46 | LOG(DEBUG) << typeid(this).name() << endl; 47 | 48 | // Read the parameters from the NED file 49 | tree_depth = par("tree_depth"); 50 | //int_switches = par("int_switches"); 51 | int_switch_down_ports = par("int_switch_down_ports"); 52 | tor_switch_up_ports = par("tor_switch_up_ports"); 53 | tor_switch_down_ports = par("tor_switch_down_ports"); 54 | switch_up_ports = par("switch_up_ports"); 55 | switch_down_ports = par("switch_down_ports"); 56 | switch_switch_link_speed = par("switch_switch_link_speed"); 57 | server_switch_link_speed = par("server_switch_link_speed"); 58 | 59 | address_ = par("address").longValue(); 60 | 61 | node_id_ = SubTreeID(*this, address_); 62 | } 63 | 64 | FatTreeNode::~FatTreeNode() 65 | { 66 | 67 | } 68 | 69 | Define_Module(FatTreeNode); 70 | -------------------------------------------------------------------------------- /src/model/node/schedulingLayer/SchedulingAlgorithm.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.node.schedulingLayer; 17 | 18 | moduleinterface SchedulingAlgorithmInterface 19 | { 20 | parameters: 21 | int address; 22 | } 23 | 24 | simple SchedulingAlgorithm like SchedulingAlgorithmInterface 25 | { 26 | parameters: 27 | int address; 28 | @display("i=block/network2"); 29 | double MinVOQSendRate @unit(bps) = default(1kbps); 30 | double ReserveBandwidth @unit(bps) = default(10*MinVOQSendRate); 31 | // Also support allocating out more bandwidth. 32 | // E.g. A factor of 1.1 means allocate out 1.1 times the server's interface 33 | // Note: this applies to both the server's TX and RX bandwidth and the 34 | // factor is applied before subtracting the above reserve from the RX bandwidth. 35 | double OversubscriptionFactor = default(1); 36 | gates: 37 | //inout port; 38 | } 39 | 40 | simple ScheduleFromFile extends SchedulingAlgorithm like SchedulingAlgorithmInterface 41 | { 42 | parameters: 43 | @class(ScheduleFromFile); 44 | string rateScheduleScript = default("exampleRateSchedule.txt"); 45 | } 46 | 47 | simple DistAlgProxy extends SchedulingAlgorithm like SchedulingAlgorithmInterface 48 | { 49 | parameters: 50 | @class(DistAlgProxy); 51 | // Note that scheduling is asynchronous so each flow has its own timer 52 | double SchedulingPeriod @unit(s) = default(1 ms); // Per-flow scheduling period... 53 | bool MaxMin = default(false); // By default, backlog-proportional rates are used 54 | bool DesynchSchedIntervals = default(true); // Desynchronize scheduling intervals by having VOQ's first req. pkt gen. at now + rand()*T 55 | MinVOQSendRate @unit(bps) = default(0 bps); 56 | ReserveBandwidth @unit(bps) = default(0 bps); 57 | } 58 | -------------------------------------------------------------------------------- /src/model/networks/testNetworks/TCPClientServerTest.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.networks.testNetworks; 17 | import ned.DatarateChannel; 18 | import datacenter.model.switch.EthSwitch; 19 | import datacenter.model.node.server.TCPClientServer; 20 | import datacenter.model.node.networkLayer.VirtualIP; 21 | 22 | 23 | network TCPClientServerTest 24 | { 25 | parameters: 26 | **.tree_depth = 1; 27 | **.int_switch_down_ports = 0; 28 | **.tor_switch_up_ports = 0; 29 | **.tor_switch_down_ports = 2; 30 | **.switch_up_ports = 0; 31 | **.switch_down_ports = 0; 32 | **.switch_switch_link_speed = 1Gbps; 33 | **.server_switch_link_speed = 1Gbps; 34 | **.number_of_paths = 1; 35 | 36 | string ClientServerType = "TCPClientServer"; 37 | string ServerServerType = "TCPClientServer"; 38 | 39 | 40 | @display("bgb=337,211"); 41 | types: 42 | channel Link_1Gbps extends DatarateChannel 43 | { 44 | datarate = 1 Gbps; 45 | } 46 | 47 | submodules: 48 | client: TCPClientServer { 49 | @display("p=78,123"); 50 | address = 0; 51 | connectAddress = 1; 52 | } 53 | server: TCPClientServer { 54 | @display("p=228,123"); 55 | address = 1; 56 | connectAddress = 0; 57 | } 58 | 59 | Switch_0_0_i0: EthSwitch { 60 | parameters: 61 | @display("p=154,50,x"); 62 | switch_id = "Switch_0_0_i0"; 63 | depth = 0; 64 | sub_tree_id = 0; 65 | gates: 66 | down_port[2]; 67 | up_port[0]; 68 | } 69 | connections: 70 | client.port <--> Link_1Gbps <--> Switch_0_0_i0.down_port[0]; 71 | server.port <--> Link_1Gbps <--> Switch_0_0_i0.down_port[1]; 72 | } 73 | 74 | 75 | -------------------------------------------------------------------------------- /src/model/common/ServerBuffer.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef SERVERBUFFER_H_ 17 | #define SERVERBUFFER_H_ 18 | 19 | class ServerBuffer : public cSimpleModule, cListener { 20 | public: 21 | ServerBuffer(); 22 | virtual ~ServerBuffer(); 23 | 24 | virtual void initialize(); 25 | virtual void registerSignals(); 26 | virtual void handleMessage(cMessage *msg); 27 | virtual void handlePacket(DCN_EthPacket pkt); 28 | virtual void setDestAddr(uint destAddr) { destAddr_ = destAddr; } 29 | virtual uint getDestAddr() { return destAddr_; } 30 | 31 | virtual simtime_t getLastActiveTime(); 32 | 33 | protected: 34 | // Helper methods 35 | virtual void drop(DCN_EthPacket *pkt); 36 | virtual void enqueue(DCN_EthPacket *pkt); 37 | virtual DCN_EthPacket * dequeue(); 38 | virtual void updateDisplayString(); 39 | 40 | 41 | 42 | protected: 43 | // Attributes 44 | uint destAddr_; 45 | cPacketQueue queue_; 46 | simtime_t lastActiveTime_; // Time at which the queue became empty 47 | long queueSizePackets; // Maximum length of the Queue in packets 48 | long queueSizeBytes; // Maximum length of the Queue in bytes 49 | 50 | 51 | public: 52 | // Interval stats on global signal 53 | virtual void receiveSignal(cComponent *source, simsignal_t signalID, long l); // For emitting stats on global signal 54 | protected: 55 | virtual void emitStats(); 56 | bool statsOnSignal; 57 | std::vector intvlQueueSizePkts_; 58 | std::vector intvlQueueSizeBytes_; 59 | std::vector intvlQueueDrops_; 60 | std::vector intvlTxBytes_; 61 | std::vector intvlRxBytes_; 62 | 63 | 64 | 65 | // Statistics 66 | simsignal_t qlenPktsSignal; 67 | simsignal_t qlenBytesSignal; 68 | simsignal_t dropSignal; 69 | simsignal_t dropPktSignal; 70 | simsignal_t rxBytesSignal; 71 | simsignal_t txBytesSignal; 72 | }; 73 | 74 | #endif /* SERVERBUFFER_H_ */ 75 | -------------------------------------------------------------------------------- /src/model/node/networkLayer/NetworkLayerBase.cc: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #include "DCCommon.h" 17 | // XXX TODO add include for TCPSegment 18 | #include "NetworkLayerBase.h" 19 | 20 | Define_Module(NetworkLayerBase); 21 | 22 | NetworkLayerBase::NetworkLayerBase() 23 | { 24 | 25 | } 26 | 27 | void NetworkLayerBase::initialize() 28 | { 29 | tcpGateIn_ = gate("tcp$i"); 30 | tcpGateOut_ = gate("tcp$o"); 31 | udpGateIn_ = gate("udp$i"); 32 | udpGateOut_ = gate("udp$o"); 33 | lowerLayerIn_ = gate("lower_layer$i"); 34 | lowerLayerOut_ = gate("lower_layer$o"); 35 | } 36 | 37 | void NetworkLayerBase::handleMessage(cMessage *msg) 38 | { 39 | LOG(DEBUG) << "msg arrived on gate " << msg->getArrivalGate() << " and tcpGateIn_ = " << tcpGateIn_ << "" << endl; 40 | LOG(DEBUG) << "msg arrived on gate " << msg->getArrivalGate()->getName() << endl; 41 | if (msg->getArrivalGate() == lowerLayerIn_) { 42 | DCN_IPPacket *ipPacket = check_and_cast(msg); 43 | if (ipPacket->getTransportProtocol() == IP_PROT_UDP) { 44 | toUdp(ipPacket); 45 | } else if (ipPacket->getTransportProtocol() == IP_PROT_TCP) { 46 | toTcp(ipPacket); 47 | } 48 | } else if (msg->getArrivalGate() == tcpGateIn_) { 49 | TCPSegment *tcpSeg = check_and_cast(msg); 50 | fromTcp(tcpSeg); 51 | } else if (msg->getArrivalGate() == udpGateIn_) { 52 | DCN_UDPPacket *udpPacket = check_and_cast(msg); 53 | fromUdp(udpPacket); 54 | } else { 55 | opp_error("unknown message"); 56 | } 57 | } 58 | 59 | void NetworkLayerBase::fromTcp(cMessage *msg) 60 | { 61 | send(msg, lowerLayerOut_); 62 | } 63 | 64 | void NetworkLayerBase::fromUdp(cMessage *msg) 65 | { 66 | send(msg, lowerLayerOut_); 67 | } 68 | 69 | void NetworkLayerBase::toTcp(DCN_IPPacket *msg) 70 | { 71 | send(msg, tcpGateOut_); 72 | } 73 | 74 | void NetworkLayerBase::toUdp(DCN_IPPacket *msg) 75 | { 76 | send(msg, udpGateOut_); 77 | } 78 | 79 | NetworkLayerBase::~NetworkLayerBase() 80 | { 81 | 82 | } 83 | -------------------------------------------------------------------------------- /src/model/node/schedulingLayer/SchedulingController.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef SCHEDULINGCONTROLLER_H_ 17 | #define SCHEDULINGCONTROLLER_H_ 18 | 19 | class SchedulingController; 20 | 21 | // Types used by demux/mux 22 | typedef std::list GateList; 23 | typedef std::map VOQGateMap; 24 | 25 | #include "ModuleWithControlPort.h" 26 | #include "Demultiplexer.h" 27 | #include "Multiplexer.h" 28 | #include "VirtualOutputQueue.h" 29 | #include "SchedulingAlgorithm.h" 30 | 31 | typedef std::map VOQMap; 32 | 33 | class VirtualOutputQueue; 34 | class Demultiplexer; 35 | class Multiplexer; 36 | class SchedulingAlgorithm; 37 | 38 | class SchedulingController : public ModuleWithControlPort { 39 | public: 40 | SchedulingController(); 41 | virtual ~SchedulingController(); 42 | 43 | virtual void initialize(int stage); 44 | int numInitStages() const { return 2; } 45 | virtual void handleMessage(cMessage *msg); 46 | 47 | // Methods 48 | virtual void pktArrivedForNewDestination(uint destAddr); 49 | virtual VirtualOutputQueue *lookupVoq(uint destAddr); 50 | virtual void sendSchedulingPacket(SchedulingPacket *sPkt); 51 | virtual void broadcastSchedulingPacket(SchedulingPacket *sPkt); 52 | virtual void handleControlMessage(ControlMessage *cmsg); 53 | 54 | protected: 55 | // Helper Methods 56 | virtual void scheduleVoqTimeout(); 57 | virtual void checkVoqTimeout(); 58 | virtual void allocateVoq(uint destAddr); 59 | virtual void removeVoq(uint destAddr); 60 | 61 | public: 62 | VOQMap voqMap_; // XXX 63 | 64 | uint64 linkRate; 65 | 66 | bool sendSchedPktAsControl_; 67 | bool enforceBacklogConstraint_; 68 | protected: 69 | // Attributes 70 | SchedulingAlgorithm *schedulingAlgorithm_; 71 | simtime_t VOQTimeout_; 72 | 73 | 74 | Demultiplexer *demux_; 75 | Multiplexer *mux_; 76 | 77 | cMessage *CheckVOQTimeoutEvent_; 78 | 79 | cGate *inGate_, *outGate_; 80 | uint address_; 81 | }; 82 | 83 | #endif /* SCHEDULINGCONTROLLER_H_ */ 84 | -------------------------------------------------------------------------------- /BuildFatTree/server.cc: -------------------------------------------------------------------------------- 1 | /* 2 | * server.cpp 3 | * BuildFatTree 4 | * 5 | * Created by Mart Haitjema on 5/19/11. 6 | * Copyright 2011 Washington University in St. Louis. All rights reserved. 7 | * 8 | */ 9 | 10 | #include "../src/model/common/std_includes.h" 11 | #include "../src/model/common/node_id.h" 12 | #include "ethernet_node.h" 13 | #include "server.h" 14 | 15 | 16 | Server::Server(const SubTreeID& server_id, uint depth) : EthNode(server_id, 1, depth) 17 | { 18 | log << "Server(" << server_id << ")" << endl; 19 | } 20 | 21 | 22 | void Server::PrintNedParameters() 23 | { 24 | //cout << indent() << indent() << indent() << "num_hosts = num_srv;" << endl; 25 | //cout << indent() << indent() << indent() << "sendIaTime = 1s;" << endl; 26 | cout << indent() << indent() << indent() << "address = " << node_id_.getAddress() << ";" << endl; 27 | //cout << indent() << indent() << indent() << "host_id = \"" << this->node_id_.get_string() << "\";" << endl; 28 | //cout << indent() << indent() << indent() << "depth = " << node_id_.get_depth() << ";" << endl; 29 | //cout << indent() << indent() << indent() << "sub_tree_id = " << node_id_.get_address() << ";" << endl; 30 | //cout << indent() << indent() << indent() << "path_mask = " << node_id_.get_path_bit_mask() << ";" << endl; 31 | //cout << indent() << indent() << indent() << "path_shift = " << node_id_.get_path_bit_shift() << ";" << endl; 32 | //cout << indent() << indent() << indent() << "sub_tree_mask = " << node_id_.get_sub_tree_bit_mask() << ";" << endl; 33 | //cout << indent() << indent() << indent() << "sub_tree_shift = " << node_id_.get_sub_tree_bit_shift() << ";" << endl; 34 | //cout << indent() << indent() << indent() << "route_down_mask = " << node_id_.get_level_id_bit_mask(node_id_.get_depth()) << ";" << endl; 35 | //cout << indent() << indent() << indent() << "route_down_shift = " << node_id_.get_level_id_bit_shift(node_id_.get_depth()) << ";" << endl; 36 | //cout << indent() << indent() << indent() << "route_up_mask = " << node_id_.get_level_id_bit_mask(node_id_.get_n() - node_id_.get_depth()) << ";" << endl; 37 | //cout << indent() << indent() << indent() << "route_up_shift = " << node_id_.get_level_id_bit_shift(node_id_.get_n() - node_id_.get_depth()) << ";" << endl; 38 | //cout << indent() << indent() << indent() << "number_of_paths = number_of_paths;" << endl; 39 | } 40 | 41 | void Server::PrintNedGates() 42 | { 43 | // Currently don't need to specify gates for server 44 | } 45 | 46 | std::string Server::NedPort(uint port_number) 47 | { 48 | std::ostringstream oss; 49 | oss << NedName() << ".port"; 50 | return oss.str(); 51 | } 52 | 53 | 54 | Server::~Server() 55 | { 56 | log << "Server::~Server() " << node_id_ << endl; 57 | } 58 | -------------------------------------------------------------------------------- /src/model/node/applicationLayer/messageApplication/trafficPatterns/TP_AllToAllVictimTenant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | #include "DCCommon.h" 16 | #include "TP_AllToAllVictimTenant.h" 17 | 18 | 19 | AppMessageVector TP_AllToAllVictimTenant::createTraffic(const SubTreeID &node_id, double messageSize) 20 | { 21 | node_id_ = node_id; messageSize_ = messageSize; 22 | AppMessageVector messages; 23 | // Assign messages for victim tenant 24 | PartitionVector partitions = partitionServers(partitionSize); 25 | uint_vec_t *partition = partitions.back(); partitions.pop_back(); 26 | for (uint s = 0; s < partition->size(); s++) { 27 | uint server_address = (*partition)[s]; 28 | addMessagesForMaliciousServer(server_address, *partition, messages); 29 | } delete partition; 30 | while (!partitions.empty()) { 31 | uint_vec_t *partition = partitions.back(); 32 | partitions.pop_back(); 33 | for (uint s = 0; s < partition->size(); s++) { 34 | uint server_address = (*partition)[s]; 35 | addMessagesForServer(server_address, *partition, messages); 36 | } 37 | delete partition; 38 | } 39 | return messages; 40 | } 41 | 42 | void TP_AllToAllVictimTenant::addMessagesForMaliciousServer(uint server_address, uint_vec_t &partition, AppMessageVector &messages) 43 | { 44 | // Create all-to-one traffic pattern within malicious tenant 45 | uint dest = partition[0]; // All send to target server = partition[0] 46 | if (dest == server_address) { dest = partition[1]; } // Except the target which sends to server 1 47 | if (dest == server_address) opp_error("whoops: dest == server_address"); 48 | AppMessage *msg = new AppMessage(); 49 | msg->source = server_address; 50 | msg->destination = dest; 51 | msg->messageNum = 1; // XXX Quick hack... if 1, code will set maxSendRate = link rate so that malicious tenant always sends at max rate 52 | msg->startTime = 0; 53 | //msg->messageSize = (double)10*1024*1024*1024*8; // 10 GiB (large enough for 1 second at 1 Gbps), XXX Find a better way to do this 54 | msg->messageSize = messageSize_; 55 | msg->messageRate = 0; // Unlimited 56 | messages.push_back(msg); 57 | } 58 | 59 | -------------------------------------------------------------------------------- /src/model/packets/DCN_TCPPacket_m.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file, do not edit! Created by opp_msgc 4.3 from model/packets/DCN_TCPPacket.msg. 3 | // 4 | 5 | #ifndef _DCN_TCPPACKET_M_H_ 6 | #define _DCN_TCPPACKET_M_H_ 7 | 8 | #include 9 | 10 | // opp_msgc version check 11 | #define MSGC_VERSION 0x0403 12 | #if (MSGC_VERSION!=OMNETPP_VERSION) 13 | # error Version mismatch! Probably this file was generated by an earlier version of opp_msgc: 'make clean' should help. 14 | #endif 15 | 16 | // cplusplus {{ 17 | #include "DCN_IPPacket.h" 18 | // }} 19 | 20 | 21 | 22 | /** 23 | * Class generated from model/packets/DCN_TCPPacket.msg by opp_msgc. 24 | *
25 |  * packet DCN_TCPPacket extends DCN_IPPacket
26 |  * {
27 |  *     @customize(true);
28 |  *     kind enum(DCN_EthPacketType) = DCN_TCP_PACKET;
29 |  * 	transportProtocol = IP_PROT_TCP;
30 |  * }
31 |  * 
32 | * 33 | * DCN_TCPPacket_Base is only useful if it gets subclassed, and DCN_TCPPacket is derived from it. 34 | * The minimum code to be written for DCN_TCPPacket is the following: 35 | * 36 | *
37 |  * class DCN_TCPPacket : public DCN_TCPPacket_Base
38 |  * {
39 |  *   private:
40 |  *     void copy(const DCN_TCPPacket& other) { ... }
41 | 
42 |  *   public:
43 |  *     DCN_TCPPacket(const char *name=NULL, int kind=0) : DCN_TCPPacket_Base(name,kind) {}
44 |  *     DCN_TCPPacket(const DCN_TCPPacket& other) : DCN_TCPPacket_Base(other) {copy(other);}
45 |  *     DCN_TCPPacket& operator=(const DCN_TCPPacket& other) {if (this==&other) return *this; DCN_TCPPacket_Base::operator=(other); copy(other); return *this;}
46 |  *     virtual DCN_TCPPacket *dup() const {return new DCN_TCPPacket(*this);}
47 |  *     // ADD CODE HERE to redefine and implement pure virtual functions from DCN_TCPPacket_Base
48 |  * };
49 |  * 
50 | * 51 | * The following should go into a .cc (.cpp) file: 52 | * 53 | *
54 |  * Register_Class(DCN_TCPPacket);
55 |  * 
56 | */ 57 | class DCN_TCPPacket_Base : public ::DCN_IPPacket 58 | { 59 | protected: 60 | 61 | private: 62 | void copy(const DCN_TCPPacket_Base& other); 63 | 64 | protected: 65 | // protected and unimplemented operator==(), to prevent accidental usage 66 | bool operator==(const DCN_TCPPacket_Base&); 67 | // make constructors protected to avoid instantiation 68 | DCN_TCPPacket_Base(const char *name=NULL, int kind=0); 69 | DCN_TCPPacket_Base(const DCN_TCPPacket_Base& other); 70 | // make assignment operator protected to force the user override it 71 | DCN_TCPPacket_Base& operator=(const DCN_TCPPacket_Base& other); 72 | 73 | public: 74 | virtual ~DCN_TCPPacket_Base(); 75 | virtual DCN_TCPPacket_Base *dup() const {throw cRuntimeError("You forgot to manually add a dup() function to class DCN_TCPPacket");} 76 | virtual void parsimPack(cCommBuffer *b); 77 | virtual void parsimUnpack(cCommBuffer *b); 78 | 79 | // field getter/setter methods 80 | }; 81 | 82 | 83 | #endif // _DCN_TCPPACKET_M_H_ 84 | -------------------------------------------------------------------------------- /src/model/common/ServerStream.ned: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.common; 17 | 18 | simple Stream 19 | { 20 | parameters: 21 | @class(Stream); 22 | double simTimeLimit @unit(s) = default(0s); // This limit is ignored if set to 0 23 | bool emitStatsOnGlobalSignal = default(false); // added for BklgSchedApplication 24 | } 25 | 26 | simple SendStream extends Stream 27 | { 28 | parameters: 29 | @class(SendStream); 30 | @signal[streamTxBytes](type="long"); 31 | @signal[streamPktPath](type="long"); 32 | @signal[txTimestamp](type="simtime_t"); 33 | @signal[txPacketPtr](type="cPacket*"); // Used by MAAdjustRateToThreshold 34 | @statistic[streamTxBytes](title="Bytes sent in the stream"; unit=bytes; record=vector?,sum?; interpolationmode=none); 35 | @statistic[streamPktPath](title="Paths taken by packets in this stream";record=histogram?); 36 | @statistic[txTimestamp](title="timestamp of packet sent";unit=s;record=vector?,count?,sum?,stats?;interpolationmode=none); 37 | } 38 | 39 | simple ReceiveStream extends Stream 40 | { 41 | parameters: 42 | @class(ReceiveStream); 43 | @signal[streamRxBytes](type="long"); 44 | @signal[streamRxLatency](type="simtime_t"); 45 | @signal[outOfOrderArrival](type="simtime_t"); 46 | @signal[streamPktPath](type="long"); 47 | @signal[pktSeqNo](type="long"); 48 | @signal[rxTimestamp](type="simtime_t"); 49 | @signal[rxPacketPtr](type="cPacket*"); // Used by MAAdjustRateToThreshold 50 | @statistic[streamRxBytes](title="Bytes received in the stream"; unit=bytes; record=vector?,sum?; interpolationmode=none); 51 | @statistic[streamRxLatency](title="received packet latency";unit=s;record=vector?,stats?); 52 | @statistic[outOfOrderArrival](title="the amount of time a packet is out-of-order by"; unit=s;record=vector?,stats?); 53 | @statistic[streamPktPath](title="Paths taken by packets in this stream";record=histogram?); 54 | @statistic[pktSeqNo](title="sequence no of received packet";record=vector?,count?,sum?,stats?;interpolationmode=none); 55 | @statistic[rxTimestamp](title="timestamp of received packet";unit=s;record=vector?,count?,sum?,stats?;interpolationmode=none); 56 | } 57 | -------------------------------------------------------------------------------- /src/model/networks/testNetworks/PacketSizeTest.ned.renamed_to_avoid_warnings: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | package datacenter.model.networks.testNetworks; 17 | import datacenter.model.node.server.Server; 18 | import datacenter.model.common.L2Queue; 19 | import ned.DatarateChannel; 20 | 21 | network PacketSizeTest 22 | { 23 | parameters: 24 | // Need these parameters for the server's to work 25 | **.tree_depth = 1; 26 | **.int_switches = 0; 27 | **.int_switch_down_ports = 0; 28 | **.tor_switch_up_ports = 1; 29 | **.tor_switch_down_ports = 1; 30 | **.switch_up_ports = 0; 31 | **.switch_down_ports = 0; 32 | **.switch_switch_link_speed = 1000000000; 33 | **.server_switch_link_speed = 1000000000; 34 | **.numberOfPaths = 1; 35 | 36 | types: 37 | channel Link_1Gbps extends DatarateChannel 38 | { 39 | datarate = 1 Gbps; 40 | } 41 | 42 | submodules: 43 | Server_0: Server { 44 | parameters: 45 | address = 0; 46 | @display("p=100,100"); 47 | gates: 48 | } 49 | Server_1: Server { 50 | parameters: 51 | address = 1; 52 | @display("p=300,100"); 53 | gates: 54 | } 55 | queue: L2Queue { 56 | @display("p=200,100"); 57 | @statistic[rxBytes](title="received packet byte length"; unit=bytes; record=vector,count,sum,histogram; interpolationmode=none); 58 | @statistic[txBytes](title="transmitting packet byte length"; unit=bytes; record=vector,count,sum,histogram; interpolationmode=none); 59 | @statistic[qlenBytes](title="queue length (bytes)"; record=vector,timeavg,max; interpolationmode=sample-hold); 60 | @statistic[qlenPkts](title="queue length (pkts)"; record=vector,timeavg,max; interpolationmode=sample-hold); 61 | @statistic[drop](title="dropped packet byte length"; unit=bytes; record=vector,min,max,mean,count,sum; interpolationmode=none); 62 | } 63 | 64 | connections allowunconnected: 65 | Server_0.port$o --> Link_1Gbps --> queue.in; 66 | queue.line <--> Link_1Gbps <--> Server_1.port; 67 | } 68 | -------------------------------------------------------------------------------- /src/model/node/resequencingLayer/HybridResequencer.h: -------------------------------------------------------------------------------- 1 | // 2 | // This program is free software: you can redistribute it and/or modify 3 | // it under the terms of the GNU Lesser General Public License as published by 4 | // the Free Software Foundation, either version 3 of the License, or 5 | // (at your option) any later version. 6 | // 7 | // This program is distributed in the hope that it will be useful, 8 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 9 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 | // GNU Lesser General Public License for more details. 11 | // 12 | // You should have received a copy of the GNU Lesser General Public License 13 | // along with this program. If not, see http://www.gnu.org/licenses/. 14 | // 15 | 16 | #ifndef HYBRIDRESEQUENCER_H_ 17 | #define HYBRIDRESEQUENCER_H_ 18 | 19 | #include 20 | #include "FatTreeNode.h" 21 | #include "ResequencerBuffer.h" 22 | 23 | class HybridResequencerBuffer; 24 | 25 | class HybridResequencer : public cSimpleModule //: public FatTreeNode 26 | { 27 | public: 28 | HybridResequencer(); 29 | virtual ~HybridResequencer(); 30 | 31 | virtual void initialize(); 32 | virtual void handleMessage(cMessage *msg); 33 | //virtual void removeBuffer(int srcAddr); // public so that another module may determine when a host is no longer sending to us (e.g. scheduling layer) 34 | virtual void checkBufferTimeout(); 35 | //virtual void removeBuffer(HybridResequencerBuffer *buf); 36 | virtual void removeBuffer(uint srcAddr); 37 | virtual void finish(); 38 | 39 | virtual void release(DCN_EthPacket *pkt); // sends the packet up the stack 40 | virtual void drop(DCN_EthPacket *pkt); // drop the packet 41 | 42 | protected: 43 | // Utility Functions 44 | virtual void sendToResequencer(cMessage *msg); 45 | virtual void addSequenceNumber(cMessage *msg); 46 | virtual HybridResequencerBuffer *lookupBuffer(int srcAddr); 47 | virtual void computeMaxExpectedNetworkDelay(cMessage *msg); 48 | 49 | public: 50 | // Max network delay we expect packets to experience... used to set timeouts 51 | simtime_t bufferTimeoutTime_; 52 | simtime_t clockSkew_; // XXX movehis to time based? 53 | simtime_t maxExpectedNetworkDelay_; 54 | bool ignoreSchedulingPackets_; 55 | bool adaptiveAgeThreshold_; 56 | 57 | protected: 58 | // Attributes 59 | typedef std::map ResequencingBufferMap; 60 | ResequencingBufferMap resequencingBuffers_; 61 | cMessage *CheckBufferTimeoutEvent_; 62 | uint address_; 63 | // Gates 64 | cGate* to_lower_layer_; 65 | cGate* to_upper_layer_; 66 | cGate* from_lower_layer_; 67 | cGate* from_upper_layer_; 68 | }; 69 | 70 | 71 | // No changes, just set a static ageThreshold 72 | //class SeqNoResequencer : public HybridResequencer 73 | //{ 74 | 75 | //}; 76 | 77 | // Instantiate only one queue and ignore sequence numbers 78 | //class TimeBasedResequencer : public HybridResequencer 79 | //{ 80 | 81 | //}; 82 | 83 | #endif /* HYBRIDRESEQUENCER_H_ */ 84 | --------------------------------------------------------------------------------