diff --git a/src/DIRAC/Core/Utilities/Network.py b/src/DIRAC/Core/Utilities/Network.py index 0c5e81078aa..2e93aa572b4 100755 --- a/src/DIRAC/Core/Utilities/Network.py +++ b/src/DIRAC/Core/Utilities/Network.py @@ -6,19 +6,9 @@ import os from urllib import parse -import psutil - from DIRAC.Core.Utilities.ReturnValues import S_OK, S_ERROR -def discoverInterfaces(): - interfaces = {k: {a.family: a.address for a in v} for k, v in psutil.net_if_addrs().items()} - return { - k: {"ip": v.get(socket.AF_INET, "0.0.0.0"), "mac": v.get(psutil.AF_LINK, "00:00:00:00:00:00")} - for k, v in interfaces.items() - } - - def getFQDN(): sFQDN = socket.getfqdn() if sFQDN.find("localhost") > -1: diff --git a/src/DIRAC/Core/Utilities/test/Test_Network.py b/src/DIRAC/Core/Utilities/test/Test_Network.py index 9e7990f3091..c43b0726d17 100644 --- a/src/DIRAC/Core/Utilities/test/Test_Network.py +++ b/src/DIRAC/Core/Utilities/test/Test_Network.py @@ -2,17 +2,7 @@ """ import pytest -from DIRAC.Core.Utilities.Network import discoverInterfaces, getFQDN, getIPsForHostName, checkHostsMatch - - -def test_discoverInterfaces(): - interfaces = discoverInterfaces() - assert len(interfaces) >= 1 - assert "lo" in interfaces or "lo0" in interfaces - assert interfaces.get("lo", interfaces.get("lo0"))["ip"].startswith("127") - for interfaceInfo in interfaces.values(): - assert "ip" in interfaceInfo - assert "mac" in interfaceInfo +from DIRAC.Core.Utilities.Network import getFQDN, getIPsForHostName, checkHostsMatch def test_getFQDN():