Add common code from Oslo for db migrations test

Moved common code for db migrations test from Oslo.

partially implements blueprint db-migration-tests

Change-Id: Icf8c27a40ccc0114e6001cfa64444ca1cdb132fa
Merge "Add common code from Oslo for db migrations test"