Hardening stats

This commit is contained in:
stephb9959
2022-03-17 11:02:12 -07:00
parent 500ae694d9
commit 1b678cbc41
5 changed files with 190 additions and 3 deletions

View File

@@ -452,7 +452,13 @@ paths:
schema:
type: boolean
required: false
- in: query
description: list of boards for a given venue
name: forVenue
schema:
type: string
format: uuid
required: false
responses:
200:
description: Return a list of boards

View File

@@ -8,6 +8,25 @@
namespace OpenWifi {
void RESTAPI_board_list_handler::DoGet() {
auto forVenue = GetParameter("forVenue","");
if(!forVenue.empty()) {
std::vector<AnalyticsObjects::BoardInfo> Boards;
auto F = [&](const AnalyticsObjects::BoardInfo &B) -> bool {
if(!B.venueList.empty()) {
for(const auto &venue:B.venueList) {
if(venue.id == forVenue) {
Boards.emplace_back(B);
break;
}
}
}
return true;
};
DB_.Iterate(F);
return ReturnObject("boards",Boards);
}
return ListHandler<BoardsDB>("boards", DB_, *this);
}

View File

@@ -11,13 +11,13 @@ namespace OpenWifi {
class RelativeCounter {
public:
explicit RelativeCounter(uint64_t iv) {
inited = iv;
inited = true;
LastValue = iv;
}
RelativeCounter() = default;
inline uint64_t set(uint64_t v) {
[[nodiscard]] inline uint64_t set(uint64_t v) {
if(!inited) {
inited=true;
LastValue=v;

View File

@@ -0,0 +1,154 @@
{
"globals": {
"wireless-multimedia": {
"profile": "rfc8325"
}
},
"interfaces": [
{
"ethernet": [
{
"select-ports": [
"WAN*",
"LAN*"
]
}
],
"ipv4": {
"addressing": "dynamic"
},
"ipv6": {
"addressing": "dynamic"
},
"name": "BowenNetwork",
"role": "upstream",
"services": [
"ssh",
"lldp",
"mdns"
],
"ssids": [
{
"bss-mode": "mesh",
"encryption": {
"ieee80211w": "optional",
"key": "snoopy_mesh",
"proto": "psk2"
},
"name": "BowenMesh",
"services": [
"statistics"
],
"wifi-bands": [
"5G"
]
},
{
"bss-mode": "ap",
"encryption": {
"ieee80211w": "optional",
"key": "snoopy99",
"proto": "psk2"
},
"name": "petunia",
"roaming": {
"generate-psk": true,
"message-exchange": "ds"
},
"services": [
"wifi-steering"
],
"wifi-bands": [
"2G",
"5G"
]
}
],
"tunnel": {
"proto": "mesh"
},
"vlan": {
"id": 100
}
}
],
"metrics": {
"dhcp-snooping": {
"filters": [
"ack",
"discover",
"offer",
"request",
"solicit",
"reply",
"renew"
]
},
"health": {
"interval": 60
},
"statistics": {
"interval": 60,
"types": [
"ssids",
"lldp",
"clients"
]
},
"wifi-frames": {
"filters": [
"probe",
"auth",
"assoc",
"disassoc",
"deauth",
"local-deauth",
"inactive-deauth",
"key-mismatch",
"beacon-report",
"radar-detected"
]
}
},
"radios": [
{
"band": "5G",
"bandwidth": 20,
"channel": 36,
"channel-mode": "VHT",
"channel-width": 80,
"country": "CA",
"tx-power": 10
},
{
"band": "2G",
"bandwidth": 20,
"channel-mode": "VHT",
"channel-width": 40,
"country": "CA",
"tx-power": 23
}
],
"services": {
"lldp": {
"describe": "uCentral",
"location": "universe"
},
"mdns": {
"enable": true
},
"ssh": {
"port": 22
},
"wifi-steering": {
"assoc-steering": true,
"load-kick-threshold": 90,
"mode": "local",
"network": "upstream",
"required-probe-snr": -80,
"required-roam-snr": -80,
"required-snr": -85
}
},
"uuid": 1645464648
}

View File

@@ -236,6 +236,13 @@ listboards() {
jq < ${result_file}
}
boardsforvenue() {
curl ${FLAGS} -X GET "https://${OWANALYTICS}/api/v1/boards?forVenue=$1" \
-H "accept: application/json" \
-H "Authorization: Bearer ${token}" > ${result_file}
jq < ${result_file}
}
boarddevices() {
curl ${FLAGS} -X GET "https://${OWANALYTICS}/api/v1/board/$1/devices" \
-H "accept: application/json" \
@@ -257,6 +264,7 @@ case "$1" in
"systeminfo") login; systeminfo ; logout;;
"boarddevices") login; boarddevices $2 ; logout ;;
"deleteboard") login; deleteboard $2; logout ;;
"boardsforvenue") login; boardsforvenue $2; logout;;
*) help ;;
esac