The Assimilation Project  based on Assimilation version 1.1.7.1474836767
cma.arpdiscovery.ArpDiscoveryListener Class Reference
Inheritance diagram for cma.arpdiscovery.ArpDiscoveryListener:
Collaboration diagram for cma.arpdiscovery.ArpDiscoveryListener:

Public Member Functions

def processpkt (self, drone, srcaddr, jsonobj, discoverychanged)
 
def processpkt_netconfig (self, drone, _unused_srcaddr, jsonobj)
 
def processpkt_arp (self, drone, _unused_srcaddr, jsonobj)
 
def filtered_add_mac_ip (self, drone, macaddr, IPlist)
 
def add_mac_ip (self, drone, macaddr, IPlist)
 

Static Public Attributes

 prio = DiscoveryListener.PRI_OPTION
 
tuple wantedpackets = ('ARP', 'netconfig')
 
dictionary ip_map = {}
 
dictionary mac_map = {}
 

Detailed Description

Class for processing ARP cache discovery entries.
The data section contains (IPaddress, MACaddress) pairs as a hash table (JSON object)
Nanoprobes currently send their entire cache each time anything shows up

For interest, here are some default ARP cache timeouts as of this writing:
    Linux         300 seconds
    Solaris       300 seconds
    Windows       600 seconds
    AIX          1200 seconds
    FreeBSD      1200 seconds
    NetBSD       1200 seconds
    OpenBSD      1200 seconds
    VMWare       1200 seconds
    Cisco       14400 seconds

For large subnets, it would be much more efficient to send only changes --
additions and deletions -- but that's not what we currently do :-D

@TODO: Change ARP updates to give deltas

If we changed the nanoprobes to send delta updates, then you wouldn't particularly
want a 20 minute timeout - you'd want something more like a few minutes
so that they came a few at a time to the CMA.  This would keep the CMA from
being bottlenecked by massive updates if you have a subnet with a lot of IP
addresses on it.  It also means that we would not get 1024 entries just because
one came online...

Of course, a lot of what causes this code to be really slow is the fact that we
hit the database with a transaction for each IP and each MAC that we find in the
message.

Definition at line 48 of file arpdiscovery.py.

Member Function Documentation

def cma.arpdiscovery.ArpDiscoveryListener.add_mac_ip (   self,
  drone,
  macaddr,
  IPlist 
)
We process all the IP addresses that go with a given MAC address (NICNode)
The parameters are expected to be canonical address strings like str(pyNetAddr(...)).

Definition at line 181 of file arpdiscovery.py.

Referenced by cma.arpdiscovery.ArpDiscoveryListener.filtered_add_mac_ip().

Here is the caller graph for this function:

def cma.arpdiscovery.ArpDiscoveryListener.filtered_add_mac_ip (   self,
  drone,
  macaddr,
  IPlist 
)
We process all the IP addresses that go with a given MAC address (NICNode)
The parameters are expected to be canonical address strings like str(pyNetAddr(...)).

Lots of the information we're given is typically repeats of information we
were given before.  This is why we keep these two in-memory maps
- to help speed that up by a huge factor.

Definition at line 162 of file arpdiscovery.py.

References cma.arpdiscovery.ArpDiscoveryListener.add_mac_ip().

Referenced by cma.arpdiscovery.ArpDiscoveryListener.processpkt_arp().

Here is the call graph for this function:

Here is the caller graph for this function:

def cma.arpdiscovery.ArpDiscoveryListener.processpkt (   self,
  drone,
  srcaddr,
  jsonobj,
  discoverychanged 
)
Trigger ARP discovery or add ARP data to the database.

Definition at line 93 of file arpdiscovery.py.

References cma.arpdiscovery.ArpDiscoveryListener.processpkt_arp(), and cma.arpdiscovery.ArpDiscoveryListener.processpkt_netconfig().

Here is the call graph for this function:

def cma.arpdiscovery.ArpDiscoveryListener.processpkt_arp (   self,
  drone,
  _unused_srcaddr,
  jsonobj 
)
We want to update the database when we hear a 'ARP' discovery packet
These discovery entries are the result of listening to ARP packets
in the nanoprobes.  Some may already be in our database, and some may not be.

As we process the packets we create any IPaddrNode and NICNode objects
that correspond to the things we've discovered.  Since IP addresses
can move around, we potentially need to clean up relationships to
NICNodes - so that any given IP address is only associated with a single
MAC address.

As noted in the class docs, the data we get is organized by IP address.
This means that a single MAC address (NIC) may appear multiple times in the
discovery data.

One interesting question is what we should default the domain to for MACs and IPs
that we create.  My thinking is that defaulting them to the domain of the Drone
that did the discovery is a reasonable choice.

Definition at line 130 of file arpdiscovery.py.

References cma.arpdiscovery.ArpDiscoveryListener.filtered_add_mac_ip().

Referenced by cma.arpdiscovery.ArpDiscoveryListener.processpkt().

Here is the call graph for this function:

Here is the caller graph for this function:

def cma.arpdiscovery.ArpDiscoveryListener.processpkt_netconfig (   self,
  drone,
  _unused_srcaddr,
  jsonobj 
)
We want to trigger ARP discovery when we hear a 'netconfig' packet

Build up the parameters for the discovery
action, then send it to drone.request_discovery(...)
To build up the parameters, you use ConfigFile.agent_params()
which will pull values from the system configuration.

Definition at line 105 of file arpdiscovery.py.

References _Listener.config, cma.dispatchtarget.DispatchTarget.config, cma.discoverylistener.DiscoveryListener.config, cma.packetlistener.PacketListener.config, cma.assimcli.DummyIO.config, cma.tests.cma_test.IOTestIO.config, obsolete_cma.DispatchTarget.config, obsolete_cma.PacketListener.config, cma.AssimCclasses.pyNetIO.config, and cma.linkdiscovery.discovery_indicates_link_is_up().

Referenced by cma.linkdiscovery.LinkDiscoveryListener.processpkt(), and cma.arpdiscovery.ArpDiscoveryListener.processpkt().

Here is the call graph for this function:

Here is the caller graph for this function:

Field Documentation

dictionary cma.arpdiscovery.ArpDiscoveryListener.ip_map = {}
static

Definition at line 90 of file arpdiscovery.py.

dictionary cma.arpdiscovery.ArpDiscoveryListener.mac_map = {}
static

Definition at line 91 of file arpdiscovery.py.

cma.arpdiscovery.ArpDiscoveryListener.prio = DiscoveryListener.PRI_OPTION
static
tuple cma.arpdiscovery.ArpDiscoveryListener.wantedpackets = ('ARP', 'netconfig')
static

The documentation for this class was generated from the following file: