Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion smoke_zephyr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import collections

# Semantic Versioning: http://semver.org/spec/v2.0.0.html
version_info = collections.namedtuple('version_info', ['major', 'minor', 'micro'])(2, 0, 1)
version_info = collections.namedtuple('version_info', ['major', 'minor', 'micro'])(2, 0, 2)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For a feature we should be bumping the minor version not the patch.

"""A tuple representing the version information in the format ('major', 'minor', 'micro')"""

version_label = ''
Expand Down
20 changes: 20 additions & 0 deletions smoke_zephyr/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,26 @@ def is_valid_email_address(email_address):
# requirements = re
return EMAIL_REGEX.match(email_address) != None

def get_ip_networks_from_file(filename, strict=True):
"""
Quickly generate a list of IPv4Networks from a file with built-in validation

:param str filename: The file to be parsed
:param bool strict: If true, raises errors when invalid networks are encountered.
:return: list
"""
with open(filename) as fin:
lst = []
for x in fin.readlines():
try:
lst.append(ipaddress.ip_network(x.strip()))
except ValueError as err:
if strict:
raise err
else:
continue
return lst

def get_ip_list(ip_network, mask=None):
"""
Quickly convert an IPv4 or IPv6 network (CIDR or Subnet) to a list
Expand Down