@oneuptime/common 12.0.34 → 13.0.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.
- package/Models/DatabaseModels/GlobalConfig.ts +12 -12
- package/Models/DatabaseModels/InventoryItem.ts +44 -1
- package/Models/DatabaseModels/NetworkDevice.ts +126 -0
- package/Server/EnvironmentConfig.ts +47 -16
- package/Server/Infrastructure/Postgres/SchemaMigrations/1791700000000-AddMacAddressToNetworkDevice.ts +25 -0
- package/Server/Infrastructure/Postgres/SchemaMigrations/Index.ts +2 -0
- package/Server/Infrastructure/Redis.ts +8 -8
- package/Server/Infrastructure/Status.ts +10 -4
- package/Server/Services/DatabaseService.ts +65 -13
- package/Server/Services/InventoryItemService.ts +31 -1
- package/Server/Services/MonitorTemplateService.ts +140 -19
- package/Server/Services/NetworkDeviceAutoImportRuleEngineService.ts +349 -41
- package/Server/Services/NetworkDeviceDiscoveryScanService.ts +87 -2
- package/Server/Services/NetworkDeviceService.ts +69 -0
- package/Server/Services/UserNotificationRuleService.ts +76 -25
- package/Server/Types/Database/Permissions/ReadPermission.ts +45 -5
- package/Server/Types/Database/QueryUtil.ts +56 -0
- package/Server/Types/Markdown.ts +93 -1
- package/Server/Utils/Dashboard/PublicDashboardResourceListPolicy.ts +82 -17
- package/Server/Utils/EmailRollup/EmailRollupFlushRunner.ts +10 -1
- package/Server/Utils/EmailRollup/EmailRollupRenderer.ts +2 -2
- package/Server/Utils/Monitor/Criteria/CompareCriteria.ts +82 -35
- package/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.ts +31 -5
- package/Server/Utils/Monitor/MonitorCriteriaEvaluator.ts +202 -37
- package/Server/Utils/Monitor/MonitorCriteriaExpectationBuilder.ts +82 -9
- package/Server/Utils/Monitor/MonitorCriteriaMessageBuilder.ts +16 -7
- package/Server/Utils/Monitor/MonitorCriteriaMessageFormatter.ts +29 -17
- package/Server/Utils/Monitor/MonitorCriteriaObservationBuilder.ts +107 -48
- package/Server/Utils/Monitor/NetworkDeviceMacLearningUtil.ts +158 -0
- package/Server/Utils/Monitor/NetworkInventoryUtil.ts +27 -0
- package/Server/Utils/Telemetry/EntityRegistry.ts +11 -1
- package/Server/Utils/Telemetry/TelemetryEntity.ts +83 -9
- package/Tests/App/Dashboard/AddNeighborToMonitoringModal.test.tsx +32 -0
- package/Tests/App/Dashboard/AdoptedDeviceDrawer.test.tsx +374 -0
- package/Tests/App/Dashboard/DashboardLabelVariables.test.tsx +580 -0
- package/Tests/App/Dashboard/DashboardMonitorLabelVariable.test.tsx +438 -0
- package/Tests/App/Dashboard/DashboardVariableAllContract.test.tsx +5 -2
- package/Tests/App/Dashboard/DeviceAttachmentCard.test.tsx +273 -0
- package/Tests/App/Dashboard/DiscoveryReviewInventoryRefresh.test.tsx +505 -0
- package/Tests/App/Dashboard/EntityDetailPanel.test.tsx +163 -0
- package/Tests/App/Dashboard/InfrastructureExplorer.test.tsx +401 -0
- package/Tests/App/Dashboard/InfrastructureGraph.test.tsx +232 -0
- package/Tests/App/Dashboard/InventoryItems.test.tsx +201 -0
- package/Tests/App/Dashboard/InventoryTypeAndStatusFacets.test.tsx +798 -0
- package/Tests/App/Dashboard/NetworkTopologyLiveView.test.tsx +320 -0
- package/Tests/App/Dashboard/NetworkTopologyToolbar.test.tsx +275 -0
- package/Tests/App/Dashboard/OnCallCalendarFeedEmptyState.test.tsx +975 -0
- package/Tests/App/Dashboard/OnCallCalendarFeedPlanGate.test.tsx +63 -0
- package/Tests/App/Dashboard/ServiceMapGraph.test.tsx +626 -0
- package/Tests/App/Dashboard/TopologyDataLoading.test.tsx +348 -0
- package/Tests/App/Dashboard/TopologyPageNavigation.test.tsx +331 -0
- package/Tests/App/Dashboard/UserSettingsEmailPreferences.test.tsx +603 -0
- package/Tests/App/Dashboard/UserSettingsNotificationSettings.test.tsx +324 -0
- package/Tests/App/PublicDashboard/DashboardVariableSelector.test.tsx +13 -4
- package/Tests/App/StatusPage/StatusPageOidcOrigin.test.tsx +223 -0
- package/Tests/Models/InventoryItemStatus.test.ts +147 -0
- package/Tests/Models/NetworkDeviceMacAddressColumn.test.ts +294 -0
- package/Tests/Server/API/DashboardPublicResourceListAPI.test.ts +129 -0
- package/Tests/Server/EnvironmentConfigValkey.test.ts +227 -0
- package/Tests/Server/Infrastructure/Postgres/AddMacAddressToNetworkDeviceMigration.test.ts +365 -0
- package/Tests/Server/Infrastructure/Postgres/CustomFieldValueMappingMigration.test.ts +62 -23
- package/Tests/Server/Infrastructure/ValkeyDeploymentConfig.test.ts +265 -0
- package/Tests/Server/Middleware/HttpMetricsMiddleware.test.ts +382 -0
- package/Tests/Server/Middleware/SCIMAuthorization.test.ts +525 -0
- package/Tests/Server/Services/DatabaseServiceAggregateBy.test.ts +291 -56
- package/Tests/Server/Services/DatabaseServiceSortTiebreaker.test.ts +151 -0
- package/Tests/Server/Services/InventoryItemManualCreate.test.ts +105 -0
- package/Tests/Server/Services/InventoryItemPromotionGate.test.ts +178 -0
- package/Tests/Server/Services/MonitorTemplateServiceCustomFieldSync.test.ts +502 -0
- package/Tests/Server/Services/NetworkDeviceAutoImportRuleEngineService.test.ts +1133 -81
- package/Tests/Server/Services/NetworkDeviceDiscoveryScanRegistration.test.ts +520 -0
- package/Tests/Server/Services/NetworkDeviceMacAddressNormalization.test.ts +572 -0
- package/Tests/Server/Types/Database/InventoryStatusPostgres.test.ts +368 -0
- package/Tests/Server/Types/Database/Permissions/ReadBlockPermission.test.ts +261 -14
- package/Tests/Server/Types/Database/QueryUtilIncludesAnyOfGroups.test.ts +169 -0
- package/Tests/Server/Types/Database/QueryUtilIncludesAnyOfGroupsPostgres.test.ts +297 -0
- package/Tests/Server/Types/Markdown.test.ts +194 -1
- package/Tests/Server/Types/Workflow/Components/IncomingWebhookUtils.test.ts +279 -0
- package/Tests/Server/Types/Workflow/Components/TextToJson.test.ts +212 -0
- package/Tests/Server/Utils/CustomField/CustomFieldMappingRegistry.test.ts +436 -0
- package/Tests/Server/Utils/Dashboard/PublicDashboardResourceListPolicy.test.ts +214 -0
- package/Tests/Server/Utils/EmailRollup/EmailRollupFlushRunnerBehaviour.test.ts +1 -1
- package/Tests/Server/Utils/EmailRollup/EmailRollupRenderer.test.ts +10 -3
- package/Tests/Server/Utils/EventLoop.test.ts +359 -0
- package/Tests/Server/Utils/JsonWebToken.test.ts +30 -0
- package/Tests/Server/Utils/Monitor/Criteria/CompareCriteria.test.ts +242 -0
- package/Tests/Server/Utils/Monitor/Criteria/CompareCriteriaAggregation.test.ts +13 -7
- package/Tests/Server/Utils/Monitor/Criteria/DatabaseMonitorCriteria.test.ts +29 -0
- package/Tests/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.test.ts +30 -6
- package/Tests/Server/Utils/Monitor/Criteria/MetricMonitorCriteriaAnomalyUnits.test.ts +246 -0
- package/Tests/Server/Utils/Monitor/MonitorCriteriaEmailEvalLogAgreement.test.ts +280 -0
- package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluator.test.ts +224 -10
- package/Tests/Server/Utils/Monitor/MonitorCriteriaEvaluatorMetricUnits.test.ts +570 -0
- package/Tests/Server/Utils/Monitor/MonitorCriteriaExpectationBuilderUnits.test.ts +30 -5
- package/Tests/Server/Utils/Monitor/MonitorCriteriaMessageBuilderUnits.test.ts +68 -21
- package/Tests/Server/Utils/Monitor/MonitorCriteriaObservationBuilderUnits.test.ts +36 -19
- package/Tests/Server/Utils/Monitor/NetworkDeviceMacLearningUtil.test.ts +573 -0
- package/Tests/Server/Utils/Monitor/NetworkInventoryUtil.test.ts +317 -0
- package/Tests/Server/Utils/Telemetry/ContextSpanProcessor.test.ts +281 -0
- package/Tests/Server/Utils/Telemetry/InventoryDuplicateIdentity.test.ts +316 -0
- package/Tests/Server/Utils/Telemetry/TelemetryEntity.test.ts +111 -8
- package/Tests/Types/Database/IncludesAnyOfGroups.test.ts +106 -0
- package/Tests/Types/JSONFunctions.test.ts +40 -0
- package/Tests/Types/NetworkAutomation/AutoImportRunMerge.test.ts +235 -0
- package/Tests/Types/NetworkAutomation/RuleRunResult.test.ts +66 -0
- package/Tests/Types/NetworkAutomation/RuleRunResultDescribe.test.ts +309 -1
- package/Tests/Types/Telemetry/InventoryLiveness.test.ts +99 -0
- package/Tests/UI/Components/CustomFields/CustomFieldsDetail.test.tsx +160 -0
- package/Tests/UI/ReactRouterSingletonBuild.test.ts +133 -0
- package/Tests/UI/Rum/ReplayHeader.test.tsx +10 -2
- package/Tests/UI/Rum/ReplayPlayerChrome.test.tsx +514 -0
- package/Tests/UI/Rum/ReplayTimeFormat.test.ts +94 -0
- package/Tests/UI/Rum/ReplayUi.test.tsx +559 -0
- package/Tests/UI/Utils/Breadcrumb/fixtures/RealBreadcrumbTrails.ts +5 -0
- package/Tests/UI/Utils/Breadcrumb/fixtures/RealRoutePatterns.ts +1 -0
- package/Tests/Utils/Dashboard/Components/DashboardMonitorListComponent.test.ts +11 -1
- package/Tests/Utils/Dashboard/LabelVariable.test.ts +257 -0
- package/Tests/Utils/Dashboard/VariableUrlState.test.ts +144 -14
- package/Tests/Utils/MetricUnitUtil.test.ts +81 -0
- package/Tests/Utils/Monitor/DeviceMacLearningUtil.test.ts +497 -0
- package/Tests/Utils/Monitor/MetricValueFormatter.test.ts +546 -0
- package/Tests/Utils/Monitor/MonitorTemplateCustomFieldUtil.test.ts +218 -0
- package/Tests/Utils/Monitor/NetworkTopologyEndpointAdoption.test.ts +1755 -0
- package/Tests/Utils/NetworkAutomation/AutoImportRunChain.test.ts +320 -0
- package/Types/BaseDatabase/IncludesAnyOfGroups.ts +77 -0
- package/Types/Dashboard/DashboardComponents/ComponentArgument.ts +1 -0
- package/Types/Dashboard/DashboardComponents/DashboardMonitorListComponent.ts +1 -0
- package/Types/Dashboard/DashboardVariable.ts +8 -0
- package/Types/JSON.ts +4 -0
- package/Types/JSONFunctions.ts +16 -0
- package/Types/Monitor/SnmpMonitor/NetworkTopology.ts +13 -0
- package/Types/NetworkAutomation/RuleRunResult.ts +402 -13
- package/Types/SerializableObjectDictionary.ts +4 -0
- package/Types/Telemetry/InventoryLiveness.ts +56 -0
- package/UI/Components/CSVFileUpload/CSVFileUpload.tsx +9 -2
- package/UI/Components/CustomFields/CustomFieldsDetail.tsx +46 -21
- package/UI/Components/Dashboard/DashboardVariableControl.tsx +285 -0
- package/UI/esbuild-config.js +6 -0
- package/Utils/Dashboard/Components/DashboardMonitorListComponent.ts +12 -1
- package/Utils/Dashboard/LabelVariable.ts +152 -0
- package/Utils/Dashboard/VariableUrlState.ts +27 -5
- package/Utils/MetricUnitUtil.ts +34 -0
- package/Utils/Monitor/DeviceMacLearningUtil.ts +177 -0
- package/Utils/Monitor/MetricValueFormatter.ts +342 -0
- package/Utils/Monitor/MonitorTemplateCustomFieldUtil.ts +124 -0
- package/Utils/Monitor/NetworkDeviceMonitorTemplateUtil.ts +7 -2
- package/Utils/Monitor/NetworkTopologyUtil.ts +693 -0
- package/Utils/NetworkAutomation/AutoImportRunChain.ts +138 -0
- package/build/dist/Models/DatabaseModels/GlobalConfig.js +12 -12
- package/build/dist/Models/DatabaseModels/GlobalConfig.js.map +1 -1
- package/build/dist/Models/DatabaseModels/InventoryItem.js +34 -1
- package/build/dist/Models/DatabaseModels/InventoryItem.js.map +1 -1
- package/build/dist/Models/DatabaseModels/NetworkDevice.js +128 -0
- package/build/dist/Models/DatabaseModels/NetworkDevice.js.map +1 -1
- package/build/dist/Server/EnvironmentConfig.js +44 -12
- package/build/dist/Server/EnvironmentConfig.js.map +1 -1
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1791700000000-AddMacAddressToNetworkDevice.js +14 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/1791700000000-AddMacAddressToNetworkDevice.js.map +1 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js +2 -0
- package/build/dist/Server/Infrastructure/Postgres/SchemaMigrations/Index.js.map +1 -1
- package/build/dist/Server/Infrastructure/Redis.js +8 -8
- package/build/dist/Server/Infrastructure/Redis.js.map +1 -1
- package/build/dist/Server/Infrastructure/Status.js +10 -4
- package/build/dist/Server/Infrastructure/Status.js.map +1 -1
- package/build/dist/Server/Services/DatabaseService.js +58 -13
- package/build/dist/Server/Services/DatabaseService.js.map +1 -1
- package/build/dist/Server/Services/InventoryItemService.js +28 -1
- package/build/dist/Server/Services/InventoryItemService.js.map +1 -1
- package/build/dist/Server/Services/MonitorTemplateService.js +116 -17
- package/build/dist/Server/Services/MonitorTemplateService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceAutoImportRuleEngineService.js +270 -37
- package/build/dist/Server/Services/NetworkDeviceAutoImportRuleEngineService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceDiscoveryScanService.js +65 -0
- package/build/dist/Server/Services/NetworkDeviceDiscoveryScanService.js.map +1 -1
- package/build/dist/Server/Services/NetworkDeviceService.js +54 -0
- package/build/dist/Server/Services/NetworkDeviceService.js.map +1 -1
- package/build/dist/Server/Services/UserNotificationRuleService.js +60 -25
- package/build/dist/Server/Services/UserNotificationRuleService.js.map +1 -1
- package/build/dist/Server/Types/Database/Permissions/ReadPermission.js +29 -4
- package/build/dist/Server/Types/Database/Permissions/ReadPermission.js.map +1 -1
- package/build/dist/Server/Types/Database/QueryUtil.js +36 -0
- package/build/dist/Server/Types/Database/QueryUtil.js.map +1 -1
- package/build/dist/Server/Types/Markdown.js +75 -0
- package/build/dist/Server/Types/Markdown.js.map +1 -1
- package/build/dist/Server/Utils/Dashboard/PublicDashboardResourceListPolicy.js +53 -18
- package/build/dist/Server/Utils/Dashboard/PublicDashboardResourceListPolicy.js.map +1 -1
- package/build/dist/Server/Utils/EmailRollup/EmailRollupFlushRunner.js +10 -1
- package/build/dist/Server/Utils/EmailRollup/EmailRollupFlushRunner.js.map +1 -1
- package/build/dist/Server/Utils/EmailRollup/EmailRollupRenderer.js +2 -2
- package/build/dist/Server/Utils/EmailRollup/EmailRollupRenderer.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/CompareCriteria.js +58 -35
- package/build/dist/Server/Utils/Monitor/Criteria/CompareCriteria.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.js +29 -5
- package/build/dist/Server/Utils/Monitor/Criteria/MetricMonitorCriteria.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js +166 -35
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaEvaluator.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaExpectationBuilder.js +58 -9
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaExpectationBuilder.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaMessageBuilder.js +9 -3
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaMessageBuilder.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaMessageFormatter.js +26 -12
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaMessageFormatter.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaObservationBuilder.js +74 -33
- package/build/dist/Server/Utils/Monitor/MonitorCriteriaObservationBuilder.js.map +1 -1
- package/build/dist/Server/Utils/Monitor/NetworkDeviceMacLearningUtil.js +114 -0
- package/build/dist/Server/Utils/Monitor/NetworkDeviceMacLearningUtil.js.map +1 -0
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js +25 -0
- package/build/dist/Server/Utils/Monitor/NetworkInventoryUtil.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/EntityRegistry.js +9 -1
- package/build/dist/Server/Utils/Telemetry/EntityRegistry.js.map +1 -1
- package/build/dist/Server/Utils/Telemetry/TelemetryEntity.js +70 -13
- package/build/dist/Server/Utils/Telemetry/TelemetryEntity.js.map +1 -1
- package/build/dist/Types/BaseDatabase/IncludesAnyOfGroups.js +54 -0
- package/build/dist/Types/BaseDatabase/IncludesAnyOfGroups.js.map +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js +1 -0
- package/build/dist/Types/Dashboard/DashboardComponents/ComponentArgument.js.map +1 -1
- package/build/dist/Types/Dashboard/DashboardVariable.js +1 -0
- package/build/dist/Types/Dashboard/DashboardVariable.js.map +1 -1
- package/build/dist/Types/JSON.js +1 -0
- package/build/dist/Types/JSON.js.map +1 -1
- package/build/dist/Types/JSONFunctions.js +13 -0
- package/build/dist/Types/JSONFunctions.js.map +1 -1
- package/build/dist/Types/NetworkAutomation/RuleRunResult.js +291 -6
- package/build/dist/Types/NetworkAutomation/RuleRunResult.js.map +1 -1
- package/build/dist/Types/SerializableObjectDictionary.js +4 -0
- package/build/dist/Types/SerializableObjectDictionary.js.map +1 -1
- package/build/dist/Types/Telemetry/InventoryLiveness.js +37 -0
- package/build/dist/Types/Telemetry/InventoryLiveness.js.map +1 -0
- package/build/dist/UI/Components/CSVFileUpload/CSVFileUpload.js +7 -0
- package/build/dist/UI/Components/CSVFileUpload/CSVFileUpload.js.map +1 -1
- package/build/dist/UI/Components/CustomFields/CustomFieldsDetail.js +9 -2
- package/build/dist/UI/Components/CustomFields/CustomFieldsDetail.js.map +1 -1
- package/build/dist/UI/Components/Dashboard/DashboardVariableControl.js +137 -0
- package/build/dist/UI/Components/Dashboard/DashboardVariableControl.js.map +1 -0
- package/build/dist/Utils/Dashboard/Components/DashboardMonitorListComponent.js +9 -1
- package/build/dist/Utils/Dashboard/Components/DashboardMonitorListComponent.js.map +1 -1
- package/build/dist/Utils/Dashboard/LabelVariable.js +96 -0
- package/build/dist/Utils/Dashboard/LabelVariable.js.map +1 -0
- package/build/dist/Utils/Dashboard/VariableUrlState.js +19 -4
- package/build/dist/Utils/Dashboard/VariableUrlState.js.map +1 -1
- package/build/dist/Utils/MetricUnitUtil.js +26 -0
- package/build/dist/Utils/MetricUnitUtil.js.map +1 -1
- package/build/dist/Utils/Monitor/DeviceMacLearningUtil.js +112 -0
- package/build/dist/Utils/Monitor/DeviceMacLearningUtil.js.map +1 -0
- package/build/dist/Utils/Monitor/MetricValueFormatter.js +276 -0
- package/build/dist/Utils/Monitor/MetricValueFormatter.js.map +1 -0
- package/build/dist/Utils/Monitor/MonitorTemplateCustomFieldUtil.js +101 -0
- package/build/dist/Utils/Monitor/MonitorTemplateCustomFieldUtil.js.map +1 -0
- package/build/dist/Utils/Monitor/NetworkDeviceMonitorTemplateUtil.js +7 -2
- package/build/dist/Utils/Monitor/NetworkDeviceMonitorTemplateUtil.js.map +1 -1
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js +484 -0
- package/build/dist/Utils/Monitor/NetworkTopologyUtil.js.map +1 -1
- package/build/dist/Utils/NetworkAutomation/AutoImportRunChain.js +59 -0
- package/build/dist/Utils/NetworkAutomation/AutoImportRunChain.js.map +1 -0
- package/jest.config.json +2 -0
- package/package.json +1 -1
- package/test-setup.sh +9 -9
- package/tsconfig.json +51 -11
- package/Tests/App/Dashboard/NotificationEmailPreferences.test.tsx +0 -399
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
2
|
+
import { afterEach, describe, expect, test } from "@jest/globals";
|
|
3
|
+
import { cleanup, render, screen } from "@testing-library/react";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { MemoryRouter } from "react-router-dom";
|
|
6
|
+
import {
|
|
7
|
+
NetworkTopologyEdge,
|
|
8
|
+
NetworkTopologyNode,
|
|
9
|
+
} from "../../../Types/Monitor/SnmpMonitor/NetworkTopology";
|
|
10
|
+
import NetworkDeviceDetailPanel from "../../../../App/FeatureSet/Dashboard/src/Components/Topology/NetworkDeviceDetailPanel";
|
|
11
|
+
import NetworkLinkDetailPanel from "../../../../App/FeatureSet/Dashboard/src/Components/Topology/NetworkLinkDetailPanel";
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
* Issue #3489, from the operator's side.
|
|
15
|
+
*
|
|
16
|
+
* A register that only answers ping used to float on the map until somebody
|
|
17
|
+
* typed its cable in under Device Links. Now the switch's forwarding table
|
|
18
|
+
* places it, and the two drawers have to SAY so — because a line that
|
|
19
|
+
* appeared on its own, ending at a port nobody typed, is a line the operator
|
|
20
|
+
* will otherwise distrust. This asserts what a person can read in each
|
|
21
|
+
* drawer, not which helper produced it:
|
|
22
|
+
*
|
|
23
|
+
* - the device drawer names the switch, the port and the VLAN, and says
|
|
24
|
+
* the attachment was learned rather than drawn;
|
|
25
|
+
* - its Links list shows the switch port instead of the "?" the device's
|
|
26
|
+
* own, silent end used to print;
|
|
27
|
+
* - the link drawer calls the link learned, explains the hierarchy in
|
|
28
|
+
* forwarding-table terms rather than as something "declared", and labels
|
|
29
|
+
* the device end by the switch port it is attached through.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
const SWITCH_NODE: NetworkTopologyNode = {
|
|
33
|
+
id: "switch-1",
|
|
34
|
+
name: "switch-01",
|
|
35
|
+
isManaged: true,
|
|
36
|
+
kind: "device",
|
|
37
|
+
role: "switch",
|
|
38
|
+
status: "up",
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const REGISTER_NODE: NetworkTopologyNode = {
|
|
42
|
+
id: "pos-1",
|
|
43
|
+
name: "pos-register-01",
|
|
44
|
+
isManaged: true,
|
|
45
|
+
kind: "device",
|
|
46
|
+
role: "host",
|
|
47
|
+
status: "up",
|
|
48
|
+
macAddress: "aa:bb:cc:dd:ee:ff",
|
|
49
|
+
ipAddress: "10.0.5.20",
|
|
50
|
+
vlanId: 42,
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const ROUTER_NODE: NetworkTopologyNode = {
|
|
54
|
+
id: "router-1",
|
|
55
|
+
name: "edge-rtr-01",
|
|
56
|
+
isManaged: true,
|
|
57
|
+
kind: "device",
|
|
58
|
+
role: "router",
|
|
59
|
+
status: "up",
|
|
60
|
+
macAddress: "aa:bb:cc:dd:ee:01",
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const LEARNED_EDGE: NetworkTopologyEdge = {
|
|
64
|
+
fromNodeId: SWITCH_NODE.id,
|
|
65
|
+
toNodeId: REGISTER_NODE.id,
|
|
66
|
+
fromPort: "Gi0/12",
|
|
67
|
+
fromInterface: { interfaceIndex: 12, isOperationallyUp: true },
|
|
68
|
+
protocols: ["fdb"],
|
|
69
|
+
parentNodeId: SWITCH_NODE.id,
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/*
|
|
73
|
+
* A router's MAC is learned on the port that leads towards it, so the
|
|
74
|
+
* builder declares no parent for it — the layout keeps inferring.
|
|
75
|
+
*/
|
|
76
|
+
const LEARNED_UPLINK_EDGE: NetworkTopologyEdge = {
|
|
77
|
+
fromNodeId: SWITCH_NODE.id,
|
|
78
|
+
toNodeId: ROUTER_NODE.id,
|
|
79
|
+
fromPort: "Gi0/48",
|
|
80
|
+
protocols: ["fdb"],
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
const LLDP_EDGE: NetworkTopologyEdge = {
|
|
84
|
+
fromNodeId: SWITCH_NODE.id,
|
|
85
|
+
toNodeId: REGISTER_NODE.id,
|
|
86
|
+
fromPort: "Gi0/12",
|
|
87
|
+
toPort: "eth0",
|
|
88
|
+
protocols: ["lldp"],
|
|
89
|
+
parentNodeId: SWITCH_NODE.id,
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const NODE_BY_ID: Map<string, NetworkTopologyNode> = new Map<
|
|
93
|
+
string,
|
|
94
|
+
NetworkTopologyNode
|
|
95
|
+
>([
|
|
96
|
+
[SWITCH_NODE.id, SWITCH_NODE],
|
|
97
|
+
[REGISTER_NODE.id, REGISTER_NODE],
|
|
98
|
+
[ROUTER_NODE.id, ROUTER_NODE],
|
|
99
|
+
]);
|
|
100
|
+
|
|
101
|
+
function renderDevicePanel(
|
|
102
|
+
node: NetworkTopologyNode,
|
|
103
|
+
edges: Array<NetworkTopologyEdge>,
|
|
104
|
+
): void {
|
|
105
|
+
render(
|
|
106
|
+
<MemoryRouter>
|
|
107
|
+
<NetworkDeviceDetailPanel
|
|
108
|
+
node={node}
|
|
109
|
+
edges={edges}
|
|
110
|
+
nodeById={NODE_BY_ID}
|
|
111
|
+
onClose={() => {}}
|
|
112
|
+
onSelectEdge={() => {}}
|
|
113
|
+
/>
|
|
114
|
+
</MemoryRouter>,
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function renderLinkPanel(edge: NetworkTopologyEdge): void {
|
|
119
|
+
render(
|
|
120
|
+
<MemoryRouter>
|
|
121
|
+
<NetworkLinkDetailPanel
|
|
122
|
+
edge={edge}
|
|
123
|
+
fromNode={NODE_BY_ID.get(edge.fromNodeId)}
|
|
124
|
+
toNode={NODE_BY_ID.get(edge.toNodeId)}
|
|
125
|
+
onClose={() => {}}
|
|
126
|
+
/>
|
|
127
|
+
</MemoryRouter>,
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
describe("the device drawer for a device placed by a forwarding table", () => {
|
|
132
|
+
afterEach(() => {
|
|
133
|
+
cleanup();
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
test("says which switch port it was learned on, and that it was learned", () => {
|
|
137
|
+
renderDevicePanel(REGISTER_NODE, [LEARNED_EDGE]);
|
|
138
|
+
|
|
139
|
+
const attachment: HTMLElement = screen.getByTestId(
|
|
140
|
+
"network-topology-learned-attachment",
|
|
141
|
+
);
|
|
142
|
+
expect(attachment).toHaveTextContent("switch-01");
|
|
143
|
+
expect(attachment).toHaveTextContent("Gi0/12");
|
|
144
|
+
expect(attachment).toHaveTextContent("VLAN 42");
|
|
145
|
+
expect(screen.getByText("Connected to")).toBeInTheDocument();
|
|
146
|
+
expect(screen.getByText(/forwarding or ARP table/)).toBeInTheDocument();
|
|
147
|
+
expect(screen.getByText(/re-cabled/)).toBeInTheDocument();
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
test("shows the MAC and the VLAN the table knew the device by", () => {
|
|
151
|
+
renderDevicePanel(REGISTER_NODE, [LEARNED_EDGE]);
|
|
152
|
+
|
|
153
|
+
expect(screen.getByText("MAC address")).toBeInTheDocument();
|
|
154
|
+
expect(screen.getByText("aa:bb:cc:dd:ee:ff")).toBeInTheDocument();
|
|
155
|
+
expect(screen.getByText("VLAN")).toBeInTheDocument();
|
|
156
|
+
expect(screen.getByText("VLAN 42")).toBeInTheDocument();
|
|
157
|
+
expect(screen.getByText("10.0.5.20")).toBeInTheDocument();
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
/*
|
|
161
|
+
* The grey sub-line under a link names THIS device's port. A register has
|
|
162
|
+
* no port to name — it answers ping and nothing else — and the line used
|
|
163
|
+
* to print "?", which reads as "we do not know where this goes" about the
|
|
164
|
+
* one link the map is surest of.
|
|
165
|
+
*/
|
|
166
|
+
test("lists the switch port under Links instead of a question mark", () => {
|
|
167
|
+
renderDevicePanel(REGISTER_NODE, [LEARNED_EDGE]);
|
|
168
|
+
|
|
169
|
+
expect(screen.getByText("Links (1)")).toBeInTheDocument();
|
|
170
|
+
expect(screen.getByText("Gi0/12")).toBeInTheDocument();
|
|
171
|
+
expect(screen.queryByText("?")).not.toBeInTheDocument();
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
test("keeps the device's own port when a discovery protocol reported it too", () => {
|
|
175
|
+
renderDevicePanel(REGISTER_NODE, [
|
|
176
|
+
{ ...LLDP_EDGE, protocols: ["lldp", "fdb"] },
|
|
177
|
+
]);
|
|
178
|
+
|
|
179
|
+
expect(screen.getByText("eth0")).toBeInTheDocument();
|
|
180
|
+
expect(screen.queryByText("Gi0/12")).not.toBeInTheDocument();
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
test("says nothing about an attachment for a device joined by LLDP alone", () => {
|
|
184
|
+
renderDevicePanel(REGISTER_NODE, [LLDP_EDGE]);
|
|
185
|
+
|
|
186
|
+
expect(
|
|
187
|
+
screen.queryByTestId("network-topology-learned-attachment"),
|
|
188
|
+
).not.toBeInTheDocument();
|
|
189
|
+
expect(screen.queryByText("Connected to")).not.toBeInTheDocument();
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
test("says nothing about an attachment for the switch that did the learning", () => {
|
|
193
|
+
renderDevicePanel(SWITCH_NODE, [LEARNED_EDGE]);
|
|
194
|
+
|
|
195
|
+
expect(
|
|
196
|
+
screen.queryByTestId("network-topology-learned-attachment"),
|
|
197
|
+
).not.toBeInTheDocument();
|
|
198
|
+
// Its own end of the edge is the port it learned the register on.
|
|
199
|
+
expect(screen.getByText("Gi0/12")).toBeInTheDocument();
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
test("still offers the device page — the device is managed, not adopted", () => {
|
|
203
|
+
renderDevicePanel(REGISTER_NODE, [LEARNED_EDGE]);
|
|
204
|
+
|
|
205
|
+
expect(screen.getByText("Device details")).toBeInTheDocument();
|
|
206
|
+
expect(
|
|
207
|
+
screen.queryByTestId("network-topology-add-to-monitoring"),
|
|
208
|
+
).not.toBeInTheDocument();
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
/*
|
|
213
|
+
* The same attachment, merged into a link the operator had typed in the
|
|
214
|
+
* other way round - device first, switch second. The switch is the TO end
|
|
215
|
+
* now, and the builder's learnedByNodeId is what keeps both drawers
|
|
216
|
+
* pointing at the right port.
|
|
217
|
+
*/
|
|
218
|
+
const REVERSED_LEARNED_EDGE: NetworkTopologyEdge = {
|
|
219
|
+
fromNodeId: REGISTER_NODE.id,
|
|
220
|
+
toNodeId: SWITCH_NODE.id,
|
|
221
|
+
toPort: "Gi0/12",
|
|
222
|
+
toInterface: { interfaceIndex: 12, isOperationallyUp: true },
|
|
223
|
+
protocols: ["manual", "fdb"],
|
|
224
|
+
parentNodeId: SWITCH_NODE.id,
|
|
225
|
+
learnedByNodeId: SWITCH_NODE.id,
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
describe("a learned link stored switch-second", () => {
|
|
229
|
+
afterEach(() => {
|
|
230
|
+
cleanup();
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
test("the device drawer still names the switch port", () => {
|
|
234
|
+
renderDevicePanel(REGISTER_NODE, [REVERSED_LEARNED_EDGE]);
|
|
235
|
+
|
|
236
|
+
const attachment: HTMLElement = screen.getByTestId(
|
|
237
|
+
"network-topology-learned-attachment",
|
|
238
|
+
);
|
|
239
|
+
expect(attachment).toHaveTextContent("switch-01");
|
|
240
|
+
expect(attachment).toHaveTextContent("Gi0/12");
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
test("the link drawer names the switch as the learner, not the from end", () => {
|
|
244
|
+
renderLinkPanel(REVERSED_LEARNED_EDGE);
|
|
245
|
+
|
|
246
|
+
expect(screen.getByText(/learned/, { selector: "div" })).toHaveTextContent(
|
|
247
|
+
"switch-01 learned pos-register-01's MAC address on Gi0/12",
|
|
248
|
+
);
|
|
249
|
+
expect(
|
|
250
|
+
screen.getByText("Attached via switch-01 Gi0/12"),
|
|
251
|
+
).toBeInTheDocument();
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
describe("the link drawer for a learned link", () => {
|
|
256
|
+
afterEach(() => {
|
|
257
|
+
cleanup();
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
test("calls it learned, and explains the hierarchy in the table's own terms", () => {
|
|
261
|
+
renderLinkPanel(LEARNED_EDGE);
|
|
262
|
+
|
|
263
|
+
expect(screen.getByText("Learned link")).toBeInTheDocument();
|
|
264
|
+
expect(
|
|
265
|
+
screen.getByText(
|
|
266
|
+
/in its forwarding or ARP table, so the Parent-Child view draws/,
|
|
267
|
+
),
|
|
268
|
+
).toBeInTheDocument();
|
|
269
|
+
expect(screen.getByText(/on Gi0\/12/)).toBeInTheDocument();
|
|
270
|
+
expect(
|
|
271
|
+
screen.queryByText(/declared, not inferred/),
|
|
272
|
+
).not.toBeInTheDocument();
|
|
273
|
+
expect(
|
|
274
|
+
screen.queryByTestId("network-topology-learned-link-note"),
|
|
275
|
+
).not.toBeInTheDocument();
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
test("labels the silent device end by the switch port it is attached through", () => {
|
|
279
|
+
renderLinkPanel(LEARNED_EDGE);
|
|
280
|
+
|
|
281
|
+
expect(
|
|
282
|
+
screen.getByText("Attached via switch-01 Gi0/12"),
|
|
283
|
+
).toBeInTheDocument();
|
|
284
|
+
expect(screen.queryByText("Unknown interface")).not.toBeInTheDocument();
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
test("notes what the table did and did not establish when no parent was declared", () => {
|
|
288
|
+
renderLinkPanel(LEARNED_UPLINK_EDGE);
|
|
289
|
+
|
|
290
|
+
const note: HTMLElement = screen.getByTestId(
|
|
291
|
+
"network-topology-learned-link-note",
|
|
292
|
+
);
|
|
293
|
+
expect(note).toHaveTextContent("switch-01");
|
|
294
|
+
expect(note).toHaveTextContent("edge-rtr-01");
|
|
295
|
+
expect(note).toHaveTextContent("on Gi0/48");
|
|
296
|
+
expect(note).toHaveTextContent("forwarding or ARP table");
|
|
297
|
+
expect(screen.getByText("Learned link")).toBeInTheDocument();
|
|
298
|
+
expect(
|
|
299
|
+
screen.queryByText(/declared, not inferred/),
|
|
300
|
+
).not.toBeInTheDocument();
|
|
301
|
+
expect(
|
|
302
|
+
screen.getByText("Attached via switch-01 Gi0/48"),
|
|
303
|
+
).toBeInTheDocument();
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
test("a discovered link still reads exactly as it did", () => {
|
|
307
|
+
renderLinkPanel(LLDP_EDGE);
|
|
308
|
+
|
|
309
|
+
expect(screen.getByText("Network link")).toBeInTheDocument();
|
|
310
|
+
expect(screen.getByText(/declared, not inferred/)).toBeInTheDocument();
|
|
311
|
+
expect(
|
|
312
|
+
screen.queryByTestId("network-topology-learned-link-note"),
|
|
313
|
+
).not.toBeInTheDocument();
|
|
314
|
+
expect(screen.getByText("eth0")).toBeInTheDocument();
|
|
315
|
+
});
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
/*
|
|
319
|
+
* The hierarchy sentence, when the parent is not the learner. A rule or a
|
|
320
|
+
* hand-drawn link said the firewall is the parent; the switch's table
|
|
321
|
+
* learned the firewall's MAC on its uplink. Two facts - and fused into one
|
|
322
|
+
* sentence they read "the firewall learned the switch's MAC", which is
|
|
323
|
+
* backwards.
|
|
324
|
+
*/
|
|
325
|
+
describe("the link drawer when the parent was declared by somebody else", () => {
|
|
326
|
+
afterEach(() => {
|
|
327
|
+
cleanup();
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
const FIREWALL_NODE: NetworkTopologyNode = {
|
|
331
|
+
id: "fw-1",
|
|
332
|
+
name: "edge-fw-01",
|
|
333
|
+
isManaged: true,
|
|
334
|
+
kind: "device",
|
|
335
|
+
role: "firewall",
|
|
336
|
+
status: "up",
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
test("states what the table learned and who is the declared parent, separately", () => {
|
|
340
|
+
NODE_BY_ID.set(FIREWALL_NODE.id, FIREWALL_NODE);
|
|
341
|
+
renderLinkPanel({
|
|
342
|
+
fromNodeId: FIREWALL_NODE.id,
|
|
343
|
+
toNodeId: SWITCH_NODE.id,
|
|
344
|
+
fromPort: "eth1",
|
|
345
|
+
toPort: "Gi0/48",
|
|
346
|
+
protocols: ["manual", "fdb"],
|
|
347
|
+
parentNodeId: FIREWALL_NODE.id,
|
|
348
|
+
learnedByNodeId: SWITCH_NODE.id,
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
const sentence: HTMLElement = screen.getByText(/learned/, {
|
|
352
|
+
selector: "div",
|
|
353
|
+
});
|
|
354
|
+
expect(sentence).toHaveTextContent(
|
|
355
|
+
"switch-01 learned edge-fw-01's MAC address on Gi0/48",
|
|
356
|
+
);
|
|
357
|
+
expect(sentence).toHaveTextContent("edge-fw-01 is the declared parent");
|
|
358
|
+
expect(sentence).not.toHaveTextContent("edge-fw-01 learned");
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
test("a pair a discovery protocol also reports is not called a learned link", () => {
|
|
362
|
+
renderLinkPanel({
|
|
363
|
+
fromNodeId: SWITCH_NODE.id,
|
|
364
|
+
toNodeId: REGISTER_NODE.id,
|
|
365
|
+
fromPort: "Gi0/12",
|
|
366
|
+
toPort: "eth0",
|
|
367
|
+
protocols: ["lldp", "fdb"],
|
|
368
|
+
learnedByNodeId: SWITCH_NODE.id,
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
expect(screen.getByText("Network link")).toBeInTheDocument();
|
|
372
|
+
expect(screen.queryByText("Learned link")).not.toBeInTheDocument();
|
|
373
|
+
});
|
|
374
|
+
});
|