Single Source of Truth API Package¶
nautobot_ssot.models
¶
Django Models for recording the status and progress of data synchronization between data sources.
The interaction between these models and Nautobot's native JobResult model deserves some examination.
- A JobResult is created each time a data sync is requested.
- This stores a reference to the specific sync operation requested (JobResult.name), much as a Job-related JobResult would reference the name of the Job.
- This stores a 'job_id', which this app uses to reference the specific sync instance.
- This stores the 'created' and 'completed' timestamps, and the requesting user (if any)
- This stores the overall 'status' of the job (pending, running, completed, failed, errored.)
- This stores a 'data' field which, in theory can store arbitrary JSON data, but in practice expects a fairly strict structure for logging of various status messages. This field is therefore not suitable for storage of in-depth data synchronization log messages, which have a different set of content requirements, but is used for high-level status reporting.
JobResult 1<->1 Sync 1-->n SyncLogEntry
AutomationGatewayModel
¶
Bases: PrimaryModel
Automation Gateway model for Nautobot Itential app.
Source code in nautobot_ssot/integrations/itential/models.py
Meta
¶
DiffJSONEncoder
¶
Bases: DjangoJSONEncoder
Custom JSON encoder for the Sync.diff field.
Source code in nautobot_ssot/models.py
SSOTConfig
¶
Bases: Model
Non-db model providing user permission constraints.
Source code in nautobot_ssot/models.py
SSOTInfobloxConfig
¶
Bases: PrimaryModel
SSOT Infoblox Configuration model.
Source code in nautobot_ssot/integrations/infoblox/models.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 |
|
Meta
¶
__str__()
¶
clean()
¶
Clean method for SSOTInfobloxConfig.
Source code in nautobot_ssot/integrations/infoblox/models.py
SSOTServiceNowConfig
¶
Bases: BaseModel
Singleton data model describing the configuration of this app.
Source code in nautobot_ssot/integrations/servicenow/models.py
Sync
¶
Bases: BaseModel
High-level overview of a data sync event/process/attempt.
Essentially an extension of the JobResult model to add a few additional fields.
Source code in nautobot_ssot/models.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
|
duration
property
¶
Total execution time of this Sync.
Meta
¶
__str__()
¶
annotated_queryset()
classmethod
¶
Construct an efficient queryset for this model and related data.
Source code in nautobot_ssot/models.py
get_absolute_url(api=False)
¶
get_source_url()
¶
Get the absolute url of the source worker associated with this instance.
Source code in nautobot_ssot/models.py
get_target_url()
¶
Get the absolute url of the target worker associated with this instance.
Source code in nautobot_ssot/models.py
SyncLogEntry
¶
Bases: BaseModel
Record of a single event during a data sync operation.
Detailed sync logs are recorded in this model, rather than in JobResult.data, because JobResult.data imposes fairly strict expectations about the structure of its contents that do not align well with the requirements of this app. Also, storing log entries as individual database records rather than a single JSON blob allows us to filter, query, sort, etc. as desired.
This model somewhat "shadows" Nautobot's built-in ObjectChange model; the key distinction to bear in mind is that an ObjectChange reflects a change that did happen, while a SyncLogEntry may reflect this or may reflect a change that could not happen or failed. Additionally, if we're syncing data from Nautobot to a different system as data target, the data isn't changing in Nautobot, so there will be no ObjectChange record.
Source code in nautobot_ssot/models.py
Meta
¶
get_action_class()
¶
Map self.action to a Bootstrap label class.
Source code in nautobot_ssot/models.py
get_status_class()
¶
Map self.status to a Bootstrap label class.