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