Unlike bgp (for inter-AS routing), ospf is an IGP (Interior Gateway Protocol) for routing inside a single AS. All routers inside one OSPF area discover each other automatically through multicast hello packets, exchange Link-State Advertisements, and build a full map of the topology.
The topology is linear: r1 ── 10.1.12.0/24 ── r2 ── 10.1.23.0/24 ── r3.
All three are in area 0. After configuration, r1 learns how to reach
r3 without adding routes by hand.