impactor support and highline 313 cibot fixes
Change-Id: I3c40a5ab5d3257ec22350214fb4e9e015354aa54
This commit is contained in:
parent
47a82b37ff
commit
1c92e82ee0
|
@ -194,6 +194,27 @@ class NSXPClient(object):
|
|||
if 'os-project-id' in tag.values()]
|
||||
return os_resources
|
||||
|
||||
def verify_realized_state(self, nsx_resources):
|
||||
"""
|
||||
Verify realized state of nsx resource
|
||||
"""
|
||||
if nsx_resources['path']:
|
||||
endpoint = ("realized-state/realized-entities?intent_path=%s"
|
||||
% (nsx_resources['path']))
|
||||
realize_state = self.get_logical_resources(endpoint)
|
||||
if realize_state is not None:
|
||||
com_list = [c['state'] for c in realize_state]
|
||||
if com_list.count("REALIZED") == len(realize_state):
|
||||
LOG.info("%s nsx_resources is realized" % nsx_resources)
|
||||
state = True
|
||||
else:
|
||||
LOG.error(" %s nsx_resources is not realized" % nsx_resources)
|
||||
state = False
|
||||
else:
|
||||
LOG.warning("Path fo nsx resource is not set!")
|
||||
state = False
|
||||
return state
|
||||
|
||||
def get_nsx_resource_by_name(self, nsx_resources, nsx_name):
|
||||
"""
|
||||
Get the NSX component created from OpenStack by name.
|
||||
|
|
|
@ -167,6 +167,13 @@ class NSXV3Client(object):
|
|||
data=jsonutils.dumps(body))
|
||||
return response
|
||||
|
||||
def get_product_version(self, endpoint):
|
||||
version = self.get(endpoint)
|
||||
res_json = version.json()
|
||||
product_version = res_json['product_version']
|
||||
product_version = (".".join(product_version.split('.')[0:2]))
|
||||
return float(product_version)
|
||||
|
||||
def get_logical_resources(self, endpoint):
|
||||
"""
|
||||
Get logical resources based on the endpoint
|
||||
|
@ -445,8 +452,12 @@ class NSXV3Client(object):
|
|||
"present in order to query backend nsgroup created")
|
||||
return None
|
||||
if nsxp:
|
||||
nsx_name = os_name + "_" + os_uuid[:5] + "..." + os_uuid[-5:]
|
||||
nsx_name = os_tenant_id + '.' + nsx_name
|
||||
product_version = self.get_product_version('/node/version')
|
||||
if product_version >= 3.2:
|
||||
nsx_name = os_name + "_" + os_uuid[:5] + "..." + os_uuid[-5:]
|
||||
else:
|
||||
nsx_name = os_name + "_" + os_uuid[:5] + "..." + os_uuid[-5:]
|
||||
nsx_name = os_tenant_id + '.' + nsx_name
|
||||
else:
|
||||
nsx_name = os_name + " - " + os_uuid
|
||||
nsgroups = self.get_ns_groups()
|
||||
|
|
|
@ -73,7 +73,10 @@ class NSXv3MacLearningTest(base.BaseNetworkTest):
|
|||
nsx_mac_profile_id)
|
||||
# Get mac-learning state for port
|
||||
nsxport_mac_learning_p = nsx_mac_profile['mac_learning_enabled']
|
||||
self.assertIsNotNone(nsx_mac_profile['realization_id'])
|
||||
if 'realization_id' in nsx_mac_profile.keys():
|
||||
self.assertIsNotNone(nsx_mac_profile['realization_id'])
|
||||
r_state = self.nsxp.verify_realized_state(nsx_mac_profile)
|
||||
self.assertTrue(r_state)
|
||||
# Get nsxv3 port(expects 'name' set)
|
||||
nsx_port = self.nsx.get_logical_port(port['name'])
|
||||
# Get list of logical port's switch profiles
|
||||
|
@ -86,20 +89,18 @@ class NSXv3MacLearningTest(base.BaseNetworkTest):
|
|||
# Get MAC learning switch profile json
|
||||
mac_sw_profile_json = self.nsx.get_switching_profile(
|
||||
mac_sw_prof_id)
|
||||
mac_learn_set_bool = False
|
||||
# Get mac-learning state for port
|
||||
if ('mac_learning' in mac_sw_profile_json):
|
||||
nsxport_mac_learning_v3 = mac_sw_profile_json[
|
||||
'mac_learning']['enabled']
|
||||
if nsxport_mac_learning_v3:
|
||||
mac_learn_set_bool_v3 = True
|
||||
mac_learn_set_bool = True
|
||||
if CONF.network.backend == 'nsxp':
|
||||
if nsxport_mac_learning_p:
|
||||
mac_learn_set_bool_p = True
|
||||
if mac_learn_set_bool_p and mac_learn_set_bool_v3:
|
||||
if nsxport_mac_learning_p and nsxport_mac_learning_v3:
|
||||
mac_learn_set_bool = True
|
||||
return mac_learn_set_bool
|
||||
return mac_learn_set_bool_v3
|
||||
else:
|
||||
mac_learn_set_bool = False
|
||||
return mac_learn_set_bool
|
||||
|
||||
def _create_mac_learn_enabled_port(self, network):
|
||||
# Create Port with required port security/sec groups config
|
||||
|
|
|
@ -66,7 +66,10 @@ class NSXv3RoutersTest(base.BaseAdminNetworkTest):
|
|||
nsx_router = self.nsxp.get_logical_router(router['name'],
|
||||
router['id'])
|
||||
self.assertIsNotNone(nsx_router)
|
||||
self.assertIsNotNone(nsx_router['realization_id'])
|
||||
if 'realization_id' in nsx_router.keys():
|
||||
self.assertIsNotNone(nsx_router['realization_id'])
|
||||
r_state = self.nsxp.verify_realized_state(nsx_router)
|
||||
self.assertTrue(r_state)
|
||||
nsx_router = self.nsx.get_logical_router(router['name'],
|
||||
router['id'])
|
||||
self.assertEqual(router['name'], router_name)
|
||||
|
@ -83,7 +86,10 @@ class NSXv3RoutersTest(base.BaseAdminNetworkTest):
|
|||
nsx_router = self.nsxp.get_logical_router(updated_router['name'],
|
||||
updated_router['id'])
|
||||
self.assertIsNotNone(nsx_router)
|
||||
self.assertIsNotNone(nsx_router['realization_id'])
|
||||
if 'realization_id' in nsx_router.keys():
|
||||
self.assertIsNotNone(nsx_router['realization_id'])
|
||||
r_state = self.nsxp.verify_realized_state(nsx_router)
|
||||
self.assertTrue(r_state)
|
||||
nsx_router = self.nsx.get_logical_router(updated_router['name'],
|
||||
updated_router['id'])
|
||||
self.assertEqual(updated_router['name'], updated_name)
|
||||
|
@ -100,7 +106,10 @@ class NSXv3RoutersTest(base.BaseAdminNetworkTest):
|
|||
nsx_router = self.nsxp.get_logical_router(router['name'],
|
||||
router['id'])
|
||||
self.assertIsNotNone(nsx_router)
|
||||
self.assertIsNotNone(nsx_router['realization_id'])
|
||||
if 'realization_id' in nsx_router.keys():
|
||||
self.assertIsNotNone(nsx_router['realization_id'])
|
||||
r_state = self.nsxp.verify_realized_state(nsx_router)
|
||||
self.assertTrue(r_state)
|
||||
nsx_router = self.nsx.get_logical_router(router['name'],
|
||||
router['id'])
|
||||
self.assertEqual(router['name'], router_name)
|
||||
|
@ -137,7 +146,10 @@ class NSXv3RoutersTest(base.BaseAdminNetworkTest):
|
|||
nsx_router = self.nsxp.get_logical_router(body['name'], body['id'])
|
||||
self.assertEqual(body['name'], router_name)
|
||||
self.assertIsNotNone(nsx_router)
|
||||
self.assertIsNotNone(nsx_router['realization_id'])
|
||||
if 'realization_id' in nsx_router.keys():
|
||||
self.assertIsNotNone(nsx_router['realization_id'])
|
||||
r_state = self.nsxp.verify_realized_state(nsx_router)
|
||||
self.assertTrue(r_state)
|
||||
self.assertEqual(nsx_router.get('enable_standby_relocation'), True)
|
||||
nsx_router = self.nsx.get_logical_router(body['name'], body['id'])
|
||||
self.assertEqual(body['name'], router_name)
|
||||
|
@ -159,14 +171,22 @@ class NSXv3RoutersTest(base.BaseAdminNetworkTest):
|
|||
nsx_router = self.nsxp.get_logical_router(body['name'], body['id'])
|
||||
self.assertEqual(body['name'], router_name)
|
||||
self.assertIsNotNone(nsx_router)
|
||||
self.assertIsNotNone(nsx_router['realization_id'])
|
||||
if 'realization_id' in nsx_router.keys():
|
||||
self.assertIsNotNone(nsx_router['realization_id'])
|
||||
r_state = self.nsxp.verify_realized_state(nsx_router)
|
||||
self.assertTrue(r_state)
|
||||
self.assertEqual(nsx_router.get(
|
||||
'enable_standby_relocation'), False)
|
||||
nsx_router = self.nsx.get_logical_router(body['name'], body['id'])
|
||||
self.assertEqual(body['name'], router_name)
|
||||
self.assertIsNotNone(nsx_router)
|
||||
self.assertEqual(nsx_router.get('allocation_profile').get(
|
||||
'enable_standby_relocation'), False)
|
||||
product_version = self.nsx.get_product_version('/node/version')
|
||||
if product_version >= 3.2:
|
||||
self.assertEqual('enable_standby_relocation' in nsx_router.get(
|
||||
'allocation_profile').keys(), False)
|
||||
else:
|
||||
self.assertEqual(nsx_router.get('allocation_profile').get(
|
||||
'enable_standby_relocation'), False)
|
||||
|
||||
public_network_info = {"external_gateway_info":
|
||||
dict(network_id=CONF.network.public_network_id)}
|
||||
|
@ -177,7 +197,10 @@ class NSXv3RoutersTest(base.BaseAdminNetworkTest):
|
|||
nsx_router = self.nsxp.get_logical_router(body['name'], body['id'])
|
||||
self.assertEqual(body['name'], router_name)
|
||||
self.assertIsNotNone(nsx_router)
|
||||
self.assertIsNotNone(nsx_router['realization_id'])
|
||||
if 'realization_id' in nsx_router.keys():
|
||||
self.assertIsNotNone(nsx_router['realization_id'])
|
||||
r_state = self.nsxp.verify_realized_state(nsx_router)
|
||||
self.assertTrue(r_state)
|
||||
self.assertEqual(nsx_router.get('enable_standby_relocation'), True)
|
||||
nsx_router = self.nsx.get_logical_router(body['name'], body['id'])
|
||||
self.assertEqual(body['name'], router_name)
|
||||
|
@ -193,7 +216,10 @@ class NSXv3RoutersTest(base.BaseAdminNetworkTest):
|
|||
nsx_router = self.nsxp.get_logical_router(body['name'], body['id'])
|
||||
self.assertEqual(body['name'], router_name)
|
||||
self.assertIsNotNone(nsx_router)
|
||||
self.assertIsNotNone(nsx_router['realization_id'])
|
||||
if 'realization_id' in nsx_router.keys():
|
||||
self.assertIsNotNone(nsx_router['realization_id'])
|
||||
r_state = self.nsxp.verify_realized_state(nsx_router)
|
||||
self.assertTrue(r_state)
|
||||
self.assertEqual(nsx_router.get(
|
||||
'enable_standby_relocation'), False)
|
||||
nsx_router = self.nsx.get_logical_router(body['name'], body['id'])
|
||||
|
|
|
@ -103,12 +103,19 @@ class NSXv3SecGroupTest(base.BaseSecGroupTest):
|
|||
secgroup['name'], secgroup['id'],
|
||||
os_tenant_id=tenant_id)
|
||||
self.assertIsNotNone(nsx_nsgroup_policy)
|
||||
self.assertIsNotNone(nsx_nsgroup_policy['realization_id'])
|
||||
if 'realization_id' in nsx_nsgroup_policy.keys():
|
||||
r_state \
|
||||
= self.nsxp.verify_realized_state(nsx_nsgroup_policy)
|
||||
self.assertTrue(r_state)
|
||||
self.assertIsNotNone(nsx_nsgroup_policy['realization_id'])
|
||||
nsx_dfw_section_policy = self.nsxp.get_firewall_section(
|
||||
secgroup['name'], secgroup['id'],
|
||||
os_tenant_id=tenant_id)
|
||||
self.assertIsNotNone(nsx_dfw_section_policy, dfw_error_msg)
|
||||
self.assertIsNotNone(nsx_dfw_section_policy['realization_id'])
|
||||
if 'realization_id' in nsx_dfw_section_policy.keys():
|
||||
r_state = \
|
||||
self.nsxp.verify_realized_state(nsx_dfw_section_policy)
|
||||
self.assertTrue(r_state)
|
||||
nsx_nsgroup = self.nsx.get_ns_group(
|
||||
secgroup['name'], secgroup['id'], nsxp=True,
|
||||
os_tenant_id=tenant_id)
|
||||
|
@ -161,7 +168,8 @@ class NSXv3SecGroupTest(base.BaseSecGroupTest):
|
|||
nsx_dfw_section_policy,
|
||||
secgroup_rule['id'], 'default')
|
||||
self.assertIsNotNone(nsx_dfw_rule)
|
||||
self.assertIsNotNone(nsx_dfw_rule['realization_id'])
|
||||
if 'realization_id' in nsx_dfw_rule.keys():
|
||||
self.assertIsNotNone(nsx_dfw_rule['realization_id'])
|
||||
nsx_dfw_rule = self.nsx.get_firewall_section_rule(
|
||||
nsx_dfw_section, secgroup_rule['id'])
|
||||
self.assertIsNotNone(nsx_dfw_rule)
|
||||
|
@ -242,19 +250,19 @@ class NSXv3SecGroupTest(base.BaseSecGroupTest):
|
|||
secgroup['name'], secgroup['id'],
|
||||
os_tenant_id='default')
|
||||
self.assertIsNone(nsx_nsgroup_policy)
|
||||
self.assertIsNotNone(nsx_nsgroup_policy['realization_id'])
|
||||
if 'realization_id' in nsx_nsgroup_policy.keys():
|
||||
self.assertIsNotNone(nsx_nsgroup_policy['realization_id'])
|
||||
nsx_dfw_section_policy = self.nsxp.get_firewall_section(
|
||||
secgroup['name'], secgroup['id'],
|
||||
os_tenant_id='default')
|
||||
self.assertIsNone(nsx_dfw_section_policy, dfw_error_msg)
|
||||
self.assertIsNotNone(nsx_dfw_section_policy['realization_id'])
|
||||
if 'realization_id' in nsx_dfw_section_policy.keys():
|
||||
self.assertIsNotNone(nsx_dfw_section_policy['realization_id'])
|
||||
nsx_nsgroup = self.nsxp.get_ns_group(
|
||||
secgroup['name'], secgroup['id'], nsxp=True,
|
||||
os_tenant_id='default')
|
||||
self.assertIsNotNone(nsx_nsgroup['realization_id'])
|
||||
nsx_dfw_section = self.nsxp.get_firewall_section(
|
||||
secgroup['name'], secgroup['id'], nsxp=True)
|
||||
self.assertIsNotNone(nsx_dfw_section['realization_id'])
|
||||
else:
|
||||
nsx_nsgroup = self.nsx.get_ns_group(secgroup['name'],
|
||||
secgroup['id'])
|
||||
|
@ -314,7 +322,6 @@ class NSXv3SecGroupTest(base.BaseSecGroupTest):
|
|||
nsx_dfw_section_policy,
|
||||
secgroup_rule['id'], 'default')
|
||||
self.assertIsNotNone(nsx_dfw_rule)
|
||||
self.assertIsNotNone(nsx_dfw_rule['realization_id'])
|
||||
nsx_dfw_rule = self.nsx.get_firewall_section_rule(
|
||||
nsx_dfw_section, secgroup_rule['id'])
|
||||
self.assertIsNotNone(nsx_dfw_rule)
|
||||
|
@ -368,7 +375,8 @@ class NSXv3SecGroupTest(base.BaseSecGroupTest):
|
|||
nsx_dfw_rule = self.nsxp.get_firewall_section_rule(
|
||||
nsx_dfw_section_policy, secgroup_rule['id'], 'default')
|
||||
self.assertIsNotNone(nsx_dfw_rule)
|
||||
self.assertIsNotNone(nsx_dfw_rule['realization_id'])
|
||||
if 'realization_id' in nsx_dfw_rule.keys():
|
||||
self.assertIsNotNone(nsx_dfw_rule['realization_id'])
|
||||
nsx_dfw_rule = self.nsx.get_firewall_section_rule(
|
||||
nsx_dfw_section, secgroup_rule['id'])
|
||||
self.assertIsNotNone(nsx_dfw_rule)
|
||||
|
@ -421,7 +429,9 @@ class NSXv3SecGroupTest(base.BaseSecGroupTest):
|
|||
nsx_dfw_section_policy,
|
||||
secgroup_rule['id'], 'default')
|
||||
self.assertIsNotNone(nsx_dfw_rule)
|
||||
self.assertIsNotNone(nsx_dfw_rule['realization_id'])
|
||||
if 'realization_id' in nsx_dfw_rule.keys():
|
||||
self.assertTrue(self.nsxp.veriy_realized_state(nsx_dfw_rule))
|
||||
self.assertIsNotNone(nsx_dfw_rule['realization_id'])
|
||||
nsx_dfw_rule = self.nsx.get_firewall_section_rule(
|
||||
nsx_dfw_section, secgroup_rule['id'])
|
||||
self.assertIsNotNone(nsx_dfw_rule)
|
||||
|
|
Loading…
Reference in New Issue