Skip to content

Commit

Permalink
fix POE Port Status and add more page lookups for the debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
nitram509 committed Apr 24, 2024
1 parent 90736cf commit 464d30e
Show file tree
Hide file tree
Showing 11 changed files with 2,681 additions and 627 deletions.
2 changes: 2 additions & 0 deletions debug_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ func printDebugLoggedIn(args *GlobalOptions, model NetgearModel, host string) {
fmt.Sprintf("http://%s/iss/specific/poe.html", host),
fmt.Sprintf("http://%s/iss/specific/poePortConf.html", host),
fmt.Sprintf("http://%s/iss/specific/poePortStatus.html", host),
fmt.Sprintf("http://%s/iss/specific/poePortStatus.html?GetData=TRUE", host),
fmt.Sprintf("http://%s/iss/specific/getPortRate.html", host),
fmt.Sprintf("http://%s/iss/specific/dashboard.html", host),
fmt.Sprintf("http://%s/iss/specific/homepage.html", host),
)
Expand Down
7 changes: 6 additions & 1 deletion http.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ func doHttpRequestAndReadResponse(args *GlobalOptions, httpMethod string, host s
}

if isModel316(model) {
requestUrl = requestUrl + "?Gambit=" + token
if strings.Contains(requestUrl, "?") {
splits := strings.Split(requestUrl, "?")
requestUrl = splits[0] + "?Gambit=" + token + "&" + splits[1]
} else {
requestUrl = requestUrl + "?Gambit=" + token
}
}

req, err := http.NewRequest(httpMethod, requestUrl, strings.NewReader(requestBody))
Expand Down
2 changes: 1 addition & 1 deletion poe_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func requestPoePortStatusPage(args *GlobalOptions, host string) (string, error)
return requestPage(args, host, url)
}
if isModel316(model) {
url := fmt.Sprintf("http://%s/iss/specific/poe.html", host)
url := fmt.Sprintf("http://%s/iss/specific/poePortStatus.html?GetData=TRUE", host)
return requestPage(args, host, url)
}
panic("model not supported")
Expand Down
2 changes: 1 addition & 1 deletion poe_status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestFindPortStatusInHtml(t *testing.T) {
},
{
model: "GS316EP",
fileName: "poePortStatus.html",
fileName: "poePortStatus_GetData_true.html",
expectedNumberOfStatuses: 15,
expectedPoePowerClass: "3",
expectedPoePortStatus: "Delivering Power",
Expand Down
6 changes: 3 additions & 3 deletions port_settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ func TestFindPortSettingsInHtml(t *testing.T) {
expectedSettingsLength: 16,
expectedIndex: 1,
expectedName: "port name 1",
expectedSpeed: "1",
expectedIngressRateLimit: "1",
expectedEgressRateLimit: "1",
expectedSpeed: "Auto",
expectedIngressRateLimit: "No Limit",
expectedEgressRateLimit: "No Limit",
expectedFlowControl: "OFF",
},
}
Expand Down
Loading

0 comments on commit 464d30e

Please sign in to comment.