FCC Diagnostics Software Design Description

This document provides a detailed overview of the design specifications for implementing the FCC Diagnostics Feature, including configuration management, database schema, diagnostic workflow, and UI design.

1. Introduction

The FCC Diagnostics Feature is an essential component designed to ensure compliance with Federal Communications Commission (FCC) regulations regarding network latency and speed. This document provides a detailed overview of the design specifications for implementing this feature.

2. Purpose

The primary objectives of the FCC Diagnostics Feature are as follows:

  • Latency Diagnostics: Monitor and analyze network latency to ensure it meets FCC standards.

  • Speed Diagnostics: Evaluate network speed performance against FCC requirements.

  • Automated Diagnostics: Introduce a robust automated diagnostic mechanism triggered from the UpdateGroup module.

  • Configuration Flexibility: Allow customization of diagnostic parameters through the fcc.properties file.

  • Data Integrity: Ensure accurate recording and storage of diagnostic results in dedicated database tables.

3. Scope

The scope of the FCC Diagnostics Feature includes the following key components:

  • Integration with UpdateGroup: Introduce a new UpdateGroup task type, "FCC diagnostics", to initiate diagnostic tasks.

  • Configuration Management: Define diagnostic parameters such as repeat intervals, thresholds, and intervals between data retrievals through the fcc.properties file.

  • Database Schema Expansion: Create new tables (ug_fcc_speed_result, ug_fcc_latency_result) and modify existing ones (ug_fcc, ug_get_param, etc.) to store diagnostic metadata and results.

  • Diagnostic Stages: Implement detailed diagnostic stages including data retrieval, calculation, threshold comparison, and error handling.

  • Error Descriptions: Provide comprehensive descriptions for various diagnostic scenarios to facilitate troubleshooting.

4. Design Overview

The design of the FCC Diagnostics Feature consists of the following components:

  • UpdateGroup Integration: Introduction of a new task type, "FCC diagnostics", within the UpdateGroup module to trigger diagnostic tasks.

  • Configuration Management: Utilization of the fcc.properties file to configure diagnostic parameters such as repeat intervals, thresholds, and data retrieval intervals. (if not exists — default values are used)

  • Database Schema Modification: Creation of new database tables (ug_fcc, ug_fcc_speed_result, ug_fcc_latency_result) and addition of columns to existing tables to accommodate diagnostic data.

  • Diagnostic Workflow: Implementation of a detailed workflow including stages for data retrieval, calculation of WAN usage, comparison with predefined thresholds, and initiation of diagnostic tasks.

  • Error Handling: Provision of descriptive error messages for various diagnostic scenarios to aid in diagnosis and resolution.

5. Detailed Design

5.1. Configuration File (fcc.properties)

The fcc.properties file contains configuration parameters for the FCC Diagnostics Feature, including:

  • fcc.repeat: Number of times to repeat the diagnostic tests.

  • fcc.interval: Interval between consecutive diagnostic tests (in minutes).

  • wan_usage.repeat: Number of times to repeat the WAN usage test in case of detection.

  • wan_usage.interval: Interval between WAN usage tests (in seconds).

  • wan_usage.retrieve.interval: Interval between GetParameterValues tasks for retrieving BytesSent/BytesReceived parameters.

  • latency.success: Latency success threshold (in milliseconds).

  • speed.success: Speed success percentage threshold.

5.2. Database Schema

The database schema includes the following tables:

5.2.1. ug_fcc

  • Stores metadata for FCC diagnostic tasks.

  • Columns: id, ug_task_id, updated, created, updator, creator, threshold_dl, threshold_ul, hubb_id, tier_dl, tier_ul, type.

5.2.2. ug_fcc_speed_result

  • Stores speed diagnostic results.

  • Columns: id, action_id, hubb_id, serial, tier, type, url, start_date, end_date, total_bytes, speed, status, description.

5.2.3. ug_fcc_latency_result

  • Stores latency diagnostic results.

  • Columns: id, action_id, hubb_id, serial, tier, url, start_date, val_avg, val_min, val_max, packets_sent, packets_received, status, description.

5.3. Diagnostic Workflow

The FCC diagnostics feature follows a detailed workflow:

  1. Retrieve active connection BytesSent/BytesReceived parameter values.

  2. Retrieve values again after the specified interval (wan_usage.retrieve.interval).

  3. Calculate current WAN usage: (value - previous value) / (time - time previous) * 0.008.

  4. Compare WAN usage with thresholds for latency or speed diagnostics.

  5. If WAN usage speed is more than the threshold:

    • Save error result in the diagnostic result table.

    • Repeat steps 1-3 after the specified interval (wan_usage.interval) not more than wan_usage.repeat times in total.

  6. If WAN usage is less than the threshold, perform the diagnostic task.

  7. Upon diagnostic completion:

    • Compare diagnostic result with the specified tier and success thresholds (latency.success or speed.success).

    • Save results in the results database table.

  8. Repeat steps 1-7 at the specified interval (fcc.interval) and repeat (fcc.repeat) times.

5.4. Possible Result Descriptions

  • "Unable to find active connection for CPE": Active connection for the CPE is not defined.

  • "Test skipped due to device is offline": UpdateGroup is configured only for online devices, and the current device is offline.

  • "Illegal active connection object name: [PARAMETER_NAME]": Active connection object name is not in the expected format.

  • "Test skipped due to WAN data usage exceeding Threshold: [threshold]Mbps - Actual: [usage]" - p.5

  • "Device didn’t complete diagnostic, diagnostic state is: [DIAGNOSTIC_STATE]" - received state in p.7 not "Completed"

  • "Not all values received from device" - not all parameters received in p.7

  • "Pending task: [TASK_TYPE] is [TASK_STATE]" - some of the tasks in flow is not completed (failed or rejected)

  • "Internal error" — any other issue occurred

5.5. UI design

  • New entries "FCC speed test" and "FCC latency test" are added into "Diagnostics" tasks from "Group Update" tab

  • For "FCC latency test" following fields are present: "Test host", "WAN usage threshold", "HUBB ID" and "Speed tier"

  • For "FCC speed test" following fields are present: "Download URL", "Upload URL", "WAN usage threshold", "HUBB ID" and "Speed tier"

  • Reactivation section is disabled by default with predefined values: "Daily" repeats, "Repeat every" = 1, "Starts on" <next day date> and "Ends" = 6

6. FCC campaigns on USP (TR-369) devices

The sections above describe the Update Group FCC task types 103 and 104. This section describes the FCC campaign engine in the fcc-core module. The engine is driven by the tick job and the fcc_sa_device rows. It measures USP (TR-369) devices on the same four legs as TR-069 and TR-181 devices. Before DEV-3472 the engine closed every USP device as SKIPPED(UNSUPPORTED). The FCC ACS now supports USP.

6.1. Protocol gate

The tick calls FccProtocols.isMeasurable before it creates any task for a device. The method returns true for a TR protocol (isTrProtocol()) or for CpeProtocolEnum.USP.

Device protocol Result

TR-069, TR-181

Measured through the CWMP pipeline. The behavior is unchanged, with one exception: a TR-181 WAN interface path Device.IP.Interface.{i}. is used only when {i} is an instance number ([1-9][0-9]{0,9}) or an instance alias [<alias>] of a device in InstanceAlias mode. The alias has at most 64 characters: a letter, then letters, digits, - or _. When no usable path is found, the device ends as ERROR(NO_WAN_IFACE).

USP (TR-369)

Measured through the FCC USP task processor, as described below.

MQTT, LWM2M, any other protocol

The device ends as SKIPPED(UNSUPPORTED). The ACS writes one INFO line: fcc device skipped, protocol not supported.

The ACS creates no cpe_pending_task and no Connection Request for a skipped device. ft-fcc-service reports a USP device as supportedByAcs=true. Deploy the ACS (this module) before ft-fcc-service, or together with it. If ft-fcc-service is deployed alone, it shows USP as supported while the ACS still skips the device.

6.2. Legs on USP

All four legs run on a USP device. Each leg gives the same device states and report rows as a TR-181 CWMP device.

  • WAN usage pre-check: two samples of the byte counters, the resolve round, and the WAN retry.

  • Download: DownloadDiagnostics().

  • Upload: UploadDiagnostics().

  • Latency: IPPing().

The failed-retry path and the hop from download to upload also run on USP. The ACS supports only the TR-181 Device:2 data model for USP devices.

6.3. Transport

One task processor, FccUspTaskProcessor, handles every USP leg. The processor extends AbstractUspTaskProcessor and handles task type 105 (FccWanBytesGpv). The tick creates the same cpe_pending_task rows as for CWMP. The task_key of each task is the fcc_sa_device.id. The USP task executor runs the task when the agent is connected to this node. Otherwise the task stays queued.

The task-name suffix tells the rounds apart.

Suffix Round

-wan

Byte-counter sample (first sample, second sample, and WAN retry).

-wan-resolve

WAN interface discovery.

-diag-<dl|ul|ping>-<token>

One diagnostic leg. The token is the dispatch time, yyyyMMddHHmmss, 14 digits.

FccWanTaskModes tests the -diag- suffix first. A diagnostic task is never read as a WAN round. The CWMP message creator refuses a -diag- task: it writes a WARN line and returns no message. The longest task name, FCC:FccWanBytesGpv-diag-ping-<14 digits>, fits the varchar(300) task name column.

A USP diagnostic leg creates no cpe_diagnostic row. The leg uses no FTACSCpeDiagnosticProcessor. For a USP row, fcc_sa_device.cpe_diagnostic_id stays null. The column cpe_diagnostic_created holds the dispatch time of the current leg in whole seconds.

The executor timeout of the processor is the larger of two values:

  • The inherited TASK_QUEUE_TIMEOUT (60 seconds).

  • Two times USP_RESPONSE_TIMEOUT plus 15 seconds. The default response timeout is 30 000 ms, so the default bound is 75 seconds.

A diagnostic task makes two requests (Subscribe and Operate). A WAN task makes one request. The USP response timeout of each request fires before the executor timeout.

The processor does not hold the agent for the measurement. The processor completes the diagnostic task as soon as the agent accepts the Operate. The measurement result arrives later as an OperationComplete notification.

6.4. WAN legs on USP

For the -wan rounds, the processor sends one USP Get. The paths are the same as the paths of the CWMP creator: Device.IP.Interface.{i}.Stats.BytesReceived and Device.IP.Interface.{i}.Stats.BytesSent. If the row has no WAN interface yet, the processor fails the task. The response goes to the same evaluation as on CWMP (FccWanBytesResponseHandler.handleValues).

The parameter active_conn_name_id exists for TR-069 only. A USP device therefore always takes the resolve round. For a USP device, a missing active connection on this first sample is the designed path and is logged at DEBUG; for a CWMP device it stays a WARN. The -wan-resolve round sends one Get with four partial paths: Device.IP.Interface., Device.Routing.Router., Device.Ethernet.Link. and Device.Ethernet.Interface.. If the agent lacks one of these paths, the Get answer still contains the parameters that exist.

The ACS matches the WAN interface by these rules, in this order:

  1. IP: The ACS reads Device.ManagementServer.ConnectionRequestURL from its own parameter store. The value is a bare address. The first Device.IP.Interface.{i}.IPv4Address.{j}.IPAddress with the same value selects Device.IP.Interface.{i}..

  2. Default route (route): The ACS reads the entries Device.Routing.Router.{i}.IPv4Forwarding.{j}.. An entry qualifies when Enable is true, Status is Enabled, and DestIPAddress and DestSubnetMask are both empty or 0.0.0.0. The entry with the lowest ForwardingMetric wins. An absent or unparsable metric counts as the largest value. If two entries share the lowest metric, the interface stays unresolved. The Interface value must start with Device.IP.Interface.. The ACS adds a trailing dot when it is missing.

  3. Upstream port (upstream): The ACS follows the interface stack in two fixed hops. The LowerLayers of a Device.IP.Interface.{i}. names a Device.Ethernet.Link.{j}., and the LowerLayers of that link names a Device.Ethernet.Interface.{k}. whose Upstream is true. Each hop compares the exact entries of the comma-separated list. The rule selects an interface only when exactly one IP interface qualifies.

  4. Name (name): The rule selects the IP interface whose Name is wan, case and surrounding spaces ignored, only when exactly one IP interface qualifies.

  5. None: The device ends as ERROR(NO_WAN_IFACE).

The upstream and name rules consider only an IP interface whose Status is Up and whose Loopback is not true. The ACS walks Ethernet only. A stack through PPP, VLANTermination, Bridging, DSL, Optical or Cellular has no upstream port here and falls through to the name rule.

In every rule each instance number of a path ({i}, and {j} and {k} of the upstream rule) must match [1-9][0-9]{0,9}. A rule does not use a path with any other value (empty, a wildcard, a leading zero, extra text), and the ACS stores nothing from it.

The resolve step writes one INFO line with rule=ip, rule=route, rule=upstream, rule=name or rule=none. If a USP Get fails or times out, the processor fails the pending task. The row keeps waiting. The existing WAN step timeout of the tick closes the row with the same reason as on CWMP.

6.5. USP diagnostic commands

FccUspDiagnosticRequestBuilder builds each command from the activation context. The root path is always Device.IP.Diagnostics.. The builder does not read cpe_parameter_name. The builder never sends DiagnosticsState. The builder never puts a null value into an argument map.

Leg Command Inputs sent Outputs kept

Download

Device.IP.Diagnostics.DownloadDiagnostics()

DownloadURL (required). NumberOfConnections when the context sets 2 or more. For a time-based test: TimeBasedTestDuration (must be greater than 0) and TimeBasedTestMeasurementInterval (only when greater than 0).

Status, BOMTime, EOMTime, TestBytesReceived, TotalBytesReceived, TestBytesReceivedUnderFullLoading, TotalBytesReceivedUnderFullLoading, PeriodOfFullLoading, IncrementalResult.{i}.{TestBytesReceived,TotalBytesReceived,StartTime,EndTime}. The ACS appends NumberOfConnections when it was sent.

Upload

Device.IP.Diagnostics.UploadDiagnostics()

UploadURL (required): the upload URL of the context plus the device serial (FccUploadUrl.compose). TestFileLength when fileSizeUl is greater than 0. NumberOfConnections and the time-based pair as for download.

Status, BOMTime, EOMTime, TestBytesSent, TotalBytesSent, TestBytesSentUnderFullLoading, TotalBytesSentUnderFullLoading, PeriodOfFullLoading, IncrementalResult.{i}.{TestBytesSent,TotalBytesSent,StartTime,EndTime}. The ACS appends NumberOfConnections when it was sent.

Latency

Device.IP.Diagnostics.IPPing()

All inputs are required: ProtocolVersion=Any, Host, NumberOfRepetitions, Timeout, DataBlockSize. A missing or non-positive value uses the default 4 repetitions, 1000 ms, and 64 bytes.

Status, SuccessCount, FailureCount, AverageResponseTime, MinimumResponseTime, MaximumResponseTime. The ACS appends NumberOfRepetitions and DataBlockSize.

WAN

Get

Sample: Device.IP.Interface.{i}.Stats.BytesReceived and …​BytesSent. Resolve: Device.IP.Interface. and Device.Routing.Router..

As returned by the agent.

The IncrementalResult index {i} must be a positive integer. FccUspResultMapper drops every other output argument. A DiagnosticsState sent by the device is dropped. The agent value Status is mapped to DiagnosticsState. The mapped names equal the names of a TR-181 CWMP response, so the CWMP result evaluation is reused. A Status other than Complete (for example Error_Timeout) is a measurement outcome. It follows the same non-complete path as a CWMP device: description and failed retry.

The builder returns no command in these cases:

  • The download or upload URL is empty.

  • The ping host is empty.

  • A time-based leg has no positive duration.

The tick then ends the device with ERROR(DEVICE_FAULT), as the CWMP builder does. The ACS does not validate DataBlockSize. The agent refuses a value outside 1 to 65535, and the device ends with ERROR(DEVICE_FAULT).

6.6. Sequence of one diagnostic leg

  1. The tick checks for a competing open cpe_diagnostic row. If one exists, the device ends as SKIPPED(BUSY).

  2. For a USP device, the tick calls FccUspDiagnosticDispatcher instead of the CWMP body. The tick has already armed TIMEOUT_CLOSE and the deadline now + diagTimeoutSec (armForDiagnostic). The dispatcher does not arm the row.

  3. The dispatcher builds the command. If the builder returns nothing, the device ends as ERROR(DEVICE_FAULT).

  4. The dispatcher writes the dispatch time, in whole seconds, to cpe_diagnostic_created. It sets cpe_diagnostic_id to null and writes pending_direction.

  5. The dispatcher creates the type-105 task -diag-<dl|ul|ping>-<token>. It enqueues a Connection Request only when context.push() is true. It then publishes the SENT state.

  6. If the dispatcher throws an error, the tick ends the device with its failDevice (ERROR(DEVICE_FAULT)). No cpe_diagnostic row exists to close.

  7. The processor reads the row and the activation context. It checks that the task still belongs to the dispatch (see Binding a result to its dispatch). A stale task completes with no Operate.

  8. The processor rebuilds the command. It creates a new subscription id (fcc-<UUID>) and a new command key for every execution.

  9. The processor registers the subscription handle, then sends a Subscribe for OperationComplete on the command path. The subscription is not persistent. Its time to live is diagTimeoutSec plus 60 seconds.

  10. If the agent accepts the Subscribe, the processor sends the Operate with the command key and the input arguments.

  11. If the agent accepts the Operate, the processor completes the task. The executor is free for the next task of the device.

  12. The agent measures and sends an OperationComplete with the same command key.

  13. The ACS maps the output arguments and gives them to the result evaluation. The handle is released.

The Operate is sent with send_resp set to the value of UspCommsService.resolveSendResponse(true). The value is true unless the installation forces XX_CMD_SEND_RESP=false. See Limitations.

6.7. Refusal and transport failure

The ACS classifies every callback of the Subscribe and the Operate.

Class Cases Result

Refusal

An Error message to the Subscribe or the Operate. An AddResp with an oper_failure or without a usable result. An OperateResp with cmd_failure, with no result, or with a result that has no case set. An OperationComplete with cmdFailure.

The ACS fails the task if it is still open, closes the device as ERROR(DEVICE_FAULT), and releases the subscription last. A malformed answer writes malformed=true in the log.

Transport failure

No response within the USP response timeout, an MTP error, or an exception in the callback.

The row keeps waiting. The TIMEOUT_CLOSE expiry ends the device as ERROR(TIMEOUT), like a silent CWMP device.

Before the Operate is sent, a transport failure releases the subscription and fails the task. After the Operate is sent, the ACS keeps the subscription. The agent can still be measuring. The OperationComplete is applied if it arrives before the deadline. The executor timeout acts only while the task is pending. It releases the subscription only when no Operate was sent.

The ACS re-reads the row before it closes the device after a refusal. If the row no longer belongs to the dispatch, the ACS closes nothing.

6.8. Binding a result to its dispatch

The binding token is cpe_diagnostic_created. The dispatcher writes it as local wall-clock time truncated to whole seconds. The task suffix carries the same value as yyyyMMddHHmmss. The ACS compares wall-clock values, not epoch values. The column has no time zone, and the comparison stays correct in the repeated hour when clocks go back.

A task or a result is current only if all these conditions are true:

  • The row exists and its cpe_id equals the cpe_id of the task.

  • cpe_diagnostic_id is null (a USP row).

  • cpe_diagnostic_created equals the token.

  • next_action is TIMEOUT_CLOSE.

  • pending_direction equals the direction in the suffix.

  • The deadline next_action_at has a value.

Two more rules depend on the time. Before execution, at least min(60 s, diagTimeoutSec / 2) of the window must remain. When the OperationComplete arrives, now must be before next_action_at.

Any failed condition makes the task or the result stale. A stale task completes with no Operate. A stale result is ignored and the subscription is released. A stale skip before execution writes an INFO line with reason= and one of: missing, cpe, cwmp_row, token, next_action, direction, deadline, malformed. A suffix with an unknown leg or a bad token is malformed. The tick updates that clear cpe_diagnostic_* also invalidate the token.

The ACS applies a notification only when all of these are true:

  • The notification is an OperationComplete.

  • The source endpoint equals the endpoint of the agent.

  • The command key equals the key of this execution.

The ACS ignores any other notification and keeps the subscription. The ACS writes a DEBUG line with the key shortened to 64 characters. Device text in the log has every ISO control character (CR, LF, NEL) and the Unicode line and paragraph separators (U+2028, U+2029) removed, and is cut to 200 characters.

6.9. Rows without a cpe_diagnostic id

A USP row has a null cpe_diagnostic_id. At the TIMEOUT_CLOSE expiry, the tick skips the cpe_diagnostic close for such a row. The tick releases the registry handle of the row instead. Restart recovery and the pending task cleaner read no cpe_diagnostic id, so a USP row needs no change there.

6.10. Subscription lifecycle

FccUspSubscriptionRegistry holds one handle for each fcc_sa_device.id. The registry is in memory and local to the node that executed the leg. A handle expires at next_action_at plus 60 seconds.

The ACS releases a handle on these events:

  • The tick closed the row at its TIMEOUT_CLOSE expiry on this node.

  • The result was applied.

  • The agent refused the leg.

  • A transport failure happened before the Operate was sent.

  • A newer dispatch for the same row replaced the handle.

  • A stale notification arrived.

  • The sweep found the handle expired.

A release removes the local handler and sends a Delete of the subscription to the agent. A node-local sweep runs every 60 seconds and releases every expired handle. A release never throws: it swallows a RuntimeException and writes a WARN with sanitised device text, so it cannot stop the sweep and cannot change the outcome of the row that called it. The caller does its own bookkeeping first and releases last. The sweep covers a tick expiry or a result that ran on another node, where the tick cannot release the local handle. A stop of the activation releases nothing. The TIMEOUT_CLOSE rows stay armed, so a leg in flight finishes as on CWMP. The device-side time to live removes the subscription on the agent. A restart or a node switch loses the in-memory handle. The result is then lost and the leg ends as ERROR(TIMEOUT).

6.11. Limitations

  • No cross-node push for USP. A pending FCC task for an agent that is connected to another node runs when the agent next contacts a node that holds the task. That is its next Periodic, WakeUp or Boot notification. If the interval is longer than the activation diagTimeoutSec (default 900 seconds), the leg ends as ERROR(TIMEOUT). Every other USP task has the same limitation.

  • XX_CMD_SEND_RESP=false hides a refusal. The agent sends no OperateResp. The ACS completes the task right after it hands the Operate to the MTP. A refusal is visible only as an OperationComplete with cmdFailure. An agent that refuses silently ends as ERROR(TIMEOUT), not ERROR(DEVICE_FAULT).

  • A manual USP diagnostic can run at the same time. The ACS checks for an open cpe_diagnostic row at dispatch. A USP FCC leg creates no such row. A manual USP diagnostic started after the FCC leg does not see it. Both measurements are then unreliable.

  • Short diagTimeoutSec. A value of 120 seconds or less gives a leg a start margin of half the window. ft-fcc-service does not bound the value from below.

  • Task type name. Type 105 carries the USP diagnostic rounds under a WAN name. A rename needs a change outside fcc-core.

  • Deployment order. Deploy the ACS before ft-fcc-service.

  • No real-agent test. DEV-3472 has no run on a real USP agent or an emulator. Unit tests use real usp-core classes and protobuf UspMsg records as fixtures.

6.12. For developers

  • The code is in FT_IoT/FTFCC/fcc-core, package com.friendly.fcc.core.usp, with diag/FccUspDiagnosticRequestBuilder, wan/FccWanParameters, wan/FccWanTaskModes and wan/FccWanInterfaceResolver.

  • fcc-core depends on usp-core (compile scope). The cycle through the USP executor is broken by the existing @Lazy injections.

  • FccUspTaskProcessor, FccUspSubscriptionRegistry and the request builder are not gated by fcc.command.consumer.enabled. FccUspDiagnosticDispatcher is gated like the tick.

  • FccUspSubscribeListener, FccUspOperateListener, FccUspNotificationListener and the leg classes are not beans. The processor creates one set for each execution.

  • The Subscribe callback runs the Operate send inside one try/catch. An exception becomes a transport failure and never reaches the USP server response handling.

  • The callbacks run on the MTP inbound pool. The FCC code adds no push, remote call or wait to a callback.

  • The result evaluation is protocol neutral: FccSaDiagnosticResultListener.onResult and FccWanBytesResponseHandler.handleValues. The CWMP entry points delegate to them.

  • The upload result URL equals the UploadURL that the device received.

7. Assumptions

  • Access to network performance metrics is available.

  • Diagnostic thresholds and parameters are correctly configured in the fcc.properties file.

  • Diagnostic tasks are executed asynchronously and can handle intermittent failures gracefully.