A man who was found in possession of a loaded AK-47 assault rifle and 30 rounds of live ammunition has been jailed.