First there is only one Yosemite Valley CG that can take longer RVs and that is North Pines. The roads in the CG are narrow and twisty with trees and boulders right along the road. I doubt you'll get a 40 foot Class A in there. Check the Reserve USA website for that CG, they have length limits for each site. There are some CG in the park outside of the Valley you should check those. I've never camped in any of those.
The big problem is that if you plan to get there before August you are out of luck barring a cancellation. They hold a lottery online six months ahead of time for sites and those go within minutes. You might have to camp outside the park which means a long drive. And I wouldn't dawdle on making reservations if you plan to go this summer. It is a very popular park.
Arctic Fox 25Y Travel Trailer
2018 RAM 2500 6.7L 4WD shortbed
Straightline dual cam hitch
400W Solar with Victron controller
Superbumper