55 thisIPC = this->getModuleByPath(
"^.^");
70 std::ostringstream os;
83 if (msg->isSelfMessage())
85 if (!opp_strcmp(msg->getName(),
"RA-CreateConnections"))
89 while (!flows->empty())
98 Flow* flow = flows->front();
116 else if (!opp_strcmp(msg->getName(),
"RA-TerminateConnections"))
120 while (!flows->empty())
122 Flow* flow = flows->front();
184 cXMLElement* dirXml = par(
"preallocation").xmlValue();
185 const cXMLElementList& timeMap = dirXml->getChildrenByTagName(
"SimTime");
187 for (
auto const m : timeMap)
189 simtime_t time =
static_cast<simtime_t
>(atoi(m->getAttribute(
"t")));
190 const cXMLElementList& connMap = m->getChildrenByTagName(
"Connection");
192 for (
auto const n : connMap)
195 const char* src = n->getAttribute(
"src");
196 const char* dst = n->getAttribute(
"dst");
197 const char* qosReqID = n->getAttribute(
"qosReq");
199 if (!src || !dst || !qosReqID)
201 throw cRuntimeError(
"Invalid preallocation parameter(s) for SimTime %s",
215 if (!opp_strcmp(qosReqID,
"mgmt"))
226 throw cRuntimeError(
"Invalid QoSReqId %s for SimTime=%s, src=\"%s\", dst=\"%s\"",
233 Flow *flow =
new Flow(srcAPN, dstAPN);
239 cMessage* msg =
new cMessage(
"RA-CreateConnections");
240 scheduleAt(time, msg);
246 const char* until_s = n->getAttribute(
"until");
249 simtime_t until =
static_cast<simtime_t
>(atoi(until_s));
254 "Invalid time of deallocation for flow {SimTime=%s, src=\"%s\", dst=\"%s\", qosReq=\"%s\"}",
264 cMessage* msg =
new cMessage(
"RA-TerminateConnections");
265 scheduleAt(until, msg);
280 std::string bottomGate =
thisIPC->gate(
"southIo$o", 0)->getNextGate()->getName();
282 if (par(
"onWire").boolValue() || bottomGate ==
"medium$o" || bottomGate ==
"mediumIntra$o" || bottomGate ==
"mediumInter$o")
289 else if (bottomGate ==
"northIo$i")
294 if (
thisIPC->par(
"relay").boolValue() ==
true)
305 cXMLElement* qosXml =
nullptr;
310 error(
"qoscubesData parameter not initialized!");
313 cXMLElementList cubes = qosXml->getChildrenByTagName(
ELEM_QOSCUBE);
314 for (
auto const m : cubes)
318 EV <<
"Error parsing QoSCube. Its ID is missing!" << endl;
322 cXMLElementList attrs = m->getChildren();
333 EV <<
"QoSCube with ID " << cube.
getQosId()
334 <<
" contains DO-NOT-CARE parameter. It is not fully defined,"
335 <<
" thus it is not loaded into RA's QoS-cube set!"
342 std::ostringstream os;
343 os << this->getFullPath()
344 <<
" does not have any QoSCube in its set. "
345 <<
"It cannot work without at least one valid QoS cube!"
347 error(os.str().c_str());
363 cXMLElement* qosXml =
nullptr;
375 cXMLElementList attrs;
379 attrs = reqs->getChildren();
382 return (reqs ?
new QoSReq(attrs) :
nullptr);
392 cGate* thisIPCIn =
thisIPC->gateHalf(
"southIo$i", cGate::INPUT, 0);
393 cGate* thisIPCOut =
thisIPC->gateHalf(
"southIo$o", cGate::OUTPUT, 0);
397 std::ostringstream rmtGate;
399 rmtModule->addGate(rmtGate.str().c_str(), cGate::INOUT,
false);
400 cGate* rmtModuleIn =
rmtModule->gateHalf(rmtGate.str().c_str(), cGate::INPUT);
401 cGate* rmtModuleOut =
rmtModule->gateHalf(rmtGate.str().c_str(), cGate::OUTPUT);
403 rmtModuleOut->connectTo(thisIPCOut);
404 thisIPCIn->connectTo(rmtModuleIn);
431 std::string combinedPortID =
normalizePortID(bottomIPC->getFullName(), portID);
435 std::ostringstream bottomIPCGate, thisIPCGate;
445 port->postInitialize();
467 std::ostringstream newPortID;
468 newPortID << ipcName <<
'_' << flowPortID;
469 return newPortID.str();
489 Enter_Method(
"createNM1Flow()");
517 EV <<
"DifAllocator returned nullptr for resolving " << dstApn << endl;
525 EV <<
"Local CS does not have any IPC in DIF " << addr.
getDifName() << endl;
551 EV <<
"Flow not allocated!" << endl;
566 Enter_Method(
"createNM1FlowWoAlloc()");
580 e->getDestAddr().getApn().getName(), qosID);
596 EV <<
"DifAllocator returned nullptr for resolving " << dstAPN << endl;
605 EV <<
"Local CS does not have any IPC in DIF " << addr.
getDifName()
639 Enter_Method(
"postNFlowAllocation()");
665 Enter_Method(
"postNM1FlowAllocation()");
683 Enter_Method(
"removeNM1FlowBindings()");
687 const char* gateName = ftItem->
getGateName().c_str();
688 cGate* thisIpcIn =
thisIPC->gateHalf(gateName, cGate::INPUT);
689 cGate* thisIpcOut =
thisIPC->gateHalf(gateName, cGate::OUTPUT);
690 cGate* rmtModuleIn =
rmtModule->gateHalf(gateName, cGate::INPUT);
691 cGate* rmtModuleOut =
rmtModule->gateHalf(gateName, cGate::OUTPUT);
694 portOut->disconnect();
695 rmtModuleOut->disconnect();
696 thisIpcOut->disconnect();
697 thisIpcIn->disconnect();
698 rmtModuleIn->disconnect();
716 Enter_Method(
"removeNM1Flow()");
718 ASSERT(flowItem !=
nullptr);
720 flowItem->getFABase()->receiveDeallocateRequest(flow);
734 Enter_Method(
"bindNFlowToNM1Flow()");
736 EV <<
"Received a request to bind an (N)-flow (dst "
742 EV <<
"This is a bottommost IPCP, the (N)-flow is bound to a medium." << endl;
750 EV <<
"Binding to an (N-1)-flow leading to " << dstAddr;
751 if (dstAddr != neighAddr)
753 EV <<
" through neighbor " << neighAddr;
771 if (nm1FlowItem !=
nullptr)
773 if (nm1FlowItem->getConnectionStatus()
776 EV <<
"Such (N-1)-flow is already present, using it." << endl;
781 EV <<
"Such (N-1)-flow is already present but its allocation is not yet finished"
787 EV <<
"No such (N-1)-flow present, allocating a new one." << endl;
788 Flow *nm1Flow =
new Flow(srcAPN, neighAPN);
798 Enter_Method(
"blockNM1PortOutput()");
804 Enter_Method(
"unblockNM1PortOutput()");
820 Enter_Method(
"signalizeSlowdownRequestToRIBd()");
826 Enter_Method(
"signalizeSlowdownRequestToEFCP()");
833 Enter_Method(
"signalizeMgmtAllocToEnrollment()");
839 Enter_Method(
"signalizeMgmtDeallocToEnrollment()");
853 Enter_Method_Silent();
855 simtime_t now = simTime();
861 preAllocs[wakeUp] =
new std::list<Flow*>;
862 cMessage* msg =
new cMessage(
"RA-CreateConnections");
863 scheduleAt(wakeUp, msg);
871 cMessage* msg =
new cMessage(
"RA-TerminateConnections");
872 scheduleAt(now, msg);
const DAP & getDifName() const
Getter of common DIF name.
static const QoSCube MANAGEMENT
void initSignalsAndListeners()
void signalizeCreateFlowPositiveToRIBd(Flow *flow)
void signalizeSlowdownRequestToRIBd(cPacket *pdu)
Class representing flow object with attributes from specs.
void setQosRequirements(const QoSReq &qosReqs)
Sets QoS parameters wanted by flow initiator.
const char * SIG_RIBD_CreateFlow
void insert(const NM1FlowTableItem *entry)
const char * SIG_RMT_SlowdownRequest
virtual void postNFlowAllocation(Flow *flow)
const APNamingInfo & getSrcApni() const
Gets read-only source APNamingInfo.
virtual void handleMessage(cMessage *msg)
virtual void onNFlowAlloc(RMTPort *port, Flow *flow)
const char * MOD_DIFALLOC
virtual void unblockNM1PortOutput(NM1FlowTableItem *ftItem)
const char * SIG_RA_MgmtFlowAllocated
LisRIBCongNotif * lisRIBCongNotif
Application Process Name class.
void signalizeMgmtDeallocToEnrollment(Flow *flow)
void setOnWire(bool status)
const char * SIG_RIBD_DeleteRequestFlow
virtual bool receiveAllocateRequest(Flow *flow)=0
std::string getQoSId() const
Getter of selected QoS-cube identifier.
std::string normalizePortID(std::string ipcName, int flowPortID)
virtual bool receiveMgmtAllocateRequest(Flow *mgmtflow)=0
virtual bool hasFlow(std::string addr, std::string qosId)
QoSReq * initQoSReqById(const char *id)
RMTPort * getRMTPort() const
const char * SIG_RIBD_CongestionNotification
void signalizeSlowdownRequestToEFCP(cObject *obj)
virtual void removeNM1Flow(Flow *flow)
const char * ELEM_QOSCUBE
virtual void postNM1FlowAllocation(NM1FlowTableItem *ftItem)
const char * GATE_NORTHIO_
NM1FlowTableItem * findFlowByDstAddr(const std::string &addr, const std::string &qosId)
const char * MOD_PDUFWDGEN
bool isDifLocal(const DAP &difName)
simsignal_t sigRAMgmtAllocd
void insertFlowInfo(Address addr, QoSCube qos, RMTPort *port)
RMTPort * getInterfacePort()
const char * MOD_RMTALLOC
QueueAllocBase * qAllocPolicy
const APN & getApn() const
Getter of APN.
virtual bool sleepFlow(Flow *flow, simtime_t wakeUp)
const char * GATE_SOUTHIO_
simsignal_t sigRACreFloNega
LisRACreResPosi * lisRACreResPosi
FABase * findFaInsideIpc(cModule *ipc)
Monitoring and adjustment of IPC process operations .
LisRMTSlowdownRequest * lisRMTSDReq
APNamingInfo holds complete naming info for particular application process.
const char * SIG_RA_ExecuteSlowdown
virtual void initialize(int stage)
virtual void createNM1FlowWithoutAllocate(Flow *flow)
std::map< simtime_t, std::list< Flow * > * > preAllocs
const QoSReq & getQosRequirements() const
Gets QoS parameters wanted by flow initiator.
RMTPort * addPort(Flow *flow)
void interconnectModules(cModule *m1, cModule *m2, std::string n1, std::string n2)
const Address & getDstNeighbor() const
Gets neighbor destination Address, which is the address of (interim) hop-by-hop destination Used duri...
bool isManagementFlow() const
const char * SIG_RA_MgmtFlowDeallocated
const char * MOD_RANM1FLOWTABLE
const char * MOD_RELAYANDMUX
void removePort(RMTPort *port)
simsignal_t sigRASDReqFromRIB
const char * SIG_FAI_CreateFlowResponsePositive
NM1FlowTableItem * findFlowByDstApni(const std::string &addr, const std::string &qosId)
const char * MOD_FLOWALLOC
virtual void createNFlow(Flow *flow)
simsignal_t sigRASDReqFromRMT
RMTModuleAllocator * rmtAllocator
virtual PDUFGNeighbor * getNextNeighbor(const Address &destination, const std::string &qos)
void signalizeCreateFlowNegativeToRIBd(Flow *flow)
const char * GATE_SOUTHIO
virtual void blockNM1PortOutput(NM1FlowTableItem *ftItem)
void signalizeMgmtAllocToEnrollment(APNIPair *apnip)
int getSrcPortId() const
Gets source PortId.
virtual NM1FlowTable * getFlowTable()
const char * SIG_EFCP_StopSending
virtual bool bindNFlowToNM1Flow(Flow *flow)
LisEFCPStartSending * lisEFCPStartSending
const char * SIG_RA_CreateFlowNegative
std::map< simtime_t, std::list< Flow * > * > preDeallocs
const char * SIG_FAI_AllocateResponsePositive
simsignal_t sigRACreFloPosi
void removeFlowInfo(RMTPort *port)
Class representing QoSCube with all its properties that is primarily used by FA, RMT and RA Specifica...
const ConnectionId & getConId() const
Gets read-only Flow's ConnectionId.
void setQosId(std::string qoSId)
Sets QoSCube identifier.
LisRADelFlow * lisRADelFlow
LisRAAllocResPos * lisRAAllocResPos
const char * SIG_RIBD_CreateFlowResponsePositive
std::string getQosId() const
Gets QoSCube identifier.
std::string getGateName() const
virtual void removeNM1FlowBindings(NM1FlowTableItem *ftItem)
const APN & getApn() const
Getter of unique APN which is initialized during object construction.
Class representing QoSReq with all its properties that is primarily used by FA, RMT and RA Specificat...
virtual void onNM1PortInit(RMTPort *port)
const char * SIG_RA_InvokeSlowdown
const char * SIG_EFCP_StartSending
LisEFCPStopSending * lisEFCPStopSending
const Address & getDstAddr() const
Gets source Address, which is the address of communication end-point.
NM1FlowTableItem * lookup(Flow *flow)
LisRACreAllocResPos * lisRACreAllocResPos
virtual bool invokeNewFlowRequestPolicy(Flow *flow)=0
cGate * getSouthOutputGate() const
LisRACreFlow * lisRACreFlow
RMTPort * bindNM1FlowToRMT(cModule *ipc, FABase *fab, Flow *flow)
const std::string & getName() const
Gets APN string name representation.
const QoSCube & getQosCube() const
cModule * getDifMember(const DAP &difName)
const char * MOD_POL_QUEUEALLOC
virtual void createNM1Flow(Flow *flow)
const char * SIG_RA_CreateFlowPositive
Address class holds IPC Process identification.
const APNamingInfo & getDstApni() const
Gets read-only destination APNamingInfo.
const Address * resolveApnToBestAddress(const APN &apn)
simsignal_t sigRAMgmtDeallocd
static const QoSReq MANAGEMENT
void setConnectionStatus(ConnectionStatus status)