In the current practice of wireless engineering, to optimize wireless networks engineers usually need to grapple simultaneously with network modeling, algorithm and protocol design as well as their implementation on distributed edge nodes. This process is tedious and error prone. In this article we attempt to address this challenge by designing OSWireless, a new control plane for optimizing software-defined wireless networks. At the core of OSWireless is the virtualization of four control plane functionalities, including intent, mathematical, algorithmic and forwarding specifications, and then provide them as a service to network engineers. To this end, we design two new subplanes for the control plane: Wireless Network Abstraction Specification (WiNAS) Subplane and Optimization-as-a-Service (OaaS) Subplane. The former converts intent specifications defined using high-level Application Programming Interfaces (APIs) to the corresponding mathematical specifications, and the latter generates automatically operational (possibly distributed) algorithmic specifications. We prototype OSWireless and deploy it over NeXT, a newly developed software-defined experimentation testbed, and showcase the automated control program generation capability of OSWireless and the optimality of the resulting programs considering a variety of network control problems. We further test the applicability of OSWireless on UBSim, a newly-developed Python based simulator for integrated aerial-ground networks, considering location optimization of mobile nodes as an example. Through developing OSWireless, we hope to accelerate research towards future zero-touch software-defined wireless networks with reduced management complexity.