def parse_data_port_mappings(mappings, default_bridge='br-data'):
    """Parse data port mappings.

    Mappings must be a space-delimited list of bridge:port.

    Returns dict of the form {port:bridge} where ports may be mac addresses or
    interface names.
    """

    # NOTE(dosaboy): we use rvalue for key to allow multiple values to be
    # proposed for <port> since it may be a mac address which will differ
    # across units this allowing first-known-good to be chosen.
    _mappings = parse_mappings(mappings, key_rvalue=True)
    if not _mappings or list(_mappings.values()) == ['']:
        if not mappings:
            return {}

        # For backwards-compatibility we need to support port-only provided in
        # config.
        _mappings = {mappings.split()[0]: default_bridge}

    ports = _mappings.keys()
    if len(set(ports)) != len(ports):
        raise Exception("It is not allowed to have the same port configured "
                        "on more than one bridge")

    return _mappings
def parse_data_port_mappings ( mappings , default_bridge = 'br-data' ) : _mappings = parse_mappings ( mappings , key_rvalue = True ) if not _mappings or list ( _mappings . values ( ) ) == [ '' ] : if not mappings : return { } _mappings = { mappings . split ( ) [ 0 ] : default_bridge } ports = _mappings . keys ( ) if len ( set ( ports ) ) != len ( ports ) : raise Exception ( "It is not allowed to have the same port configured " "on more than one bridge" ) return _mappings
Parse data port mappings.

    Mappings must be a space-delimited list of bridge:port.

    Returns dict of the form {port:bridge} where ports may be mac addresses or
    interface names.