def _get_snmp_version_int(self, ctxt, version): _version = version.lower() version_int = constants.VALID_SNMP_VERSIONS.get(_version) if version_int is None: msg = "Invalid snmp version %s." % version raise exception.InvalidSNMPConfig(msg) return version_int
def _get_usm_auth_protocol(self, ctxt, auth_protocol): if auth_protocol is not None: usm_auth_protocol = AUTH_PROTOCOL_MAP.get(auth_protocol.lower()) if usm_auth_protocol is not None: return usm_auth_protocol else: msg = "Invalid auth_protocol %s." % auth_protocol raise exception.InvalidSNMPConfig(msg) else: return config.usmNoAuthProtocol
def _get_usm_priv_protocol(self, ctxt, privacy_protocol): if privacy_protocol is not None: usm_priv_protocol = common_constants.PRIVACY_PROTOCOL_MAP.get( privacy_protocol.lower()) if usm_priv_protocol is not None: return usm_priv_protocol else: msg = "Invalid privacy_protocol %s." % privacy_protocol raise exception.InvalidSNMPConfig(msg) return config.usmNoPrivProtocol