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

Modify sysDescription file location #12

Merged
merged 1 commit into from
Feb 18, 2017

Conversation

taoyl-ms
Copy link
Contributor

Use a snmp-specific location instead of historical shared location

@stcheng stcheng merged commit e6375e9 into sonic-net:master Feb 18, 2017
@stcheng
Copy link
Contributor

stcheng commented Feb 18, 2017

could you reopen another one?

joyas-joseph added a commit to joyas-joseph/sonic-snmpagent that referenced this pull request May 6, 2020
May  5 21:35:16.852142 sonic ERR snmp#snmp-subagent [sonic_ax_impl] ERROR: Uncaught exception in sonic_ax_impl.main#012Traceback (most recent call last):sonic-net#12  File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/main.py", line 70, in main#012    event_loop.run_until_complete(agent.run_in_event_loop())sonic-net#12  File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete#012    return future.result()sonic-net#12  File "/usr/local/lib/python3.7/dist-packages/ax_interface/agent.py", line 37, in run_in_event_loop#012    background_task = self.mib_table.start_background_tasks(self.oid_updaters_enabled)sonic-net#12  File "/usr/local/lib/python3.7/dist-packages/ax_interface/mib.py", line 276, in start_background_tasks#012    task = event._loop.create_task(fut)sonic-net#12  File "/usr/lib/python3.7/asyncio/base_events.py", line 405, in create_task#012    task = tasks.Task(coro, loop=self)#012TypeError: a coroutine was expected, got <Task pending coro=<MIBUpdater.start() running at /usr/local/lib/python3.7/dist-packages/ax_interface/mib.py:34> cb=[MIBTable._done_background_task_callback() at /usr/local/lib/python3.7/dist-packages/ax_interface/mib.py:263]>

We really do not need to wrap the future within a task.

This also addresses the issue where the subagent would not exit on
SIGTERM.

Signed-off-by: Joyas Joseph <joyas_joseph@dell.com>
qiluo-msft pushed a commit that referenced this pull request May 6, 2020
May  5 21:35:16.852142 sonic ERR snmp#snmp-subagent [sonic_ax_impl] ERROR: Uncaught exception in sonic_ax_impl.main#012Traceback (most recent call last):#12  File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/main.py", line 70, in main#012    event_loop.run_until_complete(agent.run_in_event_loop())#12  File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete#012    return future.result()#12  File "/usr/local/lib/python3.7/dist-packages/ax_interface/agent.py", line 37, in run_in_event_loop#012    background_task = self.mib_table.start_background_tasks(self.oid_updaters_enabled)#12  File "/usr/local/lib/python3.7/dist-packages/ax_interface/mib.py", line 276, in start_background_tasks#012    task = event._loop.create_task(fut)#12  File "/usr/lib/python3.7/asyncio/base_events.py", line 405, in create_task#012    task = tasks.Task(coro, loop=self)#012TypeError: a coroutine was expected, got <Task pending coro=<MIBUpdater.start() running at /usr/local/lib/python3.7/dist-packages/ax_interface/mib.py:34> cb=[MIBTable._done_background_task_callback() at /usr/local/lib/python3.7/dist-packages/ax_interface/mib.py:263]>

We really do not need to wrap the future within a task.

This also addresses the issue where the subagent would not exit on
SIGTERM.
stepanblyschak added a commit to stepanblyschak/sonic-snmpagent that referenced this pull request Oct 9, 2020
Fix for the following error in syslog:

Oct  9 10:07:21.427210 mts-sonic-dut ERR snmp#snmp-subagent [ax_interface] ERROR: MIBUpdater.start() caught an unexpected exception during update_data()#012Traceback (most recent call last):sonic-net#12  File "/usr/local/lib/python3.7/dist-packa
ges/ax_interface/mib.py", line 43, in start#012    self.update_data()sonic-net#12  File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/ietf/rfc1213.py", line 245, in update_data#012    self.update_rif_counters()sonic-net#12  File "/usr/local
/lib/python3.7/dist-packages/sonic_ax_impl/mibs/ietf/rfc1213.py", line 271, in update_rif_counters#012    for sai_id in rif_sai_ids}sonic-net#12  File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/ietf/rfc1213.py", line 271, in <dic
tcomp>sonic-net#12    for sai_id in rif_sai_ids}sonic-net#12  File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/__init__.py", line 627, in dbs_get_all#012    ns_result = db_conn.get_all(db_name, _hash, *args, **tmp_kwargs)sonic-net#12  File "/usr/
local/lib/python3.7/dist-packages/swsssdk/dbconnector.py", line 295, in get_all#012    return self.dbintf.get_all(db_name, _hash, *args, **kwargs)sonic-net#12  File "/usr/local/lib/python3.7/dist-packages/swsssdk/interface.py", line 38, in wrapp
ed#012    ret_data = f(inst, db_name, *args, **kwargs)sonic-net#12  File "/usr/local/lib/python3.7/dist-packages/swsssdk/interface.py", line 314, in get_all#012    raise UnavailableDataError(message, _hash)#012swsssdk.exceptions.UnavailableDataE
rror: Key 'b'COUNTERS:oid:0x60000000005d3'' unavailable in database 'COUNTERS_DB'

Signed-off-by: Stepan Blyshchak <stepanb@nvidia.com>
qiluo-msft pushed a commit that referenced this pull request Jan 28, 2021
**- What I did**
A 'key not found' exception will be raised in bgp4.py if the state for a given neighbor is not found in STATE_DB. 
```
ERR snmp#snmp-subagent [ax_interface] ERROR: MIBUpdater.start() caught an unexpected exception during update_data()
#012Traceback (most recent call last):
#12  File "/usr/local/lib/python3.7/dist-packages/ax_interface/mib.py", line 43, in start
#12    self.update_data()#12  File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/vendor/cisco/bgp4.py", line 42, in update_data
#12    state = neigh_info['state']
#12  File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 345, in __getitem__
#12    return _swsscommon.FieldValueMap___getitem__(self, key)
#012IndexError: key not found
```
It is becaues an empty ```dict``` is returned by ```get_all``` when nothing is found for the given key. So check for ```None``` can't detect the error.

**- How I did it**
This commit addressed the issue by checking the key ```state```.

**- How to verify it**
Verified on A7260. No exception is observed after the update.

**- Description for the changelog**
This PR fix exception caused by non existing key.
qiluo-msft pushed a commit that referenced this pull request Mar 11, 2022
**- What I did**
A KeyError exception raised in rfc1213.py if LAG port don't have L3 interface
````
Oct 25 14:10:29.864852 sonic ERR snmp#snmp-subagent [ax_interface] ERROR: SubtreeMIBEntry.__call__() caught an unexpected exception during _callable_.__call__()
#012Traceback (most recent call last):
#12  File "/usr/local/lib/python3.7/dist-packages/ax_interface/mib.py", line 194, in __call__
#12    return self._callable_.__call__(sub_id, *self._callable_args)
#12  File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/ietf/rfc1213.py", line 413, in get_counter
#12    sai_lag_rif_id = self.port_rif_map[sai_lag_id]#012KeyError: '20000000007c2'
````

**- How I did it**
Checked if sai_lag_id is contained in port_rif_map

**- How to verify it**
Build docker-snmp. No exception is observed.
qiluo-msft pushed a commit that referenced this pull request Apr 4, 2022
**- Why I did**

An exception on LLDPLocalSystemDataUpdater instance is seen when the LOC_CHASSIS_TABLE does not have either lldp_loc_sys_cap_supported or lldp_loc_sys_cap_enabled fields.

Although this does not affect an functionality, the exception log can be avoided.

```
tgn-sonic-n1-l1 ERR snmp#snmp-subagent [ax_interface] ERROR: MIBUpdater.start() caught an unexpected exception during update_data()#012Traceback (most recent call last):#12 File " /usr/local/lib/python3.7/dist-packages/ax_interface/mib.py", line 37, in start#012 self.reinit_data ()#12 File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/ieee802_1ab.py", line 129, in reinit_data#012 self.loc_chassis_data['lldp_loc_sys_cap_supported'] = parse_sys_capability(self.loc _chassis_data['lldp_loc_sys_cap_supported'])#012KeyError: 'lldp_loc_sys_cap_supported'
```
qiluo-msft pushed a commit that referenced this pull request Apr 7, 2022
**- Why I did**

An exception on LLDPLocalSystemDataUpdater instance is seen when the LOC_CHASSIS_TABLE does not have either lldp_loc_sys_cap_supported or lldp_loc_sys_cap_enabled fields.

Although this does not affect an functionality, the exception log can be avoided.

```
tgn-sonic-n1-l1 ERR snmp#snmp-subagent [ax_interface] ERROR: MIBUpdater.start() caught an unexpected exception during update_data()#012Traceback (most recent call last):#12 File " /usr/local/lib/python3.7/dist-packages/ax_interface/mib.py", line 37, in start#012 self.reinit_data ()#12 File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/ieee802_1ab.py", line 129, in reinit_data#012 self.loc_chassis_data['lldp_loc_sys_cap_supported'] = parse_sys_capability(self.loc _chassis_data['lldp_loc_sys_cap_supported'])#012KeyError: 'lldp_loc_sys_cap_supported'
```
judyjoseph pushed a commit that referenced this pull request Apr 11, 2022
**- Why I did**

An exception on LLDPLocalSystemDataUpdater instance is seen when the LOC_CHASSIS_TABLE does not have either lldp_loc_sys_cap_supported or lldp_loc_sys_cap_enabled fields.

Although this does not affect an functionality, the exception log can be avoided.

```
tgn-sonic-n1-l1 ERR snmp#snmp-subagent [ax_interface] ERROR: MIBUpdater.start() caught an unexpected exception during update_data()#012Traceback (most recent call last):#12 File " /usr/local/lib/python3.7/dist-packages/ax_interface/mib.py", line 37, in start#012 self.reinit_data ()#12 File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/ieee802_1ab.py", line 129, in reinit_data#012 self.loc_chassis_data['lldp_loc_sys_cap_supported'] = parse_sys_capability(self.loc _chassis_data['lldp_loc_sys_cap_supported'])#012KeyError: 'lldp_loc_sys_cap_supported'
```
SuvarnaMeenakshi added a commit that referenced this pull request Apr 13, 2022
…present (#252)

- What I did
cherrypick of: #246
fixes sonic-net/sonic-buildimage#9996
Handle error seen on system where vlan interface map is not present.
This change requires: sonic-net/sonic-py-swsssdk#117
On chassis platform, on supervisor there are not ports available in config_db. So, there is no vlan interface map in counters db, which causes this error in syslog:

ERROR: MIBUpdater.start() caught an unexpected exception during update_data()#012Traceback (most recent call last):#12  File "/usr/local/lib/python3.7/dist-packages/ax_interface/mib.py", line 37, in start#012    self.reinit_data()#12  File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/ietf/rfc1213.py", line 233, in reinit_data#012    self.vlan_oid_name_map = Namespace.get_sync_d_from_all_namespace(mibs.init_sync_d_vlan_tables, self.db_conn)#12  File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/__init__.py", line 649, in get_sync_d_from_all_namespace#012    ns_tuple = per_namespace_func(db_conn)#12  File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/__init__.py", line 339, in init_sync_d_vlan_tables#012    vlan_name_map = port_util.get_vlan_interface_oid_map(db_conn)#12  File "/usr/local/lib/python3.7/dist-packages/swsssdk/port_util.py", line 167, in get_vlan_interface_oid_map#012    rif_name_map = db.get_all('COUNTERS_DB', 'COUNTERS_RIF_NAME_MAP', blocking=True)#12  File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 1751, in get_all#012    return dict(super(SonicV2Connector, self).get_all(db_name, _hash, blocking))#12  File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 1708, in get_all#012    return _swsscommon.SonicV2Connector_Native_get_all(self, db_name, _hash, blocking)#012RuntimeError: Key '{COUNTERS_RIF_NAME_MAP}' unavailable in database '{COUNTERS_DB}'
- How I did it
Return empty dict if vlan interface map is not present in DB.
- How to verify it
With this fix, no error in syslog message.
Able to execute other MIB queries on supervisor.
UT passes.
lukasstockner pushed a commit to genesiscloud/sonic-snmpagent that referenced this pull request Jun 13, 2022
**- What I did**
A KeyError exception raised in rfc1213.py if LAG port don't have L3 interface
````
Oct 25 14:10:29.864852 sonic ERR snmp#snmp-subagent [ax_interface] ERROR: SubtreeMIBEntry.__call__() caught an unexpected exception during _callable_.__call__()
#012Traceback (most recent call last):
sonic-net#12  File "/usr/local/lib/python3.7/dist-packages/ax_interface/mib.py", line 194, in __call__
sonic-net#12    return self._callable_.__call__(sub_id, *self._callable_args)
sonic-net#12  File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/ietf/rfc1213.py", line 413, in get_counter
sonic-net#12    sai_lag_rif_id = self.port_rif_map[sai_lag_id]#012KeyError: '20000000007c2'
````

**- How I did it**
Checked if sai_lag_id is contained in port_rif_map

**- How to verify it**
Build docker-snmp. No exception is observed.
qiluo-msft pushed a commit that referenced this pull request Mar 29, 2023
… support for RFC2863 (#279)" (#280)

Reverts #279
seeing the below error after PR 279. 
This is causing failure of getting InterfacesMIB data:
docker exec -ti snmp snmpwalk -v2c -c msft 127.0.0.1 1.3.6.1.2.1.2.2.1.1
iso.3.6.1.2.1.2.2.1.1 = No Such Instance currently exists at this OID 
ERR snmp#snmp-subagent [ax_interface] ERROR: MIBUpdater.start() caught an unexpected exception during update_data()#012Traceback (most recent call last):#12  File "/usr/local/lib/python3.7/dist-packages/ax_interface/mib.py", line 43, in start#012    self.update_data()#12  File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/ietf/rfc1213.py", line 255, in update_data#012    self.aggregate_counters()#12  File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/ietf/rfc1213.py", line 371, in aggregate_counters#012    self.rif_counters[rif_sai_id][rif_counter_name]#012KeyError: 'SAI_ROUTER_INTERFACE_STAT_IN_ERROR_PACKETS'
liuh-80 added a commit that referenced this pull request Oct 30, 2023
Improve MIBUpdater to re-connect DBConnector when re-init data.

#### Work item tracking
Microsoft ADO (number only): 24705208

**- What I did**
Fix when redis restart, some MIBUpdater's db connection will broken and keeps report error to syslog issue.

There will be following message repeat in syslog:
```
#12  File "/usr/local/lib/python3.7/dist-packages/sonic_ax_impl/mibs/ietf/rfc2737.py", line 674, in _update_per_namespace_data#
#12    msg = pubsub.get_message()#
#12  File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 1626, in get_message#
#12    return _swsscommon.PubSub_get_message(self, timeout)#
#012RuntimeError: RedisError: Failed to select, err=3: errstr=Server closed the connection
```

**- How I did it**
Re-connect DBConnector in every MIBUpdater's reinit_data method.

**- How to verify it**
Pass all UT

Manually test with following steps:
1. in database container kill redis server.
2. start redis in database container later:  service redis-server start
2. check syslog, confirm following log exist but now new log few minutes later after mibs re-init:

sudo cat /var/log/syslog | grep rfc2737.py | grep PubSub_get_message

Sep 22 03:30:17.223944 vlab-01 ERR snmp#snmp-subagent [ax_interface] ERROR: MIBUpdater.start() caught an unexpected exception during update_data()#012Traceback (most recent call last):#12  File "/usr/local/lib/python3.9/dist-packages/ax_interface/mib.py", line 43, in start#012    self.update_data()#12  File "/usr/local/lib/python3.9/dist-packages/sonic_ax_impl/mibs/ietf/rfc2737.py", line 326, in update_data#012    updater.update_data(i, self.statedb[i])#12  File "/usr/local/lib/python3.9/dist-packages/sonic_ax_impl/mibs/ietf/rfc2737.py", line 666, in update_data#012    self._update_per_namespace_data(self.pub_sub_dict[db_index])#12  File "/usr/local/lib/python3.9/dist-packages/sonic_ax_impl/mibs/ietf/rfc2737.py", line 675, in _update_per_namespace_data#012    msg = pubsub.get_message()#12  File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 1996, in get_message#012    return _swsscommon.PubSub_get_message(self, timeout, interrupt_on_signal)#012RuntimeError: RedisError: Failed to select, err=3: errstr=Server closed the connection


**- Description for the changelog**
Improve MIBUpdater to re-connect DBConnector when re-init data.
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.

2 participants