Skip to content

Commit 02b9bb3

Browse files
authored
Merge pull request #8601 from sfayer/rem_intfdisc
[int] Remove discoverInterfaces
2 parents 4b9d44d + d6b1b0d commit 02b9bb3

2 files changed

Lines changed: 1 addition & 21 deletions

File tree

src/DIRAC/Core/Utilities/Network.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,9 @@
66
import os
77
from urllib import parse
88

9-
import psutil
10-
119
from DIRAC.Core.Utilities.ReturnValues import S_OK, S_ERROR
1210

1311

14-
def discoverInterfaces():
15-
interfaces = {k: {a.family: a.address for a in v} for k, v in psutil.net_if_addrs().items()}
16-
return {
17-
k: {"ip": v.get(socket.AF_INET, "0.0.0.0"), "mac": v.get(psutil.AF_LINK, "00:00:00:00:00:00")}
18-
for k, v in interfaces.items()
19-
}
20-
21-
2212
def getFQDN():
2313
sFQDN = socket.getfqdn()
2414
if sFQDN.find("localhost") > -1:

src/DIRAC/Core/Utilities/test/Test_Network.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,7 @@
22
"""
33
import pytest
44

5-
from DIRAC.Core.Utilities.Network import discoverInterfaces, getFQDN, getIPsForHostName, checkHostsMatch
6-
7-
8-
def test_discoverInterfaces():
9-
interfaces = discoverInterfaces()
10-
assert len(interfaces) >= 1
11-
assert "lo" in interfaces or "lo0" in interfaces
12-
assert interfaces.get("lo", interfaces.get("lo0"))["ip"].startswith("127")
13-
for interfaceInfo in interfaces.values():
14-
assert "ip" in interfaceInfo
15-
assert "mac" in interfaceInfo
5+
from DIRAC.Core.Utilities.Network import getFQDN, getIPsForHostName, checkHostsMatch
166

177

188
def test_getFQDN():

0 commit comments

Comments
 (0)