From ae39aad92e846cd92d39b890cb97bd73f0cd047a Mon Sep 17 00:00:00 2001 From: Edoardo Putti Date: Tue, 29 Aug 2017 16:35:54 +0200 Subject: [PATCH] [airos] fixed ip_interface text input --- netjsonconfig/backends/airos/converters.py | 4 +++- netjsonconfig/backends/airos/interface.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/netjsonconfig/backends/airos/converters.py b/netjsonconfig/backends/airos/converters.py index 8e312dcca..19d27d544 100644 --- a/netjsonconfig/backends/airos/converters.py +++ b/netjsonconfig/backends/airos/converters.py @@ -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 @@ -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) diff --git a/netjsonconfig/backends/airos/interface.py b/netjsonconfig/backends/airos/interface.py index 0dc0a7473..66688d291 100644 --- a/netjsonconfig/backends/airos/interface.py +++ b/netjsonconfig/backends/airos/interface.py @@ -1,5 +1,7 @@ from ipaddress import ip_interface +from six import text_type + def autonegotiation(interface): """ @@ -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)}