@oneuptime/common 11.6.1 → 11.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (420) hide show
  1. package/Models/AnalyticsModels/Index.ts +4 -0
  2. package/Models/AnalyticsModels/KubernetesCostAllocation.ts +842 -0
  3. package/Models/AnalyticsModels/NetworkFlow.ts +54 -0
  4. package/Models/AnalyticsModels/SloHistory.ts +243 -0
  5. package/Models/DatabaseModels/Index.ts +20 -0
  6. package/Models/DatabaseModels/NetworkDevice.ts +453 -6
  7. package/Models/DatabaseModels/NetworkDeviceDiscoveryScan.ts +7 -6
  8. package/Models/DatabaseModels/NetworkEndpoint.ts +753 -0
  9. package/Models/DatabaseModels/NetworkSite.ts +1155 -0
  10. package/Models/DatabaseModels/NetworkSiteAssignmentRule.ts +517 -0
  11. package/Models/DatabaseModels/NetworkSiteLink.ts +611 -0
  12. package/Models/DatabaseModels/NetworkSiteStatusTimeline.ts +520 -0
  13. package/Models/DatabaseModels/NetworkSiteType.ts +499 -0
  14. package/Models/DatabaseModels/ServiceLevelObjective.ts +1115 -0
  15. package/Models/DatabaseModels/ServiceLevelObjectiveBurnRateRule.ts +762 -0
  16. package/Models/DatabaseModels/ServiceLevelObjectiveOwnerTeam.ts +444 -0
  17. package/Models/DatabaseModels/ServiceLevelObjectiveOwnerUser.ts +443 -0
  18. package/Server/Infrastructure/Postgres/SchemaMigrations/1784757142154-AddNetworkSiteHierarchyAndEndpoints.ts +359 -0
  19. package/Server/Infrastructure/Postgres/SchemaMigrations/1784897317860-AddNetworkSiteAlerting.ts +48 -0
  20. package/Server/Infrastructure/Postgres/SchemaMigrations/1784970388777-AddNetworkDevicePollingColumns.ts +65 -0
  21. package/Server/Infrastructure/Postgres/SchemaMigrations/1784986826214-AddNetworkSiteTypeTable.ts +88 -0
  22. package/Server/Infrastructure/Postgres/SchemaMigrations/1784987015619-AddServiceLevelObjective.ts +391 -0
  23. package/Server/Infrastructure/Postgres/SchemaMigrations/1785066759532-MigrationName.ts +30 -0
  24. package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +12 -0
  25. package/Server/Services/AnalyticsDatabaseService.ts +25 -9
  26. package/Server/Services/Index.ts +24 -0
  27. package/Server/Services/KubernetesCostAllocationService.ts +14 -0
  28. package/Server/Services/MetricService.ts +21 -2
  29. package/Server/Services/MonitorService.ts +22 -0
  30. package/Server/Services/NetworkDeviceService.ts +438 -2
  31. package/Server/Services/NetworkEndpointService.ts +414 -0
  32. package/Server/Services/NetworkSiteAssignmentRuleService.ts +98 -0
  33. package/Server/Services/NetworkSiteLinkService.ts +10 -0
  34. package/Server/Services/NetworkSiteService.ts +1254 -0
  35. package/Server/Services/NetworkSiteStatusTimelineService.ts +10 -0
  36. package/Server/Services/NetworkSiteTypeService.ts +10 -0
  37. package/Server/Services/ProjectService.ts +122 -2
  38. package/Server/Services/ServiceLevelObjectiveBurnRateRuleService.ts +457 -0
  39. package/Server/Services/ServiceLevelObjectiveOwnerTeamService.ts +10 -0
  40. package/Server/Services/ServiceLevelObjectiveOwnerUserService.ts +10 -0
  41. package/Server/Services/ServiceLevelObjectiveService.ts +685 -0
  42. package/Server/Services/SloHistoryService.ts +101 -0
  43. package/Server/Services/UserNotificationSettingService.ts +37 -0
  44. package/Server/Types/AnalyticsDatabase/AggregateBy.ts +9 -0
  45. package/Server/Types/Database/Permissions/OwnerTableRegistry.ts +15 -0
  46. package/Server/Utils/AnalyticsDatabase/Statement.ts +39 -3
  47. package/Server/Utils/AnalyticsDatabase/StatementGenerator.ts +87 -48
  48. package/Server/Utils/Memory.ts +9 -1
  49. package/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.ts +190 -12
  50. package/Server/Utils/Monitor/Data/OuiVendors.json +6920 -0
  51. package/Server/Utils/Monitor/DnsResolutionCache.ts +129 -0
  52. package/Server/Utils/Monitor/MonitorResource.ts +4 -30
  53. package/Server/Utils/Monitor/NetworkDeviceHydrationUtil.ts +214 -39
  54. package/Server/Utils/Monitor/NetworkDeviceMetricUtil.ts +343 -0
  55. package/Server/Utils/Monitor/NetworkDeviceWalkUtil.ts +251 -0
  56. package/Server/Utils/Monitor/NetworkInventoryUtil.ts +176 -142
  57. package/Server/Utils/Monitor/OuiLookupUtil.ts +49 -0
  58. package/Server/Utils/Monitor/SnmpInterfaceRateUtil.ts +17 -13
  59. package/Server/Utils/WhatsAppTemplateUtil.ts +7 -3
  60. package/Tests/Models/AnalyticsModels/KubernetesCostAllocation.test.ts +135 -0
  61. package/Tests/Models/NetworkSiteHierarchy.test.ts +134 -0
  62. package/Tests/Server/Services/AnalyticsDatabaseService.test.ts +239 -0
  63. package/Tests/Server/Services/KubernetesCostAllocationAggregate.test.ts +338 -0
  64. package/Tests/Server/Services/MetricServiceAggregate.test.ts +142 -0
  65. package/Tests/Server/Services/NetworkDeviceSiteAssignment.test.ts +484 -0
  66. package/Tests/Server/Services/NetworkEndpointServiceUpsert.test.ts +686 -0
  67. package/Tests/Server/Services/NetworkSiteAssignmentRuleService.test.ts +185 -0
  68. package/Tests/Server/Services/NetworkSiteService.test.ts +1354 -0
  69. package/Tests/Server/Services/ServiceLevelObjectiveBurnRateRuleService.test.ts +1313 -0
  70. package/Tests/Server/Services/ServiceLevelObjectiveService.test.ts +1988 -0
  71. package/Tests/Server/Utils/AnalyticsDatabase/Statement.test.ts +22 -0
  72. package/Tests/Server/Utils/AnalyticsDatabase/StatementGenerator.test.ts +404 -0
  73. package/Tests/Server/Utils/Encryption.test.ts +70 -0
  74. package/Tests/Server/Utils/FileAttachmentMarkdownUtil.test.ts +225 -0
  75. package/Tests/Server/Utils/JsonWebToken.test.ts +175 -0
  76. package/Tests/Server/Utils/LocalFile.test.ts +258 -0
  77. package/Tests/Server/Utils/Memory.test.ts +213 -0
  78. package/Tests/Server/Utils/Monitor/Criteria/LogMonitorCriteria.test.ts +30 -0
  79. package/Tests/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.test.ts +385 -0
  80. package/Tests/Server/Utils/Monitor/DnsResolutionCache.test.ts +194 -0
  81. package/Tests/Server/Utils/Monitor/NetworkDeviceHydrationUtil.test.ts +155 -0
  82. package/Tests/Server/Utils/Monitor/NetworkDeviceWalkUtil.test.ts +600 -0
  83. package/Tests/Server/Utils/Monitor/NetworkInventoryUtil.test.ts +151 -124
  84. package/Tests/Server/Utils/Monitor/SnmpInterfaceRateUtil.test.ts +496 -0
  85. package/Tests/Server/Utils/MonitorCriteriaDataExtractor.test.ts +175 -0
  86. package/Tests/Server/Utils/MonitorCriteriaMessageFormatter.test.ts +282 -0
  87. package/Tests/Server/Utils/OuiLookupUtil.test.ts +59 -0
  88. package/Tests/Server/Utils/SeriesResourceLabels.test.ts +117 -0
  89. package/Tests/Server/Utils/StackTraceParser.test.ts +370 -0
  90. package/Tests/Server/Utils/Stream.test.ts +87 -0
  91. package/Tests/Server/Utils/ValidateGlobalProviderProjectTeams.test.ts +221 -0
  92. package/Tests/Server/Utils/WhatsAppTemplateUtil.test.ts +199 -0
  93. package/Tests/Types/Database/CompareOperatorWireSerialization.test.ts +33 -0
  94. package/Tests/Types/Email.test.ts +198 -0
  95. package/Tests/Types/Kubernetes/KubernetesObjectParser.test.ts +177 -0
  96. package/Tests/Types/Log/LogQueryToFilter.test.ts +111 -0
  97. package/Tests/Types/Monitor/MonitorCriteria.test.ts +155 -0
  98. package/Tests/Types/Monitor/MonitorCriteriaInstance.test.ts +465 -0
  99. package/Tests/Types/Monitor/MonitorStep.test.ts +183 -0
  100. package/Tests/Types/Monitor/MonitorStepNetworkDeviceMonitor.test.ts +141 -1
  101. package/Tests/Types/Monitor/MonitorSteps.test.ts +183 -0
  102. package/Tests/Types/Monitor/MonitorType.test.ts +59 -1
  103. package/Tests/Types/Monitor/NetworkDeviceAlertPack.test.ts +97 -0
  104. package/Tests/Types/Monitor/SnmpEndpointDiscovery.test.ts +151 -0
  105. package/Tests/Types/Monitor/SnmpVendorTemplate.test.ts +110 -6
  106. package/Tests/Types/NetworkSite/DefaultNetworkSiteType.test.ts +129 -0
  107. package/Tests/Types/SerializableObjectDictionary.test.ts +166 -0
  108. package/Tests/Types/Time/RangeStartAndEndDateTime.test.ts +98 -0
  109. package/Tests/Types/WebsiteRequest.test.ts +230 -0
  110. package/Tests/UI/Components/EntityFilterRoundTrip.test.tsx +103 -0
  111. package/Tests/UI/Components/ModelTable/BaseModelTableUrlState.test.tsx +612 -0
  112. package/Tests/UI/Components/ModelTable/FilterDataToQuery.test.ts +275 -0
  113. package/Tests/UI/Utils/LogExport.test.ts +159 -0
  114. package/Tests/UI/Utils/Navigation.test.ts +183 -0
  115. package/Tests/UI/Utils/TableFilterUrlState.test.ts +539 -0
  116. package/Tests/UI/Utils/TableViewUrlState.test.ts +272 -0
  117. package/Tests/Utils/Base64.test.ts +51 -0
  118. package/Tests/Utils/Boolean.test.ts +76 -0
  119. package/Tests/Utils/Crypto.test.ts +48 -0
  120. package/Tests/Utils/Dashboard/DashboardSloComponent.test.ts +259 -0
  121. package/Tests/Utils/Dashboard/ModelQueryVariableInterpolation.test.ts +162 -0
  122. package/Tests/Utils/Enum.test.ts +54 -0
  123. package/Tests/Utils/IpCanonicalUtil.test.ts +85 -0
  124. package/Tests/Utils/Memory.test.ts +44 -0
  125. package/Tests/Utils/Metrics/MetricSeriesFingerprint.test.ts +160 -0
  126. package/Tests/Utils/Monitor/EndpointAttachmentUtil.test.ts +836 -0
  127. package/Tests/Utils/Monitor/MonitorMetricType.test.ts +218 -0
  128. package/Tests/Utils/Monitor/NetworkTopologyUtil.test.ts +447 -0
  129. package/Tests/Utils/NetworkSite/CidrMatchUtil.test.ts +440 -0
  130. package/Tests/Utils/NetworkSite/MaterializedPathUtil.test.ts +205 -0
  131. package/Tests/Utils/NetworkSite/SiteStatusRollupUtil.test.ts +221 -0
  132. package/Tests/Utils/NetworkSite/SiteUptimeUtil.test.ts +283 -0
  133. package/Tests/Utils/ObjectUtil.test.ts +30 -0
  134. package/Tests/Utils/Slo/SloBurnRateRuleState.test.ts +124 -0
  135. package/Tests/Utils/Slo/SloDuration.test.ts +148 -0
  136. package/Tests/Utils/Slo/SloHealth.test.ts +334 -0
  137. package/Tests/Utils/Slo/SloStatusColor.test.ts +89 -0
  138. package/Tests/Utils/Slo/SloUtil.test.ts +1980 -0
  139. package/Tests/Utils/Slo/SloWidgetFormat.test.ts +605 -0
  140. package/Tests/Utils/TechStack.test.ts +50 -0
  141. package/Tests/Utils/Traces/CriticalPath.test.ts +178 -0
  142. package/Types/AnalyticsDatabase/AnalyticsTableName.ts +10 -0
  143. package/Types/BaseDatabase/EqualTo.ts +9 -1
  144. package/Types/BaseDatabase/EqualToOrNull.ts +9 -1
  145. package/Types/BaseDatabase/NotEqual.ts +9 -1
  146. package/Types/Dashboard/DashboardComponentType.ts +1 -0
  147. package/Types/Dashboard/DashboardComponents/ComponentArgument.ts +1 -0
  148. package/Types/Dashboard/DashboardComponents/DashboardSloComponent.ts +42 -0
  149. package/Types/Dashboard/DashboardTemplates.ts +214 -0
  150. package/Types/Email/EmailTemplateType.ts +2 -0
  151. package/Types/Kubernetes/KubernetesCostIngest.ts +79 -0
  152. package/Types/Monitor/CriteriaFilter.ts +9 -0
  153. package/Types/Monitor/MonitorStep.ts +5 -8
  154. package/Types/Monitor/MonitorStepNetworkDeviceMonitor.ts +27 -5
  155. package/Types/Monitor/MonitorType.ts +15 -5
  156. package/Types/Monitor/SnmpMonitor/ArpEntry.ts +14 -0
  157. package/Types/Monitor/SnmpMonitor/FdbEntry.ts +18 -0
  158. package/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.ts +10 -3
  159. package/Types/Monitor/SnmpMonitor/NetworkTopology.ts +31 -5
  160. package/Types/Monitor/SnmpMonitor/SnmpMonitorResponse.ts +12 -0
  161. package/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.ts +231 -3
  162. package/Types/NetworkSite/DefaultNetworkSiteType.ts +20 -0
  163. package/Types/NotificationSetting/NotificationSettingEventType.ts +4 -0
  164. package/Types/Permission.ts +449 -0
  165. package/Types/ServiceLevelObjective/SliType.ts +6 -0
  166. package/Types/ServiceLevelObjective/SloMultiMonitorMode.ts +6 -0
  167. package/Types/ServiceLevelObjective/SloStatus.ts +9 -0
  168. package/Types/ServiceLevelObjective/SloWindowType.ts +6 -0
  169. package/Types/Telemetry/ServiceType.ts +1 -0
  170. package/UI/Components/Filters/EntityFilter.tsx +16 -0
  171. package/UI/Components/Filters/FilterViewer.tsx +22 -5
  172. package/UI/Components/List/List.tsx +8 -0
  173. package/UI/Components/ModelTable/BaseModelTable.tsx +309 -106
  174. package/UI/Components/ModelTable/FilterDataToQuery.ts +172 -0
  175. package/UI/Components/Navbar/NavBar.tsx +16 -2
  176. package/UI/Components/Navbar/NavBarMenuModal.tsx +3 -3
  177. package/UI/Utils/Navigation.ts +10 -0
  178. package/UI/Utils/TableFilterUrlState.ts +204 -17
  179. package/UI/Utils/TableViewUrlState.ts +165 -0
  180. package/Utils/Dashboard/Components/DashboardSloComponent.ts +114 -0
  181. package/Utils/Dashboard/Components/Index.ts +7 -0
  182. package/Utils/IpCanonicalUtil.ts +134 -0
  183. package/Utils/Monitor/EndpointAttachmentUtil.ts +508 -0
  184. package/Utils/Monitor/NetworkTopologyUtil.ts +157 -5
  185. package/Utils/NetworkSite/CidrMatchUtil.ts +296 -0
  186. package/Utils/NetworkSite/MaterializedPathUtil.ts +115 -0
  187. package/Utils/NetworkSite/SiteStatusRollupUtil.ts +97 -0
  188. package/Utils/NetworkSite/SiteUptimeUtil.ts +111 -0
  189. package/Utils/Slo/SloBurnRateRuleState.ts +91 -0
  190. package/Utils/Slo/SloDuration.ts +165 -0
  191. package/Utils/Slo/SloEvaluation.ts +22 -0
  192. package/Utils/Slo/SloHealth.ts +302 -0
  193. package/Utils/Slo/SloStatusColor.ts +54 -0
  194. package/Utils/Slo/SloUtil.ts +637 -0
  195. package/Utils/Slo/SloWidgetFormat.ts +383 -0
  196. package/build/dist/Models/AnalyticsModels/Index.js +4 -0
  197. package/build/dist/Models/AnalyticsModels/Index.js.map +1 -1
  198. package/build/dist/Models/AnalyticsModels/KubernetesCostAllocation.js +713 -0
  199. package/build/dist/Models/AnalyticsModels/KubernetesCostAllocation.js.map +1 -0
  200. package/build/dist/Models/AnalyticsModels/NetworkFlow.js +44 -0
  201. package/build/dist/Models/AnalyticsModels/NetworkFlow.js.map +1 -1
  202. package/build/dist/Models/AnalyticsModels/SloHistory.js +218 -0
  203. package/build/dist/Models/AnalyticsModels/SloHistory.js.map +1 -0
  204. package/build/dist/Models/DatabaseModels/Index.js +20 -0
  205. package/build/dist/Models/DatabaseModels/Index.js.map +1 -1
  206. package/build/dist/Models/DatabaseModels/NetworkDevice.js +458 -6
  207. package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -1
  208. package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js +0 -6
  209. package/build/dist/Models/DatabaseModels/NetworkDeviceDiscoveryScan.js.map +1 -1
  210. package/build/dist/Models/DatabaseModels/NetworkEndpoint.js +779 -0
  211. package/build/dist/Models/DatabaseModels/NetworkEndpoint.js.map +1 -0
  212. package/build/dist/Models/DatabaseModels/NetworkSite.js +1180 -0
  213. package/build/dist/Models/DatabaseModels/NetworkSite.js.map +1 -0
  214. package/build/dist/Models/DatabaseModels/NetworkSiteAssignmentRule.js +534 -0
  215. package/build/dist/Models/DatabaseModels/NetworkSiteAssignmentRule.js.map +1 -0
  216. package/build/dist/Models/DatabaseModels/NetworkSiteLink.js +629 -0
  217. package/build/dist/Models/DatabaseModels/NetworkSiteLink.js.map +1 -0
  218. package/build/dist/Models/DatabaseModels/NetworkSiteStatusTimeline.js +538 -0
  219. package/build/dist/Models/DatabaseModels/NetworkSiteStatusTimeline.js.map +1 -0
  220. package/build/dist/Models/DatabaseModels/NetworkSiteType.js +522 -0
  221. package/build/dist/Models/DatabaseModels/NetworkSiteType.js.map +1 -0
  222. package/build/dist/Models/DatabaseModels/ServiceLevelObjective.js +1134 -0
  223. package/build/dist/Models/DatabaseModels/ServiceLevelObjective.js.map +1 -0
  224. package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveBurnRateRule.js +769 -0
  225. package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveBurnRateRule.js.map +1 -0
  226. package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveOwnerTeam.js +460 -0
  227. package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveOwnerTeam.js.map +1 -0
  228. package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveOwnerUser.js +459 -0
  229. package/build/dist/Models/DatabaseModels/ServiceLevelObjectiveOwnerUser.js.map +1 -0
  230. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784757142154-AddNetworkSiteHierarchyAndEndpoints.js +130 -0
  231. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784757142154-AddNetworkSiteHierarchyAndEndpoints.js.map +1 -0
  232. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784897317860-AddNetworkSiteAlerting.js +31 -0
  233. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784897317860-AddNetworkSiteAlerting.js.map +1 -0
  234. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784970388777-AddNetworkDevicePollingColumns.js +36 -0
  235. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784970388777-AddNetworkDevicePollingColumns.js.map +1 -0
  236. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784986826214-AddNetworkSiteTypeTable.js +49 -0
  237. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784986826214-AddNetworkSiteTypeTable.js.map +1 -0
  238. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784987015619-AddServiceLevelObjective.js +140 -0
  239. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1784987015619-AddServiceLevelObjective.js.map +1 -0
  240. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785066759532-MigrationName.js +21 -0
  241. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1785066759532-MigrationName.js.map +1 -0
  242. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +12 -0
  243. package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
  244. package/build/dist/Server/Services/AnalyticsDatabaseService.js +23 -6
  245. package/build/dist/Server/Services/AnalyticsDatabaseService.js.map +1 -1
  246. package/build/dist/Server/Services/Index.js +24 -0
  247. package/build/dist/Server/Services/Index.js.map +1 -1
  248. package/build/dist/Server/Services/KubernetesCostAllocationService.js +12 -0
  249. package/build/dist/Server/Services/KubernetesCostAllocationService.js.map +1 -0
  250. package/build/dist/Server/Services/MetricService.js +21 -3
  251. package/build/dist/Server/Services/MetricService.js.map +1 -1
  252. package/build/dist/Server/Services/MonitorService.js +19 -0
  253. package/build/dist/Server/Services/MonitorService.js.map +1 -1
  254. package/build/dist/Server/Services/NetworkDeviceService.js +351 -1
  255. package/build/dist/Server/Services/NetworkDeviceService.js.map +1 -1
  256. package/build/dist/Server/Services/NetworkEndpointService.js +319 -0
  257. package/build/dist/Server/Services/NetworkEndpointService.js.map +1 -0
  258. package/build/dist/Server/Services/NetworkSiteAssignmentRuleService.js +90 -0
  259. package/build/dist/Server/Services/NetworkSiteAssignmentRuleService.js.map +1 -0
  260. package/build/dist/Server/Services/NetworkSiteLinkService.js +9 -0
  261. package/build/dist/Server/Services/NetworkSiteLinkService.js.map +1 -0
  262. package/build/dist/Server/Services/NetworkSiteService.js +1038 -0
  263. package/build/dist/Server/Services/NetworkSiteService.js.map +1 -0
  264. package/build/dist/Server/Services/NetworkSiteStatusTimelineService.js +9 -0
  265. package/build/dist/Server/Services/NetworkSiteStatusTimelineService.js.map +1 -0
  266. package/build/dist/Server/Services/NetworkSiteTypeService.js +9 -0
  267. package/build/dist/Server/Services/NetworkSiteTypeService.js.map +1 -0
  268. package/build/dist/Server/Services/ProjectService.js +98 -2
  269. package/build/dist/Server/Services/ProjectService.js.map +1 -1
  270. package/build/dist/Server/Services/ServiceLevelObjectiveBurnRateRuleService.js +358 -0
  271. package/build/dist/Server/Services/ServiceLevelObjectiveBurnRateRuleService.js.map +1 -0
  272. package/build/dist/Server/Services/ServiceLevelObjectiveOwnerTeamService.js +9 -0
  273. package/build/dist/Server/Services/ServiceLevelObjectiveOwnerTeamService.js.map +1 -0
  274. package/build/dist/Server/Services/ServiceLevelObjectiveOwnerUserService.js +9 -0
  275. package/build/dist/Server/Services/ServiceLevelObjectiveOwnerUserService.js.map +1 -0
  276. package/build/dist/Server/Services/ServiceLevelObjectiveService.js +588 -0
  277. package/build/dist/Server/Services/ServiceLevelObjectiveService.js.map +1 -0
  278. package/build/dist/Server/Services/SloHistoryService.js +77 -0
  279. package/build/dist/Server/Services/SloHistoryService.js.map +1 -0
  280. package/build/dist/Server/Services/UserNotificationSettingService.js +20 -0
  281. package/build/dist/Server/Services/UserNotificationSettingService.js.map +1 -1
  282. package/build/dist/Server/Types/AnalyticsDatabase/AggregateBy.js +9 -0
  283. package/build/dist/Server/Types/AnalyticsDatabase/AggregateBy.js.map +1 -1
  284. package/build/dist/Server/Types/Database/Permissions/OwnerTableRegistry.js +15 -0
  285. package/build/dist/Server/Types/Database/Permissions/OwnerTableRegistry.js.map +1 -1
  286. package/build/dist/Server/Utils/AnalyticsDatabase/Statement.js +31 -0
  287. package/build/dist/Server/Utils/AnalyticsDatabase/Statement.js.map +1 -1
  288. package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js +76 -48
  289. package/build/dist/Server/Utils/AnalyticsDatabase/StatementGenerator.js.map +1 -1
  290. package/build/dist/Server/Utils/Memory.js +9 -1
  291. package/build/dist/Server/Utils/Memory.js.map +1 -1
  292. package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js +132 -10
  293. package/build/dist/Server/Utils/Monitor/Criteria/SnmpMonitorCriteria.js.map +1 -1
  294. package/build/dist/Server/Utils/Monitor/Data/OuiVendors.json +6920 -0
  295. package/build/dist/Server/Utils/Monitor/DnsResolutionCache.js +77 -0
  296. package/build/dist/Server/Utils/Monitor/DnsResolutionCache.js.map +1 -0
  297. package/build/dist/Server/Utils/Monitor/MonitorResource.js +21 -41
  298. package/build/dist/Server/Utils/Monitor/MonitorResource.js.map +1 -1
  299. package/build/dist/Server/Utils/Monitor/NetworkDeviceHydrationUtil.js +152 -40
  300. package/build/dist/Server/Utils/Monitor/NetworkDeviceHydrationUtil.js.map +1 -1
  301. package/build/dist/Server/Utils/Monitor/NetworkDeviceMetricUtil.js +262 -0
  302. package/build/dist/Server/Utils/Monitor/NetworkDeviceMetricUtil.js.map +1 -0
  303. package/build/dist/Server/Utils/Monitor/NetworkDeviceWalkUtil.js +201 -0
  304. package/build/dist/Server/Utils/Monitor/NetworkDeviceWalkUtil.js.map +1 -0
  305. package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js +152 -120
  306. package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js.map +1 -1
  307. package/build/dist/Server/Utils/Monitor/OuiLookupUtil.js +44 -0
  308. package/build/dist/Server/Utils/Monitor/OuiLookupUtil.js.map +1 -0
  309. package/build/dist/Server/Utils/Monitor/SnmpInterfaceRateUtil.js +10 -10
  310. package/build/dist/Server/Utils/Monitor/SnmpInterfaceRateUtil.js.map +1 -1
  311. package/build/dist/Server/Utils/WhatsAppTemplateUtil.js +5 -0
  312. package/build/dist/Server/Utils/WhatsAppTemplateUtil.js.map +1 -1
  313. package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js +10 -0
  314. package/build/dist/Types/AnalyticsDatabase/AnalyticsTableName.js.map +1 -1
  315. package/build/dist/Types/BaseDatabase/EqualTo.js +9 -1
  316. package/build/dist/Types/BaseDatabase/EqualTo.js.map +1 -1
  317. package/build/dist/Types/BaseDatabase/EqualToOrNull.js +9 -1
  318. package/build/dist/Types/BaseDatabase/EqualToOrNull.js.map +1 -1
  319. package/build/dist/Types/BaseDatabase/NotEqual.js +9 -1
  320. package/build/dist/Types/BaseDatabase/NotEqual.js.map +1 -1
  321. package/build/dist/Types/Dashboard/DashboardComponentType.js +1 -0
  322. package/build/dist/Types/Dashboard/DashboardComponentType.js.map +1 -1
  323. package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js +1 -0
  324. package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js.map +1 -1
  325. package/build/dist/Types/Dashboard/DashboardComponents/DashboardSloComponent.js +23 -0
  326. package/build/dist/Types/Dashboard/DashboardComponents/DashboardSloComponent.js.map +1 -0
  327. package/build/dist/Types/Dashboard/DashboardTemplates.js +205 -0
  328. package/build/dist/Types/Dashboard/DashboardTemplates.js.map +1 -1
  329. package/build/dist/Types/Email/EmailTemplateType.js +1 -0
  330. package/build/dist/Types/Email/EmailTemplateType.js.map +1 -1
  331. package/build/dist/Types/Kubernetes/KubernetesCostIngest.js +21 -0
  332. package/build/dist/Types/Kubernetes/KubernetesCostIngest.js.map +1 -0
  333. package/build/dist/Types/Monitor/CriteriaFilter.js +1 -0
  334. package/build/dist/Types/Monitor/CriteriaFilter.js.map +1 -1
  335. package/build/dist/Types/Monitor/MonitorStep.js +5 -5
  336. package/build/dist/Types/Monitor/MonitorStep.js.map +1 -1
  337. package/build/dist/Types/Monitor/MonitorStepNetworkDeviceMonitor.js +8 -0
  338. package/build/dist/Types/Monitor/MonitorStepNetworkDeviceMonitor.js.map +1 -1
  339. package/build/dist/Types/Monitor/MonitorType.js +15 -5
  340. package/build/dist/Types/Monitor/MonitorType.js.map +1 -1
  341. package/build/dist/Types/Monitor/SnmpMonitor/ArpEntry.js +2 -0
  342. package/build/dist/Types/Monitor/SnmpMonitor/ArpEntry.js.map +1 -0
  343. package/build/dist/Types/Monitor/SnmpMonitor/FdbEntry.js +2 -0
  344. package/build/dist/Types/Monitor/SnmpMonitor/FdbEntry.js.map +1 -0
  345. package/build/dist/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.js +9 -3
  346. package/build/dist/Types/Monitor/SnmpMonitor/NetworkDeviceAlertPack.js.map +1 -1
  347. package/build/dist/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.js +217 -3
  348. package/build/dist/Types/Monitor/SnmpMonitor/SnmpVendorTemplate.js.map +1 -1
  349. package/build/dist/Types/NetworkSite/DefaultNetworkSiteType.js +21 -0
  350. package/build/dist/Types/NetworkSite/DefaultNetworkSiteType.js.map +1 -0
  351. package/build/dist/Types/NotificationSetting/NotificationSettingEventType.js +3 -0
  352. package/build/dist/Types/NotificationSetting/NotificationSettingEventType.js.map +1 -1
  353. package/build/dist/Types/Permission.js +409 -0
  354. package/build/dist/Types/Permission.js.map +1 -1
  355. package/build/dist/Types/ServiceLevelObjective/SliType.js +7 -0
  356. package/build/dist/Types/ServiceLevelObjective/SliType.js.map +1 -0
  357. package/build/dist/Types/ServiceLevelObjective/SloMultiMonitorMode.js +7 -0
  358. package/build/dist/Types/ServiceLevelObjective/SloMultiMonitorMode.js.map +1 -0
  359. package/build/dist/Types/ServiceLevelObjective/SloStatus.js +10 -0
  360. package/build/dist/Types/ServiceLevelObjective/SloStatus.js.map +1 -0
  361. package/build/dist/Types/ServiceLevelObjective/SloWindowType.js +7 -0
  362. package/build/dist/Types/ServiceLevelObjective/SloWindowType.js.map +1 -0
  363. package/build/dist/Types/Telemetry/ServiceType.js +1 -0
  364. package/build/dist/Types/Telemetry/ServiceType.js.map +1 -1
  365. package/build/dist/UI/Components/Filters/EntityFilter.js +15 -0
  366. package/build/dist/UI/Components/Filters/EntityFilter.js.map +1 -1
  367. package/build/dist/UI/Components/Filters/FilterViewer.js +19 -4
  368. package/build/dist/UI/Components/Filters/FilterViewer.js.map +1 -1
  369. package/build/dist/UI/Components/List/List.js +1 -1
  370. package/build/dist/UI/Components/List/List.js.map +1 -1
  371. package/build/dist/UI/Components/ModelTable/BaseModelTable.js +235 -89
  372. package/build/dist/UI/Components/ModelTable/BaseModelTable.js.map +1 -1
  373. package/build/dist/UI/Components/ModelTable/FilterDataToQuery.js +96 -0
  374. package/build/dist/UI/Components/ModelTable/FilterDataToQuery.js.map +1 -0
  375. package/build/dist/UI/Components/Navbar/NavBar.js +14 -2
  376. package/build/dist/UI/Components/Navbar/NavBar.js.map +1 -1
  377. package/build/dist/UI/Components/Navbar/NavBarMenuModal.js +3 -2
  378. package/build/dist/UI/Components/Navbar/NavBarMenuModal.js.map +1 -1
  379. package/build/dist/UI/Utils/Navigation.js +9 -0
  380. package/build/dist/UI/Utils/Navigation.js.map +1 -1
  381. package/build/dist/UI/Utils/TableFilterUrlState.js +159 -15
  382. package/build/dist/UI/Utils/TableFilterUrlState.js.map +1 -1
  383. package/build/dist/UI/Utils/TableViewUrlState.js +103 -0
  384. package/build/dist/UI/Utils/TableViewUrlState.js.map +1 -0
  385. package/build/dist/Utils/Dashboard/Components/DashboardSloComponent.js +93 -0
  386. package/build/dist/Utils/Dashboard/Components/DashboardSloComponent.js.map +1 -0
  387. package/build/dist/Utils/Dashboard/Components/Index.js +4 -0
  388. package/build/dist/Utils/Dashboard/Components/Index.js.map +1 -1
  389. package/build/dist/Utils/IpCanonicalUtil.js +110 -0
  390. package/build/dist/Utils/IpCanonicalUtil.js.map +1 -0
  391. package/build/dist/Utils/Monitor/EndpointAttachmentUtil.js +311 -0
  392. package/build/dist/Utils/Monitor/EndpointAttachmentUtil.js.map +1 -0
  393. package/build/dist/Utils/Monitor/NetworkTopologyUtil.js +98 -5
  394. package/build/dist/Utils/Monitor/NetworkTopologyUtil.js.map +1 -1
  395. package/build/dist/Utils/NetworkSite/CidrMatchUtil.js +222 -0
  396. package/build/dist/Utils/NetworkSite/CidrMatchUtil.js.map +1 -0
  397. package/build/dist/Utils/NetworkSite/MaterializedPathUtil.js +89 -0
  398. package/build/dist/Utils/NetworkSite/MaterializedPathUtil.js.map +1 -0
  399. package/build/dist/Utils/NetworkSite/SiteStatusRollupUtil.js +60 -0
  400. package/build/dist/Utils/NetworkSite/SiteStatusRollupUtil.js.map +1 -0
  401. package/build/dist/Utils/NetworkSite/SiteUptimeUtil.js +76 -0
  402. package/build/dist/Utils/NetworkSite/SiteUptimeUtil.js.map +1 -0
  403. package/build/dist/Utils/Slo/SloBurnRateRuleState.js +35 -0
  404. package/build/dist/Utils/Slo/SloBurnRateRuleState.js.map +1 -0
  405. package/build/dist/Utils/Slo/SloDuration.js +87 -0
  406. package/build/dist/Utils/Slo/SloDuration.js.map +1 -0
  407. package/build/dist/Utils/Slo/SloEvaluation.js +21 -0
  408. package/build/dist/Utils/Slo/SloEvaluation.js.map +1 -0
  409. package/build/dist/Utils/Slo/SloHealth.js +179 -0
  410. package/build/dist/Utils/Slo/SloHealth.js.map +1 -0
  411. package/build/dist/Utils/Slo/SloStatusColor.js +18 -0
  412. package/build/dist/Utils/Slo/SloStatusColor.js.map +1 -0
  413. package/build/dist/Utils/Slo/SloUtil.js +393 -0
  414. package/build/dist/Utils/Slo/SloUtil.js.map +1 -0
  415. package/build/dist/Utils/Slo/SloWidgetFormat.js +174 -0
  416. package/build/dist/Utils/Slo/SloWidgetFormat.js.map +1 -0
  417. package/package.json +2 -2
  418. package/Types/Dashboard/DashboardComponents/Index.ts +0 -7
  419. package/build/dist/Types/Dashboard/DashboardComponents/Index.js +0 -8
  420. package/build/dist/Types/Dashboard/DashboardComponents/Index.js.map +0 -1
@@ -0,0 +1,836 @@
1
+ import EndpointAttachmentUtil, {
2
+ ENDPOINT_LAST_SEEN_REFRESH_MS,
3
+ EndpointAttachment,
4
+ EndpointAttachmentResult,
5
+ EndpointExistingRowSnapshot,
6
+ EndpointIpBinding,
7
+ EndpointUpsertContext,
8
+ EndpointUpsertDecision,
9
+ normalizeMac,
10
+ } from "../../../Utils/Monitor/EndpointAttachmentUtil";
11
+ import FdbEntry from "../../../Types/Monitor/SnmpMonitor/FdbEntry";
12
+ import ArpEntry from "../../../Types/Monitor/SnmpMonitor/ArpEntry";
13
+
14
+ describe("EndpointAttachmentUtil.normalizeMac", () => {
15
+ it("normalizes colon form to lowercase", () => {
16
+ expect(normalizeMac("AA:BB:CC:DD:EE:FF")).toBe("aa:bb:cc:dd:ee:ff");
17
+ });
18
+
19
+ it("normalizes dash form", () => {
20
+ expect(normalizeMac("AA-BB-CC-DD-EE-FF")).toBe("aa:bb:cc:dd:ee:ff");
21
+ });
22
+
23
+ it("normalizes Cisco dot form", () => {
24
+ expect(normalizeMac("aabb.ccdd.eeff")).toBe("aa:bb:cc:dd:ee:ff");
25
+ });
26
+
27
+ it("normalizes bare hex", () => {
28
+ expect(normalizeMac("aabbccddeeff")).toBe("aa:bb:cc:dd:ee:ff");
29
+ });
30
+
31
+ it("normalizes 0x-prefixed hex and trims whitespace", () => {
32
+ expect(normalizeMac(" 0xAABBCCDDEEFF ")).toBe("aa:bb:cc:dd:ee:ff");
33
+ });
34
+
35
+ it("normalizes space-separated octets", () => {
36
+ expect(normalizeMac("aa bb cc dd ee ff")).toBe("aa:bb:cc:dd:ee:ff");
37
+ });
38
+
39
+ it("is idempotent on already-normalized input", () => {
40
+ expect(normalizeMac("aa:bb:cc:dd:ee:ff")).toBe("aa:bb:cc:dd:ee:ff");
41
+ });
42
+
43
+ it("rejects malformed values", () => {
44
+ expect(normalizeMac(undefined)).toBeUndefined();
45
+ expect(normalizeMac("")).toBeUndefined();
46
+ expect(normalizeMac("aa:bb:cc")).toBeUndefined();
47
+ expect(normalizeMac("aa:bb:cc:dd:ee:ff:00")).toBeUndefined();
48
+ expect(normalizeMac("zz:bb:cc:dd:ee:ff")).toBeUndefined();
49
+ expect(normalizeMac("not-a-mac")).toBeUndefined();
50
+ });
51
+ });
52
+
53
+ type ComputeInput = Parameters<
54
+ typeof EndpointAttachmentUtil.computeEndpointAttachments
55
+ >[0];
56
+
57
+ describe("EndpointAttachmentUtil.computeEndpointAttachments", () => {
58
+ const baseSnapshot: ComputeInput = {
59
+ deviceId: "device-1",
60
+ interfaces: [
61
+ { interfaceIndex: 1, name: "Gi0/1", macAddress: "00:00:5e:00:53:01" },
62
+ { interfaceIndex: 2, name: "Gi0/2", macAddress: "00:00:5e:00:53:02" },
63
+ { interfaceIndex: 24, name: "Gi0/24", macAddress: "00:00:5e:00:53:18" },
64
+ ],
65
+ };
66
+
67
+ it("turns a learned FDB entry into an attachment with the port name", () => {
68
+ const result: EndpointAttachmentResult =
69
+ EndpointAttachmentUtil.computeEndpointAttachments({
70
+ ...baseSnapshot,
71
+ fdbEntries: [
72
+ {
73
+ macAddress: "AA-BB-CC-DD-EE-01",
74
+ bridgePort: 1,
75
+ interfaceIndex: 1,
76
+ vlanId: 42,
77
+ status: "learned",
78
+ },
79
+ ],
80
+ });
81
+
82
+ expect(result.attachments).toEqual([
83
+ {
84
+ macAddress: "aa:bb:cc:dd:ee:01",
85
+ attachedInterfaceIndex: 1,
86
+ attachedPortName: "Gi0/1",
87
+ vlanId: 42,
88
+ },
89
+ ]);
90
+ });
91
+
92
+ it("excludes FDB entries on LLDP uplink interfaces as transit MACs", () => {
93
+ const result: EndpointAttachmentResult =
94
+ EndpointAttachmentUtil.computeEndpointAttachments({
95
+ ...baseSnapshot,
96
+ lldpNeighbors: [
97
+ { localInterfaceIndex: 24, remoteSysName: "core-switch" },
98
+ ],
99
+ fdbEntries: [
100
+ { macAddress: "aa:bb:cc:dd:ee:01", bridgePort: 1, interfaceIndex: 1 },
101
+ {
102
+ macAddress: "aa:bb:cc:dd:ee:02",
103
+ bridgePort: 24,
104
+ interfaceIndex: 24,
105
+ },
106
+ ],
107
+ });
108
+
109
+ expect(result.uplinkInterfaceIndexes).toEqual([24]);
110
+ expect(
111
+ result.attachments.map((a: EndpointAttachment) => {
112
+ return a.macAddress;
113
+ }),
114
+ ).toEqual(["aa:bb:cc:dd:ee:01"]);
115
+ });
116
+
117
+ it("excludes FDB entries on CDP uplink interfaces as transit MACs", () => {
118
+ const result: EndpointAttachmentResult =
119
+ EndpointAttachmentUtil.computeEndpointAttachments({
120
+ ...baseSnapshot,
121
+ cdpNeighbors: [{ localInterfaceIndex: 2, remoteDeviceId: "core-sw" }],
122
+ fdbEntries: [
123
+ { macAddress: "aa:bb:cc:dd:ee:03", bridgePort: 2, interfaceIndex: 2 },
124
+ { macAddress: "aa:bb:cc:dd:ee:04", bridgePort: 1, interfaceIndex: 1 },
125
+ ],
126
+ });
127
+
128
+ expect(result.uplinkInterfaceIndexes).toEqual([2]);
129
+ expect(
130
+ result.attachments.map((a: EndpointAttachment) => {
131
+ return a.macAddress;
132
+ }),
133
+ ).toEqual(["aa:bb:cc:dd:ee:04"]);
134
+ });
135
+
136
+ it("merges LLDP and CDP uplinks, sorted and deduplicated", () => {
137
+ const result: EndpointAttachmentResult =
138
+ EndpointAttachmentUtil.computeEndpointAttachments({
139
+ ...baseSnapshot,
140
+ lldpNeighbors: [
141
+ { localInterfaceIndex: 24, remoteSysName: "core" },
142
+ { localInterfaceIndex: 2, remoteSysName: "dist" },
143
+ ],
144
+ cdpNeighbors: [
145
+ { localInterfaceIndex: 24, remoteDeviceId: "core" },
146
+ { localInterfaceIndex: 1, remoteDeviceId: "edge" },
147
+ ],
148
+ });
149
+
150
+ expect(result.uplinkInterfaceIndexes).toEqual([1, 2, 24]);
151
+ });
152
+
153
+ it("excludes the device's own interface MACs from FDB and ARP", () => {
154
+ const result: EndpointAttachmentResult =
155
+ EndpointAttachmentUtil.computeEndpointAttachments({
156
+ ...baseSnapshot,
157
+ fdbEntries: [
158
+ // Self MAC spelled differently than the interface row.
159
+ {
160
+ macAddress: "0000.5e00.5301",
161
+ bridgePort: 1,
162
+ interfaceIndex: 1,
163
+ },
164
+ { macAddress: "aa:bb:cc:dd:ee:05", bridgePort: 2, interfaceIndex: 2 },
165
+ ],
166
+ arpEntries: [
167
+ {
168
+ ipAddress: "10.0.0.1",
169
+ macAddress: "00-00-5E-00-53-02",
170
+ interfaceIndex: 2,
171
+ },
172
+ {
173
+ ipAddress: "10.0.0.9",
174
+ macAddress: "aa:bb:cc:dd:ee:05",
175
+ interfaceIndex: 2,
176
+ },
177
+ ],
178
+ });
179
+
180
+ expect(result.selfMacs).toEqual([
181
+ "00:00:5e:00:53:01",
182
+ "00:00:5e:00:53:02",
183
+ "00:00:5e:00:53:18",
184
+ ]);
185
+ expect(
186
+ result.attachments.map((a: EndpointAttachment) => {
187
+ return a.macAddress;
188
+ }),
189
+ ).toEqual(["aa:bb:cc:dd:ee:05"]);
190
+ expect(result.ipBindings).toEqual([
191
+ {
192
+ macAddress: "aa:bb:cc:dd:ee:05",
193
+ ipAddress: "10.0.0.9",
194
+ routerInterfaceIndex: 2,
195
+ },
196
+ ]);
197
+ });
198
+
199
+ it("keeps learned/undefined FDB statuses and drops self/mgmt rows", () => {
200
+ const entryFor: (mac: string, status?: string) => FdbEntry = (
201
+ mac: string,
202
+ status?: string,
203
+ ): FdbEntry => {
204
+ return {
205
+ macAddress: mac,
206
+ bridgePort: 1,
207
+ interfaceIndex: 1,
208
+ ...(status !== undefined ? { status } : {}),
209
+ };
210
+ };
211
+
212
+ const result: EndpointAttachmentResult =
213
+ EndpointAttachmentUtil.computeEndpointAttachments({
214
+ ...baseSnapshot,
215
+ fdbEntries: [
216
+ entryFor("aa:bb:cc:dd:ee:01", "learned"),
217
+ entryFor("aa:bb:cc:dd:ee:02", "Learned"),
218
+ entryFor("aa:bb:cc:dd:ee:03"),
219
+ entryFor("aa:bb:cc:dd:ee:04", "self"),
220
+ entryFor("aa:bb:cc:dd:ee:05", "mgmt"),
221
+ entryFor("aa:bb:cc:dd:ee:06", "invalid"),
222
+ ],
223
+ });
224
+
225
+ expect(
226
+ result.attachments.map((a: EndpointAttachment) => {
227
+ return a.macAddress;
228
+ }),
229
+ ).toEqual(["aa:bb:cc:dd:ee:01", "aa:bb:cc:dd:ee:02", "aa:bb:cc:dd:ee:03"]);
230
+ });
231
+
232
+ it("skips FDB entries whose bridge port did not resolve to an ifIndex", () => {
233
+ const result: EndpointAttachmentResult =
234
+ EndpointAttachmentUtil.computeEndpointAttachments({
235
+ ...baseSnapshot,
236
+ fdbEntries: [
237
+ { macAddress: "aa:bb:cc:dd:ee:01", bridgePort: 7 },
238
+ { macAddress: "aa:bb:cc:dd:ee:02", bridgePort: 1, interfaceIndex: 1 },
239
+ ],
240
+ });
241
+
242
+ expect(
243
+ result.attachments.map((a: EndpointAttachment) => {
244
+ return a.macAddress;
245
+ }),
246
+ ).toEqual(["aa:bb:cc:dd:ee:02"]);
247
+ });
248
+
249
+ it("skips multicast and broadcast MACs everywhere", () => {
250
+ const result: EndpointAttachmentResult =
251
+ EndpointAttachmentUtil.computeEndpointAttachments({
252
+ ...baseSnapshot,
253
+ fdbEntries: [
254
+ { macAddress: "01:00:5e:00:00:fb", bridgePort: 1, interfaceIndex: 1 },
255
+ { macAddress: "ff:ff:ff:ff:ff:ff", bridgePort: 1, interfaceIndex: 1 },
256
+ { macAddress: "aa:bb:cc:dd:ee:01", bridgePort: 1, interfaceIndex: 1 },
257
+ ],
258
+ arpEntries: [
259
+ {
260
+ ipAddress: "224.0.0.251",
261
+ macAddress: "01:00:5e:00:00:fb",
262
+ interfaceIndex: 1,
263
+ },
264
+ ],
265
+ });
266
+
267
+ expect(
268
+ result.attachments.map((a: EndpointAttachment) => {
269
+ return a.macAddress;
270
+ }),
271
+ ).toEqual(["aa:bb:cc:dd:ee:01"]);
272
+ expect(result.ipBindings).toEqual([]);
273
+ });
274
+
275
+ it("passes the VLAN through and collapses per-VLAN duplicates deterministically", () => {
276
+ const result: EndpointAttachmentResult =
277
+ EndpointAttachmentUtil.computeEndpointAttachments({
278
+ ...baseSnapshot,
279
+ fdbEntries: [
280
+ {
281
+ macAddress: "aa:bb:cc:dd:ee:01",
282
+ bridgePort: 1,
283
+ interfaceIndex: 1,
284
+ vlanId: 200,
285
+ },
286
+ {
287
+ macAddress: "aa:bb:cc:dd:ee:01",
288
+ bridgePort: 1,
289
+ interfaceIndex: 1,
290
+ vlanId: 100,
291
+ },
292
+ ],
293
+ });
294
+
295
+ expect(result.attachments).toEqual([
296
+ {
297
+ macAddress: "aa:bb:cc:dd:ee:01",
298
+ attachedInterfaceIndex: 1,
299
+ attachedPortName: "Gi0/1",
300
+ vlanId: 100,
301
+ },
302
+ ]);
303
+ });
304
+
305
+ it("drops invalid ARP rows and collapses per-MAC ARP duplicates to the smallest IP", () => {
306
+ const result: EndpointAttachmentResult =
307
+ EndpointAttachmentUtil.computeEndpointAttachments({
308
+ ...baseSnapshot,
309
+ arpEntries: [
310
+ {
311
+ ipAddress: "10.0.0.7",
312
+ macAddress: "aa:bb:cc:dd:ee:01",
313
+ interfaceIndex: 2,
314
+ entryType: "dynamic",
315
+ },
316
+ {
317
+ ipAddress: "10.0.0.3",
318
+ macAddress: "aa:bb:cc:dd:ee:01",
319
+ interfaceIndex: 1,
320
+ entryType: "static",
321
+ },
322
+ {
323
+ ipAddress: "10.0.0.5",
324
+ macAddress: "aa:bb:cc:dd:ee:02",
325
+ interfaceIndex: 1,
326
+ entryType: "invalid",
327
+ },
328
+ ],
329
+ });
330
+
331
+ expect(result.ipBindings).toEqual([
332
+ {
333
+ macAddress: "aa:bb:cc:dd:ee:01",
334
+ ipAddress: "10.0.0.3",
335
+ routerInterfaceIndex: 1,
336
+ },
337
+ ]);
338
+ });
339
+
340
+ it("orders attachments and bindings by MAC regardless of input order", () => {
341
+ const fdbEntries: Array<FdbEntry> = [
342
+ { macAddress: "cc:cc:cc:cc:cc:cc", bridgePort: 1, interfaceIndex: 1 },
343
+ { macAddress: "aa:aa:aa:aa:aa:aa", bridgePort: 2, interfaceIndex: 2 },
344
+ ];
345
+ const arpEntries: Array<ArpEntry> = [
346
+ {
347
+ ipAddress: "10.0.0.2",
348
+ macAddress: "cc:cc:cc:cc:cc:cc",
349
+ interfaceIndex: 1,
350
+ },
351
+ {
352
+ ipAddress: "10.0.0.1",
353
+ macAddress: "aa:aa:aa:aa:aa:aa",
354
+ interfaceIndex: 2,
355
+ },
356
+ ];
357
+
358
+ const forward: EndpointAttachmentResult =
359
+ EndpointAttachmentUtil.computeEndpointAttachments({
360
+ ...baseSnapshot,
361
+ fdbEntries,
362
+ arpEntries,
363
+ });
364
+ const reversed: EndpointAttachmentResult =
365
+ EndpointAttachmentUtil.computeEndpointAttachments({
366
+ ...baseSnapshot,
367
+ fdbEntries: [...fdbEntries].reverse(),
368
+ arpEntries: [...arpEntries].reverse(),
369
+ });
370
+
371
+ expect(forward).toEqual(reversed);
372
+ expect(
373
+ forward.attachments.map((a: EndpointAttachment) => {
374
+ return a.macAddress;
375
+ }),
376
+ ).toEqual(["aa:aa:aa:aa:aa:aa", "cc:cc:cc:cc:cc:cc"]);
377
+ expect(
378
+ forward.ipBindings.map((b: EndpointIpBinding) => {
379
+ return b.macAddress;
380
+ }),
381
+ ).toEqual(["aa:aa:aa:aa:aa:aa", "cc:cc:cc:cc:cc:cc"]);
382
+ });
383
+
384
+ it("returns empty results for an empty snapshot", () => {
385
+ const result: EndpointAttachmentResult =
386
+ EndpointAttachmentUtil.computeEndpointAttachments({
387
+ deviceId: "device-1",
388
+ });
389
+
390
+ expect(result).toEqual({
391
+ uplinkInterfaceIndexes: [],
392
+ selfMacs: [],
393
+ attachments: [],
394
+ ipBindings: [],
395
+ });
396
+ });
397
+
398
+ it("returns empty results for empty arrays", () => {
399
+ const result: EndpointAttachmentResult =
400
+ EndpointAttachmentUtil.computeEndpointAttachments({
401
+ deviceId: "device-1",
402
+ fdbEntries: [],
403
+ arpEntries: [],
404
+ lldpNeighbors: [],
405
+ cdpNeighbors: [],
406
+ interfaces: [],
407
+ });
408
+
409
+ expect(result.attachments).toEqual([]);
410
+ expect(result.ipBindings).toEqual([]);
411
+ });
412
+ });
413
+
414
+ describe("EndpointAttachmentUtil.decideUpsert", () => {
415
+ const mac: string = "aa:bb:cc:dd:ee:01";
416
+ const fdbAttachment: {
417
+ interfaceIndex: number;
418
+ portName?: string | undefined;
419
+ vlanId?: number | undefined;
420
+ } = { interfaceIndex: 7, portName: "Gi0/7", vlanId: 12 };
421
+ const ipBinding: { ipAddress: string; routerInterfaceIndex: number } = {
422
+ ipAddress: "10.1.2.3",
423
+ routerInterfaceIndex: 3,
424
+ };
425
+
426
+ it("does nothing when the observation carries neither kind", () => {
427
+ const decision: EndpointUpsertDecision =
428
+ EndpointAttachmentUtil.decideUpsert(null, {
429
+ macAddress: mac,
430
+ deviceId: "switch-1",
431
+ });
432
+
433
+ expect(decision.action).toBe("none");
434
+ expect(decision.setAttachment).toBe(false);
435
+ expect(decision.setIpAddress).toBe(false);
436
+ });
437
+
438
+ it("creates from an FDB attachment with all attachment fields", () => {
439
+ const decision: EndpointUpsertDecision =
440
+ EndpointAttachmentUtil.decideUpsert(null, {
441
+ macAddress: mac,
442
+ deviceId: "switch-1",
443
+ attachment: fdbAttachment,
444
+ });
445
+
446
+ expect(decision).toEqual({
447
+ action: "create",
448
+ setAttachment: true,
449
+ attachedInterfaceIndex: 7,
450
+ attachedPortName: "Gi0/7",
451
+ vlanId: 12,
452
+ setIpAddress: false,
453
+ });
454
+ });
455
+
456
+ it("creates from an ARP-only sighting, attached to the router interface", () => {
457
+ const decision: EndpointUpsertDecision =
458
+ EndpointAttachmentUtil.decideUpsert(null, {
459
+ macAddress: mac,
460
+ deviceId: "router-1",
461
+ ipBinding,
462
+ });
463
+
464
+ expect(decision.action).toBe("create");
465
+ expect(decision.setAttachment).toBe(true);
466
+ expect(decision.attachedInterfaceIndex).toBe(3);
467
+ expect(decision.attachedPortName).toBeUndefined();
468
+ expect(decision.vlanId).toBeUndefined();
469
+ expect(decision.setIpAddress).toBe(true);
470
+ expect(decision.ipAddress).toBe("10.1.2.3");
471
+ });
472
+
473
+ it("creates from a combined FDB+ARP walk with the FDB attachment winning", () => {
474
+ const decision: EndpointUpsertDecision =
475
+ EndpointAttachmentUtil.decideUpsert(null, {
476
+ macAddress: mac,
477
+ deviceId: "l3-switch-1",
478
+ attachment: fdbAttachment,
479
+ ipBinding,
480
+ });
481
+
482
+ expect(decision.action).toBe("create");
483
+ expect(decision.setAttachment).toBe(true);
484
+ expect(decision.attachedInterfaceIndex).toBe(7);
485
+ expect(decision.setIpAddress).toBe(true);
486
+ expect(decision.ipAddress).toBe("10.1.2.3");
487
+ });
488
+
489
+ it("lets an FDB attachment steal a row attached to another device", () => {
490
+ const decision: EndpointUpsertDecision =
491
+ EndpointAttachmentUtil.decideUpsert(
492
+ { attachedNetworkDeviceId: "another-switch" },
493
+ {
494
+ macAddress: mac,
495
+ deviceId: "switch-1",
496
+ attachment: fdbAttachment,
497
+ },
498
+ );
499
+
500
+ expect(decision.action).toBe("update");
501
+ expect(decision.setAttachment).toBe(true);
502
+ expect(decision.attachedInterfaceIndex).toBe(7);
503
+ });
504
+
505
+ it("never lets ARP steal an attachment owned by a different device", () => {
506
+ const decision: EndpointUpsertDecision =
507
+ EndpointAttachmentUtil.decideUpsert(
508
+ { attachedNetworkDeviceId: "switch-1" },
509
+ {
510
+ macAddress: mac,
511
+ deviceId: "router-1",
512
+ ipBinding,
513
+ },
514
+ );
515
+
516
+ expect(decision.action).toBe("update");
517
+ expect(decision.setAttachment).toBe(false);
518
+ expect(decision.setIpAddress).toBe(true);
519
+ expect(decision.ipAddress).toBe("10.1.2.3");
520
+ });
521
+
522
+ it("lets ARP refresh an attachment it already owns", () => {
523
+ const decision: EndpointUpsertDecision =
524
+ EndpointAttachmentUtil.decideUpsert(
525
+ { attachedNetworkDeviceId: "router-1" },
526
+ {
527
+ macAddress: mac,
528
+ deviceId: "router-1",
529
+ ipBinding,
530
+ },
531
+ );
532
+
533
+ expect(decision.action).toBe("update");
534
+ expect(decision.setAttachment).toBe(true);
535
+ expect(decision.attachedInterfaceIndex).toBe(3);
536
+ expect(decision.setIpAddress).toBe(true);
537
+ });
538
+
539
+ it("lets ARP claim a row that has no attachment", () => {
540
+ const decision: EndpointUpsertDecision =
541
+ EndpointAttachmentUtil.decideUpsert(
542
+ { attachedNetworkDeviceId: undefined },
543
+ {
544
+ macAddress: mac,
545
+ deviceId: "router-1",
546
+ ipBinding,
547
+ },
548
+ );
549
+
550
+ expect(decision.action).toBe("update");
551
+ expect(decision.setAttachment).toBe(true);
552
+ expect(decision.attachedInterfaceIndex).toBe(3);
553
+ });
554
+
555
+ it("leaves port/vlan undefined when the FDB knew neither", () => {
556
+ const decision: EndpointUpsertDecision =
557
+ EndpointAttachmentUtil.decideUpsert(
558
+ { attachedNetworkDeviceId: "switch-1" },
559
+ {
560
+ macAddress: mac,
561
+ deviceId: "switch-1",
562
+ attachment: { interfaceIndex: 4 },
563
+ },
564
+ );
565
+
566
+ expect(decision.setAttachment).toBe(true);
567
+ expect(decision.attachedInterfaceIndex).toBe(4);
568
+ expect(decision.attachedPortName).toBeUndefined();
569
+ expect(decision.vlanId).toBeUndefined();
570
+ });
571
+ });
572
+
573
+ /*
574
+ * The unchanged-since-last-poll short circuit. Without it a stable
575
+ * 4096-MAC switch issues 4096 writes every poll purely to bump
576
+ * lastSeenAt — and that path runs inline on probe ingest. The rule has
577
+ * to be conservative in both directions: never suppress a write that
578
+ * carries new information, and never let lastSeenAt drift far enough to
579
+ * make a live endpoint look down (NetworkTopologyUtil calls it down at
580
+ * 15 minutes).
581
+ */
582
+ describe("EndpointAttachmentUtil.decideUpsert — unchanged sightings", () => {
583
+ const mac: string = "aa:bb:cc:dd:ee:01";
584
+ const NOW: Date = new Date("2026-07-22T12:00:00Z");
585
+ const ONE_MINUTE_AGO: Date = new Date("2026-07-22T11:59:00Z");
586
+ const TEN_MINUTES_AGO: Date = new Date("2026-07-22T11:50:00Z");
587
+ const LONG_AGO: Date = new Date("2026-07-01T00:00:00Z");
588
+
589
+ const context: EndpointUpsertContext = { now: NOW };
590
+
591
+ // A row that exactly matches what the walk below is about to report.
592
+ const stableRow: EndpointExistingRowSnapshot = {
593
+ attachedNetworkDeviceId: "switch-1",
594
+ attachedInterfaceIndex: 7,
595
+ attachedPortName: "Gi0/7",
596
+ vlanId: 12,
597
+ firstSeenAt: LONG_AGO,
598
+ lastSeenAt: ONE_MINUTE_AGO,
599
+ };
600
+
601
+ const stableSighting: {
602
+ macAddress: string;
603
+ deviceId: string;
604
+ attachment: {
605
+ interfaceIndex: number;
606
+ portName?: string | undefined;
607
+ vlanId?: number | undefined;
608
+ };
609
+ } = {
610
+ macAddress: mac,
611
+ deviceId: "switch-1",
612
+ attachment: { interfaceIndex: 7, portName: "Gi0/7", vlanId: 12 },
613
+ };
614
+
615
+ it("keeps the refresh threshold at 5 minutes", () => {
616
+ /*
617
+ * Stored lastSeenAt lags reality by at most (threshold + poll
618
+ * interval). 5 minutes keeps that under the 15-minute down window
619
+ * for any poll interval up to 10 minutes; slower polls always land
620
+ * past the threshold and fall back to writing every poll.
621
+ */
622
+ expect(ENDPOINT_LAST_SEEN_REFRESH_MS).toBe(5 * 60 * 1000);
623
+ });
624
+
625
+ it("collapses an unchanged re-sighting to no write at all", () => {
626
+ const decision: EndpointUpsertDecision =
627
+ EndpointAttachmentUtil.decideUpsert(stableRow, stableSighting, context);
628
+
629
+ expect(decision).toEqual({
630
+ action: "none",
631
+ setAttachment: false,
632
+ setIpAddress: false,
633
+ });
634
+ });
635
+
636
+ it("still writes when the caller passes no context", () => {
637
+ const decision: EndpointUpsertDecision =
638
+ EndpointAttachmentUtil.decideUpsert(stableRow, stableSighting);
639
+
640
+ expect(decision.action).toBe("update");
641
+ });
642
+
643
+ it("refreshes lastSeenAt once it ages past the threshold", () => {
644
+ const decision: EndpointUpsertDecision =
645
+ EndpointAttachmentUtil.decideUpsert(
646
+ { ...stableRow, lastSeenAt: TEN_MINUTES_AGO },
647
+ stableSighting,
648
+ context,
649
+ );
650
+
651
+ expect(decision.action).toBe("update");
652
+ });
653
+
654
+ it("honours a caller-supplied refresh threshold", () => {
655
+ const decision: EndpointUpsertDecision =
656
+ EndpointAttachmentUtil.decideUpsert(
657
+ { ...stableRow, lastSeenAt: TEN_MINUTES_AGO },
658
+ stableSighting,
659
+ { now: NOW, lastSeenRefreshMs: 30 * 60 * 1000 },
660
+ );
661
+
662
+ expect(decision.action).toBe("none");
663
+ });
664
+
665
+ it("writes when lastSeenAt sits in the future (clock skew)", () => {
666
+ const decision: EndpointUpsertDecision =
667
+ EndpointAttachmentUtil.decideUpsert(
668
+ { ...stableRow, lastSeenAt: new Date("2026-07-22T12:05:00Z") },
669
+ stableSighting,
670
+ context,
671
+ );
672
+
673
+ expect(decision.action).toBe("update");
674
+ });
675
+
676
+ it("writes when the row has no lastSeenAt to compare against", () => {
677
+ const decision: EndpointUpsertDecision =
678
+ EndpointAttachmentUtil.decideUpsert(
679
+ { ...stableRow, lastSeenAt: undefined },
680
+ stableSighting,
681
+ context,
682
+ );
683
+
684
+ expect(decision.action).toBe("update");
685
+ });
686
+
687
+ it("writes when the row still owes a firstSeenAt backfill", () => {
688
+ const decision: EndpointUpsertDecision =
689
+ EndpointAttachmentUtil.decideUpsert(
690
+ { ...stableRow, firstSeenAt: undefined },
691
+ stableSighting,
692
+ context,
693
+ );
694
+
695
+ expect(decision.action).toBe("update");
696
+ });
697
+
698
+ it("writes when the endpoint moved to a different port", () => {
699
+ const decision: EndpointUpsertDecision =
700
+ EndpointAttachmentUtil.decideUpsert(
701
+ { ...stableRow, attachedInterfaceIndex: 8 },
702
+ stableSighting,
703
+ context,
704
+ );
705
+
706
+ expect(decision.action).toBe("update");
707
+ expect(decision.attachedInterfaceIndex).toBe(7);
708
+ });
709
+
710
+ it("writes when the port was renamed", () => {
711
+ const decision: EndpointUpsertDecision =
712
+ EndpointAttachmentUtil.decideUpsert(
713
+ { ...stableRow, attachedPortName: "GigabitEthernet0/7" },
714
+ stableSighting,
715
+ context,
716
+ );
717
+
718
+ expect(decision.action).toBe("update");
719
+ });
720
+
721
+ it("writes when the endpoint moved to a different VLAN", () => {
722
+ const decision: EndpointUpsertDecision =
723
+ EndpointAttachmentUtil.decideUpsert(
724
+ { ...stableRow, vlanId: 13 },
725
+ stableSighting,
726
+ context,
727
+ );
728
+
729
+ expect(decision.action).toBe("update");
730
+ });
731
+
732
+ it("writes when the endpoint moved to a different switch", () => {
733
+ const decision: EndpointUpsertDecision =
734
+ EndpointAttachmentUtil.decideUpsert(
735
+ { ...stableRow, attachedNetworkDeviceId: "switch-2" },
736
+ stableSighting,
737
+ context,
738
+ );
739
+
740
+ expect(decision.action).toBe("update");
741
+ expect(decision.setAttachment).toBe(true);
742
+ });
743
+
744
+ it("does not treat a port/vlan the walk did not report as a change", () => {
745
+ // Undefined never clears a stored value, so it is not new information.
746
+ const decision: EndpointUpsertDecision =
747
+ EndpointAttachmentUtil.decideUpsert(
748
+ stableRow,
749
+ {
750
+ macAddress: mac,
751
+ deviceId: "switch-1",
752
+ attachment: { interfaceIndex: 7 },
753
+ },
754
+ context,
755
+ );
756
+
757
+ expect(decision.action).toBe("none");
758
+ });
759
+
760
+ it("writes when the site the device belongs to changed", () => {
761
+ const decision: EndpointUpsertDecision =
762
+ EndpointAttachmentUtil.decideUpsert(stableRow, stableSighting, {
763
+ now: NOW,
764
+ siteId: "site-2",
765
+ });
766
+
767
+ expect(decision.action).toBe("update");
768
+ });
769
+
770
+ it("stays quiet when the site is unchanged", () => {
771
+ const decision: EndpointUpsertDecision =
772
+ EndpointAttachmentUtil.decideUpsert(
773
+ { ...stableRow, siteId: "site-1" },
774
+ stableSighting,
775
+ { now: NOW, siteId: "site-1" },
776
+ );
777
+
778
+ expect(decision.action).toBe("none");
779
+ });
780
+
781
+ it("writes when the endpoint's IP changed", () => {
782
+ const decision: EndpointUpsertDecision =
783
+ EndpointAttachmentUtil.decideUpsert(
784
+ { ...stableRow, ipAddress: "10.1.2.3" },
785
+ {
786
+ ...stableSighting,
787
+ ipBinding: { ipAddress: "10.1.2.4", routerInterfaceIndex: 3 },
788
+ },
789
+ context,
790
+ );
791
+
792
+ expect(decision.action).toBe("update");
793
+ expect(decision.setIpAddress).toBe(true);
794
+ expect(decision.ipAddress).toBe("10.1.2.4");
795
+ });
796
+
797
+ it("stays quiet when the ARP binding repeats the stored IP", () => {
798
+ const decision: EndpointUpsertDecision =
799
+ EndpointAttachmentUtil.decideUpsert(
800
+ { ...stableRow, ipAddress: "10.1.2.3" },
801
+ {
802
+ ...stableSighting,
803
+ ipBinding: { ipAddress: "10.1.2.3", routerInterfaceIndex: 3 },
804
+ },
805
+ context,
806
+ );
807
+
808
+ expect(decision.action).toBe("none");
809
+ });
810
+
811
+ it("stays quiet for an ARP-only re-sighting that cannot claim the attachment", () => {
812
+ /*
813
+ * setAttachment is false here (a switch owns the port), so only the
814
+ * IP could carry news — and it does not.
815
+ */
816
+ const decision: EndpointUpsertDecision =
817
+ EndpointAttachmentUtil.decideUpsert(
818
+ { ...stableRow, ipAddress: "10.1.2.3" },
819
+ {
820
+ macAddress: mac,
821
+ deviceId: "router-1",
822
+ ipBinding: { ipAddress: "10.1.2.3", routerInterfaceIndex: 3 },
823
+ },
824
+ context,
825
+ );
826
+
827
+ expect(decision.action).toBe("none");
828
+ });
829
+
830
+ it("never suppresses a create", () => {
831
+ const decision: EndpointUpsertDecision =
832
+ EndpointAttachmentUtil.decideUpsert(null, stableSighting, context);
833
+
834
+ expect(decision.action).toBe("create");
835
+ });
836
+ });