Circuit Maintenance Jobs¶
nautobot_circuit_maintenance.jobs
¶
Circuit Maintenance plugin jobs.
location_search
¶
Location searching Job definition.
FindLocationsWithMaintenanceOverlap
¶
Bases: Job
Nautobot Job definition for finding locations without redundant circuit for impactful maintenance.
Current iteration of this job assumes that many locations will be only dual carrier connected. The searches are going to search for a single overlap in this first iteration.
Future iterations may include the ability to search for multiple circuit overlaps that would allow for just a single circuit to be available.
Source code in nautobot_circuit_maintenance/jobs/location_search.py
Meta
¶
Meta definition for the Job.
Source code in nautobot_circuit_maintenance/jobs/location_search.py
run()
¶
Executes the Job.
Source code in nautobot_circuit_maintenance/jobs/location_search.py
build_locations_to_maintenance_mapper(maintenance_queryset)
¶
Build a location to circuit maintenance mapper so the data can be quickly accessed of what possible overlaps.
Leverages defaultdict to provide the default value of an empty set to each key that will be added. Then adds each particular circuit maintenance object to the dictionary to be used as a map of maintenances going on at the location. Build a data dictionary that maps locations to circuit maintenances:
data_dict = { "msp": { CM1, CM2 }, "nyc": { CM3, CM4 } }
Parameters:
Name | Type | Description | Default |
---|---|---|---|
maintenance_queryset |
Queryset
|
Queryset of all Circuit Maintenance objects |
required |
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
Dictionary of a set of maintenance records |
Source code in nautobot_circuit_maintenance/jobs/location_search.py
check_for_overlap(record1, record2)
¶
Checks for the overlap of two circuit maintenance records.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
record1 |
CircuitMaintenance
|
First maintenance record |
required |
record2 |
CircuitMaintenance
|
Second maintenance record |
required |
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True if there is overlap, otherwise False. |
Source code in nautobot_circuit_maintenance/jobs/location_search.py
get_locations_from_circuit(circuit)
¶
Get a list of locations from a circuit object in Nautobot.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
circuit |
Circuit
|
Nautobot Circuit Object to find the locations |
required |
Returns:
Name | Type | Description |
---|---|---|
list |
set
|
List of Nautobot Location objects |