)]}'
{"neutron/plugins/ml2/drivers/type_vlan.py":[{"author":{"_account_id":8313,"name":"Lajos Katona","display_name":"lajoskatona","email":"katonalala@gmail.com","username":"elajkat","status":"Ericsson Software Technology"},"change_message_id":"ffd1c10963315b0bf9daa2ec2f81679b3f22ebc5","unresolved":false,"context_lines":[{"line_number":241,"context_line":"                msg \u003d (_(\"physical_network \u0027%s\u0027 unknown \""},{"line_number":242,"context_line":"                         \"for VLAN provider network\") % physical_network)"},{"line_number":243,"context_line":"                raise exc.InvalidInput(error_message\u003dmsg)"},{"line_number":244,"context_line":"            if segmentation_id is not None:"},{"line_number":245,"context_line":"                if not plugin_utils.is_valid_vlan_tag(segmentation_id):"},{"line_number":246,"context_line":"                    msg \u003d (_(\"segmentation_id out of range (%(min)s through \""},{"line_number":247,"context_line":"                             \"%(max)s)\") %"}],"source_content_type":"text/x-python","patch_set":4,"id":"7faddb67_d104c1c8","line":244,"updated":"2019-07-30 06:37:23.000000000","message":"in the commit msg you mentioned check for 0....\nAnyway \"if segmentation_id:...\" EQUALS with \"if segmentation_id is not None:....\"\n\nAnyway 2: the validation code is here: https://opendev.org/openstack/neutron-lib/src/branch/master/neutron_lib/plugins/utils.py#L49","commit_id":"cf368d23ab6b76413cfdc3b71ac6336dd15b1dc7"},{"author":{"_account_id":27079,"name":"Frank Wang","email":"wangpeihuixyz@126.com","username":"FrankWang"},"change_message_id":"a76e3c297008f0bcdbefac05157b1855c16742b7","unresolved":false,"context_lines":[{"line_number":241,"context_line":"                msg \u003d (_(\"physical_network \u0027%s\u0027 unknown \""},{"line_number":242,"context_line":"                         \"for VLAN provider network\") % physical_network)"},{"line_number":243,"context_line":"                raise exc.InvalidInput(error_message\u003dmsg)"},{"line_number":244,"context_line":"            if segmentation_id is not None:"},{"line_number":245,"context_line":"                if not plugin_utils.is_valid_vlan_tag(segmentation_id):"},{"line_number":246,"context_line":"                    msg \u003d (_(\"segmentation_id out of range (%(min)s through \""},{"line_number":247,"context_line":"                             \"%(max)s)\") %"}],"source_content_type":"text/x-python","patch_set":4,"id":"7faddb67_f108dd91","line":244,"in_reply_to":"7faddb67_d104c1c8","updated":"2019-07-30 07:07:18.000000000","message":"Hi Lajos, Thanks for your comments firstly.\nYes, the vlan validation code is is_valid_vlan_tag, \nbut if 0 is the segmentation id, The condition (if segmentation_id) is false, the network with 0 segmentation id could create successfully, this is not right.\nhowever, This condition (if segmentation_id is not None) is true, it will execute is_valid_vlan_tag check if the segmentation id is illegal, it can throw the exception correctly","commit_id":"cf368d23ab6b76413cfdc3b71ac6336dd15b1dc7"},{"author":{"_account_id":27079,"name":"Frank Wang","email":"wangpeihuixyz@126.com","username":"FrankWang"},"change_message_id":"c3aeb1f3b031d28982463cce4a66c15ba11eccc7","unresolved":false,"context_lines":[{"line_number":241,"context_line":"                msg \u003d (_(\"physical_network \u0027%s\u0027 unknown \""},{"line_number":242,"context_line":"                         \"for VLAN provider network\") % physical_network)"},{"line_number":243,"context_line":"                raise exc.InvalidInput(error_message\u003dmsg)"},{"line_number":244,"context_line":"            if segmentation_id is not None:"},{"line_number":245,"context_line":"                if not plugin_utils.is_valid_vlan_tag(segmentation_id):"},{"line_number":246,"context_line":"                    msg \u003d (_(\"segmentation_id out of range (%(min)s through \""},{"line_number":247,"context_line":"                             \"%(max)s)\") %"}],"source_content_type":"text/x-python","patch_set":4,"id":"7faddb67_26cd592f","line":244,"in_reply_to":"7faddb67_dfa7804f","updated":"2019-08-22 07:35:11.000000000","message":"sounds a great idea, Done, could you take a look what\u0027s wrong with the testing result? I really don\u0027t know where is the problem after looked into it several times.","commit_id":"cf368d23ab6b76413cfdc3b71ac6336dd15b1dc7"},{"author":{"_account_id":8313,"name":"Lajos Katona","display_name":"lajoskatona","email":"katonalala@gmail.com","username":"elajkat","status":"Ericsson Software Technology"},"change_message_id":"0666a8561c514f32e902a2b8f91be3223b459e8f","unresolved":false,"context_lines":[{"line_number":241,"context_line":"                msg \u003d (_(\"physical_network \u0027%s\u0027 unknown \""},{"line_number":242,"context_line":"                         \"for VLAN provider network\") % physical_network)"},{"line_number":243,"context_line":"                raise exc.InvalidInput(error_message\u003dmsg)"},{"line_number":244,"context_line":"            if segmentation_id is not None:"},{"line_number":245,"context_line":"                if not plugin_utils.is_valid_vlan_tag(segmentation_id):"},{"line_number":246,"context_line":"                    msg \u003d (_(\"segmentation_id out of range (%(min)s through \""},{"line_number":247,"context_line":"                             \"%(max)s)\") %"}],"source_content_type":"text/x-python","patch_set":4,"id":"7faddb67_dfa7804f","line":244,"in_reply_to":"7faddb67_f108dd91","updated":"2019-08-21 12:06:24.000000000","message":"Hi Frank,\nI think I see now your problem. \nPlease consider this suggestion, I see it more pythonic:\nif segmentation_id and int(segmentation_id) \u003e\u003d 0:\n    .....","commit_id":"cf368d23ab6b76413cfdc3b71ac6336dd15b1dc7"},{"author":{"_account_id":8313,"name":"Lajos Katona","display_name":"lajoskatona","email":"katonalala@gmail.com","username":"elajkat","status":"Ericsson Software Technology"},"change_message_id":"40e416667ef0ce7a9e0e0ef61af49bd52a50d951","unresolved":false,"context_lines":[{"line_number":241,"context_line":"                msg \u003d (_(\"physical_network \u0027%s\u0027 unknown \""},{"line_number":242,"context_line":"                         \"for VLAN provider network\") % physical_network)"},{"line_number":243,"context_line":"                raise exc.InvalidInput(error_message\u003dmsg)"},{"line_number":244,"context_line":"            if segmentation_id and int(segmentation_id) \u003e\u003d 0:"},{"line_number":245,"context_line":"                if not plugin_utils.is_valid_vlan_tag(segmentation_id):"},{"line_number":246,"context_line":"                    msg \u003d (_(\"segmentation_id out of range (%(min)s through \""},{"line_number":247,"context_line":"                             \"%(max)s)\") %"}],"source_content_type":"text/x-python","patch_set":5,"id":"7faddb67_0cb2bb07","line":244,"range":{"start_line":244,"start_character":12,"end_line":244,"end_character":61},"updated":"2019-08-22 11:08:23.000000000","message":"After checking in details, this was not that good idea, as first the if segmentation_id part is checked by the interpreter, and if segmentation_id is 0 (or None).\nSo I think the best (my opinion) would be:\n\n1) Your original solution (sorry for causing trouble): \nif segmentation_id is not None:\n    ....\nAs the is_valid_vlan_tag method anyway checks if the segm_id is int, you can trust in it I suppose.\n\n2) A longer version that checks the type of segm_id\nif isinstance(segmentation_id, int) and segmentation_is \u003e\u003d0:\n     .....","commit_id":"12d34f370f17b236f424c1c107647f2a106610ac"}]}
