- bridge_id = bridge_id_cache
- if bridge_id is None:
- bridge_id = row.external_ids.get("xs-network-uuids")
- if bridge_id and len(bridge_id.split(";")) > 1:
- bridge_ids = bridge_id.split(";")
- bridge_id = get_single_bridge_id(bridge_ids, row.name, "")
- if bridge_id:
- bridge_id_cache = bridge_id
+ # Get the correct bridge_id, if we can.
+ bridge_id = get_bridge_id(row.name)
+ if bridge_id is None:
+ xs_network_uuids = row.external_ids.get("xs-network-uuids")
+ if xs_network_uuids:
+ bridge_ids = xs_network_uuids.split(";")
+ if len(bridge_ids) == 1:
+ bridge_id = bridge_ids[0]
+ else:
+ bridge_id = get_single_bridge_id(bridge_ids,
+ row.name)
+ set_external_id(row, "bridge-id", bridge_id)