Example #1
0
def _valuespec_inv_parameters_inv_if():
    return Dictionary(
        title=_("Parameters for switch port inventory"),
        elements=[
            ("unused_duration",
             Age(
                 title=_("Port down time until considered unused"),
                 help=
                 _("After this time in the state <i>down</i> a port is considered unused."
                   ),
                 default_value=30 * 86400,
             )),
            ("usage_port_types",
             DualListChoice(
                 title=_("Port types to include in usage statistics"),
                 choices=defines.interface_port_types(),
                 autoheight=False,
                 rows=40,
                 enlarge_active=False,
                 custom_order=True,
                 default_value=[
                     '6', '32', '62', '117', '127', '128', '129', '180', '181',
                     '182', '205', '229'
                 ],
             )),
        ])
Example #2
0
 def valuespec(self):
     return DualListChoice(
         choices=defines.interface_port_types(),
         rows=4,
         enlarge_active=True,
         custom_order=True,
     )
Example #3
0
 def valuespec(self) -> ValueSpec:
     sorted_choices = [(str(k), str(v)) for k, v in sorted(
         defines.interface_port_types().items(), key=lambda t: t[0])]
     return DualListChoice(
         choices=sorted_choices,
         rows=4,
         enlarge_active=True,
         custom_order=True,
     )
Example #4
0
def port_types(info: str):
    return [
        (str(k), str(v))
        for k, v in sorted(defines.interface_port_types().items(), key=lambda t: t[0])
    ]