11 void DCInfection::initialize() {
12 double iniT = par(
"iniTime").doubleValue();
13 loopRem = par(
"loop").longValue();
15 if(loopRem <= 0 || iniT<0 || par(
"infectedIPC").stdstringValue() ==
"") {
return; }
17 toTors = par(
"toTors");
18 toFabric = par(
"toFabric");
19 toSpines = par(
"toSpines");
20 toEdges = par(
"toEdges");
22 if(toTors || toFabric || toSpines) {
23 scheduleAt(iniT,
new cMessage());
26 interTime = par(
"interTime").doubleValue();
28 mod = this->getParentModule()->getSubmodule(par(
"infectedIPC").stringValue());
29 if(mod==NULL) {
return; }
31 rmt = mod->getSubmodule(
"relayAndMux")->getSubmodule(
"rmt");
33 rmt->addGate(
"infGate", cGate::INOUT,
false);
34 cGate * modIn = rmt->gateHalf(
"infGate", cGate::INPUT);
35 cGate * modOut = rmt->gateHalf(
"infGate", cGate::OUTPUT);
37 cGate * In = gateHalf(
"g", cGate::INPUT);
38 cGate * Out = gateHalf(
"g", cGate::OUTPUT);
40 modOut->connectTo(In);
41 Out->connectTo(modIn);
44 string DIF = mod->par(
"difName");
45 string SRC = mod->par(
"ipcAddress");
49 string qosId = par(
"qosId");
51 srcAddr =
Address(SRC.c_str(), DIF.c_str());
53 connID.setSrcCepId(-1);
54 connID.setDstCepId(-1);
55 connID.setQoSId(qosId);
57 pods = par(
"pods").longValue();
58 torXpod = par(
"torXpod").longValue();
59 fabricXpod = par(
"fabricXpod").longValue();
60 spineXfabric = par(
"spineXfabric").longValue();
61 edgeSets = par(
"edgeSets").longValue();
63 if(pods < 1) { pods = 1; }
64 if(torXpod < 1) { torXpod = 1; }
65 if(fabricXpod < 1) { fabricXpod = 1; }
66 if(spineXfabric < 1) { spineXfabric = 1; }
67 if(edgeSets < 0) { edgeSets = 0; }
71 void DCInfection::handleMessage(cMessage *msg) {
72 simtime_t now = simTime();
73 if(loopRem <= 0) {
delete msg;
return; }
77 scheduleAt(now + interTime, msg);
79 }
else {
delete msg; }
83 void DCInfection::setNext() {
85 switch(current.type) {
95 if(current.b == torXpod) {
99 if(current.a == pods) {
116 if(current.b == fabricXpod) {
120 if(current.a == pods) {
137 if(current.b == spineXfabric) {
141 if(current.a == fabricXpod) {
158 if(current.b == fabricXpod) {
162 if(current.a == edgeSets) {
172 if(current == Im && tCurr != Im) { loopRem--; setNext(); }
174 dstAddr =
Address(current.toString().c_str(), dstAddr.getDifName().getName().c_str());
179 PDU * DCInfection::getPDU() {
197 pdu->encapsulate(ud);
199 pdu->setByteLength(0);
virtual void setNoLength(bool noLength)
virtual void setSduSeqNumPresent(bool sduSeqNumPresent)
Define_Module(DCInfection)
virtual void setDstApn(const APN &dstApn)
virtual void setHopCount(unsigned int hopCount)
virtual void setSrcAddr(const Address &srcAddr)
virtual void setDstAddr(const Address &dstAddr)
void setSduSeqNum(unsigned int sduSeqNum)
virtual void setSeqNum(unsigned int seqNum)
virtual void setSrcApn(const APN &srcApn)
virtual void setCompleteSDU(bool completeSDU)
virtual void setConnId(const ConnectionId &connId)
Address class holds IPC Process identification.