summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunaid Ali <junaidali@plumgrid.com>2016-05-12 05:35:22 -0700
committerJunaid Ali <junaidali@plumgrid.com>2016-05-12 05:35:22 -0700
commit0c32a4b93fedb6e94e4e1b56368336ec2b3beffe (patch)
treef6ce1dab630bb00e9c975d703285f4c5879d32c2
parent2212d1eae1d466eb547246d626d76a72c7a2cd88 (diff)
External interface can be set as a string
-rw-r--r--hooks/pg_gw_utils.py22
-rw-r--r--templates/kilo/ifcs.conf6
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():
267 Gateway node can have multiple interfaces. This function parses json 267 Gateway node can have multiple interfaces. This function parses json
268 provided in config to get all gateway interfaces for this node. 268 provided in config to get all gateway interfaces for this node.
269 ''' 269 '''
270 node_interfaces = [] 270 interface = config('external-interfaces')
271 try: 271 if not interface_exists(interface):
272 all_interfaces = json.loads(config('external-interfaces')) 272 log('Provided gateway interface %s does not exist'
273 except ValueError: 273 % interface)
274 raise ValueError("Invalid json provided for gateway interfaces") 274 raise ValueError('Provided gateway interface does not exist')
275 hostname = get_unit_hostname() 275 return interface
276 if hostname in all_interfaces:
277 node_interfaces = all_interfaces[hostname].split(',')
278 elif 'DEFAULT' in all_interfaces:
279 node_interfaces = all_interfaces['DEFAULT'].split(',')
280 for interface in node_interfaces:
281 if not interface_exists(interface):
282 log('Provided gateway interface %s does not exist'
283 % interface)
284 raise ValueError('Provided gateway interface does not exist')
285 return node_interfaces
286 276
287 277
288def ensure_mtu(): 278def 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 @@
1{{ fabric_interface }} = fabric_core host 1{{ fabric_interface }} = fabric_core host
2{% if ext_interfaces -%} 2{{ ext_interfaces }} = access_phys
3{% for ip in ext_interfaces -%}
4{{ ip }} = access_phys
5{% endfor -%}
6{% endif -%}
7 3