filling and draining at the touch of a button

there are multiple types of flow sensors.
a weir tube measures the height if the fluid in the tube, based on time of flight, you can calculate or monitor the flow rate.
you can have a set volume fill, then dump. that is a one way device. maybe (think h-bridge to alter destination)
like fill a five gallon bucket, then drain it. tipping bucket rain gauge ??? monster style.

since water is non-compressible, the density will not change under pressure. an orifice at pressure will pass a known quantity. so you could control the pressure discharge of the pump through and orifice and calculate time to determine quantity.

you could use a positive displacement pump, much harder than some of the options, but might be a deal on e-bay.

as for the possible flow sensor, you can use a flow sensor on the pump, then alter the source and the discharge. (With all the H-bridges we do to control electrons, a couple valves to control water have been mentioned earlier. : )

I think the big questions are if you have a huge budget and how long you want this to take.
a garden hose sensor with diverter valves (h-bridge) would be pretty simple and pretty accurate, but could take a long time.

a fire hose sized valve/sensor would be pretty costly !