Gitiles
Code Review
Sign In
gerrit.openbmc.org
/
openbmc
/
openbmc-test-automation
/
bffaa1d576c62054e2606be69e80a9a033eebd0c
/
.
/
lib
/
pythonutil.py
blob: dd23168a87ee7c903f4b6427faca3ff35995fbd6 [
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