Specification, composition, and placement of network services with flexible structures