Example #1
0
def render_affected(request, netboxid):
    """Controller for the affected tab in ipdevinfo"""
    netbox = get_object_or_404(Netbox, pk=netboxid)
    netboxes = utils.find_children(netbox)

    affected = utils.sort_by_netbox(
        utils.find_affected_but_not_down(netbox, netboxes))
    unreachable = utils.sort_by_netbox(list(set(netboxes) - set(affected)))

    organizations = utils.find_organizations(unreachable)
    contacts = utils.filter_email(organizations)
    services = Service.objects.filter(
        netbox__in=unreachable).order_by('netbox')
    affected_hosts = utils.get_affected_host_count(unreachable)

    return render(
        request,
        'ipdevinfo/frag-affected.html',
        {
            'netbox': netbox,
            'unreachable': unreachable,
            'affected': affected,
            'services': services,
            'organizations': organizations,
            'contacts': contacts,
            'affected_hosts': affected_hosts,
        },
    )
Example #2
0
def render_affected(request, netboxid):
    """Controller for the affected tab in ipdevinfo"""
    netbox = get_object_or_404(Netbox, pk=netboxid)
    netboxes = utils.find_children(netbox)

    affected = utils.sort_by_netbox(
        utils.find_affected_but_not_down(netbox, netboxes))
    unreachable = utils.sort_by_netbox(list(set(netboxes) - set(affected)))

    organizations = utils.find_organizations(unreachable)
    contacts = utils.filter_email(organizations)
    services = Service.objects.filter(netbox__in=unreachable).order_by('netbox')
    affected_hosts = utils.get_affected_host_count(unreachable)

    return render_to_response(
        'ipdevinfo/frag-affected.html', {
            'unreachable': unreachable,
            'affected': affected,
            'services': services,
            'organizations': organizations,
            'contacts': contacts,
            'affected_hosts': affected_hosts
        },
        context_instance=RequestContext(request))