diff --git a/front/plugins/__template/config.json b/front/plugins/__template/config.json index dde5a747..f34dd6be 100755 --- a/front/plugins/__template/config.json +++ b/front/plugins/__template/config.json @@ -380,7 +380,11 @@ "default_value": [], "options": [ "devMac", - "devLastIP" + "devLastIP", + "devName", + "devVendor", + "devType", + "devSourcePlugin" ], "localized": ["name", "description"], "name": [ diff --git a/front/plugins/adguard_import/config.json b/front/plugins/adguard_import/config.json index a9f60663..3c03986c 100644 --- a/front/plugins/adguard_import/config.json +++ b/front/plugins/adguard_import/config.json @@ -354,7 +354,10 @@ "default_value": [], "options": [ "devMac", - "devLastIP" + "devLastIP", + "devName", + "devType", + "devSourcePlugin" ], "localized": ["name", "description"], "name": [ diff --git a/front/plugins/arp_scan/config.json b/front/plugins/arp_scan/config.json index f0f8e4d2..ec00d4b0 100755 --- a/front/plugins/arp_scan/config.json +++ b/front/plugins/arp_scan/config.json @@ -313,7 +313,9 @@ "default_value": [], "options": [ "devMac", - "devLastIP" + "devLastIP", + "devVendor", + "devSourcePlugin" ], "localized": ["name", "description"], "name": [ diff --git a/front/plugins/asuswrt_import/config.json b/front/plugins/asuswrt_import/config.json index c4d54a83..cf4be151 100755 --- a/front/plugins/asuswrt_import/config.json +++ b/front/plugins/asuswrt_import/config.json @@ -174,7 +174,10 @@ "default_value": [], "options": [ "devMac", - "devLastIP" + "devLastIP", + "devName", + "devVendor", + "devSourcePlugin" ], "localized": ["name", "description"], "name": [ diff --git a/front/plugins/dhcp_leases/config.json b/front/plugins/dhcp_leases/config.json index 8fe9bd86..378b91b1 100755 --- a/front/plugins/dhcp_leases/config.json +++ b/front/plugins/dhcp_leases/config.json @@ -728,7 +728,9 @@ "default_value": [], "options": [ "devMac", - "devLastIP" + "devLastIP", + "devName", + "devSourcePlugin" ], "localized": ["name", "description"], "name": [ diff --git a/front/plugins/freebox/config.json b/front/plugins/freebox/config.json index 2252fcfe..037c88fa 100755 --- a/front/plugins/freebox/config.json +++ b/front/plugins/freebox/config.json @@ -350,7 +350,11 @@ "default_value": [], "options": [ "devMac", - "devLastIP" + "devLastIP", + "devName", + "devVendor", + "devType", + "devSourcePlugin" ], "localized": ["name", "description"], "name": [ diff --git a/front/plugins/icmp_scan/config.json b/front/plugins/icmp_scan/config.json index fd400adc..27a5473b 100755 --- a/front/plugins/icmp_scan/config.json +++ b/front/plugins/icmp_scan/config.json @@ -343,7 +343,9 @@ "default_value": [], "options": [ "devMac", - "devLastIP" + "devLastIP", + "devName", + "devSourcePlugin" ], "localized": ["name", "description"], "name": [ diff --git a/front/plugins/internet_ip/config.json b/front/plugins/internet_ip/config.json index dc2a988d..43d260d3 100755 --- a/front/plugins/internet_ip/config.json +++ b/front/plugins/internet_ip/config.json @@ -457,7 +457,9 @@ "default_value": [], "options": [ "devMac", - "devLastIP" + "devLastIP", + "devType", + "devSourcePlugin" ], "localized": ["name", "description"], "name": [ diff --git a/front/plugins/ipneigh/config.json b/front/plugins/ipneigh/config.json index c80046c4..1bd3d1cc 100755 --- a/front/plugins/ipneigh/config.json +++ b/front/plugins/ipneigh/config.json @@ -177,7 +177,11 @@ "default_value": [], "options": [ "devMac", - "devLastIP" + "devLastIP", + "devName", + "devVendor", + "devType", + "devSourcePlugin" ], "localized": ["name", "description"], "name": [ diff --git a/front/plugins/luci_import/config.json b/front/plugins/luci_import/config.json index 8bb19489..9225d696 100755 --- a/front/plugins/luci_import/config.json +++ b/front/plugins/luci_import/config.json @@ -430,7 +430,8 @@ "default_value": [], "options": [ "devMac", - "devLastIP" + "devLastIP", + "devSourcePlugin" ], "localized": ["name", "description"], "name": [ diff --git a/front/plugins/mikrotik_scan/config.json b/front/plugins/mikrotik_scan/config.json index c6964077..8cc0bf30 100755 --- a/front/plugins/mikrotik_scan/config.json +++ b/front/plugins/mikrotik_scan/config.json @@ -314,7 +314,9 @@ "default_value": [], "options": [ "devMac", - "devLastIP" + "devLastIP", + "devName", + "devSourcePlugin" ], "localized": ["name", "description"], "name": [ diff --git a/front/plugins/nmap_dev_scan/config.json b/front/plugins/nmap_dev_scan/config.json index 2f6c69f3..841e7d3a 100755 --- a/front/plugins/nmap_dev_scan/config.json +++ b/front/plugins/nmap_dev_scan/config.json @@ -498,7 +498,10 @@ "default_value": [], "options": [ "devMac", - "devLastIP" + "devLastIP", + "devName", + "devVendor", + "devSourcePlugin" ], "localized": ["name", "description"], "name": [ diff --git a/front/plugins/omada_sdn_imp/config.json b/front/plugins/omada_sdn_imp/config.json index 845cd4ed..fd920466 100755 --- a/front/plugins/omada_sdn_imp/config.json +++ b/front/plugins/omada_sdn_imp/config.json @@ -514,7 +514,12 @@ "default_value": [], "options": [ "devMac", - "devLastIP" + "devLastIP", + "devName", + "devParentMAC", + "devSSID", + "devType", + "devSourcePlugin" ], "localized": ["name", "description"], "name": [ diff --git a/front/plugins/omada_sdn_openapi/config.json b/front/plugins/omada_sdn_openapi/config.json index 5dd193d5..9951f117 100755 --- a/front/plugins/omada_sdn_openapi/config.json +++ b/front/plugins/omada_sdn_openapi/config.json @@ -487,7 +487,13 @@ "default_value": [], "options": [ "devMac", - "devLastIP" + "devLastIP", + "devName", + "devParentMAC", + "devSSID", + "devType", + "devSourcePlugin", + "devSite" ], "localized": ["name", "description"], "name": [ diff --git a/front/plugins/pihole_api_scan/config.json b/front/plugins/pihole_api_scan/config.json index 3b449c0a..ef6520ac 100644 --- a/front/plugins/pihole_api_scan/config.json +++ b/front/plugins/pihole_api_scan/config.json @@ -164,7 +164,8 @@ "devName", "devLastIP", "devVendor", - "devFQDN" + "devMac", + "devSourcePlugin" ], "localized": ["name", "description"], "name": [ diff --git a/front/plugins/pihole_scan/config.json b/front/plugins/pihole_scan/config.json index a72f7113..ef8fcf26 100755 --- a/front/plugins/pihole_scan/config.json +++ b/front/plugins/pihole_scan/config.json @@ -230,7 +230,11 @@ }, "default_value": [], "options": [ - "devLastIP" + "devMac", + "devLastIP", + "devName", + "devVendor", + "devSourcePlugin" ], "localized": ["name", "description"], "name": [ diff --git a/front/plugins/snmp_discovery/config.json b/front/plugins/snmp_discovery/config.json index f3f5ea84..0143b85c 100755 --- a/front/plugins/snmp_discovery/config.json +++ b/front/plugins/snmp_discovery/config.json @@ -632,7 +632,9 @@ "default_value": [], "options": [ "devMac", - "devLastIP" + "devLastIP", + "devName", + "devSourcePlugin" ], "localized": ["name", "description"], "name": [ diff --git a/front/plugins/sync/config.json b/front/plugins/sync/config.json index 8ad40010..98258515 100755 --- a/front/plugins/sync/config.json +++ b/front/plugins/sync/config.json @@ -643,7 +643,11 @@ "default_value": [], "options": [ "devMac", - "devLastIP" + "devLastIP", + "devName", + "devVendor", + "devSyncHubNode", + "devSourcePlugin" ], "localized": ["name", "description"], "name": [ diff --git a/front/plugins/unifi_api_import/config.json b/front/plugins/unifi_api_import/config.json index 9381d60f..fbd60112 100755 --- a/front/plugins/unifi_api_import/config.json +++ b/front/plugins/unifi_api_import/config.json @@ -548,7 +548,9 @@ "devMac", "devLastIP", "devName", - "devParentMAC" + "devParentMAC", + "devType", + "devSourcePlugin" ], "localized": ["name", "description"], "name": [ diff --git a/front/plugins/unifi_import/config.json b/front/plugins/unifi_import/config.json index 897a2c33..fe9eba4d 100755 --- a/front/plugins/unifi_import/config.json +++ b/front/plugins/unifi_import/config.json @@ -972,7 +972,9 @@ "devVendor", "devSSID", "devParentMAC", - "devParentPort" + "devParentPort", + "devType", + "devSourcePlugin" ], "localized": ["name", "description"], "name": [ diff --git a/front/plugins/vendor_update/config.json b/front/plugins/vendor_update/config.json index eb156f5e..cefeb034 100755 --- a/front/plugins/vendor_update/config.json +++ b/front/plugins/vendor_update/config.json @@ -274,7 +274,9 @@ "options": [ "devMac", "devVendor", - "devName" + "devName", + "devLastIP", + "devSourcePlugin" ], "localized": ["name", "description"], "name": [ diff --git a/test/authoritative_fields/test_ip_format_and_locking.py b/test/authoritative_fields/test_ip_format_and_locking.py index ff3d26a3..3141a538 100644 --- a/test/authoritative_fields/test_ip_format_and_locking.py +++ b/test/authoritative_fields/test_ip_format_and_locking.py @@ -72,103 +72,6 @@ def ip_test_db(): conn.close() -@pytest.fixture -def new_device_db(): - """Create an in-memory SQLite database for create_new_devices tests.""" - conn = sqlite3.connect(":memory:") - conn.row_factory = sqlite3.Row - cur = conn.cursor() - - cur.execute( - """ - CREATE TABLE Devices ( - devMac TEXT PRIMARY KEY, - devName TEXT, - devVendor TEXT, - devLastIP TEXT, - devPrimaryIPv4 TEXT, - devPrimaryIPv6 TEXT, - devFirstConnection TEXT, - devLastConnection TEXT, - devSyncHubNode TEXT, - devGUID TEXT, - devParentMAC TEXT, - devParentPort TEXT, - devSite TEXT, - devSSID TEXT, - devType TEXT, - devSourcePlugin TEXT, - devAlertEvents INTEGER, - devAlertDown INTEGER, - devPresentLastScan INTEGER, - devIsArchived INTEGER, - devIsNew INTEGER, - devSkipRepeated INTEGER, - devScan INTEGER, - devOwner TEXT, - devFavorite INTEGER, - devGroup TEXT, - devComments TEXT, - devLogEvents INTEGER, - devLocation TEXT, - devCustomProps TEXT, - devParentRelType TEXT, - devReqNicsOnline INTEGER - ) - """ - ) - - cur.execute( - """ - CREATE TABLE CurrentScan ( - cur_MAC TEXT, - cur_Name TEXT, - cur_Vendor TEXT, - cur_ScanMethod TEXT, - cur_IP TEXT, - cur_SyncHubNodeName TEXT, - cur_NetworkNodeMAC TEXT, - cur_PORT TEXT, - cur_NetworkSite TEXT, - cur_SSID TEXT, - cur_Type TEXT - ) - """ - ) - - cur.execute( - """ - CREATE TABLE Events ( - eve_MAC TEXT, - eve_IP TEXT, - eve_DateTime TEXT, - eve_EventType TEXT, - eve_AdditionalInfo TEXT, - eve_PendingAlertEmail INTEGER - ) - """ - ) - - cur.execute( - """ - CREATE TABLE Sessions ( - ses_MAC TEXT, - ses_IP TEXT, - ses_EventTypeConnection TEXT, - ses_DateTimeConnection TEXT, - ses_EventTypeDisconnection TEXT, - ses_DateTimeDisconnection TEXT, - ses_StillConnected INTEGER, - ses_AdditionalInfo TEXT - ) - """ - ) - - conn.commit() - yield conn - conn.close() - - @pytest.fixture def mock_ip_handlers(): """Mock device_handling helper functions.""" @@ -408,55 +311,6 @@ def test_invalid_ip_values_rejected(ip_test_db, mock_ip_handlers): ), f"Invalid IP '{invalid_ip}' should not overwrite valid IPv4" -def test_invalid_ipv6_rejected_on_create_new_devices(new_device_db): - """Invalid IPv6 values should not be persisted when creating new devices.""" - cur = new_device_db.cursor() - - cur.execute( - """ - INSERT INTO CurrentScan ( - cur_MAC, cur_Name, cur_Vendor, cur_ScanMethod, cur_IP, - cur_SyncHubNodeName, cur_NetworkNodeMAC, cur_PORT, - cur_NetworkSite, cur_SSID, cur_Type - ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) - """, - ( - "AA:BB:CC:DD:EE:10", - "", - "Vendor", - "ARPSCAN", - "fe80::zz", - "", - "", - "", - "", - "", - "", - ), - ) - new_device_db.commit() - - db = Mock() - db.sql_connection = new_device_db - db.sql = cur - db.commitDB = Mock(side_effect=new_device_db.commit) - - with patch("helper.get_setting_value", return_value=""), patch.object( - device_handling, "get_setting_value", return_value="" - ): - device_handling.create_new_devices(db) - - row = cur.execute( - "SELECT devLastIP, devPrimaryIPv4, devPrimaryIPv6 FROM Devices WHERE devMac = ?", - ("AA:BB:CC:DD:EE:10",), - ).fetchone() - - assert row is not None, "Device should be created" - assert row["devLastIP"] == "", "Invalid IPv6 should not set devLastIP" - assert row["devPrimaryIPv4"] == "", "Invalid IPv6 should not set devPrimaryIPv4" - assert row["devPrimaryIPv6"] == "", "Invalid IPv6 should not set devPrimaryIPv6" - - def test_ipv4_ipv6_mixed_in_multiple_scans(ip_test_db, mock_ip_handlers): """Multiple scans with different IP types should set both primary fields correctly.""" cur = ip_test_db.cursor()