towerops/test/towerops_web/controllers/debug_controller_test.exs
Graham McIntire aa9ed52bff
feat: add critical network switch sensor support (HP Comware, Dell PowerConnect, Dell SONiC)
Implemented top 3 critical network switch sensor gaps identified in Phase 3 analysis.
Restores fundamental temperature monitoring for common enterprise switch platforms.

Files Changed:
- priv/profiles/os_discovery/comware.yaml (enhanced)
  Added HP Comware chassis temperature monitoring via HH3C-ENTITY-EXT-MIB
  OID: 1.3.6.1.4.1.25506.2.6.1.1.1.1.12 (hh3cEntityExtTemperature)
  Uses entPhysicalName for sensor descriptions
  Gap: CRITICAL (broke fundamental monitoring) → RESOLVED
  Parity: 40% → 60%

- priv/profiles/os_discovery/powerconnect.yaml (enhanced)
  Added Dell PowerConnect/DNOS CPU temperature monitoring
  OID: 1.3.6.1.4.1.674.10895.5000.2.6132.1.1.43.1.8.1.5
  MIB: FASTPATH-BOXSERVICES-PRIVATE-MIB
  Gap: CRITICAL (no sensors) → RESOLVED
  Parity: 0% → 80%

- priv/profiles/os_discovery/dell-sonic.yaml (new)
  Created comprehensive Dell SONiC sensor profile
  MIB: NETGEAR-BOXSERVICES-PRIVATE-MIB (Quanta-based)
  Sensors:
    - Temperature: boxServicesTempSensorState (OID .1.3.6.1.4.1.4413.1.1.43.1.8.1.4)
    - Fan Speed: boxServicesFanSpeed (OID .1.3.6.1.4.1.4413.1.1.43.1.6.1.4)
    - PSU State: boxServicesPowSupplyItemState (OID .1.3.6.1.4.1.4413.1.1.43.1.7.1.3)
      States: other, notpresent, operational, failed, powering, nopower,
              notpowering, incompatible
  Gap: CRITICAL (OS detected, no sensors) → RESOLVED
  Parity: 0% → 95%

- test/towerops_web/plugs/brute_force_protection_test.exs (fixed)
  Fixed Credo warning: replaced length/1 with empty list comparison

- CHANGELOG.txt (updated)
  Documented Phase 3 analysis completion and critical fix implementation

Impact:
- HP Comware: Enables overheating alerts (fundamental monitoring restored)
- Dell PowerConnect: First sensor support for common access switches
- Dell SONiC: Complete hardware monitoring for modern data center platform

Business Value:
- Resolves production blockers for customers with HP Comware switches
- Adds support for very common Dell enterprise access switches
- Enables monitoring for Dell's modern SONiC-based data center switches

Next Steps: Remaining Tier 1 switches (Dell Force10 FTOS), then Tier 2
(optical transceiver monitoring for ProCurve/Comware).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-11 17:36:45 -06:00

52 lines
1.4 KiB
Elixir

defmodule ToweropsWeb.DebugControllerTest do
use ToweropsWeb.ConnCase, async: true
import Towerops.AccountsFixtures
import Towerops.OrganizationsFixtures
describe "GET /admin/headers" do
test "returns headers JSON for superuser", %{conn: conn} do
superuser =
user_fixture()
|> Ecto.Changeset.change(%{is_superuser: true})
|> Towerops.Repo.update!()
_org = organization_fixture(superuser.id)
conn =
conn
|> log_in_user(superuser)
|> get(~p"/admin/headers")
response = json_response(conn, 200)
assert Map.has_key?(response, "headers")
assert Map.has_key?(response, "remote_ip")
assert Map.has_key?(response, "request_path")
assert Map.has_key?(response, "method")
assert is_map(response["headers"])
assert is_binary(response["remote_ip"])
assert response["request_path"] == "/admin/headers"
assert response["method"] == "GET"
end
test "non-superuser is redirected", %{conn: conn} do
user = user_fixture()
_org = organization_fixture(user.id)
conn =
conn
|> log_in_user(user)
|> get(~p"/admin/headers")
assert redirected_to(conn) == ~p"/orgs"
end
test "unauthenticated user is redirected to login", %{conn: conn} do
conn = get(conn, ~p"/admin/headers")
assert redirected_to(conn) == ~p"/users/log-in"
end
end
end