Resource Allocation for Software Defined Networks