Any communication between the testbench and DUT should be through a driver/monitor. Your driver can connect to an interface or module, which has the UPF functions embedded in it. See my DVCon paper: Updated Example Code from DVCon Paper: The Missing Link: The Testbench to DUT Connection