A number of merits could be brought by network function virtualization (NFV) such as scalability, on demand allocation of resources, and the efficient utilization of network resources. In this paper, we introduce a framework for designing an energy efficient architecture for 5G mobile network function virtualization. In the proposed architecture, the main functionalities of the mobile core network which include the packet gateway (P-GW), serving gateway (S-GW), mobility management entity (MME), policy control and charging role function, and the home subscriber server (HSS) functions are virtualized and provisioned on demand. We also virtualize the functions of the base band unit (BBU) of the evolved node B (eNB) and offload them from the mobile radio side. We leverage the capabilities of gigabit passive optical networks (GPON) as the radio access technology to connect the remote radio head (RRH) to new virtualized BBUs. We consider the IP/WDM backbone network and the GPON based access network as the hosts of virtual machines (VMs) where network functions will be implemented. Two cases were investigated; in the first case, we considered virtualization in the IP/WDM network only (since the core network is typically the location that supports virtualization) and in the second case we considered virtualization in both the IP/WDM and GPON access network. Our results indicate that we can achieve energy savings of 22% on average with virtualization in both the IP/WDM network and GPON access network compared to the case where virtualization is only done in the IP/WDM network.