Skip to content

Commit

Permalink
Add ubiquiti-unifi-security-gateway (#15433)
Browse files Browse the repository at this point in the history
Co-authored-by: Elizaveta Eremina <70374721+lizaerem@users.noreply.github.com>
  • Loading branch information
AlexandreYang and lizaerem authored Aug 2, 2023
1 parent ca31f3c commit ee31b06
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
extends:
- _base.yaml
- _generic-if.yaml
- _generic-ucd.yaml
- _ubiquiti.yaml
sysobjectid:
- 1.3.6.1.4.1.41112.1.5 # Ubiquiti EdgeMax
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
1.3.6.1.2.1.1.1.0|4|ubiquiti-unifi-security-gateway Device Description
1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.41112.1.5
1.3.6.1.2.1.1.5.0|4|ubiquiti-unifi-security-gateway.device.name
1.3.6.1.2.1.2.1.0|2|28
1.3.6.1.4.1.2021.4.3.0|2|1048572
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_if,
assert_extend_generic_ucd,
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_ubiquiti_unifi_security_gateway(dd_agent_check):
config = create_e2e_core_test_config('ubiquiti-unifi-security-gateway')
aggregator = common.dd_agent_check_wrapper(dd_agent_check, config, rate=True)

ip_address = get_device_ip_from_config(config)
common_tags = [
'snmp_profile:ubiquiti-unifi-security-gateway',
'snmp_host:ubiquiti-unifi-security-gateway.device.name',
'device_namespace:default',
'snmp_device:' + ip_address,
] + []

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

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

# --- TEST METADATA ---
device = {
'description': 'ubiquiti-unifi-security-gateway Device Description',
'id': 'default:' + ip_address,
'id_tags': ['device_namespace:default', 'snmp_device:' + ip_address],
'ip_address': '' + ip_address,
'name': 'ubiquiti-unifi-security-gateway.device.name',
'profile': 'ubiquiti-unifi-security-gateway',
'status': 1,
'sys_object_id': '1.3.6.1.4.1.41112.1.5',
'vendor': 'ubiquiti',
}
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 ee31b06

Please sign in to comment.