Do not rely on hash ordering in tests

With tox 1.7.2 hash randomization will be on by default, causing
random failures of tests. How to reproduce:
* Update tox
* Run something like:
  $ for i in {1..20}; do tox -epy27 || break; done

Changes to fix:
* Made most of generated stuff predictable by adding sorting
* Added serialized dict check for schema validation

Change-Id: I36934ce1ebfa0c98ed9fcba6e42617c0d1b2e195
Closes-bug: #1348818
Merge "Do not rely on hash ordering in tests"