Exemplo n.º 1
0
                # set DISABLE status if interface is shutdown and disabled-interfaces argument is true
                if interfaces[iface]['shutdown'] == 'yes' and check_disabled:
                    result_dict[iface]['status'] = [3, 'SHUTDOWN']

                # If type is not defined - interface is working in Dynamic Auto mode
                if 'type' not in interfaces[iface]:
                    result_dict[iface]['mode'] = [
                        0, 'DYNAMIC',
                        'The interfaces of your switches must be in trunk or access mode.'
                    ]

                # determine vlanmap type (critical/unknown/trusted) if vlanmap defined and interface has at least 1 vlan
                if vlanmap and interfaces[iface]['vlans']:
                    result_dict[iface].update(
                        interface_type.determine(vlanmap, interfaces[iface]))
                    # set vlanmap result as 'CRITICAL' / 'UNKNOWN' / 'TRUSTED'
                    vlanmap_result = result_dict[iface]['vlanmap type'][1]
                else:
                    vlanmap_result = None

                # access/trunk mode check
                result_dict[iface].update(checks.mode.check(interfaces[iface]))

                # check cdp, dtp, mop and source guard options on current interface
                result_dict[iface].update(
                    checks.dtp.check(global_params, interfaces[iface],
                                     vlanmap_result))
                result_dict[iface].update(
                    checks.mop.check(interfaces[iface], vlanmap_result, iface))
                result_dict[iface].update(
Exemplo n.º 2
0
Arquivo: ccat.py Projeto: y0d4a/ccat
                    dict_for_drawing_plot[config_name].update({iface: interfaces[iface]['vlans']})

                result_dict[iface] = {}

                # set DISABLE status if interface is shutdown and disabled-interfaces argument is true
                if interfaces[iface]['shutdown'] == 'yes' and check_disabled:
                    result_dict[iface]['status'] = [3, 'SHUTDOWN']

                # If type is not defined - interface is working in Dynamic Auto mode
                if 'type' not in interfaces[iface]:
                    result_dict[iface]['mode'] = [0, 'DYNAMIC',
                                                  'The interfaces of your switches must be in trunk or access mode.']

                # determine vlanmap type (critical/unknown/trusted) if vlanmap defined and interface has at least 1 vlan
                if vlanmap and interfaces[iface]['vlans']:
                    result_dict[iface].update(interface_type.determine(vlanmap, interfaces[iface]))
                    # set vlanmap result as 'CRITICAL' / 'UNKNOWN' / 'TRUSTED'
                    vlanmap_result = result_dict[iface]['vlanmap type'][1]
                else:
                    vlanmap_result = None

                # access/trunk mode check
                result_dict[iface].update(checks.mode.check(interfaces[iface]))

                # check cdp, dtp, mop and source guard options on current interface
                result_dict[iface].update(checks.dtp.check(global_params, interfaces[iface], vlanmap_result))
                result_dict[iface].update(checks.mop.check(interfaces[iface], vlanmap_result, iface))
                result_dict[iface].update(checks.source_guard.check(interfaces[iface], dhcp_flag, vlanmap_result))

                cdp_result = checks.cdp.iface_check(interfaces[iface], vlanmap_result, cdp_flag)
                if cdp_result: