Gitiles
Code Review
Sign In
gerrit.openbmc.org
/
openbmc
/
openbmc-test-automation
/
2e56ad9b2c6c5f92cbdd549263fa93e94ee9e5f2
/
.
/
lib
/
pythonutil.py
blob: 3fd6ffb1804f7d31c3e9eb7d601100192e0eee94 [
file
] [
log
] [
blame
]
from
socket
import
inet_ntoa
from
struct
import
pack
def
calcDottedNetmask
(
mask
):
bits
=
0
for
i
in
xrange
(
32
-
mask
,
32
):
bits
|=
(
1
<<
i
)
packed_value
=
pack
(
'!I'
,
bits
)
addr
=
inet_ntoa
(
packed_value
)
return
addr