This is a Frog hopper that has surrounded itself with a protective mass of bubbles. These are excreted as he feeds on the plant and these insects are sometimes referred to as spittlebugs. If I wrote clickbait headlines I could say "Freakish insect blows urine bubbles and hides in them..."
Built by the caterpillar using her own hair, this exquisite little cage provides a refuge in which the caterpillar suspends herself as she pupates. This may be a lichen-eating moth species in the genus Cyana.