)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"8c7603ce2f52c13dc2c813b05a852d961133ad40","unresolved":false,"context_lines":[{"line_number":27,"context_line":"- There is a single smallest such destination cidr."},{"line_number":28,"context_line":"- There exists a path of devices (routers, compute instances, ...) that"},{"line_number":29,"context_line":"  connects the next-hop of the matching route to the actual network of"},{"line_number":30,"context_line":"  the internal address."},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"Optionally, there is a possibility to add an extra validation on the"},{"line_number":33,"context_line":"router."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"AAAAUH%2F%2FVrI%3D","line":30,"updated":"2014-01-14 22:48:05.000000000","message":"Is this overkill?  Should having a route to the destination and your other checks be sufficient?  I don\u0027t know the answer but it is something to consider.\n\nLooks like there is a fair amount of db querying to accomplish this.  That is why I bring it up.","commit_id":"b4cd303950d755f9ddd9b7c5850073a32f405f43"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"af29192549523cd210a19fa5277d681c87a7aa49","unresolved":false,"context_lines":[{"line_number":27,"context_line":"- There is a single smallest such destination cidr."},{"line_number":28,"context_line":"- There exists a path of devices (routers, compute instances, ...) that"},{"line_number":29,"context_line":"  connects the next-hop of the matching route to the actual network of"},{"line_number":30,"context_line":"  the internal address."},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"Optionally, there is a possibility to add an extra validation on the"},{"line_number":33,"context_line":"router."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"AAAAUH%2F%2BFjk%3D","line":30,"in_reply_to":"AAAAUH%2F%2BVG0%3D","updated":"2014-01-30 13:03:18.000000000","message":"I\u0027ll post to the dev mailing list to discuss. Personally, I agree that the lightweight approach of only matching the route would satisfy the initial requirement (a simple setup with a gateway protecting an internal network) and we can always extend the functionality in the future as the need arises.","commit_id":"b4cd303950d755f9ddd9b7c5850073a32f405f43"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"de634a53f49f4cac7a4aafee1c8960433f033a5a","unresolved":false,"context_lines":[{"line_number":27,"context_line":"- There is a single smallest such destination cidr."},{"line_number":28,"context_line":"- There exists a path of devices (routers, compute instances, ...) that"},{"line_number":29,"context_line":"  connects the next-hop of the matching route to the actual network of"},{"line_number":30,"context_line":"  the internal address."},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"Optionally, there is a possibility to add an extra validation on the"},{"line_number":33,"context_line":"router."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"AAAAUH%2F%2BVG0%3D","line":30,"in_reply_to":"AAAAUH%2F%2BZfs%3D","updated":"2014-01-28 00:04:47.000000000","message":"Sorry, I joined the review at patch set 5, I did not notice Nachi\u0027s comment.  I think it is worth a discussion with Nachi and others on the team.\n\nMy personal opinion is that this is overkill.  I think we should limit algorithm to using to local routing information.  Please start an email or IRC discussion about this.","commit_id":"b4cd303950d755f9ddd9b7c5850073a32f405f43"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"2175eae399ac35e9dd4706797c0c641bc243188c","unresolved":false,"context_lines":[{"line_number":27,"context_line":"- There is a single smallest such destination cidr."},{"line_number":28,"context_line":"- There exists a path of devices (routers, compute instances, ...) that"},{"line_number":29,"context_line":"  connects the next-hop of the matching route to the actual network of"},{"line_number":30,"context_line":"  the internal address."},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"Optionally, there is a possibility to add an extra validation on the"},{"line_number":33,"context_line":"router."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"AAAAUH%2F%2BZfs%3D","line":30,"in_reply_to":"AAAAUH%2F%2FVrI%3D","updated":"2014-01-27 11:45:32.000000000","message":"Patch set 4 represents a minimal approach, where a router will be validated if it has a route that matches the address of the internal IP. However, a review comment by Nachi Ueno suggested that this will not handle overlapping IPs.\n\nThe current implementation, tries to validate an explicit and unambiguous reachability between the router and the internal IP.\n\nWould you like us to go back to the previous approach?","commit_id":"b4cd303950d755f9ddd9b7c5850073a32f405f43"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"8c7603ce2f52c13dc2c813b05a852d961133ad40","unresolved":false,"context_lines":[{"line_number":30,"context_line":"  the internal address."},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"Optionally, there is a possibility to add an extra validation on the"},{"line_number":33,"context_line":"router."},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"The fix also ensures that the derived:"},{"line_number":36,"context_line":"neutron.plugins.nec.nec_router.RouterMixin"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"AAAAUH%2F%2FVdI%3D","line":33,"updated":"2014-01-14 22:48:05.000000000","message":"This seems like maybe an independent change.  Could it be added by a follow on patch?","commit_id":"b4cd303950d755f9ddd9b7c5850073a32f405f43"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"af29192549523cd210a19fa5277d681c87a7aa49","unresolved":false,"context_lines":[{"line_number":30,"context_line":"  the internal address."},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"Optionally, there is a possibility to add an extra validation on the"},{"line_number":33,"context_line":"router."},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"The fix also ensures that the derived:"},{"line_number":36,"context_line":"neutron.plugins.nec.nec_router.RouterMixin"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"AAAAUH%2F%2BFlE%3D","line":33,"in_reply_to":"AAAAUH%2F%2BU%2Fg%3D","updated":"2014-01-30 13:03:18.000000000","message":"The next patch set will revert from the method signature changes as suggested.","commit_id":"b4cd303950d755f9ddd9b7c5850073a32f405f43"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"de634a53f49f4cac7a4aafee1c8960433f033a5a","unresolved":false,"context_lines":[{"line_number":30,"context_line":"  the internal address."},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"Optionally, there is a possibility to add an extra validation on the"},{"line_number":33,"context_line":"router."},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"The fix also ensures that the derived:"},{"line_number":36,"context_line":"neutron.plugins.nec.nec_router.RouterMixin"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"AAAAUH%2F%2BU%2Fg%3D","line":33,"in_reply_to":"AAAAUH%2F%2BZbs%3D","updated":"2014-01-28 00:04:47.000000000","message":"I see the problem with the reimplementation.  I still think this is mixing in too much refactoring with the proposed patch.  I like to keep patches focused and avoid refactoring.  I have added a couple of suggestions inline to keep this patch more focused.\n\nYou could follow this patch with another patch that proposes refactoring to avoid code duplication.","commit_id":"b4cd303950d755f9ddd9b7c5850073a32f405f43"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"2175eae399ac35e9dd4706797c0c641bc243188c","unresolved":false,"context_lines":[{"line_number":30,"context_line":"  the internal address."},{"line_number":31,"context_line":""},{"line_number":32,"context_line":"Optionally, there is a possibility to add an extra validation on the"},{"line_number":33,"context_line":"router."},{"line_number":34,"context_line":""},{"line_number":35,"context_line":"The fix also ensures that the derived:"},{"line_number":36,"context_line":"neutron.plugins.nec.nec_router.RouterMixin"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":5,"id":"AAAAUH%2F%2BZbs%3D","line":33,"in_reply_to":"AAAAUH%2F%2FVdI%3D","updated":"2014-01-27 11:45:32.000000000","message":"The _get_router_for_floating_ip method, is re-implemented in neutron/plugin/nec/nec_router.py. The re-implementation adds a check that the particular router can support floating IP NAT.\n\nIf that code is left alone without adding the new validation logic that allows consideration of extra routers, the unit test validation that was added for this enhancement will succeed on the generic l3_db.L3_NAT_db_mixin, but will fail on the nec plugin router.\n\nSo rather than implement the new logic twice, the code tries to allow a subclass to add extra validation with it\u0027s own \"pluggable\" validation function. In effect, this new extra validation option, is already used by modified old code to maintain existing behavior.","commit_id":"b4cd303950d755f9ddd9b7c5850073a32f405f43"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"387cbd13e37b5ef6c6d38c8c773128f6831ebd16","unresolved":false,"context_lines":[{"line_number":18,"context_line":"hopping over devices that connect networks."},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"Given an internal address with which we would like to associate a"},{"line_number":21,"context_line":"floating IP, the fix also considers routers with extra routes where:"},{"line_number":22,"context_line":"- The router belongs to the same tenant as the port of the internal"},{"line_number":23,"context_line":"  address."},{"line_number":24,"context_line":"- The internal address matches one of the router routes."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":17,"id":"1abeadc6_e5732613","line":21,"updated":"2014-08-19 20:16:10.000000000","message":"I assume that *all* of the below conditions must be met.  The wording here isn\u0027t clear about that.  When I first read it, I thought it might be the other way where a router satisfying *any* of them would be considered.","commit_id":"d427ce92cdc3f9aac65f4a0a120ba035a55a45a8"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"25a25eaf8d60aa3155ed9b883541f952a057842e","unresolved":false,"context_lines":[{"line_number":18,"context_line":"hopping over devices that connect networks."},{"line_number":19,"context_line":""},{"line_number":20,"context_line":"Given an internal address with which we would like to associate a"},{"line_number":21,"context_line":"floating IP, the fix also considers routers with extra routes where:"},{"line_number":22,"context_line":"- The router belongs to the same tenant as the port of the internal"},{"line_number":23,"context_line":"  address."},{"line_number":24,"context_line":"- The internal address matches one of the router routes."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":17,"id":"1abeadc6_9bb9c617","line":21,"in_reply_to":"1abeadc6_e5732613","updated":"2014-08-20 21:09:19.000000000","message":"I\u0027ll clarify that the meaning is \"all\"","commit_id":"d427ce92cdc3f9aac65f4a0a120ba035a55a45a8"}],"neutron/db/l3_db.py":[{"author":{"_account_id":6524,"name":"Henry Gessau","email":"HenryG@gessau.net","username":"gessau"},"change_message_id":"607c00d2e678ff0e9ebfed783c7b653737d1faf5","unresolved":false,"context_lines":[{"line_number":469,"context_line":"                     \u0027which has no gateway_ip\u0027) % internal_subnet_id)"},{"line_number":470,"context_line":"            raise q_exc.BadRequest(resource\u003d\u0027floatingip\u0027, msg\u003dmsg)"},{"line_number":471,"context_line":""},{"line_number":472,"context_line":""},{"line_number":473,"context_line":"        # find a router on the external network with a route to the internal"},{"line_number":474,"context_line":"        # subnet"},{"line_number":475,"context_line":"        router_intf_qry \u003d context.session.query(models_v2.Port)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAATn%2F%2FPWw%3D","line":472,"updated":"2013-11-12 12:43:06.000000000","message":"HACKING nit: do not add a blank line here.","commit_id":"791748548816f8ae3fe64cb3ae906be93d5fac5a"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"34e5b4e1958de3ae4d5348d3c3877f4a5dce9102","unresolved":false,"context_lines":[{"line_number":479,"context_line":"        for intf_p in router_intf_ports:"},{"line_number":480,"context_line":"            router_id \u003d intf_p[\u0027device_id\u0027]"},{"line_number":481,"context_line":"            router \u003d self.get_router(context, router_id)"},{"line_number":482,"context_line":"            if not \u0027routes\u0027 in router:"},{"line_number":483,"context_line":"                continue"},{"line_number":484,"context_line":"            for r in router[\u0027routes\u0027]:"},{"line_number":485,"context_line":"                if not r[\u0027destination\u0027] \u003d\u003d subnet_db[\u0027cidr\u0027]:"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAATn%2F%2FQBw%3D","line":482,"updated":"2013-11-12 09:04:00.000000000","message":"HACKING nit: if \u0027routes\u0027 not in router\nper https://github.com/openstack-dev/hacking/blob/master/doc/source/index.rst","commit_id":"791748548816f8ae3fe64cb3ae906be93d5fac5a"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"34e5b4e1958de3ae4d5348d3c3877f4a5dce9102","unresolved":false,"context_lines":[{"line_number":482,"context_line":"            if not \u0027routes\u0027 in router:"},{"line_number":483,"context_line":"                continue"},{"line_number":484,"context_line":"            for r in router[\u0027routes\u0027]:"},{"line_number":485,"context_line":"                if not r[\u0027destination\u0027] \u003d\u003d subnet_db[\u0027cidr\u0027]:"},{"line_number":486,"context_line":"                    continue"},{"line_number":487,"context_line":"                return router_id"},{"line_number":488,"context_line":""}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAATn%2F%2FQBU%3D","line":485,"updated":"2013-11-12 09:04:00.000000000","message":"change to \n if r[\u0027destination\u0027] !\u003d subnet_db[\u0027cidr\u0027]:","commit_id":"791748548816f8ae3fe64cb3ae906be93d5fac5a"},{"author":{"_account_id":6524,"name":"Henry Gessau","email":"HenryG@gessau.net","username":"gessau"},"change_message_id":"607c00d2e678ff0e9ebfed783c7b653737d1faf5","unresolved":false,"context_lines":[{"line_number":484,"context_line":"            for r in router[\u0027routes\u0027]:"},{"line_number":485,"context_line":"                if not r[\u0027destination\u0027] \u003d\u003d subnet_db[\u0027cidr\u0027]:"},{"line_number":486,"context_line":"                    continue"},{"line_number":487,"context_line":"                return router_id"},{"line_number":488,"context_line":""},{"line_number":489,"context_line":"        # find router interface ports on this network"},{"line_number":490,"context_line":"        router_intf_qry \u003d context.session.query(models_v2.Port)"}],"source_content_type":"text/x-python","patch_set":1,"id":"AAAATn%2F%2FPVo%3D","line":487,"updated":"2013-11-12 12:43:06.000000000","message":"The following is equivalent to 482-487 and easier to read (IMO):\n\n    if \u0027routes\u0027 in router:\n        for r in router[\u0027routes\u0027]:\n            if r[\u0027destination\u0027] \u003d\u003d subnet_db[\u0027cidr\u0027]:\n                return router_id","commit_id":"791748548816f8ae3fe64cb3ae906be93d5fac5a"},{"author":{"_account_id":6524,"name":"Henry Gessau","email":"HenryG@gessau.net","username":"gessau"},"change_message_id":"2353f5111f7c2f0f612ffd4ab95a9ffcfc1f328c","unresolved":false,"context_lines":[{"line_number":470,"context_line":"            raise q_exc.BadRequest(resource\u003d\u0027floatingip\u0027, msg\u003dmsg)"},{"line_number":471,"context_line":""},{"line_number":472,"context_line":"        # find router interface ports on this network"},{"line_number":473,"context_line":"        router_intf_qry \u003d context.session.query(models_v2.Port)"},{"line_number":474,"context_line":"        router_intf_ports \u003d router_intf_qry.filter_by("},{"line_number":475,"context_line":"            network_id\u003dinternal_port[\u0027network_id\u0027],"},{"line_number":476,"context_line":"            device_owner\u003dDEVICE_OWNER_ROUTER_INTF)"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F%2FF1Q%3D","line":473,"updated":"2013-11-14 14:35:34.000000000","message":"Rename this to port_query.","commit_id":"57e0056854f25fecf02b1983f19680b10c249d81"},{"author":{"_account_id":6524,"name":"Henry Gessau","email":"HenryG@gessau.net","username":"gessau"},"change_message_id":"2353f5111f7c2f0f612ffd4ab95a9ffcfc1f328c","unresolved":false,"context_lines":[{"line_number":471,"context_line":""},{"line_number":472,"context_line":"        # find router interface ports on this network"},{"line_number":473,"context_line":"        router_intf_qry \u003d context.session.query(models_v2.Port)"},{"line_number":474,"context_line":"        router_intf_ports \u003d router_intf_qry.filter_by("},{"line_number":475,"context_line":"            network_id\u003dinternal_port[\u0027network_id\u0027],"},{"line_number":476,"context_line":"            device_owner\u003dDEVICE_OWNER_ROUTER_INTF)"},{"line_number":477,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F%2FFzo%3D","line":474,"updated":"2013-11-14 14:35:34.000000000","message":"Use port_query here.","commit_id":"57e0056854f25fecf02b1983f19680b10c249d81"},{"author":{"_account_id":6524,"name":"Henry Gessau","email":"HenryG@gessau.net","username":"gessau"},"change_message_id":"2353f5111f7c2f0f612ffd4ab95a9ffcfc1f328c","unresolved":false,"context_lines":[{"line_number":478,"context_line":"        for intf_p in router_intf_ports:"},{"line_number":479,"context_line":"            if intf_p[\u0027fixed_ips\u0027][0][\u0027subnet_id\u0027] \u003d\u003d internal_subnet_id:"},{"line_number":480,"context_line":"                router_id \u003d intf_p[\u0027device_id\u0027]"},{"line_number":481,"context_line":"                router_gw_qry \u003d context.session.query(models_v2.Port)"},{"line_number":482,"context_line":"                has_gw_port \u003d router_gw_qry.filter_by("},{"line_number":483,"context_line":"                    network_id\u003dexternal_network_id,"},{"line_number":484,"context_line":"                    device_id\u003drouter_id,"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F%2FFzk%3D","line":481,"updated":"2013-11-14 14:35:34.000000000","message":"Remove.","commit_id":"57e0056854f25fecf02b1983f19680b10c249d81"},{"author":{"_account_id":6524,"name":"Henry Gessau","email":"HenryG@gessau.net","username":"gessau"},"change_message_id":"2353f5111f7c2f0f612ffd4ab95a9ffcfc1f328c","unresolved":false,"context_lines":[{"line_number":479,"context_line":"            if intf_p[\u0027fixed_ips\u0027][0][\u0027subnet_id\u0027] \u003d\u003d internal_subnet_id:"},{"line_number":480,"context_line":"                router_id \u003d intf_p[\u0027device_id\u0027]"},{"line_number":481,"context_line":"                router_gw_qry \u003d context.session.query(models_v2.Port)"},{"line_number":482,"context_line":"                has_gw_port \u003d router_gw_qry.filter_by("},{"line_number":483,"context_line":"                    network_id\u003dexternal_network_id,"},{"line_number":484,"context_line":"                    device_id\u003drouter_id,"},{"line_number":485,"context_line":"                    device_owner\u003dDEVICE_OWNER_ROUTER_GW).count()"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F%2FFzg%3D","line":482,"updated":"2013-11-14 14:35:34.000000000","message":"Use port_query.","commit_id":"57e0056854f25fecf02b1983f19680b10c249d81"},{"author":{"_account_id":6524,"name":"Henry Gessau","email":"HenryG@gessau.net","username":"gessau"},"change_message_id":"2353f5111f7c2f0f612ffd4ab95a9ffcfc1f328c","unresolved":false,"context_lines":[{"line_number":488,"context_line":""},{"line_number":489,"context_line":"        # find a router on the external network with a route to the internal"},{"line_number":490,"context_line":"        # subnet"},{"line_number":491,"context_line":"        router_gw_qry \u003d context.session.query(models_v2.Port)"},{"line_number":492,"context_line":"        router_gw_ports \u003d router_gw_qry.filter_by("},{"line_number":493,"context_line":"            network_id\u003dexternal_network_id,"},{"line_number":494,"context_line":"            device_owner\u003dDEVICE_OWNER_ROUTER_GW)"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F%2FF1g%3D","line":491,"updated":"2013-11-14 14:35:34.000000000","message":"Remove.","commit_id":"57e0056854f25fecf02b1983f19680b10c249d81"},{"author":{"_account_id":6524,"name":"Henry Gessau","email":"HenryG@gessau.net","username":"gessau"},"change_message_id":"2353f5111f7c2f0f612ffd4ab95a9ffcfc1f328c","unresolved":false,"context_lines":[{"line_number":489,"context_line":"        # find a router on the external network with a route to the internal"},{"line_number":490,"context_line":"        # subnet"},{"line_number":491,"context_line":"        router_gw_qry \u003d context.session.query(models_v2.Port)"},{"line_number":492,"context_line":"        router_gw_ports \u003d router_gw_qry.filter_by("},{"line_number":493,"context_line":"            network_id\u003dexternal_network_id,"},{"line_number":494,"context_line":"            device_owner\u003dDEVICE_OWNER_ROUTER_GW)"},{"line_number":495,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAATn%2F%2FFzY%3D","line":492,"updated":"2013-11-14 14:35:34.000000000","message":"Use port_query.","commit_id":"57e0056854f25fecf02b1983f19680b10c249d81"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"de634a53f49f4cac7a4aafee1c8960433f033a5a","unresolved":false,"context_lines":[{"line_number":538,"context_line":"                    if has_gw_port:"},{"line_number":539,"context_line":"                        return router_id"},{"line_number":540,"context_line":""},{"line_number":541,"context_line":"        # find a router on the external network with an unambiguous route to"},{"line_number":542,"context_line":"        # the internal IP address and verify that the internal network is"},{"line_number":543,"context_line":"        # reachable from the router by following the ports connecting networks"},{"line_number":544,"context_line":"        # and devices"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUH%2F%2BVAA%3D","line":541,"updated":"2014-01-28 00:04:47.000000000","message":"Move this in to a new method.  This method is getting a bit long.  The new method could be called from this point in this method.  It can also be called from nec_router.py to minimize how much this patch touches that existing code.","commit_id":"b4cd303950d755f9ddd9b7c5850073a32f405f43"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"af29192549523cd210a19fa5277d681c87a7aa49","unresolved":false,"context_lines":[{"line_number":538,"context_line":"                    if has_gw_port:"},{"line_number":539,"context_line":"                        return router_id"},{"line_number":540,"context_line":""},{"line_number":541,"context_line":"        # find a router on the external network with an unambiguous route to"},{"line_number":542,"context_line":"        # the internal IP address and verify that the internal network is"},{"line_number":543,"context_line":"        # reachable from the router by following the ports connecting networks"},{"line_number":544,"context_line":"        # and devices"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUH%2F%2BFnU%3D","line":541,"in_reply_to":"AAAAUH%2F%2BVAA%3D","updated":"2014-01-30 13:03:18.000000000","message":"Implemented in the next patch set. The function became a generator that yields matching routers so that plugin code can run extra validation (please also see the comment in the diff for nec_router.py).","commit_id":"b4cd303950d755f9ddd9b7c5850073a32f405f43"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"8c7603ce2f52c13dc2c813b05a852d961133ad40","unresolved":false,"context_lines":[{"line_number":562,"context_line":"                            if smallest_cidr.cidr \u003d\u003d netaddr.IPNetwork("},{"line_number":563,"context_line":"                                route[\u0027destination\u0027]).cidr:"},{"line_number":564,"context_line":"                                nexthops.append(route[\u0027nexthop\u0027])"},{"line_number":565,"context_line":"                    if len(nexthops) \u003d\u003d 1:"},{"line_number":566,"context_line":"                        net_id \u003d self._find_net_for_nexthop("},{"line_number":567,"context_line":"                            context,"},{"line_number":568,"context_line":"                            port_query,"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUH%2F%2FVfs%3D","line":565,"updated":"2014-01-14 22:48:05.000000000","message":"So, if there is more than one we just ignore the router altogether?  Why not just pick the first one?","commit_id":"b4cd303950d755f9ddd9b7c5850073a32f405f43"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"af29192549523cd210a19fa5277d681c87a7aa49","unresolved":false,"context_lines":[{"line_number":562,"context_line":"                            if smallest_cidr.cidr \u003d\u003d netaddr.IPNetwork("},{"line_number":563,"context_line":"                                route[\u0027destination\u0027]).cidr:"},{"line_number":564,"context_line":"                                nexthops.append(route[\u0027nexthop\u0027])"},{"line_number":565,"context_line":"                    if len(nexthops) \u003d\u003d 1:"},{"line_number":566,"context_line":"                        net_id \u003d self._find_net_for_nexthop("},{"line_number":567,"context_line":"                            context,"},{"line_number":568,"context_line":"                            port_query,"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUH%2F%2BFlc%3D","line":565,"in_reply_to":"AAAAUH%2F%2BVEI%3D","updated":"2014-01-30 13:03:18.000000000","message":"The next patch set will introduce a lightweight version that only matches the route and does not do the full reachability search.","commit_id":"b4cd303950d755f9ddd9b7c5850073a32f405f43"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"de634a53f49f4cac7a4aafee1c8960433f033a5a","unresolved":false,"context_lines":[{"line_number":562,"context_line":"                            if smallest_cidr.cidr \u003d\u003d netaddr.IPNetwork("},{"line_number":563,"context_line":"                                route[\u0027destination\u0027]).cidr:"},{"line_number":564,"context_line":"                                nexthops.append(route[\u0027nexthop\u0027])"},{"line_number":565,"context_line":"                    if len(nexthops) \u003d\u003d 1:"},{"line_number":566,"context_line":"                        net_id \u003d self._find_net_for_nexthop("},{"line_number":567,"context_line":"                            context,"},{"line_number":568,"context_line":"                            port_query,"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUH%2F%2BVEI%3D","line":565,"in_reply_to":"AAAAUH%2F%2BZhc%3D","updated":"2014-01-28 00:04:47.000000000","message":"I think that we should not worry about ambiguous routes here.  If there is an ambiguous route, then the user has two problems, an ambiguous route and he has no idea why his floating ip won\u0027t attach to the router because this check does not provide any feedback along those lines, it just skips the router silently.\n\nMy $0.02.\n\nMaybe you could bring this up for discussion as well as the other point.","commit_id":"b4cd303950d755f9ddd9b7c5850073a32f405f43"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"2175eae399ac35e9dd4706797c0c641bc243188c","unresolved":false,"context_lines":[{"line_number":562,"context_line":"                            if smallest_cidr.cidr \u003d\u003d netaddr.IPNetwork("},{"line_number":563,"context_line":"                                route[\u0027destination\u0027]).cidr:"},{"line_number":564,"context_line":"                                nexthops.append(route[\u0027nexthop\u0027])"},{"line_number":565,"context_line":"                    if len(nexthops) \u003d\u003d 1:"},{"line_number":566,"context_line":"                        net_id \u003d self._find_net_for_nexthop("},{"line_number":567,"context_line":"                            context,"},{"line_number":568,"context_line":"                            port_query,"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUH%2F%2BZhc%3D","line":565,"in_reply_to":"AAAAUH%2F%2FVfs%3D","updated":"2014-01-27 11:45:32.000000000","message":"The code tries to be conservative, and only considers routers with unambiguous route to the internal IP address. It will return the first router that meets this condition (and the reachability condition).","commit_id":"b4cd303950d755f9ddd9b7c5850073a32f405f43"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"724e082af06eef42e7a91c46b539b746e3c16019","unresolved":false,"context_lines":[{"line_number":502,"context_line":"            raise q_exc.BadRequest(resource\u003d\u0027floatingip\u0027, msg\u003dmsg)"},{"line_number":503,"context_line":""},{"line_number":504,"context_line":"        # find router interface ports on this network"},{"line_number":505,"context_line":"        port_query \u003d context.session.query(models_v2.Port)"},{"line_number":506,"context_line":"        router_intf_ports \u003d port_query.filter_by("},{"line_number":507,"context_line":"            network_id\u003dinternal_port[\u0027network_id\u0027],"},{"line_number":508,"context_line":"            device_owner\u003dDEVICE_OWNER_ROUTER_INTF)"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAUH%2F9yiE%3D","line":505,"updated":"2014-02-03 22:34:16.000000000","message":"nit:  Some of this seems to be an unrelated refactor.","commit_id":"b0973c378e414ee11db74188ee945e20a2efb58e"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"0b10f8bebe2b50ecea9b39a49fd02a69117c3117","unresolved":false,"context_lines":[{"line_number":502,"context_line":"            raise q_exc.BadRequest(resource\u003d\u0027floatingip\u0027, msg\u003dmsg)"},{"line_number":503,"context_line":""},{"line_number":504,"context_line":"        # find router interface ports on this network"},{"line_number":505,"context_line":"        port_query \u003d context.session.query(models_v2.Port)"},{"line_number":506,"context_line":"        router_intf_ports \u003d port_query.filter_by("},{"line_number":507,"context_line":"            network_id\u003dinternal_port[\u0027network_id\u0027],"},{"line_number":508,"context_line":"            device_owner\u003dDEVICE_OWNER_ROUTER_INTF)"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAUH%2F9xCM%3D","line":505,"in_reply_to":"AAAAUH%2F9yiE%3D","updated":"2014-02-04 07:00:55.000000000","message":"This change was suggested in an earlier review, as the loop below created a query object within the loop. When the extra route validation was part of this method, it too re-used the port query object. I\u0027ll change the code back to the original, and it will be possible to optimize the query object usage in a later change.","commit_id":"b0973c378e414ee11db74188ee945e20a2efb58e"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"724e082af06eef42e7a91c46b539b746e3c16019","unresolved":false,"context_lines":[{"line_number":520,"context_line":"        for router_id in self._find_routes_for_floatingip(context,"},{"line_number":521,"context_line":"                                                          internal_port,"},{"line_number":522,"context_line":"                                                          external_network_id):"},{"line_number":523,"context_line":"            return router_id"},{"line_number":524,"context_line":""},{"line_number":525,"context_line":"        raise l3.ExternalGatewayForFloatingIPNotFound("},{"line_number":526,"context_line":"            subnet_id\u003dinternal_subnet_id,"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAUH%2F9ygM%3D","line":523,"updated":"2014-02-03 22:34:16.000000000","message":"Suggestion:  Since more iterations of this loop do not incur more db queries, you could iterate over all of the possible routers and take the one with the most specific route to the private IP.","commit_id":"b0973c378e414ee11db74188ee945e20a2efb58e"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"90b6503c34dcd0f1251742f2567b719ab919f6b3","unresolved":false,"context_lines":[{"line_number":520,"context_line":"        for router_id in self._find_routes_for_floatingip(context,"},{"line_number":521,"context_line":"                                                          internal_port,"},{"line_number":522,"context_line":"                                                          external_network_id):"},{"line_number":523,"context_line":"            return router_id"},{"line_number":524,"context_line":""},{"line_number":525,"context_line":"        raise l3.ExternalGatewayForFloatingIPNotFound("},{"line_number":526,"context_line":"            subnet_id\u003dinternal_subnet_id,"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAUH%2F9tGc%3D","line":523,"in_reply_to":"AAAAUH%2F9xCQ%3D","updated":"2014-02-04 20:09:33.000000000","message":"That would work as well.","commit_id":"b0973c378e414ee11db74188ee945e20a2efb58e"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"0b10f8bebe2b50ecea9b39a49fd02a69117c3117","unresolved":false,"context_lines":[{"line_number":520,"context_line":"        for router_id in self._find_routes_for_floatingip(context,"},{"line_number":521,"context_line":"                                                          internal_port,"},{"line_number":522,"context_line":"                                                          external_network_id):"},{"line_number":523,"context_line":"            return router_id"},{"line_number":524,"context_line":""},{"line_number":525,"context_line":"        raise l3.ExternalGatewayForFloatingIPNotFound("},{"line_number":526,"context_line":"            subnet_id\u003dinternal_subnet_id,"}],"source_content_type":"text/x-python","patch_set":6,"id":"AAAAUH%2F9xCQ%3D","line":523,"in_reply_to":"AAAAUH%2F9ygM%3D","updated":"2014-02-04 07:00:55.000000000","message":"I plan to have self._find_routes_for_floatingip() return a sorted list of routers (first will be most specific). So this code could just return the first router_id, and code that does extra router validation (like in nec_router.py) could iterate further.","commit_id":"b0973c378e414ee11db74188ee945e20a2efb58e"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"e91db4656182d2d2c30e78373fbd527620cd3663","unresolved":false,"context_lines":[{"line_number":470,"context_line":"        route first (largest CIDR prefix mask length)."},{"line_number":471,"context_line":""},{"line_number":472,"context_line":"        @param context: neutron api request context"},{"line_number":473,"context_line":"        @param internal_port: the port id of the target for the floatingip"},{"line_number":474,"context_line":"        @param external_network_id: the network of the floatingip"},{"line_number":475,"context_line":"        @return: a sorted list of matching routers"},{"line_number":476,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAUH%2F9py8%3D","line":473,"updated":"2014-02-05 10:29:07.000000000","message":"nit: description is incorrect. it\u0027s port dict, not id","commit_id":"78a057ec8f847098b4348daa049bab727e301fac"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"e190a8d94ec861168a2ba13b53ffb9cdbb5a7541","unresolved":false,"context_lines":[{"line_number":470,"context_line":"        route first (largest CIDR prefix mask length)."},{"line_number":471,"context_line":""},{"line_number":472,"context_line":"        @param context: neutron api request context"},{"line_number":473,"context_line":"        @param internal_port: the port id of the target for the floatingip"},{"line_number":474,"context_line":"        @param external_network_id: the network of the floatingip"},{"line_number":475,"context_line":"        @return: a sorted list of matching routers"},{"line_number":476,"context_line":"        \"\"\""}],"source_content_type":"text/x-python","patch_set":7,"id":"AAAAUH%2F9pno%3D","line":473,"in_reply_to":"AAAAUH%2F9py8%3D","updated":"2014-02-05 10:55:40.000000000","message":"Done","commit_id":"78a057ec8f847098b4348daa049bab727e301fac"},{"author":{"_account_id":2592,"name":"Mark McClain","email":"mark@mcclain.xyz","username":"markmcclain"},"change_message_id":"2ee2ec14456f8ad52cc61b6d4d53d137a47f9d11","unresolved":false,"context_lines":[{"line_number":479,"context_line":"        port_query \u003d context.session.query(models_v2.Port)"},{"line_number":480,"context_line":"        router_gw_ports \u003d port_query.filter_by("},{"line_number":481,"context_line":"            network_id\u003dexternal_network_id,"},{"line_number":482,"context_line":"            device_owner\u003dDEVICE_OWNER_ROUTER_GW)"},{"line_number":483,"context_line":""},{"line_number":484,"context_line":"        prefix_routers \u003d []"},{"line_number":485,"context_line":"        for gw_p in router_gw_ports:"}],"source_content_type":"text/x-python","patch_set":8,"id":"AAAAUH%2F9ma4%3D","line":482,"updated":"2014-02-05 18:43:13.000000000","message":"You need to filter the gw_ports by tenant otherwise you will get all ports attached to the external network across all tenants.","commit_id":"dba090212f5ef328a36f8fec4cf44b81e9031cf7"},{"author":{"_account_id":6072,"name":"Eugene Nikanorov","email":"enikanorov@mirantis.com","username":"enikanorov"},"change_message_id":"f468afcb6c149eb32540cd288c06365917f2f205","unresolved":false,"context_lines":[{"line_number":480,"context_line":"        # find the tenant router interfaces"},{"line_number":481,"context_line":"        port_query \u003d context.session.query(models_v2.Port)"},{"line_number":482,"context_line":"        router_intf_ports \u003d port_query.filter_by("},{"line_number":483,"context_line":"            tenant_id\u003dinternal_port[\u0027tenant_id\u0027],"},{"line_number":484,"context_line":"            device_owner\u003dDEVICE_OWNER_ROUTER_INTF)"},{"line_number":485,"context_line":""},{"line_number":486,"context_line":"        router_cache \u003d set([])"}],"source_content_type":"text/x-python","patch_set":9,"id":"AAAAUH%2F9cE8%3D","line":483,"updated":"2014-02-06 22:36:17.000000000","message":"I think Mark meant that you need additional filter by tenant_id. (in addition to ext_net_id)","commit_id":"3aa64a4c161d52086dc0fb454d0665ed0045b06d"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"a001a5bbdd3f5b36816bea5c7823cf6886587119","unresolved":false,"context_lines":[{"line_number":480,"context_line":"        # find the tenant router interfaces"},{"line_number":481,"context_line":"        port_query \u003d context.session.query(models_v2.Port)"},{"line_number":482,"context_line":"        router_intf_ports \u003d port_query.filter_by("},{"line_number":483,"context_line":"            tenant_id\u003dinternal_port[\u0027tenant_id\u0027],"},{"line_number":484,"context_line":"            device_owner\u003dDEVICE_OWNER_ROUTER_INTF)"},{"line_number":485,"context_line":""},{"line_number":486,"context_line":"        router_cache \u003d set([])"}],"source_content_type":"text/x-python","patch_set":9,"id":"AAAAUX%2F%2F7So%3D","line":483,"in_reply_to":"AAAAUH%2F9Z78%3D","updated":"2014-02-09 15:42:02.000000000","message":"That is what I tried first, but it seems that both in devstack and in the unit test framework, the \"router gateway\" port does not seem to have a tenant_id, so filtering on the tenant is not possible there.\n\nThe next patch set (10) will have a different approach of querying for all the routers belonging to the tenant and then validate that they have a route; and only then do a db query to verify that they are on the external network.\n\nOnly tenant routers will be considered, and each such router will only be processed once, and the gateway port query will only happen for routers that belong to the tenant and had a matching route.","commit_id":"3aa64a4c161d52086dc0fb454d0665ed0045b06d"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"c1fd6dfb6221dc2c9d174cd77d0a5ffe029a94b7","unresolved":false,"context_lines":[{"line_number":480,"context_line":"        # find the tenant router interfaces"},{"line_number":481,"context_line":"        port_query \u003d context.session.query(models_v2.Port)"},{"line_number":482,"context_line":"        router_intf_ports \u003d port_query.filter_by("},{"line_number":483,"context_line":"            tenant_id\u003dinternal_port[\u0027tenant_id\u0027],"},{"line_number":484,"context_line":"            device_owner\u003dDEVICE_OWNER_ROUTER_INTF)"},{"line_number":485,"context_line":""},{"line_number":486,"context_line":"        router_cache \u003d set([])"}],"source_content_type":"text/x-python","patch_set":9,"id":"AAAAUH%2F9Z78%3D","line":483,"in_reply_to":"AAAAUH%2F9cE8%3D","updated":"2014-02-07 05:18:12.000000000","message":"+1.  Use both to filter.  This patch adds a lot of unnecessary logic below to be sure that it is on the external network and that you don\u0027t visit a router more than once.","commit_id":"3aa64a4c161d52086dc0fb454d0665ed0045b06d"},{"author":{"_account_id":2874,"name":"yong sheng gong","email":"gong.yongsheng@99cloud.net","username":"gongysh"},"change_message_id":"3ea85460229471d9c60774fc5c8ea0b743914d59","unresolved":false,"context_lines":[{"line_number":458,"context_line":"               \u0027fixed_ip_address\u0027: floatingip[\u0027fixed_ip_address\u0027]}"},{"line_number":459,"context_line":"        return self._fields(res, fields)"},{"line_number":460,"context_line":""},{"line_number":461,"context_line":"    def _find_routes_for_floatingip(self, context, internal_port,"},{"line_number":462,"context_line":"                                    external_network_id):"},{"line_number":463,"context_line":"        \"\"\"Find routers with route to the internal IP address."},{"line_number":464,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAUX%2F%2F5dY%3D","line":461,"updated":"2014-02-10 04:20:33.000000000","message":"how about _find_router_via_routes_for_floatingip?","commit_id":"575cafd91db0a01143e8a6a911d759235236cb00"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"db063452e735a7c9eefebb1f362d913c755ba3c8","unresolved":false,"context_lines":[{"line_number":458,"context_line":"               \u0027fixed_ip_address\u0027: floatingip[\u0027fixed_ip_address\u0027]}"},{"line_number":459,"context_line":"        return self._fields(res, fields)"},{"line_number":460,"context_line":""},{"line_number":461,"context_line":"    def _find_routes_for_floatingip(self, context, internal_port,"},{"line_number":462,"context_line":"                                    external_network_id):"},{"line_number":463,"context_line":"        \"\"\"Find routers with route to the internal IP address."},{"line_number":464,"context_line":""}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAUX%2F%2F4X8%3D","line":461,"in_reply_to":"AAAAUX%2F%2F5dY%3D","updated":"2014-02-10 07:41:59.000000000","message":"Done","commit_id":"575cafd91db0a01143e8a6a911d759235236cb00"},{"author":{"_account_id":2874,"name":"yong sheng gong","email":"gong.yongsheng@99cloud.net","username":"gongysh"},"change_message_id":"3ea85460229471d9c60774fc5c8ea0b743914d59","unresolved":false,"context_lines":[{"line_number":502,"context_line":"                        prefix_routers.append("},{"line_number":503,"context_line":"                            (smallest_cidr.prefixlen, router[\u0027id\u0027]))"},{"line_number":504,"context_line":""},{"line_number":505,"context_line":"        return [p_r[1] for p_r in sorted(prefix_routers, reverse\u003dTrue)]"},{"line_number":506,"context_line":""},{"line_number":507,"context_line":"    def _get_router_for_floatingip(self, context, internal_port,"},{"line_number":508,"context_line":"                                   internal_subnet_id,"}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAUX%2F%2F5dE%3D","line":505,"updated":"2014-02-10 04:20:33.000000000","message":"It seems we will use only one, so we can return the first one here.","commit_id":"575cafd91db0a01143e8a6a911d759235236cb00"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"db063452e735a7c9eefebb1f362d913c755ba3c8","unresolved":false,"context_lines":[{"line_number":502,"context_line":"                        prefix_routers.append("},{"line_number":503,"context_line":"                            (smallest_cidr.prefixlen, router[\u0027id\u0027]))"},{"line_number":504,"context_line":""},{"line_number":505,"context_line":"        return [p_r[1] for p_r in sorted(prefix_routers, reverse\u003dTrue)]"},{"line_number":506,"context_line":""},{"line_number":507,"context_line":"    def _get_router_for_floatingip(self, context, internal_port,"},{"line_number":508,"context_line":"                                   internal_subnet_id,"}],"source_content_type":"text/x-python","patch_set":10,"id":"AAAAUX%2F%2F4nQ%3D","line":505,"in_reply_to":"AAAAUX%2F%2F5dE%3D","updated":"2014-02-10 07:41:59.000000000","message":"The method _get_router_for_floatingip (that calls this method) was re-implemented in neutron/plugin/nec/nec_router.py to add extra validation for a candidate router, and continue the scanning of routers if the router does not qualify.\n\nSo, as part of this change, a call to this method was also added to neutron/plugin/nec/nec_router.py where the iteration continues if the first router does not qualify.","commit_id":"575cafd91db0a01143e8a6a911d759235236cb00"},{"author":{"_account_id":2874,"name":"yong sheng gong","email":"gong.yongsheng@99cloud.net","username":"gongysh"},"change_message_id":"9479456912529022015475193a4d9406c30caaf4","unresolved":false,"context_lines":[{"line_number":458,"context_line":"               \u0027fixed_ip_address\u0027: floatingip[\u0027fixed_ip_address\u0027]}"},{"line_number":459,"context_line":"        return self._fields(res, fields)"},{"line_number":460,"context_line":""},{"line_number":461,"context_line":"    def _find_router_via_routes_for_floatingip(self, context, internal_port,"},{"line_number":462,"context_line":"                                               external_network_id):"},{"line_number":463,"context_line":"        \"\"\"Find routers with route to the internal IP address."},{"line_number":464,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAUX%2F%2FwDo%3D","line":461,"updated":"2014-02-11 02:19:28.000000000","message":"then the func name should be _find_routers_xxx","commit_id":"394a97410838c80c1a81b7d7f7505fb1daa14c04"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"d8ba4a73623d8bc318b705a97f66e5acba15ebe1","unresolved":false,"context_lines":[{"line_number":458,"context_line":"               \u0027fixed_ip_address\u0027: floatingip[\u0027fixed_ip_address\u0027]}"},{"line_number":459,"context_line":"        return self._fields(res, fields)"},{"line_number":460,"context_line":""},{"line_number":461,"context_line":"    def _find_router_via_routes_for_floatingip(self, context, internal_port,"},{"line_number":462,"context_line":"                                               external_network_id):"},{"line_number":463,"context_line":"        \"\"\"Find routers with route to the internal IP address."},{"line_number":464,"context_line":""}],"source_content_type":"text/x-python","patch_set":11,"id":"AAAAUX%2F%2FugY%3D","line":461,"in_reply_to":"AAAAUX%2F%2FwDo%3D","updated":"2014-02-11 07:44:47.000000000","message":"Done","commit_id":"394a97410838c80c1a81b7d7f7505fb1daa14c04"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"6369c21e2a38117280fa9b402287031e45c9a175","unresolved":false,"context_lines":[{"line_number":475,"context_line":"        @param external_network_id: the network of the floatingip"},{"line_number":476,"context_line":"        @return: a sorted list of matching routers"},{"line_number":477,"context_line":"        \"\"\""},{"line_number":478,"context_line":"        internal_ip_address \u003d internal_port[\u0027fixed_ips\u0027][0][\u0027ip_address\u0027]"},{"line_number":479,"context_line":""},{"line_number":480,"context_line":"        # find the tenant routers"},{"line_number":481,"context_line":"        routers \u003d self.get_routers("}],"source_content_type":"text/x-python","patch_set":12,"id":"AAAAUX%2F%2FX1s%3D","line":478,"updated":"2014-02-13 16:57:50.000000000","message":"We need to consider a case where internal_port has multiple address. When associating a floating IP, we can specify an IP address if the internal port has multiple IP address.\n\n(This is a new feature. We can support this later as a separate patch if it is not a small fix.)\n\n-1 is because it needs a response from the author.\n\nThanks,","commit_id":"5ba55cbc7e775d07c31acd3b34d8055e8f11d0f1"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"bf6240255896f74d6f1b3a94cbcb1887f16e2918","unresolved":false,"context_lines":[{"line_number":475,"context_line":"        @param external_network_id: the network of the floatingip"},{"line_number":476,"context_line":"        @return: a sorted list of matching routers"},{"line_number":477,"context_line":"        \"\"\""},{"line_number":478,"context_line":"        internal_ip_address \u003d internal_port[\u0027fixed_ips\u0027][0][\u0027ip_address\u0027]"},{"line_number":479,"context_line":""},{"line_number":480,"context_line":"        # find the tenant routers"},{"line_number":481,"context_line":"        routers \u003d self.get_routers("}],"source_content_type":"text/x-python","patch_set":12,"id":"AAAAU3%2F%2F8ZI%3D","line":478,"in_reply_to":"AAAAU3%2F%2F8kc%3D","updated":"2014-02-23 21:32:45.000000000","message":"Sorry @amotoki and @gongysh, I missed the explicit option for selecting the ip_address/subnet for the fip assignment.\n\nYour suggestion will be incorporated in the next patch.\n\nThanks!","commit_id":"5ba55cbc7e775d07c31acd3b34d8055e8f11d0f1"},{"author":{"_account_id":841,"name":"Akihiro Motoki","email":"amotoki@gmail.com","username":"amotoki"},"change_message_id":"716bcd21125851826d0f6d9b1da3cccd448389b2","unresolved":false,"context_lines":[{"line_number":475,"context_line":"        @param external_network_id: the network of the floatingip"},{"line_number":476,"context_line":"        @return: a sorted list of matching routers"},{"line_number":477,"context_line":"        \"\"\""},{"line_number":478,"context_line":"        internal_ip_address \u003d internal_port[\u0027fixed_ips\u0027][0][\u0027ip_address\u0027]"},{"line_number":479,"context_line":""},{"line_number":480,"context_line":"        # find the tenant routers"},{"line_number":481,"context_line":"        routers \u003d self.get_routers("}],"source_content_type":"text/x-python","patch_set":12,"id":"AAAAU3%2F%2F8kc%3D","line":478,"in_reply_to":"AAAAU3%2F%2F9Tk%3D","updated":"2014-02-23 19:16:47.000000000","message":"Regarding support of ports with multiple addresses, in the current spec of floating IP association, we need to specify fixed_ip_address if we want to associate floating IP to the second or later IP address of an internal port. Unless fixed_ip_address is passed in floating IP request, the first IP address of the internal port is used. I think gong mentioned the case where fixed_ip_address is specified (i.e., internal_address comes from L.569).\n\nWe can support this feature for ports with multiple IP addresses by passing internal_subnet_id or internal_address to this method.\n\n_get_router_for_floatingip method has internal_subnet_id argument, so the simplest way is to pass this parameter to this method and change this line to:\n\n  internal_ip_address \u003d [\n       ip[\u0027ip_address\u0027] for ip\n       in internal_port[\u0027fixed_ips\u0027]\n       if ip[\u0027subnet_id\u0027] \u003d\u003d internal_subnet_id\n  ][0]","commit_id":"5ba55cbc7e775d07c31acd3b34d8055e8f11d0f1"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"1f226bed04d188e5ae342a2c77c1058134662a83","unresolved":false,"context_lines":[{"line_number":475,"context_line":"        @param external_network_id: the network of the floatingip"},{"line_number":476,"context_line":"        @return: a sorted list of matching routers"},{"line_number":477,"context_line":"        \"\"\""},{"line_number":478,"context_line":"        internal_ip_address \u003d internal_port[\u0027fixed_ips\u0027][0][\u0027ip_address\u0027]"},{"line_number":479,"context_line":""},{"line_number":480,"context_line":"        # find the tenant routers"},{"line_number":481,"context_line":"        routers \u003d self.get_routers("}],"source_content_type":"text/x-python","patch_set":12,"id":"AAAAU3%2F%2F9Tk%3D","line":478,"in_reply_to":"AAAAUX%2F%2BcmI%3D","updated":"2014-02-23 14:30:45.000000000","message":"It seems to be derived from internal_port in line 589, where it is set to [\u0027fixed_ips\u0027][0][\u0027ip_address\u0027].\n\nAn earlier patch set (e.g. patch set 5) changed the _get_router_for_floatingip() method signature to pass internal_ip_address, as suggested. But in the spirit of a review comment to minimize changes to existing code, the patch was changed to retrieve the address from internal_port as an equivalent to passing it, without significant overhead.\n\nThanks.","commit_id":"5ba55cbc7e775d07c31acd3b34d8055e8f11d0f1"},{"author":{"_account_id":2874,"name":"yong sheng gong","email":"gong.yongsheng@99cloud.net","username":"gongysh"},"change_message_id":"cdb4d12adb0b659c536010a5dbbd16e1a9358f5c","unresolved":false,"context_lines":[{"line_number":475,"context_line":"        @param external_network_id: the network of the floatingip"},{"line_number":476,"context_line":"        @return: a sorted list of matching routers"},{"line_number":477,"context_line":"        \"\"\""},{"line_number":478,"context_line":"        internal_ip_address \u003d internal_port[\u0027fixed_ips\u0027][0][\u0027ip_address\u0027]"},{"line_number":479,"context_line":""},{"line_number":480,"context_line":"        # find the tenant routers"},{"line_number":481,"context_line":"        routers \u003d self.get_routers("}],"source_content_type":"text/x-python","patch_set":12,"id":"AAAAUX%2F%2BcmI%3D","line":478,"in_reply_to":"AAAAUX%2F%2FWkQ%3D","updated":"2014-02-21 04:18:28.000000000","message":"Line 603 got the internal_ip_address, it is possible to pass it in from there.","commit_id":"5ba55cbc7e775d07c31acd3b34d8055e8f11d0f1"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"d66f998c6521d02484d579296a6231275e2384cd","unresolved":false,"context_lines":[{"line_number":475,"context_line":"        @param external_network_id: the network of the floatingip"},{"line_number":476,"context_line":"        @return: a sorted list of matching routers"},{"line_number":477,"context_line":"        \"\"\""},{"line_number":478,"context_line":"        internal_ip_address \u003d internal_port[\u0027fixed_ips\u0027][0][\u0027ip_address\u0027]"},{"line_number":479,"context_line":""},{"line_number":480,"context_line":"        # find the tenant routers"},{"line_number":481,"context_line":"        routers \u003d self.get_routers("}],"source_content_type":"text/x-python","patch_set":12,"id":"AAAAUX%2F%2FWkQ%3D","line":478,"in_reply_to":"AAAAUX%2F%2FX1s%3D","updated":"2014-02-13 19:45:25.000000000","message":"This patch history has gone from handling a minimalist use case to trying to cover more ground back to solving a simple use case, so I believe that postponing the handling of multiple addresses would be best.\n\nSpecifically, this new lookup for routers that have routes, extend the existing lookup in _get_router_for_floatingip(), and the lookup there only considers the first \u0027fixed_ips\u0027 subnet for a match. So, considering only the first \u0027fixed_ips\u0027 ip_address for a route match seems to be consistent.\n\nThanks.","commit_id":"5ba55cbc7e775d07c31acd3b34d8055e8f11d0f1"},{"author":{"_account_id":7141,"name":"Sylvain Afchain","email":"safchain@redhat.com","username":"sylvainA"},"change_message_id":"b5279dd57771e3d3a19d5a24a8c0b1fe612d3162","unresolved":false,"context_lines":[{"line_number":492,"context_line":"                smallest_cidr \u003d netaddr.smallest_matching_cidr("},{"line_number":493,"context_line":"                    internal_ip_address,"},{"line_number":494,"context_line":"                    cidrs)"},{"line_number":495,"context_line":"                if smallest_cidr is not None:"},{"line_number":496,"context_line":"                    # verify that the router is on \"external_network\""},{"line_number":497,"context_line":"                    has_gw_port \u003d router_gw_qry.filter_by("},{"line_number":498,"context_line":"                        network_id\u003dexternal_network_id,"}],"source_content_type":"text/x-python","patch_set":14,"id":"AAAAXH%2F%2F9hA%3D","line":495,"updated":"2014-04-16 09:08:08.000000000","message":"nit: if smalled_cidr:","commit_id":"8469519618a1df3558f93e7b02be7f159fd48807"},{"author":{"_account_id":2592,"name":"Mark McClain","email":"mark@mcclain.xyz","username":"markmcclain"},"change_message_id":"3519c39722dcf6cd0fd6c096f07f3dfae9b57a87","unresolved":false,"context_lines":[{"line_number":602,"context_line":"        visited_nets \u003d set([])"},{"line_number":603,"context_line":"        visited_devices \u003d set([from_device_id])"},{"line_number":604,"context_line":"        nets \u003d [from_net_id]"},{"line_number":605,"context_line":"        while nets:"},{"line_number":606,"context_line":"            net_id \u003d nets.pop()"},{"line_number":607,"context_line":"            visited_nets.add(net_id)"},{"line_number":608,"context_line":"            net_ports \u003d port_query.filter_by(network_id\u003dnet_id,"}],"source_content_type":"text/x-python","patch_set":16,"id":"baada198_a04490b8","line":605,"updated":"2014-07-24 22:00:07.000000000","message":"Too many years of LISP hacking has me thinking that this should be made recursive.  Sadly Python internals mean the iterative version is better:)","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":2592,"name":"Mark McClain","email":"mark@mcclain.xyz","username":"markmcclain"},"change_message_id":"3519c39722dcf6cd0fd6c096f07f3dfae9b57a87","unresolved":false,"context_lines":[{"line_number":606,"context_line":"            net_id \u003d nets.pop()"},{"line_number":607,"context_line":"            visited_nets.add(net_id)"},{"line_number":608,"context_line":"            net_ports \u003d port_query.filter_by(network_id\u003dnet_id,"},{"line_number":609,"context_line":"                                             tenant_id\u003dtenant_id)"},{"line_number":610,"context_line":"            for net_port in net_ports:"},{"line_number":611,"context_line":"                device_id \u003d net_port.get(\u0027device_id\u0027)"},{"line_number":612,"context_line":"                if device_id and device_id not in visited_devices:"}],"source_content_type":"text/x-python","patch_set":16,"id":"baada198_43457e6d","line":609,"updated":"2014-07-24 22:00:07.000000000","message":"In general, I\u0027d like to see SQLAlchemy used to filter out results vs pulling the data in python.  Also seems like there should more filtering by device type to reduce the number of ports to check.","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"ee1b97222acf76ec024a2c06ebc38cde809d8c08","unresolved":false,"context_lines":[{"line_number":606,"context_line":"            net_id \u003d nets.pop()"},{"line_number":607,"context_line":"            visited_nets.add(net_id)"},{"line_number":608,"context_line":"            net_ports \u003d port_query.filter_by(network_id\u003dnet_id,"},{"line_number":609,"context_line":"                                             tenant_id\u003dtenant_id)"},{"line_number":610,"context_line":"            for net_port in net_ports:"},{"line_number":611,"context_line":"                device_id \u003d net_port.get(\u0027device_id\u0027)"},{"line_number":612,"context_line":"                if device_id and device_id not in visited_devices:"}],"source_content_type":"text/x-python","patch_set":16,"id":"7ac7a964_7327fab6","line":609,"in_reply_to":"7ac7a964_0f6948f9","updated":"2014-08-15 08:52:47.000000000","message":"what are those instances with security gw sw? If to openstack they\u0027re just instances, they should have a compute:instance tag like any other instance.\n\nI reckon you can build a list of device owners from here\nhttps://github.com/openstack/neutron/blob/master/neutron/common/constants.py#L32","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"338495102a4d6fed11d31457388d948234095bf5","unresolved":false,"context_lines":[{"line_number":606,"context_line":"            net_id \u003d nets.pop()"},{"line_number":607,"context_line":"            visited_nets.add(net_id)"},{"line_number":608,"context_line":"            net_ports \u003d port_query.filter_by(network_id\u003dnet_id,"},{"line_number":609,"context_line":"                                             tenant_id\u003dtenant_id)"},{"line_number":610,"context_line":"            for net_port in net_ports:"},{"line_number":611,"context_line":"                device_id \u003d net_port.get(\u0027device_id\u0027)"},{"line_number":612,"context_line":"                if device_id and device_id not in visited_devices:"}],"source_content_type":"text/x-python","patch_set":16,"id":"7ac7a964_fe682ebc","line":609,"in_reply_to":"7ac7a964_7327fab6","updated":"2014-08-15 11:01:22.000000000","message":"The use case for this BP is that sometimes users would want to build cloud networks that emulate a private data center, where they have a security gateway (firewall/VPN) separating the Internet, web servers and database servers into multiple zones and inspecting the traffic that goes in between.\n\nThe gateway can be a software stack installed on a standard VM instance.\n\nI looked at devices in my primitive devstack setup and saw compute:none, I also saw other code checking for startswith(\u0027compute:\u0027). \n\nPerhaps instead of enumerating devices that we want to search and having to resort to SQL LIKE for matching things like compute:*, we can enumerate devices that we\u0027d like to skip like: network:dhcp - what else?","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"f01d582fa64b02dc3637f501335c66d125a898d7","unresolved":false,"context_lines":[{"line_number":606,"context_line":"            net_id \u003d nets.pop()"},{"line_number":607,"context_line":"            visited_nets.add(net_id)"},{"line_number":608,"context_line":"            net_ports \u003d port_query.filter_by(network_id\u003dnet_id,"},{"line_number":609,"context_line":"                                             tenant_id\u003dtenant_id)"},{"line_number":610,"context_line":"            for net_port in net_ports:"},{"line_number":611,"context_line":"                device_id \u003d net_port.get(\u0027device_id\u0027)"},{"line_number":612,"context_line":"                if device_id and device_id not in visited_devices:"}],"source_content_type":"text/x-python","patch_set":16,"id":"7ac7a964_0f6948f9","line":609,"in_reply_to":"baada198_43457e6d","updated":"2014-08-15 08:13:14.000000000","message":"The next patch set will have the iteration of finding the next layer of networks all done in SQL.\n\nRegarding device type, there does not seem to be a complete list of device_owner values which can be matched (also, when considering compute instances that run security gateway software).","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"e2978a87fda14a578939af2f5228abc7432b2421","unresolved":false,"context_lines":[{"line_number":621,"context_line":"                                nets.append(device_port_net_id)"},{"line_number":622,"context_line":"        return False"},{"line_number":623,"context_line":""},{"line_number":624,"context_line":"    def _find_net_for_nexthop(self, context, port_query, router_id, nexthop):"},{"line_number":625,"context_line":"        \"\"\"Find the network to which the nexthop belongs."},{"line_number":626,"context_line":""},{"line_number":627,"context_line":"        Iterate over the router interfaces to find the network of nexthop."}],"source_content_type":"text/x-python","patch_set":16,"id":"baada198_b0c40c42","line":624,"updated":"2014-07-17 15:53:09.000000000","message":"I\u0027m not sure there is value in moving the query object around.\nI think it will be better to create it in the method. As far as I understand it won\u0027t add a significant performance penalty. Also it will make code more robust wrt errors such as modifying the query object in _find_router_via_router_for_floatingip in subsequent patches.","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"338495102a4d6fed11d31457388d948234095bf5","unresolved":false,"context_lines":[{"line_number":621,"context_line":"                                nets.append(device_port_net_id)"},{"line_number":622,"context_line":"        return False"},{"line_number":623,"context_line":""},{"line_number":624,"context_line":"    def _find_net_for_nexthop(self, context, port_query, router_id, nexthop):"},{"line_number":625,"context_line":"        \"\"\"Find the network to which the nexthop belongs."},{"line_number":626,"context_line":""},{"line_number":627,"context_line":"        Iterate over the router interfaces to find the network of nexthop."}],"source_content_type":"text/x-python","patch_set":16,"id":"7ac7a964_5ee3e232","line":624,"in_reply_to":"7ac7a964_1808a52c","updated":"2014-08-15 11:01:22.000000000","message":"I changed it in patch 17 (and also added filter by tenant that was missing in this method).","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"db9361506da89d2c4314ed93d05468e3d748d916","unresolved":false,"context_lines":[{"line_number":621,"context_line":"                                nets.append(device_port_net_id)"},{"line_number":622,"context_line":"        return False"},{"line_number":623,"context_line":""},{"line_number":624,"context_line":"    def _find_net_for_nexthop(self, context, port_query, router_id, nexthop):"},{"line_number":625,"context_line":"        \"\"\"Find the network to which the nexthop belongs."},{"line_number":626,"context_line":""},{"line_number":627,"context_line":"        Iterate over the router interfaces to find the network of nexthop."}],"source_content_type":"text/x-python","patch_set":16,"id":"baada198_d1c6d815","line":624,"in_reply_to":"baada198_b0c40c42","updated":"2014-07-18 17:51:41.000000000","message":"I wasn\u0027t sure about that, since an early comment suggested sharing the query within a method, I thought it was more optimal. I agree that the readability will improve with have a \"local\" query per method. I\u0027ll change the code.","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"ee1b97222acf76ec024a2c06ebc38cde809d8c08","unresolved":false,"context_lines":[{"line_number":621,"context_line":"                                nets.append(device_port_net_id)"},{"line_number":622,"context_line":"        return False"},{"line_number":623,"context_line":""},{"line_number":624,"context_line":"    def _find_net_for_nexthop(self, context, port_query, router_id, nexthop):"},{"line_number":625,"context_line":"        \"\"\"Find the network to which the nexthop belongs."},{"line_number":626,"context_line":""},{"line_number":627,"context_line":"        Iterate over the router interfaces to find the network of nexthop."}],"source_content_type":"text/x-python","patch_set":16,"id":"7ac7a964_1808a52c","line":624,"in_reply_to":"baada198_d1c6d815","updated":"2014-08-15 08:52:47.000000000","message":"this was not a super-important comment. Do it if you want, otherwise that\u0027s fine either way.","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"e2978a87fda14a578939af2f5228abc7432b2421","unresolved":false,"context_lines":[{"line_number":637,"context_line":"        for interface in interfaces:"},{"line_number":638,"context_line":"            cidrs \u003d [self._core_plugin._get_subnet(context,"},{"line_number":639,"context_line":"                                                   ip[\u0027subnet_id\u0027])[\u0027cidr\u0027]"},{"line_number":640,"context_line":"                     for ip in interface[\u0027fixed_ips\u0027]]"},{"line_number":641,"context_line":"            if netaddr.all_matching_cidrs(nexthop, cidrs):"},{"line_number":642,"context_line":"                return interface[\u0027network_id\u0027]"},{"line_number":643,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"baada198_101218b4","line":640,"updated":"2014-07-17 15:53:09.000000000","message":"These are way more queries than what I\u0027d like to see.\nHowever, improving this situation is not easy, even if not impossible as well. If you have any idea already let me know.","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"db9361506da89d2c4314ed93d05468e3d748d916","unresolved":false,"context_lines":[{"line_number":637,"context_line":"        for interface in interfaces:"},{"line_number":638,"context_line":"            cidrs \u003d [self._core_plugin._get_subnet(context,"},{"line_number":639,"context_line":"                                                   ip[\u0027subnet_id\u0027])[\u0027cidr\u0027]"},{"line_number":640,"context_line":"                     for ip in interface[\u0027fixed_ips\u0027]]"},{"line_number":641,"context_line":"            if netaddr.all_matching_cidrs(nexthop, cidrs):"},{"line_number":642,"context_line":"                return interface[\u0027network_id\u0027]"},{"line_number":643,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"baada198_911f00b7","line":640,"in_reply_to":"baada198_101218b4","updated":"2014-07-18 17:51:41.000000000","message":"Similar queries seem to be done in _validate_routes() in neutron/db/extraroute_db.py, every time a route is added. Here we would only call this method for routers that have a matching route (and owned by the tenant). So given an extra route we will run similar queries during the route update, and then also once per floating IP assignment that matches the destination of the route. Since floating IPs are \"expensive\", we might think that there wouldn\u0027t be too many of them per route.","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"ee1b97222acf76ec024a2c06ebc38cde809d8c08","unresolved":false,"context_lines":[{"line_number":637,"context_line":"        for interface in interfaces:"},{"line_number":638,"context_line":"            cidrs \u003d [self._core_plugin._get_subnet(context,"},{"line_number":639,"context_line":"                                                   ip[\u0027subnet_id\u0027])[\u0027cidr\u0027]"},{"line_number":640,"context_line":"                     for ip in interface[\u0027fixed_ips\u0027]]"},{"line_number":641,"context_line":"            if netaddr.all_matching_cidrs(nexthop, cidrs):"},{"line_number":642,"context_line":"                return interface[\u0027network_id\u0027]"},{"line_number":643,"context_line":""}],"source_content_type":"text/x-python","patch_set":16,"id":"7ac7a964_939f36b4","line":640,"in_reply_to":"baada198_911f00b7","updated":"2014-08-15 08:52:47.000000000","message":"The fact that similar queries are done in _validate_routes does not mean we should have those here as well. I might say that then I want those queries removed from there as well!\n\nI was thinking that maybe we can try and provide a _get_subnets method to perform a single query for all interfaces.\nAnyway, it\u0027s not going to be a terrible amount of queries after all - as you say.\nSo let\u0027s keep this for a subsequent optimization","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":2592,"name":"Mark McClain","email":"mark@mcclain.xyz","username":"markmcclain"},"change_message_id":"3519c39722dcf6cd0fd6c096f07f3dfae9b57a87","unresolved":false,"context_lines":[{"line_number":671,"context_line":"        routers \u003d self.get_routers(context, filters\u003d{\u0027tenant_id\u0027: [tenant_id]})"},{"line_number":672,"context_line":""},{"line_number":673,"context_line":"        prefix_routers \u003d []"},{"line_number":674,"context_line":"        port_query \u003d context.session.query(models_v2.Port)"},{"line_number":675,"context_line":"        for router in routers:"},{"line_number":676,"context_line":"            if \u0027routes\u0027 in router:"},{"line_number":677,"context_line":"                # find a matching route"}],"source_content_type":"text/x-python","patch_set":16,"id":"baada198_4383be02","line":674,"updated":"2014-07-24 22:00:07.000000000","message":"Why is this not scoped to tenant?\n.filter_by(tenant_id\u003dtenant_id)","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"f01d582fa64b02dc3637f501335c66d125a898d7","unresolved":false,"context_lines":[{"line_number":671,"context_line":"        routers \u003d self.get_routers(context, filters\u003d{\u0027tenant_id\u0027: [tenant_id]})"},{"line_number":672,"context_line":""},{"line_number":673,"context_line":"        prefix_routers \u003d []"},{"line_number":674,"context_line":"        port_query \u003d context.session.query(models_v2.Port)"},{"line_number":675,"context_line":"        for router in routers:"},{"line_number":676,"context_line":"            if \u0027routes\u0027 in router:"},{"line_number":677,"context_line":"                # find a matching route"}],"source_content_type":"text/x-python","patch_set":16,"id":"7ac7a964_8e957ae6","line":674,"in_reply_to":"baada198_4383be02","updated":"2014-08-15 08:13:14.000000000","message":"The query is used below to validate that the router has a matching ROUTER_GW port on the external network.\n\nIn both devstack and the unit test framework, the tenant_id of the ROUTER_GW port is empty.","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"e2978a87fda14a578939af2f5228abc7432b2421","unresolved":false,"context_lines":[{"line_number":676,"context_line":"            if \u0027routes\u0027 in router:"},{"line_number":677,"context_line":"                # find a matching route"},{"line_number":678,"context_line":"                cidrs \u003d [netaddr.IPNetwork(route[\u0027destination\u0027])"},{"line_number":679,"context_line":"                         for route in router[\u0027routes\u0027]]"},{"line_number":680,"context_line":"                smallest_cidr \u003d netaddr.smallest_matching_cidr("},{"line_number":681,"context_line":"                    internal_ip_address,"},{"line_number":682,"context_line":"                    cidrs)"}],"source_content_type":"text/x-python","patch_set":16,"id":"baada198_10d05852","line":679,"updated":"2014-07-17 15:53:09.000000000","message":"can you consider:\n\ncidr_nexthops \u003d [(netaddr.IPNetwork(route[\u0027destination\u0027]), route[\u0027nexthop\u0027])]\n\nIn this way once you identify the smellest cidr it should be possible to find the associated nexthop immediately without doing the iteration you\u0027re doing at line 692.\n\nI\u0027ve not tested the above code, and I think you can try also with a dict.","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"db9361506da89d2c4314ed93d05468e3d748d916","unresolved":false,"context_lines":[{"line_number":676,"context_line":"            if \u0027routes\u0027 in router:"},{"line_number":677,"context_line":"                # find a matching route"},{"line_number":678,"context_line":"                cidrs \u003d [netaddr.IPNetwork(route[\u0027destination\u0027])"},{"line_number":679,"context_line":"                         for route in router[\u0027routes\u0027]]"},{"line_number":680,"context_line":"                smallest_cidr \u003d netaddr.smallest_matching_cidr("},{"line_number":681,"context_line":"                    internal_ip_address,"},{"line_number":682,"context_line":"                    cidrs)"}],"source_content_type":"text/x-python","patch_set":16,"id":"baada198_b1b88412","line":679,"in_reply_to":"baada198_10d05852","updated":"2014-07-18 17:51:41.000000000","message":"Agreed.","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"e2978a87fda14a578939af2f5228abc7432b2421","unresolved":false,"context_lines":[{"line_number":685,"context_line":"                    has_gw_port \u003d port_query.filter_by("},{"line_number":686,"context_line":"                        network_id\u003dexternal_network_id,"},{"line_number":687,"context_line":"                        device_id\u003drouter[\u0027id\u0027],"},{"line_number":688,"context_line":"                        device_owner\u003dDEVICE_OWNER_ROUTER_GW).count()"},{"line_number":689,"context_line":"                    if has_gw_port:"},{"line_number":690,"context_line":"                        # validate that there exists a path to \"internal_port\""},{"line_number":691,"context_line":"                        nexthops \u003d []"}],"source_content_type":"text/x-python","patch_set":16,"id":"baada198_3fe7efe5","line":688,"updated":"2014-07-17 15:53:09.000000000","message":"doing this query for every router is a bit expensive.\nMaybe you can query all the router gw ports on external_network_id owned by tenant_id and grouped by router before starting the iteration over routers.","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"ee1b97222acf76ec024a2c06ebc38cde809d8c08","unresolved":false,"context_lines":[{"line_number":685,"context_line":"                    has_gw_port \u003d port_query.filter_by("},{"line_number":686,"context_line":"                        network_id\u003dexternal_network_id,"},{"line_number":687,"context_line":"                        device_id\u003drouter[\u0027id\u0027],"},{"line_number":688,"context_line":"                        device_owner\u003dDEVICE_OWNER_ROUTER_GW).count()"},{"line_number":689,"context_line":"                    if has_gw_port:"},{"line_number":690,"context_line":"                        # validate that there exists a path to \"internal_port\""},{"line_number":691,"context_line":"                        nexthops \u003d []"}],"source_content_type":"text/x-python","patch_set":16,"id":"7ac7a964_73ea9a10","line":688,"in_reply_to":"baada198_11f3f00a","updated":"2014-08-15 08:52:47.000000000","message":"right. this is something else that needs to be sorted outside of this patch.","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"db9361506da89d2c4314ed93d05468e3d748d916","unresolved":false,"context_lines":[{"line_number":685,"context_line":"                    has_gw_port \u003d port_query.filter_by("},{"line_number":686,"context_line":"                        network_id\u003dexternal_network_id,"},{"line_number":687,"context_line":"                        device_id\u003drouter[\u0027id\u0027],"},{"line_number":688,"context_line":"                        device_owner\u003dDEVICE_OWNER_ROUTER_GW).count()"},{"line_number":689,"context_line":"                    if has_gw_port:"},{"line_number":690,"context_line":"                        # validate that there exists a path to \"internal_port\""},{"line_number":691,"context_line":"                        nexthops \u003d []"}],"source_content_type":"text/x-python","patch_set":16,"id":"baada198_11f3f00a","line":688,"in_reply_to":"baada198_3fe7efe5","updated":"2014-07-18 17:51:41.000000000","message":"It seems that both in devstack and in the unit test framework, the \"router gateway\" port does not seem to have a tenant_id, so filtering gw ports on the tenant is not possible (this was also discussed in patch set 10).\nSpecifically, the query here is only for routers that belong to the tenant and have a route matching the floatingip address.","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"e2978a87fda14a578939af2f5228abc7432b2421","unresolved":false,"context_lines":[{"line_number":692,"context_line":"                        for route in router[\u0027routes\u0027]:"},{"line_number":693,"context_line":"                            if smallest_cidr.cidr \u003d\u003d netaddr.IPNetwork("},{"line_number":694,"context_line":"                                route[\u0027destination\u0027]).cidr:"},{"line_number":695,"context_line":"                                nexthops.append(route[\u0027nexthop\u0027])"},{"line_number":696,"context_line":"                        for nexthop in nexthops:"},{"line_number":697,"context_line":"                            net_id \u003d self._find_net_for_nexthop("},{"line_number":698,"context_line":"                                context,"}],"source_content_type":"text/x-python","patch_set":16,"id":"baada198_9071c879","line":695,"updated":"2014-07-17 15:53:09.000000000","message":"I think this will bring at most a single nextop?\nOr am I not reading your code correctly?\n\nI\u0027m asking because you are resetting nexthops at line 691","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"db9361506da89d2c4314ed93d05468e3d748d916","unresolved":false,"context_lines":[{"line_number":692,"context_line":"                        for route in router[\u0027routes\u0027]:"},{"line_number":693,"context_line":"                            if smallest_cidr.cidr \u003d\u003d netaddr.IPNetwork("},{"line_number":694,"context_line":"                                route[\u0027destination\u0027]).cidr:"},{"line_number":695,"context_line":"                                nexthops.append(route[\u0027nexthop\u0027])"},{"line_number":696,"context_line":"                        for nexthop in nexthops:"},{"line_number":697,"context_line":"                            net_id \u003d self._find_net_for_nexthop("},{"line_number":698,"context_line":"                                context,"}],"source_content_type":"text/x-python","patch_set":16,"id":"baada198_b1b3244c","line":695,"in_reply_to":"baada198_9071c879","updated":"2014-07-18 17:51:41.000000000","message":"The extraroute code doesn\u0027t seem to validate that there are no multiple routes with the same destination cidr but with different nexthop, so although this does not make sense there might be more than one element in the nexthops list. Instead of considering multiple nexthops we could raise an exception if it happens. Is this a better choice?","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"ff1e9416772028c0ebe2aee261a51f8c805f8e34","unresolved":false,"context_lines":[{"line_number":692,"context_line":"                        for route in router[\u0027routes\u0027]:"},{"line_number":693,"context_line":"                            if smallest_cidr.cidr \u003d\u003d netaddr.IPNetwork("},{"line_number":694,"context_line":"                                route[\u0027destination\u0027]).cidr:"},{"line_number":695,"context_line":"                                nexthops.append(route[\u0027nexthop\u0027])"},{"line_number":696,"context_line":"                        for nexthop in nexthops:"},{"line_number":697,"context_line":"                            net_id \u003d self._find_net_for_nexthop("},{"line_number":698,"context_line":"                                context,"}],"source_content_type":"text/x-python","patch_set":16,"id":"baada198_740c1a3a","line":695,"in_reply_to":"baada198_b1b3244c","updated":"2014-07-24 07:42:01.000000000","message":"yes, I think","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"e2978a87fda14a578939af2f5228abc7432b2421","unresolved":false,"context_lines":[{"line_number":699,"context_line":"                                port_query,"},{"line_number":700,"context_line":"                                router[\u0027id\u0027],"},{"line_number":701,"context_line":"                                nexthop)"},{"line_number":702,"context_line":"                            if (net_id is not None and"},{"line_number":703,"context_line":"                                self._is_net_reachable_from_net("},{"line_number":704,"context_line":"                                    port_query,"},{"line_number":705,"context_line":"                                    tenant_id,"}],"source_content_type":"text/x-python","patch_set":16,"id":"baada198_d076e005","line":702,"updated":"2014-07-17 15:53:09.000000000","message":"is not None is redundant\nconsider just\nif net_id and self._is_net_reachable_from_net","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"db9361506da89d2c4314ed93d05468e3d748d916","unresolved":false,"context_lines":[{"line_number":699,"context_line":"                                port_query,"},{"line_number":700,"context_line":"                                router[\u0027id\u0027],"},{"line_number":701,"context_line":"                                nexthop)"},{"line_number":702,"context_line":"                            if (net_id is not None and"},{"line_number":703,"context_line":"                                self._is_net_reachable_from_net("},{"line_number":704,"context_line":"                                    port_query,"},{"line_number":705,"context_line":"                                    tenant_id,"}],"source_content_type":"text/x-python","patch_set":16,"id":"baada198_d19418ea","line":702,"in_reply_to":"baada198_d076e005","updated":"2014-07-18 17:51:41.000000000","message":"Will do.","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"e2978a87fda14a578939af2f5228abc7432b2421","unresolved":false,"context_lines":[{"line_number":747,"context_line":"                internal_port,"},{"line_number":748,"context_line":"                internal_subnet_id,"},{"line_number":749,"context_line":"                external_network_id):"},{"line_number":750,"context_line":"            return router_id"},{"line_number":751,"context_line":""},{"line_number":752,"context_line":"        raise l3.ExternalGatewayForFloatingIPNotFound("},{"line_number":753,"context_line":"            subnet_id\u003dinternal_subnet_id,"}],"source_content_type":"text/x-python","patch_set":16,"id":"baada198_bfbdbf04","line":750,"updated":"2014-07-17 15:53:09.000000000","message":"why did you choose the for iteration and did not just return the first element returned by _find_routers_via_routes_for_floatingip?","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"ff1e9416772028c0ebe2aee261a51f8c805f8e34","unresolved":false,"context_lines":[{"line_number":747,"context_line":"                internal_port,"},{"line_number":748,"context_line":"                internal_subnet_id,"},{"line_number":749,"context_line":"                external_network_id):"},{"line_number":750,"context_line":"            return router_id"},{"line_number":751,"context_line":""},{"line_number":752,"context_line":"        raise l3.ExternalGatewayForFloatingIPNotFound("},{"line_number":753,"context_line":"            subnet_id\u003dinternal_subnet_id,"}],"source_content_type":"text/x-python","patch_set":16,"id":"baada198_b42dd291","line":750,"in_reply_to":"baada198_081bc880","updated":"2014-07-24 07:42:01.000000000","message":"I think I was asking something simpler...\nmy question was why are you doing this instead of:\n\ntry:\n    return self._find_routers_via_routes_for_floatingip(....)[0]\nexcept:\n    # Log if you think that\u0027s the case\n    raise l3.ExternalGatewayForFloatingIPNotFound","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"f01d582fa64b02dc3637f501335c66d125a898d7","unresolved":false,"context_lines":[{"line_number":747,"context_line":"                internal_port,"},{"line_number":748,"context_line":"                internal_subnet_id,"},{"line_number":749,"context_line":"                external_network_id):"},{"line_number":750,"context_line":"            return router_id"},{"line_number":751,"context_line":""},{"line_number":752,"context_line":"        raise l3.ExternalGatewayForFloatingIPNotFound("},{"line_number":753,"context_line":"            subnet_id\u003dinternal_subnet_id,"}],"source_content_type":"text/x-python","patch_set":16,"id":"7ac7a964_6d9c79c1","line":750,"in_reply_to":"baada198_b42dd291","updated":"2014-08-15 08:13:14.000000000","message":"I see. I was trying to minimize code changes in existing code and avoid expected exceptions. Perhaps I can set the router list to a variable and test its length before returning.","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"db9361506da89d2c4314ed93d05468e3d748d916","unresolved":false,"context_lines":[{"line_number":747,"context_line":"                internal_port,"},{"line_number":748,"context_line":"                internal_subnet_id,"},{"line_number":749,"context_line":"                external_network_id):"},{"line_number":750,"context_line":"            return router_id"},{"line_number":751,"context_line":""},{"line_number":752,"context_line":"        raise l3.ExternalGatewayForFloatingIPNotFound("},{"line_number":753,"context_line":"            subnet_id\u003dinternal_subnet_id,"}],"source_content_type":"text/x-python","patch_set":16,"id":"baada198_081bc880","line":750,"in_reply_to":"baada198_bfbdbf04","updated":"2014-07-18 17:51:41.000000000","message":"The calling method _get_router_for_floatingip() is overriden in neutron/plugins/nec/nec_router.py. There, the router is checked for another condition and there is a need for more than just one candidate from _find_router_via_routes_for_floatingip(). Here, indeed, we could assign the returned list to a variable, test for non-empty and return the first element.","commit_id":"acade40f2496260da6f1239e38595834d7fd8766"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"387cbd13e37b5ef6c6d38c8c773128f6831ebd16","unresolved":false,"context_lines":[{"line_number":565,"context_line":"               \u0027status\u0027: floatingip[\u0027status\u0027]}"},{"line_number":566,"context_line":"        return self._fields(res, fields)"},{"line_number":567,"context_line":""},{"line_number":568,"context_line":"    def _is_net_reachable_from_net(self, context, tenant_id, from_net_id,"},{"line_number":569,"context_line":"                                   to_net_id):"},{"line_number":570,"context_line":"        \"\"\"Check whether a network is reachable."},{"line_number":571,"context_line":""}],"source_content_type":"text/x-python","patch_set":17,"id":"1abeadc6_d3c5103d","line":568,"updated":"2014-08-19 20:16:10.000000000","message":"So, this went away in PS6 and then popped back up with no explanation in PS16.  Did I miss the explanation?  This is not how the spec describes this functionality.  Could you provide an explanation for why this came back?\n\nIMO, we don\u0027t need to check absolute connectivity and I thought we were going to go with the existence of an extra route.  But, I\u0027m open to hearing other points of view.","commit_id":"d427ce92cdc3f9aac65f4a0a120ba035a55a45a8"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"25a25eaf8d60aa3155ed9b883541f952a057842e","unresolved":false,"context_lines":[{"line_number":565,"context_line":"               \u0027status\u0027: floatingip[\u0027status\u0027]}"},{"line_number":566,"context_line":"        return self._fields(res, fields)"},{"line_number":567,"context_line":""},{"line_number":568,"context_line":"    def _is_net_reachable_from_net(self, context, tenant_id, from_net_id,"},{"line_number":569,"context_line":"                                   to_net_id):"},{"line_number":570,"context_line":"        \"\"\"Check whether a network is reachable."},{"line_number":571,"context_line":""}],"source_content_type":"text/x-python","patch_set":17,"id":"1abeadc6_5b01ee36","line":568,"in_reply_to":"1abeadc6_d3c5103d","updated":"2014-08-20 21:09:19.000000000","message":"Personally, I agree with your view, but the requirement for connectivity validation was posed earlier by Nachi Ueno and recently by Mark McClain.\n\nThe connectivity check returned for review following a conversation on IRC with Mark McClain:\n\nhttp://eavesdrop.openstack.org/irclogs/%23openstack-neutron/%23openstack-neutron.2014-07-10.log\n\n(please search for \"ofer\" - 20 mentions)\n\nI agree that an explanation in the code (as part of a review) was appropriate and is missing. (I find it easier just to communicate over the code review system, but unfortunately this is not always enough for getting attention for this proposed change).","commit_id":"d427ce92cdc3f9aac65f4a0a120ba035a55a45a8"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"bdf4dd07d859d4ec9cd02172dbeb0126f495587e","unresolved":false,"context_lines":[{"line_number":649,"context_line":"        prefix_routers \u003d []"},{"line_number":650,"context_line":"        port_query \u003d context.session.query(models_v2.Port)"},{"line_number":651,"context_line":"        for router in routers:"},{"line_number":652,"context_line":"            if \u0027routes\u0027 in router:"},{"line_number":653,"context_line":"                # find a matching route"},{"line_number":654,"context_line":"                cidr_nexthops \u003d {}"},{"line_number":655,"context_line":"                for route in router[\u0027routes\u0027]:"}],"source_content_type":"text/x-python","patch_set":17,"id":"1abeadc6_b03c26e4","line":652,"updated":"2014-08-19 10:00:56.000000000","message":"nit:\n\nroutes \u003d router.get(\u0027routes\u0027)\nif not routes:\n     continue\n\nThis will reduce one level of indentatio","commit_id":"d427ce92cdc3f9aac65f4a0a120ba035a55a45a8"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"cf4f7d590430a93b9916b41bc84497db5a19d701","unresolved":false,"context_lines":[{"line_number":649,"context_line":"        prefix_routers \u003d []"},{"line_number":650,"context_line":"        port_query \u003d context.session.query(models_v2.Port)"},{"line_number":651,"context_line":"        for router in routers:"},{"line_number":652,"context_line":"            if \u0027routes\u0027 in router:"},{"line_number":653,"context_line":"                # find a matching route"},{"line_number":654,"context_line":"                cidr_nexthops \u003d {}"},{"line_number":655,"context_line":"                for route in router[\u0027routes\u0027]:"}],"source_content_type":"text/x-python","patch_set":17,"id":"1abeadc6_9dbdf9da","line":652,"in_reply_to":"1abeadc6_5b5d6e46","updated":"2014-08-22 09:38:05.000000000","message":"I don\u0027t know about how other reviewers feel, but we\u0027re going 5 levels deep...","commit_id":"d427ce92cdc3f9aac65f4a0a120ba035a55a45a8"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"25a25eaf8d60aa3155ed9b883541f952a057842e","unresolved":false,"context_lines":[{"line_number":649,"context_line":"        prefix_routers \u003d []"},{"line_number":650,"context_line":"        port_query \u003d context.session.query(models_v2.Port)"},{"line_number":651,"context_line":"        for router in routers:"},{"line_number":652,"context_line":"            if \u0027routes\u0027 in router:"},{"line_number":653,"context_line":"                # find a matching route"},{"line_number":654,"context_line":"                cidr_nexthops \u003d {}"},{"line_number":655,"context_line":"                for route in router[\u0027routes\u0027]:"}],"source_content_type":"text/x-python","patch_set":17,"id":"1abeadc6_5b5d6e46","line":652,"in_reply_to":"1abeadc6_b03c26e4","updated":"2014-08-20 21:09:19.000000000","message":"Sure, will change. (I personally prefer this style too, but got an early comment on patch set 1).","commit_id":"d427ce92cdc3f9aac65f4a0a120ba035a55a45a8"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"bdf4dd07d859d4ec9cd02172dbeb0126f495587e","unresolved":false,"context_lines":[{"line_number":660,"context_line":"                smallest_cidr \u003d netaddr.smallest_matching_cidr("},{"line_number":661,"context_line":"                    internal_ip_address,"},{"line_number":662,"context_line":"                    cidr_nexthops.keys())"},{"line_number":663,"context_line":"                if smallest_cidr is not None:"},{"line_number":664,"context_line":"                    # verify that the router is on \"external_network\""},{"line_number":665,"context_line":"                    has_gw_port \u003d port_query.filter_by("},{"line_number":666,"context_line":"                        network_id\u003dexternal_network_id,"}],"source_content_type":"text/x-python","patch_set":17,"id":"1abeadc6_24361be8","line":663,"updated":"2014-08-19 10:00:56.000000000","message":"I don\u0027t think you need to handle the case where smallest_cidr is 0 or empty string. therefore the above could just be\n\nif smallest_cidr:","commit_id":"d427ce92cdc3f9aac65f4a0a120ba035a55a45a8"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"25a25eaf8d60aa3155ed9b883541f952a057842e","unresolved":false,"context_lines":[{"line_number":660,"context_line":"                smallest_cidr \u003d netaddr.smallest_matching_cidr("},{"line_number":661,"context_line":"                    internal_ip_address,"},{"line_number":662,"context_line":"                    cidr_nexthops.keys())"},{"line_number":663,"context_line":"                if smallest_cidr is not None:"},{"line_number":664,"context_line":"                    # verify that the router is on \"external_network\""},{"line_number":665,"context_line":"                    has_gw_port \u003d port_query.filter_by("},{"line_number":666,"context_line":"                        network_id\u003dexternal_network_id,"}],"source_content_type":"text/x-python","patch_set":17,"id":"1abeadc6_962fdd87","line":663,"in_reply_to":"1abeadc6_24361be8","updated":"2014-08-20 21:09:19.000000000","message":"will change.","commit_id":"d427ce92cdc3f9aac65f4a0a120ba035a55a45a8"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"bdf4dd07d859d4ec9cd02172dbeb0126f495587e","unresolved":false,"context_lines":[{"line_number":661,"context_line":"                    internal_ip_address,"},{"line_number":662,"context_line":"                    cidr_nexthops.keys())"},{"line_number":663,"context_line":"                if smallest_cidr is not None:"},{"line_number":664,"context_line":"                    # verify that the router is on \"external_network\""},{"line_number":665,"context_line":"                    has_gw_port \u003d port_query.filter_by("},{"line_number":666,"context_line":"                        network_id\u003dexternal_network_id,"},{"line_number":667,"context_line":"                        device_id\u003drouter[\u0027id\u0027],"}],"source_content_type":"text/x-python","patch_set":17,"id":"1abeadc6_5002f20b","line":664,"updated":"2014-08-19 10:00:56.000000000","message":"can\u0027t you just check this with router\u0027s external gateway info?\nIt would be good to save a query\n\nMoreover if that\u0027s correct you might do this check at the beginning where you check for \u0027routes\u0027 in a router. This will save us another level of indentation.","commit_id":"d427ce92cdc3f9aac65f4a0a120ba035a55a45a8"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"387cbd13e37b5ef6c6d38c8c773128f6831ebd16","unresolved":false,"context_lines":[{"line_number":661,"context_line":"                    internal_ip_address,"},{"line_number":662,"context_line":"                    cidr_nexthops.keys())"},{"line_number":663,"context_line":"                if smallest_cidr is not None:"},{"line_number":664,"context_line":"                    # verify that the router is on \"external_network\""},{"line_number":665,"context_line":"                    has_gw_port \u003d port_query.filter_by("},{"line_number":666,"context_line":"                        network_id\u003dexternal_network_id,"},{"line_number":667,"context_line":"                        device_id\u003drouter[\u0027id\u0027],"}],"source_content_type":"text/x-python","patch_set":17,"id":"1abeadc6_08b837c7","line":664,"in_reply_to":"1abeadc6_5002f20b","updated":"2014-08-19 20:16:10.000000000","message":"+1 Please look in to this.","commit_id":"d427ce92cdc3f9aac65f4a0a120ba035a55a45a8"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"25a25eaf8d60aa3155ed9b883541f952a057842e","unresolved":false,"context_lines":[{"line_number":661,"context_line":"                    internal_ip_address,"},{"line_number":662,"context_line":"                    cidr_nexthops.keys())"},{"line_number":663,"context_line":"                if smallest_cidr is not None:"},{"line_number":664,"context_line":"                    # verify that the router is on \"external_network\""},{"line_number":665,"context_line":"                    has_gw_port \u003d port_query.filter_by("},{"line_number":666,"context_line":"                        network_id\u003dexternal_network_id,"},{"line_number":667,"context_line":"                        device_id\u003drouter[\u0027id\u0027],"}],"source_content_type":"text/x-python","patch_set":17,"id":"1abeadc6_b63939a6","line":664,"in_reply_to":"1abeadc6_5002f20b","updated":"2014-08-20 21:09:19.000000000","message":"I\u0027ll look into that.","commit_id":"d427ce92cdc3f9aac65f4a0a120ba035a55a45a8"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"bdf4dd07d859d4ec9cd02172dbeb0126f495587e","unresolved":false,"context_lines":[{"line_number":720,"context_line":"                internal_port,"},{"line_number":721,"context_line":"                internal_subnet_id,"},{"line_number":722,"context_line":"                external_network_id):"},{"line_number":723,"context_line":"            return router_id"},{"line_number":724,"context_line":""},{"line_number":725,"context_line":"        raise l3.ExternalGatewayForFloatingIPNotFound("},{"line_number":726,"context_line":"            subnet_id\u003dinternal_subnet_id,"}],"source_content_type":"text/x-python","patch_set":17,"id":"1abeadc6_a486ab63","line":723,"updated":"2014-08-19 10:00:56.000000000","message":"This:\n\ntry:\n    return self._find_routers_via_routes_for_floatingip(....)[0]\nexcept IndexError:\n    # Log if you think that\u0027s the case\n    raise l3.ExternalGatewayForFloatingIPNotFound\n\nor what you suggested about testing list len in patch set 16 would work for me.","commit_id":"d427ce92cdc3f9aac65f4a0a120ba035a55a45a8"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"25a25eaf8d60aa3155ed9b883541f952a057842e","unresolved":false,"context_lines":[{"line_number":720,"context_line":"                internal_port,"},{"line_number":721,"context_line":"                internal_subnet_id,"},{"line_number":722,"context_line":"                external_network_id):"},{"line_number":723,"context_line":"            return router_id"},{"line_number":724,"context_line":""},{"line_number":725,"context_line":"        raise l3.ExternalGatewayForFloatingIPNotFound("},{"line_number":726,"context_line":"            subnet_id\u003dinternal_subnet_id,"}],"source_content_type":"text/x-python","patch_set":17,"id":"1abeadc6_b6d2195a","line":723,"in_reply_to":"1abeadc6_a486ab63","updated":"2014-08-20 21:09:19.000000000","message":"Another reason for the \"for\" loop, was that an earlier patch (or a draft for a patch) implemented _find_routers_via_routes_for_floatingip() as a generator that yielded candidate routers, where a check of len() was not possible.\n\nHowever, this is no longer the case, and I\u0027ll change to checking the length.","commit_id":"d427ce92cdc3f9aac65f4a0a120ba035a55a45a8"},{"author":{"_account_id":261,"name":"Salvatore Orlando","email":"salv.orlando@gmail.com","username":"salvatore-orlando"},"change_message_id":"cf4f7d590430a93b9916b41bc84497db5a19d701","unresolved":false,"context_lines":[{"line_number":720,"context_line":"                internal_port,"},{"line_number":721,"context_line":"                internal_subnet_id,"},{"line_number":722,"context_line":"                external_network_id):"},{"line_number":723,"context_line":"            return router_id"},{"line_number":724,"context_line":""},{"line_number":725,"context_line":"        raise l3.ExternalGatewayForFloatingIPNotFound("},{"line_number":726,"context_line":"            subnet_id\u003dinternal_subnet_id,"}],"source_content_type":"text/x-python","patch_set":17,"id":"1abeadc6_bd32b5a4","line":723,"in_reply_to":"1abeadc6_b6d2195a","updated":"2014-08-22 09:38:05.000000000","message":"thanks!","commit_id":"d427ce92cdc3f9aac65f4a0a120ba035a55a45a8"}],"neutron/plugins/nec/nec_router.py":[{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"de634a53f49f4cac7a4aafee1c8960433f033a5a","unresolved":false,"context_lines":[{"line_number":192,"context_line":"        from candidate routers for floating IP association."},{"line_number":193,"context_line":"        This method is called in l3_db.get_assoc_data()."},{"line_number":194,"context_line":"        \"\"\""},{"line_number":195,"context_line":"        def has_floating_ip_support(router_id):"},{"line_number":196,"context_line":"            if validate_router is None or validate_router(router_id):"},{"line_number":197,"context_line":"                driver \u003d self._get_router_driver_by_id(context, router_id)"},{"line_number":198,"context_line":"                return driver.floating_ip_support()"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUH%2F%2BU%2Fc%3D","line":195,"updated":"2014-01-28 00:04:47.000000000","message":"Keep this code mostly the same but add a call to the new method created in l3_db.py","commit_id":"b4cd303950d755f9ddd9b7c5850073a32f405f43"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"af29192549523cd210a19fa5277d681c87a7aa49","unresolved":false,"context_lines":[{"line_number":192,"context_line":"        from candidate routers for floating IP association."},{"line_number":193,"context_line":"        This method is called in l3_db.get_assoc_data()."},{"line_number":194,"context_line":"        \"\"\""},{"line_number":195,"context_line":"        def has_floating_ip_support(router_id):"},{"line_number":196,"context_line":"            if validate_router is None or validate_router(router_id):"},{"line_number":197,"context_line":"                driver \u003d self._get_router_driver_by_id(context, router_id)"},{"line_number":198,"context_line":"                return driver.floating_ip_support()"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUH%2F%2BFn8%3D","line":195,"in_reply_to":"AAAAUH%2F%2BU%2Fc%3D","updated":"2014-01-30 13:03:18.000000000","message":"As suggested, the next patch set, will restore the original code and add a call to a function that returns the matching routers.\nOne point, is that the plugin logic is to get a candidate router and then verifies that it supports floating IP. If the added function only returns one router and it doesn\u0027t support, we would end up with no candidates.\nSo the function returns an iterator over the matching routers, and we try them until one also supports floating IP.","commit_id":"b4cd303950d755f9ddd9b7c5850073a32f405f43"}],"neutron/tests/unit/test_extension_extraroute.py":[{"author":{"_account_id":8449,"name":"Marios Andreou","email":"marios.andreou@gmail.com","username":"marios"},"change_message_id":"f83d3892f8d79687a25122ce6fcc9ea4fc82b635","unresolved":false,"context_lines":[{"line_number":456,"context_line":"                                                     router3),"},{"line_number":457,"context_line":"                                                    (\u0027name\u0027, \u0027asc\u0027), 2, 2)"},{"line_number":458,"context_line":""},{"line_number":459,"context_line":"    def test_floatingip_reachable_by_route(self):"},{"line_number":460,"context_line":"        # public -- r1 -- inermediate -- r2 -- internal --"},{"line_number":461,"context_line":"        routes \u003d [{\u0027destination\u0027: \u002710.2.0.0/28\u0027, \u0027nexthop\u0027: \u002710.1.0.10\u0027},"},{"line_number":462,"context_line":"                  {\u0027destination\u0027: \u002710.2.0.128/30\u0027, \u0027nexthop\u0027: \u002710.1.0.10\u0027}]"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAT3%2F%2FsIM%3D","line":459,"updated":"2014-01-03 12:55:52.000000000","message":"link to the very good example on the bug report my be relevant here","commit_id":"b4cd303950d755f9ddd9b7c5850073a32f405f43"},{"author":{"_account_id":9333,"name":"Ofer Barkai","email":"ofer@checkpoint.com","username":"ofer"},"change_message_id":"af29192549523cd210a19fa5277d681c87a7aa49","unresolved":false,"context_lines":[{"line_number":456,"context_line":"                                                     router3),"},{"line_number":457,"context_line":"                                                    (\u0027name\u0027, \u0027asc\u0027), 2, 2)"},{"line_number":458,"context_line":""},{"line_number":459,"context_line":"    def test_floatingip_reachable_by_route(self):"},{"line_number":460,"context_line":"        # public -- r1 -- inermediate -- r2 -- internal --"},{"line_number":461,"context_line":"        routes \u003d [{\u0027destination\u0027: \u002710.2.0.0/28\u0027, \u0027nexthop\u0027: \u002710.1.0.10\u0027},"},{"line_number":462,"context_line":"                  {\u0027destination\u0027: \u002710.2.0.128/30\u0027, \u0027nexthop\u0027: \u002710.1.0.10\u0027}]"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAUH%2F%2BFoc%3D","line":459,"in_reply_to":"AAAAT3%2F%2FsIM%3D","updated":"2014-01-30 13:03:18.000000000","message":"Done","commit_id":"b4cd303950d755f9ddd9b7c5850073a32f405f43"}]}
