Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

Commit

Permalink
Merge pull request #2751 from sap-labs-france/master-qa
Browse files Browse the repository at this point in the history
Merge master-qa
  • Loading branch information
LucasBrazi06 authored Aug 25, 2021
2 parents 7de3cf5 + 9ed2a99 commit 4d133b4
Show file tree
Hide file tree
Showing 34 changed files with 333 additions and 26 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ev-server",
"version": "2.4.85",
"version": "2.4.87",
"engines": {
"node": "14.x.x",
"npm": "6.x.x"
Expand Down
2 changes: 1 addition & 1 deletion src/assets/charging-station-templates
89 changes: 89 additions & 0 deletions src/assets/server/rest/v1/docs/e-mobility-oas.json
Original file line number Diff line number Diff line change
Expand Up @@ -2169,6 +2169,95 @@
}
}
},
"/api/charging-stations/{id}/data/transfer": {
"put": {
"security": [
{
"bearerAuth": []
}
],
"description": "Trigger Data Transfer",
"parameters": [
{
"$ref": "#/components/parameters/chargingStationID"
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"args": {
"type": "object",
"properties": {
"vendorId": {
"type": "string",
"description": "Mandatory. Vendor of the charging station.",
"example": ""
},
"messageId": {
"type": "string",
"description": "Optional. Message to send.",
"example": ""
},
"data": {
"type": "string",
"description": "Optional. Data to send.",
"example": ""
}
}
}
}
}
}
}
},
"tags": [
"Charging Stations"
],
"responses": {
"200": {
"description": "Data Transfer has been successfully executed",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"status": {
"type": "string"
}
}
},
"examples": {
"accepted": {
"summary": "Accepted",
"value": {
"status": "Accepted"
}
},
"rejected": {
"summary": "Rejected",
"value": {
"status": "Rejected"
}
}
}
}
}
},
"401": {
"$ref": "#/components/responses/UnauthorizedError"
},
"403": {
"$ref": "#/components/responses/ForbiddenError"
},
"500": {
"$ref": "#/components/responses/BackendError"
}
}
}
},
"/api/charging-stations/{id}/configuration/retrieve": {
"put": {
"security": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@
},
"csChargingProfile": {
"$ref": "chargingstation.json#/definitions/chargingProfile"
},
"vendorId": {
"type": "string",
"sanitize": "mongo"
},
"messageId": {
"type": "string",
"sanitize": "mongo"
},
"data": {
"type": "string",
"sanitize": "mongo"
}
}
},
Expand Down
1 change: 1 addition & 0 deletions src/authorization/Authorizations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,7 @@ export default class Authorizations {
// Check Tag ID
if (remoteAuthorization.tagId === tag.ocpiToken?.uid) {
await Logging.logDebug({
siteID: chargingStation.siteID,
source: chargingStation.id,
tenantID: tenant.id, action,
message: `${Utils.buildConnectorInfo(connector.connectorId, transaction?.id)} Valid Remote Authorization found for Tag ID '${tag.ocpiToken.uid}'`,
Expand Down
2 changes: 1 addition & 1 deletion src/authorization/AuthorizationsDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ const AUTHORIZATION_DEFINITION: AuthorizationDefinition = {
Action.REMOTE_STOP_TRANSACTION, Action.STOP_TRANSACTION, Action.START_TRANSACTION,
Action.UNLOCK_CONNECTOR, Action.AUTHORIZE, Action.SET_CHARGING_PROFILE, Action.GET_COMPOSITE_SCHEDULE,
Action.CLEAR_CHARGING_PROFILE, Action.GET_DIAGNOSTICS, Action.UPDATE_FIRMWARE, Action.EXPORT,
Action.CHANGE_AVAILABILITY
Action.CHANGE_AVAILABILITY, Action.TRIGGER_DATA_TRANSFER
]
},
{ resource: Entity.TRANSACTIONS, action: [Action.LIST, Action.EXPORT, Action.IN_ERROR] },
Expand Down
11 changes: 11 additions & 0 deletions src/client/ocpi/CpoOCPIClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ export default class CpoOCPIClient extends OCPIClient {
}
await Logging.logInfo({
tenantID: this.tenant.id,
siteID: chargingStation.siteID,
source: chargingStation.id,
action: ServerAction.OCPI_AUTHORIZE_TOKEN,
message: `OCPI Tag ID '${token.uid}' has been authorized successfully`,
Expand Down Expand Up @@ -260,6 +261,7 @@ export default class CpoOCPIClient extends OCPIClient {
};
await Logging.logInfo({
tenantID: this.tenant.id,
siteID: chargingStation.siteID,
source: chargingStation.id,
action: ServerAction.OCPI_START_SESSION,
message: `${Utils.buildConnectorInfo(transaction.connectorId, transaction.id)} OCPI Transaction has been started successfully`,
Expand Down Expand Up @@ -306,6 +308,7 @@ export default class CpoOCPIClient extends OCPIClient {
});
await Logging.logInfo({
tenantID: this.tenant.id,
siteID: transaction.siteID,
source: transaction.chargeBoxID,
action: ServerAction.OCPI_PUSH_SESSIONS,
message: `${Utils.buildConnectorInfo(transaction.connectorId, transaction.id)} OCPI Transaction has been patched successfully`,
Expand Down Expand Up @@ -351,6 +354,7 @@ export default class CpoOCPIClient extends OCPIClient {
});
await Logging.logInfo({
tenantID: this.tenant.id,
siteID: transaction.siteID,
source: transaction.chargeBoxID,
action: ServerAction.OCPI_STOP_SESSION,
message: `${Utils.buildConnectorInfo(transaction.connectorId, transaction.id)} OCPI Transaction has been stopped successfully`,
Expand Down Expand Up @@ -406,6 +410,7 @@ export default class CpoOCPIClient extends OCPIClient {
});
await Logging.logInfo({
tenantID: this.tenant.id,
siteID: transaction.siteID,
source: transaction.chargeBoxID,
action: ServerAction.OCPI_PUSH_CDRS,
message: `${Utils.buildConnectorInfo(transaction.connectorId, transaction.id)} OCPI CDR has been sent successfully`,
Expand Down Expand Up @@ -440,6 +445,7 @@ export default class CpoOCPIClient extends OCPIClient {
}
await Logging.logInfo({
tenantID: this.tenant.id,
siteID: chargingStation.siteID,
source: chargingStation.id,
action: ServerAction.OCPI_PATCH_STATUS,
message: 'Charging Station has been removed successfully',
Expand Down Expand Up @@ -827,6 +833,7 @@ export default class CpoOCPIClient extends OCPIClient {
if (response.data.status_code === 3001) {
await Logging.logError({
tenantID: this.tenant.id,
siteID: transaction.siteID,
source: transaction.chargeBoxID,
action: ServerAction.OCPI_CHECK_CDRS,
message: `${Utils.buildConnectorInfo(transaction.connectorId, transaction.id)} CDR does not exist in IOP`,
Expand All @@ -849,6 +856,7 @@ export default class CpoOCPIClient extends OCPIClient {
// CDR checked
await Logging.logInfo({
tenantID: this.tenant.id,
siteID: transaction.siteID,
source: transaction.chargeBoxID,
action: ServerAction.OCPI_CHECK_CDRS,
message: `${Utils.buildConnectorInfo(transaction.connectorId, transaction.id)} CDR has been checked successfully`,
Expand All @@ -860,6 +868,7 @@ export default class CpoOCPIClient extends OCPIClient {
}
await Logging.logError({
tenantID: this.tenant.id,
siteID: transaction.siteID,
source: transaction.chargeBoxID,
action: ServerAction.OCPI_CHECK_CDRS,
message: `${Utils.buildConnectorInfo(transaction.connectorId, transaction.id)} Failed to check CDR '${transaction.ocpiData.session.id}' at ${cdrsUrl}/${transaction.ocpiData.cdr.id}`,
Expand Down Expand Up @@ -895,6 +904,7 @@ export default class CpoOCPIClient extends OCPIClient {
if (session) {
await Logging.logInfo({
tenantID: this.tenant.id,
siteID: transaction.siteID,
source: transaction.chargeBoxID,
action: ServerAction.OCPI_CHECK_SESSIONS,
message: `${Utils.buildConnectorInfo(transaction.connectorId, transaction.id)} Transaction has been checked successfully`,
Expand All @@ -906,6 +916,7 @@ export default class CpoOCPIClient extends OCPIClient {
}
await Logging.logError({
tenantID: this.tenant.id,
siteID: transaction.siteID,
source: transaction.chargeBoxID,
action: ServerAction.OCPI_CHECK_SESSIONS,
message: `${Utils.buildConnectorInfo(transaction.connectorId, transaction.id)} Failed to check Transaction at ${sessionsUrl}`,
Expand Down
2 changes: 2 additions & 0 deletions src/client/ocpi/EmspOCPIClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ export default class EmspOCPIClient extends OCPIClient {
await Logging.logDebug({
tenantID: this.tenant.id,
action: ServerAction.OCPI_START_SESSION,
siteID: chargingStation.siteID,
source: chargingStation.id,
message: `${Utils.buildConnectorInfo(connectorID)} OCPI Remote Start session response status '${response.status}'`,
module: MODULE_NAME, method: 'remoteStartSession',
Expand Down Expand Up @@ -553,6 +554,7 @@ export default class EmspOCPIClient extends OCPIClient {
await Logging.logDebug({
tenantID: this.tenant.id,
action: ServerAction.OCPI_STOP_SESSION,
siteID: transaction.siteID,
source: transaction.chargeBoxID,
message: `${Utils.buildConnectorInfo(transaction.connectorId, transaction.id)} OCPI Remote Stop response status '${response.status}'`,
module: MODULE_NAME, method: 'remoteStopSession',
Expand Down
7 changes: 6 additions & 1 deletion src/client/ocpi/OCPIChargingStationClient.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OCPPAvailabilityStatus, OCPPChangeAvailabilityCommandParam, OCPPChangeAvailabilityCommandResult, OCPPChangeConfigurationCommandParam, OCPPChangeConfigurationCommandResult, OCPPChargingProfileStatus, OCPPClearCacheCommandResult, OCPPClearCacheStatus, OCPPClearChargingProfileCommandParam, OCPPClearChargingProfileCommandResult, OCPPClearChargingProfileStatus, OCPPConfigurationStatus, OCPPGetCompositeScheduleCommandParam, OCPPGetCompositeScheduleCommandResult, OCPPGetCompositeScheduleStatus, OCPPGetConfigurationCommandParam, OCPPGetConfigurationCommandResult, OCPPGetDiagnosticsCommandParam, OCPPGetDiagnosticsCommandResult, OCPPRemoteStartStopStatus, OCPPRemoteStartTransactionCommandParam, OCPPRemoteStartTransactionCommandResult, OCPPRemoteStopTransactionCommandParam, OCPPRemoteStopTransactionCommandResult, OCPPResetCommandParam, OCPPResetCommandResult, OCPPResetStatus, OCPPSetChargingProfileCommandParam, OCPPSetChargingProfileCommandResult, OCPPUnlockConnectorCommandParam, OCPPUnlockConnectorCommandResult, OCPPUnlockStatus, OCPPUpdateFirmwareCommandParam } from '../../types/ocpp/OCPPClient';
import { OCPPAvailabilityStatus, OCPPChangeAvailabilityCommandParam, OCPPChangeAvailabilityCommandResult, OCPPChangeConfigurationCommandParam, OCPPChangeConfigurationCommandResult, OCPPChargingProfileStatus, OCPPClearCacheCommandResult, OCPPClearCacheStatus, OCPPClearChargingProfileCommandParam, OCPPClearChargingProfileCommandResult, OCPPClearChargingProfileStatus, OCPPConfigurationStatus, OCPPDataTransferCommandParam, OCPPDataTransferCommandResult, OCPPGetCompositeScheduleCommandParam, OCPPGetCompositeScheduleCommandResult, OCPPGetCompositeScheduleStatus, OCPPGetConfigurationCommandParam, OCPPGetConfigurationCommandResult, OCPPGetDiagnosticsCommandParam, OCPPGetDiagnosticsCommandResult, OCPPRemoteStartStopStatus, OCPPRemoteStartTransactionCommandParam, OCPPRemoteStartTransactionCommandResult, OCPPRemoteStopTransactionCommandParam, OCPPRemoteStopTransactionCommandResult, OCPPResetCommandParam, OCPPResetCommandResult, OCPPResetStatus, OCPPSetChargingProfileCommandParam, OCPPSetChargingProfileCommandResult, OCPPUnlockConnectorCommandParam, OCPPUnlockConnectorCommandResult, OCPPUnlockStatus, OCPPUpdateFirmwareCommandParam } from '../../types/ocpp/OCPPClient';

import ChargingStation from '../../types/ChargingStation';
import ChargingStationClient from '../ocpp/ChargingStationClient';
Expand Down Expand Up @@ -96,4 +96,9 @@ export default class OCPIChargingStationClient extends ChargingStationClient {
}

async updateFirmware(params: OCPPUpdateFirmwareCommandParam): Promise<void> { }

// eslint-disable-next-line @typescript-eslint/require-await
public async triggerDataTransfer(params: OCPPDataTransferCommandParam): Promise<OCPPDataTransferCommandResult> {
throw new Error('Method not implemented.');
}
}
4 changes: 3 additions & 1 deletion src/client/ocpp/ChargingStationClient.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { OCPPChangeAvailabilityCommandParam, OCPPChangeAvailabilityCommandResult, OCPPChangeConfigurationCommandParam, OCPPChangeConfigurationCommandResult, OCPPClearCacheCommandResult, OCPPClearChargingProfileCommandParam, OCPPClearChargingProfileCommandResult, OCPPGetCompositeScheduleCommandParam, OCPPGetCompositeScheduleCommandResult, OCPPGetConfigurationCommandParam, OCPPGetConfigurationCommandResult, OCPPGetDiagnosticsCommandParam, OCPPGetDiagnosticsCommandResult, OCPPRemoteStartTransactionCommandParam, OCPPRemoteStartTransactionCommandResult, OCPPRemoteStopTransactionCommandParam, OCPPRemoteStopTransactionCommandResult, OCPPResetCommandParam, OCPPResetCommandResult, OCPPSetChargingProfileCommandParam, OCPPSetChargingProfileCommandResult, OCPPUnlockConnectorCommandParam, OCPPUnlockConnectorCommandResult, OCPPUpdateFirmwareCommandParam } from '../../types/ocpp/OCPPClient';
import { OCPPChangeAvailabilityCommandParam, OCPPChangeAvailabilityCommandResult, OCPPChangeConfigurationCommandParam, OCPPChangeConfigurationCommandResult, OCPPClearCacheCommandResult, OCPPClearChargingProfileCommandParam, OCPPClearChargingProfileCommandResult, OCPPDataTransferCommandParam, OCPPDataTransferCommandResult, OCPPGetCompositeScheduleCommandParam, OCPPGetCompositeScheduleCommandResult, OCPPGetConfigurationCommandParam, OCPPGetConfigurationCommandResult, OCPPGetDiagnosticsCommandParam, OCPPGetDiagnosticsCommandResult, OCPPRemoteStartTransactionCommandParam, OCPPRemoteStartTransactionCommandResult, OCPPRemoteStopTransactionCommandParam, OCPPRemoteStopTransactionCommandResult, OCPPResetCommandParam, OCPPResetCommandResult, OCPPSetChargingProfileCommandParam, OCPPSetChargingProfileCommandResult, OCPPUnlockConnectorCommandParam, OCPPUnlockConnectorCommandResult, OCPPUpdateFirmwareCommandParam } from '../../types/ocpp/OCPPClient';

export default abstract class ChargingStationClient {
public abstract reset(params: OCPPResetCommandParam): Promise<OCPPResetCommandResult>;

public abstract clearCache(): Promise<OCPPClearCacheCommandResult>;

public abstract triggerDataTransfer(params: OCPPDataTransferCommandParam): Promise<OCPPDataTransferCommandResult>;

public abstract getConfiguration(params: OCPPGetConfigurationCommandParam): Promise<OCPPGetConfigurationCommandResult>;

public abstract changeConfiguration(params: OCPPChangeConfigurationCommandParam): Promise<OCPPChangeConfigurationCommandResult>;
Expand Down
6 changes: 5 additions & 1 deletion src/client/ocpp/json/JsonChargingStationClient.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { OCPPChangeAvailabilityCommandParam, OCPPChangeAvailabilityCommandResult, OCPPChangeConfigurationCommandParam, OCPPChangeConfigurationCommandResult, OCPPClearCacheCommandResult, OCPPClearChargingProfileCommandParam, OCPPClearChargingProfileCommandResult, OCPPGetCompositeScheduleCommandParam, OCPPGetCompositeScheduleCommandResult, OCPPGetConfigurationCommandParam, OCPPGetConfigurationCommandResult, OCPPGetDiagnosticsCommandParam, OCPPGetDiagnosticsCommandResult, OCPPRemoteStartTransactionCommandParam, OCPPRemoteStartTransactionCommandResult, OCPPRemoteStopTransactionCommandParam, OCPPRemoteStopTransactionCommandResult, OCPPResetCommandParam, OCPPResetCommandResult, OCPPSetChargingProfileCommandParam, OCPPSetChargingProfileCommandResult, OCPPUnlockConnectorCommandParam, OCPPUnlockConnectorCommandResult, OCPPUpdateFirmwareCommandParam } from '../../../types/ocpp/OCPPClient';
import { OCPPChangeAvailabilityCommandParam, OCPPChangeAvailabilityCommandResult, OCPPChangeConfigurationCommandParam, OCPPChangeConfigurationCommandResult, OCPPClearCacheCommandResult, OCPPClearChargingProfileCommandParam, OCPPClearChargingProfileCommandResult, OCPPDataTransferCommandParam, OCPPDataTransferCommandResult, OCPPGetCompositeScheduleCommandParam, OCPPGetCompositeScheduleCommandResult, OCPPGetConfigurationCommandParam, OCPPGetConfigurationCommandResult, OCPPGetDiagnosticsCommandParam, OCPPGetDiagnosticsCommandResult, OCPPRemoteStartTransactionCommandParam, OCPPRemoteStartTransactionCommandResult, OCPPRemoteStopTransactionCommandParam, OCPPRemoteStopTransactionCommandResult, OCPPResetCommandParam, OCPPResetCommandResult, OCPPSetChargingProfileCommandParam, OCPPSetChargingProfileCommandResult, OCPPUnlockConnectorCommandParam, OCPPUnlockConnectorCommandResult, OCPPUpdateFirmwareCommandParam } from '../../../types/ocpp/OCPPClient';

import ChargingStationClient from '../../ocpp/ChargingStationClient';
import { Command } from '../../../types/ChargingStation';
Expand Down Expand Up @@ -78,6 +78,10 @@ export default class JsonChargingStationClient extends ChargingStationClient {
return this.sendMessage(params, Command.UPDATE_FIRMWARE);
}

public async triggerDataTransfer(params: OCPPDataTransferCommandParam): Promise<OCPPDataTransferCommandResult> {
return this.sendMessage(params, Command.TRIGGER_DATA_TRANSFER);
}

private async sendMessage(params: any, commandName: Command): Promise<any> {
// Log
await Logging.logChargingStationClientSendAction(MODULE_NAME, this.tenantID, this.chargingStationID, `ChargingStation${commandName}` as ServerAction, params);
Expand Down
Loading

0 comments on commit 4d133b4

Please sign in to comment.