-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[SNMP]: Modify minigraph parser to update SNMP_AGENT_ADDRESS_CONFIG #17045
Changes from all commits
81a9e2d
c41dd1f
e044a5a
921c685
ce3a8de
4e35e11
a589bda
3f7f4fe
ea3f368
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
|
||
from portconfig import get_port_config, get_fabric_port_config, get_fabric_monitor_config | ||
from sonic_py_common.interface import backplane_prefix | ||
from sonic_py_common.multi_asic import is_multi_asic | ||
|
||
# TODO: Remove this once we no longer support Python 2 | ||
if sys.version_info.major == 3: | ||
|
@@ -1718,6 +1719,21 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw | |
|
||
results['MGMT_VRF_CONFIG'] = mvrf | ||
|
||
# Update SNMP_AGENT_ADDRESS_CONFIG with Management IP and Loopback IP | ||
# if available. | ||
if not is_multi_asic() and asic_name is None: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I want to check if the device is single asic, then update SNMP_AGENT_ADDRESS_CONFIG. |
||
results['SNMP_AGENT_ADDRESS_CONFIG'] = {} | ||
port = '161' | ||
for mgmt_intf in mgmt_intf.keys(): | ||
snmp_key = mgmt_intf[1].split('/')[0] + '|' + port + '|' | ||
results['SNMP_AGENT_ADDRESS_CONFIG'][snmp_key] = {} | ||
# Add Loopback IP as agent address for single asic | ||
for loip in lo_intfs.keys(): | ||
snmp_key = loip[1].split('/')[0] + '|' + port + '|' | ||
results['SNMP_AGENT_ADDRESS_CONFIG'][snmp_key] = {} | ||
else: | ||
results['SNMP_AGENT_ADDRESS_CONFIG'] = {} | ||
|
||
phyport_intfs = {} | ||
vlan_intfs = {} | ||
pc_intfs = {} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why checking
asic_name
? #ClosedThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For host namespace, asic_name will be None and SNMP_AGENT_ADDRESS_CONFIG is only required for host namespace in case of multi-asic devices. For single asic device asic_name will always be None, but added this check to ensure that we only generate for host namespace.
Minigraph parser generates config for host and each namespace separately.
This is done by passing the right asic_name/