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

made response better for parsing

parent eeab5809
No related branches found
No related tags found
No related merge requests found
......@@ -231,13 +231,16 @@ SERVICES_LIST_SCHEMA = {
'type': 'string',
'pattern': r'^(\d+\.)*\d+$'
},
'counters': {
'counter-field': {
'type': 'object',
'properties': {
'egressOctets': {'$ref': '#/definitions/oid'},
'ingressOctets': {'$ref': '#/definitions/oid'}
'field': {
'type': 'string',
'enum': ['egressOctets', 'ingressOctets']
},
'oid': {'$ref': '#/definitions/oid'}
},
'required': ['egressOctets', 'ingressOctets'],
'required': ['field', 'oid'],
'additionalProperties': False
},
'snmp-info': {
......@@ -245,7 +248,11 @@ SERVICES_LIST_SCHEMA = {
'properties': {
'ifIndex': {'type': 'integer'},
'community': {'type': 'string'},
'counters': {'$ref': '#/definitions/counters'}
'counters': {
'type': 'array',
'items': {'$ref': '#/definitions/counter-field'},
'minItems': 1
}
},
'required': ['ifIndex', 'community'],
'additionalProperties': False
......@@ -852,12 +859,18 @@ def _get_services_internal(service_type=None):
'community': interface_info['community'],
}
if s['type'] == 'GWS - INDIRECT':
s['snmp']['counters'] = {
'ingressOctets': _jnx_dcu_byte_count_oid(
interface_info['index']),
'egressOctets': _jnx_fw_counter_bytes_oid(
s['customer'], s['interface'])
}
s['snmp']['counters'] = [
{
'field': 'ingressOctets',
'oid': _jnx_dcu_byte_count_oid(
interface_info['index']),
},
{
'field': 'egressOctets',
'oid': _jnx_fw_counter_bytes_oid(
s['customer'], s['interface'])
}
]
return s
def _wanted_in_output(s):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment