Fix invalid status code assertion after handle expected exception

Fix bug 1179350

Change-Id: I88b511206d97f2ad607a7889c61df69a8638ced3
Fix testcase 'TestPortsV2.test_range_allocation' failed randomly

Fix bug 1179370

Change-Id: Id5645546c98549c9d7cf68359e0f6fa128ad84b7
Merge "Fix testcase 'TestPortsV2.test_range_allocation' failed randomly"
Merge "Fix invalid status code assertion after handle expected exception"