Udp srcip auto (#480)

* able to set udp_srcip and udp_srcip2 to auto

* minor

* minor
This commit is contained in:
Dhanya Thattil 2022-06-08 12:26:49 +02:00 committed by GitHub
parent 728cb35c37
commit 364e0c6268
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 71 additions and 15 deletions

View File

@ -80,6 +80,7 @@ This document describes the differences between v7.0.0 and v6.x.x
- g2 system frequency is the same irrespective of timing source
- (apparently) rxr doesnt get stuck anymore from 6.1.1
- rxr mem size changed (fifo header size from 8 to 16) due to sls rxr header = 112.. 112+ 16=128 (reduces packet losss especially for g2)
-udp_srcip and udp_Srcip2: can set to auto (for virtual or 1g data networks)
2. Resolved Issues
==================

View File

@ -1539,6 +1539,72 @@ std::string CmdProxy::UDPDestinationList(int action) {
return os.str();
}
std::string CmdProxy::UDPSourceIP(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[x.x.x.x] or auto\n\tIp address of the detector (source) udp interface. Must be same subnet as destination udp ip.\n\t[Eiger] Set only for 10G. For 1G, detector will replace with its own DHCP IP address. If 'auto' used, then ip is set to ip of rx_hostname."
<< '\n';
} else if (action == defs::GET_ACTION) {
auto t = det->getSourceUDPIP(std::vector<int>{det_id});
if (!args.empty()) {
WrongNumberOfParameters(0);
}
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
IpAddr val;
if (args[0] == "auto") {
val = getIpFromAuto();
LOG(logINFO) << "Setting udp_srcip of detector " << det_id << " to "
<< val;
} else {
val = IpAddr(args[0]);
}
det->setSourceUDPIP(val, std::vector<int>{det_id});
os << val << '\n';
} else {
throw RuntimeError("Unknown action");
}
return os.str();
}
std::string CmdProxy::UDPSourceIP2(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[x.x.x.x] or auto\n\t[Jungfrau][Gotthard2] Ip address of the detector (source) udp interface 2. Must be same subnet as destination udp ip2.\n\t [Jungfrau] top half or inner interface\n\t [Gotthard2] veto debugging. If 'auto' used, then ip is set to ip of rx_hostname."
<< '\n';
} else if (action == defs::GET_ACTION) {
auto t = det->getSourceUDPIP2(std::vector<int>{det_id});
if (!args.empty()) {
WrongNumberOfParameters(0);
}
os << OutString(t) << '\n';
} else if (action == defs::PUT_ACTION) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
IpAddr val;
if (args[0] == "auto") {
val = getIpFromAuto();
LOG(logINFO) << "Setting udp_srcip2 of detector " << det_id << " to "
<< val;
} else {
val = IpAddr(args[0]);
}
det->setSourceUDPIP2(val, std::vector<int>{det_id});
os << val << '\n';
} else {
throw RuntimeError("Unknown action");
}
return os.str();
}
std::string CmdProxy::UDPDestinationIP(int action) {
std::ostringstream os;
os << cmd << ' ';

View File

@ -877,8 +877,8 @@ class CmdProxy {
{"udp_numdst", &CmdProxy::udp_numdst},
{"udp_cleardst", &CmdProxy::udp_cleardst},
{"udp_firstdst", &CmdProxy::udp_firstdst},
{"udp_srcip", &CmdProxy::udp_srcip},
{"udp_srcip2", &CmdProxy::udp_srcip2},
{"udp_srcip", &CmdProxy::UDPSourceIP},
{"udp_srcip2", &CmdProxy::UDPSourceIP2},
{"udp_dstip", &CmdProxy::UDPDestinationIP},
{"udp_dstip2", &CmdProxy::UDPDestinationIP2},
{"udp_srcmac", &CmdProxy::udp_srcmac},
@ -1148,6 +1148,8 @@ class CmdProxy {
IpAddr getIpFromAuto();
UdpDestination getUdpEntry();
std::string UDPDestinationList(int action);
std::string UDPSourceIP(int action);
std::string UDPSourceIP2(int action);
std::string UDPDestinationIP(int action);
std::string UDPDestinationIP2(int action);
/* Receiver Config */
@ -1597,19 +1599,6 @@ class CmdProxy {
"out from in a round robin fashion. The entry must not have been "
"empty. Default: 0");
INTEGER_COMMAND_VEC_ID(
udp_srcip, getSourceUDPIP, setSourceUDPIP, IpAddr,
"[x.x.x.x]\n\tIp address of the detector (source) udp "
"interface. Must be same subnet as destination udp "
"ip.\n\t[Eiger] Set only for 10G. For 1G, detector will "
"replace with its own DHCP IP address.");
INTEGER_COMMAND_VEC_ID(
udp_srcip2, getSourceUDPIP2, setSourceUDPIP2, IpAddr,
"[x.x.x.x]\n\t[Jungfrau][Gotthard2] Ip address of the detector "
"(source) udp interface 2. Must be same subnet as destination udp "
"ip2.\n\t [Jungfrau] top half or inner interface\n\t [Gotthard2] veto "
"debugging.");
INTEGER_COMMAND_VEC_ID(
udp_srcmac, getSourceUDPMAC, setSourceUDPMAC, MacAddr,