%description: Tests for BehaviourAggregateClassifier. %file: TestApp.ned simple TestApp { gates: input in[]; output out; } %file: TestApp.cc #include #include "inet/common/INETDefs.h" #include "inet/networklayer/ipv4/IPv4Datagram.h" #include "inet/networklayer/ipv6/IPv6Datagram.h" namespace diffserv_baclassifier_1 { using namespace inet; class INET_API TestApp : public cSimpleModule { std::ofstream out; protected: void initialize(); void finalize(); void handleMessage(cMessage *msg); }; Define_Module(TestApp); void TestApp::initialize() { out.open("result.txt"); if (out.fail()) throw cRuntimeError("Can not open output file."); char buf[30]; // send 64 IPv4 datagram for (int i = 0; i < 64; i++) { sprintf(buf, "ipv4-%d", i); IPv4Datagram *datagram = new IPv4Datagram(buf); datagram->setDiffServCodePoint(i); send(datagram, "out"); } // send 64 IPv6 datagram for (int i = 0; i < 64; i++) { sprintf(buf, "ipv6-%d", i); IPv6Datagram *datagram = new IPv6Datagram(buf); datagram->setDiffServCodePoint(i); send(datagram, "out"); } } void TestApp::finalize() { out.close(); } void TestApp::handleMessage(cMessage *msg) { cGate *gate = msg->getArrivalGate(); out << msg->getName() << ": " << gate->getName() << "[" << gate->getIndex() << "]\n"; delete msg; } } %file: TestNetwork.ned import inet.networklayer.diffserv.BehaviorAggregateClassifier; network TestNetwork { submodules: app: TestApp; classifier: BehaviorAggregateClassifier { dscps = "*"; } connections: app.out --> classifier.in; for i=0..63 { classifier.outs++ --> app.in++; } classifier.defaultOut --> app.in++; } %inifile: omnetpp.ini ned-path = .;../../../../src;../../lib sim-time-limit=100s cmdenv-express-mode = true network = TestNetwork #omnetpp 5.0 - 5.1 compatibility: eventlog-file = "${resultdir}/${configname}-${runnumber}.elog" output-scalar-file = "${resultdir}/${configname}-${runnumber}.sca" output-vector-file = "${resultdir}/${configname}-${runnumber}.vec" snapshot-file = "${resultdir}/${configname}-${runnumber}.sna" %contains: result.txt ipv4-0: in[0] ipv4-1: in[1] ipv4-2: in[2] ipv4-3: in[3] ipv4-4: in[4] ipv4-5: in[5] ipv4-6: in[6] ipv4-7: in[7] ipv4-8: in[8] ipv4-9: in[9] ipv4-10: in[10] ipv4-11: in[11] ipv4-12: in[12] ipv4-13: in[13] ipv4-14: in[14] ipv4-15: in[15] ipv4-16: in[16] ipv4-17: in[17] ipv4-18: in[18] ipv4-19: in[19] ipv4-20: in[20] ipv4-21: in[21] ipv4-22: in[22] ipv4-23: in[23] ipv4-24: in[24] ipv4-25: in[25] ipv4-26: in[26] ipv4-27: in[27] ipv4-28: in[28] ipv4-29: in[29] ipv4-30: in[30] ipv4-31: in[31] ipv4-32: in[32] ipv4-33: in[33] ipv4-34: in[34] ipv4-35: in[35] ipv4-36: in[36] ipv4-37: in[37] ipv4-38: in[38] ipv4-39: in[39] ipv4-40: in[40] ipv4-41: in[41] ipv4-42: in[42] ipv4-43: in[43] ipv4-44: in[44] ipv4-45: in[45] ipv4-46: in[46] ipv4-47: in[47] ipv4-48: in[48] ipv4-49: in[49] ipv4-50: in[50] ipv4-51: in[51] ipv4-52: in[52] ipv4-53: in[53] ipv4-54: in[54] ipv4-55: in[55] ipv4-56: in[56] ipv4-57: in[57] ipv4-58: in[58] ipv4-59: in[59] ipv4-60: in[60] ipv4-61: in[61] ipv4-62: in[62] ipv4-63: in[63] ipv6-0: in[0] ipv6-1: in[1] ipv6-2: in[2] ipv6-3: in[3] ipv6-4: in[4] ipv6-5: in[5] ipv6-6: in[6] ipv6-7: in[7] ipv6-8: in[8] ipv6-9: in[9] ipv6-10: in[10] ipv6-11: in[11] ipv6-12: in[12] ipv6-13: in[13] ipv6-14: in[14] ipv6-15: in[15] ipv6-16: in[16] ipv6-17: in[17] ipv6-18: in[18] ipv6-19: in[19] ipv6-20: in[20] ipv6-21: in[21] ipv6-22: in[22] ipv6-23: in[23] ipv6-24: in[24] ipv6-25: in[25] ipv6-26: in[26] ipv6-27: in[27] ipv6-28: in[28] ipv6-29: in[29] ipv6-30: in[30] ipv6-31: in[31] ipv6-32: in[32] ipv6-33: in[33] ipv6-34: in[34] ipv6-35: in[35] ipv6-36: in[36] ipv6-37: in[37] ipv6-38: in[38] ipv6-39: in[39] ipv6-40: in[40] ipv6-41: in[41] ipv6-42: in[42] ipv6-43: in[43] ipv6-44: in[44] ipv6-45: in[45] ipv6-46: in[46] ipv6-47: in[47] ipv6-48: in[48] ipv6-49: in[49] ipv6-50: in[50] ipv6-51: in[51] ipv6-52: in[52] ipv6-53: in[53] ipv6-54: in[54] ipv6-55: in[55] ipv6-56: in[56] ipv6-57: in[57] ipv6-58: in[58] ipv6-59: in[59] ipv6-60: in[60] ipv6-61: in[61] ipv6-62: in[62] ipv6-63: in[63] %#-------------------------------------------------------------------------------------------------------------- %not-contains: stdout undisposed object: %not-contains: stdout -- check module destructor %#--------------------------------------------------------------------------------------------------------------