I'll take a small exception to @JamesK's answer about what NASA does and doesn't do. The Jet Propulsion Laboratory is part of NASA and one of the many invaluable contributions they've made to spaceflight are JPL's development ephemerides.
Have a look at the most recent release in The JPL Planetary and Lunar Ephemerides DE440 and DE441. What's done here is a gathering of all possible data, both from NASA and other space agency spacecraft and NASA and other observations, including those with telescopes, some of which were built for NASA and some not, and laser ranging of the Moon and radar ranging of other celestial bodies like planets and asteroids, again some with NASA radars and some with other radars.
See for example:
- Observational Data Used for Computing DE440 and
The observations that have been used to compute DE440 and
DE441 are summarized in Tables 3–5 for each body.
Especially in Table 3 you can see many deep space spacecraft. When they perform flybys of planets and asteroids their precise positions and speeds are closely monitored by delay-doppler measurements using their on-board coherent transponders; Earth sends a signal with an encoded Gold code (analogous to what's in a GPS signal) and the spacecraft picks it up, amplifies it and broadcasts the same signal right back to Earth. By mathematically correlating the outgoing and returning signal they can measure the distances to the spacecraft to accuracies of tens of meters over hundreds of millions of kilometers, and speeds to accuracies of millimeters per second. One of the main uncertainties is actually the effects of the signal passing twice through Earth's atmosphere due to interaction with water and electrons in the ionosphere.
Then they run lots and lots of simulations to fit all of this data, extracting very accurate standard gravitational parameters (i.e. the mass of an object times the gravitational constant $G$ since it's really hard to measure one and not the other) as well as most accurate and predictive models of the orbits and trajectories of as many solar system bodies as possible.
We have to remember that gravity has a practically infinite reach, so everything affects everything. What that means includes:
- you need a very good computer program and lots and lots of data to get a handle on what's happening
- in reality there are no exact periods, the semimajor axis of an orbit isn't even constant over one orbit, and no orbit is really exactly Keplerian to begin with.
Keplerian orbits are great starting points for understanding solar system motion, but they are not "right". Yes, NASA does provide periods in their planetary fact sheets and these are pretty close, but if you really want to know accurately where an object will be, you need a detailed ephemeris computed in this way, using all available data.
As far as masses or standard gravitational parameters are concerned, these come from several main sources.
For planets, they originally came from historical observations of satellite positions over time. Since the satellites are so much less massive than the planets they orbit (unlike our system) their positions and periods can be used to calculate the standard gravitational parameters.
Once astronomers learned to model the effects of the planet's perturbations on each other, they could further refine this.
Interestingly, the masses of some asteroids were determined by their tiny perturbations on each others' orbits!
But the big breakthrough came when there started to be spacecraft flybys of planets as mentioned above and in table 3 of the linked JPL paper.