Our willow had an infestation of caterpillars this summer. These black caterpillars had a row of yellow spots down each side. They were hard at work eating the willow leaves right down to the mid-ribs... until some wasps came a-hunting.
Again... it is their rear-ends that the larvae are waving in the air (as if to be offensive). Sometimes they will wave excrement around while taking this posture. I suppose this may act as a deterrent in combination with their defensive maneuvers.
There were other predators among the willow branches as well. Here is a photo of the last Willow Sawfly on our willow... victim of some kind of assassin bugs.
Maybe I missed the pupal cases... if so, there will probably be more of the sawfly larvae attacking our willow with a vengeance later this summer. That's because these sawflies can have more than one generation per year.
Perhaps if they come back, I may be able to snap a photo of a paper wasp hunting caterpillars.