)]}'
{"neutron/db/ipam_backend_mixin.py":[{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"61ba0b6e7bc546a586999ad58f778acac75719a7","unresolved":false,"context_lines":[{"line_number":344,"context_line":"            if segment.is_dynamic:"},{"line_number":345,"context_line":"                raise segment_exc.SubnetCantAssociateToDynamicSegment()"},{"line_number":346,"context_line":""},{"line_number":347,"context_line":"    def _validate_request_device_owner(self, context,"},{"line_number":348,"context_line":"                                       need_check_subnets, new_device_owner):"},{"line_number":349,"context_line":"        query \u003d model_query.get_collection_query("},{"line_number":350,"context_line":"            context,"}],"source_content_type":"text/x-python","patch_set":3,"id":"df3967d1_4f285785","line":347,"updated":"2017-07-31 18:59:34.000000000","message":"Why did you decide to place this method here? Why not in ipam_pluggable_backend.py?","commit_id":"dc13379a1233d911dd22c2e28366ddad54aced04"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"365837ff23e91c9aa3912e0f51c1336167fbbba8","unresolved":false,"context_lines":[{"line_number":344,"context_line":"            if segment.is_dynamic:"},{"line_number":345,"context_line":"                raise segment_exc.SubnetCantAssociateToDynamicSegment()"},{"line_number":346,"context_line":""},{"line_number":347,"context_line":"    def _validate_request_device_owner(self, context,"},{"line_number":348,"context_line":"                                       need_check_subnets, new_device_owner):"},{"line_number":349,"context_line":"        query \u003d model_query.get_collection_query("},{"line_number":350,"context_line":"            context,"}],"source_content_type":"text/x-python","patch_set":3,"id":"df3967d1_294ce69c","line":347,"in_reply_to":"df3967d1_4f285785","updated":"2017-08-01 04:19:20.000000000","message":"Thanks for kind review, Miguel. As I found the validate function are all in this file. So add here. I\u0027m also confused the place about this function. :)","commit_id":"dc13379a1233d911dd22c2e28366ddad54aced04"}],"neutron/db/ipam_pluggable_backend.py":[{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"61ba0b6e7bc546a586999ad58f778acac75719a7","unresolved":false,"context_lines":[{"line_number":160,"context_line":"        ipam_driver \u003d driver.Pool.get_instance(None, context)"},{"line_number":161,"context_line":"        ipam_driver.remove_subnet(subnet_id)"},{"line_number":162,"context_line":""},{"line_number":163,"context_line":"    def allocate_ips_for_port_and_store(self, context, port, port_id):"},{"line_number":164,"context_line":"        # Make a copy of port dict to prevent changing"},{"line_number":165,"context_line":"        # incoming dict by adding \u0027id\u0027 to it."},{"line_number":166,"context_line":"        # Deepcopy doesn\u0027t work correctly in this case, because copy of"}],"source_content_type":"text/x-python","patch_set":3,"id":"df3967d1_e4d052fa","line":163,"updated":"2017-07-31 18:59:34.000000000","message":"You are missing this code path, which takes care of port creation","commit_id":"dc13379a1233d911dd22c2e28366ddad54aced04"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"365837ff23e91c9aa3912e0f51c1336167fbbba8","unresolved":false,"context_lines":[{"line_number":160,"context_line":"        ipam_driver \u003d driver.Pool.get_instance(None, context)"},{"line_number":161,"context_line":"        ipam_driver.remove_subnet(subnet_id)"},{"line_number":162,"context_line":""},{"line_number":163,"context_line":"    def allocate_ips_for_port_and_store(self, context, port, port_id):"},{"line_number":164,"context_line":"        # Make a copy of port dict to prevent changing"},{"line_number":165,"context_line":"        # incoming dict by adding \u0027id\u0027 to it."},{"line_number":166,"context_line":"        # Deepcopy doesn\u0027t work correctly in this case, because copy of"}],"source_content_type":"text/x-python","patch_set":3,"id":"df3967d1_73fd4139","line":163,"in_reply_to":"df3967d1_e4d052fa","updated":"2017-08-01 04:19:20.000000000","message":"No, I think the create process is ok. Please see L207. It passed the device owner to get subnets, so it met the allocation requirements when specified the device owner and fixed ips. Did I miss something? :)","commit_id":"dc13379a1233d911dd22c2e28366ddad54aced04"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"8cbc5aaed0d9219692073875bf3db75c1ab8499d","unresolved":false,"context_lines":[{"line_number":31,"context_line":"from neutron.db import ipam_backend_mixin"},{"line_number":32,"context_line":"from neutron.db.models import subnet_service_type as sst_model"},{"line_number":33,"context_line":"from neutron.db import models_v2"},{"line_number":34,"context_line":"from neutron.db import _model_query as model_query"},{"line_number":35,"context_line":"from neutron.ipam import driver"},{"line_number":36,"context_line":"from neutron.ipam import exceptions as ipam_exc"},{"line_number":37,"context_line":"from neutron.objects import ports as port_obj"}],"source_content_type":"text/x-python","patch_set":4,"id":"df3967d1_4bd8027e","line":34,"updated":"2017-08-02 19:47:11.000000000","message":"This line has to be moved up right after L29. In the future, you can run pep8 checks locally in your system against your pacthset with the following command:\n\ntox -e pep8 HEAD~1","commit_id":"0a9847a0f502dfd58f2a8ddedfd90e4fcbbcdd4c"}],"neutron/tests/unit/db/test_ipam_pluggable_backend.py":[{"author":{"_account_id":12024,"name":"Tong Liu","email":"tongl@vmware.com","username":"tong101"},"change_message_id":"1c395a9e706a9885248557216a980d3e50b1977d","unresolved":false,"context_lines":[{"line_number":611,"context_line":"                              None,"},{"line_number":612,"context_line":"                              db_port,"},{"line_number":613,"context_line":"                              new_port,"},{"line_number":614,"context_line":"                              None)"},{"line_number":615,"context_line":""},{"line_number":616,"context_line":"    @mock.patch(\u0027neutron.ipam.driver.Pool\u0027)"},{"line_number":617,"context_line":"    def test_delete_port_ipam(self, pool_mock):"}],"source_content_type":"text/x-python","patch_set":1,"id":"df3967d1_a8f47d5c","line":614,"updated":"2017-07-29 17:53:44.000000000","message":"line 609-614 over-indented","commit_id":"bd4a741c4afe17ec30ef86523bd619389af72757"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"95211467c6d431bb3a7034dc97a72813920c3285","unresolved":false,"context_lines":[{"line_number":611,"context_line":"                              None,"},{"line_number":612,"context_line":"                              db_port,"},{"line_number":613,"context_line":"                              new_port,"},{"line_number":614,"context_line":"                              None)"},{"line_number":615,"context_line":""},{"line_number":616,"context_line":"    @mock.patch(\u0027neutron.ipam.driver.Pool\u0027)"},{"line_number":617,"context_line":"    def test_delete_port_ipam(self, pool_mock):"}],"source_content_type":"text/x-python","patch_set":1,"id":"df3967d1_be883271","line":614,"in_reply_to":"df3967d1_a8f47d5c","updated":"2017-07-31 00:57:47.000000000","message":"Thanks for review. :)","commit_id":"bd4a741c4afe17ec30ef86523bd619389af72757"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"61ba0b6e7bc546a586999ad58f778acac75719a7","unresolved":false,"context_lines":[{"line_number":587,"context_line":"                       new_callable\u003dmock.PropertyMock)"},{"line_number":588,"context_line":"    def test_update_port_with_not_exist_service_type(self, pmfixed_ips,"},{"line_number":589,"context_line":"                                                     pool_mock):"},{"line_number":590,"context_line":"        context \u003d mock.MagicMock()"},{"line_number":591,"context_line":"        exist_subnet_serive_type \u003d \u0027compute:nova\u0027"},{"line_number":592,"context_line":"        context.session.query().join().filter().all.return_value \u003d ["},{"line_number":593,"context_line":"            (exist_subnet_serive_type,)]"},{"line_number":594,"context_line":"        mocks \u003d self._prepare_mocks_with_pool_mock(pool_mock)"},{"line_number":595,"context_line":"        mocks[\u0027ipam\u0027] \u003d ipam_pluggable_backend.IpamPluggableBackend()"},{"line_number":596,"context_line":"        new_port \u003d {\u0027device_owner\u0027: \u0027compute:test\u0027}"},{"line_number":597,"context_line":"        db_port \u003d models_v2.Port(id\u003d\u0027id\u0027, network_id\u003d\u0027some-net-id\u0027)"},{"line_number":598,"context_line":""},{"line_number":599,"context_line":"        class test_IpAllocations(object):"},{"line_number":600,"context_line":"            def __init__(self, ip_address\u003dNone, subnet_id\u003dNone):"},{"line_number":601,"context_line":"                self.ip_address \u003d ip_address"},{"line_number":602,"context_line":"                self.subnet_id \u003d subnet_id"},{"line_number":603,"context_line":""},{"line_number":604,"context_line":"        pmfixed_ips.return_value \u003d [test_IpAllocations("},{"line_number":605,"context_line":"            ip_address\u003d\u0027192.168.1.20\u0027, subnet_id\u003d\u0027some-id\u0027)]"},{"line_number":606,"context_line":""},{"line_number":607,"context_line":"        from neutron.ipam import exceptions as ipam_exc"},{"line_number":608,"context_line":"        self.assertRaises(ipam_exc.IpAddressGenerationFailureNoMatchingSubnet,"},{"line_number":609,"context_line":"                          mocks[\u0027ipam\u0027].update_port_with_ips,"},{"line_number":610,"context_line":"                          context,"}],"source_content_type":"text/x-python","patch_set":3,"id":"df3967d1_8404e618","line":607,"range":{"start_line":590,"start_character":0,"end_line":607,"end_character":55},"updated":"2017-07-31 18:59:34.000000000","message":"Why not, like in the other test cases (see L557) create a real port, update it and see if you get the exception?","commit_id":"dc13379a1233d911dd22c2e28366ddad54aced04"},{"author":{"_account_id":4694,"name":"Miguel Lavalle","email":"miguel@mlavalle.com","username":"minsel"},"change_message_id":"54012821a15c836f9919035d493370fa1d13d5a5","unresolved":false,"context_lines":[{"line_number":604,"context_line":"        pmfixed_ips.return_value \u003d [test_IpAllocations("},{"line_number":605,"context_line":"            ip_address\u003d\u0027192.168.1.20\u0027, subnet_id\u003d\u0027some-id\u0027)]"},{"line_number":606,"context_line":""},{"line_number":607,"context_line":"        from neutron.ipam import exceptions as ipam_exc"},{"line_number":608,"context_line":"        self.assertRaises(ipam_exc.IpAddressGenerationFailureNoMatchingSubnet,"},{"line_number":609,"context_line":"                          mocks[\u0027ipam\u0027].update_port_with_ips,"},{"line_number":610,"context_line":"                          context,"}],"source_content_type":"text/x-python","patch_set":3,"id":"df3967d1_3bc1dd55","line":607,"range":{"start_line":607,"start_character":8,"end_line":607,"end_character":55},"updated":"2017-07-31 16:35:33.000000000","message":"You need to move this to the imports section","commit_id":"dc13379a1233d911dd22c2e28366ddad54aced04"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"365837ff23e91c9aa3912e0f51c1336167fbbba8","unresolved":false,"context_lines":[{"line_number":604,"context_line":"        pmfixed_ips.return_value \u003d [test_IpAllocations("},{"line_number":605,"context_line":"            ip_address\u003d\u0027192.168.1.20\u0027, subnet_id\u003d\u0027some-id\u0027)]"},{"line_number":606,"context_line":""},{"line_number":607,"context_line":"        from neutron.ipam import exceptions as ipam_exc"},{"line_number":608,"context_line":"        self.assertRaises(ipam_exc.IpAddressGenerationFailureNoMatchingSubnet,"},{"line_number":609,"context_line":"                          mocks[\u0027ipam\u0027].update_port_with_ips,"},{"line_number":610,"context_line":"                          context,"}],"source_content_type":"text/x-python","patch_set":3,"id":"df3967d1_492baa93","line":607,"range":{"start_line":607,"start_character":8,"end_line":607,"end_character":55},"in_reply_to":"df3967d1_3bc1dd55","updated":"2017-08-01 04:19:20.000000000","message":"OH, it\u0027s my mistake. I forget. Sorry","commit_id":"dc13379a1233d911dd22c2e28366ddad54aced04"},{"author":{"_account_id":12024,"name":"Tong Liu","email":"tongl@vmware.com","username":"tong101"},"change_message_id":"3d61b589c143f62db2d4f7cd68d597c5bc4eecf1","unresolved":false,"context_lines":[{"line_number":604,"context_line":"        pmfixed_ips.return_value \u003d [test_IpAllocations("},{"line_number":605,"context_line":"            ip_address\u003d\u0027192.168.1.20\u0027, subnet_id\u003d\u0027some-id\u0027)]"},{"line_number":606,"context_line":""},{"line_number":607,"context_line":"        from neutron.ipam import exceptions as ipam_exc"},{"line_number":608,"context_line":"        self.assertRaises(ipam_exc.IpAddressGenerationFailureNoMatchingSubnet,"},{"line_number":609,"context_line":"                          mocks[\u0027ipam\u0027].update_port_with_ips,"},{"line_number":610,"context_line":"                          context,"}],"source_content_type":"text/x-python","patch_set":3,"id":"df3967d1_af3d83bc","line":607,"range":{"start_line":607,"start_character":8,"end_line":607,"end_character":55},"in_reply_to":"df3967d1_3bc1dd55","updated":"2017-07-31 18:57:01.000000000","message":"same here, please put all import in beginning.","commit_id":"dc13379a1233d911dd22c2e28366ddad54aced04"},{"author":{"_account_id":15309,"name":"zhaobo","email":"bzhaojyathousandy@gmail.com","username":"ZhaoBo"},"change_message_id":"365837ff23e91c9aa3912e0f51c1336167fbbba8","unresolved":false,"context_lines":[{"line_number":587,"context_line":"                       new_callable\u003dmock.PropertyMock)"},{"line_number":588,"context_line":"    def test_update_port_with_not_exist_service_type(self, pmfixed_ips,"},{"line_number":589,"context_line":"                                                     pool_mock):"},{"line_number":590,"context_line":"        context \u003d mock.MagicMock()"},{"line_number":591,"context_line":"        exist_subnet_serive_type \u003d \u0027compute:nova\u0027"},{"line_number":592,"context_line":"        context.session.query().join().filter().all.return_value \u003d ["},{"line_number":593,"context_line":"            (exist_subnet_serive_type,)]"},{"line_number":594,"context_line":"        mocks \u003d self._prepare_mocks_with_pool_mock(pool_mock)"},{"line_number":595,"context_line":"        mocks[\u0027ipam\u0027] \u003d ipam_pluggable_backend.IpamPluggableBackend()"},{"line_number":596,"context_line":"        new_port \u003d {\u0027device_owner\u0027: \u0027compute:test\u0027}"},{"line_number":597,"context_line":"        db_port \u003d models_v2.Port(id\u003d\u0027id\u0027, network_id\u003d\u0027some-net-id\u0027)"},{"line_number":598,"context_line":""},{"line_number":599,"context_line":"        class test_IpAllocations(object):"},{"line_number":600,"context_line":"            def __init__(self, ip_address\u003dNone, subnet_id\u003dNone):"},{"line_number":601,"context_line":"                self.ip_address \u003d ip_address"},{"line_number":602,"context_line":"                self.subnet_id \u003d subnet_id"},{"line_number":603,"context_line":""},{"line_number":604,"context_line":"        pmfixed_ips.return_value \u003d [test_IpAllocations("},{"line_number":605,"context_line":"            ip_address\u003d\u0027192.168.1.20\u0027, subnet_id\u003d\u0027some-id\u0027)]"},{"line_number":606,"context_line":""},{"line_number":607,"context_line":"        from neutron.ipam import exceptions as ipam_exc"},{"line_number":608,"context_line":"        self.assertRaises(ipam_exc.IpAddressGenerationFailureNoMatchingSubnet,"},{"line_number":609,"context_line":"                          mocks[\u0027ipam\u0027].update_port_with_ips,"},{"line_number":610,"context_line":"                          context,"}],"source_content_type":"text/x-python","patch_set":3,"id":"df3967d1_e9bffdf8","line":607,"range":{"start_line":590,"start_character":0,"end_line":607,"end_character":55},"in_reply_to":"df3967d1_8404e618","updated":"2017-08-01 04:19:20.000000000","message":"I tried before. Because intro the validate function which combined with query and some operations. And if I want to make the logic process Ok , I should mock many things to do that, So I reuse the func self._prepare_mocks_with_pool_mock(pool_mock). Also, I need the subnet with device owner, but the self.subnet() from test_db_base_plugin_v2.py don\u0027t use the \"service_types\" parameter. So..","commit_id":"dc13379a1233d911dd22c2e28366ddad54aced04"}]}
