RINASim  October 2016
Documentation of framework for OMNeT++
IDPerNCU.cc
Go to the documentation of this file.
1 // The MIT License (MIT)
2 //
3 // Copyright (c) 2014-2016 Brno University of Technology, PRISTINE project
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to deal
7 // in the Software without restriction, including without limitation the rights
8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 // copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 //
12 // The above copyright notice and this permission notice shall be included in
13 // all copies or substantial portions of the Software.
14 //
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 // THE SOFTWARE.
22 
23 #include "IDPerNCU.h"
24 
26 
28 {
29  cXMLElement* qos2cuXml = NULL;
30  if (par("qos2cuData").xmlValue() != NULL && par("qos2cuData").xmlValue()->hasChildren())
31  qos2cuXml = par("qos2cuData").xmlValue();
32  else
33  error("qos2cuData parameter not initialized!");
34 
35  cXMLElementList qos2cu = qos2cuXml->getChildrenByTagName("qos");
36  for (cXMLElementList::iterator it = qos2cu.begin(); it != qos2cu.end(); ++it) {
37  cXMLElement* m = *it;
38 
39  if (!m->getAttribute("id")) {
40  EV << "Error parsing qos2cu. Its ID is missing!" << endl;
41  continue;
42  }
43  std::string qosId = m->getAttribute("id");
44 
45  if (!m->getAttribute("cu")) {
46  EV << "Error parsing CU. Its ID is missing!" << endl;
47  continue;
48  }
49  std::string cu = m->getAttribute("cu");
50  if (cu == "") {
51  EV << "Error parsing CU. Its ID is missing!" << endl;
52  continue;
53  }
54 
55  qos2CU[qosId] = cu;
56  }
57 }
58 
60 {
61  std::string qosId = pdu->getConnId().getQoSId();
62  if(qos2CU.find(qosId) != qos2CU.end()){
63  return qos2CU[qosId];
64  } else {
65  return "BE";
66  }
67 }
68 
70 {
71  return generateOutputQueueID(pdu);
72 }
virtual std::string generateInputQueueID(PDU *pdu)
Definition: IDPerNCU.cc:69
std::string getQoSId() const
Getter of selected QoS-cube identifier.
Definition: ConnectionId.cc:44
virtual ConnectionId & getConnId()
Definition: PDU_m.cc:336
Definition: PDU.h:42
std::map< std::string, std::string > qos2CU
Definition: IDPerNCU.h:40
Define_Module(IDPerNCU)
virtual std::string generateOutputQueueID(PDU *pdu)
Definition: IDPerNCU.cc:59
virtual void onPolicyInit()
Definition: IDPerNCU.cc:27