Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[multi-asic][RFC1213]: Oper status of mgmt interface for multi-asic platform #209

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

SuvarnaMeenakshi
Copy link
Contributor

- What I did
Currently oper status of all management interface is retrieved from STATE DB.
Multi-asic platform does not have any daemon running on the host namespace to update oper status of management interface in STATE DB. This PR is to add a function to retrieve oper status of management interface from kernel file: "/sys/class/net/if_name/operstate".
- How I did it

  • Add a new function to retrieve oper status from /sys/class/net/if_name/operstate.
  • Invoke this function periodically to retrieve oper status of all management interfaces.
  • This is done periodically, instead of retrieving only on SNMP query, so that the time take during the SNMP query does not increase due to the file read operation.
  • Add unit-tests for mgmt interface.
    - How to verify it
  • Run snmpwalk to get interface status, ensure that the interface status of management interface is correct, on single asic and multi-asic VS testbed.
  • With the changes - no impact of single asic platform.
    multi-asic VS testbed:
sudo ifconfig eth0 down
docker exec -it snmp snmpwalk -v2c -c public 127.0.0.1 1.3.6.1.2.1.2.2.1.8
iso.3.6.1.2.1.2.2.1.8.1 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.5 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.13 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.17 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.21 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.25 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.29 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.1001 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.1002 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.1003 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.1004 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.1005 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.1006 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.5002 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.5003 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.5012 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.5013 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.5020 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.5021 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.5030 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.5031 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9000 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9004 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9008 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9012 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9016 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9020 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9024 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9028 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9032 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9036 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9040 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9044 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9048 = INTEGER: 2
iso.3.6.1.2.1.2.2.1.8.9052 = INTEGER: 2
iso.3.6.1.2.1.2.2.1.8.9056 = INTEGER: 2
iso.3.6.1.2.1.2.2.1.8.9060 = INTEGER: 2
iso.3.6.1.2.1.2.2.1.8.9064 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9068 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9072 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9076 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9080 = INTEGER: 2
iso.3.6.1.2.1.2.2.1.8.9084 = INTEGER: 2
iso.3.6.1.2.1.2.2.1.8.9092 = INTEGER: 2
iso.3.6.1.2.1.2.2.1.8.9096 = INTEGER: 2
iso.3.6.1.2.1.2.2.1.8.10000 = INTEGER: 2 --> status down
sudo ifconfig eth0 up
docker exec -it snmp snmpwalk -v2c -c public 127.0.0.1 1.3.6.1.2.1.2.2.1.8
iso.3.6.1.2.1.2.2.1.8.1 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.5 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.13 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.17 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.21 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.25 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.29 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.1001 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.1002 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.1003 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.1004 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.1005 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.1006 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.5002 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.5003 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.5012 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.5013 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.5020 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.5021 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.5030 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.5031 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9000 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9004 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9008 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9012 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9016 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9020 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9024 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9028 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9032 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9036 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9040 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9044 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9048 = INTEGER: 2
iso.3.6.1.2.1.2.2.1.8.9052 = INTEGER: 2
iso.3.6.1.2.1.2.2.1.8.9056 = INTEGER: 2
iso.3.6.1.2.1.2.2.1.8.9060 = INTEGER: 2
iso.3.6.1.2.1.2.2.1.8.9064 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9068 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9072 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9076 = INTEGER: 1
iso.3.6.1.2.1.2.2.1.8.9080 = INTEGER: 2
iso.3.6.1.2.1.2.2.1.8.9084 = INTEGER: 2
iso.3.6.1.2.1.2.2.1.8.9092 = INTEGER: 2
iso.3.6.1.2.1.2.2.1.8.9096 = INTEGER: 2
iso.3.6.1.2.1.2.2.1.8.10000 = INTEGER: 1 --> status up

**- Description for the changelog**
<!--
Write a short (one line) summary that describes the changes in this
pull request for inclusion in the changelog:
-->

interface from kernel for multi-asic platform.
In multi-asic platform there is no daemon in the host
namespace to update the oper status of management interface.
Instead of retrieving this information from state_db,
retrieve this from /sys/class/net/../operstate file.

Signed-off-by: Suvarna Meenakshi <sumeenak@microsoft.com>
instead of retrieving it during SNMP get to ensure
SNMP get time does not increase.

Signed-off-by: Suvarna Meenakshi <sumeenak@microsoft.com>
@abdosi
Copy link
Contributor

abdosi commented Apr 9, 2021

@SuvarnaMeenakshi Regarding this:

This is done periodically, instead of retrieving only on SNMP query, so that the time take during the SNMP query does not increase due to the file read operation.

Have we seen slowness if we do only during SNMP walk ? I am wondering doing parodically results makes system more slow compare to only doing when needed especially if walk is not that common operation.

@SuvarnaMeenakshi
Copy link
Contributor Author

@SuvarnaMeenakshi Regarding this:

This is done periodically, instead of retrieving only on SNMP query, so that the time take during the SNMP query does not increase due to the file read operation.

Have we seen slowness if we do only during SNMP walk ? I am wondering doing parodically results makes system more slow compare to only doing when needed especially if walk is not that common operation.
To check this , I did comparison of running time of _get_if_entry_state_db() which is invoked upon SNMP query and update_data() which is invoked periodically. The running time was obtained before the changes in this PR and after calling _get_mgmt_oper_status() in either functions. I ran the SNMP walk to get operstatus of all interfaces 100 times on a multi-asic DUT to get average running time over 100 cycles, and update_data which is called periodically, was also calculated over 100 cycles. With that, below are the time taken:
Without this change: _get_if_entry_state_db time taken 1.3980865478515625e-05 seconds
After this change:
_get_if_entry_state_db time taken 5.311250686645508e-05. seconds
Without this change: update_data time taken 0.0767834734916687 seconds
After this change: update_data time taken 0.07709113597869872 seconds

As update_data time does not show as much increase as see in _get_if_entry_state_db(), decided to keep in update_data.

@qiluo-msft
Copy link
Contributor

Could you help explore another solution: run a process portsyncd in the host namespace, it will update oper status of management interface in STATE DB. The benefit simplified responsibilities of daemon and telemetry services. Let's say sonic-telemetry would like to get the same data, no need to poll there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants