A constraint programming approach for managing end-to-end requirements in sensor network macroprogramming