Skip to content

Fix pdu KeyError for pdu_controller fixture#7876

Merged
wangxin merged 1 commit intosonic-net:masterfrom
wangxin:fix-pdu-key-error
Mar 29, 2023
Merged

Fix pdu KeyError for pdu_controller fixture#7876
wangxin merged 1 commit intosonic-net:masterfrom
wangxin:fix-pdu-key-error

Conversation

@wangxin
Copy link
Copy Markdown
Collaborator

@wangxin wangxin commented Mar 28, 2023

Description of PR

Summary:
Fixes # (issue)

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Back port request

  • 201911
  • 202012
  • 202205

Approach

What is the motivation for this PR?

PR #7782 updated the pdu_manager_factory interface. Only devutils using this function was updated accordingly. Fixtures like pdu_controller using this function also need to be updated.

How did you do it?

This PR updated the pdu_controller and get_pdu_controller fixtures accordingly to pass correct PDU variables to the pdu_manager_factory function.

This change only can fix the issue under python2.
Under python3, the pysnmp package version 4.4.12
is much higher than the 4.2.5 package used in python2. The newer package has compatibility issues. The current snmp_pdu_controllers.py script needs to be updated for python3. This issue will be addressed in other PRs.

How did you verify/test it?

Any platform specific information?

Supported testbed topology if it's a new test case?

Documentation

PR sonic-net#7782 updated the pdu_manager_factory interface. Only devutils
using this function was updated accordingly. Fixtures like pdu_controller
using this function also need to be updated.

This fixture updated the pdu_controller and get_pdu_controller fixtures
accordingly to pass correct PDU variables to the pdu_manager_factory
function.

This change only can fix the issue under python2.
Under python3, the pysnmp package version 4.4.12
is much higher than the 4.2.5 package used in python2.
The newer package has compatibility issues. The current
snmp_pdu_controllers.py script needs to be updated for
python3. This issue will be addressed in other PRs.

Signed-off-by: Xin Wang <xiwang5@microsoft.com>
@nhe-NV
Copy link
Copy Markdown
Contributor

nhe-NV commented Mar 28, 2023

@wangxin When I take this change to my local and run the test, I meet fowllowing issue, do know what else I missed?

/var/AzDevOps/env-python3/lib/python3.8/site-packages/pysnmp/smi/rfc1902.py:853: in resolveWithMib
self.__args[0].resolveWithMib(mibViewController)
ignoreErrors = False
mibViewController = <pysnmp.smi.view.MibViewController object at 0x7f7b816b5eb0>
self = ObjectType(ObjectIdentity('.1.3.6.1.4.1.1718.3.2.3.1.5SNMPv2-SMI::enterprises.1718.3.2.3.1.3.1.1.10'), <Null value obj... <ConstraintsIntersection object, consts <SingleValueConstraint object, consts b''>>, encoding iso-8859-1, payload []>)
/var/AzDevOps/env-python3/lib/python3.8/site-packages/pysnmp/smi/rfc1902.py:401: in resolveWithMib
prefix, label, suffix = mibViewController.getNodeNameByOid(
MibScalar = <class 'MibScalar'>
MibTableColumn = <class 'MibTableColumn'>
mibViewController = <pysnmp.smi.view.MibViewController object at 0x7f7b816b5eb0>
self = ObjectIdentity('.1.3.6.1.4.1.1718.3.2.3.1.5SNMPv2-SMI::enterprises.1718.3.2.3.1.3.1.1.10')


self = <pysnmp.smi.view.MibViewController object at 0x7f7b816b5eb0>, nodeName = ('', '1', '3', '6', '1', '4', ...), modName = ''

def getNodeNameByOid(self, nodeName, modName=''):
    self.indexMib()
    if modName in self.__mibSymbolsIdx:
        mibMod = self.__mibSymbolsIdx[modName]
    else:
        raise error.SmiError('No module %s at %s' % (modName, self))
    oid, label, suffix = self.__getOidLabel(
        nodeName, mibMod['oidToLabelIdx'], mibMod['labelToOidIdx']
    )
    if oid == label:
      raise error.NoSuchObjectError(
            str='Can\'t resolve node name %s::%s at %s' %
                (modName, nodeName, self)
        )

E pysnmp.smi.error.NoSuchObjectError: NoSuchObjectError({'str': "Can't resolve node name ::('', '1', '3', '6', '1', '4', '1', '1718', '3', '2', '3', '1', '5SNMPv2-SMI::enterprises', '1718', '3', '2', '3', '1', '3', '1', '1', '10') at <pysnmp.smi.view.MibViewController object at 0x7f7b816b5eb0>"})

label = ('',)
mibMod = {'labelToOidIdx': {('iso',): (1,), ('iso', 'org'): (1, 3), ('iso', 'org', 'dod'): (1, 3, 6), ('iso', 'org', 'dod', 'in...dress': 'SNMPv2-TM', 'SnmpIPXAddress': 'SNMPv2-TM', 'SnmpOSIAddress': 'SNMPv2-TM', 'SnmpUDPAddress': 'SNMPv2-TM'}, ...}
modName = ''
nodeName = ('', '1', '3', '6', '1', '4', ...)
oid = ('',)
self = <pysnmp.smi.view.MibViewController object at 0x7f7b816b5eb0>
suffix = ('1', '3', '6', '1', '4', '1', ...)

/var/AzDevOps/env-python3/lib/python3.8/site-packages/pysnmp/smi/view.py:209: NoSuchObjectError

@wsycqyz
Copy link
Copy Markdown
Contributor

wsycqyz commented Mar 28, 2023

@nhe-NV Your issue has been fixed in PR: #7887
@wangxin Please help review PR #7887

@wangxin wangxin merged commit a98e9c9 into sonic-net:master Mar 29, 2023
selldinesh added a commit to selldinesh/sonic-mgmt that referenced this pull request Mar 29, 2023
* Fix "logging not defined" issue of some snappi tests (sonic-net#7855)

What is the motivation for this PR?
The logging module is used by some files under tests.snappi. However, the module is not imported in the files. This caused error like below while collecting the snappi tests:
E NameError: name 'logging' is not defined

How did you do it?
The fix is to import logging in those files.

Signed-off-by: Xin Wang <xiwang5@microsoft.com>

* [Python3 migration]Fix oid issue in snmp_pdu_controllers.py sonic-net#7887

What is the motivation for this PR?
In Python2, oid.prettyPrint() prints 1.3.6.1.4.1.9.1.283
In Python3, oid.prettyPrint() prints SNMPv2-SMI::enterprises.9.1.283
This difference breaks port_label_dict in _build_outlet_maps() in snmp_pdu_controllers.py

How did you do it?
Change oid.prettyPrint() to str(oid). This will make code work both in Python2 and Python3.

How did you verify/test it?
PDU testcase can run manually both in Python2 and Python3.

* Fix pdu KeyError for pdu_controller fixture (sonic-net#7876)

What is the motivation for this PR?
PR sonic-net#7782 updated the pdu_manager_factory interface. Only devutils using this function was updated accordingly. Fixtures like pdu_controller using this function also need to be updated.

How did you do it?
This PR updated the pdu_controller and get_pdu_controller fixtures accordingly to pass correct PDU variables to the pdu_manager_factory function.

This change only can fix the issue under python2.
Under python3, the pysnmp package version 4.4.12 is much higher than the 4.2.5 package used in python2. The newer package has compatibility issues. The current snmp_pdu_controllers.py script needs to be updated for python3. That issue is fixed in sonic-net#7887

Signed-off-by: Xin Wang <xiwang5@microsoft.com>

* Make test_plan.py compatible between python2 and python3 (sonic-net#7886)

* Make test_plan.py compatible between python2 and python3

Approach
What is the motivation for this PR?
Make test_plan.py compatible between python2 and python3

co-authorized by: jianquanye@microsoft.com

* RDMA pfc global pause multi dut test

* Refine testbedv2 template output (sonic-net#7895)

* Refine testbedv2 template output

Approach
What is the motivation for this PR?
Refine testbedv2 template output

Co-authorized by: jianquanye@microsoft.com

* fix test_route_perf packet verify issue (sonic-net#7877)

* fix route perf failure caused by missing some port-channel members

* Skip warm-reboot cases for T2. (sonic-net#7784)

---------

Signed-off-by: Xin Wang <xiwang5@microsoft.com>
Co-authored-by: Xin Wang <xiwang5@microsoft.com>
Co-authored-by: ShiyanWangMS <shiyanwang@microsoft.com>
Co-authored-by: Ye Jianquan <jianquanye@microsoft.com>
Co-authored-by: jcaiMR <111116206+jcaiMR@users.noreply.github.com>
Co-authored-by: rraghav-cisco <58446052+rraghav-cisco@users.noreply.github.com>
wangxin added a commit that referenced this pull request Apr 27, 2023
What is the motivation for this PR?
PR #7782 updated the pdu_manager_factory interface. Only devutils using this function was updated accordingly. Fixtures like pdu_controller using this function also need to be updated.

How did you do it?
This PR updated the pdu_controller and get_pdu_controller fixtures accordingly to pass correct PDU variables to the pdu_manager_factory function.

This change only can fix the issue under python2.
Under python3, the pysnmp package version 4.4.12 is much higher than the 4.2.5 package used in python2. The newer package has compatibility issues. The current snmp_pdu_controllers.py script needs to be updated for python3. That issue is fixed in #7887

Signed-off-by: Xin Wang <xiwang5@microsoft.com>
wangxin added a commit that referenced this pull request Apr 27, 2023
What is the motivation for this PR?
PR #7782 updated the pdu_manager_factory interface. Only devutils using this function was updated accordingly. Fixtures like pdu_controller using this function also need to be updated.

How did you do it?
This PR updated the pdu_controller and get_pdu_controller fixtures accordingly to pass correct PDU variables to the pdu_manager_factory function.

This change only can fix the issue under python2.
Under python3, the pysnmp package version 4.4.12 is much higher than the 4.2.5 package used in python2. The newer package has compatibility issues. The current snmp_pdu_controllers.py script needs to be updated for python3. That issue is fixed in #7887

Signed-off-by: Xin Wang <xiwang5@microsoft.com>
@wangxin wangxin deleted the fix-pdu-key-error branch July 12, 2023 02:16
developfast pushed a commit that referenced this pull request Jul 28, 2023
…frastructure (#7849)

* Added Multi Dut Multi asic Support

* PreCommit Check

* Update common_helpers.py

* Rdma multiasic global pause (#9)

* Fix "logging not defined" issue of some snappi tests (#7855)

What is the motivation for this PR?
The logging module is used by some files under tests.snappi. However, the module is not imported in the files. This caused error like below while collecting the snappi tests:
E NameError: name 'logging' is not defined

How did you do it?
The fix is to import logging in those files.

Signed-off-by: Xin Wang <xiwang5@microsoft.com>

* [Python3 migration]Fix oid issue in snmp_pdu_controllers.py #7887

What is the motivation for this PR?
In Python2, oid.prettyPrint() prints 1.3.6.1.4.1.9.1.283
In Python3, oid.prettyPrint() prints SNMPv2-SMI::enterprises.9.1.283
This difference breaks port_label_dict in _build_outlet_maps() in snmp_pdu_controllers.py

How did you do it?
Change oid.prettyPrint() to str(oid). This will make code work both in Python2 and Python3.

How did you verify/test it?
PDU testcase can run manually both in Python2 and Python3.

* Fix pdu KeyError for pdu_controller fixture (#7876)

What is the motivation for this PR?
PR #7782 updated the pdu_manager_factory interface. Only devutils using this function was updated accordingly. Fixtures like pdu_controller using this function also need to be updated.

How did you do it?
This PR updated the pdu_controller and get_pdu_controller fixtures accordingly to pass correct PDU variables to the pdu_manager_factory function.

This change only can fix the issue under python2.
Under python3, the pysnmp package version 4.4.12 is much higher than the 4.2.5 package used in python2. The newer package has compatibility issues. The current snmp_pdu_controllers.py script needs to be updated for python3. That issue is fixed in #7887

Signed-off-by: Xin Wang <xiwang5@microsoft.com>

* Make test_plan.py compatible between python2 and python3 (#7886)

* Make test_plan.py compatible between python2 and python3

Approach
What is the motivation for this PR?
Make test_plan.py compatible between python2 and python3

co-authorized by: jianquanye@microsoft.com

* RDMA pfc global pause multi dut test

* Refine testbedv2 template output (#7895)

* Refine testbedv2 template output

Approach
What is the motivation for this PR?
Refine testbedv2 template output

Co-authorized by: jianquanye@microsoft.com

* fix test_route_perf packet verify issue (#7877)

* fix route perf failure caused by missing some port-channel members

* Skip warm-reboot cases for T2. (#7784)

---------

Signed-off-by: Xin Wang <xiwang5@microsoft.com>
Co-authored-by: Xin Wang <xiwang5@microsoft.com>
Co-authored-by: ShiyanWangMS <shiyanwang@microsoft.com>
Co-authored-by: Ye Jianquan <jianquanye@microsoft.com>
Co-authored-by: jcaiMR <111116206+jcaiMR@users.noreply.github.com>
Co-authored-by: rraghav-cisco <58446052+rraghav-cisco@users.noreply.github.com>

* removing 2nd asic value

* review feedback changes

* removing global pause case from infra changes

* removing qos fixture from this branch

* namespace to asic_value

* resolving comments

Signed-off-by: selldinesh <s.dineshkumar0692@gmail.com>

* resolving comments

Signed-off-by: selldinesh <s.dineshkumar0692@gmail.com>

* typo fix

* removing mlnx only

* adding qos fixtures file back

* pre commit fix

* pre commit fix

* changing 'None' to None

* resolving precommit  errors

* resolving comments

* adding a short description about this file

* review comment fixes

* removing quotes

* review changes

* review changes

* review changes

* review changes

---------

Signed-off-by: Xin Wang <xiwang5@microsoft.com>
Signed-off-by: selldinesh <s.dineshkumar0692@gmail.com>
Co-authored-by: vkuma82 <kumarvinod82@yahoo.com>
Co-authored-by: Xin Wang <xiwang5@microsoft.com>
Co-authored-by: ShiyanWangMS <shiyanwang@microsoft.com>
Co-authored-by: Ye Jianquan <jianquanye@microsoft.com>
Co-authored-by: jcaiMR <111116206+jcaiMR@users.noreply.github.com>
Co-authored-by: rraghav-cisco <58446052+rraghav-cisco@users.noreply.github.com>
Co-authored-by: Vinod Kumar <vikumar7ks@gmail.com>
Co-authored-by: selldinesh <s.dineshkumar0692@gmail.com>
AharonMalkin pushed a commit to AharonMalkin/sonic-mgmt that referenced this pull request Jan 25, 2024
…frastructure (sonic-net#7849)

* Added Multi Dut Multi asic Support

* PreCommit Check

* Update common_helpers.py

* Rdma multiasic global pause (sonic-net#9)

* Fix "logging not defined" issue of some snappi tests (sonic-net#7855)

What is the motivation for this PR?
The logging module is used by some files under tests.snappi. However, the module is not imported in the files. This caused error like below while collecting the snappi tests:
E NameError: name 'logging' is not defined

How did you do it?
The fix is to import logging in those files.

Signed-off-by: Xin Wang <xiwang5@microsoft.com>

* [Python3 migration]Fix oid issue in snmp_pdu_controllers.py sonic-net#7887

What is the motivation for this PR?
In Python2, oid.prettyPrint() prints 1.3.6.1.4.1.9.1.283
In Python3, oid.prettyPrint() prints SNMPv2-SMI::enterprises.9.1.283
This difference breaks port_label_dict in _build_outlet_maps() in snmp_pdu_controllers.py

How did you do it?
Change oid.prettyPrint() to str(oid). This will make code work both in Python2 and Python3.

How did you verify/test it?
PDU testcase can run manually both in Python2 and Python3.

* Fix pdu KeyError for pdu_controller fixture (sonic-net#7876)

What is the motivation for this PR?
PR sonic-net#7782 updated the pdu_manager_factory interface. Only devutils using this function was updated accordingly. Fixtures like pdu_controller using this function also need to be updated.

How did you do it?
This PR updated the pdu_controller and get_pdu_controller fixtures accordingly to pass correct PDU variables to the pdu_manager_factory function.

This change only can fix the issue under python2.
Under python3, the pysnmp package version 4.4.12 is much higher than the 4.2.5 package used in python2. The newer package has compatibility issues. The current snmp_pdu_controllers.py script needs to be updated for python3. That issue is fixed in sonic-net#7887

Signed-off-by: Xin Wang <xiwang5@microsoft.com>

* Make test_plan.py compatible between python2 and python3 (sonic-net#7886)

* Make test_plan.py compatible between python2 and python3

Approach
What is the motivation for this PR?
Make test_plan.py compatible between python2 and python3

co-authorized by: jianquanye@microsoft.com

* RDMA pfc global pause multi dut test

* Refine testbedv2 template output (sonic-net#7895)

* Refine testbedv2 template output

Approach
What is the motivation for this PR?
Refine testbedv2 template output

Co-authorized by: jianquanye@microsoft.com

* fix test_route_perf packet verify issue (sonic-net#7877)

* fix route perf failure caused by missing some port-channel members

* Skip warm-reboot cases for T2. (sonic-net#7784)

---------

Signed-off-by: Xin Wang <xiwang5@microsoft.com>
Co-authored-by: Xin Wang <xiwang5@microsoft.com>
Co-authored-by: ShiyanWangMS <shiyanwang@microsoft.com>
Co-authored-by: Ye Jianquan <jianquanye@microsoft.com>
Co-authored-by: jcaiMR <111116206+jcaiMR@users.noreply.github.com>
Co-authored-by: rraghav-cisco <58446052+rraghav-cisco@users.noreply.github.com>

* removing 2nd asic value

* review feedback changes

* removing global pause case from infra changes

* removing qos fixture from this branch

* namespace to asic_value

* resolving comments

Signed-off-by: selldinesh <s.dineshkumar0692@gmail.com>

* resolving comments

Signed-off-by: selldinesh <s.dineshkumar0692@gmail.com>

* typo fix

* removing mlnx only

* adding qos fixtures file back

* pre commit fix

* pre commit fix

* changing 'None' to None

* resolving precommit  errors

* resolving comments

* adding a short description about this file

* review comment fixes

* removing quotes

* review changes

* review changes

* review changes

* review changes

---------

Signed-off-by: Xin Wang <xiwang5@microsoft.com>
Signed-off-by: selldinesh <s.dineshkumar0692@gmail.com>
Co-authored-by: vkuma82 <kumarvinod82@yahoo.com>
Co-authored-by: Xin Wang <xiwang5@microsoft.com>
Co-authored-by: ShiyanWangMS <shiyanwang@microsoft.com>
Co-authored-by: Ye Jianquan <jianquanye@microsoft.com>
Co-authored-by: jcaiMR <111116206+jcaiMR@users.noreply.github.com>
Co-authored-by: rraghav-cisco <58446052+rraghav-cisco@users.noreply.github.com>
Co-authored-by: Vinod Kumar <vikumar7ks@gmail.com>
Co-authored-by: selldinesh <s.dineshkumar0692@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants