Circuit Maintenance Jobs¶
nautobot_circuit_maintenance.jobs
¶
Circuit Maintenance plugin jobs.
site_search
¶
Site searching Job definition.
FindSitesWithMaintenanceOverlap
¶
Bases: Job
Nautobot Job definition for finding sites without redundant circuit for impactful maintenance.
Current iteration of this job assumes that many sites 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/site_search.py
Meta
¶
Meta definition for the Job.
Source code in nautobot_circuit_maintenance/jobs/site_search.py
run(data=None, commit=None)
¶
Executes the Job.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
dict
|
Data from Nautobot from. Defaults to None. |
None
|
commit |
bool
|
Commit boolean. Defaults to None. |
None
|
Source code in nautobot_circuit_maintenance/jobs/site_search.py
build_sites_to_maintenance_mapper(maintenance_queryset)
¶
Build a site 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 site. Build a data dictionary that maps sites 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/site_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/site_search.py
get_sites_from_circuit(circuit)
¶
Get a list of sites from a circuit object in Nautobot.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
circuit |
Circuit
|
Nautobot Circuit Object to find the sites |
required |
Returns:
Name | Type | Description |
---|---|---|
list |
set
|
List of Nautobot Site objects |