Skip to content

Commit

Permalink
Add profile linksys (#15372)
Browse files Browse the repository at this point in the history
* Add profile linksys

* add metadata

* add snmprec

* add e2e test

* fix style
  • Loading branch information
AlexandreYang authored Jul 25, 2023
1 parent 674091a commit 51a37d6
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
10 changes: 10 additions & 0 deletions snmp/datadog_checks/snmp/data/default_profiles/linksys.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
extends:
- _base.yaml
- _generic-if.yaml
metadata:
device:
fields:
vendor:
value: "linksys"
sysobjectid:
- 1.3.6.1.4.1.3955.*
4 changes: 4 additions & 0 deletions snmp/tests/compose/data/linksys.snmprec
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
1.3.6.1.2.1.1.1.0|4|linksys Device Description
1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.3955.999
1.3.6.1.2.1.1.5.0|4|linksys.device.name
1.3.6.1.2.1.2.1.0|2|28
56 changes: 56 additions & 0 deletions snmp/tests/test_e2e_core_profiles/test_profile_linksys.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# (C) Datadog, Inc. 2023-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)

import pytest

from datadog_checks.dev.utils import get_metadata_metrics

from .. import common
from ..test_e2e_core_metadata import assert_device_metadata
from .utils import (
assert_common_metrics,
assert_extend_generic_if,
create_e2e_core_test_config,
get_device_ip_from_config,
)

pytestmark = [pytest.mark.e2e, common.py3_plus_only, common.snmp_integration_only]


def test_e2e_profile_linksys(dd_agent_check):
config = create_e2e_core_test_config('linksys')
aggregator = common.dd_agent_check_wrapper(dd_agent_check, config, rate=True)

ip_address = get_device_ip_from_config(config)
common_tags = [
'snmp_profile:linksys',
'snmp_host:linksys.device.name',
'device_namespace:default',
'snmp_device:' + ip_address,
] + []

# --- TEST EXTENDED METRICS ---
assert_extend_generic_if(aggregator, common_tags)

# --- TEST METRICS ---
assert_common_metrics(aggregator, common_tags)

# --- TEST METADATA ---
device = {
'description': 'linksys Device Description',
'id': 'default:' + ip_address,
'id_tags': ['device_namespace:default', 'snmp_device:' + ip_address],
'ip_address': '' + ip_address,
'name': 'linksys.device.name',
'profile': 'linksys',
'status': 1,
'sys_object_id': '1.3.6.1.4.1.3955.999',
'vendor': 'linksys',
}
device['tags'] = common_tags
assert_device_metadata(aggregator, device)

# --- CHECK COVERAGE ---
aggregator.assert_all_metrics_covered()
aggregator.assert_metrics_using_metadata(get_metadata_metrics())

0 comments on commit 51a37d6

Please sign in to comment.