def _create_objects_from_row(self, row): raise_if_exists(ManagementProfile, name=row['name']) result = ManagementProfile(name=row['name']) proto_lookup = { name: value for value, name in ManagementProfile.PROTOCOL_CHOICES } result.protocol = proto_lookup.get(row['protocol']) result.configuration = json.loads(row['configuration']) return [result]
def snmpv1_integer_profile(): return ManagementProfile( protocol=ManagementProfile.PROTOCOL_SNMP, name="oneinteger", configuration={ "version": 1, "community": "oneinteger" }, )
def snmpv1_string_profile(): return ManagementProfile( protocol=ManagementProfile.PROTOCOL_SNMP, name="onestring", configuration={ "version": "1", "community": "onestring" }, )
def wanted_profile(): return ManagementProfile( protocol=ManagementProfile.PROTOCOL_SNMP, name="wanted", configuration={ "version": "2c", "community": "42" }, )
def management_profile(): from nav.models.manage import ManagementProfile profile = ManagementProfile(name="Test connection profile", protocol=ManagementProfile.PROTOCOL_SNMP, configuration={ "version": 2, "community": "public", "write": False, }) profile.save() yield profile profile.delete()
def null_profile(): return ManagementProfile( protocol=ManagementProfile.PROTOCOL_SNMP, name="null", configuration={"version": None}, )
def faulty_profile(): return ManagementProfile(protocol=ManagementProfile.PROTOCOL_SNMP, name="faulty", configuration={})