Ejemplo n.º 1
0
    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]
Ejemplo n.º 2
0
def snmpv1_integer_profile():
    return ManagementProfile(
        protocol=ManagementProfile.PROTOCOL_SNMP,
        name="oneinteger",
        configuration={
            "version": 1,
            "community": "oneinteger"
        },
    )
Ejemplo n.º 3
0
def snmpv1_string_profile():
    return ManagementProfile(
        protocol=ManagementProfile.PROTOCOL_SNMP,
        name="onestring",
        configuration={
            "version": "1",
            "community": "onestring"
        },
    )
Ejemplo n.º 4
0
def wanted_profile():
    return ManagementProfile(
        protocol=ManagementProfile.PROTOCOL_SNMP,
        name="wanted",
        configuration={
            "version": "2c",
            "community": "42"
        },
    )
Ejemplo n.º 5
0
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()
Ejemplo n.º 6
0
def null_profile():
    return ManagementProfile(
        protocol=ManagementProfile.PROTOCOL_SNMP,
        name="null",
        configuration={"version": None},
    )
Ejemplo n.º 7
0
def faulty_profile():
    return ManagementProfile(protocol=ManagementProfile.PROTOCOL_SNMP,
                             name="faulty",
                             configuration={})