Skip to content

Commit

Permalink
Bug/hours class properties (#31)
Browse files Browse the repository at this point in the history
* Merged in develop (pull request #52)

Merging develop into master for 1.1.1 release

* Merged in release/1.1.1 (pull request #51)

Bumping version to 1.1.1

Signed-off-by: John Henderson <[email protected]>

Approved-by: Arzon Barua

* Merged in master (pull request #50)

Merging master into develop

Approved-by: Arzon Barua

* Merged in bug/party-search-query (pull request #47)

* Adding filter for deleted parties to PlannedPartySearch

Signed-off-by: John Henderson <[email protected]>

Approved-by: Arzon Barua

* Warn rather than thrown an exception when healthCheck() is called and a non 200 status code is returned.

* Bumping version number for 1.1.2 release

Signed-off-by: John Henderson <[email protected]>

* changed hours properties to array and update openapi spec

* Merged in develop (pull request #52)

Merging develop into master for 1.1.1 release

* Merged in release/1.1.1 (pull request #51)

Bumping version to 1.1.1

Signed-off-by: John Henderson <[email protected]>

Approved-by: Arzon Barua

* Merged in master (pull request #50)

Merging master into develop

Approved-by: Arzon Barua

* Merged in bug/party-search-query (pull request #47)

* Adding filter for deleted parties to PlannedPartySearch

Signed-off-by: John Henderson <[email protected]>

Approved-by: Arzon Barua

* Warn rather than thrown an exception when healthCheck() is called and a non 200 status code is returned.

---------

Signed-off-by: John Henderson <[email protected]>
Co-authored-by: John Henderson <[email protected]>
Co-authored-by: Jon Hill <[email protected]>
Co-authored-by: Adam Staveley <[email protected]>
  • Loading branch information
4 people authored Aug 12, 2024
1 parent 72c8f17 commit 2c379f7
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 52 deletions.
10 changes: 5 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,26 @@ Fixes bug with deleted parties being communicated as having a "planned" status (

Fixes bug with handling request body when forwarding custom OCPI module requests.

## 1.1.0-rc1
## 1.1.0-rc1
### Jun 30, 2020

Adds the ability for requests to be forwarded to "Ocn Services" with matching permissions. The
Ocn ServiceInterface, using the new Permissions contract in the OCN Registry, allows data to be
shared and accessed using a permission system.

## 1.1.0-rc0
## 1.1.0-rc0
### Apr 28, 2020

Includes initial hubclientinfo OCPI module implementation.
- Optional "Still-Alive" check requests connected parties versions endpoint at regular intervals.
- Optional "Planned Party" search scans registry for newly planned parties at regular intervals.
- New configuration properties under `ocn.node`: `stillAliveEnabled`, `stillAliveRate`,
- New configuration properties under `ocn.node`: `stillAliveEnabled`, `stillAliveRate`,
`plannedPartySearchEnabled`, `plannedPartySearchRate`.

## 1.0.0
### Mar 03, 2020

Initial release of the Open Charging Network Node.
- All OCPI modules included, except for hubclientinfo.
- Custom OCPI module, *OcnRules*, for setting counter-party whitelist rules.
- Administrator API for generating TOKEN_A for planned parties.
- Administrator API for generating TOKEN_A for planned parties.
76 changes: 38 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,72 +1,72 @@
# Open Charging Network Node

The Open Charging Network (OCN) node with Open Charge Point Interface (OCPI) v2.2 API.
The Open Charging Network (OCN) node with Open Charge Point Interface (OCPI) v2.2 API.

This is a community project, aimed at incorporating and building on the open OCPI standard. As with OCPI, contributions
are welcome in the form of comments, pull requests and raised issues. Visit our
[issue tracker](https://bitbucket.org/shareandcharge/ocn-node/issues) for an overview of current and past issues.
Questions may also be asked on [Stack Overflow](https://stackoverflow.com/questions/tagged/shareandcharge), or in the
[Slack community](https://app.slack.com/client/T0BNK39NX/CRP0VKEMD).
This is a community project, aimed at incorporating and building on the open OCPI standard. As with OCPI, contributions
are welcome in the form of comments, pull requests and raised issues. Visit our
[issue tracker](https://bitbucket.org/shareandcharge/ocn-node/issues) for an overview of current and past issues.
Questions may also be asked on [Stack Overflow](https://stackoverflow.com/questions/tagged/shareandcharge), or in the
[Slack community](https://app.slack.com/client/T0BNK39NX/CRP0VKEMD).

Before contributing to the source code, please take the time to read over the
[Developer Certificate of Origin](https://developercertificate.org/). For more information, see our
Before contributing to the source code, please take the time to read over the
[Developer Certificate of Origin](https://developercertificate.org/). For more information, see our
[contributing guidelines](https://shareandcharge.atlassian.net/wiki/spaces/OCN/pages/360611849/Contributing+to+the+Open+Charging+Network).

## The Open Charging Network

The OCN is a decentralized eRoaming hub. To participate in the OCN, a node must be used to broker OCPI requests
(e.g. start/stop charging requests, POI data retrieval) between parties. A node can be set up and run by anyone, however
to connect to a node, two steps are needed:
(e.g. start/stop charging requests, POI data retrieval) between parties. A node can be set up and run by anyone, however
to connect to a node, two steps are needed:

1. A registration token (so-called Token A in OCPI terminology) must be generated for the prospective platform by the
1. A registration token (so-called Token A in OCPI terminology) must be generated for the prospective platform by the
node administrator.
2. The platform must register themselves in the [OCN Registry](https://bitbucket.org/shareandcharge/ocn-registry),
2. The platform must register themselves in the [OCN Registry](https://bitbucket.org/shareandcharge/ocn-registry),
stating that they are using that particular node.

Once a registration token is obtained and the platform is listed in the registry, the OCPI credentials handshake with
the OCN Node can be initiated, providing access to all OCPI modules and interfaces used for peer-to-peer
communication. When a counter-party is found (either offline or via the registry), requests are sent to
Once a registration token is obtained and the platform is listed in the registry, the OCPI credentials handshake with
the OCN Node can be initiated, providing access to all OCPI modules and interfaces used for peer-to-peer
communication. When a counter-party is found (either offline or via the registry), requests are sent to
them via the sender's OCN Node.

For more information about the OCN, check out the [wiki](https://shareandcharge.atlassian.net/wiki/spaces/OCN/pages/409731085/Getting+started).

## HTTP API Documentation

The [HTTP API Documentation](https://shareandcharge.bitbucket.io) for the OCN Node describes endpoints which can be used
The [HTTP API Documentation](https://shareandcharge.bitbucket.io) for the OCN Node describes endpoints which can be used
by administrators and users (OCPI parties). Outside of the full OCPI v2.2 API, OCN Nodes provide additional features,
such as the custom OCPI module, _OcnRules_, as well as ways for admins to restrict use and users to query the OCN Registry.

## Dependencies

The OCN Node is built with Kotlin, targeting the JVM. See the sections on running and building a node for
The OCN Node is built with Kotlin, targeting the JVM. See the sections on running and building a node for
further details.

The choice of operating system is up to the administrator. By and large, the OCN Node has been developed and run on
Unix-like operating systems, particularly Ubuntu and Fedora. There is currently no guarantee that it will work on other
operating systems.
Unix-like operating systems, particularly Ubuntu and Fedora. There is currently no guarantee that it will work on other
operating systems.


## Tutorial: Running your own Local Open Charging Network

Before running a node and connecting it to a local, test or prod environment, it is recommended to first become
acquainted with how the network operates.
A [tutorial](https://bitbucket.org/shareandcharge/ocn-demo) has been provided to guide administrators and users
Before running a node and connecting it to a local, test or prod environment, it is recommended to first become
acquainted with how the network operates.
A [tutorial](https://bitbucket.org/shareandcharge/ocn-demo) has been provided to guide administrators and users
of an OCN Node alike through various use case examples.

## Running a Node

First of all, ensure a [Java Runtime Environment](https://openjdk.java.net/install/) (at least version 8) is installed.
First of all, ensure a [Java Runtime Environment](https://openjdk.java.net/install/) (at least version 8) is installed.
For example, via the Ubuntu package manager:
```
sudo apt install openjdk-8-jre
```

Pre-built OCN Node packages can be found on the repository's
Pre-built OCN Node packages can be found on the repository's
[downloads page](https://bitbucket.org/shareandcharge/ocn-node/downloads/). For the rest of this section
it will be assumed that this was the method chosen by the user. For information about building the node,
see the subsequent section that follows.

Once downloaded, extract the contents of the archive and change directory:
Once downloaded, extract the contents of the archive and change directory:
```
tar zxvf ocn-node-1.1.2.tar.gz
cd ocn-node-1.1-2
Expand All @@ -79,9 +79,9 @@ java -jar ocn-node-1.1.2.jar

### Configuration

By default the OCN Node will use the `dev` profile's runtime properties. These are specified in
`application.dev.properties`. This can be used to get a node up and running and connected to the
OCN public test environment right away.
By default the OCN Node will use the `dev` profile's runtime properties. These are specified in
`application.dev.properties`. This can be used to get a node up and running and connected to the
OCN public test environment right away.

However, sooner or later it is likely that configuration options must be changed to match the environment.
For example, to configure our local development environment correctly, we might wish to create a new profile
Expand All @@ -93,15 +93,15 @@ To do so, we can make a copy of the `dev` profile, naming it however we so desir
cp application.dev.properties application.custom-local-env.properties
```

We can then edit our `custom-local-env` properties file to point to the local blockchain node.
We can then edit our `custom-local-env` properties file to point to the local blockchain node.

If we wish to setup the node for a production environment, an example `prod` profile has been provided too:

```
cp application.prod.properties application.custom-prod-env.properties
```

For details on all available configuration values, please visit our comprehensive
For details on all available configuration values, please visit our comprehensive
[OCN Node Configuration documentation](./CONFIGURATION.md).


Expand All @@ -115,13 +115,13 @@ and follow the instructions in the README, or install the NPM package:
npm i -g @shareandcharge/ocn-registry
```

Once installed, add your OCN Node url using the private key as set in the node's configuration (note that the wallet
Once installed, add your OCN Node url using the private key as set in the node's configuration (note that the wallet
key must be funded and the correct network chosen using the `-n` flag:
```
ocn-registry set-node https://ocn.server.net -n prod -s 0x1c3e5453c0f9aa74a8eb0216310b2b013f017813a648fce364bf41dbc0b37647
```

Alternatively, to register a node on the public test environment, use `-n volta`.
Alternatively, to register a node on the public test environment, use `-n volta`.

If successful the node is now available for prospective platforms to link themselves to in the OCN Registry.

Expand Down Expand Up @@ -159,7 +159,7 @@ User=ubuntu
WorkingDirectory=/home/ubuntu/ocn-node-1.1.2
ExecStart=/usr/bin/java -jar -Dspring.config.location=application.custom-prod-env.properties ocn-node-1.1.0.jar
```

Then, copy the service file to the `/etc/systemd/system` directory:
```
sudo cp ocn-node.service /etc/systemd/system
Expand All @@ -179,8 +179,8 @@ journalctl -fu ocn-node -n 1000

## Development

To be able to build the project, the [Java Development Kit](https://openjdk.java.net/install/) is required.
Make sure at least version 8 is installed and you have the JDK, not only the JRE.
To be able to build the project, the [Java Development Kit](https://openjdk.java.net/install/) is required.
Make sure at least version 8 is installed and you have the JDK, not only the JRE.

Gradle tasks are configured in `build.gradle.kts` using the Kotlin DSL. The project can be built with:
```
Expand All @@ -195,7 +195,7 @@ Gradle tasks are configured in `build.gradle.kts` using the Kotlin DSL. The proj

### Run integration tests

Integration tests depend on `ganache-cli`, a local development blockchain, which is installed using NPM. In one terminal
Integration tests depend on `ganache-cli`, a local development blockchain, which is installed using NPM. In one terminal
window, run the following task, which will attempt to install ganache if not already present and then run it:
```
./gradlew ganache
Expand Down Expand Up @@ -226,5 +226,5 @@ Make sure the project has been built already, then run:

### Generating new API documentation

Documentation is generated automatically on build. The asciidoc template can be found in
`src/docs/asciidoc/index.adoc` and the output in `build/asciidoc/html5/index.html`.
Documentation is generated automatically on build. The asciidoc template can be found in
`src/docs/asciidoc/index.adoc` and the output in `build/asciidoc/html5/index.html`.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,4 @@ tasks.register<Tar>("archive") {
"CHANGELOG.md")
}

}
}
2 changes: 1 addition & 1 deletion examples/openapi-spec.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion infra/ocn-node.service
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ ExecStart=/usr/bin/java -jar -Dspring.config.location=application.dev.properties
Restart=on-failure

[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class Verification(private val properties: NodeProperties) {
companion object {
private val logger = LoggerFactory.getLogger(Verification::class.java)
}

@EventListener(ApplicationReadyEvent::class)
fun testRegistry() {
if (properties.privateKey == null) {
Expand Down Expand Up @@ -82,4 +81,4 @@ class Verification(private val properties: NodeProperties) {
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ data class AdditionalGeoLocation(@JsonProperty("latitude") val latitude: String,

@JsonInclude(JsonInclude.Include.NON_NULL)
data class Hours(@JsonProperty("twentyfourseven") val twentyfourseven: Boolean,
@JsonProperty("regular_hours") val regularHours: RegularHours? = null,
@JsonProperty("exceptional_openings") val exceptionalOpenings: ExceptionalPeriod? = null,
@JsonProperty("exceptional_closings") val exceptionalClosings: ExceptionalPeriod? = null)
@JsonProperty("regular_hours") val regularHours: List<RegularHours>? = null,
@JsonProperty("exceptional_openings") val exceptionalOpenings: List<ExceptionalPeriod>? = null,
@JsonProperty("exceptional_closings") val exceptionalClosings: List<ExceptionalPeriod>? = null)

data class RegularHours(@JsonProperty("weekday") val weekday: Int,
@JsonProperty("period_begin") val periodBegin: String,
Expand Down Expand Up @@ -253,4 +253,4 @@ enum class ParkingType {
ON_DRIVEWAY,
ON_STREET,
UNDERGROUND_GARAGE
}
}

0 comments on commit 2c379f7

Please sign in to comment.