The core functionality of PATHspider plugins is implemented in two classes:
pathspider.desync.DesynchronizedSpider. There is also a third class,
pathspider.forge.ForgeSpider that inherits from
pathspider.desync.DesynchronizedSpider. These both inherit from the
pathspider.base.Spider which provides a skeleton that has the
required functions for any plugin. The documentation for this base class is
Basic framework for Pathspider: coordinate active measurements on large target lists with both system-level network stack state (sysctls, iptables rules, etc) as well as information derived from flow-level passive observation of traffic at the sender.
Spider(worker_count, libtrace_uri, args, server_mode)¶
A spider consists of a configurator (which alternates between two system configurations), a large number of workers (for performing some network action for each configuration), an Observer which derives information from passively observed traffic, and a thread that merges results from the workers with flow records from the collector.
Adds a job to the job queue. Before inserting into the queue, the local IP addresses will be added to the job information. The path specifier will also be constructed using this information and any additional information that is available in the job record.
If PATHspider is currently stopping, the job will not be added to the queue.
combine_connectivity(baseline, experimental=None, prefix=None)¶
Create a flow observer.
This function is called by the base Spider logic to get an instance of
pathspider.observer.Observerconfigured with the function chains that are requried by the plugin.
exception_wrapper(target, *args, **kwargs)¶
Merge a job record with a flow record.
- flow (dict) – The flow record.
- res (dict) – The job record.
tuple – Final record for job.
In order to create a final record for reporting on a job, the final job record must be merged with the flow record. This function should be implemented by any plugin to provide the logic for this merge as the keys used in these records cannot be known by PATHspider in advance.
This method is not implemented in the abstract
pathspider.base.Spiderclass and must be implemented by any plugin.
Thread to merge results from the workers and the observer.
Shut down PathSpider in an orderly fashion, ensuring that all queued jobs complete, and all available results are merged.
This function starts a PATHspider plugin by:
- Setting the running flag
- Create and start an observer
- Start the merger thread
- Start the configurator thread
- Start the worker threads
The number of worker threads to start was given when activating the plugin.
Shut down PathSpider as quickly as possible, without any regard to completeness of results.