]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
feat(cli): expose station identity overrides and CSMS credentials
authorJérôme Benoit <jerome.benoit@sap.com>
Wed, 22 Apr 2026 19:58:21 +0000 (21:58 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Wed, 22 Apr 2026 19:58:21 +0000 (21:58 +0200)
Add --base-name, --fixed-name, --name-suffix, --supervision-user and
--supervision-password options to station add command. Add credential
options to supervision set-url. Update integration tests and README.

ui/cli/README.md
ui/cli/src/commands/station.ts
ui/cli/src/commands/supervision.ts
ui/cli/tests/integration/cli.test.ts

index 0b7c663df5d79cc161e84677d4fa7743cbfa3afc..05bcfd490c5cc1a5ba3dc0c3820b35a9a9c0a6fd 100644 (file)
@@ -152,14 +152,19 @@ evse-cli station delete [hashId...]            # Delete station(s)
 
 **`station add` options:**
 
-| Option                    | Required | Description                          |
-| ------------------------- | -------- | ------------------------------------ |
-| `-t, --template <name>`   | Yes      | Station template name                |
-| `-n, --count <n>`         | Yes      | Number of stations to add            |
-| `--supervision-url <url>` | No       | Override supervision URL             |
-| `--auto-start`            | No       | Auto-start added stations            |
-| `--persistent-config`     | No       | Enable persistent OCPP configuration |
-| `--ocpp-strict`           | No       | Enable OCPP strict compliance        |
+| Option                              | Required | Description                                |
+| ----------------------------------- | -------- | ------------------------------------------ |
+| `-t, --template <name>`             | Yes      | Station template name                      |
+| `-n, --count <n>`                   | Yes      | Number of stations to add                  |
+| `--auto-start`                      | No       | Auto-start added stations                  |
+| `--base-name <name>`                | No       | Override template base name for station id |
+| `--fixed-name`                      | No       | Use base name verbatim as station id       |
+| `--name-suffix <suffix>`            | No       | Suffix appended to derived station id      |
+| `--ocpp-strict`                     | No       | Enable OCPP strict compliance              |
+| `--persistent-config`               | No       | Enable persistent OCPP configuration       |
+| `--supervision-password <password>` | No       | CSMS basic auth password                   |
+| `--supervision-url <url>`           | No       | Override supervision URL                   |
+| `--supervision-user <user>`         | No       | CSMS basic auth user                       |
 
 **`station delete` options:**
 
@@ -248,7 +253,7 @@ When `-p` is provided, version detection is skipped and the raw payload is passe
 #### supervision
 
 ```shell
-evse-cli supervision set-url --supervision-url <url> [hashId...]  # Set supervision URL
+evse-cli supervision set-url --supervision-url <url> [--supervision-user <user>] [--supervision-password <password>] [hashId...]  # Set supervision URL
 ```
 
 #### performance
index c7d1042888a2ffef9ce5c008276a5c68cd03d557..3e029c48bca1e17df23635943d56a1c44cd3e8b1 100644 (file)
@@ -35,26 +35,41 @@ export const createStationCommands = (program: Command): Command => {
     .description('Add stations from template')
     .requiredOption('-t, --template <name>', 'station template name')
     .requiredOption('-n, --count <n>', 'number of stations to add', parseInteger)
-    .option('--supervision-url <url>', 'supervision URL for new stations')
     .option('--auto-start', 'auto-start added stations')
-    .option('--persistent-config', 'enable persistent OCPP configuration')
+    .option('--base-name <name>', 'override template base name for station id')
+    .option('--fixed-name', 'use base name verbatim as station id')
+    .option('--name-suffix <suffix>', 'suffix appended to derived station id')
     .option('--ocpp-strict', 'enable OCPP strict compliance')
+    .option('--persistent-config', 'enable persistent OCPP configuration')
+    .option('--supervision-password <password>', 'CSMS basic auth password')
+    .option('--supervision-url <url>', 'supervision URL for new stations')
+    .option('--supervision-user <user>', 'CSMS basic auth user')
     .action(
       async (options: {
         autoStart?: true
+        baseName?: string
         count: number
+        fixedName?: true
+        nameSuffix?: string
         ocppStrict?: true
         persistentConfig?: true
+        supervisionPassword?: string
         supervisionUrl?: string
+        supervisionUser?: string
         template: string
       }) => {
         const payload: RequestPayload = {
           numberOfStations: options.count,
           options: pickDefined(options as Record<string, unknown>, {
             autoStart: 'autoStart',
+            baseName: 'baseName',
+            fixedName: 'fixedName',
+            nameSuffix: 'nameSuffix',
             ocppStrict: 'ocppStrictCompliance',
             persistentConfig: 'persistentConfiguration',
+            supervisionPassword: 'supervisionPassword',
             supervisionUrl: 'supervisionUrls',
+            supervisionUser: 'supervisionUser',
           }) as RequestPayload,
           template: options.template,
         }
index d4c746a682bc6c49dd4c669f218e7a83e7578e8d..57962819e51051152017d742dd318976a03b6a86 100644 (file)
@@ -2,7 +2,7 @@ import { Command } from 'commander'
 import { ProcedureName, type RequestPayload } from 'ui-common'
 
 import { runAction } from './action.js'
-import { buildHashIdsPayload } from './payload.js'
+import { buildHashIdsPayload, pickDefined } from './payload.js'
 
 export const createSupervisionCommands = (program: Command): Command => {
   const cmd = new Command('supervision').description('Supervision URL management')
@@ -11,13 +11,28 @@ export const createSupervisionCommands = (program: Command): Command => {
     .command('set-url [hashIds...]')
     .description('Set supervision URL for station(s)')
     .requiredOption('--supervision-url <url>', 'supervision URL')
-    .action(async (hashIds: string[], options: { supervisionUrl: string }) => {
-      const payload: RequestPayload = {
-        url: options.supervisionUrl,
-        ...buildHashIdsPayload(hashIds),
+    .option('--supervision-password <password>', 'CSMS basic auth password')
+    .option('--supervision-user <user>', 'CSMS basic auth user')
+    .action(
+      async (
+        hashIds: string[],
+        options: {
+          supervisionPassword?: string
+          supervisionUrl: string
+          supervisionUser?: string
+        }
+      ) => {
+        const payload: RequestPayload = {
+          url: options.supervisionUrl,
+          ...pickDefined(options as Record<string, unknown>, {
+            supervisionPassword: 'supervisionPassword',
+            supervisionUser: 'supervisionUser',
+          }),
+          ...buildHashIdsPayload(hashIds),
+        }
+        await runAction(program, ProcedureName.SET_SUPERVISION_URL, payload)
       }
-      await runAction(program, ProcedureName.SET_SUPERVISION_URL, payload)
-    })
+    )
 
   return cmd
 }
index 0c4f8fa043a9de8072b0c3356eb8c52bf7d8db5e..6d798a8d5b37bee38e3f12d016399ea4d9b4e858 100644 (file)
@@ -88,4 +88,27 @@ await describe('evse-cli integration tests', async () => {
     const result = await runCli(['station', 'add'])
     assert.strictEqual(result.code, 1)
   })
+
+  await it('should show identity and credential options in station add help', async () => {
+    const result = await runCli(['station', 'add', '--help'])
+    assert.strictEqual(result.code, 0)
+    assert.ok(result.stdout.includes('--base-name'), 'Expected --base-name option')
+    assert.ok(result.stdout.includes('--fixed-name'), 'Expected --fixed-name option')
+    assert.ok(result.stdout.includes('--name-suffix'), 'Expected --name-suffix option')
+    assert.ok(result.stdout.includes('--supervision-user'), 'Expected --supervision-user option')
+    assert.ok(
+      result.stdout.includes('--supervision-password'),
+      'Expected --supervision-password option'
+    )
+  })
+
+  await it('should show credential options in supervision set-url help', async () => {
+    const result = await runCli(['supervision', 'set-url', '--help'])
+    assert.strictEqual(result.code, 0)
+    assert.ok(result.stdout.includes('--supervision-user'), 'Expected --supervision-user option')
+    assert.ok(
+      result.stdout.includes('--supervision-password'),
+      'Expected --supervision-password option'
+    )
+  })
 })