Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HOS-21650 [AP3000] Radio link is not listed under telrgraf #25

Merged
merged 2 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 74 additions & 8 deletions plugins/inputs/ah_wireless/ah_wireless.go
Original file line number Diff line number Diff line change
Expand Up @@ -939,16 +939,15 @@ func Gather_Client_Stat(t *Ah_wireless, acc telegraf.Accumulator) error {
var numassoc int
var stainfo *ah_ieee80211_sta_info


var tot_rx_tx uint32
var tot_rate_frame uint32
var tot_pcnt int64
var conn_score int64
var tx_total int64
var rx_total int64
//var tx_ok uint64
//var rx_ok uint64
//var tot_rate_frame uint32
var tx_retries uint32
//var tx_retry_rate uchar
var idx int
//var conn_score uint32
var tmp_count1 int32
var tmp_count2 int32
var tmp_count3 uint32
Expand Down Expand Up @@ -1104,8 +1103,15 @@ func Gather_Client_Stat(t *Ah_wireless, acc telegraf.Accumulator) error {
}
}

//tx_ok = tx_total;
//rx_ok = rx_total;
tx_ok := tx_total
rx_ok := rx_total

tot_unicasts := rx_ok + tx_ok
if tot_unicasts > 100 {
tot_unicasts /= 100
} else {
tot_unicasts = 1
}
/* Tx/Rx bit rate distribution */
for idx = 0; idx < NS_HW_RATE_SIZE; idx++ {
tmp_count1 = int32(clt_item[cn].ns_tx_rate_stats[idx].ns_unicasts - t.last_clt_stat[ii][cn].ns_tx_rate_stats[idx].ns_unicasts)
Expand Down Expand Up @@ -1153,6 +1159,66 @@ func Gather_Client_Stat(t *Ah_wireless, acc telegraf.Accumulator) error {
}
/* Rate stat from DCD */

for i := 0; i < NS_HW_RATE_SIZE; i++ {
if clt_item[cn].ns_rx_rate_stats[i].ns_unicasts != 0 || clt_item[cn].ns_tx_rate_stats[i].ns_unicasts != 0 {
if clt_item[cn].ns_tx_rate_stats[i].ns_unicasts >= t.last_clt_stat[ii][cn].ns_tx_rate_stats[i].ns_unicasts ||
clt_item[cn].ns_rx_rate_stats[i].ns_unicasts >= t.last_clt_stat[ii][cn].ns_rx_rate_stats[i].ns_unicasts {
tot_rx_tx = (clt_item[cn].ns_tx_rate_stats[i].ns_unicasts + clt_item[cn].ns_rx_rate_stats[i].ns_unicasts +
clt_item[cn].ns_rx_rate_stats[i].ns_retries + clt_item[cn].ns_tx_rate_stats[i].ns_retries) -
(t.last_clt_stat[ii][cn].ns_tx_rate_stats[i].ns_unicasts +
t.last_clt_stat[ii][cn].ns_rx_rate_stats[i].ns_unicasts +
t.last_clt_stat[ii][cn].ns_rx_rate_stats[i].ns_retries +
t.last_clt_stat[ii][cn].ns_tx_rate_stats[i].ns_retries)
} else {
tot_rx_tx = 0
}
tot_rate_frame += tot_rx_tx

if tot_rx_tx > 100 {
tot_rx_tx /= 100
} else {
tot_rx_tx = 1
}
success_count := (clt_item[cn].ns_rx_rate_stats[i].ns_unicasts + clt_item[cn].ns_tx_rate_stats[i].ns_unicasts) -
(t.last_clt_stat[ii][cn].ns_rx_rate_stats[i].ns_unicasts + t.last_clt_stat[ii][cn].ns_tx_rate_stats[i].ns_unicasts)
success := success_count / tot_rx_tx

if tot_unicasts != 0 {
tot_pcnt = int64(success_count) / tot_unicasts
}

rate_score := (clt_item[cn].ns_tx_rate_stats[i].ns_rateKbps) / 1000
conn_score = (int64(rate_score) * int64(success) * tot_pcnt)
}
}
var radio_link_score, rssi int
if (stainfo != nil) {
rssi = int(stainfo.rssi) + int(stainfo.noise_floor)
} else {
rssi = 0
}
var tmp_count1 int
if tot_rate_frame > (600 * 20) {
if clt_item[cn].ns_sla_bm_score > 0 {
tmp_count1 = (50 * int(conn_score)) / int(clt_item[cn].ns_sla_bm_score)
if tmp_count1 > AH_DCD_CLT_SCORE_GOOD {
radio_link_score = AH_DCD_CLT_SCORE_GOOD
fmt.Println("radio link score is more than 100")
} else {
radio_link_score = tmp_count1
}
} else {
radio_link_score = AH_DCD_CLT_SCORE_GOOD
}
} else {
if rssi <= -85 {
radio_link_score = AH_DCD_CLT_SCORE_POOR
} else if rssi < -70 {
radio_link_score = AH_DCD_CLT_SCORE_ACCEPTABLE
} else {
radio_link_score = AH_DCD_CLT_SCORE_GOOD
}
}
t.last_clt_stat[ii][cn] = clt_item[cn]


Expand All @@ -1172,7 +1238,7 @@ func Gather_Client_Stat(t *Ah_wireless, acc telegraf.Accumulator) error {
fields2["rxDrop"] = clt_item[cn].ns_tx_drops
fields2["avgSnr"] = clt_item[cn].ns_snr
fields2["psTimes"] = clt_item[cn].ns_ps_times
fields2["radioScore"] = 0 /* TBD (Needs to implent calculations) */
fields2["radioScore"] = radio_link_score
fields2["ipNetScore"] = ipnet_score
if ipnet_score == 0 {
fields2["appScore"] = ipnet_score
Expand Down
6 changes: 6 additions & 0 deletions plugins/inputs/ah_wireless/ah_wireless_defines.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,12 @@ const (
AH_DCD_NMS_PHY_MODE_AX_6G
)

const (
AH_DCD_CLT_SCORE_POOR = 0
AH_DCD_CLT_SCORE_ACCEPTABLE = 40
AH_DCD_CLT_SCORE_GOOD = 100
)


type IFReqData struct {
Name [unix.IFNAMSIZ]byte
Expand Down
Loading