Skip to content
Snippets Groups Projects
Commit 13710aaa authored by Erik Reid's avatar Erik Reid
Browse files

added optional info field to gws direct input & output config schema

parent 068abc48
Branches
Tags
No related merge requests found
...@@ -111,6 +111,7 @@ CONFIG_SCHEMA = { ...@@ -111,6 +111,7 @@ CONFIG_SCHEMA = {
'gws-direct-interface': { 'gws-direct-interface': {
'type': 'object', 'type': 'object',
'properties': { 'properties': {
'info': {'type': 'string'},
'tag': {'type': 'string'}, 'tag': {'type': 'string'},
'counters': {'$ref': '#/definitions/gws-direct-counters'} 'counters': {'$ref': '#/definitions/gws-direct-counters'}
}, },
......
...@@ -309,7 +309,8 @@ GWS_DIRECT_DATA_SCHEMA = { ...@@ -309,7 +309,8 @@ GWS_DIRECT_DATA_SCHEMA = {
'type': 'array', 'type': 'array',
'items': {'$ref': '#/definitions/counter'}, 'items': {'$ref': '#/definitions/counter'},
'minItems': 1 'minItems': 1
} },
'info': {'type': 'string'}
}, },
'required': [ 'required': [
'nren', 'isp', 'hostname', 'tag', 'counters'], 'nren', 'isp', 'hostname', 'tag', 'counters'],
...@@ -1003,7 +1004,7 @@ def gws_direct(): ...@@ -1003,7 +1004,7 @@ def gws_direct():
snmp_params['priv'] = host['priv'] snmp_params['priv'] = host['priv']
for ifc in host['interfaces']: for ifc in host['interfaces']:
yield { ifc_data = {
'nren': nren_isp['nren'], 'nren': nren_isp['nren'],
'isp': nren_isp['isp'], 'isp': nren_isp['isp'],
'hostname': host['hostname'], 'hostname': host['hostname'],
...@@ -1016,6 +1017,8 @@ def gws_direct(): ...@@ -1016,6 +1017,8 @@ def gws_direct():
} }
for k, v in ifc['counters'].items()] for k, v in ifc['counters'].items()]
} }
if 'info' in ifc:
ifc_data['info'] = ifc['info']
result = json.dumps(list(_interfaces())) result = json.dumps(list(_interfaces()))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment