)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"64ce5eb33000180f5ed574fe836971dad172e062","unresolved":false,"context_lines":[{"line_number":18,"context_line":"* Add the policy of portforwarding"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"Partially-Implements: blueprint port-forwarding"},{"line_number":21,"context_line":"This patch partially implements the following spec:"},{"line_number":22,"context_line":"https://specs.openstack.org/openstack/neutron-specs/specs/rocky/port-forwarding.html"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"The race issue fix in:"},{"line_number":25,"context_line":"https://review.openstack.org/#/c/574673/"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"5f7c97a3_80d56e1c","line":22,"range":{"start_line":21,"start_character":0,"end_line":22,"end_character":84},"updated":"2018-07-18 14:47:05.000000000","message":"Again, duplicated to line 20.","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"eb777bcdda8a43fdafb063821397608585f0698b","unresolved":false,"context_lines":[{"line_number":18,"context_line":"* Add the policy of portforwarding"},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"Partially-Implements: blueprint port-forwarding"},{"line_number":21,"context_line":"This patch partially implements the following spec:"},{"line_number":22,"context_line":"https://specs.openstack.org/openstack/neutron-specs/specs/rocky/port-forwarding.html"},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"The race issue fix in:"},{"line_number":25,"context_line":"https://review.openstack.org/#/c/574673/"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"5f7c97a3_2d4ec56d","line":22,"range":{"start_line":21,"start_character":0,"end_line":22,"end_character":84},"in_reply_to":"5f7c97a3_80d56e1c","updated":"2018-07-19 04:24:34.000000000","message":"Done","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"}],"etc/policy.json":[{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"5f543dad4c0cb143acac259c9434b9dabc957374","unresolved":false,"context_lines":[{"line_number":247,"context_line":"    \"update_log\": \"rule:admin_only\","},{"line_number":248,"context_line":"    \"delete_log\": \"rule:admin_only\","},{"line_number":249,"context_line":""},{"line_number":250,"context_line":"    \"create_floatingip_port_forwarding\": \"rule:admin_or_floatingip_owner\","},{"line_number":251,"context_line":"    \"get_floatingip_port_forwarding\": \"rule:regular_user\","},{"line_number":252,"context_line":"    \"get_floatingip_port_forwardings\": \"rule:regular_user\","},{"line_number":253,"context_line":"    \"update_floatingip_port_forwarding\": \"rule:admin_or_floatingip_owner\","}],"source_content_type":"application/json","patch_set":2,"id":"5f7c97a3_68fe1507","line":250,"updated":"2018-07-05 00:27:29.000000000","message":"See my comment to https://review.openstack.org/#/c/579910/2/neutron/api/v2/base.py@763\n\nAlso, if we follow the policy approach for tenant validation, should we add any sort of testing for this: https://github.com/openstack/neutron/blob/master/neutron/tests/unit/test_policy.py?","commit_id":"5f831ad742b0815246ebb172f6ffe47126610686"}],"lower-constraints.txt":[{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"574c56508f5a5eeaa97234d1604b226296f2a123","unresolved":false,"context_lines":[{"line_number":56,"context_line":"munch\u003d\u003d2.1.0"},{"line_number":57,"context_line":"netaddr\u003d\u003d0.7.18"},{"line_number":58,"context_line":"netifaces\u003d\u003d0.10.4"},{"line_number":59,"context_line":"neutron-lib\u003d\u003d1.15.0"},{"line_number":60,"context_line":"openstackdocstheme\u003d\u003d1.18.1"},{"line_number":61,"context_line":"openstacksdk\u003d\u003d0.11.2"},{"line_number":62,"context_line":"os-client-config\u003d\u003d1.28.0"}],"source_content_type":"text/plain","patch_set":3,"id":"5f7c97a3_f23d2abc","line":59,"updated":"2018-07-05 12:33:42.000000000","message":"this should be done in a separate patch","commit_id":"c80a4d1307ef561c8030ff2481b2d59a8adfd9ae"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"1055c648404079eb0578fbdcb37492f0fd57e181","unresolved":false,"context_lines":[{"line_number":56,"context_line":"munch\u003d\u003d2.1.0"},{"line_number":57,"context_line":"netaddr\u003d\u003d0.7.18"},{"line_number":58,"context_line":"netifaces\u003d\u003d0.10.4"},{"line_number":59,"context_line":"neutron-lib\u003d\u003d1.15.0"},{"line_number":60,"context_line":"openstackdocstheme\u003d\u003d1.18.1"},{"line_number":61,"context_line":"openstacksdk\u003d\u003d0.11.2"},{"line_number":62,"context_line":"os-client-config\u003d\u003d1.28.0"}],"source_content_type":"text/plain","patch_set":3,"id":"5f7c97a3_0cd195f8","line":59,"in_reply_to":"5f7c97a3_e83a12c2","updated":"2018-07-06 09:26:48.000000000","message":"Yeah, that means this patch hang by this. As the lower-constraints need to update, if not, the CI will fail..So I will push. Thanks you two. :)","commit_id":"c80a4d1307ef561c8030ff2481b2d59a8adfd9ae"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"5857882db63c09758c4750222c91415e292dd771","unresolved":false,"context_lines":[{"line_number":56,"context_line":"munch\u003d\u003d2.1.0"},{"line_number":57,"context_line":"netaddr\u003d\u003d0.7.18"},{"line_number":58,"context_line":"netifaces\u003d\u003d0.10.4"},{"line_number":59,"context_line":"neutron-lib\u003d\u003d1.15.0"},{"line_number":60,"context_line":"openstackdocstheme\u003d\u003d1.18.1"},{"line_number":61,"context_line":"openstacksdk\u003d\u003d0.11.2"},{"line_number":62,"context_line":"os-client-config\u003d\u003d1.28.0"}],"source_content_type":"text/plain","patch_set":3,"id":"5f7c97a3_e83a12c2","line":59,"in_reply_to":"5f7c97a3_f23d2abc","updated":"2018-07-05 18:28:35.000000000","message":"it can be removed once https://review.openstack.org/#/c/577245/ this gets in or made dependent on it","commit_id":"c80a4d1307ef561c8030ff2481b2d59a8adfd9ae"}],"neutron/api/rpc/handlers/l3_rpc.py":[{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"c2b1619a84e1a7e8cfd31f9b90d23dc5da81f3fd","unresolved":false,"context_lines":[{"line_number":122,"context_line":"            self._ensure_host_set_on_ports(context, host, routers)"},{"line_number":123,"context_line":"            # refresh the data structure after ports are bound"},{"line_number":124,"context_line":"            routers \u003d self._routers_to_sync(context, router_ids, host)"},{"line_number":125,"context_line":"        if directory.get_plugin(plugin_constants.PORTFORWARDING):"},{"line_number":126,"context_line":"            pf_plugin \u003d directory.get_plugin(plugin_constants.PORTFORWARDING)"},{"line_number":127,"context_line":"            pf_plugin.sync_port_forwarding_fip(context, routers)"},{"line_number":128,"context_line":"        return routers"},{"line_number":129,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_ee9d63bb","line":126,"range":{"start_line":125,"start_character":11,"end_line":126,"end_character":77},"updated":"2018-07-04 01:04:32.000000000","message":"instead of using two get calls for get_plugin can only be called once,\npf_plugin \u003d directory.get_plugin(plugin_constants.PORTFORWARDING)\nif pf_plugin:\n   .....","commit_id":"435d8d67d1a4631cd52073a7109b80c05dd961af"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"1ff9aa4e81c622c3b87c56052e43efa705416398","unresolved":false,"context_lines":[{"line_number":122,"context_line":"            self._ensure_host_set_on_ports(context, host, routers)"},{"line_number":123,"context_line":"            # refresh the data structure after ports are bound"},{"line_number":124,"context_line":"            routers \u003d self._routers_to_sync(context, router_ids, host)"},{"line_number":125,"context_line":"        if directory.get_plugin(plugin_constants.PORTFORWARDING):"},{"line_number":126,"context_line":"            pf_plugin \u003d directory.get_plugin(plugin_constants.PORTFORWARDING)"},{"line_number":127,"context_line":"            pf_plugin.sync_port_forwarding_fip(context, routers)"},{"line_number":128,"context_line":"        return routers"},{"line_number":129,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_d949538e","line":126,"range":{"start_line":125,"start_character":11,"end_line":126,"end_character":77},"in_reply_to":"5f7c97a3_ee9d63bb","updated":"2018-07-04 01:59:27.000000000","message":"Done","commit_id":"435d8d67d1a4631cd52073a7109b80c05dd961af"},{"author":{"_account_id":1653,"name":"garyk","email":"gkotton@vmware.com","username":"garyk"},"change_message_id":"574c56508f5a5eeaa97234d1604b226296f2a123","unresolved":false,"context_lines":[{"line_number":122,"context_line":"            self._ensure_host_set_on_ports(context, host, routers)"},{"line_number":123,"context_line":"            # refresh the data structure after ports are bound"},{"line_number":124,"context_line":"            routers \u003d self._routers_to_sync(context, router_ids, host)"},{"line_number":125,"context_line":"        pf_plugin \u003d directory.get_plugin(plugin_constants.PORTFORWARDING)"},{"line_number":126,"context_line":"        if pf_plugin:"},{"line_number":127,"context_line":"            pf_plugin.sync_port_forwarding_fip(context, routers)"},{"line_number":128,"context_line":"        return routers"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_72735ab5","line":125,"updated":"2018-07-05 12:33:42.000000000","message":"this feels like its very hacky. Can this be done via callbacks?","commit_id":"c80a4d1307ef561c8030ff2481b2d59a8adfd9ae"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"bb00e82f1148c35a98eb2b7ed62434ac601c9dfe","unresolved":false,"context_lines":[{"line_number":122,"context_line":"            self._ensure_host_set_on_ports(context, host, routers)"},{"line_number":123,"context_line":"            # refresh the data structure after ports are bound"},{"line_number":124,"context_line":"            routers \u003d self._routers_to_sync(context, router_ids, host)"},{"line_number":125,"context_line":"        pf_plugin \u003d directory.get_plugin(plugin_constants.PORTFORWARDING)"},{"line_number":126,"context_line":"        if pf_plugin:"},{"line_number":127,"context_line":"            pf_plugin.sync_port_forwarding_fip(context, routers)"},{"line_number":128,"context_line":"        return routers"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f7c97a3_dd3eff24","line":125,"in_reply_to":"5f7c97a3_72735ab5","updated":"2018-07-05 13:46:17.000000000","message":"Thanks for review.\nHmm, as we need a way to sync the port forwarding resources through the generic sync router for maintaining the routers instance which covered port forwarding is correct and need a chance to update..Do you mean we need to introduce a new callback mechnism for sync_routers?","commit_id":"c80a4d1307ef561c8030ff2481b2d59a8adfd9ae"}],"neutron/api/v2/base.py":[{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"5f543dad4c0cb143acac259c9434b9dabc957374","unresolved":false,"context_lines":[{"line_number":451,"context_line":"        for item in items:"},{"line_number":452,"context_line":"            self._validate_network_tenant_ownership(request,"},{"line_number":453,"context_line":"                                                    item[self._resource])"},{"line_number":454,"context_line":"            # For L3 resources policy check, we support two types, such as"},{"line_number":455,"context_line":"            # parent_id is in request body, another type is parent_id is in"},{"line_number":456,"context_line":"            # request url, which we can get from kwargs."},{"line_number":457,"context_line":"            if parent_id:"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_a85aed4c","line":454,"range":{"start_line":454,"start_character":14,"end_line":454,"end_character":44},"updated":"2018-07-05 00:27:29.000000000","message":"Please see my comment to L763","commit_id":"5f831ad742b0815246ebb172f6ffe47126610686"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"5f543dad4c0cb143acac259c9434b9dabc957374","unresolved":false,"context_lines":[{"line_number":632,"context_line":"        # Ensure policy engine is initialized"},{"line_number":633,"context_line":"        policy.init()"},{"line_number":634,"context_line":"        parent_id \u003d kwargs.get(self._parent_id_name)"},{"line_number":635,"context_line":"        # If the parent_id exist, we should get orig_obj with"},{"line_number":636,"context_line":"        # self._parent_id_name field."},{"line_number":637,"context_line":"        if parent_id and self._parent_id_name not in field_list:"},{"line_number":638,"context_line":"            field_list.append(self._parent_id_name)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_4853193b","line":635,"updated":"2018-07-05 00:27:29.000000000","message":"Please see my comment to L763","commit_id":"5f831ad742b0815246ebb172f6ffe47126610686"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"5f543dad4c0cb143acac259c9434b9dabc957374","unresolved":false,"context_lines":[{"line_number":760,"context_line":"            msg \u003d _(\u0027The resource could not be found.\u0027)"},{"line_number":761,"context_line":"            raise webob.exc.HTTPNotFound(msg)"},{"line_number":762,"context_line":""},{"line_number":763,"context_line":"    def _set_parent_id_into_l3_resources_request("},{"line_number":764,"context_line":"            self, request, resource_item, parent_id):"},{"line_number":765,"context_line":"        if (request.context.is_admin or request.context.is_advsvc or"},{"line_number":766,"context_line":"                self.parent[\u0027member_name\u0027] not in (l3.FLOATINGIP, l3.ROUTER) or"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_084a0182","line":763,"range":{"start_line":763,"start_character":28,"end_line":763,"end_character":30},"updated":"2018-07-05 00:27:29.000000000","message":"In its current form, this seems to be a hack in the base controller so we can check this set of policies for floating ips port forwarding: https://review.openstack.org/#/c/579910/2/etc/policy.json@250. I would be concerned if that is the case. The base controller shouldn\u0027t have any knowledge of L3 stuff. We are violating abstraction levels.\n\nHaving said that, I think that what you are trying to propose here would apply to any resource (not only L3) where we need to apply a set of policies similar to https://review.openstack.org/#/c/579910/2/etc/policy.json@250 and we have in the API the parent relationship that floating IPs have with port forwardings. Is that the case?\n\nIf yes, I suggest keeping the code but removing from it all references to L3. I would also suggest an expanded set of comments so future developers know how to take advantage of it\n\nBy the way, this doesn\u0027t have to be solved with the policy engine. An alternative is to implement a check in the port forwardings plugin similar to: https://github.com/openstack/neutron/blob/master/neutron/db/l3_db.py#L1142. This way we wouldn\u0027t touch API base controller, which should be as general as possible\n\nFinally, if we follow the policy approach should we add some testing to: https://github.com/openstack/neutron/blob/master/neutron/tests/unit/api/v2/test_base.py?","commit_id":"5f831ad742b0815246ebb172f6ffe47126610686"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"4a72b12573617c77f7069e3b92ab9e2a8479f7c0","unresolved":false,"context_lines":[{"line_number":760,"context_line":"            msg \u003d _(\u0027The resource could not be found.\u0027)"},{"line_number":761,"context_line":"            raise webob.exc.HTTPNotFound(msg)"},{"line_number":762,"context_line":""},{"line_number":763,"context_line":"    def _set_parent_id_into_l3_resources_request("},{"line_number":764,"context_line":"            self, request, resource_item, parent_id):"},{"line_number":765,"context_line":"        if (request.context.is_admin or request.context.is_advsvc or"},{"line_number":766,"context_line":"                self.parent[\u0027member_name\u0027] not in (l3.FLOATINGIP, l3.ROUTER) or"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_dfe120fe","line":763,"range":{"start_line":763,"start_character":28,"end_line":763,"end_character":30},"in_reply_to":"5f7c97a3_084a0182","updated":"2018-07-05 01:44:16.000000000","message":"Thanks for direcion, Miguel. I answer your question inline:\n\n| In its current form, this seems to be a hack in the base controller so we can check this set of\n| policies for floating ips port forwarding: https://review.openstack.org/#/c/579910/2/etc/policy.json@250.\n| I would be concerned if that is the case. The base controller shouldn\u0027t have any knowledge of L3 stuff.\n| We are violating abstraction levels.\n\nbzhao: Yeah, you are right, Miguel. I know this part need to refactor from the community point of view. As\nI found most part of policy for checking resource owner is about core plugin part, such as\nnetwork_owner(http://git.openstack.org/cgit/openstack/neutron/tree/neutron/api/v2/base.py#n451) , so I consider\nif it\u0027s possible to add something similar with that for other extension resources, L3 stuff, not only floatingip,\nbut also routers.. For the root reason is what I want the final policy would write like current \"policy.json\", but\nnot found a very proper way to do. So that\u0027s my thought, and willing to get some advices from you and kind reviewers. And\nI think it\u0027s happening and I\u0027m very happy for raising this. Thank you. Miguel.\n\n| Having said that, I think that what you are trying to propose here would apply to any resource (not only L3)\n| where we need to apply a set of policies similar to https://review.openstack.org/#/c/579910/2/etc/policy.json@250\n| and we have in the API the parent relationship that floating IPs have with port forwardings. Is that the case?\n\nbzhao: Yes, I proposed and tried to make it more general to check the owner of some other extension resources, then\nwe can check the resource owner like network_owner had done.\n\n| If yes, I suggest keeping the code but removing from it all references to L3. I would also suggest an expanded\n| set of comments so future developers know how to take advantage of it\n\nbzhao: Thanks, Miguel. I will do that for considering how to do the more general way to accept the field if we are following policy approach.\n\n| By the way, this doesn\u0027t have to be solved with the policy engine. An alternative is to implement a check in\n| the port forwardings plugin similar to: https://github.com/openstack/neutron/blob/master/neutron/db/l3_db.py#L1142.\n| This way we wouldn\u0027t touch API base controller, which should be as general as possible\n\nbzhao: Correct, we can validate it in plugin, but I\u0027m not sure whether the future policy definition would be confused towards users/depolyers. Like below:\n    \"create_floatingip_port_forwarding\": \"rule:regular_user\",\n    \"get_floatingip_port_forwarding\": \"rule:regular_user??\",\n    \"get_floatingip_port_forwardings\": \"rule:regular_user??\",\n    \"update_floatingip_port_forwarding\": \"rule:regular_user??\",\n    \"delete_floatingip_port_forwarding\": \"rule:regular_user??\",\n\t\"create_floatingip_port_forwarding:SOMEFIELDS\": \"rule:admin??\"\n\t\"update_floatingip_port_forwarding:SOMEFIELDS\": \"rule:admin??\"\nI\u0027m not confident about this definition if it is \"rule:regular_user\" or \"rule:admin\" or something, as we must to check the floatingip\nowner, not port forwarding(default using the floatingip\u0027s tenant_id), and policy will pass all the requests to plugin. Any suggests about this?\n\n\n| Finally, if we follow the policy approach should we add some testing to:\n| https://github.com/openstack/neutron/blob/master/neutron/tests/unit/api/v2/test_base.py?\n \nbzhao: Yeah, as I know there maybe some issues/discuss about this part, so I didn\u0027t post some test codes until found the good way. :)","commit_id":"5f831ad742b0815246ebb172f6ffe47126610686"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"7c2ca90959d446d6ad6934758f0c202dc1e6d1ed","unresolved":false,"context_lines":[{"line_number":760,"context_line":"            msg \u003d _(\u0027The resource could not be found.\u0027)"},{"line_number":761,"context_line":"            raise webob.exc.HTTPNotFound(msg)"},{"line_number":762,"context_line":""},{"line_number":763,"context_line":"    def _set_parent_id_into_l3_resources_request("},{"line_number":764,"context_line":"            self, request, resource_item, parent_id):"},{"line_number":765,"context_line":"        if (request.context.is_admin or request.context.is_advsvc or"},{"line_number":766,"context_line":"                self.parent[\u0027member_name\u0027] not in (l3.FLOATINGIP, l3.ROUTER) or"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_1208ef24","line":763,"range":{"start_line":763,"start_character":28,"end_line":763,"end_character":30},"in_reply_to":"5f7c97a3_3f937402","updated":"2018-07-05 03:00:06.000000000","message":"Thanks, Miguel. It\u0027s very clear for me. I will do it.","commit_id":"5f831ad742b0815246ebb172f6ffe47126610686"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"f74823119255a2b9566cc6ea0ecfd917dfcc4324","unresolved":false,"context_lines":[{"line_number":760,"context_line":"            msg \u003d _(\u0027The resource could not be found.\u0027)"},{"line_number":761,"context_line":"            raise webob.exc.HTTPNotFound(msg)"},{"line_number":762,"context_line":""},{"line_number":763,"context_line":"    def _set_parent_id_into_l3_resources_request("},{"line_number":764,"context_line":"            self, request, resource_item, parent_id):"},{"line_number":765,"context_line":"        if (request.context.is_admin or request.context.is_advsvc or"},{"line_number":766,"context_line":"                self.parent[\u0027member_name\u0027] not in (l3.FLOATINGIP, l3.ROUTER) or"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_3f937402","line":763,"range":{"start_line":763,"start_character":28,"end_line":763,"end_character":30},"in_reply_to":"5f7c97a3_dfe120fe","updated":"2018-07-05 02:23:43.000000000","message":"If we can come up with a generalized approach easily (without starting an entire new project that will take us hundreds of lines) let\u0027s continue with the policy approach\n\nBut if it is too complicated, what is wrong with checking in the plugin? Let\u0027s just follow the example of floating ips and go from there: https://github.com/openstack/neutron/blob/master/etc/policy.json#L145. Let\u0027s keep it simple for the time being and deliver the functionality to the community. If after using it the community feels we need a policy approach, we can implement it based on their feedback\n\nI am very pleased with the code in general. I think is is close to merge. Let\u0027s not complicate it","commit_id":"5f831ad742b0815246ebb172f6ffe47126610686"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"5f543dad4c0cb143acac259c9434b9dabc957374","unresolved":false,"context_lines":[{"line_number":763,"context_line":"    def _set_parent_id_into_l3_resources_request("},{"line_number":764,"context_line":"            self, request, resource_item, parent_id):"},{"line_number":765,"context_line":"        if (request.context.is_admin or request.context.is_advsvc or"},{"line_number":766,"context_line":"                self.parent[\u0027member_name\u0027] not in (l3.FLOATINGIP, l3.ROUTER) or"},{"line_number":767,"context_line":"                resource_item.get(self._resource).get(self._parent_id_name)):"},{"line_number":768,"context_line":"            return"},{"line_number":769,"context_line":"        resource_item[self._resource].setdefault("}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_c83f29dd","line":766,"range":{"start_line":766,"start_character":16,"end_line":766,"end_character":76},"updated":"2018-07-05 00:27:29.000000000","message":"Please see my comment to L763","commit_id":"5f831ad742b0815246ebb172f6ffe47126610686"}],"neutron/extensions/floating_ip_port_forwarding.py":[{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"5830bdaca20fa982dd3f1a10609212cb64d9fc8c","unresolved":false,"context_lines":[{"line_number":76,"context_line":""},{"line_number":77,"context_line":"        return resources"},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"    def update_attributes_map(self, attributes, extension_attrs_map\u003dNone):"},{"line_number":80,"context_line":"        super(Floating_ip_port_forwarding, self).update_attributes_map("},{"line_number":81,"context_line":"            attributes,"},{"line_number":82,"context_line":"            extension_attrs_map\u003ddict("},{"line_number":83,"context_line":"                list(apidef.RESOURCE_ATTRIBUTE_MAP.items()) +"},{"line_number":84,"context_line":"                list(apidef.SUB_RESOURCE_ATTRIBUTE_MAP.items())))"},{"line_number":85,"context_line":""},{"line_number":86,"context_line":"    def get_extended_resources(self, version):"},{"line_number":87,"context_line":"        if version \u003d\u003d \"2.0\":"},{"line_number":88,"context_line":"            return dict(list(apidef.RESOURCE_ATTRIBUTE_MAP.items()) +"},{"line_number":89,"context_line":"                        list(apidef.SUB_RESOURCE_ATTRIBUTE_MAP.items()))"},{"line_number":90,"context_line":"        else:"},{"line_number":91,"context_line":"            return {}"},{"line_number":92,"context_line":""},{"line_number":93,"context_line":""},{"line_number":94,"context_line":"@six.add_metaclass(abc.ABCMeta)"}],"source_content_type":"text/x-python","patch_set":11,"id":"5f7c97a3_8e4ae157","line":91,"range":{"start_line":79,"start_character":0,"end_line":91,"end_character":21},"updated":"2018-07-25 13:46:06.000000000","message":"Not understanding why these 2 methods are needed. Don\u0027t the default ones in the base class do the same thing?? See https://github.com/openstack/neutron-lib/blob/master/neutron_lib/api/extensions.py#L224 and https://github.com/openstack/neutron-lib/blob/master/neutron_lib/api/extensions.py#L259","commit_id":"676a31e40ccdccb8c6862cc9510e462d90868bd2"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"b4bd82fc16912348fca73160a4b76b478919a8ea","unresolved":false,"context_lines":[{"line_number":76,"context_line":""},{"line_number":77,"context_line":"        return resources"},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"    def update_attributes_map(self, attributes, extension_attrs_map\u003dNone):"},{"line_number":80,"context_line":"        super(Floating_ip_port_forwarding, self).update_attributes_map("},{"line_number":81,"context_line":"            attributes,"},{"line_number":82,"context_line":"            extension_attrs_map\u003ddict("},{"line_number":83,"context_line":"                list(apidef.RESOURCE_ATTRIBUTE_MAP.items()) +"},{"line_number":84,"context_line":"                list(apidef.SUB_RESOURCE_ATTRIBUTE_MAP.items())))"},{"line_number":85,"context_line":""},{"line_number":86,"context_line":"    def get_extended_resources(self, version):"},{"line_number":87,"context_line":"        if version \u003d\u003d \"2.0\":"},{"line_number":88,"context_line":"            return dict(list(apidef.RESOURCE_ATTRIBUTE_MAP.items()) +"},{"line_number":89,"context_line":"                        list(apidef.SUB_RESOURCE_ATTRIBUTE_MAP.items()))"},{"line_number":90,"context_line":"        else:"},{"line_number":91,"context_line":"            return {}"},{"line_number":92,"context_line":""},{"line_number":93,"context_line":""},{"line_number":94,"context_line":"@six.add_metaclass(abc.ABCMeta)"}],"source_content_type":"text/x-python","patch_set":11,"id":"5f7c97a3_e1035a10","line":91,"range":{"start_line":79,"start_character":0,"end_line":91,"end_character":21},"in_reply_to":"5f7c97a3_8e4ae157","updated":"2018-07-26 03:04:34.000000000","message":"I want to say, you are right, Thanks boden. Remove it, this is just copied from other files and not change for a long time.","commit_id":"676a31e40ccdccb8c6862cc9510e462d90868bd2"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"371cc97b4d57658d3209ad1ac6d446d08ba1c1b0","unresolved":false,"context_lines":[{"line_number":40,"context_line":"    @classmethod"},{"line_number":41,"context_line":"    def get_resources(cls):"},{"line_number":42,"context_line":"        \"\"\"Returns Ext Resources.\"\"\""},{"line_number":43,"context_line":"        special_mappings \u003d {\u0027floatingips\u0027: \u0027floatingip\u0027}"},{"line_number":44,"context_line":"        plural_mappings \u003d resource_helper.build_plural_mappings("},{"line_number":45,"context_line":"            special_mappings, itertools.chain("},{"line_number":46,"context_line":"                apidef.RESOURCE_ATTRIBUTE_MAP,"}],"source_content_type":"text/x-python","patch_set":12,"id":"5f7c97a3_0a078619","line":43,"updated":"2018-07-26 09:23:04.000000000","message":"why this mapping is special?","commit_id":"21ae99d5b3e287480a2d9cfcfdc2571671d047c4"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"c6814e399d0fec2251599bdecfe563e8318d58a3","unresolved":false,"context_lines":[{"line_number":40,"context_line":"    @classmethod"},{"line_number":41,"context_line":"    def get_resources(cls):"},{"line_number":42,"context_line":"        \"\"\"Returns Ext Resources.\"\"\""},{"line_number":43,"context_line":"        special_mappings \u003d {\u0027floatingips\u0027: \u0027floatingip\u0027}"},{"line_number":44,"context_line":"        plural_mappings \u003d resource_helper.build_plural_mappings("},{"line_number":45,"context_line":"            special_mappings, itertools.chain("},{"line_number":46,"context_line":"                apidef.RESOURCE_ATTRIBUTE_MAP,"}],"source_content_type":"text/x-python","patch_set":12,"id":"5f7c97a3_aaf45289","line":43,"in_reply_to":"5f7c97a3_0a078619","updated":"2018-07-26 09:37:00.000000000","message":"It just a mapping for the relation ship of parent resource and its sub resources. I\u0027m not sure how to explain to make it clear, but can see http://git.openstack.org/cgit/openstack/neutron/tree/neutron/api/v2/resource_helper.py#n27 .. That function just accept a mapping parameter which is named as \"special_mappings\". ;-)","commit_id":"21ae99d5b3e287480a2d9cfcfdc2571671d047c4"}],"neutron/policy.py":[{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"5f543dad4c0cb143acac259c9434b9dabc957374","unresolved":false,"context_lines":[{"line_number":224,"context_line":"    @cache.cache_method_results"},{"line_number":225,"context_line":"    def _extract(self, resource_type, resource_id, field):"},{"line_number":226,"context_line":"        # NOTE(salv-orlando): This check currently assumes the parent"},{"line_number":227,"context_line":"        # resource is handled by the core plugin. It might be worth"},{"line_number":228,"context_line":"        # having a way to map resources to plugins so to make this"},{"line_number":229,"context_line":"        # check more general"},{"line_number":230,"context_line":"        plugin \u003d directory.get_plugin()"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_9caf36df","line":227,"range":{"start_line":227,"start_character":30,"end_line":227,"end_character":48},"updated":"2018-07-05 00:27:29.000000000","message":"If we follow the policy approach for tenant validation, we need to update this comment","commit_id":"5f831ad742b0815246ebb172f6ffe47126610686"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"5f543dad4c0cb143acac259c9434b9dabc957374","unresolved":false,"context_lines":[{"line_number":227,"context_line":"        # resource is handled by the core plugin. It might be worth"},{"line_number":228,"context_line":"        # having a way to map resources to plugins so to make this"},{"line_number":229,"context_line":"        # check more general"},{"line_number":230,"context_line":"        plugin \u003d directory.get_plugin()"},{"line_number":231,"context_line":"        if \u0027%ss\u0027 % resource_type in l3.RESOURCE_ATTRIBUTE_MAP:"},{"line_number":232,"context_line":"            plugin \u003d directory.get_plugin(plugin_consts.L3)"},{"line_number":233,"context_line":"        f \u003d getattr(plugin, \u0027get_%s\u0027 % resource_type)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_1caa4683","line":230,"updated":"2018-07-05 00:27:29.000000000","message":"See my comment to https://review.openstack.org/#/c/579910/2/neutron/api/v2/base.py@763","commit_id":"5f831ad742b0815246ebb172f6ffe47126610686"}],"neutron/services/portforwarding/common/exceptions.py":[{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"c2b1619a84e1a7e8cfd31f9b90d23dc5da81f3fd","unresolved":false,"context_lines":[{"line_number":22,"context_line":""},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"class PortForwardingNotSupportFilterField(n_exc.BadRequest):"},{"line_number":25,"context_line":"    message \u003d _(\"Port Forwarding lists can not be filtered by %(filter)s.\")"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_6ef393e8","line":25,"range":{"start_line":25,"start_character":17,"end_line":25,"end_character":74},"updated":"2018-07-04 01:04:32.000000000","message":"suggestion: \"Port Forwarding filter %(filter)s not supported\"\nor \n             \"Port Forwarding filter %(filter)s is invalid\"\n\nnote: this doesn\u0027t contribute to -1 for patch","commit_id":"435d8d67d1a4631cd52073a7109b80c05dd961af"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"1ff9aa4e81c622c3b87c56052e43efa705416398","unresolved":false,"context_lines":[{"line_number":22,"context_line":""},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"class PortForwardingNotSupportFilterField(n_exc.BadRequest):"},{"line_number":25,"context_line":"    message \u003d _(\"Port Forwarding lists can not be filtered by %(filter)s.\")"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_f94e8f94","line":25,"range":{"start_line":25,"start_character":17,"end_line":25,"end_character":74},"in_reply_to":"5f7c97a3_6ef393e8","updated":"2018-07-04 01:59:27.000000000","message":"Done","commit_id":"435d8d67d1a4631cd52073a7109b80c05dd961af"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"762f4ebfce700b8a5e161cf2dc013b2eba49af08","unresolved":false,"context_lines":[{"line_number":21,"context_line":"    message \u003d _(\"Port Forwarding %(id)s could not be found.\")"},{"line_number":22,"context_line":""},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"class PortForwardingNotSupportFilterField(n_exc.BadRequest):"},{"line_number":25,"context_line":"    message \u003d _(\"Port Forwarding filter %(filter)s not supported.\")"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_88defe68","line":24,"updated":"2018-07-18 08:56:42.000000000","message":"where this exception is raised. I didn\u0027t found any but maybe I missed it simply :)","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"10590763f5897f749c2fcaa38545c36e026ac7df","unresolved":false,"context_lines":[{"line_number":21,"context_line":"    message \u003d _(\"Port Forwarding %(id)s could not be found.\")"},{"line_number":22,"context_line":""},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"class PortForwardingNotSupportFilterField(n_exc.BadRequest):"},{"line_number":25,"context_line":"    message \u003d _(\"Port Forwarding filter %(filter)s not supported.\")"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_d67c82eb","line":24,"in_reply_to":"5f7c97a3_88defe68","updated":"2018-07-19 04:52:03.000000000","message":"It\u0027s in \nhttps://review.openstack.org/#/c/579910/5/neutron/services/portforwarding/pf_plugin.py@276","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"fe1ffffab73e13197556b0dd7f0d0b08151def15","unresolved":false,"context_lines":[{"line_number":22,"context_line":""},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"class PortForwardingNotSupportFilterField(n_exc.BadRequest):"},{"line_number":25,"context_line":"    message \u003d _(\"Port Forwarding filter %(filter)s not supported.\")"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_9246cd56","line":25,"range":{"start_line":25,"start_character":51,"end_line":25,"end_character":64},"updated":"2018-07-23 08:40:59.000000000","message":"nit: \"is not supported\"","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"798d6f243039d5fd56f3c72b1bf281678a745cef","unresolved":false,"context_lines":[{"line_number":22,"context_line":""},{"line_number":23,"context_line":""},{"line_number":24,"context_line":"class PortForwardingNotSupportFilterField(n_exc.BadRequest):"},{"line_number":25,"context_line":"    message \u003d _(\"Port Forwarding filter %(filter)s not supported.\")"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_4db2bd4c","line":25,"range":{"start_line":25,"start_character":51,"end_line":25,"end_character":64},"in_reply_to":"5f7c97a3_9246cd56","updated":"2018-07-24 03:33:48.000000000","message":"Done","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"5830bdaca20fa982dd3f1a10609212cb64d9fc8c","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":11,"id":"5f7c97a3_ae447d49","updated":"2018-07-25 13:46:06.000000000","message":"I\u0027m wondering if these should\u0027ve gone into neutron-lib? IF we think consumers or other implementing this extension might use them; then I think the answer is yes.","commit_id":"676a31e40ccdccb8c6862cc9510e462d90868bd2"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"b4bd82fc16912348fca73160a4b76b478919a8ea","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":11,"id":"5f7c97a3_845e3411","in_reply_to":"5f7c97a3_ae447d49","updated":"2018-07-26 03:04:34.000000000","message":"Hi boden, thanks. As this exceptions.py will be added some other exceptions in the following patches for making this whole patchset smaller as possible(such as https://review.openstack.org/#/c/574673/19/neutron/services/portforwarding/common/exceptions.py ). So could I merge the all server side patches first if possible? Then I will be the responsibility to move the whole file to neutron-lib. Is that OK?","commit_id":"676a31e40ccdccb8c6862cc9510e462d90868bd2"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"371cc97b4d57658d3209ad1ac6d446d08ba1c1b0","unresolved":false,"context_lines":[{"line_number":14,"context_line":"#    under the License."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"from neutron._i18n import _"},{"line_number":17,"context_line":"from neutron_lib import exceptions as n_exc"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"class PortForwardingNotFound(n_exc.NotFound):"}],"source_content_type":"text/x-python","patch_set":12,"id":"5f7c97a3_4a26debb","line":17,"updated":"2018-07-26 09:23:04.000000000","message":"nit: this should be above L16 in separate section","commit_id":"21ae99d5b3e287480a2d9cfcfdc2571671d047c4"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"c6814e399d0fec2251599bdecfe563e8318d58a3","unresolved":false,"context_lines":[{"line_number":14,"context_line":"#    under the License."},{"line_number":15,"context_line":""},{"line_number":16,"context_line":"from neutron._i18n import _"},{"line_number":17,"context_line":"from neutron_lib import exceptions as n_exc"},{"line_number":18,"context_line":""},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"class PortForwardingNotFound(n_exc.NotFound):"}],"source_content_type":"text/x-python","patch_set":12,"id":"5f7c97a3_2a260224","line":17,"in_reply_to":"5f7c97a3_4a26debb","updated":"2018-07-26 09:37:00.000000000","message":";-)","commit_id":"21ae99d5b3e287480a2d9cfcfdc2571671d047c4"}],"neutron/services/portforwarding/pf_plugin.py":[{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"c2b1619a84e1a7e8cfd31f9b90d23dc5da81f3fd","unresolved":false,"context_lines":[{"line_number":191,"context_line":""},{"line_number":192,"context_line":"                pf_obj.update_fields(pf_data, reset_changes\u003dTrue)"},{"line_number":193,"context_line":"                pf_obj.update()"},{"line_number":194,"context_line":"        except obj_exc.NeutronDbObjectDuplicateEntry:"},{"line_number":195,"context_line":"            (__, conflict_params) \u003d self._try_find_exist("},{"line_number":196,"context_line":"                context, floatingip_id, pf_obj.to_dict())"},{"line_number":197,"context_line":"            message \u003d _(\"A duplicate port forwarding entry with same \""},{"line_number":198,"context_line":"                        \"attributes already exists, conflict params \""},{"line_number":199,"context_line":"                        \"like %s\") % conflict_params"},{"line_number":200,"context_line":"            raise lib_exc.BadRequest(resource\u003dapidef.RESOURCE_NAME,"},{"line_number":201,"context_line":"                                     msg\u003dmessage)"},{"line_number":202,"context_line":"        self.push_api.push(context, [pf_obj], rpc_events.UPDATED)"},{"line_number":203,"context_line":"        return pf_obj"},{"line_number":204,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_ee7b23f1","line":201,"range":{"start_line":194,"start_character":8,"end_line":201,"end_character":49},"updated":"2018-07-04 01:04:32.000000000","message":"Duplicate entry for update ? IMO, it make sense for create but for update it just updates the values of existing entry ?","commit_id":"435d8d67d1a4631cd52073a7109b80c05dd961af"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"1ff9aa4e81c622c3b87c56052e43efa705416398","unresolved":false,"context_lines":[{"line_number":191,"context_line":""},{"line_number":192,"context_line":"                pf_obj.update_fields(pf_data, reset_changes\u003dTrue)"},{"line_number":193,"context_line":"                pf_obj.update()"},{"line_number":194,"context_line":"        except obj_exc.NeutronDbObjectDuplicateEntry:"},{"line_number":195,"context_line":"            (__, conflict_params) \u003d self._try_find_exist("},{"line_number":196,"context_line":"                context, floatingip_id, pf_obj.to_dict())"},{"line_number":197,"context_line":"            message \u003d _(\"A duplicate port forwarding entry with same \""},{"line_number":198,"context_line":"                        \"attributes already exists, conflict params \""},{"line_number":199,"context_line":"                        \"like %s\") % conflict_params"},{"line_number":200,"context_line":"            raise lib_exc.BadRequest(resource\u003dapidef.RESOURCE_NAME,"},{"line_number":201,"context_line":"                                     msg\u003dmessage)"},{"line_number":202,"context_line":"        self.push_api.push(context, [pf_obj], rpc_events.UPDATED)"},{"line_number":203,"context_line":"        return pf_obj"},{"line_number":204,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_19c34b5a","line":201,"range":{"start_line":194,"start_character":8,"end_line":201,"end_character":49},"in_reply_to":"5f7c97a3_ee7b23f1","updated":"2018-07-04 01:59:27.000000000","message":"It\u0027s needed.\nExisting 2 port forwardings, such as\nNeutron port A: fixed_ip B:Internal protocol port X -\u003e FLOATINGIP W:external port Y\nNeutron port B: fixed_ip B:Internal protocol port X -\u003e FLOATINGIP W:external port Y2\n\nif the second pf request want to update the internal_neutron_port association from B to A, we can not allow this. Right? That\u0027s why the dunplicate error here.","commit_id":"435d8d67d1a4631cd52073a7109b80c05dd961af"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"c2b1619a84e1a7e8cfd31f9b90d23dc5da81f3fd","unresolved":false,"context_lines":[{"line_number":233,"context_line":"        # so if we want to use the context to get another db queries, we need"},{"line_number":234,"context_line":"        # to rollback first."},{"line_number":235,"context_line":"        context.session.rollback()"},{"line_number":236,"context_line":"        if not specify_params:"},{"line_number":237,"context_line":"            params \u003d [{\u0027floatingip_id\u0027: floatingip_id,"},{"line_number":238,"context_line":"                       \u0027external_port\u0027: port_forwarding[\u0027external_port\u0027]},"},{"line_number":239,"context_line":"                      {\u0027internal_port_id\u0027: port_forwarding[\u0027internal_port_id\u0027],"},{"line_number":240,"context_line":"                       \u0027internal_ip_address\u0027: port_forwarding["},{"line_number":241,"context_line":"                           \u0027internal_ip_address\u0027],"},{"line_number":242,"context_line":"                       \u0027internal_port\u0027: port_forwarding[\u0027internal_port\u0027]}]"},{"line_number":243,"context_line":"        else:"},{"line_number":244,"context_line":"            params \u003d specify_params"},{"line_number":245,"context_line":"        for param in params:"},{"line_number":246,"context_line":"            objs \u003d pf.PortForwarding.get_objects(context, **param)"},{"line_number":247,"context_line":"            if objs:"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_aee8cb7a","line":244,"range":{"start_line":236,"start_character":7,"end_line":244,"end_character":35},"updated":"2018-07-04 01:04:32.000000000","message":"if not specify_params:\n   specify_params \u003d \n   ......\n\nfor param in specify_params.\n\nby doing so else and extra variable won\u0027t be needed.","commit_id":"435d8d67d1a4631cd52073a7109b80c05dd961af"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"1ff9aa4e81c622c3b87c56052e43efa705416398","unresolved":false,"context_lines":[{"line_number":233,"context_line":"        # so if we want to use the context to get another db queries, we need"},{"line_number":234,"context_line":"        # to rollback first."},{"line_number":235,"context_line":"        context.session.rollback()"},{"line_number":236,"context_line":"        if not specify_params:"},{"line_number":237,"context_line":"            params \u003d [{\u0027floatingip_id\u0027: floatingip_id,"},{"line_number":238,"context_line":"                       \u0027external_port\u0027: port_forwarding[\u0027external_port\u0027]},"},{"line_number":239,"context_line":"                      {\u0027internal_port_id\u0027: port_forwarding[\u0027internal_port_id\u0027],"},{"line_number":240,"context_line":"                       \u0027internal_ip_address\u0027: port_forwarding["},{"line_number":241,"context_line":"                           \u0027internal_ip_address\u0027],"},{"line_number":242,"context_line":"                       \u0027internal_port\u0027: port_forwarding[\u0027internal_port\u0027]}]"},{"line_number":243,"context_line":"        else:"},{"line_number":244,"context_line":"            params \u003d specify_params"},{"line_number":245,"context_line":"        for param in params:"},{"line_number":246,"context_line":"            objs \u003d pf.PortForwarding.get_objects(context, **param)"},{"line_number":247,"context_line":"            if objs:"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_99abdb6f","line":244,"range":{"start_line":236,"start_character":7,"end_line":244,"end_character":35},"in_reply_to":"5f7c97a3_aee8cb7a","updated":"2018-07-04 01:59:27.000000000","message":"Oh yeah, right. Thanks. Remove.","commit_id":"435d8d67d1a4631cd52073a7109b80c05dd961af"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"c2b1619a84e1a7e8cfd31f9b90d23dc5da81f3fd","unresolved":false,"context_lines":[{"line_number":284,"context_line":"            context, _pager\u003dpager, floatingip_id\u003dfloatingip_id, **filters)"},{"line_number":285,"context_line":""},{"line_number":286,"context_line":"    def delete_floatingip_port_forwarding(self, context, id, floatingip_id):"},{"line_number":287,"context_line":"        pf_obj \u003d pf.PortForwarding.get_object(context, id\u003did)"},{"line_number":288,"context_line":"        # As the policy will check the floatingip_id existing and its owner is"},{"line_number":289,"context_line":"        # correct, but we don\u0027t know the port forwarding resource is the"},{"line_number":290,"context_line":"        # sub resource of the request floatingip. So need to check the"},{"line_number":291,"context_line":"        # request floatingip_id is the same with the db."},{"line_number":292,"context_line":"        if not pf_obj or pf_obj.floatingip_id !\u003d floatingip_id:"},{"line_number":293,"context_line":"            raise pf_exc.PortForwardingNotFound(id\u003did)"},{"line_number":294,"context_line":"        with db_api.context_manager.writer.using(context):"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_2e259bbf","line":291,"range":{"start_line":287,"start_character":8,"end_line":291,"end_character":56},"updated":"2018-07-04 01:04:32.000000000","message":"shouldn\u0027t this also have check if fip exist like other gets by _get_fip_obj are doing ? if I understand it correctly this cascade delete, so in case floating ip delete get executed first this delete will be a error ?","commit_id":"435d8d67d1a4631cd52073a7109b80c05dd961af"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"1ff9aa4e81c622c3b87c56052e43efa705416398","unresolved":false,"context_lines":[{"line_number":284,"context_line":"            context, _pager\u003dpager, floatingip_id\u003dfloatingip_id, **filters)"},{"line_number":285,"context_line":""},{"line_number":286,"context_line":"    def delete_floatingip_port_forwarding(self, context, id, floatingip_id):"},{"line_number":287,"context_line":"        pf_obj \u003d pf.PortForwarding.get_object(context, id\u003did)"},{"line_number":288,"context_line":"        # As the policy will check the floatingip_id existing and its owner is"},{"line_number":289,"context_line":"        # correct, but we don\u0027t know the port forwarding resource is the"},{"line_number":290,"context_line":"        # sub resource of the request floatingip. So need to check the"},{"line_number":291,"context_line":"        # request floatingip_id is the same with the db."},{"line_number":292,"context_line":"        if not pf_obj or pf_obj.floatingip_id !\u003d floatingip_id:"},{"line_number":293,"context_line":"            raise pf_exc.PortForwardingNotFound(id\u003did)"},{"line_number":294,"context_line":"        with db_api.context_manager.writer.using(context):"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_5953036d","line":291,"range":{"start_line":287,"start_character":8,"end_line":291,"end_character":56},"in_reply_to":"5f7c97a3_2e259bbf","updated":"2018-07-04 01:59:27.000000000","message":"the policy will check the request “parent_id” which is floatingip_id, and make sure it exists and owner is the request tenant, so if the parent_id resource not exist, the request won\u0027t pass the policy check.\nmore details see: http://git.openstack.org/cgit/openstack/neutron/tree/neutron/api/v2/base.py#n555\n\nOther need to notes: we do not allow cascade delete like you said, more details could be found in the \"race condition\" patch. As the trunk/subport resource, we can not delete trunk directly, but delete its subport firstly, the port forwarding is the same.","commit_id":"435d8d67d1a4631cd52073a7109b80c05dd961af"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"c2b1619a84e1a7e8cfd31f9b90d23dc5da81f3fd","unresolved":false,"context_lines":[{"line_number":295,"context_line":"            pf_objs \u003d pf.PortForwarding.get_objects("},{"line_number":296,"context_line":"                context, floatingip_id\u003dpf_obj.floatingip_id)"},{"line_number":297,"context_line":"            if len(pf_objs) \u003d\u003d 1 and pf_objs[0].id \u003d\u003d pf_obj.id:"},{"line_number":298,"context_line":"                fip_obj \u003d router.FloatingIP.get_object("},{"line_number":299,"context_line":"                    context, id\u003dpf_obj.floatingip_id)"},{"line_number":300,"context_line":"                fip_obj.update_fields({\u0027router_id\u0027: None})"},{"line_number":301,"context_line":"                fip_obj.update()"},{"line_number":302,"context_line":"            pf_obj.delete()"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_392c0792","line":299,"range":{"start_line":298,"start_character":16,"end_line":299,"end_character":53},"updated":"2018-07-04 01:04:32.000000000","message":"to answer comment at at L291, here self._get_fip_obj can be used ?","commit_id":"435d8d67d1a4631cd52073a7109b80c05dd961af"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"d6b33fc62f9f6a90d21fead0cf503d15607ce919","unresolved":false,"context_lines":[{"line_number":295,"context_line":"            pf_objs \u003d pf.PortForwarding.get_objects("},{"line_number":296,"context_line":"                context, floatingip_id\u003dpf_obj.floatingip_id)"},{"line_number":297,"context_line":"            if len(pf_objs) \u003d\u003d 1 and pf_objs[0].id \u003d\u003d pf_obj.id:"},{"line_number":298,"context_line":"                fip_obj \u003d router.FloatingIP.get_object("},{"line_number":299,"context_line":"                    context, id\u003dpf_obj.floatingip_id)"},{"line_number":300,"context_line":"                fip_obj.update_fields({\u0027router_id\u0027: None})"},{"line_number":301,"context_line":"                fip_obj.update()"},{"line_number":302,"context_line":"            pf_obj.delete()"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_d9cf13b1","line":299,"range":{"start_line":298,"start_character":16,"end_line":299,"end_character":53},"in_reply_to":"5f7c97a3_392c0792","updated":"2018-07-04 01:06:34.000000000","message":"_get_fip_obj of course need modification to add return incase  that opted here","commit_id":"435d8d67d1a4631cd52073a7109b80c05dd961af"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"1ff9aa4e81c622c3b87c56052e43efa705416398","unresolved":false,"context_lines":[{"line_number":295,"context_line":"            pf_objs \u003d pf.PortForwarding.get_objects("},{"line_number":296,"context_line":"                context, floatingip_id\u003dpf_obj.floatingip_id)"},{"line_number":297,"context_line":"            if len(pf_objs) \u003d\u003d 1 and pf_objs[0].id \u003d\u003d pf_obj.id:"},{"line_number":298,"context_line":"                fip_obj \u003d router.FloatingIP.get_object("},{"line_number":299,"context_line":"                    context, id\u003dpf_obj.floatingip_id)"},{"line_number":300,"context_line":"                fip_obj.update_fields({\u0027router_id\u0027: None})"},{"line_number":301,"context_line":"                fip_obj.update()"},{"line_number":302,"context_line":"            pf_obj.delete()"}],"source_content_type":"text/x-python","patch_set":1,"id":"5f7c97a3_79feff38","line":299,"range":{"start_line":298,"start_character":16,"end_line":299,"end_character":53},"in_reply_to":"5f7c97a3_d9cf13b1","updated":"2018-07-04 01:59:27.000000000","message":"See above explain, if the logic arrives here, the floatingip exists, and we also check the request fip_id is the same as pf_obj.floatingip_id(see L292), we can just use get_object, right?","commit_id":"435d8d67d1a4631cd52073a7109b80c05dd961af"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"5f543dad4c0cb143acac259c9434b9dabc957374","unresolved":false,"context_lines":[{"line_number":159,"context_line":"            (__, conflict_params) \u003d self._try_find_exist("},{"line_number":160,"context_line":"                context, floatingip_id, port_forwarding)"},{"line_number":161,"context_line":"            message \u003d _(\"A duplicate port forwarding entry with same \""},{"line_number":162,"context_line":"                        \"attributes already exists, conflict params \""},{"line_number":163,"context_line":"                        \"like %s\") % conflict_params"},{"line_number":164,"context_line":"            raise lib_exc.BadRequest(resource\u003dapidef.RESOURCE_NAME,"},{"line_number":165,"context_line":"                                     msg\u003dmessage)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_fce0aacd","line":162,"range":{"start_line":162,"start_character":52,"end_line":162,"end_character":67},"updated":"2018-07-05 00:27:29.000000000","message":"nit: conflicting values","commit_id":"5f831ad742b0815246ebb172f6ffe47126610686"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"5f543dad4c0cb143acac259c9434b9dabc957374","unresolved":false,"context_lines":[{"line_number":160,"context_line":"                context, floatingip_id, port_forwarding)"},{"line_number":161,"context_line":"            message \u003d _(\"A duplicate port forwarding entry with same \""},{"line_number":162,"context_line":"                        \"attributes already exists, conflict params \""},{"line_number":163,"context_line":"                        \"like %s\") % conflict_params"},{"line_number":164,"context_line":"            raise lib_exc.BadRequest(resource\u003dapidef.RESOURCE_NAME,"},{"line_number":165,"context_line":"                                     msg\u003dmessage)"},{"line_number":166,"context_line":"        self.push_api.push(context, [pf_obj], rpc_events.CREATED)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_1ce6c6e8","line":163,"range":{"start_line":163,"start_character":25,"end_line":163,"end_character":29},"updated":"2018-07-05 00:27:29.000000000","message":"nit: are","commit_id":"5f831ad742b0815246ebb172f6ffe47126610686"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"5f543dad4c0cb143acac259c9434b9dabc957374","unresolved":false,"context_lines":[{"line_number":195,"context_line":"            (__, conflict_params) \u003d self._try_find_exist("},{"line_number":196,"context_line":"                context, floatingip_id, pf_obj.to_dict())"},{"line_number":197,"context_line":"            message \u003d _(\"A duplicate port forwarding entry with same \""},{"line_number":198,"context_line":"                        \"attributes already exists, conflict params \""},{"line_number":199,"context_line":"                        \"like %s\") % conflict_params"},{"line_number":200,"context_line":"            raise lib_exc.BadRequest(resource\u003dapidef.RESOURCE_NAME,"},{"line_number":201,"context_line":"                                     msg\u003dmessage)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_3cdb8221","line":198,"range":{"start_line":198,"start_character":52,"end_line":198,"end_character":67},"updated":"2018-07-05 00:27:29.000000000","message":"nit: conflicting values","commit_id":"5f831ad742b0815246ebb172f6ffe47126610686"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"5f543dad4c0cb143acac259c9434b9dabc957374","unresolved":false,"context_lines":[{"line_number":196,"context_line":"                context, floatingip_id, pf_obj.to_dict())"},{"line_number":197,"context_line":"            message \u003d _(\"A duplicate port forwarding entry with same \""},{"line_number":198,"context_line":"                        \"attributes already exists, conflict params \""},{"line_number":199,"context_line":"                        \"like %s\") % conflict_params"},{"line_number":200,"context_line":"            raise lib_exc.BadRequest(resource\u003dapidef.RESOURCE_NAME,"},{"line_number":201,"context_line":"                                     msg\u003dmessage)"},{"line_number":202,"context_line":"        self.push_api.push(context, [pf_obj], rpc_events.UPDATED)"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_5ce0becc","line":199,"range":{"start_line":199,"start_character":25,"end_line":199,"end_character":29},"updated":"2018-07-05 00:27:29.000000000","message":"Nit: are","commit_id":"5f831ad742b0815246ebb172f6ffe47126610686"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"5f543dad4c0cb143acac259c9434b9dabc957374","unresolved":false,"context_lines":[{"line_number":283,"context_line":""},{"line_number":284,"context_line":"    def delete_floatingip_port_forwarding(self, context, id, floatingip_id):"},{"line_number":285,"context_line":"        pf_obj \u003d pf.PortForwarding.get_object(context, id\u003did)"},{"line_number":286,"context_line":"        # As the policy will check the floatingip_id existing and its owner is"},{"line_number":287,"context_line":"        # correct, but we don\u0027t know the port forwarding resource is the"},{"line_number":288,"context_line":"        # sub resource of the request floatingip. So need to check the"},{"line_number":289,"context_line":"        # request floatingip_id is the same with the db."}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_bcf7928c","line":286,"range":{"start_line":286,"start_character":10,"end_line":286,"end_character":24},"updated":"2018-07-05 00:27:29.000000000","message":"Please see my comment to https://review.openstack.org/#/c/579910/2/neutron/api/v2/base.py@763","commit_id":"5f831ad742b0815246ebb172f6ffe47126610686"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"5f543dad4c0cb143acac259c9434b9dabc957374","unresolved":false,"context_lines":[{"line_number":324,"context_line":"                router[\u0027port_forwardings_fip_set\u0027] \u003d router_pf_fip_set["},{"line_number":325,"context_line":"                    router[\u0027id\u0027]]"},{"line_number":326,"context_line":"                fip_ids \u003d router_fip[router[\u0027id\u0027]]"},{"line_number":327,"context_line":"                map_list \u003d []"},{"line_number":328,"context_line":"                for id in fip_ids:"},{"line_number":329,"context_line":"                    map_list.append((id, fip_pfs[id]))"},{"line_number":330,"context_line":"                router[\u0027port_forwarding_mappings\u0027] \u003d {"},{"line_number":331,"context_line":"                    \u0027floatingip_port_forwarding_mapping\u0027: map_list}"}],"source_content_type":"text/x-python","patch_set":2,"id":"5f7c97a3_9c1896cd","line":329,"range":{"start_line":327,"start_character":16,"end_line":329,"end_character":54},"updated":"2018-07-05 00:27:29.000000000","message":"nit: could this be a list comprehension?","commit_id":"5f831ad742b0815246ebb172f6ffe47126610686"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"0e4331bf117bcf4a5a444603facf41a3696ffc15","unresolved":false,"context_lines":[{"line_number":75,"context_line":"        self.l3_plugin \u003d directory.get_plugin(constants.L3)"},{"line_number":76,"context_line":"        self.core_plugin \u003d directory.get_plugin()"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":"    def _get_subnet_check_valid_internal_ip(self, request_ip, exist_fixed_ips):"},{"line_number":79,"context_line":"        request_ip \u003d netaddr.IPNetwork(request_ip)"},{"line_number":80,"context_line":"        for fixed_ip in exist_fixed_ips:"},{"line_number":81,"context_line":"            if netaddr.IPNetwork(fixed_ip[\u0027ip_address\u0027]) \u003d\u003d request_ip:"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_159d2bb9","line":78,"range":{"start_line":78,"start_character":8,"end_line":78,"end_character":43},"updated":"2018-07-18 08:51:46.000000000","message":"I would name it \"_get_internal_ip_subnet\" as now it suggest me that this method is doing at least 2 different things: get_subnet and check_valid_ip","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"0e4331bf117bcf4a5a444603facf41a3696ffc15","unresolved":false,"context_lines":[{"line_number":75,"context_line":"        self.l3_plugin \u003d directory.get_plugin(constants.L3)"},{"line_number":76,"context_line":"        self.core_plugin \u003d directory.get_plugin()"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":"    def _get_subnet_check_valid_internal_ip(self, request_ip, exist_fixed_ips):"},{"line_number":79,"context_line":"        request_ip \u003d netaddr.IPNetwork(request_ip)"},{"line_number":80,"context_line":"        for fixed_ip in exist_fixed_ips:"},{"line_number":81,"context_line":"            if netaddr.IPNetwork(fixed_ip[\u0027ip_address\u0027]) \u003d\u003d request_ip:"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_b2fc8d0d","line":78,"range":{"start_line":78,"start_character":62,"end_line":78,"end_character":77},"updated":"2018-07-18 08:51:46.000000000","message":"nit: maybe just \"fixed_ips\" as a name?","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"eb777bcdda8a43fdafb063821397608585f0698b","unresolved":false,"context_lines":[{"line_number":75,"context_line":"        self.l3_plugin \u003d directory.get_plugin(constants.L3)"},{"line_number":76,"context_line":"        self.core_plugin \u003d directory.get_plugin()"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":"    def _get_subnet_check_valid_internal_ip(self, request_ip, exist_fixed_ips):"},{"line_number":79,"context_line":"        request_ip \u003d netaddr.IPNetwork(request_ip)"},{"line_number":80,"context_line":"        for fixed_ip in exist_fixed_ips:"},{"line_number":81,"context_line":"            if netaddr.IPNetwork(fixed_ip[\u0027ip_address\u0027]) \u003d\u003d request_ip:"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_b36238d8","line":78,"range":{"start_line":78,"start_character":8,"end_line":78,"end_character":43},"in_reply_to":"5f7c97a3_159d2bb9","updated":"2018-07-19 04:24:34.000000000","message":"ha, yes. Let me change the name.","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"eb777bcdda8a43fdafb063821397608585f0698b","unresolved":false,"context_lines":[{"line_number":75,"context_line":"        self.l3_plugin \u003d directory.get_plugin(constants.L3)"},{"line_number":76,"context_line":"        self.core_plugin \u003d directory.get_plugin()"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":"    def _get_subnet_check_valid_internal_ip(self, request_ip, exist_fixed_ips):"},{"line_number":79,"context_line":"        request_ip \u003d netaddr.IPNetwork(request_ip)"},{"line_number":80,"context_line":"        for fixed_ip in exist_fixed_ips:"},{"line_number":81,"context_line":"            if netaddr.IPNetwork(fixed_ip[\u0027ip_address\u0027]) \u003d\u003d request_ip:"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_f3a190f7","line":78,"range":{"start_line":78,"start_character":62,"end_line":78,"end_character":77},"in_reply_to":"5f7c97a3_b2fc8d0d","updated":"2018-07-19 04:24:34.000000000","message":"OK.","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":9531,"name":"liuyulong","display_name":"LIU Yulong","email":"i@liuyulong.me","username":"LIU-Yulong"},"change_message_id":"64ce5eb33000180f5ed574fe836971dad172e062","unresolved":false,"context_lines":[{"line_number":81,"context_line":"            if netaddr.IPNetwork(fixed_ip[\u0027ip_address\u0027]) \u003d\u003d request_ip:"},{"line_number":82,"context_line":"                return fixed_ip[\u0027subnet_id\u0027]"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":"    def _find_a_router_for_fippf(self, context, pf_dict, fip_obj):"},{"line_number":85,"context_line":"        internal_port_id \u003d pf_dict[\u0027internal_port_id\u0027]"},{"line_number":86,"context_line":"        internal_port \u003d self.core_plugin.get_port(context, internal_port_id)"},{"line_number":87,"context_line":"        v4_fixed_ips \u003d [fixed_ip for fixed_ip in internal_port[\u0027fixed_ips\u0027]"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_8007aec8","line":84,"range":{"start_line":84,"start_character":27,"end_line":84,"end_character":32},"updated":"2018-07-18 14:47:05.000000000","message":"Can we rename this `fippf` to `fip_port_forwarding`?","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"eb777bcdda8a43fdafb063821397608585f0698b","unresolved":false,"context_lines":[{"line_number":81,"context_line":"            if netaddr.IPNetwork(fixed_ip[\u0027ip_address\u0027]) \u003d\u003d request_ip:"},{"line_number":82,"context_line":"                return fixed_ip[\u0027subnet_id\u0027]"},{"line_number":83,"context_line":""},{"line_number":84,"context_line":"    def _find_a_router_for_fippf(self, context, pf_dict, fip_obj):"},{"line_number":85,"context_line":"        internal_port_id \u003d pf_dict[\u0027internal_port_id\u0027]"},{"line_number":86,"context_line":"        internal_port \u003d self.core_plugin.get_port(context, internal_port_id)"},{"line_number":87,"context_line":"        v4_fixed_ips \u003d [fixed_ip for fixed_ip in internal_port[\u0027fixed_ips\u0027]"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_93acdcee","line":84,"range":{"start_line":84,"start_character":27,"end_line":84,"end_character":32},"in_reply_to":"5f7c97a3_8007aec8","updated":"2018-07-19 04:24:34.000000000","message":"Done","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"0e4331bf117bcf4a5a444603facf41a3696ffc15","unresolved":false,"context_lines":[{"line_number":87,"context_line":"        v4_fixed_ips \u003d [fixed_ip for fixed_ip in internal_port[\u0027fixed_ips\u0027]"},{"line_number":88,"context_line":"                        if (netaddr.IPNetwork(fixed_ip[\u0027ip_address\u0027]"},{"line_number":89,"context_line":"                                              ).version \u003d\u003d"},{"line_number":90,"context_line":"                            lib_consts.IP_VERSION_4)]"},{"line_number":91,"context_line":"        # Get the internal ip address, if not specified, choose the first ipv4"},{"line_number":92,"context_line":"        # address."},{"line_number":93,"context_line":"        internal_ip_address \u003d pf_dict.get(\u0027internal_ip_address\u0027)"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_351f075b","line":90,"updated":"2018-07-18 08:51:46.000000000","message":"what if port has only IPv6 addresses? Shouldn\u0027t You stop here in such case?","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"eb777bcdda8a43fdafb063821397608585f0698b","unresolved":false,"context_lines":[{"line_number":87,"context_line":"        v4_fixed_ips \u003d [fixed_ip for fixed_ip in internal_port[\u0027fixed_ips\u0027]"},{"line_number":88,"context_line":"                        if (netaddr.IPNetwork(fixed_ip[\u0027ip_address\u0027]"},{"line_number":89,"context_line":"                                              ).version \u003d\u003d"},{"line_number":90,"context_line":"                            lib_consts.IP_VERSION_4)]"},{"line_number":91,"context_line":"        # Get the internal ip address, if not specified, choose the first ipv4"},{"line_number":92,"context_line":"        # address."},{"line_number":93,"context_line":"        internal_ip_address \u003d pf_dict.get(\u0027internal_ip_address\u0027)"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_73db4079","line":90,"in_reply_to":"5f7c97a3_351f075b","updated":"2018-07-19 04:24:34.000000000","message":"Yeah, you are right. I will add.","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"0e4331bf117bcf4a5a444603facf41a3696ffc15","unresolved":false,"context_lines":[{"line_number":113,"context_line":"            context, internal_subnet_id)"},{"line_number":114,"context_line":"        external_network_id \u003d fip_obj.floating_network_id"},{"line_number":115,"context_line":"        try:"},{"line_number":116,"context_line":"            router_id \u003d self.l3_plugin.get_router_for_floatingip("},{"line_number":117,"context_line":"                context, internal_port, internal_subnet, external_network_id)"},{"line_number":118,"context_line":"        except lib_l3_exc.ExternalGatewayForFloatingIPNotFound:"},{"line_number":119,"context_line":"            message \u003d _("}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_95893b71","line":116,"range":{"start_line":116,"start_character":12,"end_line":116,"end_character":24},"updated":"2018-07-18 08:51:46.000000000","message":"You can \"return\" here directly and then L130 will not be necessary","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"eb777bcdda8a43fdafb063821397608585f0698b","unresolved":false,"context_lines":[{"line_number":113,"context_line":"            context, internal_subnet_id)"},{"line_number":114,"context_line":"        external_network_id \u003d fip_obj.floating_network_id"},{"line_number":115,"context_line":"        try:"},{"line_number":116,"context_line":"            router_id \u003d self.l3_plugin.get_router_for_floatingip("},{"line_number":117,"context_line":"                context, internal_port, internal_subnet, external_network_id)"},{"line_number":118,"context_line":"        except lib_l3_exc.ExternalGatewayForFloatingIPNotFound:"},{"line_number":119,"context_line":"            message \u003d _("}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_33d38861","line":116,"range":{"start_line":116,"start_character":12,"end_line":116,"end_character":24},"in_reply_to":"5f7c97a3_95893b71","updated":"2018-07-19 04:24:34.000000000","message":"Done","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"0e4331bf117bcf4a5a444603facf41a3696ffc15","unresolved":false,"context_lines":[{"line_number":135,"context_line":"                                          port_forwarding):"},{"line_number":136,"context_line":"        # check if the floatingip_id is the request tenant for query"},{"line_number":137,"context_line":"        # floatingip obj, it can cover all cases for owner check."},{"line_number":138,"context_line":"        self._validate_fip_obj_exists(context, floatingip_id)"},{"line_number":139,"context_line":"        port_forwarding \u003d port_forwarding.get(apidef.RESOURCE_NAME)"},{"line_number":140,"context_line":"        port_forwarding[\u0027floatingip_id\u0027] \u003d floatingip_id"},{"line_number":141,"context_line":"        pf_obj \u003d pf.PortForwarding(context, **port_forwarding)"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_353e278a","line":138,"updated":"2018-07-18 08:51:46.000000000","message":"do we really need this? Wouldn\u0027t this check be done in L145 when You get floating IP object? Now You are doing \"get_object\" twice. Maybe at least You can do something like \"_get_fip_obj\" here instead and return it from this method?","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"eb777bcdda8a43fdafb063821397608585f0698b","unresolved":false,"context_lines":[{"line_number":135,"context_line":"                                          port_forwarding):"},{"line_number":136,"context_line":"        # check if the floatingip_id is the request tenant for query"},{"line_number":137,"context_line":"        # floatingip obj, it can cover all cases for owner check."},{"line_number":138,"context_line":"        self._validate_fip_obj_exists(context, floatingip_id)"},{"line_number":139,"context_line":"        port_forwarding \u003d port_forwarding.get(apidef.RESOURCE_NAME)"},{"line_number":140,"context_line":"        port_forwarding[\u0027floatingip_id\u0027] \u003d floatingip_id"},{"line_number":141,"context_line":"        pf_obj \u003d pf.PortForwarding(context, **port_forwarding)"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_93f7fc8c","line":138,"in_reply_to":"5f7c97a3_353e278a","updated":"2018-07-19 04:24:34.000000000","message":"This func here is for support check the fip owner is the request tenant. As spec or previous discussion mentioned, normal user  allow to CRUD the port forwarding when the parent resource(fip resource) is owned by he/her. So my thought is raising ealier. But I agree with you, let me refactor like your suggest.","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"0e4331bf117bcf4a5a444603facf41a3696ffc15","unresolved":false,"context_lines":[{"line_number":150,"context_line":"                                                          fip_obj)"},{"line_number":151,"context_line":"                # If this func does not raise an exception, means the"},{"line_number":152,"context_line":"                # router_id matched."},{"line_number":153,"context_line":"                # case1: fip_obj.router_id \u003d None"},{"line_number":154,"context_line":"                # case2: fip_obj.router_id is the same with we selected."},{"line_number":155,"context_line":"                self._check_router_match(context, fip_obj,"},{"line_number":156,"context_line":"                                         router_id, port_forwarding)"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_f5c8af75","line":153,"updated":"2018-07-18 08:51:46.000000000","message":"I\u0027m not an L3 expert here but can You explain me more what such case means? Why FIP can not have router_id set and why we want to set it here in such case?","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"fe1ffffab73e13197556b0dd7f0d0b08151def15","unresolved":false,"context_lines":[{"line_number":150,"context_line":"                                                          fip_obj)"},{"line_number":151,"context_line":"                # If this func does not raise an exception, means the"},{"line_number":152,"context_line":"                # router_id matched."},{"line_number":153,"context_line":"                # case1: fip_obj.router_id \u003d None"},{"line_number":154,"context_line":"                # case2: fip_obj.router_id is the same with we selected."},{"line_number":155,"context_line":"                self._check_router_match(context, fip_obj,"},{"line_number":156,"context_line":"                                         router_id, port_forwarding)"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_37980b19","line":153,"in_reply_to":"5f7c97a3_b6a78609","updated":"2018-07-23 08:40:59.000000000","message":"Ok, I see. So it is not possible to have 2 separate networks and use one FIP PF to forward traffic for those 2 different networks if those networks are not using same router. That make sense for me :)","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"eb777bcdda8a43fdafb063821397608585f0698b","unresolved":false,"context_lines":[{"line_number":150,"context_line":"                                                          fip_obj)"},{"line_number":151,"context_line":"                # If this func does not raise an exception, means the"},{"line_number":152,"context_line":"                # router_id matched."},{"line_number":153,"context_line":"                # case1: fip_obj.router_id \u003d None"},{"line_number":154,"context_line":"                # case2: fip_obj.router_id is the same with we selected."},{"line_number":155,"context_line":"                self._check_router_match(context, fip_obj,"},{"line_number":156,"context_line":"                                         router_id, port_forwarding)"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_b6a78609","line":153,"in_reply_to":"5f7c97a3_f5c8af75","updated":"2018-07-19 04:24:34.000000000","message":"I\u0027m not agree. You are an expert. :).\n\nLet me explain here.\nFor case 1, fip_obj.router_id \u003d None, in generic case, if a floatingip associate with a port, logic will find a router to do that, as the fip will be configured in that router namespace. If the fip_obj.router_id is None, that means the fip is \"free\", it just a db record, not be used by a internal port(1:1 DNAT) or port forwardings. Other notes, this feature will maintain the fip status and router_id update. so here we can create port forwarding.\n\nFor case 2, fip_obj.router_id is the same with we selected, the above func _find_a_router_for_fippf will return a router_id based on request port forwarding and existing fip_obj.floating_network_id. That func can find a good router which can reach the request internal_subnet(get from internal neutron port), then we get the router and check the existing fip_obj.router_id(fip was already configured in its previous router), if they are the same, we can do the following, otherwise we need to raise, as it\u0027s impossible to configura the same ip into different router ns.","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"0e4331bf117bcf4a5a444603facf41a3696ffc15","unresolved":false,"context_lines":[{"line_number":174,"context_line":"                                          port_forwarding):"},{"line_number":175,"context_line":"        # check if the floatingip_id is the request tenant for query"},{"line_number":176,"context_line":"        # floatingip obj, it can cover all cases for owner check."},{"line_number":177,"context_line":"        self._validate_fip_obj_exists(context, floatingip_id)"},{"line_number":178,"context_line":"        pf_data \u003d port_forwarding.get(apidef.RESOURCE_NAME)"},{"line_number":179,"context_line":"        new_internal_port_id \u003d None"},{"line_number":180,"context_line":"        if pf_data and pf_data.get(\u0027internal_port_id\u0027):"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_157c4b20","line":177,"updated":"2018-07-18 08:51:46.000000000","message":"same question as above. Do we really need this here?","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"eb777bcdda8a43fdafb063821397608585f0698b","unresolved":false,"context_lines":[{"line_number":174,"context_line":"                                          port_forwarding):"},{"line_number":175,"context_line":"        # check if the floatingip_id is the request tenant for query"},{"line_number":176,"context_line":"        # floatingip obj, it can cover all cases for owner check."},{"line_number":177,"context_line":"        self._validate_fip_obj_exists(context, floatingip_id)"},{"line_number":178,"context_line":"        pf_data \u003d port_forwarding.get(apidef.RESOURCE_NAME)"},{"line_number":179,"context_line":"        new_internal_port_id \u003d None"},{"line_number":180,"context_line":"        if pf_data and pf_data.get(\u0027internal_port_id\u0027):"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_76ad6ee5","line":177,"in_reply_to":"5f7c97a3_157c4b20","updated":"2018-07-19 04:24:34.000000000","message":"Same as above","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"0e4331bf117bcf4a5a444603facf41a3696ffc15","unresolved":false,"context_lines":[{"line_number":233,"context_line":"            raise lib_exc.BadRequest(resource\u003dapidef.RESOURCE_NAME,"},{"line_number":234,"context_line":"                                     msg\u003dmessage)"},{"line_number":235,"context_line":""},{"line_number":236,"context_line":"    def _try_find_exist(self, context, floatingip_id, port_forwarding,"},{"line_number":237,"context_line":"                        specify_params\u003dNone):"},{"line_number":238,"context_line":"        # Because the session had been flushed by NeutronDbObjectDuplicateEntry"},{"line_number":239,"context_line":"        # so if we want to use the context to get another db queries, we need"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_5502c373","line":236,"range":{"start_line":236,"start_character":8,"end_line":236,"end_character":23},"updated":"2018-07-18 08:51:46.000000000","message":"maybe \"_find_existing_pf\"","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"eb777bcdda8a43fdafb063821397608585f0698b","unresolved":false,"context_lines":[{"line_number":233,"context_line":"            raise lib_exc.BadRequest(resource\u003dapidef.RESOURCE_NAME,"},{"line_number":234,"context_line":"                                     msg\u003dmessage)"},{"line_number":235,"context_line":""},{"line_number":236,"context_line":"    def _try_find_exist(self, context, floatingip_id, port_forwarding,"},{"line_number":237,"context_line":"                        specify_params\u003dNone):"},{"line_number":238,"context_line":"        # Because the session had been flushed by NeutronDbObjectDuplicateEntry"},{"line_number":239,"context_line":"        # so if we want to use the context to get another db queries, we need"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_1682fa52","line":236,"range":{"start_line":236,"start_character":8,"end_line":236,"end_character":23},"in_reply_to":"5f7c97a3_5502c373","updated":"2018-07-19 04:24:34.000000000","message":"Done","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"0e4331bf117bcf4a5a444603facf41a3696ffc15","unresolved":false,"context_lines":[{"line_number":262,"context_line":"                                       fields\u003dNone):"},{"line_number":263,"context_line":"        # check if the floatingip_id is the request tenant for query"},{"line_number":264,"context_line":"        # floatingip obj, it can cover all cases for owner check."},{"line_number":265,"context_line":"        self._validate_fip_obj_exists(context, floatingip_id)"},{"line_number":266,"context_line":"        obj \u003d pf.PortForwarding.get_object(context, id\u003did)"},{"line_number":267,"context_line":"        if not obj:"},{"line_number":268,"context_line":"            raise pf_exc.PortForwardingNotFound(id\u003did)"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_5527231f","line":265,"updated":"2018-07-18 08:51:46.000000000","message":"this is not needed IMO. Is it possible that FIP will not be found and port forwarding object will exists for user?","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"eb777bcdda8a43fdafb063821397608585f0698b","unresolved":false,"context_lines":[{"line_number":262,"context_line":"                                       fields\u003dNone):"},{"line_number":263,"context_line":"        # check if the floatingip_id is the request tenant for query"},{"line_number":264,"context_line":"        # floatingip obj, it can cover all cases for owner check."},{"line_number":265,"context_line":"        self._validate_fip_obj_exists(context, floatingip_id)"},{"line_number":266,"context_line":"        obj \u003d pf.PortForwarding.get_object(context, id\u003did)"},{"line_number":267,"context_line":"        if not obj:"},{"line_number":268,"context_line":"            raise pf_exc.PortForwardingNotFound(id\u003did)"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_f63dfe8c","line":265,"in_reply_to":"5f7c97a3_5527231f","updated":"2018-07-19 04:24:34.000000000","message":"As the backend is \"the port forwarding owner is the same with floatingip\", only the fip owner/admin can CRUD port forwarding, here we treat floatingip as the parent resource of port forwarding, and the port forwarding will share the floatingip tenant_id. That means floatingip and port forwarding would be owned by the same tenant. So if you are a generic user, you can still see the port forwarding which created by you owned floatingip. For admin user, admin can create a port forwarding, but it still owned by the floatingip tenant.\n\nIf we don\u0027t limit here, there is a case, the request url:\nv2/floatingips/\u003cNON-EXIST-FIP-ID\u003e/portforwardings/\u003cEXIST-PF-ID\u003e\n\nso the request would success with the wrong request url. That\u0027s bad.","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"0e4331bf117bcf4a5a444603facf41a3696ffc15","unresolved":false,"context_lines":[{"line_number":295,"context_line":"        # check if the floatingip_id is the request tenant for query"},{"line_number":296,"context_line":"        # floatingip obj, it can cover all cases for owner check."},{"line_number":297,"context_line":"        self._validate_fip_obj_exists(context, floatingip_id)"},{"line_number":298,"context_line":"        pf_obj \u003d pf.PortForwarding.get_object(context, id\u003did)"},{"line_number":299,"context_line":""},{"line_number":300,"context_line":"        if not pf_obj or pf_obj.floatingip_id !\u003d floatingip_id:"},{"line_number":301,"context_line":"            raise pf_exc.PortForwardingNotFound(id\u003did)"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_15c9ab22","line":298,"updated":"2018-07-18 08:51:46.000000000","message":"shouldn\u0027t this be done inside transaction also?","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"eb777bcdda8a43fdafb063821397608585f0698b","unresolved":false,"context_lines":[{"line_number":295,"context_line":"        # check if the floatingip_id is the request tenant for query"},{"line_number":296,"context_line":"        # floatingip obj, it can cover all cases for owner check."},{"line_number":297,"context_line":"        self._validate_fip_obj_exists(context, floatingip_id)"},{"line_number":298,"context_line":"        pf_obj \u003d pf.PortForwarding.get_object(context, id\u003did)"},{"line_number":299,"context_line":""},{"line_number":300,"context_line":"        if not pf_obj or pf_obj.floatingip_id !\u003d floatingip_id:"},{"line_number":301,"context_line":"            raise pf_exc.PortForwardingNotFound(id\u003did)"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_b66c669d","line":298,"in_reply_to":"5f7c97a3_15c9ab22","updated":"2018-07-19 04:24:34.000000000","message":"This is just used for the following check and verify the request port forwarding resource exists.","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"0e4331bf117bcf4a5a444603facf41a3696ffc15","unresolved":false,"context_lines":[{"line_number":297,"context_line":"        self._validate_fip_obj_exists(context, floatingip_id)"},{"line_number":298,"context_line":"        pf_obj \u003d pf.PortForwarding.get_object(context, id\u003did)"},{"line_number":299,"context_line":""},{"line_number":300,"context_line":"        if not pf_obj or pf_obj.floatingip_id !\u003d floatingip_id:"},{"line_number":301,"context_line":"            raise pf_exc.PortForwardingNotFound(id\u003did)"},{"line_number":302,"context_line":"        with db_api.context_manager.writer.using(context):"},{"line_number":303,"context_line":"            pf_objs \u003d pf.PortForwarding.get_objects("}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_350b877c","line":300,"range":{"start_line":300,"start_character":25,"end_line":300,"end_character":62},"updated":"2018-07-18 08:51:46.000000000","message":"I\u0027m fine to have it here but I wonder how such case is possible :)","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"fe1ffffab73e13197556b0dd7f0d0b08151def15","unresolved":false,"context_lines":[{"line_number":297,"context_line":"        self._validate_fip_obj_exists(context, floatingip_id)"},{"line_number":298,"context_line":"        pf_obj \u003d pf.PortForwarding.get_object(context, id\u003did)"},{"line_number":299,"context_line":""},{"line_number":300,"context_line":"        if not pf_obj or pf_obj.floatingip_id !\u003d floatingip_id:"},{"line_number":301,"context_line":"            raise pf_exc.PortForwardingNotFound(id\u003did)"},{"line_number":302,"context_line":"        with db_api.context_manager.writer.using(context):"},{"line_number":303,"context_line":"            pf_objs \u003d pf.PortForwarding.get_objects("}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_57b6e78b","line":300,"range":{"start_line":300,"start_character":25,"end_line":300,"end_character":62},"in_reply_to":"5f7c97a3_162c3a48","updated":"2018-07-23 08:40:59.000000000","message":"ok, that\u0027s clear for me now","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"eb777bcdda8a43fdafb063821397608585f0698b","unresolved":false,"context_lines":[{"line_number":297,"context_line":"        self._validate_fip_obj_exists(context, floatingip_id)"},{"line_number":298,"context_line":"        pf_obj \u003d pf.PortForwarding.get_object(context, id\u003did)"},{"line_number":299,"context_line":""},{"line_number":300,"context_line":"        if not pf_obj or pf_obj.floatingip_id !\u003d floatingip_id:"},{"line_number":301,"context_line":"            raise pf_exc.PortForwardingNotFound(id\u003did)"},{"line_number":302,"context_line":"        with db_api.context_manager.writer.using(context):"},{"line_number":303,"context_line":"            pf_objs \u003d pf.PortForwarding.get_objects("}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_162c3a48","line":300,"range":{"start_line":300,"start_character":25,"end_line":300,"end_character":62},"in_reply_to":"5f7c97a3_350b877c","updated":"2018-07-19 04:24:34.000000000","message":"If we don\u0027t limit here, there is a case, the request url:\nv2/floatingips/\u003cOther-EXIST-FIP-ID\u003e/portforwardings/\u003cEXIST-PF-ID\u003e\n\nhere even though the port forwarding resource exist, but it is the sub resource towards FIPA. And see that url, it seems to request the port forwarding under \u003cOther-EXIST-FIP-ID\u003e, so we need to raise.","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"0e4331bf117bcf4a5a444603facf41a3696ffc15","unresolved":false,"context_lines":[{"line_number":312,"context_line":""},{"line_number":313,"context_line":"    def _get_port_forwarding_by_routers(self, context, router_ids):"},{"line_number":314,"context_line":"        return pf.PortForwarding.get_port_forwarding_obj_by_routers("},{"line_number":315,"context_line":"            context, router_ids)"},{"line_number":316,"context_line":""},{"line_number":317,"context_line":"    def sync_port_forwarding_fip(self, context, routers):"},{"line_number":318,"context_line":"        if not routers:"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_f5fc2f40","line":315,"updated":"2018-07-18 08:51:46.000000000","message":"do You really need such special one line method?","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"eb777bcdda8a43fdafb063821397608585f0698b","unresolved":false,"context_lines":[{"line_number":312,"context_line":""},{"line_number":313,"context_line":"    def _get_port_forwarding_by_routers(self, context, router_ids):"},{"line_number":314,"context_line":"        return pf.PortForwarding.get_port_forwarding_obj_by_routers("},{"line_number":315,"context_line":"            context, router_ids)"},{"line_number":316,"context_line":""},{"line_number":317,"context_line":"    def sync_port_forwarding_fip(self, context, routers):"},{"line_number":318,"context_line":"        if not routers:"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_f058a689","line":315,"in_reply_to":"5f7c97a3_f5fc2f40","updated":"2018-07-19 04:24:34.000000000","message":"No, let me remove it. :)","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"64b80fc3daf09cb29b1d417362e9f144e946e133","unresolved":false,"context_lines":[{"line_number":331,"context_line":""},{"line_number":332,"context_line":"        for router in routers:"},{"line_number":333,"context_line":"            if router[\u0027id\u0027] in router_fip:"},{"line_number":334,"context_line":"                router[\u0027port_forwardings_fip_set\u0027] \u003d router_pf_fip_set["},{"line_number":335,"context_line":"                    router[\u0027id\u0027]]"},{"line_number":336,"context_line":"                fip_ids \u003d router_fip[router[\u0027id\u0027]]"},{"line_number":337,"context_line":"                router[\u0027port_forwarding_mappings\u0027] \u003d {"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_d9c11c51","line":334,"range":{"start_line":334,"start_character":16,"end_line":334,"end_character":50},"updated":"2018-07-18 21:03:12.000000000","message":"After going through https://review.openstack.org/#/c/533850/28/neutron/agent/l3/extensions/port_forwarding.py, I couldn\u0027t find where you use this. Why sent it to the agent then?","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"eb777bcdda8a43fdafb063821397608585f0698b","unresolved":false,"context_lines":[{"line_number":331,"context_line":""},{"line_number":332,"context_line":"        for router in routers:"},{"line_number":333,"context_line":"            if router[\u0027id\u0027] in router_fip:"},{"line_number":334,"context_line":"                router[\u0027port_forwardings_fip_set\u0027] \u003d router_pf_fip_set["},{"line_number":335,"context_line":"                    router[\u0027id\u0027]]"},{"line_number":336,"context_line":"                fip_ids \u003d router_fip[router[\u0027id\u0027]]"},{"line_number":337,"context_line":"                router[\u0027port_forwarding_mappings\u0027] \u003d {"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_edef6d19","line":334,"range":{"start_line":334,"start_character":16,"end_line":334,"end_character":50},"in_reply_to":"5f7c97a3_d9c11c51","updated":"2018-07-19 04:24:34.000000000","message":"Oh, I think you may miss something, I try to explain here, this field is for taking over the fip management from router to port_forwarding agent extension. As before port forwarding extension process the router update, or restart the whole l3 agent, the logic will remove the fip from router ns if it think the fip is not managed by agent, so I add this field to tell agent, not remove these fips which used by port forwarding, otherwise if router update/l3 agent restart, the fip will be removed first(router existing process logic https://review.openstack.org/#/c/533850/28/neutron/agent/l3/router_info.py@382) and then port forwarding l3 extension will add. But during this period, the data plane traffic is down, that\u0027s unexpected. For this inline field \u0027port_forwardings_fip_set\u0027, You will find it in https://review.openstack.org/#/c/533850/28/neutron/agent/l3/router_info.py@1165","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"64b80fc3daf09cb29b1d417362e9f144e946e133","unresolved":false,"context_lines":[{"line_number":336,"context_line":"                fip_ids \u003d router_fip[router[\u0027id\u0027]]"},{"line_number":337,"context_line":"                router[\u0027port_forwarding_mappings\u0027] \u003d {"},{"line_number":338,"context_line":"                    \u0027floatingip_port_forwarding_mapping\u0027:"},{"line_number":339,"context_line":"                        [(fip_id, fip_pfs[fip_id]) for fip_id in fip_ids]}"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_998ba415","line":339,"range":{"start_line":339,"start_character":34,"end_line":339,"end_character":49},"updated":"2018-07-18 21:03:12.000000000","message":"As far as I can tell, on the agent side you are not using this part of the tuple: https://review.openstack.org/#/c/533850/28/neutron/agent/l3/extensions/port_forwarding.py@384. Why the send it? This could be just a list of fip ids","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"eb777bcdda8a43fdafb063821397608585f0698b","unresolved":false,"context_lines":[{"line_number":336,"context_line":"                fip_ids \u003d router_fip[router[\u0027id\u0027]]"},{"line_number":337,"context_line":"                router[\u0027port_forwarding_mappings\u0027] \u003d {"},{"line_number":338,"context_line":"                    \u0027floatingip_port_forwarding_mapping\u0027:"},{"line_number":339,"context_line":"                        [(fip_id, fip_pfs[fip_id]) for fip_id in fip_ids]}"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_706b361b","line":339,"range":{"start_line":339,"start_character":34,"end_line":339,"end_character":49},"in_reply_to":"5f7c97a3_998ba415","updated":"2018-07-19 04:24:34.000000000","message":"Thanks, Miguel. You are right. I will remove the other half and make it as a fip_list.","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"fe1ffffab73e13197556b0dd7f0d0b08151def15","unresolved":false,"context_lines":[{"line_number":92,"context_line":"        if not v4_fixed_ips:"},{"line_number":93,"context_line":"            # As port forwarding works with ipv4 addresses,"},{"line_number":94,"context_line":"            # if there is no ipv4 address, we need to raise."},{"line_number":95,"context_line":"            message \u003d _(\"Requested neutron port %s must allocate \""},{"line_number":96,"context_line":"                        \"an IPv4 address at least.\") % internal_port_id"},{"line_number":97,"context_line":"            raise lib_exc.BadRequest(resource\u003dapidef.RESOURCE_NAME,"},{"line_number":98,"context_line":"                                     msg\u003dmessage)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_529ef5b7","line":95,"range":{"start_line":95,"start_character":35,"end_line":95,"end_character":42},"updated":"2018-07-23 08:40:59.000000000","message":"nit: I don\u0027t think that this word is necessary here.\nTo distinguish neutron port from tcp port, maybe better would be \"requested internal port...\" instead of \"neutron\"?","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"798d6f243039d5fd56f3c72b1bf281678a745cef","unresolved":false,"context_lines":[{"line_number":92,"context_line":"        if not v4_fixed_ips:"},{"line_number":93,"context_line":"            # As port forwarding works with ipv4 addresses,"},{"line_number":94,"context_line":"            # if there is no ipv4 address, we need to raise."},{"line_number":95,"context_line":"            message \u003d _(\"Requested neutron port %s must allocate \""},{"line_number":96,"context_line":"                        \"an IPv4 address at least.\") % internal_port_id"},{"line_number":97,"context_line":"            raise lib_exc.BadRequest(resource\u003dapidef.RESOURCE_NAME,"},{"line_number":98,"context_line":"                                     msg\u003dmessage)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_683f7e86","line":95,"range":{"start_line":95,"start_character":35,"end_line":95,"end_character":42},"in_reply_to":"5f7c97a3_529ef5b7","updated":"2018-07-24 03:33:48.000000000","message":"Yeah, thanks, You said make sence to me. :)","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"fe1ffffab73e13197556b0dd7f0d0b08151def15","unresolved":false,"context_lines":[{"line_number":105,"context_line":"            pf_dict[\u0027internal_ip_address\u0027] \u003d internal_ip_address"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"        # check the matched fixed ip"},{"line_number":108,"context_line":"        internal_subnet_id \u003d self._get_internal_ip_subnet("},{"line_number":109,"context_line":"            internal_ip_address, v4_fixed_ips)"},{"line_number":110,"context_line":"        if not internal_subnet_id:"},{"line_number":111,"context_line":"            message \u003d _("},{"line_number":112,"context_line":"                \"Requested internal IP address %(internal_ip_address)s is not \""},{"line_number":113,"context_line":"                \"suitable for internal neutron port %(internal_port_id)s, as \""},{"line_number":114,"context_line":"                \"its fixed_ips are %(fixed_ips)s\") % {"},{"line_number":115,"context_line":"                \u0027internal_ip_address\u0027: internal_ip_address,"},{"line_number":116,"context_line":"                \u0027internal_port_id\u0027: internal_port[\u0027id\u0027],"},{"line_number":117,"context_line":"                \u0027fixed_ips\u0027: v4_fixed_ips}"},{"line_number":118,"context_line":"            raise lib_exc.BadRequest(resource\u003dapidef.RESOURCE_NAME,"},{"line_number":119,"context_line":"                                     msg\u003dmessage)"},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"        internal_subnet \u003d self.core_plugin.get_subnet("},{"line_number":122,"context_line":"            context, internal_subnet_id)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_f2b5c11a","line":119,"range":{"start_line":108,"start_character":8,"end_line":119,"end_character":49},"updated":"2018-07-23 08:40:59.000000000","message":"correct me if I\u0027m wrong but IMO this is necessary only if there was internal_ip_address specified in request. If it was not set and was chosen in L104, this check is not necessary, right?","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"c10f4553d316ba25248dcba521c0ef03dc8aef45","unresolved":false,"context_lines":[{"line_number":105,"context_line":"            pf_dict[\u0027internal_ip_address\u0027] \u003d internal_ip_address"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"        # check the matched fixed ip"},{"line_number":108,"context_line":"        internal_subnet_id \u003d self._get_internal_ip_subnet("},{"line_number":109,"context_line":"            internal_ip_address, v4_fixed_ips)"},{"line_number":110,"context_line":"        if not internal_subnet_id:"},{"line_number":111,"context_line":"            message \u003d _("},{"line_number":112,"context_line":"                \"Requested internal IP address %(internal_ip_address)s is not \""},{"line_number":113,"context_line":"                \"suitable for internal neutron port %(internal_port_id)s, as \""},{"line_number":114,"context_line":"                \"its fixed_ips are %(fixed_ips)s\") % {"},{"line_number":115,"context_line":"                \u0027internal_ip_address\u0027: internal_ip_address,"},{"line_number":116,"context_line":"                \u0027internal_port_id\u0027: internal_port[\u0027id\u0027],"},{"line_number":117,"context_line":"                \u0027fixed_ips\u0027: v4_fixed_ips}"},{"line_number":118,"context_line":"            raise lib_exc.BadRequest(resource\u003dapidef.RESOURCE_NAME,"},{"line_number":119,"context_line":"                                     msg\u003dmessage)"},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"        internal_subnet \u003d self.core_plugin.get_subnet("},{"line_number":122,"context_line":"            context, internal_subnet_id)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_bbdb864c","line":119,"range":{"start_line":108,"start_character":8,"end_line":119,"end_character":49},"in_reply_to":"5f7c97a3_a374d99c","updated":"2018-07-24 08:37:31.000000000","message":"Yes, I was talking about case 2 that then it\u0027s not necessary.\nTo get subnet_id in such case You can just add:\n\n    internal_subnet_id \u003d v4_fixed_ips[0][\u0027subnet_id\u0027]\n\nin L104 as Manjeet said already :)","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"370ec7dd1660de1fafabd4ce99b9c85ce14275d3","unresolved":false,"context_lines":[{"line_number":105,"context_line":"            pf_dict[\u0027internal_ip_address\u0027] \u003d internal_ip_address"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"        # check the matched fixed ip"},{"line_number":108,"context_line":"        internal_subnet_id \u003d self._get_internal_ip_subnet("},{"line_number":109,"context_line":"            internal_ip_address, v4_fixed_ips)"},{"line_number":110,"context_line":"        if not internal_subnet_id:"},{"line_number":111,"context_line":"            message \u003d _("},{"line_number":112,"context_line":"                \"Requested internal IP address %(internal_ip_address)s is not \""},{"line_number":113,"context_line":"                \"suitable for internal neutron port %(internal_port_id)s, as \""},{"line_number":114,"context_line":"                \"its fixed_ips are %(fixed_ips)s\") % {"},{"line_number":115,"context_line":"                \u0027internal_ip_address\u0027: internal_ip_address,"},{"line_number":116,"context_line":"                \u0027internal_port_id\u0027: internal_port[\u0027id\u0027],"},{"line_number":117,"context_line":"                \u0027fixed_ips\u0027: v4_fixed_ips}"},{"line_number":118,"context_line":"            raise lib_exc.BadRequest(resource\u003dapidef.RESOURCE_NAME,"},{"line_number":119,"context_line":"                                     msg\u003dmessage)"},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"        internal_subnet \u003d self.core_plugin.get_subnet("},{"line_number":122,"context_line":"            context, internal_subnet_id)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_b344011c","line":119,"range":{"start_line":108,"start_character":8,"end_line":119,"end_character":49},"in_reply_to":"5f7c97a3_bbdb864c","updated":"2018-07-24 17:31:54.000000000","message":"that\u0027s what i meant for case 2 fetch subnet_id from v4_fixed_ips[0][\u0027subnet_id\u0027]","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"798d6f243039d5fd56f3c72b1bf281678a745cef","unresolved":false,"context_lines":[{"line_number":105,"context_line":"            pf_dict[\u0027internal_ip_address\u0027] \u003d internal_ip_address"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"        # check the matched fixed ip"},{"line_number":108,"context_line":"        internal_subnet_id \u003d self._get_internal_ip_subnet("},{"line_number":109,"context_line":"            internal_ip_address, v4_fixed_ips)"},{"line_number":110,"context_line":"        if not internal_subnet_id:"},{"line_number":111,"context_line":"            message \u003d _("},{"line_number":112,"context_line":"                \"Requested internal IP address %(internal_ip_address)s is not \""},{"line_number":113,"context_line":"                \"suitable for internal neutron port %(internal_port_id)s, as \""},{"line_number":114,"context_line":"                \"its fixed_ips are %(fixed_ips)s\") % {"},{"line_number":115,"context_line":"                \u0027internal_ip_address\u0027: internal_ip_address,"},{"line_number":116,"context_line":"                \u0027internal_port_id\u0027: internal_port[\u0027id\u0027],"},{"line_number":117,"context_line":"                \u0027fixed_ips\u0027: v4_fixed_ips}"},{"line_number":118,"context_line":"            raise lib_exc.BadRequest(resource\u003dapidef.RESOURCE_NAME,"},{"line_number":119,"context_line":"                                     msg\u003dmessage)"},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"        internal_subnet \u003d self.core_plugin.get_subnet("},{"line_number":122,"context_line":"            context, internal_subnet_id)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_a374d99c","line":119,"range":{"start_line":108,"start_character":8,"end_line":119,"end_character":49},"in_reply_to":"5f7c97a3_f2b5c11a","updated":"2018-07-24 03:33:48.000000000","message":"Hmmm, let me show the all cases here.\n\n1. if we specified a internal_ip_address in request body, we can get the internal_ip_address from pf_dict, if the logic can arrive get L102, that means we get v4_fixed_ips from port, then we must get the right subnet_id based on v4_fixed_ips. if internal_subnet_id is not None, that means we choose the right v4_ip_address in request body, and we can do the following.\n\n2. If we dont specified a internal_ip_address in request body, we only can get the v4_fixed_ips from port, and set it back in request body, then we will ALWAYS get the internal_subnet_id, so we do the following.\n\nSo let me guess your question, you may said the \"if\" is not necessary in case 2. Yeah, you are right. But for _get_internal_ip_subnet, I think we need to get it in both cases. :)","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"5675d298f9f8f1d894aa16af8c41b056c2a95445","unresolved":false,"context_lines":[{"line_number":105,"context_line":"            pf_dict[\u0027internal_ip_address\u0027] \u003d internal_ip_address"},{"line_number":106,"context_line":""},{"line_number":107,"context_line":"        # check the matched fixed ip"},{"line_number":108,"context_line":"        internal_subnet_id \u003d self._get_internal_ip_subnet("},{"line_number":109,"context_line":"            internal_ip_address, v4_fixed_ips)"},{"line_number":110,"context_line":"        if not internal_subnet_id:"},{"line_number":111,"context_line":"            message \u003d _("},{"line_number":112,"context_line":"                \"Requested internal IP address %(internal_ip_address)s is not \""},{"line_number":113,"context_line":"                \"suitable for internal neutron port %(internal_port_id)s, as \""},{"line_number":114,"context_line":"                \"its fixed_ips are %(fixed_ips)s\") % {"},{"line_number":115,"context_line":"                \u0027internal_ip_address\u0027: internal_ip_address,"},{"line_number":116,"context_line":"                \u0027internal_port_id\u0027: internal_port[\u0027id\u0027],"},{"line_number":117,"context_line":"                \u0027fixed_ips\u0027: v4_fixed_ips}"},{"line_number":118,"context_line":"            raise lib_exc.BadRequest(resource\u003dapidef.RESOURCE_NAME,"},{"line_number":119,"context_line":"                                     msg\u003dmessage)"},{"line_number":120,"context_line":""},{"line_number":121,"context_line":"        internal_subnet \u003d self.core_plugin.get_subnet("},{"line_number":122,"context_line":"            context, internal_subnet_id)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_22fe7906","line":119,"range":{"start_line":108,"start_character":8,"end_line":119,"end_character":49},"in_reply_to":"5f7c97a3_f2b5c11a","updated":"2018-07-23 18:34:03.000000000","message":"get_internal_ip_subnet(\n            internal_ip_address, v4_fixed_ips) is only needed if L103 is true, otherwise its redundant, you can just have\n\ninternal_subnet_id \u003d v4_fixed_ips[0][\u0027subnet_id\u0027] and avoid a for loop again","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"235ae44e24483d1c308791e20299652eacbb4c70","unresolved":false,"context_lines":[{"line_number":138,"context_line":"                                     msg\u003dmessage)"},{"line_number":139,"context_line":""},{"line_number":140,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":141,"context_line":"    @db_api.context_manager.writer"},{"line_number":142,"context_line":"    def create_floatingip_port_forwarding(self, context, floatingip_id,"},{"line_number":143,"context_line":"                                          port_forwarding):"},{"line_number":144,"context_line":"        port_forwarding \u003d port_forwarding.get(apidef.RESOURCE_NAME)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_606a2983","line":141,"range":{"start_line":141,"start_character":4,"end_line":141,"end_character":34},"updated":"2018-07-23 19:29:52.000000000","message":"We don\u0027t need this, since we have L149 below, right?","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"798d6f243039d5fd56f3c72b1bf281678a745cef","unresolved":false,"context_lines":[{"line_number":138,"context_line":"                                     msg\u003dmessage)"},{"line_number":139,"context_line":""},{"line_number":140,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":141,"context_line":"    @db_api.context_manager.writer"},{"line_number":142,"context_line":"    def create_floatingip_port_forwarding(self, context, floatingip_id,"},{"line_number":143,"context_line":"                                          port_forwarding):"},{"line_number":144,"context_line":"        port_forwarding \u003d port_forwarding.get(apidef.RESOURCE_NAME)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_2dd18157","line":141,"range":{"start_line":141,"start_character":4,"end_line":141,"end_character":34},"in_reply_to":"5f7c97a3_606a2983","updated":"2018-07-24 03:33:48.000000000","message":"yes, thanks Miguel.","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"5675d298f9f8f1d894aa16af8c41b056c2a95445","unresolved":false,"context_lines":[{"line_number":157,"context_line":"                # case2: fip_obj.router_id is the same with we selected."},{"line_number":158,"context_line":"                self._check_router_match(context, fip_obj,"},{"line_number":159,"context_line":"                                         router_id, port_forwarding)"},{"line_number":160,"context_line":"                if not fip_obj.router_id:"},{"line_number":161,"context_line":"                    fip_obj.router_id \u003d router_id"},{"line_number":162,"context_line":"                    fip_obj.update()"},{"line_number":163,"context_line":"                pf_obj.create()"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_8508b7d8","line":160,"range":{"start_line":160,"start_character":16,"end_line":160,"end_character":41},"updated":"2018-07-23 18:34:03.000000000","message":"making sure router_id isn\u0027t None ? before firing update would help,","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"798d6f243039d5fd56f3c72b1bf281678a745cef","unresolved":false,"context_lines":[{"line_number":157,"context_line":"                # case2: fip_obj.router_id is the same with we selected."},{"line_number":158,"context_line":"                self._check_router_match(context, fip_obj,"},{"line_number":159,"context_line":"                                         router_id, port_forwarding)"},{"line_number":160,"context_line":"                if not fip_obj.router_id:"},{"line_number":161,"context_line":"                    fip_obj.router_id \u003d router_id"},{"line_number":162,"context_line":"                    fip_obj.update()"},{"line_number":163,"context_line":"                pf_obj.create()"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_cd21ed51","line":160,"range":{"start_line":160,"start_character":16,"end_line":160,"end_character":41},"in_reply_to":"5f7c97a3_8508b7d8","updated":"2018-07-24 03:33:48.000000000","message":"Here, we want to make sure the fip is \"Free\", if it is Free(not be associated with a neutron port, or not be configured on any routers), then we need to take over to update the router_id, as it had been used by port forwarding.\n\n\"before firing update would help\", I\u0027m not sure I follow u.","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"370ec7dd1660de1fafabd4ce99b9c85ce14275d3","unresolved":false,"context_lines":[{"line_number":157,"context_line":"                # case2: fip_obj.router_id is the same with we selected."},{"line_number":158,"context_line":"                self._check_router_match(context, fip_obj,"},{"line_number":159,"context_line":"                                         router_id, port_forwarding)"},{"line_number":160,"context_line":"                if not fip_obj.router_id:"},{"line_number":161,"context_line":"                    fip_obj.router_id \u003d router_id"},{"line_number":162,"context_line":"                    fip_obj.update()"},{"line_number":163,"context_line":"                pf_obj.create()"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_d3c65d6a","line":160,"range":{"start_line":160,"start_character":16,"end_line":160,"end_character":41},"in_reply_to":"5f7c97a3_cd21ed51","updated":"2018-07-24 17:31:54.000000000","message":"I meant to add a check that router_id is not None, but looking at code the get_router_for_floatingip would raise an exception if no router is found, so the check may not be needed.","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"235ae44e24483d1c308791e20299652eacbb4c70","unresolved":false,"context_lines":[{"line_number":189,"context_line":"                if new_internal_port_id and (new_internal_port_id !\u003d"},{"line_number":190,"context_line":"                                             ori_internal_port_id):"},{"line_number":191,"context_line":"                    router_id \u003d self._find_a_router_for_fip_port_forwarding("},{"line_number":192,"context_line":"                        context, port_forwarding, fip_obj)"},{"line_number":193,"context_line":"                    self._check_router_match(context, fip_obj,"},{"line_number":194,"context_line":"                                             router_id, port_forwarding)"},{"line_number":195,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_7babbc70","line":192,"range":{"start_line":192,"start_character":33,"end_line":192,"end_character":48},"updated":"2018-07-23 19:29:52.000000000","message":"This has to be pf_data. When executing the following update in my environment:\n\ncurl -s -X PUT http://localhost:9696/v2.0/floatingips/$FIP_ID/port_forwardings/$PF_ID \\\n    -H \"Content-type: application/json\" \\\n    -H \"X-Auth-Token: $TOKEN\" \\\n    -d \u0027{\n            \"port_forwarding\": {\n                \"internal_port_id\": \"99889dc2-19a7-4edb-b9d0-d2ace8d1e144\"\n            }\n        }\u0027\n\nI get this traceback in the Neutron server (please keep in mind a deployed PS16 of https://review.openstack.org/#/c/574673 in my test environment, not this patch):\n\na7-4edb-b9d0-d2ace8d1e144\u0027}} {{(pid\u003d21431) prepare_request_body /opt/stack/neutron/neutron/api/v2/base.py:692}}\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource [None req-34e6a630-39c5-4780-b741-d2c08506bfae admin admin] update failed: No details.: KeyError: \u0027internal_port_id\u0027\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource Traceback (most recent call last):\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource   File \"/opt/stack/neutron/neutron/api/v2/resource.py\", line 98, in resource\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource     result \u003d method(request\u003drequest, **args)\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource   File \"/opt/stack/neutron/neutron/api/v2/base.py\", line 610, in update\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource     return self._update(request, id, body, **kwargs)\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource   File \"/usr/local/lib/python2.7/dist-packages/neutron_lib/db/api.py\", line 140, in wrapped\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource     setattr(e, \u0027_RETRY_EXCEEDED\u0027, True)\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource   File \"/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py\", line 220, in __exit__\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource     self.force_reraise()\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource   File \"/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py\", line 196, in force_reraise\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource     six.reraise(self.type_, self.value, self.tb)\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource   File \"/usr/local/lib/python2.7/dist-packages/neutron_lib/db/api.py\", line 136, in wrapped\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource     return f(*args, **kwargs)\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource   File \"/usr/local/lib/python2.7/dist-packages/oslo_db/api.py\", line 154, in wrapper\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource     ectxt.value \u003d e.inner_exc\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource   File \"/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py\", line 220, in __exit__\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource     self.force_reraise()\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource   File \"/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py\", line 196, in force_reraise\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource     six.reraise(self.type_, self.value, self.tb)\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource   File \"/usr/local/lib/python2.7/dist-packages/oslo_db/api.py\", line 142, in wrapper\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource     return f(*args, **kwargs)\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource   File \"/usr/local/lib/python2.7/dist-packages/neutron_lib/db/api.py\", line 183, in wrapped\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource     LOG.debug(\"Retry wrapper got retriable exception: %s\", e)\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource   File \"/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py\", line 220, in __exit__\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource     self.force_reraise()\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource   File \"/usr/local/lib/python2.7/dist-packages/oslo_utils/excutils.py\", line 196, in force_reraise\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource     six.reraise(self.type_, self.value, self.tb)\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource   File \"/usr/local/lib/python2.7/dist-packages/neutron_lib/db/api.py\", line 179, in wrapped\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource     return f(*dup_args, **dup_kwargs)\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource   File \"/opt/stack/neutron/neutron/api/v2/base.py\", line 658, in _update\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource     obj \u003d obj_updater(request.context, id, **kwargs)\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource   File \"/opt/stack/neutron/neutron/db/db_base_plugin_common.py\", line 49, in inner\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource     result \u003d f(*args, **kwargs)\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource   File \"/opt/stack/neutron/neutron/services/portforwarding/pf_plugin.py\", line 321, in update_floatingip_port_forwarding\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource     context, port_forwarding, fip_obj)\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource   File \"/opt/stack/neutron/neutron/services/portforwarding/pf_plugin.py\", line 203, in _find_a_router_for_fip_port_forwarding\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource     internal_port_id \u003d pf_dict[\u0027internal_port_id\u0027]\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource KeyError: \u0027internal_port_id\u0027\nJul 23 19:07:02 allinone neutron-server[21418]: ERROR neutron.api.v2.resource","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"798d6f243039d5fd56f3c72b1bf281678a745cef","unresolved":false,"context_lines":[{"line_number":189,"context_line":"                if new_internal_port_id and (new_internal_port_id !\u003d"},{"line_number":190,"context_line":"                                             ori_internal_port_id):"},{"line_number":191,"context_line":"                    router_id \u003d self._find_a_router_for_fip_port_forwarding("},{"line_number":192,"context_line":"                        context, port_forwarding, fip_obj)"},{"line_number":193,"context_line":"                    self._check_router_match(context, fip_obj,"},{"line_number":194,"context_line":"                                             router_id, port_forwarding)"},{"line_number":195,"context_line":""}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_c8347bfd","line":192,"range":{"start_line":192,"start_character":33,"end_line":192,"end_character":48},"in_reply_to":"5f7c97a3_7babbc70","updated":"2018-07-24 03:33:48.000000000","message":"Yeah, you are right, Miguel. Thanks. Let me fix.","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"235ae44e24483d1c308791e20299652eacbb4c70","unresolved":false,"context_lines":[{"line_number":259,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":260,"context_line":"    def get_floatingip_port_forwarding(self, context, id, floatingip_id,"},{"line_number":261,"context_line":"                                       fields\u003dNone):"},{"line_number":262,"context_line":"        # check if the floatingip is owned by the request tenant. For fit this,"},{"line_number":263,"context_line":"        # we query the floatingip obj, it can cover all cases for owner check."},{"line_number":264,"context_line":"        self._get_fip_obj(context, floatingip_id)"},{"line_number":265,"context_line":"        obj \u003d pf.PortForwarding.get_object(context, id\u003did)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_fb410ca9","line":262,"range":{"start_line":262,"start_character":37,"end_line":262,"end_character":64},"updated":"2018-07-23 19:29:52.000000000","message":"Is this comment correct?","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"798d6f243039d5fd56f3c72b1bf281678a745cef","unresolved":false,"context_lines":[{"line_number":259,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":260,"context_line":"    def get_floatingip_port_forwarding(self, context, id, floatingip_id,"},{"line_number":261,"context_line":"                                       fields\u003dNone):"},{"line_number":262,"context_line":"        # check if the floatingip is owned by the request tenant. For fit this,"},{"line_number":263,"context_line":"        # we query the floatingip obj, it can cover all cases for owner check."},{"line_number":264,"context_line":"        self._get_fip_obj(context, floatingip_id)"},{"line_number":265,"context_line":"        obj \u003d pf.PortForwarding.get_object(context, id\u003did)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_5316e04c","line":262,"range":{"start_line":262,"start_character":37,"end_line":262,"end_character":64},"in_reply_to":"5f7c97a3_fb410ca9","updated":"2018-07-24 03:33:48.000000000","message":"self._get_fip_obj(context, floatingip_id) in L264 is used for checking if the request tenant can get the fip_obj, if the context is admin or the owner of the fip is the same with the project_id in context, it can pass. This comment leaves for explaining the L264. I can remove if we are all clear. :)","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"235ae44e24483d1c308791e20299652eacbb4c70","unresolved":false,"context_lines":[{"line_number":281,"context_line":"                                        filters\u003dNone, fields\u003dNone, sorts\u003dNone,"},{"line_number":282,"context_line":"                                        limit\u003dNone, marker\u003dNone,"},{"line_number":283,"context_line":"                                        page_reverse\u003dFalse):"},{"line_number":284,"context_line":"        # check if the floatingip is owned by the request tenant. For fit this,"},{"line_number":285,"context_line":"        # we query the floatingip obj, it can cover all cases for owner check."},{"line_number":286,"context_line":"        self._get_fip_obj(context, floatingip_id)"},{"line_number":287,"context_line":"        filters \u003d filters or {}"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_bb72b417","line":284,"range":{"start_line":284,"start_character":37,"end_line":284,"end_character":64},"updated":"2018-07-23 19:29:52.000000000","message":"Same question here","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"5675d298f9f8f1d894aa16af8c41b056c2a95445","unresolved":false,"context_lines":[{"line_number":287,"context_line":"        filters \u003d filters or {}"},{"line_number":288,"context_line":"        self._validate_filter_for_port_forwarding(filters)"},{"line_number":289,"context_line":"        pager \u003d base_obj.Pager(sorts, limit, page_reverse, marker)"},{"line_number":290,"context_line":"        return pf.PortForwarding.get_objects("},{"line_number":291,"context_line":"            context, _pager\u003dpager, floatingip_id\u003dfloatingip_id, **filters)"},{"line_number":292,"context_line":""},{"line_number":293,"context_line":"    def delete_floatingip_port_forwarding(self, context, id, floatingip_id):"},{"line_number":294,"context_line":"        pf_obj \u003d pf.PortForwarding.get_object(context, id\u003did)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_005d7515","line":291,"range":{"start_line":290,"start_character":15,"end_line":291,"end_character":74},"updated":"2018-07-23 18:34:03.000000000","message":"Note: get_objects return [] or list of objects, so I guess empty list should be handled properly, if its allowed no further action required.\n\nNote: comment not reason for -1","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"798d6f243039d5fd56f3c72b1bf281678a745cef","unresolved":false,"context_lines":[{"line_number":287,"context_line":"        filters \u003d filters or {}"},{"line_number":288,"context_line":"        self._validate_filter_for_port_forwarding(filters)"},{"line_number":289,"context_line":"        pager \u003d base_obj.Pager(sorts, limit, page_reverse, marker)"},{"line_number":290,"context_line":"        return pf.PortForwarding.get_objects("},{"line_number":291,"context_line":"            context, _pager\u003dpager, floatingip_id\u003dfloatingip_id, **filters)"},{"line_number":292,"context_line":""},{"line_number":293,"context_line":"    def delete_floatingip_port_forwarding(self, context, id, floatingip_id):"},{"line_number":294,"context_line":"        pf_obj \u003d pf.PortForwarding.get_object(context, id\u003did)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_53b2604c","line":291,"range":{"start_line":290,"start_character":15,"end_line":291,"end_character":74},"in_reply_to":"5f7c97a3_005d7515","updated":"2018-07-24 03:33:48.000000000","message":"Hmmm, this func is like \"list_something\", the outer wrapper db_base_plugin_common.convert_result_to_dict will make the response into dict, and make_result_with_fields will process \"Fields\" if we specified. For now, it just contains 2 func for further process.\n\nSo once get_objects return [], we just return []. I\u0027m not sure I understand \"handle properly\".","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"370ec7dd1660de1fafabd4ce99b9c85ce14275d3","unresolved":false,"context_lines":[{"line_number":287,"context_line":"        filters \u003d filters or {}"},{"line_number":288,"context_line":"        self._validate_filter_for_port_forwarding(filters)"},{"line_number":289,"context_line":"        pager \u003d base_obj.Pager(sorts, limit, page_reverse, marker)"},{"line_number":290,"context_line":"        return pf.PortForwarding.get_objects("},{"line_number":291,"context_line":"            context, _pager\u003dpager, floatingip_id\u003dfloatingip_id, **filters)"},{"line_number":292,"context_line":""},{"line_number":293,"context_line":"    def delete_floatingip_port_forwarding(self, context, id, floatingip_id):"},{"line_number":294,"context_line":"        pf_obj \u003d pf.PortForwarding.get_object(context, id\u003did)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_b39c015d","line":291,"range":{"start_line":290,"start_character":15,"end_line":291,"end_character":74},"in_reply_to":"5f7c97a3_53b2604c","updated":"2018-07-24 17:31:54.000000000","message":"ok then fine, meaning no pf exits ! by handling properly I meant if you want to modify the message displayed or passed.","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"5675d298f9f8f1d894aa16af8c41b056c2a95445","unresolved":false,"context_lines":[{"line_number":297,"context_line":"            raise pf_exc.PortForwardingNotFound(id\u003did)"},{"line_number":298,"context_line":"        with db_api.context_manager.writer.using(context):"},{"line_number":299,"context_line":"            fip_obj \u003d self._get_fip_obj(context, pf_obj.floatingip_id)"},{"line_number":300,"context_line":"            pf_objs \u003d pf.PortForwarding.get_objects("},{"line_number":301,"context_line":"                context, floatingip_id\u003dpf_obj.floatingip_id)"},{"line_number":302,"context_line":"            if len(pf_objs) \u003d\u003d 1 and pf_objs[0].id \u003d\u003d pf_obj.id:"},{"line_number":303,"context_line":"                fip_obj.update_fields({\u0027router_id\u0027: None})"},{"line_number":304,"context_line":"                fip_obj.update()"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_c07d3d71","line":301,"range":{"start_line":300,"start_character":12,"end_line":301,"end_character":60},"updated":"2018-07-23 18:34:03.000000000","message":"why don\u0027t just use get_object with pf_obj.id filter since its unique it will return exactly one if pf exists then L302 won\u0027t be needed.","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"370ec7dd1660de1fafabd4ce99b9c85ce14275d3","unresolved":false,"context_lines":[{"line_number":297,"context_line":"            raise pf_exc.PortForwardingNotFound(id\u003did)"},{"line_number":298,"context_line":"        with db_api.context_manager.writer.using(context):"},{"line_number":299,"context_line":"            fip_obj \u003d self._get_fip_obj(context, pf_obj.floatingip_id)"},{"line_number":300,"context_line":"            pf_objs \u003d pf.PortForwarding.get_objects("},{"line_number":301,"context_line":"                context, floatingip_id\u003dpf_obj.floatingip_id)"},{"line_number":302,"context_line":"            if len(pf_objs) \u003d\u003d 1 and pf_objs[0].id \u003d\u003d pf_obj.id:"},{"line_number":303,"context_line":"                fip_obj.update_fields({\u0027router_id\u0027: None})"},{"line_number":304,"context_line":"                fip_obj.update()"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_53780df6","line":301,"range":{"start_line":300,"start_character":12,"end_line":301,"end_character":60},"in_reply_to":"5f7c97a3_534ee039","updated":"2018-07-24 17:31:54.000000000","message":"ohk make sense now, would add a comment for future reference before L302 ?","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"798d6f243039d5fd56f3c72b1bf281678a745cef","unresolved":false,"context_lines":[{"line_number":297,"context_line":"            raise pf_exc.PortForwardingNotFound(id\u003did)"},{"line_number":298,"context_line":"        with db_api.context_manager.writer.using(context):"},{"line_number":299,"context_line":"            fip_obj \u003d self._get_fip_obj(context, pf_obj.floatingip_id)"},{"line_number":300,"context_line":"            pf_objs \u003d pf.PortForwarding.get_objects("},{"line_number":301,"context_line":"                context, floatingip_id\u003dpf_obj.floatingip_id)"},{"line_number":302,"context_line":"            if len(pf_objs) \u003d\u003d 1 and pf_objs[0].id \u003d\u003d pf_obj.id:"},{"line_number":303,"context_line":"                fip_obj.update_fields({\u0027router_id\u0027: None})"},{"line_number":304,"context_line":"                fip_obj.update()"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_534ee039","line":301,"range":{"start_line":300,"start_character":12,"end_line":301,"end_character":60},"in_reply_to":"5f7c97a3_c07d3d71","updated":"2018-07-24 03:33:48.000000000","message":"As the feature must take over the fip status management, so we need to update the fip which associated with port forwardings. So when we delete a port forwarding, we must check this port forwarding is the last one association with fip. Then we get pf_objs by floatingip_id, check if it is the last one. If it is, we update the router_id to None. Then we push the delete pf_obj, the agent side will update the fip status from Active to Down. This is the logic here.\n\nL300 just for use count the list only contains 1 element, and the element id is the same with we requested delelte_pf_id. So I feel, L302 is necessary.","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"f424d9358b6e086b4d998e36682f02a46c733b86","unresolved":false,"context_lines":[{"line_number":106,"context_line":"            pf_dict[\u0027internal_ip_address\u0027] \u003d internal_ip_address"},{"line_number":107,"context_line":"            internal_subnet_id \u003d v4_fixed_ips[0][\u0027subnet_id\u0027]"},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"        if not internal_subnet_id:"},{"line_number":110,"context_line":"            # check the matched fixed ip"},{"line_number":111,"context_line":"            internal_subnet_id \u003d self._get_internal_ip_subnet("},{"line_number":112,"context_line":"                internal_ip_address, v4_fixed_ips)"}],"source_content_type":"text/x-python","patch_set":9,"id":"5f7c97a3_fd49df2e","line":109,"updated":"2018-07-24 23:20:10.000000000","message":"If at this point internal_subnet_id is None, it means that the request doesn\u0027t specify internal_ip_address, right? As a reader of this code, it would be clearer to me if we discard L103 and L109 becomes a simple else. Otherwise, I have to take to take two mental leaps to reach the same conclusion","commit_id":"1739efbb6c2229b9e1b886277b2e56a468c7632b"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"332906bf2a65c1a25a8df7b9cd1b3ab708aa309e","unresolved":false,"context_lines":[{"line_number":106,"context_line":"            pf_dict[\u0027internal_ip_address\u0027] \u003d internal_ip_address"},{"line_number":107,"context_line":"            internal_subnet_id \u003d v4_fixed_ips[0][\u0027subnet_id\u0027]"},{"line_number":108,"context_line":""},{"line_number":109,"context_line":"        if not internal_subnet_id:"},{"line_number":110,"context_line":"            # check the matched fixed ip"},{"line_number":111,"context_line":"            internal_subnet_id \u003d self._get_internal_ip_subnet("},{"line_number":112,"context_line":"                internal_ip_address, v4_fixed_ips)"}],"source_content_type":"text/x-python","patch_set":9,"id":"5f7c97a3_4334b247","line":109,"in_reply_to":"5f7c97a3_fd49df2e","updated":"2018-07-25 00:47:11.000000000","message":"Oh, yes. Thanks Miguel. You are right. My brain is block yesterday. ;-(","commit_id":"1739efbb6c2229b9e1b886277b2e56a468c7632b"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"5830bdaca20fa982dd3f1a10609212cb64d9fc8c","unresolved":false,"context_lines":[{"line_number":64,"context_line":"    This class implements a Port Forwarding plugin."},{"line_number":65,"context_line":"    \"\"\""},{"line_number":66,"context_line":""},{"line_number":67,"context_line":"    supported_extension_aliases \u003d [\u0027floating-ip-port-forwarding\u0027]"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":"    __native_pagination_support \u003d True"},{"line_number":70,"context_line":"    __native_sorting_support \u003d True"}],"source_content_type":"text/x-python","patch_set":11,"id":"5f7c97a3_6e7e656e","line":67,"range":{"start_line":67,"start_character":37,"end_line":67,"end_character":63},"updated":"2018-07-25 13:46:06.000000000","message":"Why not use the ALIAS of the API def here?","commit_id":"676a31e40ccdccb8c6862cc9510e462d90868bd2"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"b4bd82fc16912348fca73160a4b76b478919a8ea","unresolved":false,"context_lines":[{"line_number":64,"context_line":"    This class implements a Port Forwarding plugin."},{"line_number":65,"context_line":"    \"\"\""},{"line_number":66,"context_line":""},{"line_number":67,"context_line":"    supported_extension_aliases \u003d [\u0027floating-ip-port-forwarding\u0027]"},{"line_number":68,"context_line":""},{"line_number":69,"context_line":"    __native_pagination_support \u003d True"},{"line_number":70,"context_line":"    __native_sorting_support \u003d True"}],"source_content_type":"text/x-python","patch_set":11,"id":"5f7c97a3_e48da87d","line":67,"range":{"start_line":67,"start_character":37,"end_line":67,"end_character":63},"in_reply_to":"5f7c97a3_6e7e656e","updated":"2018-07-26 03:04:34.000000000","message":"I just follow the style from other service plugins, ;-).","commit_id":"676a31e40ccdccb8c6862cc9510e462d90868bd2"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"371cc97b4d57658d3209ad1ac6d446d08ba1c1b0","unresolved":false,"context_lines":[{"line_number":75,"context_line":"        self.l3_plugin \u003d directory.get_plugin(constants.L3)"},{"line_number":76,"context_line":"        self.core_plugin \u003d directory.get_plugin()"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":"    def _get_internal_ip_subnet(self, request_ip, fixed_ips):"},{"line_number":79,"context_line":"        request_ip \u003d netaddr.IPNetwork(request_ip)"},{"line_number":80,"context_line":"        for fixed_ip in fixed_ips:"},{"line_number":81,"context_line":"            if netaddr.IPNetwork(fixed_ip[\u0027ip_address\u0027]) \u003d\u003d request_ip:"}],"source_content_type":"text/x-python","patch_set":12,"id":"5f7c97a3_ea6a4ab3","line":78,"range":{"start_line":78,"start_character":8,"end_line":78,"end_character":31},"updated":"2018-07-26 09:23:04.000000000","message":"nitty nit: it could be named \"_get_internal_ip_subnet_id\" as it doesn\u0027t return subnet object but only ID always :)","commit_id":"21ae99d5b3e287480a2d9cfcfdc2571671d047c4"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"c6814e399d0fec2251599bdecfe563e8318d58a3","unresolved":false,"context_lines":[{"line_number":75,"context_line":"        self.l3_plugin \u003d directory.get_plugin(constants.L3)"},{"line_number":76,"context_line":"        self.core_plugin \u003d directory.get_plugin()"},{"line_number":77,"context_line":""},{"line_number":78,"context_line":"    def _get_internal_ip_subnet(self, request_ip, fixed_ips):"},{"line_number":79,"context_line":"        request_ip \u003d netaddr.IPNetwork(request_ip)"},{"line_number":80,"context_line":"        for fixed_ip in fixed_ips:"},{"line_number":81,"context_line":"            if netaddr.IPNetwork(fixed_ip[\u0027ip_address\u0027]) \u003d\u003d request_ip:"}],"source_content_type":"text/x-python","patch_set":12,"id":"5f7c97a3_ca342e4a","line":78,"range":{"start_line":78,"start_character":8,"end_line":78,"end_character":31},"in_reply_to":"5f7c97a3_ea6a4ab3","updated":"2018-07-26 09:37:00.000000000","message":"Ha, yes. the name is hard to named. :-)","commit_id":"21ae99d5b3e287480a2d9cfcfdc2571671d047c4"},{"author":{"_account_id":28373,"name":"Kailun Qin","email":"kailun.qin@hotmail.com","username":"kailun.qin"},"change_message_id":"ec5c34fe3079fa018bff46d4c639d8f52c1d4d53","unresolved":false,"context_lines":[{"line_number":174,"context_line":"        return pf_obj"},{"line_number":175,"context_line":""},{"line_number":176,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":177,"context_line":"    def update_floatingip_port_forwarding(self, context, id, floatingip_id,"},{"line_number":178,"context_line":"                                          port_forwarding):"},{"line_number":179,"context_line":"        port_forwarding \u003d port_forwarding.get(apidef.RESOURCE_NAME)"},{"line_number":180,"context_line":"        new_internal_port_id \u003d None"}],"source_content_type":"text/x-python","patch_set":12,"id":"5f7c97a3_8d911956","line":177,"range":{"start_line":177,"start_character":8,"end_line":177,"end_character":41},"updated":"2018-07-31 09:21:29.000000000","message":"From the port forwarding spec [1], it indicates that the update operation is not supported and will be extended in the future if possible. May I know whether it is actually supported in this cycle or not? Thanks!\n\n[1] https://github.com/openstack/neutron-specs/blame/master/specs/rocky/port-forwarding.rst#L145#L146","commit_id":"21ae99d5b3e287480a2d9cfcfdc2571671d047c4"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"c05f95351dbd61fa0c10c7ada75175ea1c298f3f","unresolved":false,"context_lines":[{"line_number":174,"context_line":"        return pf_obj"},{"line_number":175,"context_line":""},{"line_number":176,"context_line":"    @db_base_plugin_common.convert_result_to_dict"},{"line_number":177,"context_line":"    def update_floatingip_port_forwarding(self, context, id, floatingip_id,"},{"line_number":178,"context_line":"                                          port_forwarding):"},{"line_number":179,"context_line":"        port_forwarding \u003d port_forwarding.get(apidef.RESOURCE_NAME)"},{"line_number":180,"context_line":"        new_internal_port_id \u003d None"}],"source_content_type":"text/x-python","patch_set":12,"id":"5f7c97a3_dab1ee01","line":177,"range":{"start_line":177,"start_character":8,"end_line":177,"end_character":41},"in_reply_to":"5f7c97a3_8d911956","updated":"2018-08-01 03:51:30.000000000","message":"Hmm, Thanks for attention, I have to say, we support update operation in this circle with internel_ip_address, external_port, internal_port, internal_port_id.","commit_id":"21ae99d5b3e287480a2d9cfcfdc2571671d047c4"}],"neutron/tests/etc/policy.json":[{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"5f543dad4c0cb143acac259c9434b9dabc957374","unresolved":false,"context_lines":[{"line_number":13,"context_line":"    \"shared_address_scopes\": \"field:address_scopes:shared\u003dTrue\","},{"line_number":14,"context_line":"    \"external\": \"field:networks:router:external\u003dTrue\","},{"line_number":15,"context_line":"    \"default\": \"rule:admin_or_owner\","},{"line_number":16,"context_line":"    \"admin_or_floatingip_owner\": \"rule:context_is_admin or tenant_id:%(floatingip:tenant_id)s\","},{"line_number":17,"context_line":""},{"line_number":18,"context_line":"    \"create_subnet\": \"rule:admin_or_network_owner\","},{"line_number":19,"context_line":"    \"create_subnet:segment_id\": \"rule:admin_only\","}],"source_content_type":"application/json","patch_set":2,"id":"5f7c97a3_1cffa666","line":16,"updated":"2018-07-05 00:27:29.000000000","message":"Please see my comment to https://review.openstack.org/#/c/579910/2/neutron/api/v2/base.py@763","commit_id":"5f831ad742b0815246ebb172f6ffe47126610686"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"5f543dad4c0cb143acac259c9434b9dabc957374","unresolved":false,"context_lines":[{"line_number":247,"context_line":"    \"update_log\": \"rule:admin_only\","},{"line_number":248,"context_line":"    \"delete_log\": \"rule:admin_only\","},{"line_number":249,"context_line":""},{"line_number":250,"context_line":"    \"create_floatingip_port_forwarding\": \"rule:admin_or_floatingip_owner\","},{"line_number":251,"context_line":"    \"get_floatingip_port_forwarding\": \"rule:regular_user\","},{"line_number":252,"context_line":"    \"get_floatingip_port_forwardings\": \"rule:regular_user\","},{"line_number":253,"context_line":"    \"update_floatingip_port_forwarding\": \"rule:admin_or_floatingip_owner\","}],"source_content_type":"application/json","patch_set":2,"id":"5f7c97a3_fcf98a81","line":250,"updated":"2018-07-05 00:27:29.000000000","message":"Please see my comment to https://review.openstack.org/#/c/579910/2/neutron/api/v2/base.py@763","commit_id":"5f831ad742b0815246ebb172f6ffe47126610686"}],"neutron/tests/functional/services/portforwarding/test_port_forwarding.py":[{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"0e4331bf117bcf4a5a444603facf41a3696ffc15","unresolved":false,"context_lines":[{"line_number":62,"context_line":"        self._set_router_gw(self.router[\u0027id\u0027], self.ext_net[\u0027id\u0027])"},{"line_number":63,"context_line":"        self._add_router_interface(self.router[\u0027id\u0027], self.subnet[\u0027id\u0027])"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"    def test_negative_create_floatingip_port_forwarding(self):"},{"line_number":66,"context_line":"        fip \u003d self._create_floatingip(self.ext_net[\u0027id\u0027])"},{"line_number":67,"context_line":"        port \u003d self._create_port(self.fmt, self.net[\u0027id\u0027]).json[\u0027port\u0027]"},{"line_number":68,"context_line":"        port_forwarding \u003d {"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_15652b1c","line":65,"range":{"start_line":65,"start_character":13,"end_line":65,"end_character":21},"updated":"2018-07-18 08:51:46.000000000","message":"what this \"negative\" means here?","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"a91807b864ab5aa0eb1c989026de1be13a4ff79b","unresolved":false,"context_lines":[{"line_number":62,"context_line":"        self._set_router_gw(self.router[\u0027id\u0027], self.ext_net[\u0027id\u0027])"},{"line_number":63,"context_line":"        self._add_router_interface(self.router[\u0027id\u0027], self.subnet[\u0027id\u0027])"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"    def test_negative_create_floatingip_port_forwarding(self):"},{"line_number":66,"context_line":"        fip \u003d self._create_floatingip(self.ext_net[\u0027id\u0027])"},{"line_number":67,"context_line":"        port \u003d self._create_port(self.fmt, self.net[\u0027id\u0027]).json[\u0027port\u0027]"},{"line_number":68,"context_line":"        port_forwarding \u003d {"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_a2109c50","line":65,"range":{"start_line":65,"start_character":13,"end_line":65,"end_character":21},"in_reply_to":"5f7c97a3_15652b1c","updated":"2018-07-19 07:32:59.000000000","message":"create a port forwarding with paramsA, then create another port forwarding with the same paramsA. It would be fail","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"5f5c830b985ab06072b242d6032dd1438972454a","unresolved":false,"context_lines":[{"line_number":62,"context_line":"        self._set_router_gw(self.router[\u0027id\u0027], self.ext_net[\u0027id\u0027])"},{"line_number":63,"context_line":"        self._add_router_interface(self.router[\u0027id\u0027], self.subnet[\u0027id\u0027])"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"    def test_negative_create_floatingip_port_forwarding(self):"},{"line_number":66,"context_line":"        fip \u003d self._create_floatingip(self.ext_net[\u0027id\u0027])"},{"line_number":67,"context_line":"        port \u003d self._create_port(self.fmt, self.net[\u0027id\u0027]).json[\u0027port\u0027]"},{"line_number":68,"context_line":"        port_forwarding \u003d {"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_e27c54eb","line":65,"range":{"start_line":65,"start_character":13,"end_line":65,"end_character":21},"in_reply_to":"5f7c97a3_a2109c50","updated":"2018-07-19 08:01:43.000000000","message":"IMHO it would be better to have two separate tests then, one which checks \"good\" case and second called e.g. \"test_create_floating_ip_pf_duplicate\" (or something like that) which should raise exception","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"fc3cef2a63b4f9799c648dadb4ffc04f8e4843e6","unresolved":false,"context_lines":[{"line_number":62,"context_line":"        self._set_router_gw(self.router[\u0027id\u0027], self.ext_net[\u0027id\u0027])"},{"line_number":63,"context_line":"        self._add_router_interface(self.router[\u0027id\u0027], self.subnet[\u0027id\u0027])"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"    def test_negative_create_floatingip_port_forwarding(self):"},{"line_number":66,"context_line":"        fip \u003d self._create_floatingip(self.ext_net[\u0027id\u0027])"},{"line_number":67,"context_line":"        port \u003d self._create_port(self.fmt, self.net[\u0027id\u0027]).json[\u0027port\u0027]"},{"line_number":68,"context_line":"        port_forwarding \u003d {"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_365e11e9","line":65,"range":{"start_line":65,"start_character":13,"end_line":65,"end_character":21},"in_reply_to":"5f7c97a3_e27c54eb","updated":"2018-07-19 08:32:37.000000000","message":"Thanks for suggest. I will split this today. :)","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":17120,"name":"Manjeet Singh Bhatia","email":"manjeet.s.bhatia@intel.com","username":"manjeets"},"change_message_id":"5675d298f9f8f1d894aa16af8c41b056c2a95445","unresolved":false,"context_lines":[{"line_number":76,"context_line":"                 apidef.INTERNAL_IP_ADDRESS:"},{"line_number":77,"context_line":"                     self.port[\u0027fixed_ips\u0027][0][\u0027ip_address\u0027]}}"},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"    def test_create_floatingip_port_forwarding(self):"},{"line_number":80,"context_line":"        res \u003d self.pf_plugin.create_floatingip_port_forwarding("},{"line_number":81,"context_line":"            self.context, self.fip[\u0027id\u0027], self.port_forwarding)"},{"line_number":82,"context_line":"        expect \u003d {"},{"line_number":83,"context_line":"            \"external_port\": 2225,"},{"line_number":84,"context_line":"            \"internal_port\": 25,"},{"line_number":85,"context_line":"            \"internal_port_id\": self.port[\u0027id\u0027],"},{"line_number":86,"context_line":"            \"protocol\": \"tcp\","},{"line_number":87,"context_line":"            \"internal_ip_address\": self.port[\u0027fixed_ips\u0027][0][\u0027ip_address\u0027],"},{"line_number":88,"context_line":"            \u0027id\u0027: mock.ANY,"},{"line_number":89,"context_line":"            \u0027router_id\u0027: self.router[\u0027id\u0027],"},{"line_number":90,"context_line":"            \u0027floating_ip_address\u0027: self.fip[\u0027floating_ip_address\u0027],"},{"line_number":91,"context_line":"            \u0027floatingip_id\u0027: self.fip[\u0027id\u0027]}"},{"line_number":92,"context_line":"        self.assertEqual(expect, res)"},{"line_number":93,"context_line":""},{"line_number":94,"context_line":"    def test_negative_create_floatingip_port_forwarding(self):"},{"line_number":95,"context_line":"        self.pf_plugin.create_floatingip_port_forwarding("},{"line_number":96,"context_line":"            self.context, self.fip[\u0027id\u0027], self.port_forwarding)"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":"        # This will be fail with the same params"},{"line_number":99,"context_line":"        self.assertRaises(lib_exc.BadRequest,"},{"line_number":100,"context_line":"                          self.pf_plugin.create_floatingip_port_forwarding,"},{"line_number":101,"context_line":"                          self.context, self.fip[\u0027id\u0027], self.port_forwarding)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_a00da1e8","line":101,"range":{"start_line":79,"start_character":4,"end_line":101,"end_character":77},"updated":"2018-07-23 18:34:03.000000000","message":"testcases for delete and update can also be added ? I see those for unit tests but get_object/s are mocked there, so here without mocking get_objects functionality for delete and update can also be tested","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"798d6f243039d5fd56f3c72b1bf281678a745cef","unresolved":false,"context_lines":[{"line_number":76,"context_line":"                 apidef.INTERNAL_IP_ADDRESS:"},{"line_number":77,"context_line":"                     self.port[\u0027fixed_ips\u0027][0][\u0027ip_address\u0027]}}"},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"    def test_create_floatingip_port_forwarding(self):"},{"line_number":80,"context_line":"        res \u003d self.pf_plugin.create_floatingip_port_forwarding("},{"line_number":81,"context_line":"            self.context, self.fip[\u0027id\u0027], self.port_forwarding)"},{"line_number":82,"context_line":"        expect \u003d {"},{"line_number":83,"context_line":"            \"external_port\": 2225,"},{"line_number":84,"context_line":"            \"internal_port\": 25,"},{"line_number":85,"context_line":"            \"internal_port_id\": self.port[\u0027id\u0027],"},{"line_number":86,"context_line":"            \"protocol\": \"tcp\","},{"line_number":87,"context_line":"            \"internal_ip_address\": self.port[\u0027fixed_ips\u0027][0][\u0027ip_address\u0027],"},{"line_number":88,"context_line":"            \u0027id\u0027: mock.ANY,"},{"line_number":89,"context_line":"            \u0027router_id\u0027: self.router[\u0027id\u0027],"},{"line_number":90,"context_line":"            \u0027floating_ip_address\u0027: self.fip[\u0027floating_ip_address\u0027],"},{"line_number":91,"context_line":"            \u0027floatingip_id\u0027: self.fip[\u0027id\u0027]}"},{"line_number":92,"context_line":"        self.assertEqual(expect, res)"},{"line_number":93,"context_line":""},{"line_number":94,"context_line":"    def test_negative_create_floatingip_port_forwarding(self):"},{"line_number":95,"context_line":"        self.pf_plugin.create_floatingip_port_forwarding("},{"line_number":96,"context_line":"            self.context, self.fip[\u0027id\u0027], self.port_forwarding)"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":"        # This will be fail with the same params"},{"line_number":99,"context_line":"        self.assertRaises(lib_exc.BadRequest,"},{"line_number":100,"context_line":"                          self.pf_plugin.create_floatingip_port_forwarding,"},{"line_number":101,"context_line":"                          self.context, self.fip[\u0027id\u0027], self.port_forwarding)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_b3ef34f9","line":101,"range":{"start_line":79,"start_character":4,"end_line":101,"end_character":77},"in_reply_to":"5f7c97a3_1bdba8ea","updated":"2018-07-24 03:33:48.000000000","message":"I just add some Uts about update/delete in \nhttps://review.openstack.org/#/c/579910/8/neutron/tests/unit/services/portforwarding/test_pf_plugin.py\n\nOK, I will add.","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"235ae44e24483d1c308791e20299652eacbb4c70","unresolved":false,"context_lines":[{"line_number":76,"context_line":"                 apidef.INTERNAL_IP_ADDRESS:"},{"line_number":77,"context_line":"                     self.port[\u0027fixed_ips\u0027][0][\u0027ip_address\u0027]}}"},{"line_number":78,"context_line":""},{"line_number":79,"context_line":"    def test_create_floatingip_port_forwarding(self):"},{"line_number":80,"context_line":"        res \u003d self.pf_plugin.create_floatingip_port_forwarding("},{"line_number":81,"context_line":"            self.context, self.fip[\u0027id\u0027], self.port_forwarding)"},{"line_number":82,"context_line":"        expect \u003d {"},{"line_number":83,"context_line":"            \"external_port\": 2225,"},{"line_number":84,"context_line":"            \"internal_port\": 25,"},{"line_number":85,"context_line":"            \"internal_port_id\": self.port[\u0027id\u0027],"},{"line_number":86,"context_line":"            \"protocol\": \"tcp\","},{"line_number":87,"context_line":"            \"internal_ip_address\": self.port[\u0027fixed_ips\u0027][0][\u0027ip_address\u0027],"},{"line_number":88,"context_line":"            \u0027id\u0027: mock.ANY,"},{"line_number":89,"context_line":"            \u0027router_id\u0027: self.router[\u0027id\u0027],"},{"line_number":90,"context_line":"            \u0027floating_ip_address\u0027: self.fip[\u0027floating_ip_address\u0027],"},{"line_number":91,"context_line":"            \u0027floatingip_id\u0027: self.fip[\u0027id\u0027]}"},{"line_number":92,"context_line":"        self.assertEqual(expect, res)"},{"line_number":93,"context_line":""},{"line_number":94,"context_line":"    def test_negative_create_floatingip_port_forwarding(self):"},{"line_number":95,"context_line":"        self.pf_plugin.create_floatingip_port_forwarding("},{"line_number":96,"context_line":"            self.context, self.fip[\u0027id\u0027], self.port_forwarding)"},{"line_number":97,"context_line":""},{"line_number":98,"context_line":"        # This will be fail with the same params"},{"line_number":99,"context_line":"        self.assertRaises(lib_exc.BadRequest,"},{"line_number":100,"context_line":"                          self.pf_plugin.create_floatingip_port_forwarding,"},{"line_number":101,"context_line":"                          self.context, self.fip[\u0027id\u0027], self.port_forwarding)"}],"source_content_type":"text/x-python","patch_set":8,"id":"5f7c97a3_1bdba8ea","line":101,"range":{"start_line":79,"start_character":4,"end_line":101,"end_character":77},"in_reply_to":"5f7c97a3_a00da1e8","updated":"2018-07-23 19:29:52.000000000","message":"Yes, we clearly need a test case for update, given my comment / discovery there","commit_id":"d38b0e6f1fce4e8181e44e7e1f64827707a3028c"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"371cc97b4d57658d3209ad1ac6d446d08ba1c1b0","unresolved":false,"context_lines":[{"line_number":84,"context_line":"    def test_create_floatingip_port_forwarding(self):"},{"line_number":85,"context_line":"        res \u003d self.pf_plugin.create_floatingip_port_forwarding("},{"line_number":86,"context_line":"            self.context, self.fip[\u0027id\u0027], self.port_forwarding)"},{"line_number":87,"context_line":"        expect \u003d {"},{"line_number":88,"context_line":"            \"external_port\": 2225,"},{"line_number":89,"context_line":"            \"internal_port\": 25,"},{"line_number":90,"context_line":"            \"internal_port_id\": self.port[\u0027id\u0027],"}],"source_content_type":"text/x-python","patch_set":12,"id":"5f7c97a3_ea3b2a98","line":87,"range":{"start_line":87,"start_character":8,"end_line":87,"end_character":14},"updated":"2018-07-26 09:23:04.000000000","message":"nitty nit: expected","commit_id":"21ae99d5b3e287480a2d9cfcfdc2571671d047c4"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"371cc97b4d57658d3209ad1ac6d446d08ba1c1b0","unresolved":false,"context_lines":[{"line_number":120,"context_line":"        }"},{"line_number":121,"context_line":"        update_res \u003d self.pf_plugin.update_floatingip_port_forwarding("},{"line_number":122,"context_line":"            self.context, res[\u0027id\u0027], self.fip[\u0027id\u0027], update_body)"},{"line_number":123,"context_line":"        expect \u003d {"},{"line_number":124,"context_line":"            \"external_port\": 2226,"},{"line_number":125,"context_line":"            \"internal_port\": 26,"},{"line_number":126,"context_line":"            \"internal_port_id\": self.port[\u0027id\u0027],"}],"source_content_type":"text/x-python","patch_set":12,"id":"5f7c97a3_0a3f8686","line":123,"range":{"start_line":123,"start_character":8,"end_line":123,"end_character":14},"updated":"2018-07-26 09:23:04.000000000","message":"same nit here","commit_id":"21ae99d5b3e287480a2d9cfcfdc2571671d047c4"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"371cc97b4d57658d3209ad1ac6d446d08ba1c1b0","unresolved":false,"context_lines":[{"line_number":145,"context_line":"        }"},{"line_number":146,"context_line":"        update_res \u003d self.pf_plugin.update_floatingip_port_forwarding("},{"line_number":147,"context_line":"            self.context, res[\u0027id\u0027], self.fip[\u0027id\u0027], update_body)"},{"line_number":148,"context_line":"        expect \u003d {"},{"line_number":149,"context_line":"            \"external_port\": 2227,"},{"line_number":150,"context_line":"            \"internal_port\": 27,"},{"line_number":151,"context_line":"            \"internal_port_id\": new_port[\u0027id\u0027],"}],"source_content_type":"text/x-python","patch_set":12,"id":"5f7c97a3_6a4f1a35","line":148,"range":{"start_line":148,"start_character":8,"end_line":148,"end_character":14},"updated":"2018-07-26 09:23:04.000000000","message":"and here :)","commit_id":"21ae99d5b3e287480a2d9cfcfdc2571671d047c4"}],"neutron/tests/unit/services/portforwarding/test_pf_plugin.py":[{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"0e4331bf117bcf4a5a444603facf41a3696ffc15","unresolved":false,"context_lines":[{"line_number":260,"context_line":"        def _create():"},{"line_number":261,"context_line":"            raise obj_exc.NeutronDbObjectDuplicateEntry("},{"line_number":262,"context_line":"                mock.Mock(), mock.Mock())"},{"line_number":263,"context_line":"        pf_obj.create.side_effect \u003d _create"},{"line_number":264,"context_line":"        mock_try_find_exist.return_value \u003d (\u0027pf_obj\u0027, \u0027conflict_param\u0027)"},{"line_number":265,"context_line":"        self.assertRaises("},{"line_number":266,"context_line":"            lib_exc.BadRequest,"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_a82ada74","line":263,"range":{"start_line":263,"start_character":36,"end_line":263,"end_character":43},"updated":"2018-07-18 08:51:46.000000000","message":"You can set here directly obj_exc.NeutronDbObjectDuplicateEntry(mock.Mock(), mock.Mock()) and then this \"_create\" function will not be necessary","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"a91807b864ab5aa0eb1c989026de1be13a4ff79b","unresolved":false,"context_lines":[{"line_number":260,"context_line":"        def _create():"},{"line_number":261,"context_line":"            raise obj_exc.NeutronDbObjectDuplicateEntry("},{"line_number":262,"context_line":"                mock.Mock(), mock.Mock())"},{"line_number":263,"context_line":"        pf_obj.create.side_effect \u003d _create"},{"line_number":264,"context_line":"        mock_try_find_exist.return_value \u003d (\u0027pf_obj\u0027, \u0027conflict_param\u0027)"},{"line_number":265,"context_line":"        self.assertRaises("},{"line_number":266,"context_line":"            lib_exc.BadRequest,"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_42298886","line":263,"range":{"start_line":263,"start_character":36,"end_line":263,"end_character":43},"in_reply_to":"5f7c97a3_a82ada74","updated":"2018-07-19 07:32:59.000000000","message":"Thanks. I will change this.","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":11975,"name":"Slawek Kaplonski","email":"skaplons@redhat.com","username":"slaweq"},"change_message_id":"0e4331bf117bcf4a5a444603facf41a3696ffc15","unresolved":false,"context_lines":[{"line_number":294,"context_line":"            raise lib_l3_exc.ExternalGatewayForFloatingIPNotFound("},{"line_number":295,"context_line":"                external_network_id\u003dmock.Mock(),"},{"line_number":296,"context_line":"                subnet_id\u003dmock.Mock(), port_id\u003dmock.Mock())"},{"line_number":297,"context_line":"        mock_get_router.side_effect \u003d _raise"},{"line_number":298,"context_line":"        self.assertRaises("},{"line_number":299,"context_line":"            lib_exc.BadRequest,"},{"line_number":300,"context_line":"            self.pf_plugin._find_a_router_for_fippf,"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_c83cf6c1","line":297,"range":{"start_line":297,"start_character":38,"end_line":297,"end_character":44},"updated":"2018-07-18 08:51:46.000000000","message":"same as above here","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"a91807b864ab5aa0eb1c989026de1be13a4ff79b","unresolved":false,"context_lines":[{"line_number":294,"context_line":"            raise lib_l3_exc.ExternalGatewayForFloatingIPNotFound("},{"line_number":295,"context_line":"                external_network_id\u003dmock.Mock(),"},{"line_number":296,"context_line":"                subnet_id\u003dmock.Mock(), port_id\u003dmock.Mock())"},{"line_number":297,"context_line":"        mock_get_router.side_effect \u003d _raise"},{"line_number":298,"context_line":"        self.assertRaises("},{"line_number":299,"context_line":"            lib_exc.BadRequest,"},{"line_number":300,"context_line":"            self.pf_plugin._find_a_router_for_fippf,"}],"source_content_type":"text/x-python","patch_set":5,"id":"5f7c97a3_021f105a","line":297,"range":{"start_line":297,"start_character":38,"end_line":297,"end_character":44},"in_reply_to":"5f7c97a3_c83cf6c1","updated":"2018-07-19 07:32:59.000000000","message":"Thank you","commit_id":"6687267ed4a34b245bb07f39cba9a49b1ebb6c7f"},{"author":{"_account_id":5367,"name":"boden","email":"bodenvmw@gmail.com","username":"boden"},"change_message_id":"5830bdaca20fa982dd3f1a10609212cb64d9fc8c","unresolved":false,"context_lines":[{"line_number":62,"context_line":"            prod_registry, \u0027_get_manager\u0027, return_value\u003dself.prod_mgr).start()"},{"line_number":63,"context_line":"        self.setup_coreplugin(load_plugins\u003dFalse)"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"        mock.patch(\u0027neutron.objects.db.api.create_object\u0027).start()"},{"line_number":66,"context_line":"        mock.patch(\u0027neutron.objects.db.api.update_object\u0027).start()"},{"line_number":67,"context_line":"        mock.patch(\u0027neutron.objects.db.api.delete_object\u0027).start()"},{"line_number":68,"context_line":"        mock.patch(\u0027neutron.objects.db.api.get_object\u0027).start()"},{"line_number":69,"context_line":"        # We don\u0027t use real models as per mocks above. We also need to mock-out"},{"line_number":70,"context_line":"        # methods that work with real data types"},{"line_number":71,"context_line":"        mock.patch("}],"source_content_type":"text/x-python","patch_set":11,"id":"5f7c97a3_aee0fd28","line":68,"range":{"start_line":65,"start_character":0,"end_line":68,"end_character":63},"updated":"2018-07-25 13:46:06.000000000","message":"I see a number of places patching these... Seems we should\u0027ve considered a fixture here IMHO.","commit_id":"676a31e40ccdccb8c6862cc9510e462d90868bd2"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"b4bd82fc16912348fca73160a4b76b478919a8ea","unresolved":false,"context_lines":[{"line_number":62,"context_line":"            prod_registry, \u0027_get_manager\u0027, return_value\u003dself.prod_mgr).start()"},{"line_number":63,"context_line":"        self.setup_coreplugin(load_plugins\u003dFalse)"},{"line_number":64,"context_line":""},{"line_number":65,"context_line":"        mock.patch(\u0027neutron.objects.db.api.create_object\u0027).start()"},{"line_number":66,"context_line":"        mock.patch(\u0027neutron.objects.db.api.update_object\u0027).start()"},{"line_number":67,"context_line":"        mock.patch(\u0027neutron.objects.db.api.delete_object\u0027).start()"},{"line_number":68,"context_line":"        mock.patch(\u0027neutron.objects.db.api.get_object\u0027).start()"},{"line_number":69,"context_line":"        # We don\u0027t use real models as per mocks above. We also need to mock-out"},{"line_number":70,"context_line":"        # methods that work with real data types"},{"line_number":71,"context_line":"        mock.patch("}],"source_content_type":"text/x-python","patch_set":11,"id":"5f7c97a3_445b3cf8","line":68,"range":{"start_line":65,"start_character":0,"end_line":68,"end_character":63},"in_reply_to":"5f7c97a3_aee0fd28","updated":"2018-07-26 03:04:34.000000000","message":"Yes, I found Qos, logging plugins also use these mocks..","commit_id":"676a31e40ccdccb8c6862cc9510e462d90868bd2"}]}
