From 0c32a4b93fedb6e94e4e1b56368336ec2b3beffe Mon Sep 17 00:00:00 2001 From: Junaid Ali Date: Thu, 12 May 2016 05:35:22 -0700 Subject: [PATCH] External interface can be set as a string --- hooks/pg_gw_utils.py | 22 ++++++---------------- templates/kilo/ifcs.conf | 6 +----- 2 files changed, 7 insertions(+), 21 deletions(-) diff --git a/hooks/pg_gw_utils.py b/hooks/pg_gw_utils.py index 57a9632..46a4fdb 100644 --- a/hooks/pg_gw_utils.py +++ b/hooks/pg_gw_utils.py @@ -267,22 +267,12 @@ def get_gw_interfaces(): Gateway node can have multiple interfaces. This function parses json provided in config to get all gateway interfaces for this node. ''' - node_interfaces = [] - try: - all_interfaces = json.loads(config('external-interfaces')) - except ValueError: - raise ValueError("Invalid json provided for gateway interfaces") - hostname = get_unit_hostname() - if hostname in all_interfaces: - node_interfaces = all_interfaces[hostname].split(',') - elif 'DEFAULT' in all_interfaces: - node_interfaces = all_interfaces['DEFAULT'].split(',') - for interface in node_interfaces: - if not interface_exists(interface): - log('Provided gateway interface %s does not exist' - % interface) - raise ValueError('Provided gateway interface does not exist') - return node_interfaces + interface = config('external-interfaces') + if not interface_exists(interface): + log('Provided gateway interface %s does not exist' + % interface) + raise ValueError('Provided gateway interface does not exist') + return interface def ensure_mtu(): diff --git a/templates/kilo/ifcs.conf b/templates/kilo/ifcs.conf index 657fbd5..5e05ef2 100644 --- a/templates/kilo/ifcs.conf +++ b/templates/kilo/ifcs.conf @@ -1,7 +1,3 @@ {{ fabric_interface }} = fabric_core host -{% if ext_interfaces -%} -{% for ip in ext_interfaces -%} -{{ ip }} = access_phys -{% endfor -%} -{% endif -%} +{{ ext_interfaces }} = access_phys