Advertisement
Guest User

Untitled

a guest
Mar 31st, 2014
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.02 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. ##----------------------------------------------------------------------
  3. ## sa.network_info application
  4. ##----------------------------------------------------------------------
  5. ## Copyright (C) 2007-2014 The NOC Project
  6. ## See LICENSE for details
  7. ##----------------------------------------------------------------------
  8.  
  9. ## NOC modules
  10. from noc.lib.app import ExtApplication, view
  11. from noc.ip.models import *
  12. from noc.inv.models import *
  13.  
  14.  
  15. class network_infoAppplication(ExtApplication):
  16.     """
  17.    sa.network_info application
  18.    """
  19.     title = "Network Info"
  20.     menu = "Network Info"
  21.  
  22.     @view(method=["GET"], url=r"^$", access="read", api=True)
  23.     def api_main(self, request):
  24.         mo = ManagedObject.objects.get(id=38)
  25.         ni = "L3 device: "+mo.name+"\n"
  26.         arps = mo.scripts.get_arp()
  27.         for arp in arps:
  28.             ni += "ARP entry: "+arp['ip']+" "+arp['mac']+"\n"
  29.  
  30.         return {
  31.             "network_info": ni,
  32.             "success" : True
  33.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement