'Test handler calls into trunk manager for adding subports.'

@mock.patch('neutron.agent.common.ovs_lib.OVSBridge')
def test_handle_subports_created(self, br):

    def fake_update_subport_bindings(context, subports):
        return {self.trunk_id: [{'id': subport.port_id, 'mac_address': ('mac%d' % subport.segmentation_id)} for subport in subports]}
    trunk_rpc = self.skeleton.ovsdb_handler.trunk_rpc
    trunk_rpc.update_subport_bindings.side_effect = fake_update_subport_bindings
    self.skeleton.handle_subports(mock.Mock(), 'SUBPORTS', self.subports, events.CREATED)
    expected_calls = [mock.call(subport.trunk_id, subport.port_id, mock.ANY, subport.segmentation_id) for subport in self.subports]
    self.trunk_manager.add_sub_port.assert_has_calls(expected_calls)
