| Total Complexity | 2 |
| Total Lines | 15 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | """Utils module.""" |
||
| 2 | |||
| 3 | 1 | from .settings import COOKIE_PREFIX |
|
| 4 | |||
| 5 | |||
| 6 | 1 | def int_dpid(dpid): |
|
| 7 | """Convert a str dpid to an int.""" |
||
| 8 | 1 | dpid = int(dpid.replace(":", ""), 16) |
|
| 9 | 1 | return dpid |
|
| 10 | |||
| 11 | |||
| 12 | 1 | def get_cookie(dpid): |
|
| 13 | """Return the cookie integer given a dpid.""" |
||
| 14 | return (0x0000FFFFFFFFFFFF & int(int_dpid(dpid))) | (COOKIE_PREFIX << 56) |
||
| 15 |