)]}'
{"neutron/tests/unit/plugins/ml2/extensions/test_dns_integration.py":[{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"39693ba51721f3f3d412b03ad31ae53337fe8be0","unresolved":false,"context_lines":[{"line_number":111,"context_line":"        ip_net \u003d netaddr.IPNetwork(cidr)"},{"line_number":112,"context_line":"        # initialize the allocation_pool to the lower half of the subnet"},{"line_number":113,"context_line":"        subnet_size \u003d ip_net.last - ip_net.first"},{"line_number":114,"context_line":"        subnet_mid_point \u003d ip_net.first + int(subnet_size / 2)"},{"line_number":115,"context_line":"        start, end \u003d (netaddr.IPAddress(ip_net.first + 2),"},{"line_number":116,"context_line":"                      netaddr.IPAddress(subnet_mid_point))"},{"line_number":117,"context_line":"        allocation_pools \u003d [{\u0027start\u0027: str(start),"}],"source_content_type":"text/x-python","patch_set":4,"id":"9f436f4f_d77aab86","line":114,"updated":"2017-08-09 07:16:20.000000000","message":"Why do we need to change the logic? Do you see any problem on the previous logic? This is just from my curiosity.\n\nip_net.first and ip_net.last are both integer, so I think the previous logic should work. In addition int() looks unnecessary as \"subnet_size / 2\" is already integer. I think the following works:\n\n  subnet_mid_point \u003d ip_net.first + subnet_size  /2","commit_id":"5160c5da6791a999e6367298d12578797e386b03"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"060dafb531045d1f112abf909e1c5ca3c4d71945","unresolved":false,"context_lines":[{"line_number":111,"context_line":"        ip_net \u003d netaddr.IPNetwork(cidr)"},{"line_number":112,"context_line":"        # initialize the allocation_pool to the lower half of the subnet"},{"line_number":113,"context_line":"        subnet_size \u003d ip_net.last - ip_net.first"},{"line_number":114,"context_line":"        subnet_mid_point \u003d ip_net.first + int(subnet_size / 2)"},{"line_number":115,"context_line":"        start, end \u003d (netaddr.IPAddress(ip_net.first + 2),"},{"line_number":116,"context_line":"                      netaddr.IPAddress(subnet_mid_point))"},{"line_number":117,"context_line":"        allocation_pools \u003d [{\u0027start\u0027: str(start),"}],"source_content_type":"text/x-python","patch_set":4,"id":"9f436f4f_eb98166b","line":114,"in_reply_to":"9f436f4f_d77aab86","updated":"2017-08-09 21:10:08.000000000","message":"This change was made to overcome a problem with py35 testing. You are right, ip_net.first and subnet_size are integers:\n\n(Pdb) ip_net.first\n167772160\n(Pdb) type(ip_net.first)\n\u003cclass \u0027int\u0027\u003e\n(Pdb) subnet_size\n255\n(Pdb) type(subnet_size)\n\u003cclass \u0027int\u0027\u003e\n\nHowever, when the values shown above are used in the assignment you suggest (subnet_mid_point \u003d ip_net.first + subnet_size  /2), we get the following:\n\n(Pdb) subnet_mid_point\n167772287.5\n(Pdb) type(subnet_mid_point)\n\u003cclass \u0027float\u0027\u003e\n\nand the statement in L115-116 fails as follows when creating an IPv4 subnet:\n\n(Pdb) n\nnetaddr.core.AddrFormatError: failed to detect a valid IP address from 167772287.5\n\u003e /home/miguel/neutron/neutron/tests/unit/plugins/ml2/extensions/test_dns_integration.py(120)_create_subnet_for_test()\n-\u003e netaddr.IPAddress(subnet_mid_point))\n\nIf instead we let subnet_mid_point \u003d int(ip_net.first + subnet_size / 2) as is, with some combinations of values we fail creating an IPv6 subnet. For example:\n\n(Pdb) ip_net\nIPNetwork(\u0027fd3d:bdd4:da60::/64\u0027)\n\nGives us the following:\n\n(Pdb) ip_net.first\n336615263281323672539489471771594194944\n(Pdb) subnet_size\n18446744073709551615\n(Pdb) n\n\u003e /home/miguel/neutron/neutron/tests/unit/plugins/ml2/extensions/test_dns_integration.py(118)_create_subnet_for_test()\n-\u003e start, end \u003d (netaddr.IPAddress(ip_net.first + 2),\n(Pdb) subnet_mid_point\n336615263281323672539489471771594194944\n\nAs you can see, subnet_mid_point is rounded down, so it is equal to ip_net.first: \n\n(Pdb) subnet_mid_point \u003d\u003d ip_net.first\nTrue\n\nSo we get: \n\n(Pdb) allocation_pools\n[{\u0027end\u0027: \u0027fd3d:bdd4:da60::\u0027, \u0027start\u0027: \u0027fd3d:bdd4:da60::2\u0027}]\n\nand the subnet creation fails:\n\n(Pdb) resp \u003d self._create_subnet(self.fmt, network_id, str(ip_net), ip_version\u003dip_net.ip.version, allocation_pools\u003dallocation_pools)\n(Pdb) resp.text\n\u0027{\"NeutronError\": {\"message\": \"The allocation pool {\\\u0027end\\\u0027: \\\u0027fd3d:bdd4:da60::\\\u0027, \\\u0027start\\\u0027: \\\u0027fd3d:bdd4:da60::2\\\u0027} is not valid.\", \"type\": \"InvalidAllocationPool\", \"detail\": \"\"}}\u0027\nTrue\n\nTo handle the potential rounding down, I isolated it in the int(subnet_size / 2) term","commit_id":"5160c5da6791a999e6367298d12578797e386b03"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"5a476c7da789b9adb4d3fb9febb2a2aff4f0772c","unresolved":false,"context_lines":[{"line_number":111,"context_line":"        ip_net \u003d netaddr.IPNetwork(cidr)"},{"line_number":112,"context_line":"        # initialize the allocation_pool to the lower half of the subnet"},{"line_number":113,"context_line":"        subnet_size \u003d ip_net.last - ip_net.first"},{"line_number":114,"context_line":"        subnet_mid_point \u003d ip_net.first + int(subnet_size / 2)"},{"line_number":115,"context_line":"        start, end \u003d (netaddr.IPAddress(ip_net.first + 2),"},{"line_number":116,"context_line":"                      netaddr.IPAddress(subnet_mid_point))"},{"line_number":117,"context_line":"        allocation_pools \u003d [{\u0027start\u0027: str(start),"}],"source_content_type":"text/x-python","patch_set":4,"id":"9f436f4f_fa17b044","line":114,"in_reply_to":"9f436f4f_eb98166b","updated":"2017-08-10 09:25:50.000000000","message":"Thanks for clarification. I confirmed this happens in my python3 environment. The round down is really tricky and it is not what I thought when I commented first.","commit_id":"5160c5da6791a999e6367298d12578797e386b03"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"39693ba51721f3f3d412b03ad31ae53337fe8be0","unresolved":false,"context_lines":[{"line_number":371,"context_line":"        for ip in port[\u0027fixed_ips\u0027]:"},{"line_number":372,"context_line":"            new_fixed_ips[\u0027fixed_ips\u0027].append("},{"line_number":373,"context_line":"                {\u0027subnet_id\u0027: ip[\u0027subnet_id\u0027],"},{"line_number":374,"context_line":"                 \u0027ip_address\u0027: str(netaddr.IPAddress(ip[\u0027ip_address\u0027]) + 1)})"},{"line_number":375,"context_line":"        return new_fixed_ips"},{"line_number":376,"context_line":""},{"line_number":377,"context_line":"    def test_update_port_fixed_ips(self, *mocks):"}],"source_content_type":"text/x-python","patch_set":4,"id":"9f436f4f_77f89fc3","line":374,"updated":"2017-08-09 07:16:20.000000000","message":"(no action needed) the logic can be as follows, but it is personal preference. in addition, it is a test code :)\n\n  new_fixed_ips \u003d [{\u0027subnet_id\u0027: ip[\u0027subnet_id\u0027],\n                    \u0027ip_address\u0027: ....}\n                   for ip in port[\u0027fixed_ips\u0027]]\n  return {\u0027fixed_ips\u0027: new_fixed_ips}","commit_id":"5160c5da6791a999e6367298d12578797e386b03"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"060dafb531045d1f112abf909e1c5ca3c4d71945","unresolved":false,"context_lines":[{"line_number":371,"context_line":"        for ip in port[\u0027fixed_ips\u0027]:"},{"line_number":372,"context_line":"            new_fixed_ips[\u0027fixed_ips\u0027].append("},{"line_number":373,"context_line":"                {\u0027subnet_id\u0027: ip[\u0027subnet_id\u0027],"},{"line_number":374,"context_line":"                 \u0027ip_address\u0027: str(netaddr.IPAddress(ip[\u0027ip_address\u0027]) + 1)})"},{"line_number":375,"context_line":"        return new_fixed_ips"},{"line_number":376,"context_line":""},{"line_number":377,"context_line":"    def test_update_port_fixed_ips(self, *mocks):"}],"source_content_type":"text/x-python","patch_set":4,"id":"9f436f4f_e7bf2af9","line":374,"in_reply_to":"9f436f4f_77f89fc3","updated":"2017-08-09 21:10:08.000000000","message":"Your suggestion is much nice that what I coded. Thanks. Done!","commit_id":"5160c5da6791a999e6367298d12578797e386b03"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"39693ba51721f3f3d412b03ad31ae53337fe8be0","unresolved":false,"context_lines":[{"line_number":447,"context_line":"        port, dns_data_db_1 \u003d self._update_port_for_test(port,"},{"line_number":448,"context_line":"                                                         new_dns_name\u003d\u0027\u0027)"},{"line_number":449,"context_line":"        kwargs \u003d self._compute_new_fixed_ips(port)"},{"line_number":450,"context_line":"        mock_client.reset_mock()"},{"line_number":451,"context_line":"        mock_admin_client.reset_mock()"},{"line_number":452,"context_line":"        port, dns_data_db_2 \u003d self._update_port_for_test(port,"},{"line_number":453,"context_line":"                                                         new_dns_name\u003d\u0027\u0027,"},{"line_number":454,"context_line":"                                                         **kwargs)"}],"source_content_type":"text/x-python","patch_set":4,"id":"9f436f4f_97af8393","line":451,"range":{"start_line":450,"start_character":7,"end_line":451,"end_character":38},"updated":"2017-08-09 07:16:20.000000000","message":"Perhaps it is better we avoid using global mock variable but it looks beyond the scope of this patch.","commit_id":"5160c5da6791a999e6367298d12578797e386b03"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"060dafb531045d1f112abf909e1c5ca3c4d71945","unresolved":false,"context_lines":[{"line_number":447,"context_line":"        port, dns_data_db_1 \u003d self._update_port_for_test(port,"},{"line_number":448,"context_line":"                                                         new_dns_name\u003d\u0027\u0027)"},{"line_number":449,"context_line":"        kwargs \u003d self._compute_new_fixed_ips(port)"},{"line_number":450,"context_line":"        mock_client.reset_mock()"},{"line_number":451,"context_line":"        mock_admin_client.reset_mock()"},{"line_number":452,"context_line":"        port, dns_data_db_2 \u003d self._update_port_for_test(port,"},{"line_number":453,"context_line":"                                                         new_dns_name\u003d\u0027\u0027,"},{"line_number":454,"context_line":"                                                         **kwargs)"}],"source_content_type":"text/x-python","patch_set":4,"id":"9f436f4f_6741fa0b","line":451,"range":{"start_line":450,"start_character":7,"end_line":451,"end_character":38},"in_reply_to":"9f436f4f_97af8393","updated":"2017-08-09 21:10:08.000000000","message":"Agree, beyond the scope of this patchset","commit_id":"5160c5da6791a999e6367298d12578797e386b03"}]}
