Configuring SNMP Communities

The SNMP Read-Only Community String is like a user id or password. It is sent along with each SNMP Get-Request and allows (or denies) access to the FlexSwitch's statistics. If the community string is correct, the device responds with the requested information. If the community string is incorrect, the device simply ignores the request and does not respond.

For more details about configuration options, see the following pages:

Configuring an SNMP Community

Attribute Date Type Description Permitted Values
Name [Key] string SNMP community name DEFAULT: public
AccessType string Access type for the SNMP community. SELECTION: RO/RW
DEFAULT:RO
AclRef string ACL name used with this snmp community for access filtering. DEFAULT:""

REST (cURL) Example

config/SnmpCommunity

curl -k -u <user>:<password> -X POST -H ‘Content-Type: application/json’ –header ‘Accept: application/json’ -d ‘{<Model Object as json-Data>}’ http://device-management-IP:443/public/v1/config/SnmpCommunity

JSON Data Model

{
    "Name"; "test",
    "AccessType":"RO",
    "AclRef":"Acl01"
}

Python Example

from flexswitchV2 import FlexSwitch

name="test"
accesstype="RO"
aclref=Acl01"


if __name__ == '__main__':
    switchIP := "192.168.56.101"
    swtch = FlexSwitch (switchIP, 443)  # Instantiate object to talk to flexSwitch
    response, error = swtch.createAccessControlList(Name=name, AccessType=accesstype, AclRef=aclref)

    if error != None: #Error not being None implies there is some problem
        print error
    else :
    print 'Success'

CLI Example

localhost(config)#snmp community test
localhost(config-community-test)#AclRef Acl01
localhost(config-community-test)#apply
Applying Config:
id: 1    object: SnmpCommunity   status: APPLIED CONFIG  valid: True delete: False num user cmds: 2
 command                attr         value    model attr    iskey    required    userprov    time provisioned        
----------------------------------------------------------------------------------------------------------------------
 snmp community test    community    test     Name          True     X           X           Sun Nov 13 03:03:50 2033
 AclRef Acl01           AclRef       Acl01    AclRef        False                X           Sun Nov 13 03:03:53 2033