Skip to content

Commit

Permalink
Add profile for server-iron-switch (#15329)
Browse files Browse the repository at this point in the history
  • Loading branch information
lizaerem authored Jul 21, 2023
1 parent 4536eed commit 424ce8f
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
extends:
- _base.yaml
- _generic-host-resources-base.yaml
- _generic-if.yaml

metadata:
device:
fields:
vendor:
value: "server_iron"

sysobjectid:
- 1.3.6.1.4.1.1991.1.3.3.2 # Server Iron XL switches
19 changes: 19 additions & 0 deletions snmp/tests/compose/data/server-iron-switch.snmprec
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
1.3.6.1.2.1.1.1.0|4|server-iron-switch Device Description
1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.1991.1.3.3.2
1.3.6.1.2.1.1.5.0|4|server-iron-switch.device.name
1.3.6.1.2.1.2.1.0|2|28
1.3.6.1.2.1.25.1.1.0|67|201526890
1.3.6.1.2.1.25.2.3.1.1.4|2|4
1.3.6.1.2.1.25.2.3.1.1.31|2|31
1.3.6.1.2.1.25.2.3.1.2.4|6|1.3.6.1.3.167.36
1.3.6.1.2.1.25.2.3.1.2.31|6|1.3.6.1.3
1.3.6.1.2.1.25.2.3.1.3.4|4x|6b65707420627574207468656972204a61646564206275742064726976696e67
1.3.6.1.2.1.25.2.3.1.3.31|4x|7a6f6d62696573206f78656e206b657074204a6164656420717561696e746c79207a6f6d62696573
1.3.6.1.2.1.25.2.3.1.5.4|2|17
1.3.6.1.2.1.25.2.3.1.5.31|2|21
1.3.6.1.2.1.25.2.3.1.6.4|2|30
1.3.6.1.2.1.25.2.3.1.6.31|2|4
1.3.6.1.2.1.25.3.3.1.1.10|2|10
1.3.6.1.2.1.25.3.3.1.1.21|2|21
1.3.6.1.2.1.25.3.3.1.2.10|2|31
1.3.6.1.2.1.25.3.3.1.2.21|2|15
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# (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_host_resources_base,
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_server_iron_switch(dd_agent_check):
config = create_e2e_core_test_config('server-iron-switch')
aggregator = common.dd_agent_check_wrapper(dd_agent_check, config, rate=True)

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

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

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

# --- TEST METADATA ---
device = {
'description': 'server-iron-switch Device Description',
'id': 'default:' + ip_address,
'id_tags': ['device_namespace:default', 'snmp_device:' + ip_address],
'ip_address': '' + ip_address,
'name': 'server-iron-switch.device.name',
'profile': 'server-iron-switch',
'status': 1,
'sys_object_id': '1.3.6.1.4.1.1991.1.3.3.2',
'vendor': 'server_iron',
}
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 424ce8f

Please sign in to comment.