# OBU node

This is the version matching the final requirements where the client are started from the policy executor

## Running the code using Docker

1. To create the Docker Image, run "Dockerfile" using this command: `docker build -f Dockerfile -t client-image .`
2. Create a container from the above image using this command: `docker run -p 8080:8080 -p 5000:5000 -p 80:80 -e SERVER_IP_FLWR={server_ip_port_flwr} -e PARAMETER_IP=1 -e SERVER_IP_AGG={server_ip_port_agg} -e CLIENT_ID={client_id} --name client --rm client-image` (More notes below)
3. The script for the clients will run automatically. The clients assume the server is ready to accept the connection (which is the scenario to expect given no error happens on the server side), otherwise the clients will fail to establish the connection and stop the execution.

* **Notes**:
- `{server_ip_port_flwr}`is the IP address and port number used for the flower framework (port 8080 in tests) and `{server_ip_port_agg}` are the ip address and port used to communicated with the DMLO (port 5000 in tests), they should both be of the form `192.168.0.1:5000`.
- `{client_id}` is the ID to assign the specific client (each client should have a unique ID)
- The `-p` flag is used to map the docker ports to the devices ports and should be changed according to the ports used in the simulation (currently set to ports 8080 and 5000).
- The `-e` flag is used to set the variables used to run the script automatically.
- The execution can be stopped by opening another terminal and using this command `docker kill client`.
