void crofchantest::handle_established(rofl::crofchan &chan, rofl::crofconn &conn, uint8_t ofp_version) { rofl::AcquireReadWriteLock lock(tlock); LOG(INFO) << std::endl; LOG(INFO) << "TEST: crofchantest::handle_established() -chan-, " << "num_of_accepts = " << num_of_accepts << ", " << "num_of_conns = " << num_of_conns << ", " << "channel1.size() = " << channel1->size() << ", " << "channel2.size() = " << channel2->size() << ", " << "conn.get_auxid() = " << (int)conn.get_auxid().get_id() << std::endl; CPPUNIT_ASSERT(conn.is_established()); if (testname == std::string("test_congestion")) { /* we need a large queue size to force a loopback socket into congestion */ if (channel1 == &chan) { conn.set_txqueue_max_size(65536); } if (conn.get_auxid() == rofl::cauxid(0)) { rofl::cthread::thread(thread_num) .add_timer(this, TIMER_ID_START_SENDING_PACKET_INS, rofl::ctimespec().expire_in(1)); } } }
void crofchantest::handle_recv(rofl::crofchan &chan, rofl::crofconn &conn, rofl::openflow::cofmsg *pmsg) { rofl::AcquireReadWriteLock lock(tlock); switch (pmsg->get_type()) { case rofl::openflow13::OFPT_FEATURES_REQUEST: { LOG(INFO) << "crofchantest::handle_recv() message: " << std::endl << *pmsg << "sending FEATURES-REPLY auxid: " << (int)conn.get_auxid().get_id() << std::endl; rofl::openflow::cofmsg_features_reply *msg = new rofl::openflow::cofmsg_features_reply(rofl::openflow13::OFP_VERSION, pmsg->get_xid(), dpid); msg->set_auxid(conn.get_auxid().get_id()); conn.send_message(msg); } break; case rofl::openflow13::OFPT_PACKET_IN: { std::cerr << "r"; num_of_pkts_rcvd++; if ((num_of_pkts_sent == num_of_pkts_rcvd) && (max_congestion_rounds <= 0)) { LOG(INFO) << "TEST: received all packets, initiating test shutdown " << std::endl; LOG(INFO) << "sent: " << num_of_pkts_sent << std::endl; LOG(INFO) << "rcvd: " << num_of_pkts_rcvd << std::endl; keep_running = false; } } break; case rofl::openflow13::OFPT_PACKET_OUT: { } break; default: {}; } delete pmsg; }
void crofchantest::handle_established(rofl::crofconn &conn, uint8_t ofp_version) { { rofl::AcquireReadWriteLock lock(plock); pending_conns.erase(&conn); LOG(INFO) << "crofchantest::handle_established() pending_conns: " << pending_conns.size() << std::endl; } rofl::AcquireReadWriteLock lock(tlock); channel2->add_conn(&conn); LOG(INFO) << "TEST: crofchantest::handle_established() server via -conn-, " << "conn.get_auxid() = " << (int)conn.get_auxid().get_id() << std::endl; CPPUNIT_ASSERT(conn.is_established()); num_of_ctl_established++; LOG(INFO) << "num_of_ctl_established = " << num_of_ctl_established << std::endl; }