blob: 3db39c65da7003b8519c2f49a26bfe1e0c3da5c6 [file] [log] [blame]
Kevin Benton183b7be2016-03-24 22:14:58 -07001# 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 Bentona2ceb2d2016-09-22 17:52:25 -070013import netaddr
14
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +000015from tempest.lib import decorators
Kevin Benton183b7be2016-03-24 22:14:58 -070016from tempest import test
17
18from neutron.tests.tempest.api import base
19from neutron.tests.tempest.api import base_security_groups as bsg
20from neutron.tests.tempest import config
21
22
23class TestRevisions(base.BaseAdminNetworkTest, bsg.BaseSecGroupTest):
24
25 @classmethod
Kevin Bentonb944fcb2016-09-02 00:26:42 -060026 @test.requires_ext(extension="standard-attr-revisions", service="network")
Kevin Benton183b7be2016-03-24 22:14:58 -070027 def skip_checks(cls):
28 super(TestRevisions, cls).skip_checks()
29
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +000030 @decorators.idempotent_id('4a26a4be-9c53-483c-bc50-b53f1db10ac6')
Kevin Benton183b7be2016-03-24 22:14:58 -070031 def test_update_network_bumps_revision(self):
32 net = self.create_network()
Prateek Aroraebc25142017-03-27 11:30:47 -040033 self.addCleanup(self.client.delete_network, net['id'])
Kevin Benton2f067902016-09-02 17:14:37 -070034 self.assertIn('revision_number', net)
Kevin Benton183b7be2016-03-24 22:14:58 -070035 updated = self.client.update_network(net['id'], name='newnet')
Kevin Benton2f067902016-09-02 17:14:37 -070036 self.assertGreater(updated['network']['revision_number'],
37 net['revision_number'])
Kevin Benton183b7be2016-03-24 22:14:58 -070038
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +000039 @decorators.idempotent_id('cac7ecde-12d5-4331-9a03-420899dea077')
Kevin Benton183b7be2016-03-24 22:14:58 -070040 def test_update_port_bumps_revision(self):
41 net = self.create_network()
Prateek Aroraebc25142017-03-27 11:30:47 -040042 self.addCleanup(self.client.delete_network, net['id'])
Kevin Benton183b7be2016-03-24 22:14:58 -070043 port = self.create_port(net)
Prateek Aroraebc25142017-03-27 11:30:47 -040044 self.addCleanup(self.client.delete_port, port['id'])
Kevin Benton2f067902016-09-02 17:14:37 -070045 self.assertIn('revision_number', port)
Kevin Benton183b7be2016-03-24 22:14:58 -070046 updated = self.client.update_port(port['id'], name='newport')
Kevin Benton2f067902016-09-02 17:14:37 -070047 self.assertGreater(updated['port']['revision_number'],
48 port['revision_number'])
Kevin Benton183b7be2016-03-24 22:14:58 -070049
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +000050 @decorators.idempotent_id('c1c4fa41-8e89-44d0-9bfc-409f3b66dc57')
Kevin Benton183b7be2016-03-24 22:14:58 -070051 def test_update_subnet_bumps_revision(self):
52 net = self.create_network()
Prateek Aroraebc25142017-03-27 11:30:47 -040053 self.addCleanup(self.client.delete_network, net['id'])
Kevin Benton183b7be2016-03-24 22:14:58 -070054 subnet = self.create_subnet(net)
Prateek Aroraebc25142017-03-27 11:30:47 -040055 self.addCleanup(self.client.delete_subnet, subnet['id'])
Kevin Benton2f067902016-09-02 17:14:37 -070056 self.assertIn('revision_number', subnet)
Kevin Benton183b7be2016-03-24 22:14:58 -070057 updated = self.client.update_subnet(subnet['id'], name='newsub')
Kevin Benton2f067902016-09-02 17:14:37 -070058 self.assertGreater(updated['subnet']['revision_number'],
59 subnet['revision_number'])
Kevin Benton183b7be2016-03-24 22:14:58 -070060
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +000061 @decorators.idempotent_id('e8c5d7db-2b8d-4615-a476-6e537437c4f2')
Kevin Benton183b7be2016-03-24 22:14:58 -070062 def test_update_subnetpool_bumps_revision(self):
63 sp = self.create_subnetpool('subnetpool', default_prefixlen=24,
64 prefixes=['10.0.0.0/8'])
Prateek Aroraebc25142017-03-27 11:30:47 -040065 self.addCleanup(self.client.delete_subnetpool, sp['id'])
Kevin Benton2f067902016-09-02 17:14:37 -070066 self.assertIn('revision_number', sp)
Kevin Benton183b7be2016-03-24 22:14:58 -070067 updated = self.admin_client.update_subnetpool(sp['id'], name='sp2')
Kevin Benton2f067902016-09-02 17:14:37 -070068 self.assertGreater(updated['subnetpool']['revision_number'],
69 sp['revision_number'])
Kevin Benton183b7be2016-03-24 22:14:58 -070070
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +000071 @decorators.idempotent_id('e8c5d7db-2b8d-4567-a326-6e123437c4d1')
Nam Nguyen Hoai2984b6d2016-08-05 09:46:43 +070072 def test_update_subnet_bumps_network_revision(self):
73 net = self.create_network()
Prateek Aroraebc25142017-03-27 11:30:47 -040074 self.addCleanup(self.client.delete_network, net['id'])
Nam Nguyen Hoai2984b6d2016-08-05 09:46:43 +070075 subnet = self.create_subnet(net)
76 updated = self.client.show_network(net['id'])
Kevin Benton2f067902016-09-02 17:14:37 -070077 self.assertGreater(updated['network']['revision_number'],
78 net['revision_number'])
Nam Nguyen Hoai2984b6d2016-08-05 09:46:43 +070079 self.client.delete_subnet(subnet['id'])
80 updated2 = self.client.show_network(net['id'])
Kevin Benton2f067902016-09-02 17:14:37 -070081 self.assertGreater(updated2['network']['revision_number'],
82 updated['network']['revision_number'])
Nam Nguyen Hoai2984b6d2016-08-05 09:46:43 +070083
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +000084 @decorators.idempotent_id('6c256f71-c929-4200-b3dc-4e1843506be5')
Kevin Benton183b7be2016-03-24 22:14:58 -070085 @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 Benton2f067902016-09-02 17:14:37 -070088 self.assertIn('revision_number', sg['security_group'])
Kevin Benton183b7be2016-03-24 22:14:58 -070089 update_body = self.client.update_security_group(
90 sg['security_group']['id'], name='new_sg_name')
Kevin Benton2f067902016-09-02 17:14:37 -070091 self.assertGreater(update_body['security_group']['revision_number'],
92 sg['security_group']['revision_number'])
Kevin Benton183b7be2016-03-24 22:14:58 -070093
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +000094 @decorators.idempotent_id('6489632f-8550-4453-a674-c98849742967')
Kevin Benton183b7be2016-03-24 22:14:58 -070095 @test.requires_ext(extension="security-group", service="network")
96 def test_update_port_sg_binding_bumps_revision(self):
97 net = self.create_network()
Prateek Aroraebc25142017-03-27 11:30:47 -040098 self.addCleanup(self.client.delete_network, net['id'])
Kevin Benton183b7be2016-03-24 22:14:58 -070099 port = self.create_port(net)
Prateek Aroraebc25142017-03-27 11:30:47 -0400100 self.addCleanup(self.client.delete_port, port['id'])
Kevin Benton183b7be2016-03-24 22:14:58 -0700101 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 Bentona2bd97b2016-09-19 20:05:25 -0700105 updated2 = self.client.update_port(port['id'], security_groups=[])
Kevin Benton2f067902016-09-02 17:14:37 -0700106 self.assertGreater(updated['port']['revision_number'],
107 port['revision_number'])
108 self.assertGreater(updated2['port']['revision_number'],
109 updated['port']['revision_number'])
Kevin Benton183b7be2016-03-24 22:14:58 -0700110
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000111 @decorators.idempotent_id('29c7ab2b-d1d8-425d-8cec-fcf632960f22')
Kevin Benton183b7be2016-03-24 22:14:58 -0700112 @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 Benton2f067902016-09-02 17:14:37 -0700120 self.assertGreater(updated['security_group']['revision_number'],
121 sg['security_group']['revision_number'])
Kevin Benton183b7be2016-03-24 22:14:58 -0700122 self.client.delete_security_group_rule(
123 rule['security_group_rule']['id'])
124 updated2 = self.client.show_security_group(sg['security_group']['id'])
Kevin Benton2f067902016-09-02 17:14:37 -0700125 self.assertGreater(updated2['security_group']['revision_number'],
126 updated['security_group']['revision_number'])
Kevin Benton183b7be2016-03-24 22:14:58 -0700127
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000128 @decorators.idempotent_id('db70c285-0365-4fac-9f55-2a0ad8cf55a8')
Kevin Bentona2ceb2d2016-09-22 17:52:25 -0700129 @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 Aroraebc25142017-03-27 11:30:47 -0400132 self.addCleanup(self.client.delete_network, net['id'])
Kevin Bentona2ceb2d2016-09-22 17:52:25 -0700133 port = self.create_port(net)
Prateek Aroraebc25142017-03-27 11:30:47 -0400134 self.addCleanup(self.client.delete_port, port['id'])
Kevin Bentona2ceb2d2016-09-22 17:52:25 -0700135 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ńskic0caa2e2017-02-25 10:11:32 +0000144 @decorators.idempotent_id('a21ec3b4-3569-4b77-bf29-4177edaa2df5')
Kevin Bentona2ceb2d2016-09-22 17:52:25 -0700145 @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 Aroraebc25142017-03-27 11:30:47 -0400148 self.addCleanup(self.client.delete_network, net['id'])
Kevin Bentona2ceb2d2016-09-22 17:52:25 -0700149 port = self.create_port(net)
Prateek Aroraebc25142017-03-27 11:30:47 -0400150 self.addCleanup(self.client.delete_port, port['id'])
Kevin Bentona2ceb2d2016-09-22 17:52:25 -0700151 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ńskic0caa2e2017-02-25 10:11:32 +0000161 @decorators.idempotent_id('40ba648f-f374-4c29-a5b7-489dd5a38a4e')
Kevin Bentona2ceb2d2016-09-22 17:52:25 -0700162 @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 Aroraebc25142017-03-27 11:30:47 -0400165 self.addCleanup(self.client.delete_network, net['id'])
Kevin Bentonf46e7a22016-09-24 23:07:45 -0700166 updated = self.client.update_network(net['id'], dns_domain='exa.test.')
Kevin Bentona2ceb2d2016-09-22 17:52:25 -0700167 self.assertGreater(updated['network']['revision_number'],
168 net['revision_number'])
169 port = self.create_port(net)
Prateek Aroraebc25142017-03-27 11:30:47 -0400170 self.addCleanup(self.client.delete_port, port['id'])
Kevin Bentona2ceb2d2016-09-22 17:52:25 -0700171 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ńskic0caa2e2017-02-25 10:11:32 +0000180 @decorators.idempotent_id('8482324f-cf59-4d73-b98e-d37119255300')
Kevin Bentona2ceb2d2016-09-22 17:52:25 -0700181 @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 Aroraebc25142017-03-27 11:30:47 -0400184 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 Bentona2ceb2d2016-09-22 17:52:25 -0700188 subgateway = netaddr.IPAddress(subnet['gateway_ip'])
189 router = self.create_router(router_name='test')
Prateek Aroraebc25142017-03-27 11:30:47 -0400190 self.addCleanup(self.client.delete_router, router['id'])
Kevin Bentona2ceb2d2016-09-22 17:52:25 -0700191 self.create_router_interface(router['id'], subnet['id'])
Prateek Aroraebc25142017-03-27 11:30:47 -0400192 self.addCleanup(
193 self.client.remove_router_interface_with_subnet_id,
194 router['id'],
195 subnet['id'])
Kevin Bentona2ceb2d2016-09-22 17:52:25 -0700196 router = self.client.show_router(router['id'])['router']
Omer Ansond1586832016-10-10 22:46:32 +0300197 updated = self.client.update_extra_routes(
198 router['id'], str(subgateway + 1), '2.0.0.0/24')
Kevin Bentona2ceb2d2016-09-22 17:52:25 -0700199 self.assertGreater(updated['router']['revision_number'],
200 router['revision_number'])
Omer Ansond1586832016-10-10 22:46:32 +0300201 updated2 = self.client.delete_extra_routes(router['id'])
Kevin Bentona2ceb2d2016-09-22 17:52:25 -0700202 self.assertGreater(updated2['router']['revision_number'],
203 updated['router']['revision_number'])
204
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000205 @decorators.idempotent_id('6bd18702-e25a-4b4b-8c0c-680113533511')
Kevin Bentona2ceb2d2016-09-22 17:52:25 -0700206 @test.requires_ext(extension="subnet-service-types", service="network")
207 def test_update_subnet_service_types_bumps_revisions(self):
Prateek Aroraebc25142017-03-27 11:30:47 -0400208 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 Bentona2ceb2d2016-09-22 17:52:25 -0700212 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ńskic0caa2e2017-02-25 10:11:32 +0000221 @decorators.idempotent_id('9c83105c-9973-45ff-9ca2-e66d64700abe')
Kevin Bentona2ceb2d2016-09-22 17:52:25 -0700222 @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 Aroraebc25142017-03-27 11:30:47 -0400225 self.addCleanup(self.client.delete_network, net['id'])
Kevin Bentonf46e7a22016-09-24 23:07:45 -0700226 updated = self.client.update_network(net['id'],
227 port_security_enabled=True)
Kevin Bentona2ceb2d2016-09-22 17:52:25 -0700228 self.assertGreater(updated['network']['revision_number'],
229 net['revision_number'])
Kevin Bentonf46e7a22016-09-24 23:07:45 -0700230 updated2 = self.client.update_network(net['id'],
231 port_security_enabled=False)
Kevin Bentona2ceb2d2016-09-22 17:52:25 -0700232 self.assertGreater(updated2['network']['revision_number'],
233 updated['network']['revision_number'])
234 port = self.create_port(net, port_security_enabled=False)
Prateek Aroraebc25142017-03-27 11:30:47 -0400235 self.addCleanup(self.client.delete_port, port['id'])
Kevin Bentona2ceb2d2016-09-22 17:52:25 -0700236 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ńskic0caa2e2017-02-25 10:11:32 +0000245 @decorators.idempotent_id('68d5ac3a-11a1-4847-8e2e-5843c043d89b')
Kevin Bentona2ceb2d2016-09-22 17:52:25 -0700246 @test.requires_ext(extension="binding", service="network")
247 def test_portbinding_bumps_revision(self):
Prateek Aroraebc25142017-03-27 11:30:47 -0400248 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 Bentona2ceb2d2016-09-22 17:52:25 -0700252 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ńskic0caa2e2017-02-25 10:11:32 +0000259 @decorators.idempotent_id('4a37bde9-1975-47e0-9b8c-2c9ca36415b0')
Kevin Benton183b7be2016-03-24 22:14:58 -0700260 @test.requires_ext(extension="router", service="network")
261 def test_update_router_bumps_revision(self):
Prateek Aroraebc25142017-03-27 11:30:47 -0400262 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 Benton183b7be2016-03-24 22:14:58 -0700266 router = self.create_router(router_name='test')
Prateek Aroraebc25142017-03-27 11:30:47 -0400267 self.addCleanup(self.client.delete_router, router['id'])
Kevin Benton2f067902016-09-02 17:14:37 -0700268 self.assertIn('revision_number', router)
269 rev1 = router['revision_number']
Kevin Benton183b7be2016-03-24 22:14:58 -0700270 router = self.client.update_router(router['id'],
271 name='test2')['router']
Kevin Benton2f067902016-09-02 17:14:37 -0700272 self.assertGreater(router['revision_number'], rev1)
Kevin Benton183b7be2016-03-24 22:14:58 -0700273 self.create_router_interface(router['id'], subnet['id'])
Prateek Aroraebc25142017-03-27 11:30:47 -0400274 self.addCleanup(
275 self.client.remove_router_interface_with_subnet_id,
276 router['id'],
277 subnet['id'])
Kevin Benton183b7be2016-03-24 22:14:58 -0700278 updated = self.client.show_router(router['id'])['router']
Kevin Benton2f067902016-09-02 17:14:37 -0700279 self.assertGreater(updated['revision_number'],
280 router['revision_number'])
Kevin Benton183b7be2016-03-24 22:14:58 -0700281
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000282 @decorators.idempotent_id('9de71ebc-f5df-4cd0-80bc-60299fce3ce9')
Kevin Benton183b7be2016-03-24 22:14:58 -0700283 @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 Aroraebc25142017-03-27 11:30:47 -0400288 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 Benton183b7be2016-03-24 22:14:58 -0700292 router = self.create_router('test', external_network_id=ext_id)
Prateek Aroraebc25142017-03-27 11:30:47 -0400293 self.addCleanup(self.client.delete_router, router['id'])
Kevin Benton183b7be2016-03-24 22:14:58 -0700294 self.create_router_interface(router['id'], subnet['id'])
Prateek Aroraebc25142017-03-27 11:30:47 -0400295 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 Benton183b7be2016-03-24 22:14:58 -0700301 body = self.client.create_floatingip(
302 floating_network_id=ext_id,
303 port_id=port['id'],
304 description='d1'
305 )['floatingip']
Itzik Browna3926d92017-02-12 02:49:29 +0200306 self.floating_ips.append(body)
Kevin Benton2f067902016-09-02 17:14:37 -0700307 self.assertIn('revision_number', body)
Kevin Benton183b7be2016-03-24 22:14:58 -0700308 b2 = self.client.update_floatingip(body['id'], description='d2')
Kevin Benton2f067902016-09-02 17:14:37 -0700309 self.assertGreater(b2['floatingip']['revision_number'],
310 body['revision_number'])
LIU Yulong39e5f102016-05-05 14:52:26 +0800311 # disassociate
312 self.client.update_floatingip(b2['floatingip']['id'], port_id=None)
Lujinba9a4922016-11-21 18:19:04 +0900313
Sławek Kapłońskic0caa2e2017-02-25 10:11:32 +0000314 @decorators.idempotent_id('afb6486c-41b5-483e-a500-3c506f4deb49')
Lujinba9a4922016-11-21 18:19:04 +0900315 @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 Aroraebc25142017-03-27 11:30:47 -0400319 self.addCleanup(self.client.delete_router, router['id'])
Lujinba9a4922016-11-21 18:19:04 +0900320 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ńskic0caa2e2017-02-25 10:11:32 +0000331 @decorators.idempotent_id('90743b00-b0e2-40e4-9524-1c884fe3ef23')
Kevin Benton3e305972016-12-28 02:05:29 -0800332 @test.requires_ext(extension="external-net", service="network")
Lujinba9a4922016-11-21 18:19:04 +0900333 @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 Aroraebc25142017-03-27 11:30:47 -0400338 self.addCleanup(self.client.delete_network, net['id'])
Lujinba9a4922016-11-21 18:19:04 +0900339 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ńskic0caa2e2017-02-25 10:11:32 +0000345 @decorators.idempotent_id('5af6450a-0f61-49c3-b628-38db77c7b856')
Lujinba9a4922016-11-21 18:19:04 +0900346 @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 Aroraebc25142017-03-27 11:30:47 -0400349 net = self.create_network()
350 self.addCleanup(self.client.delete_network, net['id'])
351 port = self.create_port(net)
Lujinba9a4922016-11-21 18:19:04 +0900352 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ńskic0caa2e2017-02-25 10:11:32 +0000358 @decorators.idempotent_id('817da343-c6e4-445c-9519-a621f124dfbe')
Lujinba9a4922016-11-21 18:19:04 +0900359 @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'])