|
| 1 | +import warnings |
| 2 | + |
| 3 | + |
1 | 4 | class SnmpParameters(object): |
2 | 5 | class SnmpVersion: |
3 | 6 | def __init__(self): |
@@ -112,8 +115,50 @@ def __init__( |
112 | 115 | self.snmp_user = snmp_user |
113 | 116 | self.snmp_password = snmp_password |
114 | 117 | self.snmp_private_key = snmp_private_key |
115 | | - self.auth_protocol = auth_protocol |
116 | | - self.private_key_protocol = private_key_protocol |
| 118 | + self.snmp_auth_protocol = auth_protocol |
| 119 | + self.snmp_private_key_protocol = private_key_protocol |
| 120 | + |
| 121 | + # For backward compatibility auth_protocol and private_key_protocol |
| 122 | + @property |
| 123 | + def auth_protocol(self): |
| 124 | + warnings.warn( |
| 125 | + "auth_protocol is obsolete please use snmp_auth_protocol field instead", |
| 126 | + DeprecationWarning, |
| 127 | + stacklevel=2, |
| 128 | + ) |
| 129 | + return self.snmp_auth_protocol |
| 130 | + |
| 131 | + @auth_protocol.setter |
| 132 | + def auth_protocol(self, value): |
| 133 | + warnings.warn( |
| 134 | + "auth_protocol is obsolete please use snmp_auth_protocol field instead", |
| 135 | + DeprecationWarning, |
| 136 | + stacklevel=2, |
| 137 | + ) |
| 138 | + self.snmp_auth_protocol = value |
| 139 | + |
| 140 | + @property |
| 141 | + def private_key_protocol(self): |
| 142 | + warnings.warn( |
| 143 | + "private_key_protocol is obsolete please " |
| 144 | + "use snmp_private_key_protocol " |
| 145 | + "field instead", |
| 146 | + DeprecationWarning, |
| 147 | + stacklevel=2, |
| 148 | + ) |
| 149 | + |
| 150 | + return self.snmp_private_key_protocol |
| 151 | + |
| 152 | + @private_key_protocol.setter |
| 153 | + def private_key_protocol(self, value): |
| 154 | + warnings.warn( |
| 155 | + "private_key_protocol is obsolete please " |
| 156 | + "use snmp_private_key_protocol " |
| 157 | + "field instead", |
| 158 | + DeprecationWarning, |
| 159 | + stacklevel=2, |
| 160 | + ) |
| 161 | + self.snmp_private_key_protocol = value |
117 | 162 |
|
118 | 163 | def validate(self): |
119 | 164 | super(SNMPV3Parameters, self).validate() |
|
0 commit comments