'Set trunk metadata in OVS port for trunk parent port.'

def _set_trunk_metadata(self, trunk_bridge, port, trunk_id, subport_ids):

    trunk_bridge = (trunk_bridge or ovs_lib.OVSBridge(utils.gen_trunk_br_name(trunk_id)))
    port = (port or self._get_parent_port(trunk_bridge))
    port['external_ids']['bridge_name'] = trunk_bridge.br_name
    port['external_ids']['trunk_id'] = trunk_id
    port['external_ids']['subport_ids'] = jsonutils.dumps(subport_ids)
    trunk_bridge.set_db_attribute('Interface', port['name'], 'external_ids', port['external_ids'])
