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

Finished feature gws-gui-info-in-config.

parents 068abc48 cd5e9a75
No related branches found
No related tags found
No related merge requests found
......@@ -111,6 +111,7 @@ CONFIG_SCHEMA = {
'gws-direct-interface': {
'type': 'object',
'properties': {
'info': {'type': 'string'},
'tag': {'type': 'string'},
'counters': {'$ref': '#/definitions/gws-direct-counters'}
},
......
......@@ -309,7 +309,8 @@ GWS_DIRECT_DATA_SCHEMA = {
'type': 'array',
'items': {'$ref': '#/definitions/counter'},
'minItems': 1
}
},
'info': {'type': 'string'}
},
'required': [
'nren', 'isp', 'hostname', 'tag', 'counters'],
......@@ -1003,7 +1004,7 @@ def gws_direct():
snmp_params['priv'] = host['priv']
for ifc in host['interfaces']:
yield {
ifc_data = {
'nren': nren_isp['nren'],
'isp': nren_isp['isp'],
'hostname': host['hostname'],
......@@ -1016,6 +1017,9 @@ def gws_direct():
}
for k, v in ifc['counters'].items()]
}
if 'info' in ifc:
ifc_data['info'] = ifc['info']
yield ifc_data
result = json.dumps(list(_interfaces()))
......
......@@ -264,6 +264,7 @@
"interfaces": [
{
"tag": "a",
"info": "Some PSNC CenturyLink text, interface XX-9/9/9.123 #123",
"counters": {
"traffic_in": "1.3.6.1.2.1.31.1.1.1.6.675",
"traffic_out": "1.3.6.1.2.1.31.1.1.1.10.675"
......@@ -304,6 +305,7 @@
"interfaces": [
{
"tag": "a",
"info": "Some HEANET CenturyLink text",
"counters": {
"traffic_in": "1.3.6.1.2.1.31.1.1.1.6.645",
"traffic_out": "1.3.6.1.2.1.31.1.1.1.10.645"
......
......@@ -76,7 +76,7 @@ def test_gws_direct(client):
assert rv.is_json
response_data = json.loads(rv.data.decode('utf-8'))
jsonschema.validate(response_data, poller.GWS_DIRECT_DATA_SCHEMA)
assert response_data, "the subscription list shouldn't be empty"
assert response_data, "the service list shouldn't be empty"
def test_gws_indirect(client):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment