Skip to content

Commit

Permalink
[airos] fixed ip_interface text input
Browse files Browse the repository at this point in the history
  • Loading branch information
edoput committed Aug 31, 2017
1 parent be01dd3 commit ae39aad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion netjsonconfig/backends/airos/converters.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from copy import deepcopy
from ipaddress import ip_interface

import six

from ...utils import get_copy
from ..base.converter import BaseConverter
from .aaa import bridge_devname, profile_from_interface, status_from_interface
Expand Down Expand Up @@ -479,7 +481,7 @@ def to_intermediate(self):
routes = self.default_routes()
original = get_copy(self.netjson, self.netjson_key, [])
for r in original:
network = ip_interface(r['destination'])
network = ip_interface(six.text_type(r['destination']))
temp = {}
temp['ip'] = str(network.ip)
temp['netmask'] = str(network.netmask)
Expand Down
4 changes: 3 additions & 1 deletion netjsonconfig/backends/airos/interface.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from ipaddress import ip_interface

from six import text_type


def autonegotiation(interface):
"""
Expand Down Expand Up @@ -92,7 +94,7 @@ def split_cidr(address):
"""
Return the address in dict format
"""
network = ip_interface('{addr}/{mask}'.format(addr=address['address'], mask=address['mask']))
network = ip_interface(text_type('{addr}/{mask}'.format(addr=address['address'], mask=address['mask'])))
return {'ip': str(network.ip), 'netmask': str(network.netmask)}


Expand Down

0 comments on commit ae39aad

Please sign in to comment.