Optical networks are commonly adopted to implement the fronthaul of Cloud-RAN (CRAN) and Hybrid-CRAN (H-CRAN) architectures to support the 5G traffic. The Cloud-Fog RAN (CF-RAN) architecture promotes cloud and local fog processing of baseband signals with the novelty of activating on demand processing capabilities under the Fog Computing and Network Functions Virtualization (NFV) paradigms. Timeand-Wavelength-Division-Multiplexed Passive Optical Networks (TWDM-PON) are used to implement the fronthaul due to the capacity of Virtual-PON (VPON) formation, which can reduce power consumption by allocating as many Remote Radio Heads (RRH) as possible into a single optical channel. However, the TWDM-PON wavelengths must be assigned to the VPONs in an exclusive manner so different VPONs do not share a common wavelength and thus VPONs do not collide on the optical links. In this paper we propose an Energy-Efficient VPON Formation and Wavelength Dimensioning formulation through Integer Linear Programming (ILP) to efficiently form VPONs and dimension the wavelengths so collisions never occurs. Results from the experiments show that the ILP formulation was able to form VPONs and dimension the wavelengths to the network nodes on the most energy-efficient way, achieving gains in the order of 80.27% in comparison to a random VPON formation approach.