With the growing demand for business communications, electrical signal processing optical path switching can’t meet the demand. The multi-granularity switch system that can improve node routing and switching capabilities came into being. In the traditional network, each node is responsible for calculating the path; synchronize the whole network state, which will increase the burden on the network, so the concept of path calculation element (PCE) is proposed. The PCE is responsible for routing and allocating resources in the network1. In the traditional band-switched optical network, the wavelength is used as the basic routing unit, resulting in relatively low wavelength utilization. Due to the limitation of wavelength continuity, the routing design of the band technology becomes complicated, which directly affects the utilization of the system. In this paper, optical code granularity is adopted. There is no continuity of the optical code, and the number of optical codes is more flexible than the wavelength. For the introduction of optical code switching, we propose a Code Group Routing Entity (CGRE) algorithm. In short, the combination of three-tier multi-granularity optical switching system and PCE can simplify the network structure, reduce the node load, and enhance the network scalability and survivability. Realize the intelligentization of optical network.