Service Provisioning and Security Design in Software Defined Networks