Commit 15657d87 authored by Ad Schellevis's avatar Ad Schellevis

(configd) add netaddr.IPNetwork to template helpers, for...

(configd) add netaddr.IPNetwork to template helpers, for https://github.com/opnsense/core/issues/1309
parent 99dac4ab
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
""" """
from operator import itemgetter from operator import itemgetter
import netaddr
# noinspection PyPep8Naming # noinspection PyPep8Naming
...@@ -105,3 +106,11 @@ class Helpers(object): ...@@ -105,3 +106,11 @@ class Helpers(object):
return self._template_in_data['__uuid__'][uuid] return self._template_in_data['__uuid__'][uuid]
else: else:
return {} return {}
@staticmethod
def getIPNetwork(network):
""" generate network object using netaddr
:param network: network
:return: IPNetwork
"""
return netaddr.IPNetwork(network)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment