feat(simulator): add certificates related OCPP 2.x types
authorJérôme Benoit <jerome.benoit@sap.com>
Tue, 21 Feb 2023 21:10:24 +0000 (22:10 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Tue, 21 Feb 2023 21:10:24 +0000 (22:10 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ocpp/OCPPConstants.ts
src/types/ocpp/2.0/Common.ts
src/types/ocpp/2.0/Requests.ts
src/types/ocpp/2.0/Responses.ts
src/types/ocpp/Responses.ts

index f6b9af807d5e0552adca1aae18f4c44c7fee699b..1064a95a0e3ab1651162b38e1ad1defb7fd59e0c 100644 (file)
@@ -12,8 +12,8 @@ import {
 export class OCPPConstants {
   static readonly OCPP_REQUEST_EMPTY = Object.freeze({});
   static readonly OCPP_RESPONSE_EMPTY = Object.freeze({});
-  static readonly OCPP_RESPONSE_ACCEPTED = Object.freeze({ status: GenericStatus.ACCEPTED });
-  static readonly OCPP_RESPONSE_REJECTED = Object.freeze({ status: GenericStatus.REJECTED });
+  static readonly OCPP_RESPONSE_ACCEPTED = Object.freeze({ status: GenericStatus.Accepted });
+  static readonly OCPP_RESPONSE_REJECTED = Object.freeze({ status: GenericStatus.Rejected });
 
   static readonly OCPP_CONFIGURATION_RESPONSE_ACCEPTED = Object.freeze({
     status: ConfigurationStatus.ACCEPTED,
index 5e47a2512cbdc4eebe78ab019bb993f969a62ca1..ba908562c87bb70b013bbb94e9436f0db133fd55 100644 (file)
@@ -1,4 +1,17 @@
-import type { JsonObject } from '../../internal';
+import type { GenericStatus, JsonObject } from '../../internal';
+
+export enum DataEnumType {
+  // eslint-disable-next-line id-blacklist
+  string = 'string',
+  decimal = 'decimal',
+  integer = 'integer',
+  dateTime = 'dateTime',
+  // eslint-disable-next-line id-blacklist
+  boolean = 'boolean',
+  OptionList = 'OptionList',
+  SequenceList = 'SequenceList',
+  MemberList = 'MemberList',
+}
 
 export enum BootReasonEnumType {
   ApplicationReset = 'ApplicationReset',
@@ -20,6 +33,84 @@ export enum OCPP20ConnectorStatusEnumType {
   FAULTED = 'Faulted',
 }
 
+export type GenericStatusEnumType = GenericStatus;
+
+export enum HashAlgorithmEnumType {
+  SHA256 = 'SHA256',
+  SHA384 = 'SHA384',
+  SHA512 = 'SHA512',
+}
+
+export enum GetCertificateIdUseEnumType {
+  V2GRootCertificate = 'V2GRootCertificate',
+  MORootCertificate = 'MORootCertificate',
+  CSMSRootCertificate = 'CSMSRootCertificate',
+  V2GCertificateChain = 'V2GCertificateChain',
+  ManufacturerRootCertificate = 'ManufacturerRootCertificate',
+}
+
+export enum GetCertificateStatusEnumType {
+  Accepted = 'Accepted',
+  Failed = 'Failed',
+}
+
+export enum GetInstalledCertificateStatusEnumType {
+  Accepted = 'Accepted',
+  NotFound = 'NotFound',
+}
+
+export enum InstallCertificateStatusEnumType {
+  Accepted = 'Accepted',
+  Rejected = 'Rejected',
+  Failed = 'Failed',
+}
+
+export enum InstallCertificateUseEnumType {
+  V2GRootCertificate = 'V2GRootCertificate',
+  MORootCertificate = 'MORootCertificate',
+  CSMSRootCertificate = 'CSMSRootCertificate',
+  ManufacturerRootCertificate = 'ManufacturerRootCertificate',
+}
+
+export enum DeleteCertificateStatusEnumType {
+  Accepted = 'Accepted',
+  Failed = 'Failed',
+  NotFound = 'NotFound',
+}
+
+export enum CertificateActionEnumType {
+  Install = 'Install',
+  Update = 'Update',
+}
+
+export enum CertificateSigningUseEnumType {
+  ChargingStationCertificate = 'ChargingStationCertificate',
+  V2GCertificate = 'V2GCertificate',
+}
+
+export type CertificateSignedStatusEnumType = GenericStatus;
+
+export type CertificateHashDataType = {
+  hashAlgorithm: HashAlgorithmEnumType;
+  issuerNameHash: string;
+  issuerKeyHash: string;
+  serialNumber: string;
+} & JsonObject;
+
+export type CertificateHashDataChainType = {
+  certificateType: GetCertificateIdUseEnumType;
+  certificateHashData: CertificateHashDataType;
+  childCertificateHashData?: CertificateHashDataType;
+} & JsonObject;
+
+export type OCSPRequestDataType = {
+  hashAlgorithm: HashAlgorithmEnumType;
+  issuerNameHash: string;
+  issuerKeyHash: string;
+  serialNumber: string;
+  responderURL: string;
+} & JsonObject;
+
 export type StatusInfoType = {
   reasonCode: string;
   additionalInfo?: string;
index 220a39b6f617a0f020aa5b65ff04baecbc0ad3c3..d584c8289ad88db7e3d79ad56b95610062b15f99 100644 (file)
@@ -1,6 +1,7 @@
 import type {
   BootReasonEnumType,
   EmptyObject,
+  InstallCertificateUseEnumType,
   JsonObject,
   OCPP20ConnectorStatusEnumType,
   OCPP20SetVariableDataType,
@@ -50,3 +51,8 @@ export type OCPP20StatusNotificationRequest = {
 export type OCPP20SetVariablesRequest = {
   setVariableData: OCPP20SetVariableDataType[];
 } & JsonObject;
+
+export type OCPP20InstallCertificateRequest = {
+  certificateType: InstallCertificateUseEnumType;
+  certificate: string;
+} & JsonObject;
index fdbebf15c4eb33fd5b8fed7c4fd719fdcceb2493..5fac747a2300cfe023a482cbd3804a7dbe020f80 100644 (file)
@@ -1,6 +1,7 @@
 import type {
   EmptyObject,
   GenericStatus,
+  InstallCertificateStatusEnumType,
   JsonObject,
   OCPP20SetVariableResultType,
   RegistrationStatusEnumType,
@@ -28,3 +29,8 @@ export type OCPP20StatusNotificationResponse = EmptyObject;
 export type OCPP20SetVariablesResponse = {
   setVariableResult: OCPP20SetVariableResultType[];
 } & JsonObject;
+
+export type OCPP20InstallCertificateResponse = {
+  status: InstallCertificateStatusEnumType;
+  statusInfo?: StatusInfoType;
+} & JsonObject;
index ae6ae45d67d6404b9ac9f6153d8af8550d438191..f14ef426871c107b8533d8744fde282f6930a857 100644 (file)
@@ -53,8 +53,8 @@ export type DiagnosticsStatusNotificationResponse = OCPP16DiagnosticsStatusNotif
 export type FirmwareStatusNotificationResponse = OCPP16FirmwareStatusNotificationResponse;
 
 export enum GenericStatus {
-  ACCEPTED = 'Accepted',
-  REJECTED = 'Rejected',
+  Accepted = 'Accepted',
+  Rejected = 'Rejected',
 }
 
 export type GenericResponse = {