Tempest fixes for below cases

- vmware_nsx_tempest_plugin.tests.nsxv3.api.test_nsx_floating_ip.NSXv3FloatingIPTest.test_create_floating_ip
- vmware_nsx_tempest_plugin.tests.nsxv3.api.test_nsx_floating_ip.NSXv3FloatingIPTest.test_delete_floating_ip
- vmware_nsx_tempest_plugin.tests.nsxv3.api.test_nsx_floating_ip.NSXv3FloatingIPTest.test_update_floating_ip
- vmware_nsx_tempest_plugin.tests.nsxv3.api.test_nsx_port_security.NSXv3PortSecurity.test_admin_port_security_at_beckend_after_enable_disable
- vmware_nsx_tempest_plugin.tests.nsxv3.api.test_nsx_port_security.NSXv3PortSecurity.test_tenant_port_security_at_beckend_after_enable_disable
- vmware_nsx_tempest_plugin.tests.scenario.test_new_case_coverage.TestNewCase.test_create_port_with_dhcp_port_ip
- vmware_nsx_tempest_plugin.tests.scenario.test_new_case_coverage.TestNewCase.test_create_sec_group_with_invalid_protocol
- vmware_nsx_tempest_plugin.tests.scenario.test_new_case_coverage.TestNewCase.test_mac_learning_should_not_applied_over_trusted_ports
- vmware_nsx_tempest_plugin.tests.scenario.test_new_case_coverage.TestNewCase.test_mac_learning_with_provider_sec_group_enabled_on_port
- vmware_nsx_tempest_plugin.tests.scenario.test_provider_networks.ProviderNetworks.test_provider_vlan_networks_using_router_Adn_verify
- vmware_nsx_tempest_plugin.tests.nsxv3.api.test_nsx_routers.NSXv3RoutersTest.test_deploy_router_ha_with_relocation_enable_disable

Change-Id: Ie729ae95df4096a763ce0483b62c06cf85614842
This commit is contained in:
shubhamk 2019-09-12 10:56:51 +00:00
parent ea56f1c721
commit e9c592bacd
7 changed files with 50 additions and 15 deletions

View File

@ -72,11 +72,18 @@ class ApplianceManager(manager.NetworkScenarioTest):
def _verify_empty_security_group_status(self, security_group):
ip_protocols = ["IPV6", "IPV4"]
nsx_fw_section, nsx_fw_section_rules = \
self.nsx_client.get_firewall_section_and_rules(
security_group['name'], security_group['id'])
if CONF.network.backend == 'nsxp':
nsx_fw_section, nsx_fw_section_rules = \
self.nsx_client.get_firewall_section_and_rules(
security_group['name'], security_group['id'],
os_tenant_id='default')
elif CONF.network.backend == 'nsxv3':
nsx_fw_section, nsx_fw_section_rules = \
self.nsx_client.get_firewall_section_and_rules(
security_group['name'], security_group['id'])
msg = "Newly created empty security group does not meet criteria !!!"
self.assertEqual(nsx_fw_section["rule_count"], 2, msg)
if CONF.network.backend != 'nsxp':
self.assertEqual(nsx_fw_section["rule_count"], 2, msg)
self.assertEqual(nsx_fw_section_rules[0]["action"], "ALLOW", msg)
self.assertEqual(nsx_fw_section_rules[1]["action"], "ALLOW", msg)
self.assertEqual(nsx_fw_section_rules[0]["direction"], "OUT", msg)

View File

@ -14,6 +14,7 @@
# under the License.
from oslo_log import log as logging
from vmware_nsx_tempest_plugin.services import nsxp_client
from vmware_nsx_tempest_plugin.services import nsxv3_client
LOG = logging.getLogger(__name__)
@ -28,6 +29,8 @@ class NSXClient(object):
self.password = password
if backend.lower() == "nsxv3":
self.nsx = nsxv3_client.NSXV3Client(host, username, password)
elif backend.lower() == "nsxp":
self.nsx = nsxp_client.NSXPClient(host, username, password)
def get_firewall_section_and_rules(self, *args, **kwargs):
if self.backend == "nsxv3":
@ -36,6 +39,12 @@ class NSXClient(object):
firewall_section_rules = self.nsx.get_firewall_section_rules(
firewall_section)
return firewall_section, firewall_section_rules
elif self.backend == "nsxp":
firewall_section = self.nsx.get_firewall_section(
*args, **kwargs)
firewall_section_rules = self.nsx.get_firewall_section_rules(
firewall_section, tenant_id=kwargs['os_tenant_id'])
return firewall_section, firewall_section_rules
else:
# TODO(ddoshi) define else for nsxv
pass

View File

@ -13,6 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import time
from oslo_log import log as logging
from tempest.api.network import base
@ -21,6 +23,7 @@ from tempest.lib.common.utils import data_utils
from tempest.lib import decorators
from tempest import test
from vmware_nsx_tempest_plugin.common import constants
from vmware_nsx_tempest_plugin.services import nsxv3_client
CONF = config.CONF
@ -69,6 +72,8 @@ class NSXv3FloatingIPTest(base.BaseNetworkTest):
LOG.debug("Port IP address: %s", port_ip)
self.addCleanup(self.floating_ips_client.delete_floatingip,
fip['id'])
if CONF.network.backend == 'nsxp':
time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL)
nsx_router = self.nsx.get_logical_router(self.router['name'],
self.router['id'])
LOG.debug("NSX router on backend: %s", nsx_router)
@ -102,6 +107,8 @@ class NSXv3FloatingIPTest(base.BaseNetworkTest):
{'port1': port1_ip, 'port2': port2_ip})
self.addCleanup(self.floating_ips_client.delete_floatingip,
fip['id'])
if CONF.network.backend == 'nsxp':
time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL)
nsx_router = self.nsx.get_logical_router(self.router['name'],
self.router['id'])
self.assertEqual(fip['fixed_ip_address'], port1_ip)
@ -110,6 +117,8 @@ class NSXv3FloatingIPTest(base.BaseNetworkTest):
update_body = self.floating_ips_client.update_floatingip(
fip['id'], port_id=self.ports[1]['id'])
updated_fip = update_body['floatingip']
if CONF.network.backend == 'nsxp':
time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL)
nat_rules = self.nsx.get_logical_router_nat_rules(nsx_router)
LOG.debug("NAT rules on NSX router %(router)s: %(rules)s",
{'router': nsx_router, 'rules': nat_rules})
@ -139,12 +148,16 @@ class NSXv3FloatingIPTest(base.BaseNetworkTest):
fip = create_body['floatingip']
port_ip = self.ports[0]['fixed_ips'][0]['ip_address']
LOG.debug("Port IP address: %s", port_ip)
if CONF.network.backend == 'nsxp':
time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL)
nsx_router = self.nsx.get_logical_router(self.router['name'],
self.router['id'])
LOG.debug("NSX router on backend: %s", nsx_router)
self.assertIsNotNone(fip['id'])
# Delete the floating ip and backend nat rules
self.floating_ips_client.delete_floatingip(fip['id'])
if CONF.network.backend == 'nsxp':
time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL)
nat_rules = self.nsx.get_logical_router_nat_rules(nsx_router)
LOG.debug("NAT rules on NSX router %(router)s: %(rules)s",
{'router': nsx_router, 'rules': nat_rules})

View File

@ -149,7 +149,7 @@ class NSXv3PortSecurity(base.BaseAdminNetworkTest):
network['network']['id'])
subnet_client = client.subnets_client
subnet = self._create_subnet_v6(network['network'], cidr="2020::/64",
subnets_client=subnet_client)
subnets_client=subnet_client)
body = {"network_id": network['network']['id'],
"admin_state_up": "true",
"port_security_enabled": "false", "security_groups": []}
@ -277,7 +277,7 @@ class NSXv3PortSecurity(base.BaseAdminNetworkTest):
time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL)
nsx_nsgroup_policy = self.nsxp.get_ns_group(
secgroup['name'], secgroup['id'],
os_tenant_id=secgroup['tenant_id'])
os_tenant_id='default')
self.assertIsNotNone(nsx_nsgroup_policy)
nsgroup_id = self.nsx.get_neutron_ns_group_id(nsxp=True)
else:
@ -321,7 +321,7 @@ class NSXv3PortSecurity(base.BaseAdminNetworkTest):
time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL)
nsx_nsgroup_policy = self.nsxp.get_ns_group(
secgroup['name'], secgroup['id'],
os_tenant_id=secgroup['tenant_id'])
os_tenant_id='default')
self.assertIsNotNone(nsx_nsgroup_policy)
nsgroup_id = self.nsx.get_neutron_ns_group_id(nsxp=True)
else:

View File

@ -152,6 +152,7 @@ class NSXv3RoutersTest(base.BaseAdminNetworkTest):
router_name=router_name, admin_state_up=True)
if CONF.network.backend == 'nsxp':
time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL)
nsx_router = self.nsxp.get_logical_router(body['name'], body['id'])
self.assertEqual(body['name'], router_name)
self.assertIsNotNone(nsx_router)
@ -169,6 +170,7 @@ class NSXv3RoutersTest(base.BaseAdminNetworkTest):
self.routers_client.update_router(body['id'], **public_network_info)
if CONF.network.backend == 'nsxp':
time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL)
nsx_router = self.nsxp.get_logical_router(body['name'], body['id'])
self.assertEqual(body['name'], router_name)
self.assertIsNotNone(nsx_router)
@ -184,6 +186,7 @@ class NSXv3RoutersTest(base.BaseAdminNetworkTest):
self.routers_client.update_router(body['id'], **public_network_info)
if CONF.network.backend == 'nsxp':
time.sleep(constants.NSXP_BACKEND_SMALL_TIME_INTERVAL)
nsx_router = self.nsxp.get_logical_router(body['name'], body['id'])
self.assertEqual(body['name'], router_name)
self.assertIsNotNone(nsx_router)

View File

@ -551,13 +551,14 @@ class TestNewCase(feature_manager.FeatureManager):
image_id = self.get_glance_image_id(['cirros', "esx"])
vm_state = self.create_topology_instance(
"state_vm_1", create_floating_ip=False,
image_id=image_id, port=port['port'])
image_id=image_id, port=port['port'],
clients=self.cmgr_adm)
self.assertEqual("ACTIVE", vm_state['status'])
@decorators.idempotent_id('1207561e-91cc-8905-b217-98844caa79f6')
def test_create_port_with_dhcp_port_ip(self):
topology_dict = self.create_topo_single_network(
"instance_port", deploy_instance=False)
"instance_port", create_instance=False)
network_state = topology_dict['network_state']
subnet_state = topology_dict['subnet_state']
network_cidr = (
@ -856,12 +857,12 @@ class TestNewCase(feature_manager.FeatureManager):
vm1 = self.\
create_topology_instance("server1", [network],
security_groups=[
{'name': self.sg['name']}],
{'name': self.sg['name']}],
clients=self.cmgr_adm)
vm2 = self.\
create_topology_instance("server2", [network],
security_groups=[
{'name': self.sg['name']}],
{'name': self.sg['name']}],
clients=self.cmgr_adm)
ip_address = vm1['floating_ips'][0]['floating_ip_address']
ssh_source = self._get_remote_client(ip_address, use_password=True)
@ -903,12 +904,12 @@ class TestNewCase(feature_manager.FeatureManager):
vm1 = self.\
create_topology_instance("server1", [network],
security_groups=[
{'name': self.sg['name']}],
{'name': self.sg['name']}],
clients=self.cmgr_adm)
vm2 = self.\
create_topology_instance("server2", [network],
security_groups=[
{'name': self.sg['name']}],
{'name': self.sg['name']}],
clients=self.cmgr_adm)
ip_address = vm1['floating_ips'][0]['floating_ip_address']
ssh_source = self._get_remote_client(ip_address, use_password=True)

View File

@ -270,7 +270,8 @@ class ProviderNetworks(feature_manager.FeatureManager):
'fixed_ips')[0]['ip_address'] == subnet['gateway_ip']:
port_id = port['id']
break
self.check_centralized_port_created(router_op, subnet, port_id)
if CONF.network.backend != 'nsxp':
self.check_centralized_port_created(router_op, subnet, port_id)
network = self.create_topology_network(network_name="overlay-network")
subnet1 = self.create_topology_subnet(
"overlay_subnet",
@ -287,7 +288,8 @@ class ProviderNetworks(feature_manager.FeatureManager):
'fixed_ips')[0]['ip_address'] == subnet['gateway_ip']:
port_id = port['id']
break
self.check_downlink_port_created(router_op, subnet1, port_id)
if CONF.network.backend != 'nsxp':
self.check_downlink_port_created(router_op, subnet1, port_id)
@decorators.idempotent_id('3ca5b0d5-5be0-42e3-b3b1-eb653753fbfe')
def test_vlan_network_attach_router_fails(self):