Last time I had to configured OSPF was a long time ago, but I just did some quick research to answer you about this.
So, first thing, to use OSPF in a F5 devices, you need to have Advanced Routing:
https://support.f5.com/csp/article/K14490
That will then use internally a system called ZebOS, that basically uses similar commands as Cisco device.
You enter a special shell for that, and from there is just similar Cisco CLI.
In each route domain you create in the F5, you need to enable OSPF for that route domain.
The part I had to research, was how to link OSPF to VRF, as I wasn't sure if was supported.
However, looks to be as the documentation talks about that.
https://support.f5.com/content/kb/en-us/products/big-ip_ltm/manuals/related/ospf-commandreference-7-8-1/_jcr_content/pdfAttach/download/file.res/ospf-commandreference-7-8-1.pdf
"
router ospf vrf
Use this command to specify a VRF instance in OSPF. To use this command, you must first create a VRF Name in the
NSM using the
ip vrf
command. Associate the same name with the OSPF instance using this command. "
Interesting the latest version of this document does not document this commands, but I dont think that means that this functionality was removed.
https://support.f5.com/content/kb/en-us/products/big-ip_ltm/manuals/related/arm-ospf-command-reference-7-10-6/_jcr_content/pdfAttach/download/file.res/arm-ospf-command-reference-7-10-6.pdf