  Open Radio Access Network (RAN) architectures will enable interoperability,
openness and programmable data-driven control in next generation cellular
networks. However, developing and testing efficient solutions that generalize
across heterogeneous cellular deployments and scales, and that optimize network
performance in such diverse environments is a complex task that is still
largely unexplored. In this paper we present OpenRAN Gym, a unified, open, and
O-RAN-compliant experimental toolbox for data collection, design, prototyping
and testing of end-to-end data-driven control solutions for next generation
Open RAN systems. OpenRAN Gym extends and combines into a unique solution
several software frameworks for data collection of RAN statistics and RAN
control, and a lightweight O-RAN near-real-time RAN Intelligent Controller
(RIC) tailored to run on experimental wireless platforms. We first provide an
overview of the various architectural components of OpenRAN Gym and describe
how it is used to collect data and design, train and test artificial
intelligence and machine learning O-RAN-compliant applications (xApps) at
scale. We then describe in detail how to test the developed xApps on
softwarized RANs and provide an example of two xApps developed with OpenRAN Gym
that are used to control a network with 7 base stations and 42 users deployed
on the Colosseum testbed. Finally, we show how solutions developed with OpenRAN
Gym on Colosseum can be exported to real-world, heterogeneous wireless
platforms, such as the Arena testbed and the POWDER and COSMOS platforms of the
PAWR program. OpenRAN Gym and its software components are open-source and
publicly-available to the research community. By guiding the readers through
running experiments with OpenRAN Gym, we aim at providing a key reference for
researchers and practitioners working on experimental Open RAN systems.
