Itzik Brown | e67ebb5 | 2016-05-15 05:34:41 +0000 | [diff] [blame] | 1 | # Copyright 2016 Red Hat, Inc. |
| 2 | # All Rights Reserved. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 5 | # not use this file except in compliance with the License. You may obtain |
| 6 | # a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 | # License for the specific language governing permissions and limitations |
| 14 | # under the License. |
Roman Safronov | 367e118 | 2020-05-13 16:38:15 +0300 | [diff] [blame] | 15 | import testtools |
| 16 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 17 | from tempest.lib import decorators |
Itzik Brown | e67ebb5 | 2016-05-15 05:34:41 +0000 | [diff] [blame] | 18 | |
Roman Safronov | 367e118 | 2020-05-13 16:38:15 +0300 | [diff] [blame] | 19 | from neutron_tempest_plugin.common import ssh |
Chandan Kumar | 667d3d3 | 2017-09-22 12:24:06 +0530 | [diff] [blame] | 20 | from neutron_tempest_plugin import config |
| 21 | from neutron_tempest_plugin.scenario import base |
Itzik Brown | e67ebb5 | 2016-05-15 05:34:41 +0000 | [diff] [blame] | 22 | |
| 23 | CONF = config.CONF |
Itzik Brown | e67ebb5 | 2016-05-15 05:34:41 +0000 | [diff] [blame] | 24 | |
| 25 | |
| 26 | class NetworkBasicTest(base.BaseTempestTestCase): |
Slawek Kaplonski | edf3cba | 2021-04-21 10:34:02 +0200 | [diff] [blame] | 27 | credentials = ['primary', 'admin'] |
Itzik Brown | e67ebb5 | 2016-05-15 05:34:41 +0000 | [diff] [blame] | 28 | force_tenant_isolation = False |
| 29 | |
| 30 | # Default to ipv4. |
| 31 | _ip_version = 4 |
| 32 | |
Sławek Kapłoński | c0caa2e | 2017-02-25 10:11:32 +0000 | [diff] [blame] | 33 | @decorators.idempotent_id('de07fe0a-e955-449e-b48b-8641c14cd52e') |
Itzik Brown | e67ebb5 | 2016-05-15 05:34:41 +0000 | [diff] [blame] | 34 | def test_basic_instance(self): |
Itzik Brown | 1ef813a | 2016-06-06 12:56:21 +0000 | [diff] [blame] | 35 | self.setup_network_and_server() |
| 36 | self.check_connectivity(self.fip['floating_ip_address'], |
Itzik Brown | e67ebb5 | 2016-05-15 05:34:41 +0000 | [diff] [blame] | 37 | CONF.validation.image_ssh_user, |
Itzik Brown | 1ef813a | 2016-06-06 12:56:21 +0000 | [diff] [blame] | 38 | self.keypair['private_key']) |
Roman Safronov | 367e118 | 2020-05-13 16:38:15 +0300 | [diff] [blame] | 39 | |
| 40 | @testtools.skipUnless( |
| 41 | CONF.neutron_plugin_options.global_ip_address, |
| 42 | 'Global IP address is not defined.') |
| 43 | @decorators.idempotent_id('49609189-3a0e-43c7-832e-a7e114aad1c9') |
| 44 | def test_ping_global_ip_from_vm_with_fip(self): |
| 45 | self.setup_network_and_server() |
| 46 | server_ssh_client = ssh.Client(self.fip['floating_ip_address'], |
| 47 | CONF.validation.image_ssh_user, |
| 48 | pkey=self.keypair['private_key']) |
| 49 | self.check_remote_connectivity( |
| 50 | server_ssh_client, |
| 51 | CONF.neutron_plugin_options.global_ip_address, |
| 52 | ping_count=1) |