snmp context-name
Use snmp context-name to configure an SNMP context for a BGP instance.
Use undo snmp context-name to restore the default.
Syntax
snmp context-name context-name
undo snmp context-name
Default
No SNMP context is configured for a BGP instance.
Views
BGP instance view
Predefined user roles
network-admin
Parameters
context-name: Specifies an SNMP context by its name, a case-sensitive string of 1 to 32 characters.
Usage guidelines
BGP does not know the BGP instance to which a managed MIB node belongs. To resolve this issue, configure different SNMP contexts for different BGP instances.
The device selects a MIB for an SNMP packet according to the context (for SNMPv3) or community name (for SNMPv1/v2c) in the following ways:
For an SNMPv3 packet:
The device selects the MIB of the BGP instance default if the packet does not carry a context and no SNMP context was configured for the BGP instance default.
The device selects the MIB of a BGP instance if the packet meets the following conditions:
Carries a context that was configured with the snmp-agent context command in system view.
Matches the context of the BGP instance.
The device does not process any MIBs in other situations.
For an SNMPv1/v2c packet:
The device selects the MIB of the BGP instance default if the following conditions are met:
No SNMP community to SNMP context mapping was configured with the snmp-agent community-map command in system view.
No SNMP context was configured for the BGP instance default.
The device selects the MIB of a BGP instance if the SNMP community is mapped to an SNMP context and the context matches the context of the BGP instance.
The device does not process any MIBs in other situations.
For more information about SNMP contexts and community names, see Network Management and Monitoring Configuration Guide.
Do not configure the same SNMP context for different BGP instances.
If you execute this command multiple times, the most recent configuration takes effect.
Examples
# Configure SNMP context bgp-abc for BGP instance abc.
<Sysname> system-view [Sysname] bgp 100 instance abc [Sysname-bgp-abc] snmp context-name bgp-abc
Related commands
snmp-agent community-map (Network Management and Monitoring Command Reference)
snmp-agent context (Network Management and Monitoring Command Reference)