How to use update_port_forwarding method in tempest

Best Python code snippet using tempest_python

test_port_forwarding_negative.py

Source: test_port_forwarding_negative.py Github

copy

Full Screen

1# Copyright 2020 OpenStack Foundation2# All Rights Reserved.3#4# Licensed under the Apache License, Version 2.0 (the "License"); you may5# not use this file except in compliance with the License. You may obtain6# a copy of the License at7#8# http:/​/​www.apache.org/​licenses/​LICENSE-2.09#10# Unless required by applicable law or agreed to in writing, software11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the13# License for the specific language governing permissions and limitations14# under the License.15from tempest.lib.common.utils import data_utils16from tempest.lib import decorators17from tempest.lib import exceptions18from neutron_tempest_plugin.api import base19from neutron_tempest_plugin import config20CONF = config.CONF21class PortForwardingNegativeTestJSON(base.BaseNetworkTest):22 required_extensions = ['router', 'floating-ip-port-forwarding']23 @classmethod24 def resource_setup(cls):25 super(PortForwardingNegativeTestJSON, cls).resource_setup()26 cls.ext_net_id = CONF.network.public_network_id27 # Create network, subnet, router and add interface28 cls.network = cls.create_network()29 cls.subnet = cls.create_subnet(cls.network)30 cls.router = cls.create_router(data_utils.rand_name('router'),31 external_network_id=cls.ext_net_id)32 cls.create_router_interface(cls.router['id'], cls.subnet['id'])33 @decorators.attr(type='negative')34 @decorators.idempotent_id('63c0d406-99d5-11ea-bb37-0242ac130002')35 def test_mapping_same_fip_and_external_port_to_different_dest(self):36 port1 = self.create_port(self.network)37 port2 = self.create_port(self.network)38 fip_for_pf = self.create_floatingip()39 self.create_port_forwarding(40 fip_for_pf['id'],41 internal_port_id=port1['id'],42 internal_ip_address=port1['fixed_ips'][0]['ip_address'],43 internal_port=1111, external_port=2222,44 protocol="tcp")45 self.assertRaises(46 exceptions.BadRequest,47 self.create_port_forwarding,48 fip_for_pf['id'],49 internal_port_id=port2['id'],50 internal_ip_address=port2['fixed_ips'][0]['ip_address'],51 internal_port=3333, external_port=2222,52 protocol="tcp")53 @decorators.attr(type='negative')54 @decorators.idempotent_id('0c229a4c-9f28-11ea-bb37-0242ac130002')55 def test_mapping_different_external_ports_to_the_same_destination(self):56 port = self.create_port(self.network)57 fip_for_pf = self.create_floatingip()58 self.create_port_forwarding(59 fip_for_pf['id'],60 internal_port_id=port['id'],61 internal_ip_address=port['fixed_ips'][0]['ip_address'],62 internal_port=1111, external_port=3333,63 protocol="tcp")64 self.assertRaises(65 exceptions.BadRequest,66 self.create_port_forwarding,67 fip_for_pf['id'],68 internal_port_id=port['id'],69 internal_ip_address=port['fixed_ips'][0]['ip_address'],70 internal_port=1111, external_port=5555,71 protocol="tcp")72 @decorators.attr(type='negative')73 @decorators.idempotent_id('e9d3ffb6-e5bf-421d-acaa-ee6010dfbf14')74 def test_out_of_range_ports(self):75 port = self.create_port(self.network)76 fip_for_pf = self.create_floatingip()77 pf_params = {78 'internal_port_id': port['id'],79 'internal_ip_address': port['fixed_ips'][0]['ip_address'],80 'internal_port': 1111,81 'external_port': 3333,82 'protocol': "tcp"}83 pf = self.create_port_forwarding(fip_for_pf['id'], **pf_params)84 # Check: Invalid input for external_port update85 self.assertRaises(86 exceptions.BadRequest,87 self.update_port_forwarding,88 fip_for_pf['id'], pf['id'], external_port=108343)89 # Check: Invalid input for internal_port update90 self.assertRaises(91 exceptions.BadRequest,92 self.update_port_forwarding,93 fip_for_pf['id'], pf['id'], internal_port=108343)94 # Check: Invalid input for external_port create95 pf_params['internal_port'] = 444496 pf_params['external_port'] = 33333397 self.assertRaises(98 exceptions.BadRequest,99 self.create_port_forwarding, fip_for_pf['id'], **pf_params)100 # Check: Invalid input for internal_port create101 pf_params['internal_port'] = 444444102 pf_params['external_port'] = 3333103 self.assertRaises(104 exceptions.BadRequest,...

Full Screen

Full Screen

floating_ips_port_forwarding_client.py

Source: floating_ips_port_forwarding_client.py Github

copy

Full Screen

...24 """25 uri = '/​floatingips/​%s/​port_forwardings' % floatingip_id26 post_data = {'port_forwarding': kwargs}27 return self.create_resource(uri, post_data)28 def update_port_forwarding(29 self, floatingip_id, port_forwarding_id, **kwargs):30 """Updates a floating IP port_forwarding resource.31 For a full list of available parameters, please refer to the official32 API reference:33 https:/​/​docs.openstack.org/​api-ref/​network/​v2/​index.html#update-a-port-forwarding34 """35 uri = '/​floatingips/​%s/​port_forwardings/​%s' % (36 floatingip_id, port_forwarding_id)37 post_data = {'port_forwarding': kwargs}38 return self.update_resource(uri, post_data)39 def show_port_forwarding(40 self, floatingip_id, port_forwarding_id, **fields):41 """Shows details for a floating IP port forwarding id.42 For a full list of available parameters, please refer to the official...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Rebuild Confidence in Your Test Automation

These days, development teams depend heavily on feedback from automated tests to evaluate the quality of the system they are working on.

What will come after “agile”?

I think that probably most development teams describe themselves as being “agile” and probably most development teams have standups, and meetings called retrospectives.There is also a lot of discussion about “agile”, much written about “agile”, and there are many presentations about “agile”. A question that is often asked is what comes after “agile”? Many testers work in “agile” teams so this question matters to us.

Test strategy and how to communicate it

I routinely come across test strategy documents when working with customers. They are lengthy—100 pages or more—and packed with monotonous text that is routinely reused from one project to another. Yawn once more— the test halt and resume circumstances, the defect management procedure, entrance and exit criteria, unnecessary generic risks, and in fact, one often-used model replicates the requirements of textbook testing, from stress to systems integration.

Do you possess the necessary characteristics to adopt an Agile testing mindset?

To understand the agile testing mindset, we first need to determine what makes a team “agile.” To me, an agile team continually focuses on becoming self-organized and cross-functional to be able to complete any challenge they may face during a project.

How To Refresh Page Using Selenium C# [Complete Tutorial]

When working on web automation with Selenium, I encountered scenarios where I needed to refresh pages from time to time. When does this happen? One scenario is that I needed to refresh the page to check that the data I expected to see was still available even after refreshing. Another possibility is to clear form data without going through each input individually.

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run tempest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful