Move the port inspector onto device pages
Lint / JS (eslint) (push) Successful in 1m14s
Lint / Python (flake8) (push) Successful in 2m12s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Security / Python Security (bandit) (push) Successful in 1m3s
Test / Python Tests (pytest) (push) Successful in 1m11s
Lint / Python (flake8) (pull_request) Successful in 1m1s
Lint / JS (eslint) (pull_request) Successful in 10s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Security / Python Security (bandit) (pull_request) Successful in 56s
Test / Python Tests (pytest) (pull_request) Successful in 1m5s
Lint / JS (eslint) (push) Successful in 1m14s
Lint / Python (flake8) (push) Successful in 2m12s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Security / Python Security (bandit) (push) Successful in 1m3s
Test / Python Tests (pytest) (push) Successful in 1m11s
Lint / Python (flake8) (pull_request) Successful in 1m1s
Lint / JS (eslint) (pull_request) Successful in 10s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Security / Python Security (bandit) (pull_request) Successful in 56s
Test / Python Tests (pytest) (pull_request) Successful in 1m5s
Replace the all-switches Inspector page with a per-device front panel, port table and detail panel. /inspector now redirects to the dashboard, and /device/<name>#port-<n> links directly to a port. Restore neighbor names after UniFi's LLDP change: read local_port_idx and resolve neighbors by MAC using Prometheus NIC data, UniFi devices and the wired client table. This also brings back Run Diagnostics on server ports, which depends on a named neighbor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+32
-1
@@ -58,7 +58,19 @@ class TestPagesAndNav:
|
||||
html = client.get('/device/%3Cscript%3Ex', headers=AUTH).get_data(as_text=True)
|
||||
assert '<script>x' not in html
|
||||
|
||||
def test_link_data_api_remains_for_inspector(self, client):
|
||||
def test_old_inspector_url_redirects_home(self, client):
|
||||
resp = client.get('/inspector', headers=AUTH)
|
||||
assert resp.status_code == 302 and resp.headers['Location'].endswith('/')
|
||||
|
||||
def test_nav_has_no_inspector_link(self, client):
|
||||
assert '>Inspector<' not in client.get('/', headers=AUTH).get_data(as_text=True)
|
||||
assert 'Inspector' not in client.get('/device/large1', headers=AUTH).get_data(as_text=True).split('</nav>')[0]
|
||||
|
||||
def test_device_page_loads_the_port_inspector(self, client):
|
||||
html = client.get('/device/large1', headers=AUTH).get_data(as_text=True)
|
||||
assert 'port-inspector.js' in html and 'id="inspector-panel"' in html
|
||||
|
||||
def test_link_data_api_remains(self, client):
|
||||
assert client.get('/api/links', headers=AUTH).status_code == 200
|
||||
|
||||
|
||||
@@ -91,3 +103,22 @@ class TestDatabaseTimeZone:
|
||||
with patch.object(real_db.pymysql, 'connect') as connect:
|
||||
real_db._new_conn({'host': 'h', 'user': 'u', 'password': 'p', 'name': 'n'})
|
||||
assert connect.call_args.kwargs['init_command'] == "SET time_zone='+00:00'"
|
||||
|
||||
|
||||
class TestDiagnoseWithResolvedNeighbor:
|
||||
LINKS = json.dumps({
|
||||
'hosts': {'large1': {'enp35s0': {'host_ip': '10.0.0.2'}}},
|
||||
'unifi_switches': {'sw': {'ports': {'Port 4': {
|
||||
'port_idx': 4, 'up': True,
|
||||
'lldp': {'system_name': 'large1', 'port_id': 'enp35s0', 'chassis_id': 'aa:bb:cc:dd:ee:ff'},
|
||||
}}}},
|
||||
})
|
||||
|
||||
def test_port_with_a_named_neighbor_starts_a_job(self, client):
|
||||
STATE['link_stats'], saved = self.LINKS, STATE['link_stats']
|
||||
try:
|
||||
with patch.object(gandalf.threading, 'Thread'):
|
||||
resp = client.post('/api/diagnose', json={'switch_name': 'sw', 'port_idx': 4}, headers=AUTH)
|
||||
finally:
|
||||
STATE['link_stats'] = saved
|
||||
assert resp.status_code == 200 and resp.get_json()['job_id']
|
||||
|
||||
Reference in New Issue
Block a user