It isn't always obvious what internal considerations drive NK's attention seeking behaviour, but its long game is beyond doubt:  getting the US out of the Korean peninsula and reuniting the Koreas on terms favourable to itself.  

By standing up to the Americans and drawing them into following suit it may be playing a weak hand as well as it can.  But it's a risky game, and much depends on how South Koreans respond.  My guess is that in any conflict which involves Japan, many South Koreans will side with their own kin rather than the Japanese.