UE based: will require the UE to measure and report NR-CGI by reading SIB1 of NR cell. If your network runs on NSA/SA dual mode, SIB1 will be there. UE needs to support this measurement by sharing reportCGI-NR-NoEN-DC-r15 and/or reportCGI-NR-EN-DC-r15. Once the UE reports the unknown PCI the eNodeB can ask 5GC/EPC for details about the target NR cell in order to create the X2/Xn, or ask OSS for its own database to obtain the information.
OSS based: requires no extra measurements from the UE. By regular measurement reports for regular mobility, if a unknown PCI is reported, the eNodeB will query the OSS for details about the target NR cell in order to create the X2/Xn.
Where I work, we did a manual creation of the initial list (based on cell refs, distance criteria, etc…) and then activated ANR UE Based on top of it.