How to use show_port_forwarding method in tempest

Best Python code snippet using tempest_python

client.py

Source:client.py Github

copy

Full Screen

...884 revision_number=revision_number)885 def delete_floatingip(self, floatingip):886 """Deletes the specified floatingip."""887 return self.delete(self.floatingip_path % (floatingip))888 def show_port_forwarding(self, floatingip, portforwarding):889 """Fetches information of a certain portforwarding"""890 return self.get(self.port_forwarding_path % (floatingip,891 portforwarding))892 def list_port_forwardings(self, floatingip, retrieve_all=True, **_params):893 """Fetches a list of all portforwardings for a floatingip."""894 return self.list('port_forwardings',895 self.port_forwardings_path % floatingip, retrieve_all,896 **_params)897 def create_port_forwarding(self, floatingip, body=None):898 """Creates a new portforwarding."""899 return self.post(self.port_forwardings_path % floatingip, body=body)900 def delete_port_forwarding(self, floatingip, portforwarding):901 """Deletes the specified portforwarding."""902 return self.delete(self.port_forwarding_path % (floatingip,...

Full Screen

Full Screen

test_floating_ips_port_forwarding_client.py

Source:test_floating_ips_port_forwarding_client.py Github

copy

Full Screen

1# Copyright 2021 Red Hat, Inc.2# 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.15import copy16from tempest.lib.services.network import floating_ips_port_forwarding_client17from tempest.tests.lib import fake_auth_provider18from tempest.tests.lib.services import base19class TestFloatingIpsPortForwardingClient(base.BaseServiceTest):20 FAKE_PORT_FORWARDING_REQUEST = {21 "port_forwarding": {22 "protocol": "tcp",23 "internal_ip_address": "10.0.0.11",24 "internal_port": 25,25 "internal_port_id": "1238be08-a2a8-4b8d-addf-fb5e2250e480",26 "external_port": 2230,27 "description": "Some description",28 }29 }30 FAKE_PORT_FORWARDING_RESPONSE = {31 "port_forwarding": {32 "protocol": "tcp",33 "internal_ip_address": "10.0.0.12",34 "internal_port": 26,35 "internal_port_id": "1238be08-a2a8-4b8d-addf-fb5e2250e480",36 "external_port": 2130,37 "description": "Some description",38 "id": "825ade3c-9760-4880-8080-8fc2dbab9acc"39 }40 }41 FAKE_PORT_FORWARDINGS = {42 "port_forwardings": [43 FAKE_PORT_FORWARDING_RESPONSE['port_forwarding']44 ]45 }46 FAKE_FLOATINGIP_ID = "a6800594-5b7a-4105-8bfe-723b346ce866"47 FAKE_PORT_FORWARDING_ID = "a7800594-5b7a-4105-8bfe-723b346ce866"48 def setUp(self):49 super(TestFloatingIpsPortForwardingClient, self).setUp()50 fake_auth = fake_auth_provider.FakeAuthProvider()51 self.floating_ips_port_forwarding_client = \52 floating_ips_port_forwarding_client.\53 FloatingIpsPortForwardingClient(fake_auth,54 "network",55 "regionOne")56 def _test_create_port_forwarding(self, bytes_body=False):57 self.check_service_client_function(58 self.floating_ips_port_forwarding_client.59 create_port_forwarding,60 "tempest.lib.common.rest_client.RestClient.post",61 self.FAKE_PORT_FORWARDING_RESPONSE,62 bytes_body,63 201,64 floatingip_id=self.FAKE_FLOATINGIP_ID,65 **self.FAKE_PORT_FORWARDING_REQUEST)66 def _test_list_port_forwardings(self, bytes_body=False):67 self.check_service_client_function(68 self.floating_ips_port_forwarding_client.69 list_port_forwardings,70 "tempest.lib.common.rest_client.RestClient.get",71 self.FAKE_PORT_FORWARDINGS,72 bytes_body,73 200,74 floatingip_id=self.FAKE_FLOATINGIP_ID)75 def _test_show_port_forwardings(self, bytes_body=False):76 self.check_service_client_function(77 self.floating_ips_port_forwarding_client.78 show_port_forwarding,79 "tempest.lib.common.rest_client.RestClient.get",80 self.FAKE_PORT_FORWARDING_RESPONSE,81 bytes_body,82 200,83 floatingip_id=self.FAKE_FLOATINGIP_ID,84 port_forwarding_id=self.FAKE_PORT_FORWARDING_ID)85 def _test_delete_port_forwarding(self):86 self.check_service_client_function(87 self.floating_ips_port_forwarding_client.88 delete_port_forwarding,89 "tempest.lib.common.rest_client.RestClient.delete",90 {},91 status=204,92 floatingip_id=self.FAKE_FLOATINGIP_ID,93 port_forwarding_id=self.FAKE_PORT_FORWARDING_ID)94 def _test_update_port_forwarding(self, bytes_body=False):95 update_kwargs = {96 "internal_port": "27"97 }98 resp_body = {99 "port_forwarding": copy.deepcopy(100 self.FAKE_PORT_FORWARDING_RESPONSE['port_forwarding']101 )102 }103 resp_body["port_forwarding"].update(update_kwargs)104 self.check_service_client_function(105 self.floating_ips_port_forwarding_client.update_port_forwarding,106 "tempest.lib.common.rest_client.RestClient.put",107 resp_body,108 bytes_body,109 200,110 floatingip_id=self.FAKE_FLOATINGIP_ID,111 port_forwarding_id=self.FAKE_PORT_FORWARDING_ID,112 **update_kwargs)113 def test_list_port_forwardings_with_str_body(self):114 self._test_list_port_forwardings()115 def test_list_port_forwardings_with_bytes_body(self):116 self._test_list_port_forwardings(bytes_body=True)117 def test_show_port_forwardings_with_str_body(self):118 self._test_show_port_forwardings()119 def test_show_port_forwardings_with_bytes_body(self):120 self._test_show_port_forwardings(bytes_body=True)121 def test_create_port_forwarding_with_str_body(self):122 self._test_create_port_forwarding()123 def test_create_port_forwarding_with_bytes_body(self):124 self._test_create_port_forwarding(bytes_body=True)125 def test_update_port_forwarding_with_str_body(self):126 self._test_update_port_forwarding()127 def test_update_port_forwarding_with_bytes_body(self):...

Full Screen

Full Screen

floating_ips_port_forwarding_client.py

Source:floating_ips_port_forwarding_client.py Github

copy

Full Screen

...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 official43 API reference:44 https://docs.openstack.org/api-ref/network/v2/index.html#show-port-forwarding45 """46 uri = '/floatingips/%s/port_forwardings/%s' % (47 floatingip_id, port_forwarding_id)48 return self.show_resource(uri, **fields)49 def delete_port_forwarding(self, floatingip_id, port_forwarding_id):50 """Deletes a floating IP port_forwarding resource.51 For a full list of available parameters, please refer to the official52 API reference:53 https://docs.openstack.org/api-ref/network/v2/index.html#delete-a-floating-ip-port-forwarding...

Full Screen

Full Screen

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