示例#1
0
def test_get_apic_capacity_metrics(aggregator):
    check = CiscoACICheck(common.CHECK_NAME, {}, {})
    api = ApiMock()
    capacity = Capacity(
        api,
        instance={"tags": ["user_tag:1", "utag:2"]},
        check_tags=["check_tag:1", "ctag:2"],
        gauge=check.gauge,
        log=check.log,
    )
    capacity._get_apic_capacity_metrics()
    tags = ['check_tag:1', 'ctag:2', 'user_tag:1', 'utag:2']

    aggregator.assert_metric('cisco_aci.capacity.apic.endpoint.utilized', value=666.0, tags=tags, hostname='', count=1)
    aggregator.assert_metric(
        'cisco_aci.capacity.apic.bridge_domain.utilized', value=666.0, tags=tags, hostname='', count=1
    )
    aggregator.assert_metric('cisco_aci.capacity.apic.tenant.utilized', value=666.0, tags=tags, hostname='', count=1)
    aggregator.assert_metric(
        'cisco_aci.capacity.apic.private_network.utilized', value=666.0, tags=tags, hostname='', count=1
    )
    aggregator.assert_metric(
        'cisco_aci.capacity.apic.endpoint_group.utilized', value=666.0, tags=tags, hostname='', count=1
    )
    aggregator.assert_metric('cisco_aci.capacity.apic.fabric_node.utilized', value=6.0, tags=tags, hostname='', count=1)

    # Assert coverage for this check on this instance
    aggregator.assert_all_metrics_covered()
示例#2
0
def test_get_eqpt_capacity(aggregator):
    check = CiscoACICheck(common.CHECK_NAME, {}, {})
    api = ApiMock()
    capacity = Capacity(
        api,
        instance={"tags": ["user_tag:1", "utag:2"]},
        check_tags=["check_tag:1", "ctag:2"],
        gauge=check.gauge,
        log=check.log,
    )
    capacity._get_eqpt_capacity()
    tags = ['fabric_pod_id:1', 'node_id:2', 'check_tag:1', 'ctag:2', 'user_tag:1', 'utag:2']
    hn = 'pod-1-node-2'
    aggregator.assert_metric('cisco_aci.capacity.leaf.policy_cam.utilized', value=8.0, tags=tags, hostname=hn, count=1)
    aggregator.assert_metric('cisco_aci.capacity.leaf.vlan.limit', value=5.0, tags=tags, hostname=hn, count=1)
    aggregator.assert_metric('cisco_aci.capacity.leaf.ipv6_endpoint.limit', value=2.0, tags=tags, hostname=hn, count=1)
    aggregator.assert_metric('cisco_aci.capacity.leaf.policy_cam.limit', value=7.0, tags=tags, hostname=hn, count=1)
    aggregator.assert_metric('cisco_aci.capacity.leaf.ipv4_endpoint.limit', value=1.0, tags=tags, hostname=hn, count=1)
    aggregator.assert_metric(
        'cisco_aci.capacity.leaf.ipv6_endpoint.utilized', value=4.0, tags=tags, hostname=hn, count=1
    )
    aggregator.assert_metric('cisco_aci.capacity.leaf.vlan.utilized', value=6.0, tags=tags, hostname=hn, count=1)
    aggregator.assert_metric('cisco_aci.capacity.leaf.multicast.limit', value=9.0, tags=tags, hostname=hn, count=1)
    aggregator.assert_metric('cisco_aci.capacity.leaf.multicast.utilized', value=10.0, tags=tags, hostname=hn, count=1)
    aggregator.assert_metric(
        'cisco_aci.capacity.leaf.ipv4_endpoint.utilized', value=3.0, tags=tags, hostname=hn, count=1
    )

    # Assert coverage for this check on this instance
    aggregator.assert_all_metrics_covered()
示例#3
0
def test_get_contexts(aggregator):
    check = CiscoACICheck(common.CHECK_NAME, {}, {})
    api = ApiMock()
    capacity = Capacity(
        api,
        instance={"tags": ["user_tag:1", "utag:2"]},
        check_tags=["check_tag:1", "ctag:2"],
        gauge=check.gauge,
        log=check.log,
    )
    capacity._get_contexts()
    tags = ['check_tag:1', 'ctag:2', 'user_tag:1', 'utag:2']

    aggregator.assert_metric(
        'cisco_aci.capacity.leaf.bridge_domain.utilized',
        value=666.0,
        tags=['fabric_pod_id:1', 'node_id:2'] + tags,
        hostname='pod-1-node-2',
        count=1,
    )
    aggregator.assert_metric(
        'cisco_aci.capacity.leaf.vrf.utilized',
        value=666.0,
        tags=['fabric_pod_id:1', 'node_id:2'] + tags,
        hostname='pod-1-node-2',
    )
    aggregator.assert_metric(
        'cisco_aci.capacity.leaf.endpoint_group.limit',
        value=3500.0,
        tags=['fabric_pod_id:1', 'node_id:2'] + tags,
        hostname='pod-1-node-2',
        count=1,
    )
    aggregator.assert_metric(
        'cisco_aci.capacity.leaf.bridge_domain.limit',
        value=3500.0,
        tags=['fabric_pod_id:1', 'node_id:2'] + tags,
        hostname='pod-1-node-2',
        count=1,
    )
    aggregator.assert_metric(
        'cisco_aci.capacity.leaf.endpoint_group.utilized',
        value=666.0,
        tags=['fabric_pod_id:1', 'node_id:2'] + tags,
        hostname='pod-1-node-2',
    )
    aggregator.assert_metric(
        'cisco_aci.capacity.leaf.vrf.limit',
        value=800.0,
        tags=['fabric_pod_id:1', 'node_id:2'] + tags,
        hostname='pod-1-node-2',
        count=1,
    )

    # Assert coverage for this check on this instance
    aggregator.assert_all_metrics_covered()
示例#4
0
def test_get_apic_capacity_limits(aggregator):
    check = CiscoACICheck(common.CHECK_NAME, {}, {})
    api = ApiMock()
    capacity = Capacity(
        api,
        instance={"tags": ["user_tag:1", "utag:2"]},
        check_tags=["check_tag:1", "ctag:2"],
        gauge=check.gauge,
        log=check.log,
    )
    capacity._get_apic_capacity_limits()
    tags = ['check_tag:1', 'ctag:2', 'user_tag:1', 'utag:2']

    aggregator.assert_metric('cisco_aci.capacity.apic.tenant.limit', value=2.0, tags=tags, hostname='', count=1)
    aggregator.assert_metric('cisco_aci.capacity.apic.service_graph.limit', value=8.0, tags=tags, hostname='', count=1)
    aggregator.assert_metric('cisco_aci.capacity.apic.bridge_domain.limit', value=9.0, tags=tags, hostname='', count=1)
    aggregator.assert_metric(
        'cisco_aci.capacity.apic.azure_domain.endpoint_group.limit', value=7.0, tags=tags, hostname='', count=1
    )
    aggregator.assert_metric(
        'cisco_aci.capacity.apic.vmware_domain.endpoint_group.limit', value=11.0, tags=tags, hostname='', count=1
    )
    aggregator.assert_metric('cisco_aci.capacity.apic.fabric_node.limit', value=0.0, tags=tags, hostname='', count=1)
    aggregator.assert_metric('cisco_aci.capacity.apic.contract.limit', value=1.0, tags=tags, hostname='', count=1)
    aggregator.assert_metric('cisco_aci.capacity.apic.azure_domain.limit', value=4.0, tags=tags, hostname='', count=1)
    aggregator.assert_metric('cisco_aci.capacity.apic.azure_domain.limit', value=6.0, tags=tags, hostname='', count=1)
    aggregator.assert_metric(
        'cisco_aci.capacity.apic.endpoint_group.limit', value=10.0, tags=tags, hostname='', count=1
    )
    aggregator.assert_metric(
        'cisco_aci.capacity.apic.private_network.limit', value=5.0, tags=tags, hostname='', count=1
    )
    aggregator.assert_metric('cisco_aci.capacity.apic.endpoint.limit', value=3.0, tags=tags, hostname='', count=1)

    # Assert coverage for this check on this instance
    aggregator.assert_all_metrics_covered()