)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"6343f7e87efd973fdebf4905b0383a0930a9d685","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Inessa Vasilevskaya \u003civasilevskaya@mirantis.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2016-08-12 02:22:41 +0300"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"ovsfw: wrong masking of single even ports"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"During the creation of security group rule with"},{"line_number":10,"context_line":"single port allowed (min_port \u003d\u003d max_port) for"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"9ad45d7e_33e74aad","line":7,"range":{"start_line":7,"start_character":6,"end_line":7,"end_character":41},"updated":"2016-08-12 01:28:17.000000000","message":"\"fix single port rule bad masking\" may be more informative","commit_id":"323183e35ea3a425fbb8982be536e0c7570799fd"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"6343f7e87efd973fdebf4905b0383a0930a9d685","unresolved":false,"context_lines":[{"line_number":9,"context_line":"During the creation of security group rule with"},{"line_number":10,"context_line":"single port allowed (min_port \u003d\u003d max_port) for"},{"line_number":11,"context_line":"an even port number, tp_src field erroneously"},{"line_number":12,"context_line":"contained 0xffe mask thus causing next port to"},{"line_number":13,"context_line":"be available as well."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"This was fixed by not generating a mask for single"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"9ad45d7e_d3ccee36","line":12,"range":{"start_line":12,"start_character":10,"end_line":12,"end_character":15},"updated":"2016-08-12 01:28:17.000000000","message":"should be 0xfffe","commit_id":"323183e35ea3a425fbb8982be536e0c7570799fd"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"f35d5407d099912242ae30cc31f2ad1d20b3de6e","unresolved":false,"context_lines":[{"line_number":16,"context_line":""},{"line_number":17,"context_line":"Functional and unit tests to cover the bug added as well."},{"line_number":18,"context_line":""},{"line_number":19,"context_line":"Co-Authored-By: Jakub Libosvar \u003clibosvar@redhat.com\u003e"},{"line_number":20,"context_line":"Co-Authored-By: IWAMOTO Toshihiro \u003ciwamoto@valinux.co.jp\u003e"},{"line_number":21,"context_line":""},{"line_number":22,"context_line":"Closes-Bug:#1611991"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":10,"id":"3ac371cc_edfa2f42","line":19,"range":{"start_line":19,"start_character":0,"end_line":19,"end_character":52},"updated":"2016-08-17 16:44:13.000000000","message":"I think I shouldn\u0027t be co-authored, it\u0027s all your and Iwamoto\u0027s credit :)","commit_id":"37c81a65d738cdaf51f08a0f91ce135a4c097fd8"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"9ac56251c8b25e6ef0c8b1162db4316f0df6d64a","unresolved":false,"context_lines":[{"line_number":19,"context_line":"Co-Authored-By: Jakub Libosvar \u003clibosvar@redhat.com\u003e"},{"line_number":20,"context_line":"Co-Authored-By: IWAMOTO Toshihiro \u003ciwamoto@valinux.co.jp\u003e"},{"line_number":21,"context_line":""},{"line_number":22,"context_line":"Closes-Bug:#1611991"},{"line_number":23,"context_line":"Change-Id: Idfc0e9c52e0dd08852c91c17e12edb034606a361"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":19,"id":"1ac06dbe_436fdd2a","line":22,"range":{"start_line":22,"start_character":0,"end_line":22,"end_character":19},"updated":"2016-08-23 10:27:29.000000000","message":"I\u0027ll add a space","commit_id":"1c96b3388464a3bdb39cec4df3841d708e1036b6"}],"neutron/common/utils.py":[{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"85b547ac9741e5a3bf5943a6cec63476d0d7e9c6","unresolved":false,"context_lines":[{"line_number":432,"context_line":"    if bitdiff \u003d\u003d 0:"},{"line_number":433,"context_line":"        return [_hex_format(port_min)]"},{"line_number":434,"context_line":"    # for python3.x, bit_length could be used here"},{"line_number":435,"context_line":"    top_bit \u003d 1"},{"line_number":436,"context_line":"    while top_bit \u003c\u003d bitdiff:"},{"line_number":437,"context_line":"        top_bit \u003c\u003c\u003d 1"},{"line_number":438,"context_line":"    mask \u003d top_bit - 1"}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_928e40ce","line":435,"updated":"2016-08-17 15:33:42.000000000","message":"The code is really low-level. I personally find it quite time consuming when reading. I think we must add some helpful comments with examples to understand the used algorithm here. E.g.\n\n # Find the MSB set to 1 on a bit place where port_min and port_max differs\n\nor maybe better would be to split it into several small elementary functions, so the resulting code would be calling functions with semantical meaning.","commit_id":"0c4faeb1ad8136f41f0e4679d81e6ca7a86d09d1"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"565baaad255774ad21c853e6e912b497f987c19b","unresolved":false,"context_lines":[{"line_number":441,"context_line":"    common \u003d port_min \u0026 ~mask"},{"line_number":442,"context_line":"    if lower \u003d\u003d 0 and upper \u003d\u003d mask:"},{"line_number":443,"context_line":"        # special case"},{"line_number":444,"context_line":"        import ipdb; ipdb.set_trace()"},{"line_number":445,"context_line":"        return [\u0027%s/%s\u0027 % (_hex_format(common), _hex_format(0xffff \u0026 ~mask))]"},{"line_number":446,"context_line":"    first_iter \u003d True"},{"line_number":447,"context_line":"    rules \u003d []"}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_5407b1c9","line":444,"updated":"2016-08-17 06:12:06.000000000","message":"Please remove this debugging code.","commit_id":"0c4faeb1ad8136f41f0e4679d81e6ca7a86d09d1"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"bec7aabaf92379364b2d3ca7329ab13528021b2d","unresolved":false,"context_lines":[{"line_number":441,"context_line":"    common \u003d port_min \u0026 ~mask"},{"line_number":442,"context_line":"    if lower \u003d\u003d 0 and upper \u003d\u003d mask:"},{"line_number":443,"context_line":"        # special case"},{"line_number":444,"context_line":"        import ipdb; ipdb.set_trace()"},{"line_number":445,"context_line":"        return [\u0027%s/%s\u0027 % (_hex_format(common), _hex_format(0xffff \u0026 ~mask))]"},{"line_number":446,"context_line":"    first_iter \u003d True"},{"line_number":447,"context_line":"    rules \u003d []"}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_7aa3afb2","line":444,"in_reply_to":"3ac371cc_5407b1c9","updated":"2016-08-17 10:42:40.000000000","message":"Oops, sorry.","commit_id":"0c4faeb1ad8136f41f0e4679d81e6ca7a86d09d1"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"565baaad255774ad21c853e6e912b497f987c19b","unresolved":false,"context_lines":[{"line_number":442,"context_line":"    if lower \u003d\u003d 0 and upper \u003d\u003d mask:"},{"line_number":443,"context_line":"        # special case"},{"line_number":444,"context_line":"        import ipdb; ipdb.set_trace()"},{"line_number":445,"context_line":"        return [\u0027%s/%s\u0027 % (_hex_format(common), _hex_format(0xffff \u0026 ~mask))]"},{"line_number":446,"context_line":"    first_iter \u003d True"},{"line_number":447,"context_line":"    rules \u003d []"},{"line_number":448,"context_line":"    top_bit_save \u003d top_bit"}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_b4cd4587","line":445,"updated":"2016-08-17 06:12:06.000000000","message":"This 0xffff masking appears many times in this function.\nHow about changing _hex_format to take 2 args (port and mask) and moving 0xffff masking into it?","commit_id":"0c4faeb1ad8136f41f0e4679d81e6ca7a86d09d1"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"bec7aabaf92379364b2d3ca7329ab13528021b2d","unresolved":false,"context_lines":[{"line_number":442,"context_line":"    if lower \u003d\u003d 0 and upper \u003d\u003d mask:"},{"line_number":443,"context_line":"        # special case"},{"line_number":444,"context_line":"        import ipdb; ipdb.set_trace()"},{"line_number":445,"context_line":"        return [\u0027%s/%s\u0027 % (_hex_format(common), _hex_format(0xffff \u0026 ~mask))]"},{"line_number":446,"context_line":"    first_iter \u003d True"},{"line_number":447,"context_line":"    rules \u003d []"},{"line_number":448,"context_line":"    top_bit_save \u003d top_bit"}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_5aa8738d","line":445,"in_reply_to":"3ac371cc_b4cd4587","updated":"2016-08-17 10:42:40.000000000","message":"Done","commit_id":"0c4faeb1ad8136f41f0e4679d81e6ca7a86d09d1"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"565baaad255774ad21c853e6e912b497f987c19b","unresolved":false,"context_lines":[{"line_number":452,"context_line":"        mask \u003e\u003e\u003d 1"},{"line_number":453,"context_line":"        if (lower \u0026 mask) \u003d\u003d 0:"},{"line_number":454,"context_line":"            if mask \u003d\u003d 0:"},{"line_number":455,"context_line":"                rules.append(_hex_format(common | lower))"},{"line_number":456,"context_line":"            else:"},{"line_number":457,"context_line":"                rules.append(\u0027%s/%s\u0027 % (_hex_format(common | lower),"},{"line_number":458,"context_line":"                                        _hex_format(0xffff \u0026 ~mask)))"}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_b4d0a5f7","line":455,"range":{"start_line":455,"start_character":41,"end_line":455,"end_character":56},"updated":"2016-08-17 06:12:06.000000000","message":"I noticed later that (common | lower) equals to port_min, so please use the latter.\n\nLikewise for common | upper and port_max.","commit_id":"0c4faeb1ad8136f41f0e4679d81e6ca7a86d09d1"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"bec7aabaf92379364b2d3ca7329ab13528021b2d","unresolved":false,"context_lines":[{"line_number":452,"context_line":"        mask \u003e\u003e\u003d 1"},{"line_number":453,"context_line":"        if (lower \u0026 mask) \u003d\u003d 0:"},{"line_number":454,"context_line":"            if mask \u003d\u003d 0:"},{"line_number":455,"context_line":"                rules.append(_hex_format(common | lower))"},{"line_number":456,"context_line":"            else:"},{"line_number":457,"context_line":"                rules.append(\u0027%s/%s\u0027 % (_hex_format(common | lower),"},{"line_number":458,"context_line":"                                        _hex_format(0xffff \u0026 ~mask)))"}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_1a9b9b73","line":455,"range":{"start_line":455,"start_character":41,"end_line":455,"end_character":56},"in_reply_to":"3ac371cc_b4d0a5f7","updated":"2016-08-17 10:42:40.000000000","message":"Done","commit_id":"0c4faeb1ad8136f41f0e4679d81e6ca7a86d09d1"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"3228445dfea9da784467e598e33a5830c65a94b8","unresolved":false,"context_lines":[{"line_number":448,"context_line":"    common \u003d port_min \u0026 ~mask"},{"line_number":449,"context_line":"    if lower \u003d\u003d 0 and upper \u003d\u003d mask:"},{"line_number":450,"context_line":"        # special case"},{"line_number":451,"context_line":"        return [\u0027%s/%s\u0027 % (_hex_format(common), _hex_format(0xffff \u0026 ~mask))]"},{"line_number":452,"context_line":"    first_iter \u003d True"},{"line_number":453,"context_line":"    rules \u003d []"},{"line_number":454,"context_line":"    top_bit_save \u003d top_bit"}],"source_content_type":"text/x-python","patch_set":8,"id":"3ac371cc_2d2900e7","line":451,"range":{"start_line":451,"start_character":7,"end_line":451,"end_character":77},"updated":"2016-08-17 10:42:26.000000000","message":"change to _hex_format(common, mask)","commit_id":"4d52b7fccaf4e87acbd1bd6634b13c6e64de49cc"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"e7e0d7fa9716dd79d63f5ba0f3e154f641729eb1","unresolved":false,"context_lines":[{"line_number":427,"context_line":"        return format(num, \u0027#06x\u0027)"},{"line_number":428,"context_line":"    if mask:"},{"line_number":429,"context_line":"        return \"%s/%s\" % (hex_str(port), hex_str(0xffff \u0026 ~mask))"},{"line_number":430,"context_line":"    return \"%s\" % hex_str(port)"},{"line_number":431,"context_line":""},{"line_number":432,"context_line":""},{"line_number":433,"context_line":"def port_rule_masking(port_min, port_max):"}],"source_content_type":"text/x-python","patch_set":9,"id":"3ac371cc_3b948f41","line":430,"updated":"2016-08-17 13:35:10.000000000","message":"return hex_str(port) should be fine here.","commit_id":"fe6adb90e4845bc782849fd5838a928098017ad0"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"4e0468a46acfb97c8c09fac40df05c8f3f311e86","unresolved":false,"context_lines":[{"line_number":427,"context_line":"        return format(num, \u0027#06x\u0027)"},{"line_number":428,"context_line":"    if mask:"},{"line_number":429,"context_line":"        return \"%s/%s\" % (hex_str(port), hex_str(0xffff \u0026 ~mask))"},{"line_number":430,"context_line":"    return \"%s\" % hex_str(port)"},{"line_number":431,"context_line":""},{"line_number":432,"context_line":""},{"line_number":433,"context_line":"def port_rule_masking(port_min, port_max):"}],"source_content_type":"text/x-python","patch_set":9,"id":"3ac371cc_ec199f89","line":430,"in_reply_to":"3ac371cc_3b948f41","updated":"2016-08-17 14:05:20.000000000","message":"Thanks, missed that.","commit_id":"fe6adb90e4845bc782849fd5838a928098017ad0"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"e7e0d7fa9716dd79d63f5ba0f3e154f641729eb1","unresolved":false,"context_lines":[{"line_number":457,"context_line":"        top_bit \u003e\u003e\u003d 1"},{"line_number":458,"context_line":"        mask \u003e\u003e\u003d 1"},{"line_number":459,"context_line":"        if (lower \u0026 mask) \u003d\u003d 0:"},{"line_number":460,"context_line":"            if mask \u003d\u003d 0:"},{"line_number":461,"context_line":"                rules.append(_hex_format(port_min))"},{"line_number":462,"context_line":"            else:"},{"line_number":463,"context_line":"                rules.append(_hex_format(port_min, mask))"},{"line_number":464,"context_line":"            break"}],"source_content_type":"text/x-python","patch_set":9,"id":"3ac371cc_9b1e63b9","line":461,"range":{"start_line":460,"start_character":11,"end_line":461,"end_character":51},"updated":"2016-08-17 13:35:10.000000000","message":"I\u0027d move this mask \u003d\u003d 0 conditional into _hex_format.","commit_id":"fe6adb90e4845bc782849fd5838a928098017ad0"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"4e0468a46acfb97c8c09fac40df05c8f3f311e86","unresolved":false,"context_lines":[{"line_number":457,"context_line":"        top_bit \u003e\u003e\u003d 1"},{"line_number":458,"context_line":"        mask \u003e\u003e\u003d 1"},{"line_number":459,"context_line":"        if (lower \u0026 mask) \u003d\u003d 0:"},{"line_number":460,"context_line":"            if mask \u003d\u003d 0:"},{"line_number":461,"context_line":"                rules.append(_hex_format(port_min))"},{"line_number":462,"context_line":"            else:"},{"line_number":463,"context_line":"                rules.append(_hex_format(port_min, mask))"},{"line_number":464,"context_line":"            break"}],"source_content_type":"text/x-python","patch_set":9,"id":"3ac371cc_e7753898","line":461,"range":{"start_line":460,"start_character":11,"end_line":461,"end_character":51},"in_reply_to":"3ac371cc_9b1e63b9","updated":"2016-08-17 14:05:20.000000000","message":"I think the whole if\\else part can be rewritten as rules.append(_hex_format(port_min, mask))","commit_id":"fe6adb90e4845bc782849fd5838a928098017ad0"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"e7e0d7fa9716dd79d63f5ba0f3e154f641729eb1","unresolved":false,"context_lines":[{"line_number":463,"context_line":"                rules.append(_hex_format(port_min, mask))"},{"line_number":464,"context_line":"            break"},{"line_number":465,"context_line":"        if (lower \u0026 top_bit) \u003d\u003d 0 and not first_iter:"},{"line_number":466,"context_line":"            if top_bit \u003e port_min:"},{"line_number":467,"context_line":"                port_num \u003d (common | top_bit)"},{"line_number":468,"context_line":"            else:"},{"line_number":469,"context_line":"                port_num \u003d (port_min \u0026 ~mask | top_bit)"},{"line_number":470,"context_line":"            rules.append(_hex_format(port_num, mask))"},{"line_number":471,"context_line":"        first_iter \u003d False"}],"source_content_type":"text/x-python","patch_set":9,"id":"3ac371cc_1be553db","line":468,"range":{"start_line":466,"start_character":0,"end_line":468,"end_character":17},"updated":"2016-08-17 13:35:10.000000000","message":"Do we need this?\nThe else case should work fine for both cases.","commit_id":"fe6adb90e4845bc782849fd5838a928098017ad0"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"4e0468a46acfb97c8c09fac40df05c8f3f311e86","unresolved":false,"context_lines":[{"line_number":463,"context_line":"                rules.append(_hex_format(port_min, mask))"},{"line_number":464,"context_line":"            break"},{"line_number":465,"context_line":"        if (lower \u0026 top_bit) \u003d\u003d 0 and not first_iter:"},{"line_number":466,"context_line":"            if top_bit \u003e port_min:"},{"line_number":467,"context_line":"                port_num \u003d (common | top_bit)"},{"line_number":468,"context_line":"            else:"},{"line_number":469,"context_line":"                port_num \u003d (port_min \u0026 ~mask | top_bit)"},{"line_number":470,"context_line":"            rules.append(_hex_format(port_num, mask))"},{"line_number":471,"context_line":"        first_iter \u003d False"}],"source_content_type":"text/x-python","patch_set":9,"id":"3ac371cc_ec323f0f","line":468,"range":{"start_line":466,"start_character":0,"end_line":468,"end_character":17},"in_reply_to":"3ac371cc_1be553db","updated":"2016-08-17 14:05:20.000000000","message":"yep, common \u003d\u003d (port_min \u0026 ~mask) in case top_bit is greater than port_min. \nThanks!","commit_id":"fe6adb90e4845bc782849fd5838a928098017ad0"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"67aa3da88f9f1b24b1c32d94d47a5d7ec97aaa8c","unresolved":false,"context_lines":[{"line_number":480,"context_line":"            rules.append(_hex_format(upper_part \u0026 ~top_bit, mask))"},{"line_number":481,"context_line":"        first_iter \u003d False"},{"line_number":482,"context_line":""},{"line_number":483,"context_line":"    return [r for r in sorted(rules)]"},{"line_number":484,"context_line":""},{"line_number":485,"context_line":""},{"line_number":486,"context_line":"def create_object_with_dependency(creator, dep_getter, dep_creator,"}],"source_content_type":"text/x-python","patch_set":10,"id":"3ac371cc_cd1bf3c8","line":483,"range":{"start_line":483,"start_character":11,"end_line":483,"end_character":37},"updated":"2016-08-17 16:43:33.000000000","message":"We don\u0027t need to sort the rules, rules used in ovs firewall have the same priority and rules are mutual exclusive, so we should be fine with not sorted list.","commit_id":"37c81a65d738cdaf51f08a0f91ce135a4c097fd8"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"6df8d8ef9aca04e6de76ef261492ee4716891fde","unresolved":false,"context_lines":[{"line_number":480,"context_line":"            rules.append(_hex_format(upper_part \u0026 ~top_bit, mask))"},{"line_number":481,"context_line":"        first_iter \u003d False"},{"line_number":482,"context_line":""},{"line_number":483,"context_line":"    return [r for r in sorted(rules)]"},{"line_number":484,"context_line":""},{"line_number":485,"context_line":""},{"line_number":486,"context_line":"def create_object_with_dependency(creator, dep_getter, dep_creator,"}],"source_content_type":"text/x-python","patch_set":10,"id":"3ac371cc_44f823c5","line":483,"range":{"start_line":483,"start_character":11,"end_line":483,"end_character":37},"in_reply_to":"3ac371cc_1781748f","updated":"2016-08-18 20:23:21.000000000","message":"I think I did that to make existing tests pass, but I\u0027ll move the sorting into the tests then.","commit_id":"37c81a65d738cdaf51f08a0f91ce135a4c097fd8"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"f7549cb16da1f44d161e8a3e145d7b77cd1e379a","unresolved":false,"context_lines":[{"line_number":480,"context_line":"            rules.append(_hex_format(upper_part \u0026 ~top_bit, mask))"},{"line_number":481,"context_line":"        first_iter \u003d False"},{"line_number":482,"context_line":""},{"line_number":483,"context_line":"    return [r for r in sorted(rules)]"},{"line_number":484,"context_line":""},{"line_number":485,"context_line":""},{"line_number":486,"context_line":"def create_object_with_dependency(creator, dep_getter, dep_creator,"}],"source_content_type":"text/x-python","patch_set":10,"id":"3ac371cc_1781748f","line":483,"range":{"start_line":483,"start_character":11,"end_line":483,"end_character":37},"in_reply_to":"3ac371cc_cd1bf3c8","updated":"2016-08-18 07:58:05.000000000","message":"+1","commit_id":"37c81a65d738cdaf51f08a0f91ce135a4c097fd8"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"b8fb28303367ae510bdca0e7686067d3968e173f","unresolved":false,"context_lines":[{"line_number":454,"context_line":"    top_bit \u003e\u003e\u003d 1"},{"line_number":455,"context_line":"    mask \u003e\u003e\u003d 1"},{"line_number":456,"context_line":"    while True:"},{"line_number":457,"context_line":"        # remaining range to be encoded is range(port_min, port_min | mask)"},{"line_number":458,"context_line":"        if (lower \u0026 mask) \u003d\u003d 0:"},{"line_number":459,"context_line":"            rules.append(_hex_format(port_min, mask))"},{"line_number":460,"context_line":"            break"}],"source_content_type":"text/x-python","patch_set":11,"id":"3ac371cc_086cb59a","line":457,"updated":"2016-08-18 07:55:39.000000000","message":"oops that was range(port_min, (port_min | mask) + 1)","commit_id":"812ae793f3ccbfd369762ed9300dac019e451f7a"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"b8fb28303367ae510bdca0e7686067d3968e173f","unresolved":false,"context_lines":[{"line_number":458,"context_line":"        if (lower \u0026 mask) \u003d\u003d 0:"},{"line_number":459,"context_line":"            rules.append(_hex_format(port_min, mask))"},{"line_number":460,"context_line":"            break"},{"line_number":461,"context_line":"        top_bit \u003e\u003e\u003d 1"},{"line_number":462,"context_line":"        if top_bit \u003d\u003d 0:"},{"line_number":463,"context_line":"            break"},{"line_number":464,"context_line":"        mask \u003e\u003e\u003d 1"},{"line_number":465,"context_line":"        if (lower \u0026 top_bit) \u003d\u003d 0:"},{"line_number":466,"context_line":"            rules.append(_hex_format(port_min \u0026 ~mask | top_bit, mask))"},{"line_number":467,"context_line":"        # if the above if-clause is false, range(port_min, port_min | mask) hasn\u0027t"}],"source_content_type":"text/x-python","patch_set":11,"id":"3ac371cc_680e098d","line":464,"range":{"start_line":461,"start_character":1,"end_line":464,"end_character":18},"updated":"2016-08-18 07:55:39.000000000","message":"I think moving the bit shift into the middle of the iteration helps understanding, and also kills a mysterious first_iter flag.\n\nIn the original version, it wasn\u0027t possible to write comment that appears on L.457 as it carried over port ranges into next iterations.","commit_id":"812ae793f3ccbfd369762ed9300dac019e451f7a"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"b8fb28303367ae510bdca0e7686067d3968e173f","unresolved":false,"context_lines":[{"line_number":464,"context_line":"        mask \u003e\u003e\u003d 1"},{"line_number":465,"context_line":"        if (lower \u0026 top_bit) \u003d\u003d 0:"},{"line_number":466,"context_line":"            rules.append(_hex_format(port_min \u0026 ~mask | top_bit, mask))"},{"line_number":467,"context_line":"        # if the above if-clause is false, range(port_min, port_min | mask) hasn\u0027t"},{"line_number":468,"context_line":"        # changed in this iteration."},{"line_number":469,"context_line":""},{"line_number":470,"context_line":"    # The following while block is a mirror image of the above block."}],"source_content_type":"text/x-python","patch_set":11,"id":"3ac371cc_6811e903","line":467,"range":{"start_line":467,"start_character":59,"end_line":467,"end_character":74},"updated":"2016-08-18 07:55:39.000000000","message":"(port_min | mask) + 1","commit_id":"812ae793f3ccbfd369762ed9300dac019e451f7a"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"059d47952a4c12e39325c19d914c6cd5c9db3184","unresolved":false,"context_lines":[{"line_number":430,"context_line":"    return hex_str(port)"},{"line_number":431,"context_line":""},{"line_number":432,"context_line":""},{"line_number":433,"context_line":"def port_rule_masking(port_min, port_max):"},{"line_number":434,"context_line":"    # Check port_max \u003e\u003d port_min."},{"line_number":435,"context_line":"    if port_max \u003c port_min:"},{"line_number":436,"context_line":"        raise ValueError(_(\"\u0027port_max\u0027 is smaller than \u0027port_min\u0027\"))"}],"source_content_type":"text/x-python","patch_set":12,"id":"3ac371cc_13178155","line":433,"updated":"2016-08-19 03:36:52.000000000","message":"Personally I find that for a method of such complexity the lack of inline documentation to be very problematic for readability and maintainability. It would be nice if it was explained at high level what this method does and how a port range is expected to be translated into a list of rules of a specific nature.\n\nThe tests help a bit but numbers are meaningless on their own. I wonder if breaking down this in smaller units may make the whole thing more digestible.","commit_id":"2bdfa10e38ad0ca9f59410b12ec3d90a220e9ef9"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"4d772bf34ffbeded32c25154420937c272ac2eda","unresolved":false,"context_lines":[{"line_number":447,"context_line":"    lower \u003d port_min \u0026 mask"},{"line_number":448,"context_line":"    upper \u003d port_max \u0026 mask"},{"line_number":449,"context_line":"    common \u003d port_min \u0026 ~mask"},{"line_number":450,"context_line":"    if lower \u003d\u003d 0 and upper \u003d\u003d mask:"},{"line_number":451,"context_line":"        # special case"},{"line_number":452,"context_line":"        return [_hex_format(common, mask)]"},{"line_number":453,"context_line":"    rules \u003d []"}],"source_content_type":"text/x-python","patch_set":12,"id":"3ac371cc_6b01a339","line":450,"updated":"2016-08-19 01:47:25.000000000","message":"I found lower and upper is only needed here, so it could be done without defining these variables.","commit_id":"2bdfa10e38ad0ca9f59410b12ec3d90a220e9ef9"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"970c79253c2c995fa504c5aa2bbb62ae1fd7cdd9","unresolved":false,"context_lines":[{"line_number":84,"context_line":"            self.base \u003d self.prev_ref.base"},{"line_number":85,"context_line":"            if self.prev_ref:"},{"line_number":86,"context_line":"                self.prev_ref \u003d self.prev_ref.prev_ref"},{"line_number":87,"context_line":"            if self.prev_ref:"},{"line_number":88,"context_line":"                self.shake()"},{"line_number":89,"context_line":""},{"line_number":90,"context_line":"    def __str__(self):"},{"line_number":91,"context_line":"        return _hex_format(self.base, self.mask)"}],"source_content_type":"text/x-python","patch_set":15,"id":"1ac06dbe_a958c757","line":88,"range":{"start_line":87,"start_character":0,"end_line":88,"end_character":28},"updated":"2016-08-19 14:50:08.000000000","message":"This can be moved to the \"if\" above to avoid calling it in case prev_ref on L85 is None.","commit_id":"2ec594a674d2c0b090cf854c0c86ff88b0c32c6f"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"5aed611b5256bd5a2aab3d8963fa5362aa19a0a6","unresolved":false,"context_lines":[{"line_number":431,"context_line":"def port_rule_masking(port_min, port_max):"},{"line_number":432,"context_line":"    \"\"\""},{"line_number":433,"context_line":"    The algorithm is split in 2 parts: first rules for range [port_min, T)"},{"line_number":434,"context_line":"    are generated, then rules for range [T, port_max], where T is determined by"},{"line_number":435,"context_line":"    initial port values."},{"line_number":436,"context_line":""},{"line_number":437,"context_line":"    Each part starts with setting up mask and top_bit variables to their"}],"source_content_type":"text/x-python","patch_set":18,"id":"1ac06dbe_64f344d7","line":434,"range":{"start_line":434,"start_character":63,"end_line":434,"end_character":76},"updated":"2016-08-22 12:08:15.000000000","message":"Based on what criteria is it determined? Would it add readability if we\u0027d have those parts as separate functions so it\u0027s clearer which part is which?","commit_id":"34d1d9138381bccaacaa160a79d75fc915d995ae"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"3e9f76bbf5325f633775f0a7b570e7ad6e10051d","unresolved":false,"context_lines":[{"line_number":431,"context_line":"def port_rule_masking(port_min, port_max):"},{"line_number":432,"context_line":"    \"\"\""},{"line_number":433,"context_line":"    The algorithm is split in 2 parts: first rules for range [port_min, T)"},{"line_number":434,"context_line":"    are generated, then rules for range [T, port_max], where T is determined by"},{"line_number":435,"context_line":"    initial port values."},{"line_number":436,"context_line":""},{"line_number":437,"context_line":"    Each part starts with setting up mask and top_bit variables to their"}],"source_content_type":"text/x-python","patch_set":18,"id":"1ac06dbe_b858bc33","line":434,"range":{"start_line":434,"start_character":63,"end_line":434,"end_character":76},"in_reply_to":"1ac06dbe_64f344d7","updated":"2016-08-22 12:17:27.000000000","message":"this part actually is the least that matters (I mean the way the range is divided). Don\u0027t know why I even but emphasis on that.\nLet\u0027s split port_rule_masking into smth like _process_min_port() and _process_max_port() then?","commit_id":"34d1d9138381bccaacaa160a79d75fc915d995ae"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"a069435c63208c430638b88fec0925c17cb42d46","unresolved":false,"context_lines":[{"line_number":431,"context_line":"def port_rule_masking(port_min, port_max):"},{"line_number":432,"context_line":"    \"\"\""},{"line_number":433,"context_line":"    The algorithm is split in 2 parts: first rules for range [port_min, T)"},{"line_number":434,"context_line":"    are generated, then rules for range [T, port_max], where T is determined by"},{"line_number":435,"context_line":"    initial port values."},{"line_number":436,"context_line":""},{"line_number":437,"context_line":"    Each part starts with setting up mask and top_bit variables to their"}],"source_content_type":"text/x-python","patch_set":18,"id":"1ac06dbe_38796cf7","line":434,"range":{"start_line":434,"start_character":63,"end_line":434,"end_character":76},"in_reply_to":"1ac06dbe_b858bc33","updated":"2016-08-22 12:21:11.000000000","message":"I still wonder where is the boundary T though. More we know, better the understanding.","commit_id":"34d1d9138381bccaacaa160a79d75fc915d995ae"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"5aed611b5256bd5a2aab3d8963fa5362aa19a0a6","unresolved":false,"context_lines":[{"line_number":441,"context_line":"    With each rule generation cycle, mask and top_bit are bit shifted to the"},{"line_number":442,"context_line":"    right. When top_bit reaches 0 it means that last register was processed."},{"line_number":443,"context_line":""},{"line_number":444,"context_line":"    Every cycle step the following conditions are checked:"},{"line_number":445,"context_line":"        * port \u0026 mask \u003d\u003d 0 (alternatively port \u0026 mask \u003d\u003d mask)"},{"line_number":446,"context_line":"        This corresponds to the masked remainder matching a streak of \u00270\u0027"},{"line_number":447,"context_line":"        (or \u00271\u0027 alternatively)."}],"source_content_type":"text/x-python","patch_set":18,"id":"1ac06dbe_848c8036","line":444,"range":{"start_line":444,"start_character":4,"end_line":444,"end_character":57},"updated":"2016-08-22 12:08:15.000000000","message":"Nit: Every cycle step checks the following conditions:","commit_id":"34d1d9138381bccaacaa160a79d75fc915d995ae"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"3e9f76bbf5325f633775f0a7b570e7ad6e10051d","unresolved":false,"context_lines":[{"line_number":441,"context_line":"    With each rule generation cycle, mask and top_bit are bit shifted to the"},{"line_number":442,"context_line":"    right. When top_bit reaches 0 it means that last register was processed."},{"line_number":443,"context_line":""},{"line_number":444,"context_line":"    Every cycle step the following conditions are checked:"},{"line_number":445,"context_line":"        * port \u0026 mask \u003d\u003d 0 (alternatively port \u0026 mask \u003d\u003d mask)"},{"line_number":446,"context_line":"        This corresponds to the masked remainder matching a streak of \u00270\u0027"},{"line_number":447,"context_line":"        (or \u00271\u0027 alternatively)."}],"source_content_type":"text/x-python","patch_set":18,"id":"1ac06dbe_989d005c","line":444,"range":{"start_line":444,"start_character":4,"end_line":444,"end_character":57},"in_reply_to":"1ac06dbe_848c8036","updated":"2016-08-22 12:17:27.000000000","message":"thanks!","commit_id":"34d1d9138381bccaacaa160a79d75fc915d995ae"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"5aed611b5256bd5a2aab3d8963fa5362aa19a0a6","unresolved":false,"context_lines":[{"line_number":446,"context_line":"        This corresponds to the masked remainder matching a streak of \u00270\u0027"},{"line_number":447,"context_line":"        (or \u00271\u0027 alternatively)."},{"line_number":448,"context_line":"        Ex. port \u003d 1101000, mask \u003d 0000111 will result in 1101xxx rule"},{"line_number":449,"context_line":"        (port \u003d 1110111, mask \u003d 0001111 will result in 1110xxx rule)"},{"line_number":450,"context_line":""},{"line_number":451,"context_line":"        * port \u0026 top_bit \u003d\u003d 0 (alternatively port \u0026 top_bit \u003d\u003d top_bit)"},{"line_number":452,"context_line":"        This means that current port register is equal to \u00270\u0027 (\u00271\u0027"}],"source_content_type":"text/x-python","patch_set":18,"id":"1ac06dbe_44c1e82d","line":449,"range":{"start_line":449,"start_character":55,"end_line":449,"end_character":62},"updated":"2016-08-22 12:08:15.000000000","message":"111xxxx ?","commit_id":"34d1d9138381bccaacaa160a79d75fc915d995ae"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"3e9f76bbf5325f633775f0a7b570e7ad6e10051d","unresolved":false,"context_lines":[{"line_number":446,"context_line":"        This corresponds to the masked remainder matching a streak of \u00270\u0027"},{"line_number":447,"context_line":"        (or \u00271\u0027 alternatively)."},{"line_number":448,"context_line":"        Ex. port \u003d 1101000, mask \u003d 0000111 will result in 1101xxx rule"},{"line_number":449,"context_line":"        (port \u003d 1110111, mask \u003d 0001111 will result in 1110xxx rule)"},{"line_number":450,"context_line":""},{"line_number":451,"context_line":"        * port \u0026 top_bit \u003d\u003d 0 (alternatively port \u0026 top_bit \u003d\u003d top_bit)"},{"line_number":452,"context_line":"        This means that current port register is equal to \u00270\u0027 (\u00271\u0027"}],"source_content_type":"text/x-python","patch_set":18,"id":"1ac06dbe_447e08af","line":449,"range":{"start_line":449,"start_character":55,"end_line":449,"end_character":62},"in_reply_to":"1ac06dbe_44c1e82d","updated":"2016-08-22 12:17:27.000000000","message":"should be mask\u003d0000111.","commit_id":"34d1d9138381bccaacaa160a79d75fc915d995ae"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"b8d5f7c1cefd1fb50d6e54b497e29314ae43f6b7","unresolved":false,"context_lines":[{"line_number":453,"context_line":""},{"line_number":454,"context_line":""},{"line_number":455,"context_line":"def _gen_rules_port_max(port_max, top_bit):"},{"line_number":456,"context_line":"    rules \u003d []"},{"line_number":457,"context_line":"    mask \u003d top_bit - 1"},{"line_number":458,"context_line":""},{"line_number":459,"context_line":"    while True:"}],"source_content_type":"text/x-python","patch_set":19,"id":"1ac06dbe_ce9dc90b","line":456,"updated":"2016-08-23 01:53:22.000000000","message":"These two function can be merged, though I thought it is more understandable to write them down this way.\n\nThere are two ways to merge these functions.\n\n1. Add a inverted\u003dFalse arg and conditionalize L.438 and L.446 on it.\n\n2. Tweak _gen_rules_port_min output and do the following:\n\ndef _gen_rules_port_max(port_max, top_bit):\n    common \u003d port_max \u0026 ~(top_bit -1)\n    inverted \u003d _gen_rules_port_min(top_bit - (port_max \u0026 (top_bit - 1) - 1, top_bit)\n    return [_hex_format(common | (top_bit - port - 1), mask) for port, mask in inverted]","commit_id":"1c96b3388464a3bdb39cec4df3841d708e1036b6"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"f8c780afca0468c8ad7092e38f9b01ce988e0384","unresolved":false,"context_lines":[{"line_number":453,"context_line":""},{"line_number":454,"context_line":""},{"line_number":455,"context_line":"def _gen_rules_port_max(port_max, top_bit):"},{"line_number":456,"context_line":"    rules \u003d []"},{"line_number":457,"context_line":"    mask \u003d top_bit - 1"},{"line_number":458,"context_line":""},{"line_number":459,"context_line":"    while True:"}],"source_content_type":"text/x-python","patch_set":19,"id":"1ac06dbe_d31400ea","line":456,"in_reply_to":"1ac06dbe_400eb33b","updated":"2016-08-24 01:23:39.000000000","message":"2 is my favorite but I don\u0027t have strong opinion on this.","commit_id":"1c96b3388464a3bdb39cec4df3841d708e1036b6"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"4993ae9bdae50db3a38c7276e34d2e9a4678417b","unresolved":false,"context_lines":[{"line_number":453,"context_line":""},{"line_number":454,"context_line":""},{"line_number":455,"context_line":"def _gen_rules_port_max(port_max, top_bit):"},{"line_number":456,"context_line":"    rules \u003d []"},{"line_number":457,"context_line":"    mask \u003d top_bit - 1"},{"line_number":458,"context_line":""},{"line_number":459,"context_line":"    while True:"}],"source_content_type":"text/x-python","patch_set":19,"id":"1ac06dbe_400eb33b","line":456,"in_reply_to":"1ac06dbe_ce9dc90b","updated":"2016-08-23 10:25:41.000000000","message":"I\u0027m afraid this won\u0027t help readability. I\u0027d wait for other opinions.","commit_id":"1c96b3388464a3bdb39cec4df3841d708e1036b6"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"b8d5f7c1cefd1fb50d6e54b497e29314ae43f6b7","unresolved":false,"context_lines":[{"line_number":474,"context_line":""},{"line_number":475,"context_line":"def port_rule_masking(port_min, port_max):"},{"line_number":476,"context_line":"    \"\"\""},{"line_number":477,"context_line":"    The algorithm is split in 2 parts: first rules for range [port_min, T)"},{"line_number":478,"context_line":"    are generated, then rules for range [T, port_max], where T is determined by"},{"line_number":479,"context_line":"    initial ports first differing register."},{"line_number":480,"context_line":""}],"source_content_type":"text/x-python","patch_set":19,"id":"1ac06dbe_ce1e695e","line":477,"updated":"2016-08-23 01:53:22.000000000","message":"IMO, such implementation detail can be put into regular comments that start with \"#\".\n\nAs a docstring, it would be more useful to describe why and what, eg.\n\n\"\"\"ovs cannot handle port ranges directly.  A port range must be expressed as a logical or of bit matches and masks.\nThis function takes such a range of ports (inclusive) and returns a set of bit masks.\"\"\"","commit_id":"1c96b3388464a3bdb39cec4df3841d708e1036b6"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"f8c780afca0468c8ad7092e38f9b01ce988e0384","unresolved":false,"context_lines":[{"line_number":474,"context_line":""},{"line_number":475,"context_line":"def port_rule_masking(port_min, port_max):"},{"line_number":476,"context_line":"    \"\"\""},{"line_number":477,"context_line":"    The algorithm is split in 2 parts: first rules for range [port_min, T)"},{"line_number":478,"context_line":"    are generated, then rules for range [T, port_max], where T is determined by"},{"line_number":479,"context_line":"    initial ports first differing register."},{"line_number":480,"context_line":""}],"source_content_type":"text/x-python","patch_set":19,"id":"1ac06dbe_b3fce4b8","line":477,"in_reply_to":"1ac06dbe_23e62115","updated":"2016-08-24 01:23:39.000000000","message":"This whole docstring.","commit_id":"1c96b3388464a3bdb39cec4df3841d708e1036b6"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"ad872c2399fd0d7ebc8b97ea8994472137b4a286","unresolved":false,"context_lines":[{"line_number":474,"context_line":""},{"line_number":475,"context_line":"def port_rule_masking(port_min, port_max):"},{"line_number":476,"context_line":"    \"\"\""},{"line_number":477,"context_line":"    The algorithm is split in 2 parts: first rules for range [port_min, T)"},{"line_number":478,"context_line":"    are generated, then rules for range [T, port_max], where T is determined by"},{"line_number":479,"context_line":"    initial ports first differing register."},{"line_number":480,"context_line":""}],"source_content_type":"text/x-python","patch_set":19,"id":"1ac06dbe_49284a9a","line":477,"in_reply_to":"1ac06dbe_b3fce4b8","updated":"2016-08-24 11:24:50.000000000","message":"Ok, got it.","commit_id":"1c96b3388464a3bdb39cec4df3841d708e1036b6"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"4993ae9bdae50db3a38c7276e34d2e9a4678417b","unresolved":false,"context_lines":[{"line_number":474,"context_line":""},{"line_number":475,"context_line":"def port_rule_masking(port_min, port_max):"},{"line_number":476,"context_line":"    \"\"\""},{"line_number":477,"context_line":"    The algorithm is split in 2 parts: first rules for range [port_min, T)"},{"line_number":478,"context_line":"    are generated, then rules for range [T, port_max], where T is determined by"},{"line_number":479,"context_line":"    initial ports first differing register."},{"line_number":480,"context_line":""}],"source_content_type":"text/x-python","patch_set":19,"id":"1ac06dbe_23e62115","line":477,"in_reply_to":"1ac06dbe_ce1e695e","updated":"2016-08-23 10:25:41.000000000","message":"By implementation detail you mean [port_min, T) range or\\and the part about how the algorithm works?","commit_id":"1c96b3388464a3bdb39cec4df3841d708e1036b6"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"b8d5f7c1cefd1fb50d6e54b497e29314ae43f6b7","unresolved":false,"context_lines":[{"line_number":512,"context_line":"    top_bit \u003d 1"},{"line_number":513,"context_line":"    while top_bit \u003c\u003d bitdiff:"},{"line_number":514,"context_line":"        top_bit \u003c\u003c\u003d 1"},{"line_number":515,"context_line":"    if port_min \u003d\u003d 0 and port_max \u003d\u003d top_bit - 1:"},{"line_number":516,"context_line":"        # special case, full range [0, 2^k-1]"},{"line_number":517,"context_line":"        return [_hex_format(0, port_max)]"},{"line_number":518,"context_line":""}],"source_content_type":"text/x-python","patch_set":19,"id":"1ac06dbe_0b7a33bd","line":515,"updated":"2016-08-23 01:53:22.000000000","message":"You should check against port_min \u0026 (top_bit - 1) \u003d\u003d 0 and port_max \u0026 (top_bit - 1) \u003d\u003d (top_bit - 1) instead. The above case is a special case of this.\n\nUsually a port range can be divided into two, but when it spans entire range(N * (2 ** M), (N + 1) * (2 ** M)) it needs to be expressed as a single bit mask.","commit_id":"1c96b3388464a3bdb39cec4df3841d708e1036b6"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"4993ae9bdae50db3a38c7276e34d2e9a4678417b","unresolved":false,"context_lines":[{"line_number":512,"context_line":"    top_bit \u003d 1"},{"line_number":513,"context_line":"    while top_bit \u003c\u003d bitdiff:"},{"line_number":514,"context_line":"        top_bit \u003c\u003c\u003d 1"},{"line_number":515,"context_line":"    if port_min \u003d\u003d 0 and port_max \u003d\u003d top_bit - 1:"},{"line_number":516,"context_line":"        # special case, full range [0, 2^k-1]"},{"line_number":517,"context_line":"        return [_hex_format(0, port_max)]"},{"line_number":518,"context_line":""}],"source_content_type":"text/x-python","patch_set":19,"id":"1ac06dbe_c35f4de3","line":515,"in_reply_to":"1ac06dbe_0b7a33bd","updated":"2016-08-23 10:25:41.000000000","message":"If my calculations are right, then the only way port_min \u0026 (top_bit - 1) \u003d\u003d 0 is when port_min \u003d\u003d 0. Any other conjunction with logical 1 will result in value \u003e 0.\n\nThe same stands for port_max \u0026 (top_bit - 1) \u003d\u003d (top_bit - 1).\n\nIf I\u0027m nuts and blindingly missing something, then we must surely add this to test coverage.","commit_id":"1c96b3388464a3bdb39cec4df3841d708e1036b6"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"ad872c2399fd0d7ebc8b97ea8994472137b4a286","unresolved":false,"context_lines":[{"line_number":512,"context_line":"    top_bit \u003d 1"},{"line_number":513,"context_line":"    while top_bit \u003c\u003d bitdiff:"},{"line_number":514,"context_line":"        top_bit \u003c\u003c\u003d 1"},{"line_number":515,"context_line":"    if port_min \u003d\u003d 0 and port_max \u003d\u003d top_bit - 1:"},{"line_number":516,"context_line":"        # special case, full range [0, 2^k-1]"},{"line_number":517,"context_line":"        return [_hex_format(0, port_max)]"},{"line_number":518,"context_line":""}],"source_content_type":"text/x-python","patch_set":19,"id":"1ac06dbe_c92d5aff","line":515,"in_reply_to":"1ac06dbe_3392b44c","updated":"2016-08-24 11:24:50.000000000","message":"Sorry for being stubborn, you are right here, I ignored the common part. I\u0027ll add a test for this.","commit_id":"1c96b3388464a3bdb39cec4df3841d708e1036b6"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"f8c780afca0468c8ad7092e38f9b01ce988e0384","unresolved":false,"context_lines":[{"line_number":512,"context_line":"    top_bit \u003d 1"},{"line_number":513,"context_line":"    while top_bit \u003c\u003d bitdiff:"},{"line_number":514,"context_line":"        top_bit \u003c\u003c\u003d 1"},{"line_number":515,"context_line":"    if port_min \u003d\u003d 0 and port_max \u003d\u003d top_bit - 1:"},{"line_number":516,"context_line":"        # special case, full range [0, 2^k-1]"},{"line_number":517,"context_line":"        return [_hex_format(0, port_max)]"},{"line_number":518,"context_line":""}],"source_content_type":"text/x-python","patch_set":19,"id":"1ac06dbe_3392b44c","line":515,"in_reply_to":"1ac06dbe_c35f4de3","updated":"2016-08-24 01:23:39.000000000","message":"In previous patchsets, the comparison was against lower and upper, not port_min and port_max.\n\nPlease look at test failures, or substitute port_min\u003d8 and port_max\u003d11 and follow the algorithm and do the math.","commit_id":"1c96b3388464a3bdb39cec4df3841d708e1036b6"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"151cbbfdc01d64e1bed77e0744524064da2a3ee0","unresolved":false,"context_lines":[{"line_number":445,"context_line":"        mask \u003e\u003e\u003d 1"},{"line_number":446,"context_line":"        if (port_min \u0026 top_bit) \u003d\u003d 0:"},{"line_number":447,"context_line":"            # matched next \u00270\u0027 in port_min to substitute for \u00271\u0027 in resulting"},{"line_number":448,"context_line":"            # ovs rule"},{"line_number":449,"context_line":"            rules.append(_hex_format(port_min \u0026 ~mask | top_bit, mask))"},{"line_number":450,"context_line":"        # range(port_min, (port_min | mask) + 1) hasn\u0027t changed in this"},{"line_number":451,"context_line":"        # iteration if the above if-clause is false"}],"source_content_type":"text/x-python","patch_set":22,"id":"1ac06dbe_1ccadb4f","line":448,"updated":"2016-08-25 01:21:12.000000000","message":"ovs is still here. :)","commit_id":"e84c670b7903771b5170db4984eea8fb5c12ea67"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"151cbbfdc01d64e1bed77e0744524064da2a3ee0","unresolved":false,"context_lines":[{"line_number":467,"context_line":"        mask \u003e\u003e\u003d 1"},{"line_number":468,"context_line":"        if (port_max \u0026 top_bit) \u003d\u003d top_bit:"},{"line_number":469,"context_line":"            # matched next \u00271\u0027 in port_max to substitute for \u00270\u0027 in resulting"},{"line_number":470,"context_line":"            # ovs rule"},{"line_number":471,"context_line":"            rules.append(_hex_format(port_max \u0026 ~mask \u0026 ~top_bit, mask))"},{"line_number":472,"context_line":"    return rules"},{"line_number":473,"context_line":""}],"source_content_type":"text/x-python","patch_set":22,"id":"1ac06dbe_3cc1972f","line":470,"updated":"2016-08-25 01:21:12.000000000","message":"ditto","commit_id":"e84c670b7903771b5170db4984eea8fb5c12ea67"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"fd98548f8e9047d61dcdfba5c21c908b16e05ea6","unresolved":false,"context_lines":[{"line_number":474,"context_line":""},{"line_number":475,"context_line":"def port_rule_masking(port_min, port_max):"},{"line_number":476,"context_line":"    \"\"\""},{"line_number":477,"context_line":"    Ovs cannot handle port ranges directly: a port range must be expressed as"},{"line_number":478,"context_line":"    a set of bitwise matches and masks. This function takes a range"},{"line_number":479,"context_line":"    of ports [port_min, port_max] and returns a set of bitwise matches that"},{"line_number":480,"context_line":"    cover the given range."}],"source_content_type":"text/x-python","patch_set":22,"id":"1ac06dbe_cf2a702f","line":477,"range":{"start_line":477,"start_character":4,"end_line":477,"end_character":7},"updated":"2016-08-24 13:55:46.000000000","message":"what does a common generic utility method have to do with ovs? Will you need to update this comment if and when ovs does support this?","commit_id":"e84c670b7903771b5170db4984eea8fb5c12ea67"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"151cbbfdc01d64e1bed77e0744524064da2a3ee0","unresolved":false,"context_lines":[{"line_number":474,"context_line":""},{"line_number":475,"context_line":"def port_rule_masking(port_min, port_max):"},{"line_number":476,"context_line":"    \"\"\""},{"line_number":477,"context_line":"    Ovs cannot handle port ranges directly: a port range must be expressed as"},{"line_number":478,"context_line":"    a set of bitwise matches and masks. This function takes a range"},{"line_number":479,"context_line":"    of ports [port_min, port_max] and returns a set of bitwise matches that"},{"line_number":480,"context_line":"    cover the given range."}],"source_content_type":"text/x-python","patch_set":22,"id":"1ac06dbe_fc69bf26","line":477,"range":{"start_line":477,"start_character":4,"end_line":477,"end_character":7},"in_reply_to":"1ac06dbe_2751960f","updated":"2016-08-25 01:21:12.000000000","message":"What this function does is generic enough to be put into neutron/common, but\nI wonder if any port filter implementation other than openflow/ovs wants bitmask representation.","commit_id":"e84c670b7903771b5170db4984eea8fb5c12ea67"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"ec50ad2cf89ecbb6eb16c4460c3a566fa3af9729","unresolved":false,"context_lines":[{"line_number":474,"context_line":""},{"line_number":475,"context_line":"def port_rule_masking(port_min, port_max):"},{"line_number":476,"context_line":"    \"\"\""},{"line_number":477,"context_line":"    Ovs cannot handle port ranges directly: a port range must be expressed as"},{"line_number":478,"context_line":"    a set of bitwise matches and masks. This function takes a range"},{"line_number":479,"context_line":"    of ports [port_min, port_max] and returns a set of bitwise matches that"},{"line_number":480,"context_line":"    cover the given range."}],"source_content_type":"text/x-python","patch_set":22,"id":"1ac06dbe_2751960f","line":477,"range":{"start_line":477,"start_character":4,"end_line":477,"end_character":7},"in_reply_to":"1ac06dbe_cf2a702f","updated":"2016-08-24 19:41:17.000000000","message":"Removed all ovs related text.","commit_id":"e84c670b7903771b5170db4984eea8fb5c12ea67"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"48744da6085a07923d74b923fda24361fda2da2e","unresolved":false,"context_lines":[{"line_number":522,"context_line":"    if (port_min \u0026 (top_bit - 1) \u003d\u003d 0 and"},{"line_number":523,"context_line":"            port_max \u0026 (top_bit - 1) \u003d\u003d top_bit - 1):"},{"line_number":524,"context_line":"        # special case, range of 2^k ports is covered"},{"line_number":525,"context_line":"        return [_hex_format(port_min \u0026 ~(top_bit - 1), top_bit - 1)]"},{"line_number":526,"context_line":""},{"line_number":527,"context_line":"    top_bit \u003e\u003e\u003d 1"},{"line_number":528,"context_line":"    rules \u003d []"}],"source_content_type":"text/x-python","patch_set":23,"id":"1ac06dbe_3c5fd70f","line":525,"range":{"start_line":525,"start_character":28,"end_line":525,"end_character":53},"updated":"2016-08-25 01:15:47.000000000","message":"this is always equal to port_min. this bitwise and is redundant.","commit_id":"895a274fe9711a9755bac8ae0834b0777f5b02c1"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"f279fcd3a6fa35aac836dee7a9d72ddc79a73c5f","unresolved":false,"context_lines":[{"line_number":428,"context_line":"    return hex_str(port)"},{"line_number":429,"context_line":""},{"line_number":430,"context_line":""},{"line_number":431,"context_line":"def _gen_rules_port_min(port_min, top_bit):"},{"line_number":432,"context_line":"    rules \u003d []"},{"line_number":433,"context_line":"    mask \u003d top_bit - 1"},{"line_number":434,"context_line":""}],"source_content_type":"text/x-python","patch_set":24,"id":"fa7ab95a_a121834f","line":431,"updated":"2016-08-29 08:50:41.000000000","message":"\"\"\"Encodes a port range range(port_min, (port_min | (top_bit - 1)) + 1) into a set of bit value/masks.\"\"\"","commit_id":"761baf9859ca9f01b26852514fb0a53af8db407d"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"8c36c270f9ed7c344ab9f0f3ad040876edbb7c4a","unresolved":false,"context_lines":[{"line_number":428,"context_line":"    return hex_str(port)"},{"line_number":429,"context_line":""},{"line_number":430,"context_line":""},{"line_number":431,"context_line":"def _gen_rules_port_min(port_min, top_bit):"},{"line_number":432,"context_line":"    rules \u003d []"},{"line_number":433,"context_line":"    mask \u003d top_bit - 1"},{"line_number":434,"context_line":""}],"source_content_type":"text/x-python","patch_set":24,"id":"fa7ab95a_11da444c","line":431,"in_reply_to":"fa7ab95a_4a6b5285","updated":"2016-08-30 02:06:04.000000000","message":"oh my! I didn\u0027t know that. thanks.","commit_id":"761baf9859ca9f01b26852514fb0a53af8db407d"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"2623fabb3455fb367102433a0d25568ab9861cf7","unresolved":false,"context_lines":[{"line_number":428,"context_line":"    return hex_str(port)"},{"line_number":429,"context_line":""},{"line_number":430,"context_line":""},{"line_number":431,"context_line":"def _gen_rules_port_min(port_min, top_bit):"},{"line_number":432,"context_line":"    rules \u003d []"},{"line_number":433,"context_line":"    mask \u003d top_bit - 1"},{"line_number":434,"context_line":""}],"source_content_type":"text/x-python","patch_set":24,"id":"fa7ab95a_4a6b5285","line":431,"in_reply_to":"fa7ab95a_a121834f","updated":"2016-08-29 16:01:27.000000000","message":"Nitpick to this comment: As per pep256 it should be in imperative :)","commit_id":"761baf9859ca9f01b26852514fb0a53af8db407d"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"f279fcd3a6fa35aac836dee7a9d72ddc79a73c5f","unresolved":false,"context_lines":[{"line_number":483,"context_line":""},{"line_number":484,"context_line":"    # The algorithm is split in 2 parts: first rules for range [port_min, T)"},{"line_number":485,"context_line":"    # are generated, then rules for range [T, port_max], where T is determined"},{"line_number":486,"context_line":"    # by initial ports first differing register."},{"line_number":487,"context_line":""},{"line_number":488,"context_line":"    # Each part starts with setting up mask and top_bit variables to their"},{"line_number":489,"context_line":"    # maximum. Top_bit has the form (1000000) with \u00271\u0027 pointing to the"}],"source_content_type":"text/x-python","patch_set":24,"id":"fa7ab95a_6113fb66","line":486,"updated":"2016-08-29 08:50:41.000000000","message":"The definition of T should be given.\n\nT equals to (port_max \u0026 ~ ((1 \u003c\u003c (port_min ^ port_max).bit_length() - 1) - 1), or\n\nAssume port_min and port_max has a form abcwxyz and abcpqrs, respectively, in a binary notation, each letter represents 0 or 1.  T has a form abc1000.  (Note that when w !\u003d p, w \u003d\u003d 0 and p \u003d\u003d 1 hold.)","commit_id":"761baf9859ca9f01b26852514fb0a53af8db407d"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"f279fcd3a6fa35aac836dee7a9d72ddc79a73c5f","unresolved":false,"context_lines":[{"line_number":490,"context_line":"    # register being processed, while mask has the form (0111111) with \u00271\u0027"},{"line_number":491,"context_line":"    # showing possible range to be covered."},{"line_number":492,"context_line":"    # With each rule generation cycle, mask and top_bit are bit shifted to the"},{"line_number":493,"context_line":"    # right. When top_bit reaches 0 it means that last register was processed."},{"line_number":494,"context_line":""},{"line_number":495,"context_line":"    # Every cycle step checks the following conditions:"},{"line_number":496,"context_line":""}],"source_content_type":"text/x-python","patch_set":24,"id":"fa7ab95a_84ce4db2","line":493,"updated":"2016-08-29 08:50:41.000000000","message":"This describes how bit shifts are performed but doesn\u0027t describe why this gives correct results.","commit_id":"761baf9859ca9f01b26852514fb0a53af8db407d"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"f279fcd3a6fa35aac836dee7a9d72ddc79a73c5f","unresolved":false,"context_lines":[{"line_number":492,"context_line":"    # With each rule generation cycle, mask and top_bit are bit shifted to the"},{"line_number":493,"context_line":"    # right. When top_bit reaches 0 it means that last register was processed."},{"line_number":494,"context_line":""},{"line_number":495,"context_line":"    # Every cycle step checks the following conditions:"},{"line_number":496,"context_line":""},{"line_number":497,"context_line":"    #     * port \u0026 mask \u003d\u003d 0 (alternatively port \u0026 mask \u003d\u003d mask)"},{"line_number":498,"context_line":"    #     This corresponds to the masked remainder matching a streak of \u00270\u0027"}],"source_content_type":"text/x-python","patch_set":24,"id":"fa7ab95a_e4f2b9d1","line":495,"updated":"2016-08-29 08:50:41.000000000","message":"L436 comment says the remaining port ranges to be encoded, but it\u0027s not quite explicit.","commit_id":"761baf9859ca9f01b26852514fb0a53af8db407d"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"5a0815af95ae6f8938aa4b603fdba71725153429","unresolved":false,"context_lines":[{"line_number":522,"context_line":"    if (port_min \u0026 (top_bit - 1) \u003d\u003d 0 and"},{"line_number":523,"context_line":"            port_max \u0026 (top_bit - 1) \u003d\u003d top_bit - 1):"},{"line_number":524,"context_line":"        # special case, range of 2^k ports is covered"},{"line_number":525,"context_line":"        return [_hex_format(port_min \u0026 ~(top_bit - 1), top_bit - 1)]"},{"line_number":526,"context_line":""},{"line_number":527,"context_line":"    top_bit \u003e\u003e\u003d 1"},{"line_number":528,"context_line":"    rules \u003d []"}],"source_content_type":"text/x-python","patch_set":24,"id":"fa7ab95a_78acfeed","line":525,"range":{"start_line":525,"start_character":37,"end_line":525,"end_character":53},"updated":"2016-08-26 01:36:22.000000000","message":"This is redundant. please remove.","commit_id":"761baf9859ca9f01b26852514fb0a53af8db407d"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"9b619c7fddd4e0f4fe6723053135c599a63a8a0e","unresolved":false,"context_lines":[{"line_number":459,"context_line":""},{"line_number":460,"context_line":"def _gen_rules_port_max(port_max, top_bit):"},{"line_number":461,"context_line":"    \"\"\""},{"line_number":462,"context_line":"    Encode a port range range(port_min | (top_bit - 1)) + 1, port_max + 1) into"},{"line_number":463,"context_line":"    a set of bit value/masks."},{"line_number":464,"context_line":"    \"\"\""},{"line_number":465,"context_line":"    rules \u003d []"}],"source_content_type":"text/x-python","patch_set":25,"id":"fa7ab95a_4c95c086","line":462,"range":{"start_line":462,"start_character":30,"end_line":462,"end_character":60},"updated":"2016-08-31 04:39:15.000000000","message":"This function has nothing to do with port_min. Please use port_max to describe the range.","commit_id":"54a2f60009ac3456447ec733767a40d9d1cd86f0"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"023ae8c9b2eff8a9844202dae479afe1a1f5ffd6","unresolved":false,"context_lines":[{"line_number":459,"context_line":""},{"line_number":460,"context_line":"def _gen_rules_port_max(port_max, top_bit):"},{"line_number":461,"context_line":"    \"\"\""},{"line_number":462,"context_line":"    Encode a port range range(port_min | (top_bit - 1)) + 1, port_max + 1) into"},{"line_number":463,"context_line":"    a set of bit value/masks."},{"line_number":464,"context_line":"    \"\"\""},{"line_number":465,"context_line":"    rules \u003d []"}],"source_content_type":"text/x-python","patch_set":25,"id":"fa7ab95a_d2c9505c","line":462,"range":{"start_line":462,"start_character":30,"end_line":462,"end_character":60},"in_reply_to":"fa7ab95a_41565307","updated":"2016-08-31 12:35:56.000000000","message":"Nevermind, ignore my previous comment. Will be done","commit_id":"54a2f60009ac3456447ec733767a40d9d1cd86f0"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"015e64ebcbee9a6adc65d131a7521450490ec04d","unresolved":false,"context_lines":[{"line_number":459,"context_line":""},{"line_number":460,"context_line":"def _gen_rules_port_max(port_max, top_bit):"},{"line_number":461,"context_line":"    \"\"\""},{"line_number":462,"context_line":"    Encode a port range range(port_min | (top_bit - 1)) + 1, port_max + 1) into"},{"line_number":463,"context_line":"    a set of bit value/masks."},{"line_number":464,"context_line":"    \"\"\""},{"line_number":465,"context_line":"    rules \u003d []"}],"source_content_type":"text/x-python","patch_set":25,"id":"fa7ab95a_41565307","line":462,"range":{"start_line":462,"start_character":30,"end_line":462,"end_character":60},"in_reply_to":"fa7ab95a_4c95c086","updated":"2016-08-31 11:01:27.000000000","message":"I\u0027m afraid I\u0027ll have to paraphrase the whole part, as per my explanation this function processes range [port_min, T).","commit_id":"54a2f60009ac3456447ec733767a40d9d1cd86f0"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"9b619c7fddd4e0f4fe6723053135c599a63a8a0e","unresolved":false,"context_lines":[{"line_number":519,"context_line":"    # variables to their maximum. Top_bit has the form (1000000) with \u00271\u0027"},{"line_number":520,"context_line":"    # pointing to the register being processed, while mask has the form"},{"line_number":521,"context_line":"    # (0111111) with \u00271\u0027 showing possible range to be covered."},{"line_number":522,"context_line":"    # With each rule generation cycle, mask and top_bit are bit shifted to the"},{"line_number":523,"context_line":"    # right. When top_bit reaches 0 it means that last register was processed."},{"line_number":524,"context_line":""},{"line_number":525,"context_line":"    # Every k step checks the following conditions, 1\u003c\u003dk\u003c\u003dn:"}],"source_content_type":"text/x-python","patch_set":25,"id":"fa7ab95a_5f6484e4","line":522,"updated":"2016-08-31 04:39:15.000000000","message":"L522-549 comment is better to be moved under _gen_rules_port_min, IMO.","commit_id":"54a2f60009ac3456447ec733767a40d9d1cd86f0"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"015e64ebcbee9a6adc65d131a7521450490ec04d","unresolved":false,"context_lines":[{"line_number":519,"context_line":"    # variables to their maximum. Top_bit has the form (1000000) with \u00271\u0027"},{"line_number":520,"context_line":"    # pointing to the register being processed, while mask has the form"},{"line_number":521,"context_line":"    # (0111111) with \u00271\u0027 showing possible range to be covered."},{"line_number":522,"context_line":"    # With each rule generation cycle, mask and top_bit are bit shifted to the"},{"line_number":523,"context_line":"    # right. When top_bit reaches 0 it means that last register was processed."},{"line_number":524,"context_line":""},{"line_number":525,"context_line":"    # Every k step checks the following conditions, 1\u003c\u003dk\u003c\u003dn:"}],"source_content_type":"text/x-python","patch_set":25,"id":"fa7ab95a_a673b5e6","line":522,"in_reply_to":"fa7ab95a_5f6484e4","updated":"2016-08-31 11:01:27.000000000","message":"I think it\u0027s time to move these lines into _gen_rules_port_* functions (and separate properly conditions being checked).","commit_id":"54a2f60009ac3456447ec733767a40d9d1cd86f0"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"9b619c7fddd4e0f4fe6723053135c599a63a8a0e","unresolved":false,"context_lines":[{"line_number":522,"context_line":"    # With each rule generation cycle, mask and top_bit are bit shifted to the"},{"line_number":523,"context_line":"    # right. When top_bit reaches 0 it means that last register was processed."},{"line_number":524,"context_line":""},{"line_number":525,"context_line":"    # Every k step checks the following conditions, 1\u003c\u003dk\u003c\u003dn:"},{"line_number":526,"context_line":""},{"line_number":527,"context_line":"    #     * port \u0026 mask \u003d\u003d 0 for range [port_min, T)"},{"line_number":528,"context_line":"    #       (port \u0026 mask \u003d\u003d mask for range [T, port_max])"}],"source_content_type":"text/x-python","patch_set":25,"id":"fa7ab95a_7f6148d3","line":525,"updated":"2016-08-31 04:39:15.000000000","message":"No definition of k is given.\n\nIt seems k starts from (n-m) and iterates down to 1. right?","commit_id":"54a2f60009ac3456447ec733767a40d9d1cd86f0"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"015e64ebcbee9a6adc65d131a7521450490ec04d","unresolved":false,"context_lines":[{"line_number":522,"context_line":"    # With each rule generation cycle, mask and top_bit are bit shifted to the"},{"line_number":523,"context_line":"    # right. When top_bit reaches 0 it means that last register was processed."},{"line_number":524,"context_line":""},{"line_number":525,"context_line":"    # Every k step checks the following conditions, 1\u003c\u003dk\u003c\u003dn:"},{"line_number":526,"context_line":""},{"line_number":527,"context_line":"    #     * port \u0026 mask \u003d\u003d 0 for range [port_min, T)"},{"line_number":528,"context_line":"    #       (port \u0026 mask \u003d\u003d mask for range [T, port_max])"}],"source_content_type":"text/x-python","patch_set":25,"id":"fa7ab95a_d74dcdc5","line":525,"in_reply_to":"fa7ab95a_7f6148d3","updated":"2016-08-31 11:01:27.000000000","message":"iteration k, \"every k step\", so it is 1\u003c\u003dk\u003c\u003dn as mentioned on L525.","commit_id":"54a2f60009ac3456447ec733767a40d9d1cd86f0"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"18a66e834b9f9cbcf0e7687b6bca61564e45fbe4","unresolved":false,"context_lines":[{"line_number":522,"context_line":"    # With each rule generation cycle, mask and top_bit are bit shifted to the"},{"line_number":523,"context_line":"    # right. When top_bit reaches 0 it means that last register was processed."},{"line_number":524,"context_line":""},{"line_number":525,"context_line":"    # Every k step checks the following conditions, 1\u003c\u003dk\u003c\u003dn:"},{"line_number":526,"context_line":""},{"line_number":527,"context_line":"    #     * port \u0026 mask \u003d\u003d 0 for range [port_min, T)"},{"line_number":528,"context_line":"    #       (port \u0026 mask \u003d\u003d mask for range [T, port_max])"}],"source_content_type":"text/x-python","patch_set":25,"id":"fa7ab95a_534c6276","line":525,"in_reply_to":"fa7ab95a_d74dcdc5","updated":"2016-08-31 13:09:56.000000000","message":"And again nevermind, this \"k step\" stuff does more harm than good.","commit_id":"54a2f60009ac3456447ec733767a40d9d1cd86f0"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"9b619c7fddd4e0f4fe6723053135c599a63a8a0e","unresolved":false,"context_lines":[{"line_number":524,"context_line":""},{"line_number":525,"context_line":"    # Every k step checks the following conditions, 1\u003c\u003dk\u003c\u003dn:"},{"line_number":526,"context_line":""},{"line_number":527,"context_line":"    #     * port \u0026 mask \u003d\u003d 0 for range [port_min, T)"},{"line_number":528,"context_line":"    #       (port \u0026 mask \u003d\u003d mask for range [T, port_max])"},{"line_number":529,"context_line":"    #     This means that remaining (n-k) bits are equal to \u00270\u0027"},{"line_number":530,"context_line":"    #     (\u00271\u0027 alternatively) and can be covered by a single port/mask rule."}],"source_content_type":"text/x-python","patch_set":25,"id":"fa7ab95a_9f5e0c11","line":527,"updated":"2016-08-31 04:39:15.000000000","message":"One wouldn\u0027t expect T changes during iterations.\n\nIt would be better to write as range [port_min, port_min | ((1 \u003c\u003c k) - 1)]","commit_id":"54a2f60009ac3456447ec733767a40d9d1cd86f0"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"015e64ebcbee9a6adc65d131a7521450490ec04d","unresolved":false,"context_lines":[{"line_number":524,"context_line":""},{"line_number":525,"context_line":"    # Every k step checks the following conditions, 1\u003c\u003dk\u003c\u003dn:"},{"line_number":526,"context_line":""},{"line_number":527,"context_line":"    #     * port \u0026 mask \u003d\u003d 0 for range [port_min, T)"},{"line_number":528,"context_line":"    #       (port \u0026 mask \u003d\u003d mask for range [T, port_max])"},{"line_number":529,"context_line":"    #     This means that remaining (n-k) bits are equal to \u00270\u0027"},{"line_number":530,"context_line":"    #     (\u00271\u0027 alternatively) and can be covered by a single port/mask rule."}],"source_content_type":"text/x-python","patch_set":25,"id":"fa7ab95a_86da31e8","line":527,"in_reply_to":"fa7ab95a_9f5e0c11","updated":"2016-08-31 11:01:27.000000000","message":"In algorithm description I use T as the value that initially divides the whole range, so it is calculated only once (as described in L506-516). \n\nHere [port_min, T) and [T, port_max] define ranges that will be processed by _gen_rules_port_min and _gen_rules_port_max accordingly.","commit_id":"54a2f60009ac3456447ec733767a40d9d1cd86f0"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"9b619c7fddd4e0f4fe6723053135c599a63a8a0e","unresolved":false,"context_lines":[{"line_number":543,"context_line":"    #     to 0. Then P \u003d p_k | top_bit (p_k | ~top_bit alternatively)."},{"line_number":544,"context_line":""},{"line_number":545,"context_line":"    #     For example:"},{"line_number":546,"context_line":"    #     min_port \u003d 1101000, k\u003d3, top_bit \u003d 10000."},{"line_number":547,"context_line":"    #     This will result in 111xxxx or 0x0070/fff0 rule."},{"line_number":548,"context_line":"    #     max_port \u003d 1110111, k\u003d2, top_bit \u003d 100000."},{"line_number":549,"context_line":"    #     This will result in 10xxxxx or 0x0040/ffe0 rule."},{"line_number":550,"context_line":""},{"line_number":551,"context_line":"    # Check port_max \u003e\u003d port_min."},{"line_number":552,"context_line":"    if port_max \u003c port_min:"}],"source_content_type":"text/x-python","patch_set":25,"id":"fa7ab95a_5f3644e8","line":549,"range":{"start_line":546,"start_character":1,"end_line":549,"end_character":58},"updated":"2016-08-31 04:39:15.000000000","message":"These examples look strange.\n\nIMO, it\u0027s better to let examples iterate through the loops. eg:\n\n_gen_rules_port_min(0b1101010, 0b10000)\ngives nothing in the first iteration (k\u003d4)\ngives 0b1101100/0xfffc in the second iteration (k\u003d3) and the remaining range is [0b1101010, 0b1101100)\n...","commit_id":"54a2f60009ac3456447ec733767a40d9d1cd86f0"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"015e64ebcbee9a6adc65d131a7521450490ec04d","unresolved":false,"context_lines":[{"line_number":543,"context_line":"    #     to 0. Then P \u003d p_k | top_bit (p_k | ~top_bit alternatively)."},{"line_number":544,"context_line":""},{"line_number":545,"context_line":"    #     For example:"},{"line_number":546,"context_line":"    #     min_port \u003d 1101000, k\u003d3, top_bit \u003d 10000."},{"line_number":547,"context_line":"    #     This will result in 111xxxx or 0x0070/fff0 rule."},{"line_number":548,"context_line":"    #     max_port \u003d 1110111, k\u003d2, top_bit \u003d 100000."},{"line_number":549,"context_line":"    #     This will result in 10xxxxx or 0x0040/ffe0 rule."},{"line_number":550,"context_line":""},{"line_number":551,"context_line":"    # Check port_max \u003e\u003d port_min."},{"line_number":552,"context_line":"    if port_max \u003c port_min:"}],"source_content_type":"text/x-python","patch_set":25,"id":"fa7ab95a_01fe0b05","line":549,"range":{"start_line":546,"start_character":1,"end_line":549,"end_character":58},"in_reply_to":"fa7ab95a_5f3644e8","updated":"2016-08-31 11:01:27.000000000","message":"Thanks, iterating this way looks more self-explanatory.","commit_id":"54a2f60009ac3456447ec733767a40d9d1cd86f0"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"943b2682d2e178a2cd8bc3540c83c5f4c31f8408","unresolved":false,"context_lines":[{"line_number":448,"context_line":"    #     * port \u0026 mask \u003d\u003d 0"},{"line_number":449,"context_line":"    #     This means that remaining bits k..0 are equal to \u00270\u0027 and can be"},{"line_number":450,"context_line":"    #     covered by a single port/mask rule."},{"line_number":451,"context_line":""},{"line_number":452,"context_line":"    #     * port \u0026 top_bit \u003d\u003d 0"},{"line_number":453,"context_line":"    #     This means that kth port bit is equal to \u00270\u0027. By setting it to \u00271\u0027"},{"line_number":454,"context_line":"    #     and masking other (k-1) bits all ports in range"}],"source_content_type":"text/x-python","patch_set":27,"id":"fa7ab95a_0526db67","line":451,"updated":"2016-09-01 07:10:47.000000000","message":"In the code, top_bit and mask are shifted here.","commit_id":"4018e6fac3802822971efd8c3b15eaf7c73bfbb5"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"fe80b31ef06758320a01e516803c5ddd45e45872","unresolved":false,"context_lines":[{"line_number":448,"context_line":"    #     * port \u0026 mask \u003d\u003d 0"},{"line_number":449,"context_line":"    #     This means that remaining bits k..0 are equal to \u00270\u0027 and can be"},{"line_number":450,"context_line":"    #     covered by a single port/mask rule."},{"line_number":451,"context_line":""},{"line_number":452,"context_line":"    #     * port \u0026 top_bit \u003d\u003d 0"},{"line_number":453,"context_line":"    #     This means that kth port bit is equal to \u00270\u0027. By setting it to \u00271\u0027"},{"line_number":454,"context_line":"    #     and masking other (k-1) bits all ports in range"}],"source_content_type":"text/x-python","patch_set":27,"id":"fa7ab95a_ec68f0bc","line":451,"in_reply_to":"fa7ab95a_0526db67","updated":"2016-09-01 12:10:43.000000000","message":"Right, I\u0027ll mention this detail, thanks.","commit_id":"4018e6fac3802822971efd8c3b15eaf7c73bfbb5"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"943b2682d2e178a2cd8bc3540c83c5f4c31f8408","unresolved":false,"context_lines":[{"line_number":461,"context_line":"    # * step 1, k\u003d5"},{"line_number":462,"context_line":"    #   top_bit\u003d0100000, mask\u003d0011111 -\u003e no match"},{"line_number":463,"context_line":"    # * step 2, k\u003d4"},{"line_number":464,"context_line":"    #   top_bit\u003d0010000, mask\u003d0001111 -\u003e condition 2 matches -\u003e 011xxxx or"},{"line_number":465,"context_line":"    #                                                           0x0030/fff0"},{"line_number":466,"context_line":"    # * step 3, k\u003d3"},{"line_number":467,"context_line":"    #   top_bit\u003d0001000, mask\u003d0000111 -\u003e condition 1 matches -\u003e 0101xxx or"}],"source_content_type":"text/x-python","patch_set":27,"id":"fa7ab95a_255aff2a","line":464,"updated":"2016-09-01 07:10:47.000000000","message":"\"condition 2\" is not defined.","commit_id":"4018e6fac3802822971efd8c3b15eaf7c73bfbb5"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"fe80b31ef06758320a01e516803c5ddd45e45872","unresolved":false,"context_lines":[{"line_number":461,"context_line":"    # * step 1, k\u003d5"},{"line_number":462,"context_line":"    #   top_bit\u003d0100000, mask\u003d0011111 -\u003e no match"},{"line_number":463,"context_line":"    # * step 2, k\u003d4"},{"line_number":464,"context_line":"    #   top_bit\u003d0010000, mask\u003d0001111 -\u003e condition 2 matches -\u003e 011xxxx or"},{"line_number":465,"context_line":"    #                                                           0x0030/fff0"},{"line_number":466,"context_line":"    # * step 3, k\u003d3"},{"line_number":467,"context_line":"    #   top_bit\u003d0001000, mask\u003d0000111 -\u003e condition 1 matches -\u003e 0101xxx or"}],"source_content_type":"text/x-python","patch_set":27,"id":"fa7ab95a_d17027df","line":464,"in_reply_to":"fa7ab95a_255aff2a","updated":"2016-09-01 12:10:43.000000000","message":"Hm, well, I meant conditions L448-457. I wonder if changing bullets to numbers will help.","commit_id":"4018e6fac3802822971efd8c3b15eaf7c73bfbb5"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"943b2682d2e178a2cd8bc3540c83c5f4c31f8408","unresolved":false,"context_lines":[{"line_number":464,"context_line":"    #   top_bit\u003d0010000, mask\u003d0001111 -\u003e condition 2 matches -\u003e 011xxxx or"},{"line_number":465,"context_line":"    #                                                           0x0030/fff0"},{"line_number":466,"context_line":"    # * step 3, k\u003d3"},{"line_number":467,"context_line":"    #   top_bit\u003d0001000, mask\u003d0000111 -\u003e condition 1 matches -\u003e 0101xxx or"},{"line_number":468,"context_line":"    #                                                           0x0028/fff8"},{"line_number":469,"context_line":""},{"line_number":470,"context_line":"    #   rules\u003d[0x0030/fff0, 0x0028/fff8]"}],"source_content_type":"text/x-python","patch_set":27,"id":"fa7ab95a_653c07c0","line":467,"updated":"2016-09-01 07:10:47.000000000","message":"ditto","commit_id":"4018e6fac3802822971efd8c3b15eaf7c73bfbb5"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"943b2682d2e178a2cd8bc3540c83c5f4c31f8408","unresolved":false,"context_lines":[{"line_number":474,"context_line":""},{"line_number":475,"context_line":"    while True:"},{"line_number":476,"context_line":"        # remaining range to be encoded is range(port_min,"},{"line_number":477,"context_line":"        #                                        (port_min | mask) + 1)"},{"line_number":478,"context_line":"        if (port_min \u0026 mask) \u003d\u003d 0:"},{"line_number":479,"context_line":"            # greedy matched a streak of \u00270\u0027 in port_min"},{"line_number":480,"context_line":"            rules.append(_hex_format(port_min, mask))"}],"source_content_type":"text/x-python","patch_set":27,"id":"fa7ab95a_6535e7d9","line":477,"updated":"2016-09-01 07:10:47.000000000","message":"I wonder if this comment is better to be moved to L447.","commit_id":"4018e6fac3802822971efd8c3b15eaf7c73bfbb5"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"fe80b31ef06758320a01e516803c5ddd45e45872","unresolved":false,"context_lines":[{"line_number":474,"context_line":""},{"line_number":475,"context_line":"    while True:"},{"line_number":476,"context_line":"        # remaining range to be encoded is range(port_min,"},{"line_number":477,"context_line":"        #                                        (port_min | mask) + 1)"},{"line_number":478,"context_line":"        if (port_min \u0026 mask) \u003d\u003d 0:"},{"line_number":479,"context_line":"            # greedy matched a streak of \u00270\u0027 in port_min"},{"line_number":480,"context_line":"            rules.append(_hex_format(port_min, mask))"}],"source_content_type":"text/x-python","patch_set":27,"id":"fa7ab95a_11fe0f38","line":477,"in_reply_to":"fa7ab95a_6535e7d9","updated":"2016-09-01 12:10:43.000000000","message":"Reasonable.","commit_id":"4018e6fac3802822971efd8c3b15eaf7c73bfbb5"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"943b2682d2e178a2cd8bc3540c83c5f4c31f8408","unresolved":false,"context_lines":[{"line_number":505,"context_line":"    # With each rule generation cycle, mask and top_bit are bit shifted to the"},{"line_number":506,"context_line":"    # right. When top_bit reaches 0 it means that last register was processed."},{"line_number":507,"context_line":""},{"line_number":508,"context_line":"    # Let port_min be n bits long, top_bit \u003d 1 \u003c\u003c k, 0\u003c\u003dk\u003c\u003dn-1."},{"line_number":509,"context_line":""},{"line_number":510,"context_line":"    # Each cycle step checks the following conditions:"},{"line_number":511,"context_line":""}],"source_content_type":"text/x-python","patch_set":27,"id":"fa7ab95a_f27b7ff2","line":508,"range":{"start_line":508,"start_character":10,"end_line":508,"end_character":18},"updated":"2016-09-01 07:10:47.000000000","message":"copy-paste-modify is bad for maintainabilty. See you\u0027ve left port_min here. ;)\n\nHow about just saying \"this is a bit-inverted version of _gen_rules_port_min\"?","commit_id":"4018e6fac3802822971efd8c3b15eaf7c73bfbb5"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"fe80b31ef06758320a01e516803c5ddd45e45872","unresolved":false,"context_lines":[{"line_number":505,"context_line":"    # With each rule generation cycle, mask and top_bit are bit shifted to the"},{"line_number":506,"context_line":"    # right. When top_bit reaches 0 it means that last register was processed."},{"line_number":507,"context_line":""},{"line_number":508,"context_line":"    # Let port_min be n bits long, top_bit \u003d 1 \u003c\u003c k, 0\u003c\u003dk\u003c\u003dn-1."},{"line_number":509,"context_line":""},{"line_number":510,"context_line":"    # Each cycle step checks the following conditions:"},{"line_number":511,"context_line":""}],"source_content_type":"text/x-python","patch_set":27,"id":"fa7ab95a_b1d1e3cf","line":508,"range":{"start_line":508,"start_character":10,"end_line":508,"end_character":18},"in_reply_to":"fa7ab95a_f27b7ff2","updated":"2016-09-01 12:10:43.000000000","message":"I will refine the copy-paste version for now (following Jakub\u0027s comments \"the more we know the better\"). Let\u0027s wait for other opinions, it\u0027s always easier to delete a detailed comment than to write one :)","commit_id":"4018e6fac3802822971efd8c3b15eaf7c73bfbb5"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"9dfcd2349a74e139bcdf15550d5e8e3d5a6088bb","unresolved":false,"context_lines":[{"line_number":441,"context_line":"    # With each rule generation cycle, mask and top_bit are bit shifted to the"},{"line_number":442,"context_line":"    # right. When top_bit reaches 0 it means that last register was processed."},{"line_number":443,"context_line":""},{"line_number":444,"context_line":"    # Let port_min be n bits long, top_bit \u003d 1 \u003c\u003c k, 0\u003c\u003dk\u003c\u003dn-1."},{"line_number":445,"context_line":""},{"line_number":446,"context_line":"    # Remaining range to be encoded in a cycle is range(port_min,"},{"line_number":447,"context_line":"    #                                                   (port_min | mask) + 1)."}],"source_content_type":"text/x-python","patch_set":28,"id":"fa7ab95a_4ee51f07","line":444,"range":{"start_line":444,"start_character":10,"end_line":444,"end_character":34},"updated":"2016-09-02 08:38:17.000000000","message":"port_min can be 0 and port_min.bit_length() isn\u0027t important here.","commit_id":"07559996fde596dc43c30b545cc22b1bcc31ada5"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"9dfcd2349a74e139bcdf15550d5e8e3d5a6088bb","unresolved":false,"context_lines":[{"line_number":459,"context_line":"    #     and masking other (k-1) bits all ports in range"},{"line_number":460,"context_line":"    #     [P, P + 2^(k-1)-1] are guaranteed to be covered."},{"line_number":461,"context_line":"    #     Let p_k be equal to port first (n-k) bits with rest set to 0."},{"line_number":462,"context_line":"    #     Then P \u003d p_k | top_bit."},{"line_number":463,"context_line":""},{"line_number":464,"context_line":"    # Full cycle example for range [40, 64):"},{"line_number":465,"context_line":"    # port\u003d0101000, top_bit\u003d0100000, k\u003d5"}],"source_content_type":"text/x-python","patch_set":28,"id":"fa7ab95a_f1533614","line":462,"updated":"2016-09-02 08:38:17.000000000","message":"To prove the correctness of this algorithm, I think it\u0027s important to mention the remaining range is range(port_min, (port_min | mask) + 1) here (with the update mask value).\n\nWhen range(port_min, (port_min | mask) + 1) shrinks, condition 2 holds.  When the range doesn\u0027t shrink, condition 2 doesn\u0027t hold and no need to emit a bitmask in this loop iteration.","commit_id":"07559996fde596dc43c30b545cc22b1bcc31ada5"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"9d0126ecfad980d2bfc41cfd98fd0c8a5743c22e","unresolved":false,"context_lines":[{"line_number":459,"context_line":"    #     and masking other (k-1) bits all ports in range"},{"line_number":460,"context_line":"    #     [P, P + 2^(k-1)-1] are guaranteed to be covered."},{"line_number":461,"context_line":"    #     Let p_k be equal to port first (n-k) bits with rest set to 0."},{"line_number":462,"context_line":"    #     Then P \u003d p_k | top_bit."},{"line_number":463,"context_line":""},{"line_number":464,"context_line":"    # Full cycle example for range [40, 64):"},{"line_number":465,"context_line":"    # port\u003d0101000, top_bit\u003d0100000, k\u003d5"}],"source_content_type":"text/x-python","patch_set":28,"id":"9a89bdaa_570c6742","line":462,"in_reply_to":"fa7ab95a_f1533614","updated":"2016-09-03 12:36:42.000000000","message":"I\u0027ll add correctness proof to the comment.","commit_id":"07559996fde596dc43c30b545cc22b1bcc31ada5"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"9dfcd2349a74e139bcdf15550d5e8e3d5a6088bb","unresolved":false,"context_lines":[{"line_number":465,"context_line":"    # port\u003d0101000, top_bit\u003d0100000, k\u003d5"},{"line_number":466,"context_line":"    # * step 1, k\u003d5"},{"line_number":467,"context_line":"    #   top_bit\u003d0100000, mask\u003d0011111 -\u003e no match"},{"line_number":468,"context_line":"    # * step 2, k\u003d4"},{"line_number":469,"context_line":"    #   top_bit\u003d0010000, mask\u003d0001111 -\u003e condition 2 matches -\u003e 011xxxx or"},{"line_number":470,"context_line":"    #                                                           0x0030/fff0"},{"line_number":471,"context_line":"    # * step 3, k\u003d3"}],"source_content_type":"text/x-python","patch_set":28,"id":"fa7ab95a_2ed29b00","line":468,"range":{"start_line":468,"start_character":8,"end_line":468,"end_character":19},"updated":"2016-09-02 08:38:17.000000000","message":"I think it happens in the first loop iteration as a bit shift happens in the middle of the loop.  You meant \"step\" to be a loop iteration count, or something else?","commit_id":"07559996fde596dc43c30b545cc22b1bcc31ada5"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"9d0126ecfad980d2bfc41cfd98fd0c8a5743c22e","unresolved":false,"context_lines":[{"line_number":465,"context_line":"    # port\u003d0101000, top_bit\u003d0100000, k\u003d5"},{"line_number":466,"context_line":"    # * step 1, k\u003d5"},{"line_number":467,"context_line":"    #   top_bit\u003d0100000, mask\u003d0011111 -\u003e no match"},{"line_number":468,"context_line":"    # * step 2, k\u003d4"},{"line_number":469,"context_line":"    #   top_bit\u003d0010000, mask\u003d0001111 -\u003e condition 2 matches -\u003e 011xxxx or"},{"line_number":470,"context_line":"    #                                                           0x0030/fff0"},{"line_number":471,"context_line":"    # * step 3, k\u003d3"}],"source_content_type":"text/x-python","patch_set":28,"id":"9a89bdaa_77ffab34","line":468,"range":{"start_line":468,"start_character":8,"end_line":468,"end_character":19},"in_reply_to":"fa7ab95a_2ed29b00","updated":"2016-09-03 12:36:42.000000000","message":"Forgot to refactor this, thanks","commit_id":"07559996fde596dc43c30b545cc22b1bcc31ada5"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"9dfcd2349a74e139bcdf15550d5e8e3d5a6088bb","unresolved":false,"context_lines":[{"line_number":467,"context_line":"    #   top_bit\u003d0100000, mask\u003d0011111 -\u003e no match"},{"line_number":468,"context_line":"    # * step 2, k\u003d4"},{"line_number":469,"context_line":"    #   top_bit\u003d0010000, mask\u003d0001111 -\u003e condition 2 matches -\u003e 011xxxx or"},{"line_number":470,"context_line":"    #                                                           0x0030/fff0"},{"line_number":471,"context_line":"    # * step 3, k\u003d3"},{"line_number":472,"context_line":"    #   top_bit\u003d0001000, mask\u003d0000111 -\u003e condition 1 matches -\u003e 0101xxx or"},{"line_number":473,"context_line":"    #                                                           0x0028/fff8"}],"source_content_type":"text/x-python","patch_set":28,"id":"fa7ab95a_8e7ba7bd","line":470,"updated":"2016-09-02 08:38:17.000000000","message":"The remaining range is [40, 47]. Note that 0b0101000 | 0b1111 \u003d 47 and the range [48, 64) is expressed by the above bitmask.","commit_id":"07559996fde596dc43c30b545cc22b1bcc31ada5"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"9dfcd2349a74e139bcdf15550d5e8e3d5a6088bb","unresolved":false,"context_lines":[{"line_number":468,"context_line":"    # * step 2, k\u003d4"},{"line_number":469,"context_line":"    #   top_bit\u003d0010000, mask\u003d0001111 -\u003e condition 2 matches -\u003e 011xxxx or"},{"line_number":470,"context_line":"    #                                                           0x0030/fff0"},{"line_number":471,"context_line":"    # * step 3, k\u003d3"},{"line_number":472,"context_line":"    #   top_bit\u003d0001000, mask\u003d0000111 -\u003e condition 1 matches -\u003e 0101xxx or"},{"line_number":473,"context_line":"    #                                                           0x0028/fff8"},{"line_number":474,"context_line":""}],"source_content_type":"text/x-python","patch_set":28,"id":"fa7ab95a_91e10a2d","line":471,"updated":"2016-09-02 08:38:17.000000000","message":"0b0101000 \u0026 0b1111 !\u003d0, so condition 1 doesn\u0027t hold.\n0b0101000 \u0026 0b100 !\u003d 0, so condition 2 doesn\u0027t hold.\n\nThe remaining range [40, 40 | 0b111] \u003d\u003d [40, 47].\n\nThen...","commit_id":"07559996fde596dc43c30b545cc22b1bcc31ada5"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"0083c7e87f1e2274b6345b348cf1ae56f8d63f5c","unresolved":false,"context_lines":[{"line_number":433,"context_line":"    Encode a port range range(port_min, (port_min | (top_bit - 1)) + 1) into"},{"line_number":434,"context_line":"    a set of bit value/masks."},{"line_number":435,"context_line":"    \"\"\""},{"line_number":436,"context_line":"    # Processing starts with setting up mask and top_bit variables to their"},{"line_number":437,"context_line":"    # maximum. Top_bit has the form (1000000) with \u00271\u0027 pointing to the register"},{"line_number":438,"context_line":"    # being processed, while mask has the form (0111111) with \u00271\u0027 showing"},{"line_number":439,"context_line":"    # possible range to be covered."},{"line_number":440,"context_line":""}],"source_content_type":"text/x-python","patch_set":29,"id":"9a89bdaa_1082ce94","line":437,"range":{"start_line":436,"start_character":69,"end_line":437,"end_character":14},"updated":"2016-09-05 09:24:30.000000000","message":"I think this part of comment should belong to the call site.","commit_id":"bf11eba058d383ad8361ec5f6609e139e65b825f"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"e3cdab9bd2579943211c80c2e84dc5088f4daef1","unresolved":false,"context_lines":[{"line_number":433,"context_line":"    Encode a port range range(port_min, (port_min | (top_bit - 1)) + 1) into"},{"line_number":434,"context_line":"    a set of bit value/masks."},{"line_number":435,"context_line":"    \"\"\""},{"line_number":436,"context_line":"    # Processing starts with setting up mask and top_bit variables to their"},{"line_number":437,"context_line":"    # maximum. Top_bit has the form (1000000) with \u00271\u0027 pointing to the register"},{"line_number":438,"context_line":"    # being processed, while mask has the form (0111111) with \u00271\u0027 showing"},{"line_number":439,"context_line":"    # possible range to be covered."},{"line_number":440,"context_line":""}],"source_content_type":"text/x-python","patch_set":29,"id":"9a89bdaa_7d112eac","line":437,"range":{"start_line":436,"start_character":69,"end_line":437,"end_character":14},"in_reply_to":"9a89bdaa_1082ce94","updated":"2016-09-05 10:16:07.000000000","message":"There is no reference to \u0027mask\u0027 variable in port_rules_masking and as long as top_bit and mask play together I\u0027d leave it here.","commit_id":"bf11eba058d383ad8361ec5f6609e139e65b825f"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"0083c7e87f1e2274b6345b348cf1ae56f8d63f5c","unresolved":false,"context_lines":[{"line_number":441,"context_line":"    # With each rule generation cycle, mask and top_bit are bit shifted to the"},{"line_number":442,"context_line":"    # right. When top_bit reaches 0 it means that last register was processed."},{"line_number":443,"context_line":""},{"line_number":444,"context_line":"    # Let port_min be n bits long, top_bit \u003d 1 \u003c\u003c k, 0\u003c\u003dk\u003c\u003dn-1."},{"line_number":445,"context_line":""},{"line_number":446,"context_line":"    # Each cycle step checks the following conditions:"},{"line_number":447,"context_line":""}],"source_content_type":"text/x-python","patch_set":29,"id":"9a89bdaa_e4768f3d","line":444,"updated":"2016-09-05 09:24:30.000000000","message":"Please address my comment in PS28.","commit_id":"bf11eba058d383ad8361ec5f6609e139e65b825f"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"e3cdab9bd2579943211c80c2e84dc5088f4daef1","unresolved":false,"context_lines":[{"line_number":441,"context_line":"    # With each rule generation cycle, mask and top_bit are bit shifted to the"},{"line_number":442,"context_line":"    # right. When top_bit reaches 0 it means that last register was processed."},{"line_number":443,"context_line":""},{"line_number":444,"context_line":"    # Let port_min be n bits long, top_bit \u003d 1 \u003c\u003c k, 0\u003c\u003dk\u003c\u003dn-1."},{"line_number":445,"context_line":""},{"line_number":446,"context_line":"    # Each cycle step checks the following conditions:"},{"line_number":447,"context_line":""}],"source_content_type":"text/x-python","patch_set":29,"id":"9a89bdaa_5db0eadd","line":444,"in_reply_to":"9a89bdaa_e4768f3d","updated":"2016-09-05 10:16:07.000000000","message":"I need n and k for precise generated rule description. The remaining range per step approach is fine for correctness proof, but imho it is easier to understand what is going on given reference to single bits.\n\nBut we DO need other opinions.","commit_id":"bf11eba058d383ad8361ec5f6609e139e65b825f"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"0083c7e87f1e2274b6345b348cf1ae56f8d63f5c","unresolved":false,"context_lines":[{"line_number":446,"context_line":"    # Each cycle step checks the following conditions:"},{"line_number":447,"context_line":""},{"line_number":448,"context_line":"    #     1). port \u0026 mask \u003d\u003d 0"},{"line_number":449,"context_line":"    #     This means that remaining bits k..0 are equal to \u00270\u0027 and can be"},{"line_number":450,"context_line":"    #     covered by a single port/mask rule."},{"line_number":451,"context_line":""},{"line_number":452,"context_line":"    #     If condition 1 doesn\u0027t fit, then both top_bit and mask are bit"}],"source_content_type":"text/x-python","patch_set":29,"id":"9a89bdaa_04045315","line":449,"range":{"start_line":449,"start_character":41,"end_line":449,"end_character":45},"updated":"2016-09-05 09:24:30.000000000","message":"If top_bit \u003d\u003d 1 \u003c\u003c k, mask consists of k \u00271\u0027s, so this should be k-bits wide.\nIt seems you are counting the LSB as 1, so this should be k..1 (sounds odd) , or (k-1)..0 ?","commit_id":"bf11eba058d383ad8361ec5f6609e139e65b825f"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"e3cdab9bd2579943211c80c2e84dc5088f4daef1","unresolved":false,"context_lines":[{"line_number":446,"context_line":"    # Each cycle step checks the following conditions:"},{"line_number":447,"context_line":""},{"line_number":448,"context_line":"    #     1). port \u0026 mask \u003d\u003d 0"},{"line_number":449,"context_line":"    #     This means that remaining bits k..0 are equal to \u00270\u0027 and can be"},{"line_number":450,"context_line":"    #     covered by a single port/mask rule."},{"line_number":451,"context_line":""},{"line_number":452,"context_line":"    #     If condition 1 doesn\u0027t fit, then both top_bit and mask are bit"}],"source_content_type":"text/x-python","patch_set":29,"id":"9a89bdaa_9881a04d","line":449,"range":{"start_line":449,"start_character":41,"end_line":449,"end_character":45},"in_reply_to":"9a89bdaa_04045315","updated":"2016-09-05 10:16:07.000000000","message":"It should be k ... 1 to be consistent with later (k-1) expressions. Thanks","commit_id":"bf11eba058d383ad8361ec5f6609e139e65b825f"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"0083c7e87f1e2274b6345b348cf1ae56f8d63f5c","unresolved":false,"context_lines":[{"line_number":453,"context_line":"    #     shifted to the right and condition 2 is checked:"},{"line_number":454,"context_line":""},{"line_number":455,"context_line":"    #     2). port \u0026 top_bit \u003d\u003d 0"},{"line_number":456,"context_line":"    #     This means that kth port bit is equal to \u00270\u0027. By setting it to \u00271\u0027"},{"line_number":457,"context_line":"    #     and masking other (k-1) bits all ports in range"},{"line_number":458,"context_line":"    #     [P, P + 2^(k-1)-1] are guaranteed to be covered."},{"line_number":459,"context_line":"    #     Let p_k be equal to port first (n-k) bits with rest set to 0."}],"source_content_type":"text/x-python","patch_set":29,"id":"9a89bdaa_c7518d64","line":456,"updated":"2016-09-05 09:24:30.000000000","message":"top_bit is now 1 \u003c\u003c (k-1), so the above statement is correct if you count the LSB as 1st bit.","commit_id":"bf11eba058d383ad8361ec5f6609e139e65b825f"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"0083c7e87f1e2274b6345b348cf1ae56f8d63f5c","unresolved":false,"context_lines":[{"line_number":500,"context_line":"            rules.append(_hex_format(port_min, mask))"},{"line_number":501,"context_line":"            break"},{"line_number":502,"context_line":"        top_bit \u003e\u003e\u003d 1"},{"line_number":503,"context_line":"        if top_bit \u003d\u003d 0:"},{"line_number":504,"context_line":"            break"},{"line_number":505,"context_line":"        mask \u003e\u003e\u003d 1"},{"line_number":506,"context_line":"        if (port_min \u0026 top_bit) \u003d\u003d 0:"}],"source_content_type":"text/x-python","patch_set":29,"id":"9a89bdaa_3a040c14","line":503,"updated":"2016-09-05 09:24:30.000000000","message":"I\u0027m beginning to think this condition will never hit.","commit_id":"bf11eba058d383ad8361ec5f6609e139e65b825f"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"e3cdab9bd2579943211c80c2e84dc5088f4daef1","unresolved":false,"context_lines":[{"line_number":500,"context_line":"            rules.append(_hex_format(port_min, mask))"},{"line_number":501,"context_line":"            break"},{"line_number":502,"context_line":"        top_bit \u003e\u003e\u003d 1"},{"line_number":503,"context_line":"        if top_bit \u003d\u003d 0:"},{"line_number":504,"context_line":"            break"},{"line_number":505,"context_line":"        mask \u003e\u003e\u003d 1"},{"line_number":506,"context_line":"        if (port_min \u0026 top_bit) \u003d\u003d 0:"}],"source_content_type":"text/x-python","patch_set":29,"id":"9a89bdaa_187590f8","line":503,"in_reply_to":"9a89bdaa_3a040c14","updated":"2016-09-05 10:16:07.000000000","message":"Well, let\u0027s think\n\nPrior to that top_bit\u003d00001, mask\u003d00000\neven if cond. 2 doesn\u0027t fit, cond. 1 will always be a match.\n\nSo yes, it\u0027s redundant. Good catch!","commit_id":"bf11eba058d383ad8361ec5f6609e139e65b825f"}],"neutron/tests/unit/common/test_utils.py":[{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"2203151d362247a6839e7e97339fc83d79d43808","unresolved":false,"context_lines":[{"line_number":696,"context_line":"        # Test 2."},{"line_number":697,"context_line":"        port_min \u003d 20"},{"line_number":698,"context_line":"        port_max \u003d 130"},{"line_number":699,"context_line":"        expected_rules \u003d [\u00270x0014/0xfffe\u0027, \u00270x0016/0xfffe\u0027, \u00270x0018/0xfff8\u0027,"},{"line_number":700,"context_line":"                          \u00270x0020/0xffe0\u0027, \u00270x0040/0xffc0\u0027, \u00270x0080/0xfffe\u0027,"},{"line_number":701,"context_line":"                          \u00270x0082\u0027]"},{"line_number":702,"context_line":"        rules \u003d utils.port_rule_masking(port_min, port_max)"}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_235484fd","side":"PARENT","line":699,"range":{"start_line":699,"start_character":26,"end_line":699,"end_character":58},"updated":"2016-08-17 01:48:45.000000000","message":"that was wrong, 20-21 and 22-23 should be combined in one range 20-23 (0x0014/0xfffc).","commit_id":"ba3b4638d2a84e734b4e77759d5238c5edac9c46"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"2203151d362247a6839e7e97339fc83d79d43808","unresolved":false,"context_lines":[{"line_number":708,"context_line":"        expected_rules \u003d [\u00270x1195\u0027, \u00270x1196/0xfffe\u0027, \u00270x1198/0xfff8\u0027,"},{"line_number":709,"context_line":"                          \u00270x11a0/0xffe0\u0027, \u00270x11c0/0xffc0\u0027, \u00270x1200/0xfe00\u0027,"},{"line_number":710,"context_line":"                          \u00270x1400/0xfc00\u0027, \u00270x1800/0xf800\u0027, \u00270x2000/0xe000\u0027,"},{"line_number":711,"context_line":"                          \u00270x4000/0xc000\u0027, \u00270x8021/0xff00\u0027, \u00270x8101/0xffe0\u0027,"},{"line_number":712,"context_line":"                          \u00270x8120/0xfffe\u0027]"},{"line_number":713,"context_line":""},{"line_number":714,"context_line":"        rules \u003d utils.port_rule_masking(port_min, port_max)"}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_63f67cfa","side":"PARENT","line":711,"range":{"start_line":711,"start_character":43,"end_line":711,"end_character":75},"updated":"2016-08-17 01:48:45.000000000","message":"another bad sheep, 32801-33056 and 33025-33056 instead of 32768-33023 and 33024-33055 is utterly wrong (not only rules overlap, but ports 32768-32800 are left open)","commit_id":"ba3b4638d2a84e734b4e77759d5238c5edac9c46"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"565baaad255774ad21c853e6e912b497f987c19b","unresolved":false,"context_lines":[{"line_number":683,"context_line":""},{"line_number":684,"context_line":"class TestPortRuleMasking(base.BaseTestCase):"},{"line_number":685,"context_line":""},{"line_number":686,"context_line":"    def print_range(self, tp_src_str):"},{"line_number":687,"context_line":"        # XXX FIXME remove this after debugging all masking issues"},{"line_number":688,"context_line":""},{"line_number":689,"context_line":"        def to_dec(hex_str):"}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_343e758c","line":686,"updated":"2016-08-17 06:12:06.000000000","message":"This function seems unused.","commit_id":"0c4faeb1ad8136f41f0e4679d81e6ca7a86d09d1"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"bec7aabaf92379364b2d3ca7329ab13528021b2d","unresolved":false,"context_lines":[{"line_number":683,"context_line":""},{"line_number":684,"context_line":"class TestPortRuleMasking(base.BaseTestCase):"},{"line_number":685,"context_line":""},{"line_number":686,"context_line":"    def print_range(self, tp_src_str):"},{"line_number":687,"context_line":"        # XXX FIXME remove this after debugging all masking issues"},{"line_number":688,"context_line":""},{"line_number":689,"context_line":"        def to_dec(hex_str):"}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_3ac77765","line":686,"in_reply_to":"3ac371cc_343e758c","updated":"2016-08-17 10:42:40.000000000","message":"Just wanted to have this in git history in case the algorithm has some flaws. Will remove it in next PS.","commit_id":"0c4faeb1ad8136f41f0e4679d81e6ca7a86d09d1"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"8807f1641f9c48669e6e3d33056736f2791c7712","unresolved":false,"context_lines":[{"line_number":683,"context_line":""},{"line_number":684,"context_line":"class TestPortRuleMasking(base.BaseTestCase):"},{"line_number":685,"context_line":""},{"line_number":686,"context_line":"    def print_range(self, tp_src_str):"},{"line_number":687,"context_line":"        # XXX FIXME remove this after debugging all masking issues"},{"line_number":688,"context_line":""},{"line_number":689,"context_line":"        def to_dec(hex_str):"}],"source_content_type":"text/x-python","patch_set":7,"id":"3ac371cc_fe0e658a","line":686,"in_reply_to":"3ac371cc_3ac77765","updated":"2016-08-17 13:34:32.000000000","message":"It is easy to confirm computed bit masks span the specified port range and don\u0027t overlap.\nTo check the bit masks are optimal, it suffices to confirm no two adjacent bit masks can be merged into one. They need the same mask values to be able to be merged.\n\nIn this way, the precomputed \"answers\" below can be get rid of, but we don\u0027t need to go that far.","commit_id":"0c4faeb1ad8136f41f0e4679d81e6ca7a86d09d1"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"3228445dfea9da784467e598e33a5830c65a94b8","unresolved":false,"context_lines":[{"line_number":685,"context_line":""},{"line_number":686,"context_line":""},{"line_number":687,"context_line":"class TestPortRuleMasking(base.BaseTestCase):"},{"line_number":688,"context_line":""},{"line_number":689,"context_line":"    def test_port_rule_masking(self):"},{"line_number":690,"context_line":"        # Test 1."},{"line_number":691,"context_line":"        port_min \u003d 5"}],"source_content_type":"text/x-python","patch_set":8,"id":"3ac371cc_cd382c40","line":688,"updated":"2016-08-17 10:42:26.000000000","message":"unrelated","commit_id":"4d52b7fccaf4e87acbd1bd6634b13c6e64de49cc"},{"author":{"_account_id":8655,"name":"Jakub Libosvar","email":"libosvar@redhat.com","username":"jlibosva"},"change_message_id":"837e4448b6320957c663adda3de890e8b3919114","unresolved":false,"context_lines":[{"line_number":686,"context_line":""},{"line_number":687,"context_line":"class TestPortRuleMasking(base.BaseTestCase):"},{"line_number":688,"context_line":"    def test_port_rule_masking(self):"},{"line_number":689,"context_line":"        # Test 1."},{"line_number":690,"context_line":"        port_min \u003d 5"},{"line_number":691,"context_line":"        port_max \u003d 12"},{"line_number":692,"context_line":"        expected_rules \u003d [\u00270x0005\u0027, \u00270x0006/0xfffe\u0027, \u00270x0008/0xfffc\u0027, \u00270x000c\u0027]"}],"source_content_type":"text/x-python","patch_set":10,"id":"3ac371cc_4d854305","line":689,"updated":"2016-08-17 16:41:18.000000000","message":"All these 6 tests below are the same. Now with growth, I suggest we should generalize one function and provide testing with test scenarios.\n\n scenarios \u003d [\n     (\u0027Test 1\u0027, {\u0027port_min\u0027: 5,\n                    \u0027port_max\u0027: 12,\n                    \u0027expected\u0027: [\u00270x0005\u0027, \u00270x0006/0xfffe\u0027, \u00270x0008/0xfffc\u0027, \u00270x000c\u0027],\n                    \u0027exception: None),\n     (\u0027Test bad values\u0027, {\u0027port_min\u0027: 12,\n                                     \u0027port_max\u0027: 5,\n                                      expected: None\n                                      exception: ValueError}),\n ]\n\n def test_port_rule_masking(self):\n     if self.exception:\n         with testtools.ExpectedException(self.exception):\n             utils.port_rule_masking(self.port_min, self.port_max)\n     else:\n         rules \u003d utils.port_rule_masking(self.port_min, self.port_max)\n         self.assertItemsEqual(self.expected, rules)","commit_id":"37c81a65d738cdaf51f08a0f91ce135a4c097fd8"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"5523aa36e3e9eadcf35eb09f0fe5e9a82fb29f60","unresolved":false,"context_lines":[{"line_number":695,"context_line":""},{"line_number":696,"context_line":"        # Test 1."},{"line_number":697,"context_line":"        expected_rules \u003d [\u00270x0005\u0027, \u00270x0006/0xfffe\u0027, \u00270x0008/0xfffc\u0027, \u00270x000c\u0027]"},{"line_number":698,"context_line":"        check_rules(5, 12, expected_rules)"},{"line_number":699,"context_line":""},{"line_number":700,"context_line":"        # Test 2."},{"line_number":701,"context_line":"        expected_rules \u003d [\u00270x0014/0xfffc\u0027, \u00270x0018/0xfff8\u0027,"}],"source_content_type":"text/x-python","patch_set":12,"id":"3ac371cc_b6b5bb32","line":698,"updated":"2016-08-19 03:41:14.000000000","message":"can we add a test that covers the entire port range? Would it make sense?","commit_id":"2bdfa10e38ad0ca9f59410b12ec3d90a220e9ef9"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"7e6408a0f4892d957278af751b70aac85d045e6b","unresolved":false,"context_lines":[{"line_number":695,"context_line":""},{"line_number":696,"context_line":"        # Test 1."},{"line_number":697,"context_line":"        expected_rules \u003d [\u00270x0005\u0027, \u00270x0006/0xfffe\u0027, \u00270x0008/0xfffc\u0027, \u00270x000c\u0027]"},{"line_number":698,"context_line":"        check_rules(5, 12, expected_rules)"},{"line_number":699,"context_line":""},{"line_number":700,"context_line":"        # Test 2."},{"line_number":701,"context_line":"        expected_rules \u003d [\u00270x0014/0xfffc\u0027, \u00270x0018/0xfff8\u0027,"}],"source_content_type":"text/x-python","patch_set":12,"id":"1ac06dbe_f1027d3d","line":698,"in_reply_to":"3ac371cc_b6b5bb32","updated":"2016-08-20 17:19:43.000000000","message":"Hm, it won\u0027t hurt I think.","commit_id":"2bdfa10e38ad0ca9f59410b12ec3d90a220e9ef9"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"5523aa36e3e9eadcf35eb09f0fe5e9a82fb29f60","unresolved":false,"context_lines":[{"line_number":714,"context_line":"        # Test 4."},{"line_number":715,"context_line":"        expected_rules \u003d [\u00270x0064/0xfffc\u0027, \u00270x0068/0xfff8\u0027,"},{"line_number":716,"context_line":"                          \u00270x0070/0xfffe\u0027, \u00270x0072\u0027]"},{"line_number":717,"context_line":"        check_rules(100, 114, expected_rules)"},{"line_number":718,"context_line":""},{"line_number":719,"context_line":"        # Test 5."},{"line_number":720,"context_line":"        expected_rules \u003d [\u00270x0065\u0027, \u00270x0066/0xfffe\u0027, \u00270x0068/0xfff8\u0027,"}],"source_content_type":"text/x-python","patch_set":12,"id":"3ac371cc_169acfc5","line":717,"updated":"2016-08-19 03:41:14.000000000","message":"for readability I think these should be individual tests.","commit_id":"2bdfa10e38ad0ca9f59410b12ec3d90a220e9ef9"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"7e6408a0f4892d957278af751b70aac85d045e6b","unresolved":false,"context_lines":[{"line_number":714,"context_line":"        # Test 4."},{"line_number":715,"context_line":"        expected_rules \u003d [\u00270x0064/0xfffc\u0027, \u00270x0068/0xfff8\u0027,"},{"line_number":716,"context_line":"                          \u00270x0070/0xfffe\u0027, \u00270x0072\u0027]"},{"line_number":717,"context_line":"        check_rules(100, 114, expected_rules)"},{"line_number":718,"context_line":""},{"line_number":719,"context_line":"        # Test 5."},{"line_number":720,"context_line":"        expected_rules \u003d [\u00270x0065\u0027, \u00270x0066/0xfffe\u0027, \u00270x0068/0xfff8\u0027,"}],"source_content_type":"text/x-python","patch_set":12,"id":"1ac06dbe_317895f2","line":717,"in_reply_to":"3ac371cc_169acfc5","updated":"2016-08-20 17:19:43.000000000","message":"Ok, will be done.","commit_id":"2bdfa10e38ad0ca9f59410b12ec3d90a220e9ef9"},{"author":{"_account_id":748,"name":"Armando Migliaccio","email":"armamig@gmail.com","username":"armando-migliaccio"},"change_message_id":"5523aa36e3e9eadcf35eb09f0fe5e9a82fb29f60","unresolved":false,"context_lines":[{"line_number":719,"context_line":"        # Test 5."},{"line_number":720,"context_line":"        expected_rules \u003d [\u00270x0065\u0027, \u00270x0066/0xfffe\u0027, \u00270x0068/0xfff8\u0027,"},{"line_number":721,"context_line":"                          \u00270x0070/0xfff0\u0027]"},{"line_number":722,"context_line":"        check_rules(101, 127, expected_rules)"},{"line_number":723,"context_line":""},{"line_number":724,"context_line":"        # Test 6. Single port"},{"line_number":725,"context_line":"        check_rules(5001, 5001, [\u00270x1389\u0027])"}],"source_content_type":"text/x-python","patch_set":12,"id":"3ac371cc_b6e3fb32","line":722,"updated":"2016-08-19 03:41:14.000000000","message":"how did you come up with these numbers? Is that because odd vs even matters? Explaining what Test # is for would be nice, you did for those below.","commit_id":"2bdfa10e38ad0ca9f59410b12ec3d90a220e9ef9"},{"author":{"_account_id":13717,"name":"Inessa Vasilevskaya","email":"ivasilevskaya@mirantis.com","username":"ivasilevskaya"},"change_message_id":"7e6408a0f4892d957278af751b70aac85d045e6b","unresolved":false,"context_lines":[{"line_number":719,"context_line":"        # Test 5."},{"line_number":720,"context_line":"        expected_rules \u003d [\u00270x0065\u0027, \u00270x0066/0xfffe\u0027, \u00270x0068/0xfff8\u0027,"},{"line_number":721,"context_line":"                          \u00270x0070/0xfff0\u0027]"},{"line_number":722,"context_line":"        check_rules(101, 127, expected_rules)"},{"line_number":723,"context_line":""},{"line_number":724,"context_line":"        # Test 6. Single port"},{"line_number":725,"context_line":"        check_rules(5001, 5001, [\u00270x1389\u0027])"}],"source_content_type":"text/x-python","patch_set":12,"id":"1ac06dbe_71ee8d8c","line":722,"in_reply_to":"3ac371cc_b6e3fb32","updated":"2016-08-20 17:19:43.000000000","message":"Tests 1-3 were taken as they are from networking-ovs-dpdk. \nOthers were added during debugging port masking algorithm: the binary representation of given ports matters and to test everything I had to follow different branches of execution (now when Jakub has proposed a more high level version of the algo \u0027different branches\u0027 idea is a bit hard to follow though).\n\nI\u0027ll refactor the tests and add some comments.","commit_id":"2bdfa10e38ad0ca9f59410b12ec3d90a220e9ef9"},{"author":{"_account_id":9200,"name":"IWAMOTO Toshihiro","email":"iwamoto@valinux.co.jp","username":"toshii"},"change_message_id":"48744da6085a07923d74b923fda24361fda2da2e","unresolved":false,"context_lines":[{"line_number":718,"context_line":"         {\u0027port_min\u0027: 22,"},{"line_number":719,"context_line":"          \u0027port_max\u0027: 22,"},{"line_number":720,"context_line":"          \u0027expected\u0027: [\u00270x0016\u0027]}),"},{"line_number":721,"context_line":"        (\u0027Test single odd port\u0027,"},{"line_number":722,"context_line":"         {\u0027port_min\u0027: 5001,"},{"line_number":723,"context_line":"          \u0027port_max\u0027: 5001,"},{"line_number":724,"context_line":"          \u0027expected\u0027: [\u00270x1389\u0027]}),"},{"line_number":725,"context_line":"        (\u0027Test full interval\u0027,"},{"line_number":726,"context_line":"         {\u0027port_min\u0027: 0,"},{"line_number":727,"context_line":"          \u0027port_max\u0027: 7,"},{"line_number":728,"context_line":"          \u0027expected\u0027: [\u00270x0000/0xfff8\u0027]}),"},{"line_number":729,"context_line":"        (\u0027Test 2^k interval\u0027,"},{"line_number":730,"context_line":"         {\u0027port_min\u0027: 8,"},{"line_number":731,"context_line":"          \u0027port_max\u0027: 15,"}],"source_content_type":"text/x-python","patch_set":23,"id":"1ac06dbe_bc862711","line":728,"range":{"start_line":721,"start_character":0,"end_line":728,"end_character":42},"updated":"2016-08-25 01:15:47.000000000","message":"These tests are redundant assuming the implementation of port_rule_masking, but it might not be a good idea for tests to assume specific implementation...","commit_id":"895a274fe9711a9755bac8ae0834b0777f5b02c1"}]}
