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