Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion tests/snmp/test_snmp_cpu.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import pytest
import time
import logging

logger = logging.getLogger(__name__)

@pytest.mark.bsl
def test_snmp_cpu(duthost, localhost, creds):
Expand All @@ -17,7 +19,13 @@ def test_snmp_cpu(duthost, localhost, creds):

hostip = duthost.host.options['inventory_manager'].get_host(duthost.hostname).vars['ansible_host']
host_facts = duthost.setup()['ansible_facts']
host_vcpus = int(host_facts['ansible_processor_vcpus'])
if host_facts.has_key("ansible_processor_vcpus"):
host_vcpus = int(host_facts['ansible_processor_vcpus'])
else:
res = duthost.shell("nproc")
host_vcpus = int(res['stdout'])

logger.info("found {} cpu on the dut".format(host_vcpus))

# Gather facts with SNMP version 2
snmp_facts = localhost.snmp_facts(host=hostip, version="v2c", community=creds["snmp_rocommunity"], is_dell=True)['ansible_facts']
Expand Down