Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 1 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 2 | # not use this file except in compliance with the License. You may obtain |
| 3 | # a copy of the License at |
| 4 | # |
| 5 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | # |
| 7 | # Unless required by applicable law or agreed to in writing, software |
| 8 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 9 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 10 | # License for the specific language governing permissions and limitations |
| 11 | # under the License. |
| 12 | |
Kevin Benton | a2ceb2d | 2016-09-22 17:52:25 -0700 | [diff] [blame] | 13 | import netaddr |
| 14 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 15 | from tempest.lib import decorators |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 16 | from tempest import test |
| 17 | |
| 18 | from neutron.tests.tempest.api import base |
| 19 | from neutron.tests.tempest.api import base_security_groups as bsg |
| 20 | from neutron.tests.tempest import config |
| 21 | |
| 22 | |
| 23 | class TestRevisions(base.BaseAdminNetworkTest, bsg.BaseSecGroupTest): |
| 24 | |
| 25 | @classmethod |
Kevin Benton | b944fcb | 2016-09-02 00:26:42 -0600 | [diff] [blame] | 26 | @test.requires_ext(extension="standard-attr-revisions", service="network") |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 27 | def skip_checks(cls): |
| 28 | super(TestRevisions, cls).skip_checks() |
| 29 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 30 | @decorators.idempotent_id('4a26a4be-9c53-483c-bc50-b53f1db10ac6') |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 31 | def test_update_network_bumps_revision(self): |
| 32 | net = self.create_network() |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 33 | self.addCleanup(self.client.delete_network, net['id']) |
Kevin Benton | 2f06790 | 2016-09-02 17:14:37 -0700 | [diff] [blame] | 34 | self.assertIn('revision_number', net) |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 35 | updated = self.client.update_network(net['id'], name='newnet') |
Kevin Benton | 2f06790 | 2016-09-02 17:14:37 -0700 | [diff] [blame] | 36 | self.assertGreater(updated['network']['revision_number'], |
| 37 | net['revision_number']) |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 38 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 39 | @decorators.idempotent_id('cac7ecde-12d5-4331-9a03-420899dea077') |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 40 | def test_update_port_bumps_revision(self): |
| 41 | net = self.create_network() |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 42 | self.addCleanup(self.client.delete_network, net['id']) |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 43 | port = self.create_port(net) |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 44 | self.addCleanup(self.client.delete_port, port['id']) |
Kevin Benton | 2f06790 | 2016-09-02 17:14:37 -0700 | [diff] [blame] | 45 | self.assertIn('revision_number', port) |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 46 | updated = self.client.update_port(port['id'], name='newport') |
Kevin Benton | 2f06790 | 2016-09-02 17:14:37 -0700 | [diff] [blame] | 47 | self.assertGreater(updated['port']['revision_number'], |
| 48 | port['revision_number']) |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 49 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 50 | @decorators.idempotent_id('c1c4fa41-8e89-44d0-9bfc-409f3b66dc57') |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 51 | def test_update_subnet_bumps_revision(self): |
| 52 | net = self.create_network() |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 53 | self.addCleanup(self.client.delete_network, net['id']) |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 54 | subnet = self.create_subnet(net) |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 55 | self.addCleanup(self.client.delete_subnet, subnet['id']) |
Kevin Benton | 2f06790 | 2016-09-02 17:14:37 -0700 | [diff] [blame] | 56 | self.assertIn('revision_number', subnet) |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 57 | updated = self.client.update_subnet(subnet['id'], name='newsub') |
Kevin Benton | 2f06790 | 2016-09-02 17:14:37 -0700 | [diff] [blame] | 58 | self.assertGreater(updated['subnet']['revision_number'], |
| 59 | subnet['revision_number']) |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 60 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 61 | @decorators.idempotent_id('e8c5d7db-2b8d-4615-a476-6e537437c4f2') |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 62 | def test_update_subnetpool_bumps_revision(self): |
| 63 | sp = self.create_subnetpool('subnetpool', default_prefixlen=24, |
| 64 | prefixes=['10.0.0.0/8']) |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 65 | self.addCleanup(self.client.delete_subnetpool, sp['id']) |
Kevin Benton | 2f06790 | 2016-09-02 17:14:37 -0700 | [diff] [blame] | 66 | self.assertIn('revision_number', sp) |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 67 | updated = self.admin_client.update_subnetpool(sp['id'], name='sp2') |
Kevin Benton | 2f06790 | 2016-09-02 17:14:37 -0700 | [diff] [blame] | 68 | self.assertGreater(updated['subnetpool']['revision_number'], |
| 69 | sp['revision_number']) |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 70 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 71 | @decorators.idempotent_id('e8c5d7db-2b8d-4567-a326-6e123437c4d1') |
Nam Nguyen Hoai | 2984b6d | 2016-08-05 09:46:43 +0700 | [diff] [blame] | 72 | def test_update_subnet_bumps_network_revision(self): |
| 73 | net = self.create_network() |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 74 | self.addCleanup(self.client.delete_network, net['id']) |
Nam Nguyen Hoai | 2984b6d | 2016-08-05 09:46:43 +0700 | [diff] [blame] | 75 | subnet = self.create_subnet(net) |
| 76 | updated = self.client.show_network(net['id']) |
Kevin Benton | 2f06790 | 2016-09-02 17:14:37 -0700 | [diff] [blame] | 77 | self.assertGreater(updated['network']['revision_number'], |
| 78 | net['revision_number']) |
Nam Nguyen Hoai | 2984b6d | 2016-08-05 09:46:43 +0700 | [diff] [blame] | 79 | self.client.delete_subnet(subnet['id']) |
| 80 | updated2 = self.client.show_network(net['id']) |
Kevin Benton | 2f06790 | 2016-09-02 17:14:37 -0700 | [diff] [blame] | 81 | self.assertGreater(updated2['network']['revision_number'], |
| 82 | updated['network']['revision_number']) |
Nam Nguyen Hoai | 2984b6d | 2016-08-05 09:46:43 +0700 | [diff] [blame] | 83 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 84 | @decorators.idempotent_id('6c256f71-c929-4200-b3dc-4e1843506be5') |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 85 | @test.requires_ext(extension="security-group", service="network") |
| 86 | def test_update_sg_group_bumps_revision(self): |
| 87 | sg, name = self._create_security_group() |
Kevin Benton | 2f06790 | 2016-09-02 17:14:37 -0700 | [diff] [blame] | 88 | self.assertIn('revision_number', sg['security_group']) |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 89 | update_body = self.client.update_security_group( |
| 90 | sg['security_group']['id'], name='new_sg_name') |
Kevin Benton | 2f06790 | 2016-09-02 17:14:37 -0700 | [diff] [blame] | 91 | self.assertGreater(update_body['security_group']['revision_number'], |
| 92 | sg['security_group']['revision_number']) |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 93 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 94 | @decorators.idempotent_id('6489632f-8550-4453-a674-c98849742967') |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 95 | @test.requires_ext(extension="security-group", service="network") |
| 96 | def test_update_port_sg_binding_bumps_revision(self): |
| 97 | net = self.create_network() |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 98 | self.addCleanup(self.client.delete_network, net['id']) |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 99 | port = self.create_port(net) |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 100 | self.addCleanup(self.client.delete_port, port['id']) |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 101 | sg = self._create_security_group()[0] |
| 102 | self.client.update_port( |
| 103 | port['id'], security_groups=[sg['security_group']['id']]) |
| 104 | updated = self.client.show_port(port['id']) |
Kevin Benton | a2bd97b | 2016-09-19 20:05:25 -0700 | [diff] [blame] | 105 | updated2 = self.client.update_port(port['id'], security_groups=[]) |
Kevin Benton | 2f06790 | 2016-09-02 17:14:37 -0700 | [diff] [blame] | 106 | self.assertGreater(updated['port']['revision_number'], |
| 107 | port['revision_number']) |
| 108 | self.assertGreater(updated2['port']['revision_number'], |
| 109 | updated['port']['revision_number']) |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 110 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 111 | @decorators.idempotent_id('29c7ab2b-d1d8-425d-8cec-fcf632960f22') |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 112 | @test.requires_ext(extension="security-group", service="network") |
| 113 | def test_update_sg_rule_bumps_sg_revision(self): |
| 114 | sg, name = self._create_security_group() |
| 115 | rule = self.client.create_security_group_rule( |
| 116 | security_group_id=sg['security_group']['id'], |
| 117 | protocol='tcp', direction='ingress', ethertype=self.ethertype, |
| 118 | port_range_min=60, port_range_max=70) |
| 119 | updated = self.client.show_security_group(sg['security_group']['id']) |
Kevin Benton | 2f06790 | 2016-09-02 17:14:37 -0700 | [diff] [blame] | 120 | self.assertGreater(updated['security_group']['revision_number'], |
| 121 | sg['security_group']['revision_number']) |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 122 | self.client.delete_security_group_rule( |
| 123 | rule['security_group_rule']['id']) |
| 124 | updated2 = self.client.show_security_group(sg['security_group']['id']) |
Kevin Benton | 2f06790 | 2016-09-02 17:14:37 -0700 | [diff] [blame] | 125 | self.assertGreater(updated2['security_group']['revision_number'], |
| 126 | updated['security_group']['revision_number']) |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 127 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 128 | @decorators.idempotent_id('db70c285-0365-4fac-9f55-2a0ad8cf55a8') |
Kevin Benton | a2ceb2d | 2016-09-22 17:52:25 -0700 | [diff] [blame] | 129 | @test.requires_ext(extension="allowed-address-pairs", service="network") |
| 130 | def test_update_allowed_address_pairs_bumps_revision(self): |
| 131 | net = self.create_network() |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 132 | self.addCleanup(self.client.delete_network, net['id']) |
Kevin Benton | a2ceb2d | 2016-09-22 17:52:25 -0700 | [diff] [blame] | 133 | port = self.create_port(net) |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 134 | self.addCleanup(self.client.delete_port, port['id']) |
Kevin Benton | a2ceb2d | 2016-09-22 17:52:25 -0700 | [diff] [blame] | 135 | updated = self.client.update_port( |
| 136 | port['id'], allowed_address_pairs=[{'ip_address': '1.1.1.1/32'}]) |
| 137 | self.assertGreater(updated['port']['revision_number'], |
| 138 | port['revision_number']) |
| 139 | updated2 = self.client.update_port( |
| 140 | port['id'], allowed_address_pairs=[]) |
| 141 | self.assertGreater(updated2['port']['revision_number'], |
| 142 | updated['port']['revision_number']) |
| 143 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 144 | @decorators.idempotent_id('a21ec3b4-3569-4b77-bf29-4177edaa2df5') |
Kevin Benton | a2ceb2d | 2016-09-22 17:52:25 -0700 | [diff] [blame] | 145 | @test.requires_ext(extension="extra_dhcp_opt", service="network") |
| 146 | def test_update_extra_dhcp_opt_bumps_revision(self): |
| 147 | net = self.create_network() |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 148 | self.addCleanup(self.client.delete_network, net['id']) |
Kevin Benton | a2ceb2d | 2016-09-22 17:52:25 -0700 | [diff] [blame] | 149 | port = self.create_port(net) |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 150 | self.addCleanup(self.client.delete_port, port['id']) |
Kevin Benton | a2ceb2d | 2016-09-22 17:52:25 -0700 | [diff] [blame] | 151 | opts = [{'opt_value': 'pxelinux.0', 'opt_name': 'bootfile-name'}] |
| 152 | updated = self.client.update_port(port['id'], extra_dhcp_opts=opts) |
| 153 | self.assertGreater(updated['port']['revision_number'], |
| 154 | port['revision_number']) |
| 155 | opts[0]['opt_value'] = 'pxelinux.77' |
| 156 | updated2 = self.client.update_port( |
| 157 | port['id'], extra_dhcp_opts=opts) |
| 158 | self.assertGreater(updated2['port']['revision_number'], |
| 159 | updated['port']['revision_number']) |
| 160 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 161 | @decorators.idempotent_id('40ba648f-f374-4c29-a5b7-489dd5a38a4e') |
Kevin Benton | a2ceb2d | 2016-09-22 17:52:25 -0700 | [diff] [blame] | 162 | @test.requires_ext(extension="dns-integration", service="network") |
| 163 | def test_update_dns_domain_bumps_revision(self): |
| 164 | net = self.create_network(dns_domain='example.test.') |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 165 | self.addCleanup(self.client.delete_network, net['id']) |
Kevin Benton | f46e7a2 | 2016-09-24 23:07:45 -0700 | [diff] [blame] | 166 | updated = self.client.update_network(net['id'], dns_domain='exa.test.') |
Kevin Benton | a2ceb2d | 2016-09-22 17:52:25 -0700 | [diff] [blame] | 167 | self.assertGreater(updated['network']['revision_number'], |
| 168 | net['revision_number']) |
| 169 | port = self.create_port(net) |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 170 | self.addCleanup(self.client.delete_port, port['id']) |
Kevin Benton | a2ceb2d | 2016-09-22 17:52:25 -0700 | [diff] [blame] | 171 | updated = self.client.update_port(port['id'], dns_name='port1') |
| 172 | if not updated['port']['dns_name']: |
| 173 | self.skipTest("Server does not have DNS domain configured.") |
| 174 | self.assertGreater(updated['port']['revision_number'], |
| 175 | port['revision_number']) |
| 176 | updated2 = self.client.update_port(port['id'], dns_name='') |
| 177 | self.assertGreater(updated2['port']['revision_number'], |
| 178 | updated['port']['revision_number']) |
| 179 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 180 | @decorators.idempotent_id('8482324f-cf59-4d73-b98e-d37119255300') |
Kevin Benton | a2ceb2d | 2016-09-22 17:52:25 -0700 | [diff] [blame] | 181 | @test.requires_ext(extension="router", service="network") |
| 182 | @test.requires_ext(extension="extraroute", service="network") |
| 183 | def test_update_router_extra_routes_bumps_revision(self): |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 184 | net = self.create_network() |
| 185 | self.addCleanup(self.client.delete_network, net['id']) |
| 186 | subnet = self.create_subnet(net) |
| 187 | self.addCleanup(self.client.delete_subnet, subnet['id']) |
Kevin Benton | a2ceb2d | 2016-09-22 17:52:25 -0700 | [diff] [blame] | 188 | subgateway = netaddr.IPAddress(subnet['gateway_ip']) |
| 189 | router = self.create_router(router_name='test') |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 190 | self.addCleanup(self.client.delete_router, router['id']) |
Kevin Benton | a2ceb2d | 2016-09-22 17:52:25 -0700 | [diff] [blame] | 191 | self.create_router_interface(router['id'], subnet['id']) |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 192 | self.addCleanup( |
| 193 | self.client.remove_router_interface_with_subnet_id, |
| 194 | router['id'], |
| 195 | subnet['id']) |
Kevin Benton | a2ceb2d | 2016-09-22 17:52:25 -0700 | [diff] [blame] | 196 | router = self.client.show_router(router['id'])['router'] |
Omer Anson | d158683 | 2016-10-10 22:46:32 +0300 | [diff] [blame] | 197 | updated = self.client.update_extra_routes( |
| 198 | router['id'], str(subgateway + 1), '2.0.0.0/24') |
Kevin Benton | a2ceb2d | 2016-09-22 17:52:25 -0700 | [diff] [blame] | 199 | self.assertGreater(updated['router']['revision_number'], |
| 200 | router['revision_number']) |
Omer Anson | d158683 | 2016-10-10 22:46:32 +0300 | [diff] [blame] | 201 | updated2 = self.client.delete_extra_routes(router['id']) |
Kevin Benton | a2ceb2d | 2016-09-22 17:52:25 -0700 | [diff] [blame] | 202 | self.assertGreater(updated2['router']['revision_number'], |
| 203 | updated['router']['revision_number']) |
| 204 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 205 | @decorators.idempotent_id('6bd18702-e25a-4b4b-8c0c-680113533511') |
Kevin Benton | a2ceb2d | 2016-09-22 17:52:25 -0700 | [diff] [blame] | 206 | @test.requires_ext(extension="subnet-service-types", service="network") |
| 207 | def test_update_subnet_service_types_bumps_revisions(self): |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 208 | net = self.create_network() |
| 209 | self.addCleanup(self.client.delete_network, net['id']) |
| 210 | subnet = self.create_subnet(net) |
| 211 | self.addCleanup(self.client.delete_subnet, subnet['id']) |
Kevin Benton | a2ceb2d | 2016-09-22 17:52:25 -0700 | [diff] [blame] | 212 | updated = self.client.update_subnet( |
| 213 | subnet['id'], service_types=['compute:']) |
| 214 | self.assertGreater(updated['subnet']['revision_number'], |
| 215 | subnet['revision_number']) |
| 216 | updated2 = self.client.update_subnet( |
| 217 | subnet['id'], service_types=[]) |
| 218 | self.assertGreater(updated2['subnet']['revision_number'], |
| 219 | updated['subnet']['revision_number']) |
| 220 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 221 | @decorators.idempotent_id('9c83105c-9973-45ff-9ca2-e66d64700abe') |
Kevin Benton | a2ceb2d | 2016-09-22 17:52:25 -0700 | [diff] [blame] | 222 | @test.requires_ext(extension="port-security", service="network") |
| 223 | def test_update_port_security_bumps_revisions(self): |
| 224 | net = self.create_network(port_security_enabled=False) |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 225 | self.addCleanup(self.client.delete_network, net['id']) |
Kevin Benton | f46e7a2 | 2016-09-24 23:07:45 -0700 | [diff] [blame] | 226 | updated = self.client.update_network(net['id'], |
| 227 | port_security_enabled=True) |
Kevin Benton | a2ceb2d | 2016-09-22 17:52:25 -0700 | [diff] [blame] | 228 | self.assertGreater(updated['network']['revision_number'], |
| 229 | net['revision_number']) |
Kevin Benton | f46e7a2 | 2016-09-24 23:07:45 -0700 | [diff] [blame] | 230 | updated2 = self.client.update_network(net['id'], |
| 231 | port_security_enabled=False) |
Kevin Benton | a2ceb2d | 2016-09-22 17:52:25 -0700 | [diff] [blame] | 232 | self.assertGreater(updated2['network']['revision_number'], |
| 233 | updated['network']['revision_number']) |
| 234 | port = self.create_port(net, port_security_enabled=False) |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 235 | self.addCleanup(self.client.delete_port, port['id']) |
Kevin Benton | a2ceb2d | 2016-09-22 17:52:25 -0700 | [diff] [blame] | 236 | updated = self.client.update_port(port['id'], |
| 237 | port_security_enabled=True) |
| 238 | self.assertGreater(updated['port']['revision_number'], |
| 239 | port['revision_number']) |
| 240 | updated2 = self.client.update_port(port['id'], |
| 241 | port_security_enabled=False) |
| 242 | self.assertGreater(updated2['port']['revision_number'], |
| 243 | updated['port']['revision_number']) |
| 244 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 245 | @decorators.idempotent_id('68d5ac3a-11a1-4847-8e2e-5843c043d89b') |
Kevin Benton | a2ceb2d | 2016-09-22 17:52:25 -0700 | [diff] [blame] | 246 | @test.requires_ext(extension="binding", service="network") |
| 247 | def test_portbinding_bumps_revision(self): |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 248 | net = self.create_network() |
| 249 | self.addCleanup(self.client.delete_network, net['id']) |
| 250 | port = self.create_port(net) |
| 251 | self.addCleanup(self.client.delete_port, port['id']) |
Kevin Benton | a2ceb2d | 2016-09-22 17:52:25 -0700 | [diff] [blame] | 252 | port = self.admin_client.update_port( |
| 253 | port['id'], **{'binding:host_id': 'badhost1'})['port'] |
| 254 | updated = self.admin_client.update_port( |
| 255 | port['id'], **{'binding:host_id': 'badhost2'})['port'] |
| 256 | self.assertGreater(updated['revision_number'], |
| 257 | port['revision_number']) |
| 258 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 259 | @decorators.idempotent_id('4a37bde9-1975-47e0-9b8c-2c9ca36415b0') |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 260 | @test.requires_ext(extension="router", service="network") |
| 261 | def test_update_router_bumps_revision(self): |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 262 | net = self.create_network() |
| 263 | self.addCleanup(self.client.delete_network, net['id']) |
| 264 | subnet = self.create_subnet(net) |
| 265 | self.addCleanup(self.client.delete_subnet, subnet['id']) |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 266 | router = self.create_router(router_name='test') |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 267 | self.addCleanup(self.client.delete_router, router['id']) |
Kevin Benton | 2f06790 | 2016-09-02 17:14:37 -0700 | [diff] [blame] | 268 | self.assertIn('revision_number', router) |
| 269 | rev1 = router['revision_number'] |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 270 | router = self.client.update_router(router['id'], |
| 271 | name='test2')['router'] |
Kevin Benton | 2f06790 | 2016-09-02 17:14:37 -0700 | [diff] [blame] | 272 | self.assertGreater(router['revision_number'], rev1) |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 273 | self.create_router_interface(router['id'], subnet['id']) |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 274 | self.addCleanup( |
| 275 | self.client.remove_router_interface_with_subnet_id, |
| 276 | router['id'], |
| 277 | subnet['id']) |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 278 | updated = self.client.show_router(router['id'])['router'] |
Kevin Benton | 2f06790 | 2016-09-02 17:14:37 -0700 | [diff] [blame] | 279 | self.assertGreater(updated['revision_number'], |
| 280 | router['revision_number']) |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 281 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 282 | @decorators.idempotent_id('9de71ebc-f5df-4cd0-80bc-60299fce3ce9') |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 283 | @test.requires_ext(extension="router", service="network") |
| 284 | @test.requires_ext(extension="standard-attr-description", |
| 285 | service="network") |
| 286 | def test_update_floatingip_bumps_revision(self): |
| 287 | ext_id = config.CONF.network.public_network_id |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 288 | net = self.create_network() |
| 289 | self.addCleanup(self.client.delete_network, net['id']) |
| 290 | subnet = self.create_subnet(net) |
| 291 | self.addCleanup(self.client.delete_subnet, subnet['id']) |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 292 | router = self.create_router('test', external_network_id=ext_id) |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 293 | self.addCleanup(self.client.delete_router, router['id']) |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 294 | self.create_router_interface(router['id'], subnet['id']) |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 295 | self.addCleanup( |
| 296 | self.client.remove_router_interface_with_subnet_id, |
| 297 | router['id'], |
| 298 | subnet['id']) |
| 299 | port = self.create_port(net) |
| 300 | self.addCleanup(self.client.delete_port, port['id']) |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 301 | body = self.client.create_floatingip( |
| 302 | floating_network_id=ext_id, |
| 303 | port_id=port['id'], |
| 304 | description='d1' |
| 305 | )['floatingip'] |
Itzik Brown | a3926d9 | 2017-02-12 02:49:29 +0200 | [diff] [blame] | 306 | self.floating_ips.append(body) |
Kevin Benton | 2f06790 | 2016-09-02 17:14:37 -0700 | [diff] [blame] | 307 | self.assertIn('revision_number', body) |
Kevin Benton | 183b7be | 2016-03-24 22:14:58 -0700 | [diff] [blame] | 308 | b2 = self.client.update_floatingip(body['id'], description='d2') |
Kevin Benton | 2f06790 | 2016-09-02 17:14:37 -0700 | [diff] [blame] | 309 | self.assertGreater(b2['floatingip']['revision_number'], |
| 310 | body['revision_number']) |
LIU Yulong | 39e5f10 | 2016-05-05 14:52:26 +0800 | [diff] [blame] | 311 | # disassociate |
| 312 | self.client.update_floatingip(b2['floatingip']['id'], port_id=None) |
Lujin | ba9a492 | 2016-11-21 18:19:04 +0900 | [diff] [blame] | 313 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 314 | @decorators.idempotent_id('afb6486c-41b5-483e-a500-3c506f4deb49') |
Lujin | ba9a492 | 2016-11-21 18:19:04 +0900 | [diff] [blame] | 315 | @test.requires_ext(extension="router", service="network") |
| 316 | @test.requires_ext(extension="dvr", service="network") |
| 317 | def test_update_router_extra_attributes_bumps_revision(self): |
| 318 | router = self.create_router(router_name='r1') |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 319 | self.addCleanup(self.client.delete_router, router['id']) |
Lujin | ba9a492 | 2016-11-21 18:19:04 +0900 | [diff] [blame] | 320 | self.assertIn('revision_number', router) |
| 321 | rev1 = router['revision_number'] |
| 322 | router = self.admin_client.update_router( |
| 323 | router['id'], admin_state_up=False)['router'] |
| 324 | self.assertGreater(router['revision_number'], rev1) |
| 325 | self.admin_client.update_router(router['id'], |
| 326 | distributed=True)['router'] |
| 327 | updated = self.client.show_router(router['id'])['router'] |
| 328 | self.assertGreater(updated['revision_number'], |
| 329 | router['revision_number']) |
| 330 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 331 | @decorators.idempotent_id('90743b00-b0e2-40e4-9524-1c884fe3ef23') |
Kevin Benton | 3e30597 | 2016-12-28 02:05:29 -0800 | [diff] [blame] | 332 | @test.requires_ext(extension="external-net", service="network") |
Lujin | ba9a492 | 2016-11-21 18:19:04 +0900 | [diff] [blame] | 333 | @test.requires_ext(extension="auto-allocated-topology", service="network") |
| 334 | @test.requires_ext(extension="subnet_allocation", service="network") |
| 335 | @test.requires_ext(extension="router", service="network") |
| 336 | def test_update_external_network_bumps_revision(self): |
| 337 | net = self.create_network() |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 338 | self.addCleanup(self.client.delete_network, net['id']) |
Lujin | ba9a492 | 2016-11-21 18:19:04 +0900 | [diff] [blame] | 339 | self.assertIn('revision_number', net) |
| 340 | updated = self.admin_client.update_network(net['id'], |
| 341 | **{'router:external': True}) |
| 342 | self.assertGreater(updated['network']['revision_number'], |
| 343 | net['revision_number']) |
| 344 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 345 | @decorators.idempotent_id('5af6450a-0f61-49c3-b628-38db77c7b856') |
Lujin | ba9a492 | 2016-11-21 18:19:04 +0900 | [diff] [blame] | 346 | @test.requires_ext(extension="qos", service="network") |
| 347 | def test_update_qos_port_policy_binding_bumps_revision(self): |
| 348 | policy = self.create_qos_policy(name='port-policy', shared=False) |
Prateek Arora | ebc2514 | 2017-03-27 11:30:47 -0400 | [diff] [blame^] | 349 | net = self.create_network() |
| 350 | self.addCleanup(self.client.delete_network, net['id']) |
| 351 | port = self.create_port(net) |
Lujin | ba9a492 | 2016-11-21 18:19:04 +0900 | [diff] [blame] | 352 | self.addCleanup(self.client.delete_port, port['id']) |
| 353 | updated = self.admin_client.update_port( |
| 354 | port['id'], qos_policy_id=policy['id']) |
| 355 | self.assertGreater(updated['port']['revision_number'], |
| 356 | port['revision_number']) |
| 357 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 358 | @decorators.idempotent_id('817da343-c6e4-445c-9519-a621f124dfbe') |
Lujin | ba9a492 | 2016-11-21 18:19:04 +0900 | [diff] [blame] | 359 | @test.requires_ext(extension="qos", service="network") |
| 360 | def test_update_qos_network_policy_binding_bumps_revision(self): |
| 361 | policy = self.create_qos_policy(name='network-policy', shared=False) |
| 362 | network = self.create_network() |
| 363 | self.addCleanup(self.client.delete_network, network['id']) |
| 364 | updated = self.admin_client.update_network( |
| 365 | network['id'], qos_policy_id=policy['id']) |
| 366 | self.assertGreater(updated['network']['revision_number'], |
| 367 | network['revision_number']) |