As the Internet traffic grows, the energy efficiency gains more attention as a design factor for the planning and operation of telecommunication networks. This paper is devoted to the study of energy efficiency in optical transport networks, comparing the performance of an innovative flexible-grid network based on Orthogonal Frequency Division Multiplexing (OFDM) with that of conventional fixed-grid Wavelength Division Multiplexing (WDM) networks with a Single Line Rate (SLR) and with a Mixed Line Rate (MLR) operation. The power consumption values of the network elements are introduced. Energy-aware heuristic algorithms are proposed for the resource allocation both in static (offline) and dynamic (online) scenarios with time-varying demands for the Elastic-bandwidth OFDM-based network and the WDM networks (with SLR and MLR). The energy efficiency performance of the two network technologies under different traffic load conditions have been demonstrated for different network sizes through simulations based on the proposed algorithms. The results in energy efficiency and network blocking highlight the benefits of the bandwidth elasticity and the flexibility of selecting different modulation formats offered by OFDM networks.