Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
export default {
name: 'firmware-update-success',
description:
'Successful firmware update: station boots, downloads firmware, installs it successfully, and continues operating normally. No failures expected.',
trace: {
traceId: 'scenario-firmware-update-success',
metadata: {
stationId: 'CS-SYNTHETIC-012',
ocppVersion: '1.6',
source: 'synthetic-scenario',
description:
'Station boots, reports the firmware as downloaded and installed within seconds, then sends a heartbeat.',
},
events: [
{
timestamp: '2024-01-15T06:00:00.000Z',
direction: 'CS_TO_CSMS',
message: [
2,
'msg-001',
'BootNotification',
{
chargePointVendor: 'SyntheticVendor',
chargePointModel: 'SM-100',
chargePointSerialNumber: 'CS-SYNTHETIC-012',
firmwareVersion: '1.0.0',
},
],
},
{
timestamp: '2024-01-15T06:00:00.500Z',
direction: 'CSMS_TO_CS',
message: [
3,
'msg-001',
{
currentTime: '2024-01-15T06:00:00.500Z',
interval: 300,
status: 'Accepted',
},
],
},
{
timestamp: '2024-01-15T06:00:30.000Z',
direction: 'CS_TO_CSMS',
message: [
2,
'msg-002',
'FirmwareStatusNotification',
{ status: 'Downloaded' },
],
},
{
timestamp: '2024-01-15T06:00:30.500Z',
direction: 'CSMS_TO_CS',
message: [3, 'msg-002', {}],
},
{
timestamp: '2024-01-15T06:01:00.000Z',
direction: 'CS_TO_CSMS',
message: [
2,
'msg-003',
'FirmwareStatusNotification',
{ status: 'Installed' },
],
},
{
timestamp: '2024-01-15T06:01:00.500Z',
direction: 'CSMS_TO_CS',
message: [3, 'msg-003', {}],
},
{
timestamp: '2024-01-15T06:03:00.000Z',
direction: 'CS_TO_CSMS',
message: [2, 'msg-hb-1', 'Heartbeat', {}],
},
{
timestamp: '2024-01-15T06:03:00.500Z',
direction: 'CSMS_TO_CS',
message: [
3,
'msg-hb-1',
{ currentTime: '2024-01-15T06:03:00.500Z' },
],
},
],
},
expectedFailures: [],
assertions: [{ type: 'no_failures', params: {} }],
};
7 changes: 5 additions & 2 deletions packages/toolkit/src/scenarios/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
shortSessionScenario,
heartbeatIrregularScenario,
unresponsiveCsmsScenario,
firmwareUpdateSuccessScenario,
} from './index.js';
import { parseTrace, buildSessionTimeline, detectFailures } from '../core/index.js';

Expand All @@ -26,8 +27,8 @@ import { parseTrace, buildSessionTimeline, detectFailures } from '../core/index.
// ---------------------------------------------------------------------------

describe('scenario registry', () => {
it('exports exactly 15 scenarios', () => {
expect(scenarios).toHaveLength(15);
it('exports exactly 16 scenarios', () => {
expect(scenarios).toHaveLength(16);
});

it('exports scenario names in order', () => {
Expand All @@ -47,6 +48,7 @@ describe('scenario registry', () => {
'short-session',
'heartbeat-irregular',
'unresponsive-csms',
'firmware-update-success',
]);
});

Expand Down Expand Up @@ -75,6 +77,7 @@ describe('scenario registry', () => {
expect(getScenario('short-session')).toBe(shortSessionScenario);
expect(getScenario('heartbeat-irregular')).toBe(heartbeatIrregularScenario);
expect(getScenario('unresponsive-csms')).toBe(unresponsiveCsmsScenario);
expect(getScenario('firmware-update-success')).toBe(firmwareUpdateSuccessScenario);
});

it('getScenario returns undefined for unknown name', () => {
Expand Down
5 changes: 5 additions & 0 deletions packages/toolkit/src/scenarios/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import meterAnomaly from './__scenarios__/meter-anomaly.js';
import shortSession from './__scenarios__/short-session.js';
import heartbeatIrregular from './__scenarios__/heartbeat-irregular.js';
import unresponsiveCsms from './__scenarios__/unresponsive-csms.js';
import firmwareUpdateSuccess from './__scenarios__/firmware-update-success.js';

// ---------------------------------------------------------------------------
// Scenarios derived from core fixtures
Expand Down Expand Up @@ -66,6 +67,7 @@ const meterAnomalyScenario: Scenario = meterAnomaly as unknown as Scenario;
const shortSessionScenario: Scenario = shortSession as unknown as Scenario;
const heartbeatIrregularScenario: Scenario = heartbeatIrregular as unknown as Scenario;
const unresponsiveCsmsScenario: Scenario = unresponsiveCsms as unknown as Scenario;
const firmwareUpdateSuccessScenario: Scenario = firmwareUpdateSuccess as unknown as Scenario;

// ---------------------------------------------------------------------------
// Registry
Expand All @@ -87,6 +89,7 @@ export const scenarios = [
shortSessionScenario,
heartbeatIrregularScenario,
unresponsiveCsmsScenario,
firmwareUpdateSuccessScenario,
] as const;

export const scenarioNames = [
Expand All @@ -105,6 +108,7 @@ export const scenarioNames = [
'short-session',
'heartbeat-irregular',
'unresponsive-csms',
'firmware-update-success',
] as const;

export {
Expand All @@ -123,6 +127,7 @@ export {
shortSessionScenario,
heartbeatIrregularScenario,
unresponsiveCsmsScenario,
firmwareUpdateSuccessScenario,
};

export { compareScenarioReports } from './compare.js';
Expand Down
4 changes: 2 additions & 2 deletions tests/external-fixture/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ const scenarios = await import('@ocpp-debugkit/toolkit/scenarios');

assert(Array.isArray(scenarios.scenarios), 'scenarios is an array');
assert(
scenarios.scenarios.length === 15,
`15 scenarios exported (got ${scenarios.scenarios.length})`,
scenarios.scenarios.length === 16,
`16 scenarios exported (got ${scenarios.scenarios.length})`,
);
assert(typeof scenarios.getScenario === 'function', 'getScenario is a function');
assert(scenarios.getScenario('normal-session') !== undefined, 'normal-session scenario exists');
Expand Down