DUELMIPs: Optimizing SDN Functionality and Security