A routing and wavelength assignment (RWA) algorithm against high-power jamming based on software-defined optical networks (SDONs) is proposed. The SDON architecture is designed with power monitors at each node, which can collect the abnormal power information from each port and wavelength. Based on the abnormal power information, a metric, the weighted attack probability (WAP), can be calculated. A WAP-based RWA algorithm (WAP-RWA) is proposed considering the WAP values of each link and node along the selected lightpath. Numerical results show that the WAP-RWA algorithm can achieve a better performance in terms of blocking probability and resource utilization compared with the attack-aware dedicated path protection (AA-DPP) RWA (AA-DPP-RWA) algorithm, while providing a protection comparable with the AA-DPP-RWA algorithm.