add call collisions to the stats counters; add REST APIs to reset and zero call counters;

r05a04_dev
Bryan Biedenkapp 3 days ago
parent d68fffad97
commit eee7a21616

@ -146,6 +146,7 @@ FNENetwork::FNENetwork(HostFNE* host, const std::string& address, uint16_t port,
m_sndcpEndAddr(__IP_FROM_STR("10.10.1.254")), m_sndcpEndAddr(__IP_FROM_STR("10.10.1.254")),
m_totalActiveCalls(0U), m_totalActiveCalls(0U),
m_totalCallsProcessed(0U), m_totalCallsProcessed(0U),
m_totalCallCollisions(0U),
m_logDenials(false), m_logDenials(false),
m_logUpstreamCallStartEnd(true), m_logUpstreamCallStartEnd(true),
m_reportPeerPing(reportPeerPing), m_reportPeerPing(reportPeerPing),

@ -409,6 +409,7 @@ namespace network
int32_t m_totalActiveCalls; int32_t m_totalActiveCalls;
uint64_t m_totalCallsProcessed; uint64_t m_totalCallsProcessed;
uint64_t m_totalCallCollisions;
bool m_logDenials; bool m_logDenials;
bool m_logUpstreamCallStartEnd; bool m_logUpstreamCallStartEnd;

@ -218,6 +218,9 @@ bool TagAnalogData::processFrame(const uint8_t* data, uint32_t len, uint32_t pee
else { else {
LogWarning((fromUpstream) ? LOG_PEER : LOG_MASTER, "Analog, Call Collision, peer = %u, ssrc = %u, srcId = %u, dstId = %u, streamId = %u, rxPeer = %u, rxSrcId = %u, rxDstId = %u, rxStreamId = %u, fromUpstream = %u", LogWarning((fromUpstream) ? LOG_PEER : LOG_MASTER, "Analog, Call Collision, peer = %u, ssrc = %u, srcId = %u, dstId = %u, streamId = %u, rxPeer = %u, rxSrcId = %u, rxDstId = %u, rxStreamId = %u, fromUpstream = %u",
peerId, ssrc, srcId, dstId, streamId, status.peerId, status.srcId, status.dstId, status.streamId, fromUpstream); peerId, ssrc, srcId, dstId, streamId, status.peerId, status.srcId, status.dstId, status.streamId, fromUpstream);
m_network->m_totalCallCollisions++;
return false; return false;
} }
} else { } else {

@ -316,6 +316,9 @@ bool TagDMRData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId
} else { } else {
LogWarning((fromUpstream) ? LOG_PEER : LOG_MASTER, "DMR, Call Collision, peer = %u, ssrc = %u, srcId = %u, dstId = %u, slotNo = %u, streamId = %u, rxPeer = %u, rxSrcId = %u, rxDstId = %u, rxSlotNo = %u, rxStreamId = %u, fromUpstream = %u", LogWarning((fromUpstream) ? LOG_PEER : LOG_MASTER, "DMR, Call Collision, peer = %u, ssrc = %u, srcId = %u, dstId = %u, slotNo = %u, streamId = %u, rxPeer = %u, rxSrcId = %u, rxDstId = %u, rxSlotNo = %u, rxStreamId = %u, fromUpstream = %u",
peerId, ssrc, srcId, dstId, slotNo, streamId, status.peerId, status.srcId, status.dstId, status.slotNo, status.streamId, fromUpstream); peerId, ssrc, srcId, dstId, slotNo, streamId, status.peerId, status.srcId, status.dstId, status.slotNo, status.streamId, fromUpstream);
m_network->m_totalCallCollisions++;
return false; return false;
} }
} else { } else {

@ -354,6 +354,9 @@ bool TagNXDNData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerI
} else { } else {
LogWarning((fromUpstream) ? LOG_PEER : LOG_MASTER, "NXDN, Call Collision, peer = %u, ssrc = %u, srcId = %u, dstId = %u, streamId = %u, rxPeer = %u, rxSrcId = %u, rxDstId = %u, rxStreamId = %u, fromUpstream = %u", LogWarning((fromUpstream) ? LOG_PEER : LOG_MASTER, "NXDN, Call Collision, peer = %u, ssrc = %u, srcId = %u, dstId = %u, streamId = %u, rxPeer = %u, rxSrcId = %u, rxDstId = %u, rxStreamId = %u, fromUpstream = %u",
peerId, ssrc, srcId, dstId, streamId, status.peerId, status.srcId, status.dstId, status.streamId, fromUpstream); peerId, ssrc, srcId, dstId, streamId, status.peerId, status.srcId, status.dstId, status.streamId, fromUpstream);
m_network->m_totalCallCollisions++;
return false; return false;
} }
} else { } else {

@ -411,6 +411,9 @@ bool TagP25Data::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId
else { else {
LogWarning((fromUpstream) ? LOG_PEER : LOG_MASTER, "P25, Call Collision, peer = %u, ssrc = %u, sysId = $%03X, netId = $%05X, srcId = %u, dstId = %u, streamId = %u, rxPeer = %u, rxSrcId = %u, rxDstId = %u, rxStreamId = %u, fromUpstream = %u", LogWarning((fromUpstream) ? LOG_PEER : LOG_MASTER, "P25, Call Collision, peer = %u, ssrc = %u, sysId = $%03X, netId = $%05X, srcId = %u, dstId = %u, streamId = %u, rxPeer = %u, rxSrcId = %u, rxDstId = %u, rxStreamId = %u, fromUpstream = %u",
peerId, ssrc, sysId, netId, srcId, dstId, streamId, status.peerId, status.srcId, status.dstId, status.streamId, fromUpstream); peerId, ssrc, sysId, netId, srcId, dstId, streamId, status.peerId, status.srcId, status.dstId, status.streamId, fromUpstream);
m_network->m_totalCallCollisions++;
return false; return false;
} }
} else { } else {

@ -673,6 +673,9 @@ void RESTAPI::initializeEndpoints()
m_dispatcher.match(FNE_GET_RELOAD_CRYPTO).get(REST_API_BIND(RESTAPI::restAPI_GetReloadCrypto, this)); m_dispatcher.match(FNE_GET_RELOAD_CRYPTO).get(REST_API_BIND(RESTAPI::restAPI_GetReloadCrypto, this));
m_dispatcher.match(FNE_GET_STATS).get(REST_API_BIND(RESTAPI::restAPI_GetStats, this)); m_dispatcher.match(FNE_GET_STATS).get(REST_API_BIND(RESTAPI::restAPI_GetStats, this));
m_dispatcher.match(FNE_PUT_RESET_TOTAL_CALLS).put(REST_API_BIND(RESTAPI::restAPI_PutResetTotalCalls, this));
m_dispatcher.match(FNE_PUT_RESET_ACTIVE_CALLS).put(REST_API_BIND(RESTAPI::restAPI_PutResetActiveCalls, this));
m_dispatcher.match(FNE_PUT_RESET_CALL_COLLISIONS).put(REST_API_BIND(RESTAPI::restAPI_PutResetCallCollisions, this));
m_dispatcher.match(FNE_GET_AFF_LIST).get(REST_API_BIND(RESTAPI::restAPI_GetAffList, this)); m_dispatcher.match(FNE_GET_AFF_LIST).get(REST_API_BIND(RESTAPI::restAPI_GetAffList, this));
m_dispatcher.match(FNE_GET_SPANNING_TREE).get(REST_API_BIND(RESTAPI::restAPI_GetSpanningTree, this)); m_dispatcher.match(FNE_GET_SPANNING_TREE).get(REST_API_BIND(RESTAPI::restAPI_GetSpanningTree, this));
@ -1948,6 +1951,8 @@ void RESTAPI::restAPI_GetStats(const HTTPPayload& request, HTTPPayload& reply, c
// total calls processed // total calls processed
uint32_t totalCallsProcessed = m_network->m_totalCallsProcessed; uint32_t totalCallsProcessed = m_network->m_totalCallsProcessed;
response["totalCallsProcessed"].set<uint32_t>(totalCallsProcessed); response["totalCallsProcessed"].set<uint32_t>(totalCallsProcessed);
uint32_t totalCallCollisions = m_network->m_totalCallCollisions;
response["totalCallCollisions"].set<uint32_t>(totalCallCollisions);
int32_t totalActiveCalls = m_network->m_totalActiveCalls; int32_t totalActiveCalls = m_network->m_totalActiveCalls;
response["totalActiveCalls"].set<int32_t>(totalActiveCalls); response["totalActiveCalls"].set<int32_t>(totalActiveCalls);
@ -1967,6 +1972,63 @@ void RESTAPI::restAPI_GetStats(const HTTPPayload& request, HTTPPayload& reply, c
reply.payload(response); reply.payload(response);
} }
/* REST API endpoint; implements put reset total calls request. */
void RESTAPI::restAPI_PutResetTotalCalls(const HTTPPayload& request, HTTPPayload& reply, const RequestMatch& match)
{
if (!validateAuth(request, reply)) {
return;
}
json::object response = json::object();
setResponseDefaultStatus(response);
LogInfoEx(LOG_REST, "request to reset total calls processed");
if (m_network != nullptr) {
m_network->m_totalCallsProcessed = 0U;
}
reply.payload(response);
}
/* REST API endpoint; implements put reset active calls request. */
void RESTAPI::restAPI_PutResetActiveCalls(const HTTPPayload& request, HTTPPayload& reply, const RequestMatch& match)
{
if (!validateAuth(request, reply)) {
return;
}
json::object response = json::object();
setResponseDefaultStatus(response);
LogInfoEx(LOG_REST, "request to reset total active calls");
if (m_network != nullptr) {
m_network->m_totalActiveCalls = 0U;
}
reply.payload(response);
}
/* REST API endpoint; implements put reset call collisions request. */
void RESTAPI::restAPI_PutResetCallCollisions(const HTTPPayload& request, HTTPPayload& reply, const RequestMatch& match)
{
if (!validateAuth(request, reply)) {
return;
}
json::object response = json::object();
setResponseDefaultStatus(response);
LogInfoEx(LOG_REST, "request to reset total call collisions");
if (m_network != nullptr) {
m_network->m_totalCallCollisions = 0U;
}
reply.payload(response);
}
/* REST API endpoint; implements get affiliation list request. */ /* REST API endpoint; implements get affiliation list request. */
void RESTAPI::restAPI_GetAffList(const HTTPPayload& request, HTTPPayload& reply, const RequestMatch& match) void RESTAPI::restAPI_GetAffList(const HTTPPayload& request, HTTPPayload& reply, const RequestMatch& match)

@ -376,6 +376,30 @@ private:
*/ */
void restAPI_GetStats(const HTTPPayload& request, HTTPPayload& reply, const restapi::RequestMatch& match); void restAPI_GetStats(const HTTPPayload& request, HTTPPayload& reply, const restapi::RequestMatch& match);
/**
* @brief REST API endpoint; implements put reset total calls request.
* @param request HTTP request.
* @param reply HTTP reply.
* @param match HTTP request matcher.
*/
void restAPI_PutResetTotalCalls(const HTTPPayload& request, HTTPPayload& reply, const restapi::RequestMatch& match);
/**
* @brief REST API endpoint; implements put reset active calls request.
* @param request HTTP request.
* @param reply HTTP reply.
* @param match HTTP request matcher.
*/
void restAPI_PutResetActiveCalls(const HTTPPayload& request, HTTPPayload& reply, const restapi::RequestMatch& match);
/**
* @brief REST API endpoint; implements put reset call collisions request.
* @param request HTTP request.
* @param reply HTTP reply.
* @param match HTTP request matcher.
*/
void restAPI_PutResetCallCollisions(const HTTPPayload& request, HTTPPayload& reply, const restapi::RequestMatch& match);
/** /**
* @brief REST API endpoint; implements get affiliation list request. * @brief REST API endpoint; implements get affiliation list request.
* @param request HTTP request. * @param request HTTP request.

@ -60,6 +60,9 @@
#define FNE_GET_RELOAD_CRYPTO "/reload-crypto" #define FNE_GET_RELOAD_CRYPTO "/reload-crypto"
#define FNE_GET_STATS "/stats" #define FNE_GET_STATS "/stats"
#define FNE_PUT_RESET_TOTAL_CALLS "/stats/reset-total-calls"
#define FNE_PUT_RESET_ACTIVE_CALLS "/stats/reset-active-calls"
#define FNE_PUT_RESET_CALL_COLLISIONS "/stats/reset-call-collisions"
#define FNE_GET_AFF_LIST "/report-affiliations" #define FNE_GET_AFF_LIST "/report-affiliations"
#define FNE_GET_SPANNING_TREE "/spanning-tree" #define FNE_GET_SPANNING_TREE "/spanning-tree"

@ -59,6 +59,9 @@
#define RCD_FNE_SAVE_PEER_ACL "fne-peer-commit" #define RCD_FNE_SAVE_PEER_ACL "fne-peer-commit"
#define RCD_FNE_GET_STATS "fne-stats" #define RCD_FNE_GET_STATS "fne-stats"
#define RCD_FNE_PUT_RESET_TOTAL_CALLS "fne-reset-total-calls"
#define RCD_FNE_PUT_RESET_ACTIVE_CALLS "fne-reset-active-calls"
#define RCD_FNE_PUT_RESET_CALL_COLLISIONS "fne-reset-call-collisions"
#define RCD_FNE_GET_SPANNINGTREE "fne-spanning-tree" #define RCD_FNE_GET_SPANNINGTREE "fne-spanning-tree"
@ -235,6 +238,9 @@ void usage(const char* message, const char* arg)
reply += " fne-peer-commit Saves the current peer ACL to permenant storage (Converged FNE only)\r\n"; reply += " fne-peer-commit Saves the current peer ACL to permenant storage (Converged FNE only)\r\n";
reply += "\r\n"; reply += "\r\n";
reply += " fne-stats Retrieves current FNE statistics (Converged FNE only)\r\n"; reply += " fne-stats Retrieves current FNE statistics (Converged FNE only)\r\n";
reply += " fne-reset-total-calls Resets the total call statistics counters (Converged FNE only)\r\n";
reply += " fne-reset-active-calls Resets the active call statistics counters (Converged FNE only)\r\n";
reply += " fne-reset-call-collisions Resets the call collision statistics counters (Converged FNE only)\r\n";
reply += "\r\n"; reply += "\r\n";
reply += " fne-spanning-tree Retrieves the current FNE spanning tree (Converged FNE only)\r\n"; reply += " fne-spanning-tree Retrieves the current FNE spanning tree (Converged FNE only)\r\n";
reply += "\r\n"; reply += "\r\n";
@ -976,6 +982,15 @@ int main(int argc, char** argv)
else if (rcom == RCD_FNE_GET_STATS) { else if (rcom == RCD_FNE_GET_STATS) {
retCode = client->send(HTTP_GET, FNE_GET_STATS, json::object(), response); retCode = client->send(HTTP_GET, FNE_GET_STATS, json::object(), response);
} }
else if (rcom == RCD_FNE_PUT_RESET_TOTAL_CALLS) {
retCode = client->send(HTTP_PUT, FNE_PUT_RESET_TOTAL_CALLS, json::object(), response);
}
else if (rcom == RCD_FNE_PUT_RESET_ACTIVE_CALLS) {
retCode = client->send(HTTP_PUT, FNE_PUT_RESET_ACTIVE_CALLS, json::object(), response);
}
else if (rcom == RCD_FNE_PUT_RESET_CALL_COLLISIONS) {
retCode = client->send(HTTP_PUT, FNE_PUT_RESET_CALL_COLLISIONS, json::object(), response);
}
else if (rcom == RCD_FNE_GET_SPANNINGTREE) { else if (rcom == RCD_FNE_GET_SPANNINGTREE) {
retCode = client->send(HTTP_GET, FNE_GET_SPANNING_TREE, json::object(), response); retCode = client->send(HTTP_GET, FNE_GET_SPANNING_TREE, json::object(), response);
} }

Loading…
Cancel
Save

Powered by TurnKey Linux.