Wavelength division multiplexing (WDM) optical networks are becoming more attractive due to their unprecedented high bandwidth provisions and reliability over data transmission among nodes. Therefore, it is not uncommon for enterprises to build a datacenter with over thousands of nodes using WDM optical networks. To reach the high speed over optical links, all-optical, i.e., single hop, networks are desirable as there is no overhead on conversions to and from the electronic form compared to multi-hop networks. However, given the number of nodes required, few previous works suggested a topology, e.g., torus, to support all-to-all routing with the minimum number of wavelengths over all-optical networks. In this paper, we address this challenge from a different angle. Specifically, it is possible to build different torus topologies by altering the number of nodes in every dimension, but we first show that the minimum number of wavelengths to satisfy the all-to-all routing over torus is N/3, and prove that the necessary and sufficient condition to achieve it is the sides of all dimensions are 3; thus the resultant topology is an n-dimensional hypersquare torus network; then we develop a wavelength assignment to achieve the all-to-all routing over the corresponding n-dimensional hypersquare torus; finally, we consider the fail-over problem in our proposed topology and derive the minimum number of backup wavelengths to mitigate the affected lightpaths thus maintain the gossiping.