cfme.control.snmp_form module

This file contains useful classes for working with SNMP filling.

class cfme.control.snmp_form.SNMPForm[source]

Bases: object

Class encapsulating the most common (and hopefully single) configuration of SNMP form

Usage:

form = SNMPForm()
fill(form, dict(
    hosts=["host1", "host2"],
    traps=[
        ("aaa", "Counter32", 125),                      # Takes 3-tuples
        ("bbb", "Null"),                                # 2-tuples with no value specified
        SNMPTrap("ccc", "Gauge32", 256),                # objects dtto
        SNMPTrap("ddd", "Null"),                        # value can be unspecified too
        {"oid": "eee", "type": "Integer", "value": 42}  # omg dict too! Yay.
    ],
    version="v2",
    id="aabcd",
))
fields = <cfme.web_ui.Form fields=[('hosts', <cfme.control.snmp_form.SNMPHostsField object at 0x7f4d239735d0>), ('version', Select("//select[@id='snmp_version']", multi=False)), ('id', <cfme.web_ui.Input _names=('trap_id',), _use_id=False>), ('traps', <cfme.control.snmp_form.SNMPTrapsField num_fields=None>)]>
class cfme.control.snmp_form.SNMPHostsField[source]

Bases: object

Class designed for handling the two-type snmp hosts field.

They can be 3 or just single.

host_fields[source]

Returns list of locators to all host fields

class cfme.control.snmp_form.SNMPTrap(oid, type, value=None)[source]

Bases: utils.pretty.Pretty

Nicer representation of the single SNMP trap

Parameters:
  • oid – SNMP OID
  • type – SNMP type
  • value – Value (default: None)
as_tuple[source]

Return the contents as a tuple used for filling

pretty_attrs = ['oid', 'type', 'value']
class cfme.control.snmp_form.SNMPTrapField(seq_id)[source]

Bases: utils.pretty.Pretty

Class representing SNMP trap field consisting of 3 elements - oid, type and value

Parameters:seq_id – Sequential id of the field. Usually in range 1-10
oid[source]
oid_loc[source]
pretty_attrs = ['seq_id']
type[source]
type_loc[source]
value[source]
value_loc[source]
class cfme.control.snmp_form.SNMPTrapsField(num_fields)[source]

Bases: utils.pretty.Pretty

Encapsulates all trap fields to simplify form filling

Parameters:num_fields – How many SNMPTrapField to generate
pretty_attrs = ['num_fields']
cfme.control.snmp_form.fill_snmp_form(form, values, action)[source]

I wanted to use dict but that is overrided in web_ui that it disassembles dict to list of tuples :(

cfme.control.snmp_form.fill_snmp_hosts_field_basestr(field, value)[source]
cfme.control.snmp_form.fill_snmp_hosts_field_list(field, values)[source]
cfme.control.snmp_form.fill_snmp_trap_field_dict(field, val)[source]
cfme.control.snmp_form.fill_snmp_trap_field_trap(field, val)[source]
cfme.control.snmp_form.fill_snmp_trap_field_tuple(field, val)[source]
cfme.control.snmp_form.fill_snmp_traps_field_list(field, values)[source]
cfme.control.snmp_form.fill_snmp_traps_field_single_trap(field, value)[source]