GithubHelp home page GithubHelp logo

sap-labs-france / ev-server Goto Github PK

View Code? Open in Web Editor NEW
142.0 142.0 131.0 47.66 MB

The Open e-Mobility Charging Station management backend server (check also ev-dashboard and ev-mobile)

Home Page: https://open-e-mobility.fr/

License: Apache License 2.0

JavaScript 0.41% Dockerfile 0.06% Shell 0.17% HTML 0.75% Makefile 0.12% TypeScript 98.49% Procfile 0.01% Batchfile 0.01%
charge-point-operation e-mobility mobility-operation

ev-server's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ev-server's Issues

requestGetConfiguration called without params

in ChargingStation.js, the function requestGetConfiguration is called without providing params.

Running OCPPSoap15Test.js will pass but if you check the logs you can see:

{ source: undefined,
  module: undefined,
  method: undefined,
  action: 'RequestConfiguration',
  message: 'Cannot destructure property `keys` of \'undefined\' or \'null\'.',
  detailedMessages: 
   [ { stack: 'TypeError: Cannot destructure property `keys` of \'undefined\' or \'null\'.\n    at SoapChargingStationClient.getConfiguration (/Users/i058319/devel/ev/ev-server/src/client/soap/SoapChargingStationClient.js:236:22)\n    at ChargingStation.requestGetConfiguration (/Users/i058319/devel/ev/ev-server/src/model/ChargingStation.js:1357:46)\n    at <anonymous>\n    at process._tickCallback (internal/process/next_tick.js:189:7)' } ],
  type: 'S',
  level: 'E',
  timestamp: 2018-10-29T15:21:32.066Z }

impossible to update a user

when updating a user from the UI, the server always return an error mentioning that the phone is not valid. But the phone is valid. the regex checking it is not correct.

Create Variant Management

Implement new Variant management in the backend.

New collection in DB: variants
View ID (Logs, Chargers...)
User ID (optionel)
List of variants
Variant Name
List filters
Filter ID
Filter content

Not defined parameters in ChargingStation

Found by eslint

C:\SAPDevelop\gitwork\chargeangels\ev-server\src\entity\ChargingStation.js
788:5 warning 'timeDiffDuration' is never reassigned. Use 'const' instead prefer-const
793:5 warning 'dateTimeString' is never reassigned. Use 'const' instead prefer-const
1483:82 error 'key' is not defined no-undef
1483:100 error 'value' is not defined no-undef

throw new BackendError(this.getID(), Cannot set the configuration param ${key} with value ${value} to ${this.getID()}, "ChargingStation", "requestChangeConfiguration")

This code is not correctly called in ChargingStationService line 427 with two parameters instead of one
result = await chargingStation.requestChangeConfiguration('maxintensitysocket', filteredRequest.maxIntensity);

provide docker environment

For now, to run the ev-server, we need mongo installed and also a local mailserver available.

In order to ease this process and have the same environment for all developers we could use docker.

It should:

  • start a pre-configured database with users and passwords
  • start a mail server to receive notifications

Status:

  • docker database
  • docker mail server
  • provide default config file explained in readme.md
  • provide simple script to start/stop/reset the docker env explained in readme.md

Auto activation of user account

Today new users are activated by an Admin during registration.
This process has to be done automatically via Auto Activation of email account.

Invalid ChargeBoxID returned in transaction

During a transaction, the returned ChargeBoxID is not the same as the one sent. In fact, it is an hexadecimal string representing it.

ChargeBoxID sent JX5HM5JMDHS9 to start a new transaction.
ChargeBoxID received 4a5835484d354a4d44485339 when reading the transaction from the server.

Delete response contains the last created/updated ID

To reproduce:

  • run the test 'Should delete site which will delete the site area' in CompanySiteSiteAreaTest and observe the response data of a delete operation.

The issue is located here
Object.assign(Constants.REST_RESPONSE_SUCCESS, {id: newSite.getID()})

Documentation of the assign method:

/**
* Copy the values of all of the enumerable own properties from one or more source objects to a
* target object. Returns the target object.
* @param target The target object to copy to.
* @param source The source object from which to copy properties.
*/
assign<T, U>(target: T, source: U): T & U;

Possible fix:
Object.assign({id: newSite.getID()}, Constants.REST_RESPONSE_SUCCESS)

{
  "method": "POST",
  "url": "/client/api/SiteAreaCreate",
  "data": {
    "siteID": "5bd08640f2244f598431c7fb",
    "name": "Dare LLC",
    "accessControl": true
  },
  "baseURL": "http://127.0.0.1:8082"
}
{
  "status": 200,
  "statusText": "OK",
  "data": {
    "status": "Success",
    "id": "5bd08640f2244f598431c7fd"
  }
}
{
  "method": "DELETE",
  "url": "/client/api/SiteDelete",
  "params": {
    "ID": "5bd08640f2244f598431c7fb"
  },
  "baseURL": "http://127.0.0.1:8082"
}
{
  "status": 200,
  "statusText": "OK",
  "data": {
    "status": "Success",
    "id": "5bd08640f2244f598431c7fd"
  }
}

Authorizations.switchTraceOn() is not a function

When I enabled the debug mode in config.json (Authorization) I got the error below;
After checking the code, unfortunately the method does not exist in branch master

{
    "_id" : ObjectId("5bbfb0d3d17f541a17019e5b"),
    "level" : "E",
    "source" : "Central Server",
    "type" : "S",
    "module" : null,
    "method" : null,
    "timestamp" : ISODate("2018-10-11T20:21:39.145Z"),
    "action" : "User",
    "message" : "Authorizations.switchTraceOn is not a function",
    "detailedMessages" : "[{\"stack\":\"TypeError: Authorizations.switchTraceOn is not a function\\n    at Function.canPerformAction (/home/mobile/Documents/charge-angel/ev-server/src/authorization/Authorizations.js:660:19)\\n    at Function.canReadUser (/home/mobile/Documents/charge-angel/ev-server/src/authorization/Authorizations.js:412:25)\\n    at Function.handleGetUser (/home/mobile/Documents/charge-angel/ev-server/src/server/front-end/service/UserService.js:362:24)\\n    at process._tickCallback (internal/process/next_tick.js:68:7)\"}]",
    "userID" : null,
    "actionOnUserID" : null
}

Impossible to create new Site

Description

impossible to create a new Site.

trace:

Company is not defined
at Function.company (/Users/i058319/devel/ev/ev-server/dist/webpack:/src/server/front-end/service/SiteService.js:211:1)
at SiteService (/Users/i058319/devel/ev/ev-server/dist/webpack:/src/server/front-end/CentralRestServerService.js:95:1)
at Layer.handle [as handle_request] (/Users/i058319/devel/ev/ev-server/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/Users/i058319/devel/ev/ev-server/node_modules/express/lib/router/index.js:317:13)
at /Users/i058319/devel/ev/ev-server/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/Users/i058319/devel/ev/ev-server/node_modules/express/lib/router/index.js:335:12)
at next (/Users/i058319/devel/ev/ev-server/node_modules/express/lib/router/index.js:275:10)
at complete (/Users/i058319/devel/ev/ev-server/node_modules/passport/lib/middleware/authenticate.js:263:13)
at /Users/i058319/devel/ev/ev-server/node_modules/passport/lib/middleware/authenticate.js:270:15
at pass (/Users/i058319/devel/ev/ev-server/node_modules/passport/lib/authenticator.js:431:14)

The SiteService does not import the Company class.

ConnectorId 0 within handleStatusNotification

It is possible that the station sends a message with a connectorId = 0.
According to the standard it represents information about the charge point main controller.
Not sure what it means and how it should be handle. Anywa yit currently creates an error due to the fact that we try to access the array with connectorId-1.

Allow to apply a configuration template to a charging station newly connected to a tenant.

During a load test against a tenant made with ev-simulator, unknown users and charging stations try to begin a charging session. To do so, users and charging station need to be manually 'attached' to the tenant.

  • For users, we can enable a tunable that will add any new user to the tenant as valid;
  • For charging stations, we need to have the same feature that will apply a configuration to each new station connected to avoid having to do manual configuration for load tests.

Circular dependencies prevents starting a transaction

Issue Description

When running Transaction_test.js, the server failed with the following stacktrace:

TypeError: Site.getSite is not a function
    at SiteArea.getSite (/Users/i058319/devel/ev/ev-server/src/model/SiteArea.js:93:26)
    at Function.checkAndGetIfUserIsAuthorizedForChargingStation (/Users/i058319/devel/ev/ev-server/src/authorization/Authorizations.js:210:29)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Inspection

It appears that a cross dependency between Site and SiteArea forbids to use Site class inside SiteArea.
This issue is also present between the classes Site and User.

Security: Invalidate the token when user profile/component are changed

Scenario
On a enlevé le badge ID de Patrice pendant qu’il affichait le détail d’une borne.
Dans ce cas, on trigger un isAuthorize() dans le backend avec le badgeID qui est dans le token.
Comme le badge n’est plus dans la base ca va créer un ‘User Unknown’.

Solution
Il faut invalider le token d’un user à chaque fois qu’il est modifié par un admin.

Construire un hash qui serait dans le token et qui serait une concaténation des champs présents dans le profil du user (last update) et des components activés (Pricing...)
Si une de ces valeurs change on invalide le token cote backend.
Il faudrait donc une méthode qui construit ce hash et une autre qui le check de manière central a chaque requete qui requiert d'etre loggé.

Remove check tenant API

Remove also the entry in the Rest API, the views (Tenant not found) and clean up the related components (guards...)

Login screen on the wrong tenant should return the message of the wrong login ('Wrong email or password') but should be logged correctly in the master tenant's logging ('User with email 'xyz' tried to log in with an unknown tenant 'xyz'!)

Implement OCPP16-J

Implement server/charger communication over WebSocket and using JSON message format

new model of transactions ?

Could you let me know if a new transaction model has been introduced since d825e2b. After merging master branch, all my tests failed due to differences between expectations and actual transaction after getting them:

Before:

      {
        connectorId: connectorId,
        tagID: context.user.tagIDs[0],
        chargeBoxID: context.chargeBoxIdentity,
        chargeBox: {
          id: context.chargeBoxIdentity,
          connectors: [
            {
              activeTransactionID: transactionId,
              connectorId: connectorId,
              currentConsumption: 0,
              totalConsumption: 0,
              status: 'Available',
              errorCode: 'NoError',
              info: null,
              vendorErrorCode: null
            }
          ]
        }
      }

Now:

      {
        connectorId: connectorId,
        tagID: context.user.tagIDs[0],
        chargeBoxID: context.chargeBoxIdentity,
        id: transactionId,
        timestamp: currentTime.toISOString(),
        "user": {
          "firstName": context.user.firstName,
          "id": context.user.id,
          "name": context.user.name,
        }
      }

@LucasBrazi06, Is it a new model expected or is there an issue there ?

Implement Tenant

As discussed the whole topic below:

  • Add Super Admin (Type='S')
  • Add Namespace authorization (only SA can manage namespace)
  • Create Namespace view (List/Create/Edit/Delete) in the new dashboard
  • Use sub-domain to identify the namespace
  • Add namespace in login's token
  • Implement namespace in backend (get it from token and pass it up to the DB + prefix the collections)
  • Change URL of the charger to point to the right namespace
  • Migration / Switch to namespace
  • Doc to create a new namespace (Wiki? / Readme.md?)

Perfs: Tests with 100, 1000, 10000, 100000 Charging Stations

  • Goal is to provide a report that we can show to the customers that contains:
  • Charger Connections with 100, 1000, 10000, 100000 (at once)
  • Charger Transactions with 100, 1000, 10000, 100000

Monitor the traffic/cpu/mem for each topic and generate charts so we can compare each load.

You can create a dedicated tenant in production so we can test real perfs and also the UI with this amount of data.

Try also to provide when creating the chargers, valid GPS coordinates so we can show them in SAC

Crash > Starting the backend on an empty database trigger a TypeError

(node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:1) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'hasOwnProperty' of undefined
    at Function._0x44d47c (/usr/app/dist/webpack:/src/utils/Logging.js:390:1)
    at Function.logInfo (/usr/app/dist/webpack:/src/utils/Logging.js:137:1)
    at Function.migrate (/usr/app/dist/webpack:/src/migration/MigrationHandler.js:23:1)
    at Function.start (/usr/app/dist/webpack:/src/start.js:63:1)
    at process._tickCallback (internal/process/next_tick.js:68:7)

To reproduce, just create a docker image of the backend.

Support multiple values in query parameters

In order to retrieve the logs from multiple users, the server must support query parameters with multi values. Several options are available:

  • Support operators like in, eq, gt, lt, ge, le (like userId=in(123,345))
  • Use a filter query param to support extended search (and, or) (like filter=(user eq 123 and site eq Caen) or (site eq Mougin)
  • Support the same query parameter several times (like userId=123&userId=456)
    ...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.