Adding new testcases for opened bugs

- test_update_lb_vip_port_with_fixed_ip
- test_update_lb_vip_port_with_allowed_address_pair
- test_port_creation_load
- test_lbaas_https_traffic_lb_vip_stats
- test_mac_learning_status_in_port_show
- test_floatingip_attach_to_router_interface_port

Change-Id: Ie1710095e0a91520a28f05effa67ba95578df67d
This commit is contained in:
shubhamk 2019-09-26 07:36:03 +00:00
parent 214b525245
commit ba8ce01da9
2 changed files with 191 additions and 4 deletions

View File

@ -755,3 +755,9 @@ class NSXV3Client(object):
edge_cluster = self.get_logical_resources("/edge-clusters/%s"
% edge_cluster_id)
return edge_cluster['members']
def get_lb_pools(self):
"""
Get edge cluster members
"""
return self.get_logical_resources("/loadbalancer/pools")

View File

@ -78,7 +78,7 @@ class TestNewCase(feature_manager.FeatureManager):
cls.web_service_start_delay = 2.5
def create_topo_single_network(self, namestart, create_instance=True,
set_gateway=True, **kwargs):
set_gateway=True, cidr=None, **kwargs):
"""
Create Topo where 1 logical switches which is
connected via tier-1 router.
@ -90,9 +90,9 @@ class TestNewCase(feature_manager.FeatureManager):
set_gateway=set_gateway,
**kwargs)
network_state = self.create_topology_network(network_name)
subnet_state = self.create_topology_subnet(subnet_name, network_state,
router_id=router_state["id"]
)
subnet_state = self.create_topology_subnet(
subnet_name, network_state, router_id=router_state["id"],
cidr=cidr)
if create_instance:
image_id = self.get_glance_image_id(["cirros", "esx"])
self.create_topology_instance(
@ -1546,3 +1546,184 @@ class TestNewCase(feature_manager.FeatureManager):
0]['advertiseRouteType'] == 'T1_STATIC':
route_present = True
self.assertEqual(False, route_present, 'Static Route is Present')
@decorators.idempotent_id('3437227a-12aa-9016-b217-12454cab45c3')
def test_update_lb_vip_port_with_fixed_ip(self):
"""
Check it should advertise static route with no-not
router
"""
topo_dict = self.create_topo_single_network('test_lb_port',
create_instance=False)
subnet_state = topo_dict['subnet_state']
self.loadbalancer = self.load_balancers_admin_client.\
create_load_balancer(
name='test_lb',
vip_subnet_id=subnet_state['id'])['loadbalancer']
self.addCleanup(
self.load_balancers_admin_client.delete_load_balancer,
self.loadbalancer['id'])
self.load_balancers_admin_client.wait_for_load_balancer_status(
self.loadbalancer['id'])
network_cidr = (
CONF.network.project_network_cidr.rsplit('/')[0]).rsplit('.',
1)
fix_ip = [{'subnet_id': subnet_state.get(
'id'),
'ip_address': network_cidr[0] + '.21'}]
args = {'fixed_ips': fix_ip}
self.assertRaises(exceptions.BadRequest,
self.cmgr_adm.ports_client.update_port,
self.loadbalancer['vip_port_id'], **args)
@decorators.idempotent_id('4548338b-12aa-0126-b217-12454cab45c3')
def test_update_lb_vip_port_with_allowed_address_pair(self):
"""
Check it should advertise static route with no-not
router
"""
topo_dict = self.create_topo_single_network('test_lb_port',
create_instance=False)
subnet_state = topo_dict['subnet_state']
self.loadbalancer = self.load_balancers_admin_client.\
create_load_balancer(
name='test_lb',
vip_subnet_id=subnet_state['id'])['loadbalancer']
self.addCleanup(
self.load_balancers_admin_client.delete_load_balancer,
self.loadbalancer['id'])
self.load_balancers_admin_client.wait_for_load_balancer_status(
self.loadbalancer['id'])
allowed_address_pairs = [{'ip_address': '10.0.0.10'}]
self.assertRaises(exceptions.BadRequest,
self.cmgr_adm.ports_client.update_port,
self.loadbalancer['vip_port_id'],
allowed_address_pairs=allowed_address_pairs)
@decorators.idempotent_id('4548338b-12aa-0126-b217-23556dbb45c3')
def test_port_creation_load(self):
"""
Check it should advertise static route with no-not
router
"""
topology_dict = self.create_topo_single_network(
"route-port", create_instance=False,
cidr='192.168.0.0/24')
network_state = topology_dict['network_state']
name = data_utils.rand_name('vmw-port')
args = {'port_security_enabled': True,
'mac_learning_enabled': False,
'name': name}
for i in range(1, 5):
for j in range(1, 20):
port = self.create_topology_port(
network_state,
ports_client=self.cmgr_adm.ports_client,
**args)
port = port['port']
self.assertEqual("ACTIVE", port['status'])
ports = self.ports_client.list_ports()
self.assertEqual(False, len(ports) > 1, 'port listing is failed')
@decorators.idempotent_id('4548449b-12aa-1127-c217-34567ebb45c3')
def test_lbaas_https_traffic_lb_vip_stats(self):
"""
Create lbaas, in it create listener
with barbican certificate and with terminated
https protocol and check https
traffic should work.
With same lb create http listener
with barbican certificate and check
http traffic should work.
"""
barbican_secrets = self.create_barbican_secret_conatainer(
constants.CERT_FILE, constants.KEY_FILE)
barbican_container = barbican_secrets['secret_container']
self.create_single_network_topo_for_barbican()
no_of_servers = 2
image_id = self.get_glance_image_id(["cirros", "esx"])
for instance in range(0, no_of_servers):
self.create_topology_instance(
"server_lbaas_%s" % instance, [self.network_state],
security_groups=[{'name': self.sg['name']}],
image_id=image_id, clients=self.cmgr_adm)
self.start_web_servers(constants.HTTP_PORT)
topo_dict = self.create_project_lbaas(
protocol_type="TERMINATED_HTTPS",
protocol_port="443",
lb_algorithm="ROUND_ROBIN",
hm_type='HTTP',
member_count=2,
weight=5,
pool_protocol='HTTP',
pool_port='80',
vip_subnet_id=self.subnet_state['id'],
barbican_container=barbican_container,
count=0, barbican=True)
self.check_lbaas_project_weight_values(HTTPS=True)
stats = self.load_balancers_admin_client.show_load_balancer_stats(
load_balancer_id=topo_dict['lb_id'])
stats = stats.get('stats', stats)
self.assertNotEqual(0, stats['bytes_in'])
self.assertNotEqual(0, stats['bytes_out'])
self.assertNotEqual(0, stats['total_connections'])
@decorators.idempotent_id('4548449b-23ba-2138-a227-34567ebb45c3')
def test_mac_learning_status_in_port_show(self):
"""
Create lbaas, in it create listener
with barbican certificate and with terminated
https protocol and check https
traffic should work.
With same lb create http listener
with barbican certificate and check
http traffic should work.
"""
topology_dict = self.create_topo_single_network(
"route-port", create_instance=False)
network_state = topology_dict['network_state']
name = data_utils.rand_name('vmw-port')
args = {'mac_learning_enabled': True,
'port_security_enabled': False,
'name': name}
port = self.create_topology_port(
network_state, ports_client=self.cmgr_adm.ports_client, **args)
port = port['port']
self.assertEqual(port['mac_learning_enabled'],
True,
'Mac learning parameter is not present')
if not port['mac_learning_enabled']:
raise Exception("Mac learning is not enabled")
kwargs = {'mac_learning_enabled': False}
port = self.cmgr_adm.ports_client.update_port(port['id'],
**kwargs)['port']
self.assertEqual(port['mac_learning_enabled'],
False,
'Mac learning parameter is not present')
@decorators.idempotent_id('4679459c-32ca-1478-a227-34567ebb45c3')
def test_floatingip_attach_to_router_interface_port(self):
"""
Create lbaas, in it create listener
with barbican certificate and with terminated
https protocol and check https
traffic should work.
With same lb create http listener
with barbican certificate and check
http traffic should work.
"""
topology_dict = self.create_topo_single_network(
"route-port", create_instance=False)
router_state = topology_dict['router_state']
ports = self.cmgr_adm.ports_client.list_ports()
for port in ports['ports']:
if 'device_owner' in port:
if port['device_owner'] == "network:router_interface"\
and port['device_id'] == router_state['id']:
self.assertRaises(
exceptions.BadRequest,
self.create_floatingip,
thing=port,
client=self.cmgr_adm.floating_ips_client,
port_id=port['id'])