Fix access to lifetime dict in update_ipsecpolicy method

Also add corresponding unit test.

Change-Id: Ie1141b5034415ccf3039a71dfedc47cfb2ca7a88
Closes-Bug: #1237912
(cherry picked from commit 48e36b542904effb9b35c9d62bd0247e25f0dac6)