Code Review
/
vvp
/
validation-scripts.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
[VVP] Modifies uses_sr_iov function in structures.py to return sr_iov true when vnic_...
[vvp/validation-scripts.git]
/
ice_validator
/
tests
/
structures.py
diff --git
a/ice_validator/tests/structures.py
b/ice_validator/tests/structures.py
index
9c47b80
..
5e81587
100644
(file)
--- a/
ice_validator/tests/structures.py
+++ b/
ice_validator/tests/structures.py
@@
-85,13
+85,19
@@
class HeatProcessor(object):
# regex parses the proper resource id format.
@staticmethod
# regex parses the proper resource id format.
@staticmethod
- def get_param_value(value):
+ def get_param_value(value
, withIndex=False
):
"""Return get_param value of `value`
"""
if isinstance(value, dict) and len(value) == 1:
v = value.get("get_param")
if isinstance(v, list) and v:
"""Return get_param value of `value`
"""
if isinstance(value, dict) and len(value) == 1:
v = value.get("get_param")
if isinstance(v, list) and v:
- v = v[0]
+ if withIndex and len(v) > 1:
+ idx = v[1]
+ if isinstance(idx, dict):
+ idx = idx.get("get_param", idx)
+ v = "{}{}".format(v[0], idx)
+ else:
+ v = v[0]
else:
v = None
return v
else:
v = None
return v
@@
-161,7
+167,7
@@
class HeatProcessor(object):
# are replaced in the template in arbitrary order.
name = template
for key, value in params.items():
# are replaced in the template in arbitrary order.
name = template
for key, value in params.items():
- param = cls.get_param_value(value)
+ param = cls.get_param_value(value
, withIndex=True
)
if param is None:
return None
name = name.replace(key, str(param))
if param is None:
return None
name = name.replace(key, str(param))
@@
-223,7
+229,7
@@
class ContrailV2NetworkFlavorBaseProcessor(HeatProcessor):
network_flavor_external = "external"
network_flavor_internal = "internal"
network_flavor_external = "external"
network_flavor_internal = "internal"
- network_flavor_subint = "subint"
+ network_flavor_subint = "subint
erface
"
@classmethod
def get_network_flavor(cls, resource):
@classmethod
def get_network_flavor(cls, resource):
@@
-264,7
+270,7
@@
class ContrailV2InstanceIpProcessor(ContrailV2NetworkFlavorBaseProcessor):
re_rids = collections.OrderedDict(
[
(
re_rids = collections.OrderedDict(
[
(
- "int
_ip
",
+ "int
ernal
",
_get_regex(
r"(?P<vm_type>.+)"
r"_(?P<vm_type_index>\d+)"
_get_regex(
r"(?P<vm_type>.+)"
r"_(?P<vm_type_index>\d+)"
@@
-272,27
+278,14
@@
class ContrailV2InstanceIpProcessor(ContrailV2NetworkFlavorBaseProcessor):
r"_(?P<network_role>.+)"
r"_vmi"
r"_(?P<vmi_index>\d+)"
r"_(?P<network_role>.+)"
r"_vmi"
r"_(?P<vmi_index>\d+)"
+ r"(_v6)?"
r"_IP"
r"_(?P<index>\d+)"
r"$"
),
),
(
r"_IP"
r"_(?P<index>\d+)"
r"$"
),
),
(
- "int_v6_ip",
- _get_regex(
- r"(?P<vm_type>.+)"
- r"_(?P<vm_type_index>\d+)"
- r"_int"
- r"_(?P<network_role>.+)"
- r"_vmi"
- r"_(?P<vmi_index>\d+)"
- r"_v6_IP"
- r"_(?P<index>\d+)"
- r"$"
- ),
- ),
- (
- "subint_ip",
+ "subinterface",
_get_regex(
r"(?P<vm_type>.+)"
r"_(?P<vm_type_index>\d+)"
_get_regex(
r"(?P<vm_type>.+)"
r"_(?P<vm_type_index>\d+)"
@@
-300,51
+293,26
@@
class ContrailV2InstanceIpProcessor(ContrailV2NetworkFlavorBaseProcessor):
r"_(?P<network_role>.+)"
r"_vmi"
r"_(?P<vmi_index>\d+)"
r"_(?P<network_role>.+)"
r"_vmi"
r"_(?P<vmi_index>\d+)"
+ r"(_v6)?"
r"_IP"
r"_(?P<index>\d+)"
r"$"
),
),
(
r"_IP"
r"_(?P<index>\d+)"
r"$"
),
),
(
- "subint_v6_ip",
- _get_regex(
- r"(?P<vm_type>.+)"
- r"_(?P<vm_type_index>\d+)"
- r"_subint"
- r"_(?P<network_role>.+)"
- r"_vmi"
- r"_(?P<vmi_index>\d+)"
- r"_v6_IP"
- r"_(?P<index>\d+)"
- r"$"
- ),
- ),
- (
- "ip",
+ "external",
_get_regex(
r"(?P<vm_type>.+)"
r"_(?P<vm_type_index>\d+)"
r"_(?P<network_role>.+)"
r"_vmi"
r"_(?P<vmi_index>\d+)"
_get_regex(
r"(?P<vm_type>.+)"
r"_(?P<vm_type_index>\d+)"
r"_(?P<network_role>.+)"
r"_vmi"
r"_(?P<vmi_index>\d+)"
+ r"(_v6)?"
r"_IP"
r"_(?P<index>\d+)"
r"$"
),
),
r"_IP"
r"_(?P<index>\d+)"
r"$"
),
),
- (
- "v6_ip",
- _get_regex(
- r"(?P<vm_type>.+)"
- r"_(?P<vm_type_index>\d+)"
- r"_(?P<network_role>.+)"
- r"_vmi"
- r"_(?P<vmi_index>\d+)"
- r"_v6_IP"
- r"_(?P<index>\d+)"
- r"$"
- ),
- ),
]
)
]
)
@@
-406,7
+374,7
@@
class ContrailV2VirtualMachineInterfaceProcessor(ContrailV2NetworkFlavorBaseProc
re_rids = collections.OrderedDict(
[
(
re_rids = collections.OrderedDict(
[
(
- "
vmi_
internal",
+ "internal",
_get_regex(
r"(?P<vm_type>.+)"
r"_(?P<vm_type_index>\d+)"
_get_regex(
r"(?P<vm_type>.+)"
r"_(?P<vm_type_index>\d+)"
@@
-418,7
+386,7
@@
class ContrailV2VirtualMachineInterfaceProcessor(ContrailV2NetworkFlavorBaseProc
),
),
(
),
),
(
- "
vmi_subint
",
+ "
subinterface
",
_get_regex(
r"(?P<vm_type>.+)"
r"_(?P<vm_type_index>\d+)"
_get_regex(
r"(?P<vm_type>.+)"
r"_(?P<vm_type_index>\d+)"
@@
-430,7
+398,7
@@
class ContrailV2VirtualMachineInterfaceProcessor(ContrailV2NetworkFlavorBaseProc
),
),
(
),
),
(
- "
vmi_
external",
+ "external",
_get_regex(
r"(?P<vm_type>.+)"
r"_(?P<vm_type_index>\d+)"
_get_regex(
r"(?P<vm_type>.+)"
r"_(?P<vm_type_index>\d+)"
@@
-452,7
+420,7
@@
class ContrailV2VirtualNetworkProcessor(HeatProcessor):
re_rids = collections.OrderedDict(
[
("network", _get_regex(r"int" r"_(?P<network_role>.+)" r"_network" r"$")),
re_rids = collections.OrderedDict(
[
("network", _get_regex(r"int" r"_(?P<network_role>.+)" r"_network" r"$")),
- ("rvn", _get_regex(r"int" r"_(?P<network_role>.+)" r"_RVN" r"$")),
+
#
("rvn", _get_regex(r"int" r"_(?P<network_role>.+)" r"_RVN" r"$")),
]
)
]
)
@@
-498,7
+466,7
@@
class NeutronPortProcessor(HeatProcessor):
re_rids = collections.OrderedDict(
[
(
re_rids = collections.OrderedDict(
[
(
- "internal
_port
",
+ "internal",
_get_regex(
r"(?P<vm_type>.+)"
r"_(?P<vm_type_index>\d+)"
_get_regex(
r"(?P<vm_type>.+)"
r"_(?P<vm_type_index>\d+)"
@@
-509,7
+477,7
@@
class NeutronPortProcessor(HeatProcessor):
),
),
(
),
),
(
- "
port
",
+ "
external
",
_get_regex(
r"(?P<vm_type>.+)"
r"_(?P<vm_type_index>\d+)"
_get_regex(
r"(?P<vm_type>.+)"
r"_(?P<vm_type_index>\d+)"
@@
-518,26
+486,6
@@
class NeutronPortProcessor(HeatProcessor):
r"$"
),
),
r"$"
),
),
- (
- "floating_ip",
- _get_regex(
- r"reserve_port"
- r"_(?P<vm_type>.+)"
- r"_(?P<network_role>.+)"
- r"_floating_ip_(?P<index>\d+)"
- r"$"
- ),
- ),
- (
- "floating_v6_ip",
- _get_regex(
- r"reserve_port"
- r"_(?P<vm_type>.+)"
- r"_(?P<network_role>.+)"
- r"_floating_v6_ip_(?P<index>\d+)"
- r"$"
- ),
- ),
]
)
]
)
@@
-546,11
+494,11
@@
class NeutronPortProcessor(HeatProcessor):
"""Returns True/False as `resource` is/not
An OS::Nova:Port with the property binding:vnic_type
"""
"""Returns True/False as `resource` is/not
An OS::Nova:Port with the property binding:vnic_type
"""
- re
turn nested_dict.get(
- resource, "type"
- ) == cls.resource_type and "binding:vnic_type" in nested_dict.get(
- resource, "properties", default={}
- )
+ re
source_properties = nested_dict.get(resource, "properties", default={})
+ if nested_dict.get(resource, "type") == cls.resource_type and resource_properties.get("binding:vnic_type", "") == "direct":
+ return True
+
+ return False
class NovaServerProcessor(HeatProcessor):
class NovaServerProcessor(HeatProcessor):