India signed defense and energy deals with neighboring Sri Lanka as Prime Minister Narendra Modi visited the island nation.