)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"d437ba1848266784eabdfafb527906b9fbf7d1f5","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Add JSON schema for network_data.json"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Operator-generated network metadata can be validated"},{"line_number":10,"context_line":"against contributed JSON schema before it\u0027s too late."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Change-Id: Ie5a5a1fc81c7c2d3f61b72d19de464cfc9dab5ec"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"3fa7e38b_0e2f8f3e","line":9,"range":{"start_line":9,"start_character":0,"end_line":9,"end_character":35},"updated":"2020-01-21 12:44:08.000000000","message":"I\u0027m confused. I though that the network_data.json is not operator generated but generated by nova[1].\n\nWhat is the way the Operator passes in the network_data.json ?\n\n\n\n[1] https://github.com/openstack/nova/blob/85c35b4d9d6386866ddf197e4a751f729b726188/nova/virt/netutils.py#L168","commit_id":"5560357fed2670804dd2eb4dc8979269a9ef3bbe"},{"author":{"_account_id":26340,"name":"Ilya Etingof","email":"etingof@gmail.com","username":"etingof"},"change_message_id":"b669e66c80025b28973237224ed52c597eeb0a4f","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Add JSON schema for network_data.json"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Operator-generated network metadata can be validated"},{"line_number":10,"context_line":"against contributed JSON schema before it\u0027s too late."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Change-Id: Ie5a5a1fc81c7c2d3f61b72d19de464cfc9dab5ec"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"3fa7e38b_893939d0","line":9,"range":{"start_line":9,"start_character":0,"end_line":9,"end_character":35},"in_reply_to":"3fa7e38b_0e2f8f3e","updated":"2020-01-21 13:29:52.000000000","message":"Sorry for confusing you! My thoughts hopped way ahead of my fingers. This is what I wanted to express.\n\nIt is indeed true, that Nova generates network_data.json let alone the rest of the  metadata. Arguably, validating Nova-generated JSON is marginally reasonable because Nova never fails (hm-hm) and no human soul is involved in metadata  generation process.\n\nHowever, there are tools in the wild such as ironic or Glean that piggyback Nova metadata format for their own good. These tools might be able to accept network_data.json from the Operator - this is where things can go South.\n\nThe main driver for creating the schema being proposed is to harden ironic against human error when Nova is not involved (the topmost use-case being DHCP-less or L3-only bare metal deploy).\n\nWe can probably stash this schema somewhere within ironic or Glean, however I thought it would be best to have the schema under Nova control as the only source of truth.","commit_id":"5560357fed2670804dd2eb4dc8979269a9ef3bbe"},{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"a87da67d6aeb3c5979854ac4ed372504d5e5e5a2","unresolved":false,"context_lines":[{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Add JSON schema for network_data.json"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"Operator-generated network metadata can be validated"},{"line_number":10,"context_line":"against contributed JSON schema before it\u0027s too late."},{"line_number":11,"context_line":""},{"line_number":12,"context_line":"Change-Id: Ie5a5a1fc81c7c2d3f61b72d19de464cfc9dab5ec"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"3fa7e38b_1f921ffd","line":9,"range":{"start_line":9,"start_character":0,"end_line":9,"end_character":35},"in_reply_to":"3fa7e38b_893939d0","updated":"2020-01-24 17:49:36.000000000","message":"Thanks for the explanation, it helped me a lot. I agree with Stephen that we need some way to test the schema against nova emitted network_data. I crafted a test case where the metadata service is used to get the network_data of an instance and that network_data is validated according to the schema you provided. \n\nTo be able to make it work nicely I had to rebase your patch to a newer master. Sorry for that. I suggest you to squash the test change into this change and expand the commit message based on the use cases you explained to me above. \n\n\nhttps://review.opendev.org/704182","commit_id":"5560357fed2670804dd2eb4dc8979269a9ef3bbe"}],"nova/tests/functional/test_metadata.py":[{"author":{"_account_id":9708,"name":"Balazs Gibizer","display_name":"gibi","email":"gibizer@gmail.com","username":"gibi"},"change_message_id":"2faf6741a89cc9de51d1c6ad0e965c67eea97194","unresolved":false,"context_lines":[{"line_number":189,"context_line":"        schema_file \u003d os.path.normpath(os.path.join("},{"line_number":190,"context_line":"            os.path.dirname(os.path.abspath(__file__)),"},{"line_number":191,"context_line":"            \"../../../doc/api_schemas/network_data.json\"))"},{"line_number":192,"context_line":"        with open(schema_file) as f:"},{"line_number":193,"context_line":"            schema \u003d json.load(f)"},{"line_number":194,"context_line":""},{"line_number":195,"context_line":"        jsonschema.validate(res.json(), schema)"}],"source_content_type":"text/x-python","patch_set":5,"id":"3fa7e38b_ed8b9d67","line":193,"range":{"start_line":192,"start_character":0,"end_line":193,"end_character":33},"updated":"2020-02-17 13:57:53.000000000","message":"If I change this to \n\n        with open(schema_file) as f:\n            data \u003d f.read()\n        schema \u003d jsonutils.loads(data)\n\nthen jsonutils works","commit_id":"7404d047eb3ab500674bd7e603b59eb0875f1c58"},{"author":{"_account_id":26340,"name":"Ilya Etingof","email":"etingof@gmail.com","username":"etingof"},"change_message_id":"d0de9e828e063f121c101a99b895d91259326b34","unresolved":false,"context_lines":[{"line_number":189,"context_line":"        schema_file \u003d os.path.normpath(os.path.join("},{"line_number":190,"context_line":"            os.path.dirname(os.path.abspath(__file__)),"},{"line_number":191,"context_line":"            \"../../../doc/api_schemas/network_data.json\"))"},{"line_number":192,"context_line":"        with open(schema_file) as f:"},{"line_number":193,"context_line":"            schema \u003d json.load(f)"},{"line_number":194,"context_line":""},{"line_number":195,"context_line":"        jsonschema.validate(res.json(), schema)"}],"source_content_type":"text/x-python","patch_set":5,"id":"3fa7e38b_8d2549c3","line":193,"range":{"start_line":192,"start_character":0,"end_line":193,"end_character":33},"in_reply_to":"3fa7e38b_ed8b9d67","updated":"2020-02-17 14:36:49.000000000","message":"I suspect it\u0027s the bytes/str problem. UTF8 serialization should be in `bytes`.\n\nLet\u0027s see if `open(file \u0027rb\u0027)` would help...","commit_id":"7404d047eb3ab500674bd7e603b59eb0875f1c58"}]}
