diff --git a/slsDetectorSoftware/tests/test-CmdProxy-jungfrau.cpp b/slsDetectorSoftware/tests/test-CmdProxy-jungfrau.cpp index 7c74cd0b2..bd45b1086 100644 --- a/slsDetectorSoftware/tests/test-CmdProxy-jungfrau.cpp +++ b/slsDetectorSoftware/tests/test-CmdProxy-jungfrau.cpp @@ -94,6 +94,37 @@ TEST_CASE("Setting and reading back Jungfrau dacs", "[.cmd][.dacs][.new]") { } } +/* Network Configuration (Detector<->Receiver) */ + +TEST_CASE("selinterface", "[.cmd][.new]") { + Detector det; + CmdProxy proxy(&det); + auto det_type = det.getDetectorType().squash(); + if (det_type == defs::JUNGFRAU) { + auto prev_val = det.getSelectedUDPInterface().tsquash( + "inconsistent selected interface to test"); + { + std::ostringstream oss; + proxy.Call("selinterface", {"1"}, -1, PUT, oss); + REQUIRE(oss.str() == "selinterface 1\n"); + } + { + std::ostringstream oss; + proxy.Call("selinterface", {"0"}, -1, PUT, oss); + REQUIRE(oss.str() == "selinterface 0\n"); + } + { + std::ostringstream oss; + proxy.Call("selinterface", {}, -1, GET, oss); + REQUIRE(oss.str() == "selinterface 0\n"); + } + det.selectUDPInterface(prev_val); + REQUIRE_THROWS(proxy.Call("selinterface", {"2"}, -1, PUT)); + } else { + REQUIRE_THROWS(proxy.Call("selinterface", {}, -1, GET)); + } +} + TEST_CASE("nframes", "[.cmd]") { Detector det; CmdProxy proxy(&det); diff --git a/slsDetectorSoftware/tests/test-CmdProxy.cpp b/slsDetectorSoftware/tests/test-CmdProxy.cpp index 9615b434d..50e1cf093 100644 --- a/slsDetectorSoftware/tests/test-CmdProxy.cpp +++ b/slsDetectorSoftware/tests/test-CmdProxy.cpp @@ -1183,6 +1183,48 @@ TEST_CASE("numinterfaces", "[.cmd][.new]") { REQUIRE_THROWS(proxy.Call("numinterfaces", {"0"}, -1, PUT)); } +TEST_CASE("udp_srcip", "[.cmd][.new]") { + Detector det; + CmdProxy proxy(&det); + auto prev_val = det.getSourceUDPIP(); + REQUIRE_THROWS(proxy.Call("udp_srcip", {"0.0.0.0"}, -1, PUT)); + { + std::ostringstream oss; + proxy.Call("udp_srcip", {"129.129.205.12"}, -1, PUT, oss); + REQUIRE(oss.str() == "udp_srcip 129.129.205.12\n"); + } + for (int i = 0; i != det.size(); ++i) { + det.setSourceUDPIP(prev_val[i], {i}); + } +} + +TEST_CASE("udp_dstip", "[.cmd][.new]") { + Detector det; + CmdProxy proxy(&det); + REQUIRE_THROWS(proxy.Call("udp_dstip", {"0.0.0.0"}, -1, PUT)); +} + +TEST_CASE("udp_srcmac", "[.cmd][.new]") { + Detector det; + CmdProxy proxy(&det); + auto prev_val = det.getSourceUDPMAC(); + REQUIRE_THROWS(proxy.Call("udp_srcmac", {"00:00:00:00:00:00"}, -1, PUT)); + { + std::ostringstream oss; + proxy.Call("udp_srcmac", {"00:50:c2:42:34:12"}, -1, PUT, oss); + REQUIRE(oss.str() == "udp_srcmac 00:50:c2:42:34:12\n"); + } + for (int i = 0; i != det.size(); ++i) { + det.setSourceUDPMAC(prev_val[i], {i}); + } +} + +TEST_CASE("udp_dstmac", "[.cmd][.new]") { + Detector det; + CmdProxy proxy(&det); + REQUIRE_THROWS(proxy.Call("udp_dstmac", {"00:00:00:00:00:00"}, -1, PUT)); +} + /* Advanced */ TEST_CASE("initialchecks", "[.cmd]") {