)]}'
{"neutron/agent/l3_agent.py":[{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"d195a002f39d102d66d534e2d848401af29106ea","unresolved":false,"context_lines":[{"line_number":528,"context_line":"    def _get_ex_gw_port(self, ri):"},{"line_number":529,"context_line":"        return ri.router.get(\u0027gw_port\u0027)"},{"line_number":530,"context_line":""},{"line_number":531,"context_line":"    def _execute_ip_cmd(self, cmd, ns, chk_exit_code\u003dFalse):"},{"line_number":532,"context_line":"        if self.conf.use_namespaces:"},{"line_number":533,"context_line":"            ip_wrapper \u003d ip_lib.IPWrapper(self.conf.root_helper,"},{"line_number":534,"context_line":"                                          namespace\u003dns)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAVn%2F%2F1HY%3D","line":531,"updated":"2014-03-04 04:11:07.000000000","message":"If you\u0027re going to do something like this it should be more global in scope, and probably be called \u0027ns_execute\u0027 since it\u0027s not just running /sbin/ip in the namespace.  Then the other agents could use it as well.","commit_id":"7f7c029ef536da76db911255e5a0010769d23be1"},{"author":{"_account_id":9633,"name":"Randy Tuttle","email":"rantuttl@cisco.com","username":"rantuttl"},"change_message_id":"bfb8f37bd249dc15504192ec2b6421eff11ffeec","unresolved":false,"context_lines":[{"line_number":528,"context_line":"    def _get_ex_gw_port(self, ri):"},{"line_number":529,"context_line":"        return ri.router.get(\u0027gw_port\u0027)"},{"line_number":530,"context_line":""},{"line_number":531,"context_line":"    def _execute_ip_cmd(self, cmd, ns, chk_exit_code\u003dFalse):"},{"line_number":532,"context_line":"        if self.conf.use_namespaces:"},{"line_number":533,"context_line":"            ip_wrapper \u003d ip_lib.IPWrapper(self.conf.root_helper,"},{"line_number":534,"context_line":"                                          namespace\u003dns)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAVn%2F%2Fuyk%3D","line":531,"in_reply_to":"AAAAVn%2F%2F1HY%3D","updated":"2014-03-07 12:44:25.000000000","message":"Ok. I can change the name. Regarding a more global nature, it likely is; however, I don\u0027t know if other agents need it in its current form. I would prefer to decouple that kind of change and put it in a bug fix as a \"cleanup\" effort. Probably would make sense in iplib, so then we can at least import it into l3_agent.py","commit_id":"7f7c029ef536da76db911255e5a0010769d23be1"},{"author":{"_account_id":55,"name":"Édouard Thuleau","email":"ethuleau@juniper.net","username":"ethuleau"},"change_message_id":"a0e687c5e3261dfc9918e8ca526ad75ce1787aa1","unresolved":false,"context_lines":[{"line_number":549,"context_line":"                ip_wrapper.netns.execute(arping_cmd, check_exit_code\u003dTrue)"},{"line_number":550,"context_line":"            else:"},{"line_number":551,"context_line":"                utils.execute(arping_cmd, check_exit_code\u003dTrue,"},{"line_number":552,"context_line":"                              root_helper\u003dself.root_helper)"},{"line_number":553,"context_line":"        except Exception as e:"},{"line_number":554,"context_line":"            LOG.error(_(\"Failed sending gratuitous ARP: %s\"), str(e))"},{"line_number":555,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAVn%2F%2F9HU%3D","line":552,"updated":"2014-03-03 08:05:13.000000000","message":"You can use the new method \u0027_execute_ip_cmd\u0027 you introduced wiith your patch","commit_id":"7f7c029ef536da76db911255e5a0010769d23be1"},{"author":{"_account_id":9633,"name":"Randy Tuttle","email":"rantuttl@cisco.com","username":"rantuttl"},"change_message_id":"bfb8f37bd249dc15504192ec2b6421eff11ffeec","unresolved":false,"context_lines":[{"line_number":549,"context_line":"                ip_wrapper.netns.execute(arping_cmd, check_exit_code\u003dTrue)"},{"line_number":550,"context_line":"            else:"},{"line_number":551,"context_line":"                utils.execute(arping_cmd, check_exit_code\u003dTrue,"},{"line_number":552,"context_line":"                              root_helper\u003dself.root_helper)"},{"line_number":553,"context_line":"        except Exception as e:"},{"line_number":554,"context_line":"            LOG.error(_(\"Failed sending gratuitous ARP: %s\"), str(e))"},{"line_number":555,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAVn%2F%2F62s%3D","line":552,"in_reply_to":"AAAAVn%2F%2F9HU%3D","updated":"2014-03-07 12:44:25.000000000","message":"I did consider this, but my thinking was not to go churn a lot of unrelated code. I am certain there are other areas of code that are similar to this one. I would prefer that this be part of some code cleanup effort. However, if the consensus is to \"cleanup\" the code, that we can pile that change into this blueprint too.\n\nI would prefer to decouple that kind of change and put it in a bug fix as a \"cleanup\" effort. Probably would make sense in iplib, so then we can at least import it into l3_agent.py","commit_id":"7f7c029ef536da76db911255e5a0010769d23be1"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"d195a002f39d102d66d534e2d848401af29106ea","unresolved":false,"context_lines":[{"line_number":600,"context_line":"                                                 ip[\u0027ip_address\u0027])"},{"line_number":601,"context_line":"            else:"},{"line_number":602,"context_line":"                parm \u003d \u0027net.ipv6.conf.%s.forwarding\u003d1\u0027 % str(interface_name)"},{"line_number":603,"context_line":"                cmd \u003d [\u0027sysctl\u0027, parm]"},{"line_number":604,"context_line":"                self._execute_ip_cmd(cmd, ri.ns_name())"},{"line_number":605,"context_line":"                parm \u003d (\u0027net.ipv6.conf.%s.accept_ra_defrtr\u003d0\u0027 %"},{"line_number":606,"context_line":"                        str(interface_name))"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAVn%2F%2Fy3s%3D","line":603,"updated":"2014-03-04 04:11:07.000000000","message":"These parm/cmd combos are hard to read, just create it in one shot, something like:\n\ncmd \u003d [\u0027sysctl, \u0027-w\u0027, \u0027...%s...\u0027 % iface]\n\nI added the -w here since that\u0027s what the other one in the file does, even though it\u0027s not necessary.","commit_id":"7f7c029ef536da76db911255e5a0010769d23be1"},{"author":{"_account_id":9633,"name":"Randy Tuttle","email":"rantuttl@cisco.com","username":"rantuttl"},"change_message_id":"bfb8f37bd249dc15504192ec2b6421eff11ffeec","unresolved":false,"context_lines":[{"line_number":600,"context_line":"                                                 ip[\u0027ip_address\u0027])"},{"line_number":601,"context_line":"            else:"},{"line_number":602,"context_line":"                parm \u003d \u0027net.ipv6.conf.%s.forwarding\u003d1\u0027 % str(interface_name)"},{"line_number":603,"context_line":"                cmd \u003d [\u0027sysctl\u0027, parm]"},{"line_number":604,"context_line":"                self._execute_ip_cmd(cmd, ri.ns_name())"},{"line_number":605,"context_line":"                parm \u003d (\u0027net.ipv6.conf.%s.accept_ra_defrtr\u003d0\u0027 %"},{"line_number":606,"context_line":"                        str(interface_name))"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAVn%2F%2Fu0c%3D","line":603,"in_reply_to":"AAAAVn%2F%2Fy3s%3D","updated":"2014-03-07 12:44:25.000000000","message":"Sure, I can tidy this up.","commit_id":"7f7c029ef536da76db911255e5a0010769d23be1"},{"author":{"_account_id":1131,"name":"Brian Haley","email":"haleyb.dev@gmail.com","username":"brian-haley"},"change_message_id":"d195a002f39d102d66d534e2d848401af29106ea","unresolved":false,"context_lines":[{"line_number":610,"context_line":"            gw_ip \u003d ip[\u0027gateway_ip\u0027]"},{"line_number":611,"context_line":"            if gw_ip:"},{"line_number":612,"context_line":"                addr_family \u003d \u0027-%s\u0027 % ip_vers"},{"line_number":613,"context_line":"                cmd \u003d [\u0027route\u0027, addr_family, \u0027add\u0027, \u0027default\u0027, \u0027gw\u0027, gw_ip]"},{"line_number":614,"context_line":"                self._execute_ip_cmd(cmd, ri.ns_name())"},{"line_number":615,"context_line":"            elif (ip_vers \u003d\u003d 6):"},{"line_number":616,"context_line":"                # gw_ip is None and IPv6 subnet; assume RA from upstream router"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAVn%2F%2Fywc%3D","line":613,"updated":"2014-03-04 04:11:07.000000000","message":"The route command doesn\u0027t take a -4/-6 argument, it takes -A inet/inet6 - you could change this to use /sbin/ip instead.","commit_id":"7f7c029ef536da76db911255e5a0010769d23be1"},{"author":{"_account_id":9633,"name":"Randy Tuttle","email":"rantuttl@cisco.com","username":"rantuttl"},"change_message_id":"bfb8f37bd249dc15504192ec2b6421eff11ffeec","unresolved":false,"context_lines":[{"line_number":610,"context_line":"            gw_ip \u003d ip[\u0027gateway_ip\u0027]"},{"line_number":611,"context_line":"            if gw_ip:"},{"line_number":612,"context_line":"                addr_family \u003d \u0027-%s\u0027 % ip_vers"},{"line_number":613,"context_line":"                cmd \u003d [\u0027route\u0027, addr_family, \u0027add\u0027, \u0027default\u0027, \u0027gw\u0027, gw_ip]"},{"line_number":614,"context_line":"                self._execute_ip_cmd(cmd, ri.ns_name())"},{"line_number":615,"context_line":"            elif (ip_vers \u003d\u003d 6):"},{"line_number":616,"context_line":"                # gw_ip is None and IPv6 subnet; assume RA from upstream router"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAVn%2F%2Fu7M%3D","line":613,"in_reply_to":"AAAAVn%2F%2Fywc%3D","updated":"2014-03-07 12:44:25.000000000","message":"Good point. Will switch over to the \"ip -4/-6 route add\" command","commit_id":"7f7c029ef536da76db911255e5a0010769d23be1"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"cde84ca06a451b06d07238a9f833fa2f6025b4ff","unresolved":false,"context_lines":[{"line_number":505,"context_line":"            # ex_gw_port should not be None in this case"},{"line_number":506,"context_line":"            ips \u003d ex_gw_port[\u0027fixed_ips\u0027]"},{"line_number":507,"context_line":"            for ip in ips:"},{"line_number":508,"context_line":"                if (netaddr.IPNetwork(ip[\u0027cidr\u0027]).version \u003d\u003d 4):"},{"line_number":509,"context_line":"                    ex_gw_ip \u003d ip[\u0027ip_address\u0027]"},{"line_number":510,"context_line":"                    for rule in self.external_gateway_nat_rules("},{"line_number":511,"context_line":"                        ex_gw_ip,"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2B%2Bhs%3D","line":508,"updated":"2014-03-11 19:14:09.000000000","message":"See comment from line 641.","commit_id":"60fe940d36c33a1ef6f9231aaf74f9729b1354ff"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"cde84ca06a451b06d07238a9f833fa2f6025b4ff","unresolved":false,"context_lines":[{"line_number":583,"context_line":"    def _get_ex_gw_port(self, ri):"},{"line_number":584,"context_line":"        return ri.router.get(\u0027gw_port\u0027)"},{"line_number":585,"context_line":""},{"line_number":586,"context_line":"    def _execute_ns_cmd(self, cmd, ns, chk_exit_code\u003dFalse):"},{"line_number":587,"context_line":"        # TODO(rantuttl) Consider making this more global in nature"},{"line_number":588,"context_line":"        # so that other agents might use it. Do as a bug \"cleanup\" fix."},{"line_number":589,"context_line":"        ip_wrapper \u003d ip_lib.IPWrapper(self.conf.root_helper, namespace\u003dns)"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2B%2BpI%3D","line":586,"updated":"2014-03-11 19:14:09.000000000","message":"Could this just go away?  It now has little value considering the recent refactor.  Below, where this is used, could you get ip_wrapper once and use it multiple times?","commit_id":"60fe940d36c33a1ef6f9231aaf74f9729b1354ff"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"cde84ca06a451b06d07238a9f833fa2f6025b4ff","unresolved":false,"context_lines":[{"line_number":638,"context_line":"                            namespace\u003dri.ns_name(),"},{"line_number":639,"context_line":"                            preserve_ips\u003dpreserve_ips)"},{"line_number":640,"context_line":"        for ip in fixed_ips:"},{"line_number":641,"context_line":"            ip_vers \u003d netaddr.IPNetwork(ip[\u0027cidr\u0027]).version"},{"line_number":642,"context_line":"            if (ip_vers \u003d\u003d 4):"},{"line_number":643,"context_line":"                self._send_gratuitous_arp_packet(ri, interface_name,"},{"line_number":644,"context_line":"                                                 ip[\u0027ip_address\u0027])"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2B%2BiY%3D","line":641,"updated":"2014-03-11 19:14:09.000000000","message":"Lots of \"if version \u003d\u003d 4 do this\" and \"if version \u003d\u003d 6 do that.\"\n\nIs there an abstraction that we can introduce here so that the code does not commingle so much ipv4 and ipv6 together?  Add classes that implement the abstraction for ipv4 and ipv6.  This code would benefit from it, I think.","commit_id":"60fe940d36c33a1ef6f9231aaf74f9729b1354ff"},{"author":{"_account_id":10257,"name":"Sridhar Gaddam","email":"sgaddam@redhat.com","username":"sridhargaddam"},"change_message_id":"8a8fb77e6eb716985ae46ef0deb601078181794c","unresolved":false,"context_lines":[{"line_number":645,"context_line":"            else:"},{"line_number":646,"context_line":"                cmd \u003d [\u0027sysctl\u0027,"},{"line_number":647,"context_line":"                       \u0027net.ipv6.conf.%s.forwarding\u003d1\u0027 % str(interface_name)]"},{"line_number":648,"context_line":"                self._execute_ns_cmd(cmd, ri.ns_name())"},{"line_number":649,"context_line":"                cmd \u003d [\u0027sysctl\u0027,"},{"line_number":650,"context_line":"                       \u0027net.ipv6.conf.%s.accept_ra_defrtr\u003d0\u0027 %"},{"line_number":651,"context_line":"                       str(interface_name)]"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAW3%2F%2Ff4A%3D","line":648,"updated":"2014-04-14 19:08:42.000000000","message":"When you re-base to the latest, please modify ri.ns_name() to ri.ns_name as its no longer a callable function.","commit_id":"60fe940d36c33a1ef6f9231aaf74f9729b1354ff"},{"author":{"_account_id":6685,"name":"Baodong (Robert) Li","email":"baoli@cisco.com","username":"baoli"},"change_message_id":"b8d834da2093c17415dbe6d475b8ac0acadc3905","unresolved":false,"context_lines":[{"line_number":664,"context_line":"                cmd \u003d [\u0027sysctl\u0027,"},{"line_number":665,"context_line":"                       \u0027net.ipv6.conf.%s.accept_ra_defrtr\u003d1\u0027 %"},{"line_number":666,"context_line":"                       str(interface_name)]"},{"line_number":667,"context_line":"                self._execute_ns_cmd(cmd, ri.ns_name())"},{"line_number":668,"context_line":""},{"line_number":669,"context_line":"    def external_gateway_removed(self, ri, ex_gw_port,"},{"line_number":670,"context_line":"                                 interface_name, internal_cidrs):"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2FCXI%3D","line":667,"updated":"2014-03-10 14:46:22.000000000","message":"line 642 to line 667, if I understand the logic correctly, wonder if it can be rearranged a little like something in below:\n       ip_vers \u003d netaddr.IPNetwork(ip[\u0027cidr\u0027]).version\n       gw_ip \u003d ip[\u0027gateway_ip\u0027]\n       if gw_ip:\n           install the route\n\n       if (ip_vers \u003d\u003d 4):\n           send arp\n       elif gw_ip:\n           enable forwarding and don\u0027t accept ra defaul route\n       else:\n           accept ra, forwarding, default route","commit_id":"60fe940d36c33a1ef6f9231aaf74f9729b1354ff"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"cde84ca06a451b06d07238a9f833fa2f6025b4ff","unresolved":false,"context_lines":[{"line_number":690,"context_line":"                          \u0027--to-port %s\u0027 % self.conf.metadata_port))"},{"line_number":691,"context_line":"        return rules"},{"line_number":692,"context_line":""},{"line_number":693,"context_line":"    def external_gateway_nat_rules(self, ex_gw_ip, internal_cidrs,"},{"line_number":694,"context_line":"                                   interface_name):"},{"line_number":695,"context_line":"        rules \u003d [(\u0027POSTROUTING\u0027, \u0027! -i %(interface_name)s \u0027"},{"line_number":696,"context_line":"                  \u0027! -o %(interface_name)s -m conntrack ! \u0027"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2B%2Bj8%3D","line":693,"updated":"2014-03-11 19:14:09.000000000","message":"I think this method should be named with ipv4 in the name to be clear that it is only intended to create nat rules for that version.","commit_id":"60fe940d36c33a1ef6f9231aaf74f9729b1354ff"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"cde84ca06a451b06d07238a9f833fa2f6025b4ff","unresolved":false,"context_lines":[{"line_number":698,"context_line":"                  {\u0027interface_name\u0027: interface_name})]"},{"line_number":699,"context_line":"        for cidr in internal_cidrs:"},{"line_number":700,"context_line":"            net \u003d netaddr.IPNetwork(cidr)"},{"line_number":701,"context_line":"            if (net.version \u003d\u003d 4):"},{"line_number":702,"context_line":"                rules.extend(self.internal_network_nat_rules(ex_gw_ip, cidr))"},{"line_number":703,"context_line":"        return rules"},{"line_number":704,"context_line":""}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2B%2Bms%3D","line":701,"updated":"2014-03-11 19:14:09.000000000","message":"This was checked above where this method was called.  Why check both?","commit_id":"60fe940d36c33a1ef6f9231aaf74f9729b1354ff"}],"neutron/db/db_base_plugin_v2.py":[{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"cde84ca06a451b06d07238a9f833fa2f6025b4ff","unresolved":false,"context_lines":[{"line_number":909,"context_line":"        Check external networks for no more than two subnets,"},{"line_number":910,"context_line":"        and if so, the subnets are not the same version."},{"line_number":911,"context_line":"        \"\"\""},{"line_number":912,"context_line":"        if len(net[\u0027subnets\u0027]) \u003e 2:"},{"line_number":913,"context_line":"            msg \u003d (_(\"More than 2 subnets disallowed on \""},{"line_number":914,"context_line":"                   \"external network: %s\") % net[\u0027id\u0027])"},{"line_number":915,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2B%2Bnc%3D","line":912,"updated":"2014-03-11 19:14:09.000000000","message":"I think there should be a method to check ipv4 subnets and one to check ipv6 subnets.  They should be separated.\n\nI don\u0027t think that one subnet per ip version is a good general rule.  For example, I\u0027d like to allow more than one ipv4 someday soon, long before I attempt to employ ipv6.","commit_id":"60fe940d36c33a1ef6f9231aaf74f9729b1354ff"},{"author":{"_account_id":10257,"name":"Sridhar Gaddam","email":"sgaddam@redhat.com","username":"sridhargaddam"},"change_message_id":"8a8fb77e6eb716985ae46ef0deb601078181794c","unresolved":false,"context_lines":[{"line_number":915,"context_line":"            raise n_exc.InvalidInput(error_message\u003dmsg)"},{"line_number":916,"context_line":"        elif len(net[\u0027subnets\u0027]) \u003d\u003d 2:"},{"line_number":917,"context_line":"            subnet0 \u003d self._get_subnet(context, net[\u0027subnets\u0027][0])"},{"line_number":918,"context_line":"            subnet1 \u003d self._get_subnet(context, net[\u0027subnets\u0027][1])"},{"line_number":919,"context_line":"            if subnet0.ip_version \u003d\u003d subnet1.ip_version:"},{"line_number":920,"context_line":"                data \u003d {\u0027vers\u0027: subnet0.ip_version,"},{"line_number":921,"context_line":"                        \u0027netid\u0027: net[\u0027id\u0027]}"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAW3%2F%2Fduw%3D","line":918,"updated":"2014-04-14 19:08:42.000000000","message":"Please check the calls above. I see that you are not passing the id to _get_subnet. \nYou may want to invoke the api as follows. \nself._get_subnet(context, net[\u0027subnets\u0027][0].id)\n\nI could see the following error. \nSubnet \u003cneutron.db.models_v2.Subnet[object at 4230690] {tenant_id\u003du\u0027682be08c2b3142db9799164ecdeabdd9\u0027, id\u003du\u00270a12aae2-91da-4bac-9cfa-07da0838b4e2\u0027, name\u003du\u0027IPV6Snet\u0027, network_id\u003du\u0027e9761034-e1c7-4537-bdde-0286f28f0711\u0027, ip_version\u003d6L, cidr\u003du\u00272001:1:2:3::/64\u0027, gateway_ip\u003du\u00272001:1:2:3::1\u0027, enable_dhcp\u003dTrue, shared\u003dFalse, ipv6_ra_mode\u003dNone, ipv6_address_mode\u003dNone}\u003e could not be found","commit_id":"60fe940d36c33a1ef6f9231aaf74f9729b1354ff"}],"neutron/db/l3_db.py":[{"author":{"_account_id":6685,"name":"Baodong (Robert) Li","email":"baoli@cisco.com","username":"baoli"},"change_message_id":"59925e5447b1898adc1d52c3e097f252cc3000bf","unresolved":false,"context_lines":[{"line_number":838,"context_line":"            for fixed_ip in fixed_ips:"},{"line_number":839,"context_line":"                my_ports \u003d subnet_id_ports_dict.get(fixed_ip[\u0027subnet_id\u0027], [])"},{"line_number":840,"context_line":"                my_ports.append(port)"},{"line_number":841,"context_line":"                subnet_id_ports_dict[fixed_ip[\u0027subnet_id\u0027]] \u003d my_ports"},{"line_number":842,"context_line":"        if not subnet_id_ports_dict:"},{"line_number":843,"context_line":"            return"},{"line_number":844,"context_line":"        filters \u003d {\u0027id\u0027: subnet_id_ports_dict.keys()}"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAVn%2F%2FLhM%3D","line":841,"updated":"2014-03-07 20:55:32.000000000","message":"This statement is not necessary, and can be removed.","commit_id":"7f7c029ef536da76db911255e5a0010769d23be1"},{"author":{"_account_id":6685,"name":"Baodong (Robert) Li","email":"baoli@cisco.com","username":"baoli"},"change_message_id":"1542be07ca989a0c1b711dc419c8f924d9322667","unresolved":false,"context_lines":[{"line_number":838,"context_line":"            for fixed_ip in fixed_ips:"},{"line_number":839,"context_line":"                my_ports \u003d subnet_id_ports_dict.get(fixed_ip[\u0027subnet_id\u0027], [])"},{"line_number":840,"context_line":"                my_ports.append(port)"},{"line_number":841,"context_line":"                subnet_id_ports_dict[fixed_ip[\u0027subnet_id\u0027]] \u003d my_ports"},{"line_number":842,"context_line":"        if not subnet_id_ports_dict:"},{"line_number":843,"context_line":"            return"},{"line_number":844,"context_line":"        filters \u003d {\u0027id\u0027: subnet_id_ports_dict.keys()}"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAVn%2F%2FC4E%3D","line":841,"in_reply_to":"AAAAVn%2F%2FDL8%3D","updated":"2014-03-10 13:35:29.000000000","message":"got it. thanks. \nWhat I suggested only works when the key already exists in the dict.","commit_id":"7f7c029ef536da76db911255e5a0010769d23be1"},{"author":{"_account_id":9633,"name":"Randy Tuttle","email":"rantuttl@cisco.com","username":"rantuttl"},"change_message_id":"1d52f262282eaa17976a5c9ce3a17cb761d811ac","unresolved":false,"context_lines":[{"line_number":838,"context_line":"            for fixed_ip in fixed_ips:"},{"line_number":839,"context_line":"                my_ports \u003d subnet_id_ports_dict.get(fixed_ip[\u0027subnet_id\u0027], [])"},{"line_number":840,"context_line":"                my_ports.append(port)"},{"line_number":841,"context_line":"                subnet_id_ports_dict[fixed_ip[\u0027subnet_id\u0027]] \u003d my_ports"},{"line_number":842,"context_line":"        if not subnet_id_ports_dict:"},{"line_number":843,"context_line":"            return"},{"line_number":844,"context_line":"        filters \u003d {\u0027id\u0027: subnet_id_ports_dict.keys()}"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAVn%2F%2FDL8%3D","line":841,"in_reply_to":"AAAAVn%2F%2FHog%3D","updated":"2014-03-10 12:35:49.000000000","message":"my_ports is taken from subnet_id_port_dict, but it is an empty dict. I also understand what you are saying, but in practice, it does not behave as you described. See code from python interpreter. As you can see, if I remove this last line (first example), sd remains empty. That is not desired.\n\n\u003e\u003e\u003e sd \u003d{}\n\u003e\u003e\u003e fixed_ips \u003d [{\u0027subnet_id\u0027: \u00271111\u0027, \u0027ip_address\u0027: \u0027192.168.20.2\u0027, \u0027cidr\u0027: \u0027192.168.20.0/24\u0027, \u0027gateway_ip\u0027: \u0027192.168.20.1\u0027}, {\u0027subnet_id\u0027: \u00272222\u0027, \u0027ip_address\u0027: \u00272001:192:168:100::2\u0027, \u0027cidr\u0027: \u00272001:192:168:100::2/64\u0027, \u0027gateway_ip\u0027: \u00272001:192:168:100::1\u0027}]\n\u003e\u003e\u003e \n\u003e\u003e\u003e for fip in fixed_ips:    \n...     mp \u003d sd.get(fip[\u0027subnet_id\u0027],[])\n...     mp.append(\u00271234-5678-9a\u0027)\n... \n\u003e\u003e\u003e sd\n{}\n\u003e\u003e\u003e for fip in fixed_ips:\n...     mp \u003d sd.get(fip[\u0027subnet_id\u0027],[])\n...     mp.append(\u00271234-5678-9a\u0027)\n...     sd[fip[\u0027subnet_id\u0027]] \u003d mp\n... \n\u003e\u003e\u003e sd\n{\u00271111\u0027: [\u00271234-5678-9a\u0027], \u00272222\u0027: [\u00271234-5678-9a\u0027]}","commit_id":"7f7c029ef536da76db911255e5a0010769d23be1"},{"author":{"_account_id":6685,"name":"Baodong (Robert) Li","email":"baoli@cisco.com","username":"baoli"},"change_message_id":"6a87c3403e6e27b643124105fa63756cdd2f726f","unresolved":false,"context_lines":[{"line_number":838,"context_line":"            for fixed_ip in fixed_ips:"},{"line_number":839,"context_line":"                my_ports \u003d subnet_id_ports_dict.get(fixed_ip[\u0027subnet_id\u0027], [])"},{"line_number":840,"context_line":"                my_ports.append(port)"},{"line_number":841,"context_line":"                subnet_id_ports_dict[fixed_ip[\u0027subnet_id\u0027]] \u003d my_ports"},{"line_number":842,"context_line":"        if not subnet_id_ports_dict:"},{"line_number":843,"context_line":"            return"},{"line_number":844,"context_line":"        filters \u003d {\u0027id\u0027: subnet_id_ports_dict.keys()}"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAVn%2F%2FHog%3D","line":841,"in_reply_to":"AAAAVn%2F%2FKo4%3D","updated":"2014-03-09 02:39:35.000000000","message":"my_ports is taken from subnet_id_ports_dict as a list object. Updating it change the contents of the list, but doesn\u0027t modify the reference to the object. That\u0027s why it doesn\u0027t need to assign back.","commit_id":"7f7c029ef536da76db911255e5a0010769d23be1"},{"author":{"_account_id":9633,"name":"Randy Tuttle","email":"rantuttl@cisco.com","username":"rantuttl"},"change_message_id":"5385144f0c3030e6f7f599a87e60de4556637682","unresolved":false,"context_lines":[{"line_number":838,"context_line":"            for fixed_ip in fixed_ips:"},{"line_number":839,"context_line":"                my_ports \u003d subnet_id_ports_dict.get(fixed_ip[\u0027subnet_id\u0027], [])"},{"line_number":840,"context_line":"                my_ports.append(port)"},{"line_number":841,"context_line":"                subnet_id_ports_dict[fixed_ip[\u0027subnet_id\u0027]] \u003d my_ports"},{"line_number":842,"context_line":"        if not subnet_id_ports_dict:"},{"line_number":843,"context_line":"            return"},{"line_number":844,"context_line":"        filters \u003d {\u0027id\u0027: subnet_id_ports_dict.keys()}"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAVn%2F%2FKo4%3D","line":841,"in_reply_to":"AAAAVn%2F%2FLhM%3D","updated":"2014-03-07 22:37:59.000000000","message":"Not sure I follow your reasoning. Why can it be removed? It was there to start with. All I did was place the for-loop around it. It still needs to store a list of ports against the particular subnet.","commit_id":"7f7c029ef536da76db911255e5a0010769d23be1"},{"author":{"_account_id":55,"name":"Édouard Thuleau","email":"ethuleau@juniper.net","username":"ethuleau"},"change_message_id":"a0e687c5e3261dfc9918e8ca526ad75ce1787aa1","unresolved":false,"context_lines":[{"line_number":859,"context_line":"                if (dev_owner \u003d\u003d DEVICE_OWNER_ROUTER_GW):"},{"line_number":860,"context_line":"                    fixed_ips \u003d port.get(\u0027fixed_ips\u0027, [])"},{"line_number":861,"context_line":"                    x \u003d 0"},{"line_number":862,"context_line":"                    while (x \u003c len(fixed_ips)):"},{"line_number":863,"context_line":"                        filters \u003d {\u0027id\u0027: [fixed_ips[x][\u0027subnet_id\u0027]]}"},{"line_number":864,"context_line":"                        fields \u003d [\u0027id\u0027, \u0027cidr\u0027, \u0027gateway_ip\u0027]"},{"line_number":865,"context_line":"                        s \u003d self._core_plugin.get_subnets(context,"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAVn%2F%2F87Q%3D","line":862,"updated":"2014-03-03 08:05:13.000000000","message":"You can use:\n\n for x in xrange(len(fixed_ips)):","commit_id":"7f7c029ef536da76db911255e5a0010769d23be1"},{"author":{"_account_id":9633,"name":"Randy Tuttle","email":"rantuttl@cisco.com","username":"rantuttl"},"change_message_id":"bfb8f37bd249dc15504192ec2b6421eff11ffeec","unresolved":false,"context_lines":[{"line_number":859,"context_line":"                if (dev_owner \u003d\u003d DEVICE_OWNER_ROUTER_GW):"},{"line_number":860,"context_line":"                    fixed_ips \u003d port.get(\u0027fixed_ips\u0027, [])"},{"line_number":861,"context_line":"                    x \u003d 0"},{"line_number":862,"context_line":"                    while (x \u003c len(fixed_ips)):"},{"line_number":863,"context_line":"                        filters \u003d {\u0027id\u0027: [fixed_ips[x][\u0027subnet_id\u0027]]}"},{"line_number":864,"context_line":"                        fields \u003d [\u0027id\u0027, \u0027cidr\u0027, \u0027gateway_ip\u0027]"},{"line_number":865,"context_line":"                        s \u003d self._core_plugin.get_subnets(context,"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAVn%2F%2F61o%3D","line":862,"in_reply_to":"AAAAVn%2F%2F87Q%3D","updated":"2014-03-07 12:44:25.000000000","message":"Yes, great idea. I will look into this.","commit_id":"7f7c029ef536da76db911255e5a0010769d23be1"},{"author":{"_account_id":6685,"name":"Baodong (Robert) Li","email":"baoli@cisco.com","username":"baoli"},"change_message_id":"59925e5447b1898adc1d52c3e097f252cc3000bf","unresolved":false,"context_lines":[{"line_number":864,"context_line":"                        fields \u003d [\u0027id\u0027, \u0027cidr\u0027, \u0027gateway_ip\u0027]"},{"line_number":865,"context_line":"                        s \u003d self._core_plugin.get_subnets(context,"},{"line_number":866,"context_line":"                                                          filters,"},{"line_number":867,"context_line":"                                                          fields)"},{"line_number":868,"context_line":"                        port[\u0027fixed_ips\u0027][x][\u0027cidr\u0027] \u003d s[0][\u0027cidr\u0027]"},{"line_number":869,"context_line":"                        port[\u0027fixed_ips\u0027][x][\u0027gateway_ip\u0027] \u003d s[0][\u0027gateway_ip\u0027]"},{"line_number":870,"context_line":"                        x +\u003d 1"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAVn%2F%2FLYU%3D","line":867,"updated":"2014-03-07 20:55:32.000000000","message":"Just wonder do you still need to call get_subnets() in here? Have the subnet id been added in the previous loop? and therefore it should already been available in the subnet_dicts.","commit_id":"7f7c029ef536da76db911255e5a0010769d23be1"},{"author":{"_account_id":9633,"name":"Randy Tuttle","email":"rantuttl@cisco.com","username":"rantuttl"},"change_message_id":"1d52f262282eaa17976a5c9ce3a17cb761d811ac","unresolved":false,"context_lines":[{"line_number":864,"context_line":"                        fields \u003d [\u0027id\u0027, \u0027cidr\u0027, \u0027gateway_ip\u0027]"},{"line_number":865,"context_line":"                        s \u003d self._core_plugin.get_subnets(context,"},{"line_number":866,"context_line":"                                                          filters,"},{"line_number":867,"context_line":"                                                          fields)"},{"line_number":868,"context_line":"                        port[\u0027fixed_ips\u0027][x][\u0027cidr\u0027] \u003d s[0][\u0027cidr\u0027]"},{"line_number":869,"context_line":"                        port[\u0027fixed_ips\u0027][x][\u0027gateway_ip\u0027] \u003d s[0][\u0027gateway_ip\u0027]"},{"line_number":870,"context_line":"                        x +\u003d 1"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAVn%2F%2FDK8%3D","line":867,"in_reply_to":"AAAAVn%2F%2FHoQ%3D","updated":"2014-03-10 12:35:49.000000000","message":"Let me explore a means to search the local copy of the previous get_subnets call.","commit_id":"7f7c029ef536da76db911255e5a0010769d23be1"},{"author":{"_account_id":6685,"name":"Baodong (Robert) Li","email":"baoli@cisco.com","username":"baoli"},"change_message_id":"6a87c3403e6e27b643124105fa63756cdd2f726f","unresolved":false,"context_lines":[{"line_number":864,"context_line":"                        fields \u003d [\u0027id\u0027, \u0027cidr\u0027, \u0027gateway_ip\u0027]"},{"line_number":865,"context_line":"                        s \u003d self._core_plugin.get_subnets(context,"},{"line_number":866,"context_line":"                                                          filters,"},{"line_number":867,"context_line":"                                                          fields)"},{"line_number":868,"context_line":"                        port[\u0027fixed_ips\u0027][x][\u0027cidr\u0027] \u003d s[0][\u0027cidr\u0027]"},{"line_number":869,"context_line":"                        port[\u0027fixed_ips\u0027][x][\u0027gateway_ip\u0027] \u003d s[0][\u0027gateway_ip\u0027]"},{"line_number":870,"context_line":"                        x +\u003d 1"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAVn%2F%2FHoQ%3D","line":867,"in_reply_to":"AAAAVn%2F%2FKpI%3D","updated":"2014-03-09 02:39:35.000000000","message":"The entire routine could have been written to get each subnet, which would have been much simpler. But I guess that it\u0027s written as what it is because each get_subnet requires a DB query, and therefore grouping all the subnets in a filter would speed up the query. On the other hand, getting the subnet content from a dict is much faster than DB query.\n\nTherefore, if the dict already has the subnet ( which I think is), then no need to do another db query.","commit_id":"7f7c029ef536da76db911255e5a0010769d23be1"},{"author":{"_account_id":9633,"name":"Randy Tuttle","email":"rantuttl@cisco.com","username":"rantuttl"},"change_message_id":"5385144f0c3030e6f7f599a87e60de4556637682","unresolved":false,"context_lines":[{"line_number":864,"context_line":"                        fields \u003d [\u0027id\u0027, \u0027cidr\u0027, \u0027gateway_ip\u0027]"},{"line_number":865,"context_line":"                        s \u003d self._core_plugin.get_subnets(context,"},{"line_number":866,"context_line":"                                                          filters,"},{"line_number":867,"context_line":"                                                          fields)"},{"line_number":868,"context_line":"                        port[\u0027fixed_ips\u0027][x][\u0027cidr\u0027] \u003d s[0][\u0027cidr\u0027]"},{"line_number":869,"context_line":"                        port[\u0027fixed_ips\u0027][x][\u0027gateway_ip\u0027] \u003d s[0][\u0027gateway_ip\u0027]"},{"line_number":870,"context_line":"                        x +\u003d 1"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAAVn%2F%2FKpI%3D","line":867,"in_reply_to":"AAAAVn%2F%2FLYU%3D","updated":"2014-03-07 22:37:59.000000000","message":"The previous get could be based on more that one subnet, and would require that the code search for that specific subnet_id to pull the correct values for populating the payload.","commit_id":"7f7c029ef536da76db911255e5a0010769d23be1"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"cde84ca06a451b06d07238a9f833fa2f6025b4ff","unresolved":false,"context_lines":[{"line_number":876,"context_line":"                # by adding cidr and gateway ip."},{"line_number":877,"context_line":"                if (dev_owner \u003d\u003d DEVICE_OWNER_ROUTER_GW):"},{"line_number":878,"context_line":"                    fixed_ips \u003d port.get(\u0027fixed_ips\u0027, [])"},{"line_number":879,"context_line":"                    for x in xrange(len(fixed_ips)):"},{"line_number":880,"context_line":"                        filters \u003d {\u0027id\u0027: [fixed_ips[x][\u0027subnet_id\u0027]]}"},{"line_number":881,"context_line":"                        fields \u003d [\u0027id\u0027, \u0027cidr\u0027, \u0027gateway_ip\u0027]"},{"line_number":882,"context_line":"                        s \u003d self._core_plugin.get_subnets(context,"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2B%2BgE%3D","line":879,"updated":"2014-03-11 19:14:09.000000000","message":"\"for x, ip in enumerate(fixed_ips)\" reads much better.","commit_id":"60fe940d36c33a1ef6f9231aaf74f9729b1354ff"}],"neutron/tests/unit/test_l3_plugin.py":[{"author":{"_account_id":6685,"name":"Baodong (Robert) Li","email":"baoli@cisco.com","username":"baoli"},"change_message_id":"b8d834da2093c17415dbe6d475b8ac0acadc3905","unresolved":false,"context_lines":[{"line_number":1719,"context_line":"                        self._set_net_external(net_id)"},{"line_number":1720,"context_line":"                        self._add_external_gateway_to_router("},{"line_number":1721,"context_line":"                            r[\u0027router\u0027][\u0027id\u0027], net_id)"},{"line_number":1722,"context_line":"                        #raise Exception(\"\u003e\u003e\u003e Here we are...\")"},{"line_number":1723,"context_line":"                        routers \u003d self.plugin.get_sync_data("},{"line_number":1724,"context_line":"                            context.get_admin_context(),"},{"line_number":1725,"context_line":"                            [r[\u0027router\u0027][\u0027id\u0027]])"}],"source_content_type":"text/x-python","patch_set":3,"id":"AAAAVn%2F%2FCSg%3D","line":1722,"updated":"2014-03-10 14:46:22.000000000","message":"Shall this comment be removed?","commit_id":"60fe940d36c33a1ef6f9231aaf74f9729b1354ff"}]}
