From bb155b37f90a34902c80061a9c337ed8a7597b35 Mon Sep 17 00:00:00 2001 From: Ulf Wiger Date: Wed, 27 Jan 2016 16:28:46 +0100 Subject: ongoing update of docs to 0.5.0 --- BUILD.md | 77 ++++++++++++--------- CONFIGURE.md | 196 +++++++++++++++++++++++++++++++++++++++++----------- doc/rvi_protocol.md | 6 +- 3 files changed, 203 insertions(+), 76 deletions(-) diff --git a/BUILD.md b/BUILD.md index 9d7be37..87ac02a 100644 --- a/BUILD.md +++ b/BUILD.md @@ -1,19 +1,19 @@ -Copyright (C) 2014-2015, Jaguar Land Rover +Copyright (C) 2014-2016, Jaguar Land Rover This document is licensed under Creative Commons Attribution-ShareAlike 4.0 International. -**Version 0.4.0** +**Version 0.5.0** # BUILD INSTRUCTIONS FOR RVI # This document describes the build process for the RVI project on an -Ubuntu 14.01 Linux machine. +Ubuntu 14.04 Linux machine. Please see ```README.md``` for a general description of the project and its structure. -Please see ```CONFIGURE.md``` for details on cofniguring and launching +Please see ```CONFIGURE.md``` for details on configuring and launching the system once it has been built. The first milestone of the RVI project is the HVAC demo. Please see @@ -31,7 +31,7 @@ Please note that the configuraiton process, described in # PREREQUISITES # -1. The Ubuntu 14.01 system have the latest updates installed. +1. The Ubuntu 14.04 system have the latest updates installed. 2. The user can gain root access to install packages. 3. There is at least 5GB of space availabled for packages and code. @@ -46,8 +46,17 @@ Grade Linux repositories where the code resides: ## INSTALL ERLANG ## -Install Erlang R16B03, or a later R16 release: +Install Erlang 18.2, or a later version 18 release: +Tested packages of the latest versions of Erlang can be downloaded from [packages.erlang-solutions.com](https://www.erlang-solutions.com/resources/download.html) + +Add the following line to your /etc/apt/sources.list + + deb http://packages.erlang-solutions.com/ubuntu trusty contrib + +Update and install erlang + + sudo apt-get update sudo apt-get install erlang @@ -60,18 +69,13 @@ to the build system. The clone will be downloaded into a newly created ```rvi_core``` subdirectory. +## BUILD THE RVI SYSTEM ## -## RETRIEVE ADDITIONAL CODE DEPENDENCIES ## - -Move into the newly created ```rvi_core``` directory where the code resides. - - cd rvi_core +Run ```make``` to build the dependency code in ```deps``` and the +top level project in the ```rvi``` directory. -Run ```make deps``` to pull all necessary repositories into the ```deps``` -subdirectory under the ```rvi``` directory: + make compile - make deps - The local ```rebar``` command is used to retrieve the dependencies. See ```rebar.config``` and ```deps/*/rebar.config``` for a list of dependencies. @@ -79,25 +83,34 @@ dependencies. See the [rebar](https://github.com/basho/rebar) project for a detailed description of the rebar Erlang build tool. - -## BUILD THE RVI SYSTEM ## - -Run ```make``` to build the dependency code in ```deps``` and the -top level project in the ```rvi``` directory. - - make compile - -The following warnings are expected, and are not a failure indication: - - .../exo_ssh.erl:18: Warning: undefined callback function code_change/3 (behaviour 'ssh_channel') - ... - .../bert_challenge.erl:223: Warning: crypto:sha/1 is deprecated and will be removed in in a future release; use crypto:hash/2 - ... - .../bert_challenge.erl:230: Warning: crypto:sha/1 is deprecated and will be removed in in a future release; use crypto:hash/2 + Expected output: + $ make + ./rebar get-deps + ==> goldrush (get-deps) + ==> lager (get-deps) + ==> src (get-deps) + ==> ale (get-deps) + ==> src (get-deps) + ... + ./rebar compile + ==> goldrush (compile) + Compiled src/glc.erl + Compiled src/glc_lib.erl + Compiled src/glc_code.erl ... - .../authorize_rpc.erl:31: Warning: function get_certificate_body/2 is unused + /.../rvi_core/deps/exo/src/exo_ssh.erl:18: Warning: undefined callback function code_change/3 (behaviour 'ssh_channel') + /.../rvi_core/deps/exo/src/exo_ssh.erl:18: Warning: undefined callback function handle_call/3 (behaviour 'ssh_channel') + ... + cp deps/setup/setup_gen scripts/ + (cd components/authorize && make escript) + ERL_LIBS=/.../rvi_core/components/authorize/..:/..../jlr/rvi_core/components/authorize/../../deps ./rebar escriptize + ==> authorize (escriptize) + cp components/authorize/author scripts/ + $ + +Some warnings are expected, and are usually not a failure indication: -The compiled code is available under ```ebin/``` and ```deps/*/ebin```. +The compiled code is available under ```ebin/```, ```components/*/ebin``` and ```deps/*/ebin```. ## CREATE A RELEASE ## diff --git a/CONFIGURE.md b/CONFIGURE.md index 7fe95c5..1b848a5 100644 --- a/CONFIGURE.md +++ b/CONFIGURE.md @@ -1,9 +1,9 @@ -Copyright (C) 2014-2015, Jaguar Land Rover +Copyright (C) 2014-2016, Jaguar Land Rover This document is licensed under Creative Commons Attribution-ShareAlike 4.0 International. -**Version 0.4.0** +**Version 0.5.0** # CONFIGURING AN RVI NODE @@ -22,7 +22,7 @@ The reader is assumed to be able to: ## PREREQUISITES -1. Erlang runtime R16B03 or later has to be installed on the hosting system. +1. Erlang runtime 18.2 or later has to be installed on the hosting system. 2. The ```setup_rvi_node.sh``` tool is available to build a release. 3. ```rvi_sample.config``` is used as a starting point for a customized setup. Root access is not needed. @@ -38,32 +38,31 @@ steps must be taken. This node will handle traffic to all services that start with the given prefix. -2. Specify RVI node external address
-The external address is announced by the Data Link component to other -RVI nodes, allowing them to connect to this node and exchange -services. +2. Provide paths to keys, certificates and service credentials
+RVI Core uses X.509 keys certificates for authentication, and credentials +specifying which services can be registered and invoked. -2. Configure static nodes
+3. Configure static nodes
Backend / Cloud-based RVI nodes have non-changing network addresses that should be known by other nodes in a network. This is acheived by setting up service prefixes and addresses of the static nodes in all other nodes deployed in a network. -3. Specify Service Edge URL that local services connect to
+4. Specify Service Edge URL that local services connect to
The Service Edge URL is used by local services to send traffic that is to be forwarded to services on the local and remote nodes. -4. Specify URLs for RVI components
+5. Specify URLs for RVI components
In addition to the Service Edge URL, the remaining components must have their URLs configured so that the components can locate each other and exchange commands. -5. Build the development release
-The ```setup_rvi_node.sh``` is executed to read the configuration file +6. Build the development release
+The ```setup_rvi_node.sh``` script is executed to read the configuration file and generate a development or production release. -6. Start the release
-The ```rvi_node.sh``` is executed to launch the built development +7. Start the release
+The ```rvi_node.sh``` script is executed to launch the built development release. ```$REL_HOME/rvi/bin/rvi start``` is used to launch the production release. @@ -72,7 +71,7 @@ production release. There is a single configuration file, with the setup for all components and modules in the node, used for each release. -A documented example file is provided as ```rvi_sample.config``` +A documented example file is provided as ```priv/config/rvi_sample.config``` The configuration file consists of an array of erlang tuples (records / structs / entries), where the ```env``` tuple contains configuration data for @@ -82,7 +81,104 @@ the lager logging system, only the ```rvi``` tuple needs to be edited. The term tuple and entry will be intermixed throughout this document. +### Erlang terms + +For a full description of Erlang types, read [the Erlang Reference Manual](http://erlang.org/doc/reference_manual/users_guide.html). The following is a brief summary: + +* Tuples, written as ```{ Elem1, ..., ElemN }``` are like arrays whose elements are accessed by position. +* Lists, written as ```[ Elem1, ..., ElemN ]``` are linked lists whose elements are accessed by iterating from the beginning of the list. Another notation is ```[ Head | Tail ]```. Strings are actually lists of integers, and ```"RVI"``` is equivalent to ```[82,86,73]```, or ```[$R,$V,$I]```. +* Numbers, e.g. ```17```, ```1.44```, ```2#101``` (binary notation), ```16#5A``` (hex notation). +* Atoms, names starting with a lowercase letter or enclosed in single quotes, are essentially labels. +* Variable names start with an uppercase letter. + +### Setup config files + +RVI Core uses the [setup](https://github.com/uwiger/setup) tool to build from configuration files. + +The files used by ```setup``` are evaluated using the [file:script/1](http://erlang.org/doc/man/file.html#script-1) function, meaning that the file can contain a sequence of executable Erlang expressions, each terminated with a full stop (```.```). Anything starting with ```%``` and to the end of the line +constitutes a comment. + +Example from ```rvi_core/priv/config/rvi_sample.config```: + + Env = fun(V, Def) -> + case os:getenv(V) of + false -> Def; + Str when is_integer(Def) -> list_to_integer(Str); + Str when is_atom(Def) -> list_to_atom(Str); + Str -> Str + end + end. + IPPort = fun(IP, Port) -> + IP ++ ":" ++ integer_to_list(Port) + end. + MyPort = Env("RVI_PORT", 9000). + MyIP = Env("RVI_MYIP", "127.0.0.1"). + MyNodeAddr = Env("RVI_MY_NODE_ADDR", IPPort(MyIP, MyPort)). + BackendIP = Env("RVI_BACKEND", "38.129.64.31"). + BackendPort = Env("RVI_BACKEND_PORT", 8807). + LogLevel = Env("RVI_LOGLEVEL", notice). + +The above defines two function objects used to check for the existence of a given OS environment variable, and using the corresponding value, or else using a default value. For example, the variable ```MyPort``` is set to either the value of ```RVI_PORT``` or else to ```9000```. These variables are used further down in the configuration file. + +The ```setup``` utility is called when the ```rvi.sh``` script is run. To e.g. enable debug logging, you can do the following: + + $ RVI_LOGLEVEL=debug rvi.sh ... + +```Setup``` expects certain configuration entries, e.g. ```{apps, [App1, ...]}```, ```{env, [{App, [{Key, Val}, ...]}, ...]}```. Most of the configuration work for RVI is done in ```{env, ...}```. + +It is possible to include existing configuration files and then modifying the result. For example, the ```rvi_sample.config``` file includes ```rvi_core/priv/config/rvi_common.config``` via the following line: + + {include_lib, "rvi_core/priv/config/rvi_common.config"}, + +Includes can be used at several levels. For example, ```priv/test_config/basic_backend.config``` includes ```priv/test_config/backend.config```, which in its turn includes ```priv/config/backend.config```, which, finally, includes ```priv/config/rvi_common.config```. + +Other examples can be found in ```rvi_core/priv/test_config/```, where configurations used by the test suite are located: + + {ok, CurDir} = file:get_cwd(). + [ + {include_lib, "rvi_core/priv/test_config/backend.config"}, + {remove_apps, [bt, dlink_bt]}, + {set_env, + [{rvi_core, + [ + {[components, data_link, dlink_tcp_rpc, server_opts, ping_interval], 500} + ]} + ]} + ]. + +The ```set_env``` instruction specifically takes a list of ```{App, [{Key, Value}]}``` tuples, where the ```Key``` is either an atom or list of atoms, the latter indicating an entry in a 'tree' of entries. In the example above, the tree would look like: + + {rvi_core, + [ + ... + {components, + [ + ... + {data_link, + [ + ... + {dlink_tcp_rpc, + [ + ... + {server_opts, + [ + ... + {ping_interval, 500} + ]} + ]} + ]} + ]} + ]} + +If the entry in question exists in the tree, it will be modified; if not, it will be added. + +For more details about what can be done with ```setup```, see (the setup_gen manual)[https://github.com/uwiger/setup/blob/master/doc/setup_gen.md]. + ## CONFIGURATION FILE VALUE SUBSITUTION +Some forms of substitution are supported by ```setup```, see (the docs on variable expansion)[https://github.com/uwiger/setup/blob/master/doc/setup.md#Variable_expansion]. + +RVI Core supports some additional substitution of its own. All substitution is done automatically when RVI starts, so the running applications see the final results of the substitutions. + All string values under the rvi tuple tree are scanned for specific dokens during startup. If a token is found, it will be replaced with a value referenced by it. @@ -192,23 +288,30 @@ An example entry is given below: ] +#PROVIDE PATHS TO KEYS, CERTIFICATES AND SERVICE CREDENTIALS -# SPECIFY RVI NODE EXTERNAL ADDRESS # +The following settings are required for the RVI Core authentication framework: -The external rvi node address is the address, as seen from the outside -world, where this node's data link can be contacted. In IP based -networks, this is usually a ```hostname:port``` value. In SMS-only -networks, this will be the MSISDN of the node's mobile subscription. -Any traffic directed to the given address should be forwarded to the -Data Link component. +* `{device_key, DevKeyFile}` +* `{provisioning_key, ProvKeyFile}` +* `{root_cert, RootCertFile}` +* `{device_cert, DevCertFile}` +* `{cred_dir, CredDirectory}` -If the node lives behind a firewall, or should for some reason not -accept incoming connections from other nodes, the node external address -should be set to ```"0.0.0.0:0"```. +The [doc/rvi_protocol.md](doc/rvi_protocol.md) document explains the authentication +protocol and how to create the necessary keys and certificates. -The configuration element to set under the ```rvi``` tuple is ```node_address```. +Note that the `cred_dir` option needs to be a directory. RVI Core will pick up +any valid credentials present in that directory. + +Default values - the sample keys and certs used in `rvi_protocol.md` - are +specified in [rvi_common.config](priv/doc/rvi_common.config). +The defaults should *only* be used for testing and demos - never for live use. + +#CONFIGURE DATA LINK LAYERS + +The ```data_link``` components are specified as ```{Module, Type, Options}```, e.g. -An example tuple is given below:
 [
   ...
@@ -216,23 +319,32 @@ An example tuple is given below:
     ...
     { rvi_core, [
       ...
-      { node_address, "92.52.72.132:8817 }
-    ]}
-  ]}
-] 
+      { components, [
+        ...
+        { dlink_tls_rpc, gen_server, [ ... ] }
+       ] }
+     ] }
+   ] }
+]
 
-*Please note that IP addresses, not DNS names, should be used in all - network addresses.* +In the data link component, ```dlink_tls_rpc```, you can specify the following options: -In the data link component, ```dllink_tcp_rpc```, you also -need to specify the port it should listen to, and optionally also the -interface to use. + { server_opts, Opts } -This is done by editing the tuple ```rvi_core -> data_link -> dlink_tcp_rpc```, and -set ```port``` to the port that traffic is recevied on. -An example tuple is given below: +These are options for the TLS listener and subsequent connections: + +* `{port, Port}` - which port to listen to +* `{ip, Address}` - optionally specifies which interface to listen to +* `{max_msg_size, Sz}` - maximum fragment size (see [doc/rvi_protocol.md](doc/rvi_protocol.md#chunking-of-large-messages) for details +* `{reliable, true | false}` - if `max_msg_size` isn't specified, this will enable reliable transmission using the fragmentation protocol. + + { persistent_connections, Addresses } +`Addresses` is a list of IP:Port strings signifying other RVI nodes to connect to. The connection- +and fragmentation-related options above will also be applied to these connections. + +An example tuple is given below:
 [
@@ -245,10 +357,12 @@ An example tuple is given below:
         ...
         { data_link, [ 
          ...
-	     { dlink_tcp_rpc, gen_server,
+	     { dlink_tls_rpc, gen_server,
 	      [ 
 	        ...
-            { server_opts, [ { ip, "192.168.11.234"}, { port, 8807 }]},
+            { server_opts, [ { ip, "192.168.11.234"},
+                                { port, 8807 },
+                                { max_msg_size, 1024 } ]},
             { persistent_connections, [ "38.129.64.13:8807" ]}
 	      ]
 	    }]
diff --git a/doc/rvi_protocol.md b/doc/rvi_protocol.md
index 68cb818..fc0a2f8 100644
--- a/doc/rvi_protocol.md
+++ b/doc/rvi_protocol.md
@@ -15,7 +15,7 @@ This document describes the core protocol between two RVI nodes.
 [6] X.509 Certificates - (link)[https://en.wikipedia.org/wiki/X.509]
# FEATURES COVERED BY PROTOCOL -1. **Authroization**
+1. **Authorization**
Prove to the remote RVI node that the local RVI node has the right to invoke a set of services, and the right to register another set of services. @@ -257,7 +257,7 @@ openssl genrsa -out insecure_root_key.pem 1024 openssl req -x509 -new -nodes -key insecure_root_key.pem -days 365 -out insecure_root_cert.crt ``` -The content of the sample ```insercure_root_key.pem``` private key +The content of the sample ```insecure_root_key.pem``` private key file, which has no password protection, is: ``` @@ -328,7 +328,7 @@ openssl x509 -req -days 365 -in insecure_device_cert.csr \ The ```insecure_device_cert.csr``` intermediate certificate signing request can be deleted once the three steps above have been executed. -The content of the sample ```insercure_device_key.pem``` private key +The content of the sample ```insecure_device_key.pem``` private key file, which has no password protection, is: ``` -- cgit v1.2.1 From a4be6f9a8451b22fe3fead90c67c45cbb7fa50a2 Mon Sep 17 00:00:00 2001 From: Ulf Wiger Date: Fri, 29 Jan 2016 20:18:41 +0100 Subject: moved files to subdirs, w.i.p. on fragmentation --- CONFIGURE.md | 10 +-- doc/images/frag-overview.png | Bin 0 -> 63851 bytes doc/images/rvi_protocol_double_connect1.png | Bin 0 -> 8253 bytes doc/images/rvi_protocol_double_connect2.png | Bin 0 -> 8286 bytes doc/images/rvi_protocol_flow.png | Bin 0 -> 33520 bytes doc/images/rvi_protocol_frag1.png | Bin 0 -> 16359 bytes doc/images/rvi_protocol_stack.png | Bin 0 -> 12693 bytes doc/images/rvi_protocol_x509_credential.png | Bin 0 -> 17933 bytes doc/images/rvi_protocol_x509_pub_key.png | Bin 0 -> 17539 bytes doc/msc/rvi_protocol_double_connect1.msc | 23 ++++++ doc/msc/rvi_protocol_double_connect2.msc | 10 +++ doc/msc/rvi_protocol_flow.msc | 32 ++++++++ doc/msc/rvi_protocol_frag1.msc | 23 ++++++ doc/rvi_fragmentation.md | 122 ++++++++++++++++++++++++++++ doc/rvi_protocol.md | 12 +-- doc/rvi_protocol_double_connect1.msc | 23 ------ doc/rvi_protocol_double_connect1.png | Bin 8253 -> 0 bytes doc/rvi_protocol_double_connect2.msc | 10 --- doc/rvi_protocol_double_connect2.png | Bin 8286 -> 0 bytes doc/rvi_protocol_flow.msc | 32 -------- doc/rvi_protocol_flow.png | Bin 33520 -> 0 bytes doc/rvi_protocol_frag1.msc | 23 ------ doc/rvi_protocol_frag1.png | Bin 16359 -> 0 bytes doc/rvi_protocol_stack.png | Bin 12693 -> 0 bytes doc/rvi_protocol_x509_credential.png | Bin 17933 -> 0 bytes doc/rvi_protocol_x509_pub_key.png | Bin 17539 -> 0 bytes 26 files changed, 221 insertions(+), 99 deletions(-) create mode 100644 doc/images/frag-overview.png create mode 100644 doc/images/rvi_protocol_double_connect1.png create mode 100644 doc/images/rvi_protocol_double_connect2.png create mode 100644 doc/images/rvi_protocol_flow.png create mode 100644 doc/images/rvi_protocol_frag1.png create mode 100644 doc/images/rvi_protocol_stack.png create mode 100644 doc/images/rvi_protocol_x509_credential.png create mode 100644 doc/images/rvi_protocol_x509_pub_key.png create mode 100644 doc/msc/rvi_protocol_double_connect1.msc create mode 100644 doc/msc/rvi_protocol_double_connect2.msc create mode 100644 doc/msc/rvi_protocol_flow.msc create mode 100644 doc/msc/rvi_protocol_frag1.msc create mode 100644 doc/rvi_fragmentation.md delete mode 100644 doc/rvi_protocol_double_connect1.msc delete mode 100644 doc/rvi_protocol_double_connect1.png delete mode 100644 doc/rvi_protocol_double_connect2.msc delete mode 100644 doc/rvi_protocol_double_connect2.png delete mode 100644 doc/rvi_protocol_flow.msc delete mode 100644 doc/rvi_protocol_flow.png delete mode 100644 doc/rvi_protocol_frag1.msc delete mode 100644 doc/rvi_protocol_frag1.png delete mode 100644 doc/rvi_protocol_stack.png delete mode 100644 doc/rvi_protocol_x509_credential.png delete mode 100644 doc/rvi_protocol_x509_pub_key.png diff --git a/CONFIGURE.md b/CONFIGURE.md index 1b848a5..9364ba3 100644 --- a/CONFIGURE.md +++ b/CONFIGURE.md @@ -596,23 +596,23 @@ external node address chapter: Communication between the RVi components can be either JSON-RPC or Erlang-internal gen\_server calls. - -JSON-RPC calls provide compatability with replacement components + +JSON-RPC calls provide compatibility with replacement components written in languages other than Erlang. gen\_server calls provide native erlang inter-process calls that are signficantly faster than JSON-RPC when transmitting large data volumes. - + If one or more of the RVI components are replaced with external components, use JSON-RPC by ```json_rpc_address``` for all components. - + If an all-native erlang system is configured, use gen\_server calls by configuring ```gen_server```. If both ```gen_server``` and ```json_rpc_address``` are specified, the gen\_server communicaiton path will be used for inter component communication. - + Please note that communication between two RVI nodes are not affected by this since data_link_bert_rpc will use the protocol and data links specified by the matching routing rule to communicate. See diff --git a/doc/images/frag-overview.png b/doc/images/frag-overview.png new file mode 100644 index 0000000..ad866c4 Binary files /dev/null and b/doc/images/frag-overview.png differ diff --git a/doc/images/rvi_protocol_double_connect1.png b/doc/images/rvi_protocol_double_connect1.png new file mode 100644 index 0000000..21ad892 Binary files /dev/null and b/doc/images/rvi_protocol_double_connect1.png differ diff --git a/doc/images/rvi_protocol_double_connect2.png b/doc/images/rvi_protocol_double_connect2.png new file mode 100644 index 0000000..d14f92d Binary files /dev/null and b/doc/images/rvi_protocol_double_connect2.png differ diff --git a/doc/images/rvi_protocol_flow.png b/doc/images/rvi_protocol_flow.png new file mode 100644 index 0000000..eb06363 Binary files /dev/null and b/doc/images/rvi_protocol_flow.png differ diff --git a/doc/images/rvi_protocol_frag1.png b/doc/images/rvi_protocol_frag1.png new file mode 100644 index 0000000..aedb46e Binary files /dev/null and b/doc/images/rvi_protocol_frag1.png differ diff --git a/doc/images/rvi_protocol_stack.png b/doc/images/rvi_protocol_stack.png new file mode 100644 index 0000000..043beaa Binary files /dev/null and b/doc/images/rvi_protocol_stack.png differ diff --git a/doc/images/rvi_protocol_x509_credential.png b/doc/images/rvi_protocol_x509_credential.png new file mode 100644 index 0000000..d63bb24 Binary files /dev/null and b/doc/images/rvi_protocol_x509_credential.png differ diff --git a/doc/images/rvi_protocol_x509_pub_key.png b/doc/images/rvi_protocol_x509_pub_key.png new file mode 100644 index 0000000..f685ad7 Binary files /dev/null and b/doc/images/rvi_protocol_x509_pub_key.png differ diff --git a/doc/msc/rvi_protocol_double_connect1.msc b/doc/msc/rvi_protocol_double_connect1.msc new file mode 100644 index 0000000..eb22f83 --- /dev/null +++ b/doc/msc/rvi_protocol_double_connect1.msc @@ -0,0 +1,23 @@ +# +# +# Sequence diagram description +# +# The sequence diagram description below is translated to +# a PNG image by mscgen (http://www.mcternan.me.uk/mscgen/) +# +# Recompile updated diagrams to a png image with: +# +# mscgen -T png rvi_core_double_connect.msc +# + +msc { + width="400"; + "Client", "Server"; + "Client" -> "Server" [ label = "Connect" ]; + "Client" <-> "Server" [ label = "TLS Upgrade" ]; + "Client" -> "Server" [ label = "authorize(...)" ]; + "Client" <- "Server" [ label = "authorize(...)" ]; + "Client" abox "Server" [ label = "Race Condition" ] ; +} + + diff --git a/doc/msc/rvi_protocol_double_connect2.msc b/doc/msc/rvi_protocol_double_connect2.msc new file mode 100644 index 0000000..0240df5 --- /dev/null +++ b/doc/msc/rvi_protocol_double_connect2.msc @@ -0,0 +1,10 @@ +msc { + width="400"; + "Client", "Server"; + "Server" -> "Client" [ label = "Connect" ]; + "Server" <-> "Client" [ label = "TLS Upgrade" ]; + "Client" <- "Server" [ label = "authorize(...)" ]; + "Client" -> "Server" [ label = "authorize(...)" ]; + "Client" abox "Server" [ label = "Race Condition" ] ; +} + diff --git a/doc/msc/rvi_protocol_flow.msc b/doc/msc/rvi_protocol_flow.msc new file mode 100644 index 0000000..f4a84b3 --- /dev/null +++ b/doc/msc/rvi_protocol_flow.msc @@ -0,0 +1,32 @@ +# +# +# Sequence diagram description +# +# The sequence diagram description below is translated to +# a PNG image by mscgen (http://www.mcternan.me.uk/mscgen/) +# +# Recompile updated diagrams to a png image with: +# +# mscgen -T png swm.msc +# + +msc { + width="1024"; + "Client", "Server"; + "Client" -> "Server" [ label = "connect" ]; + "Client" -> "Server" [ label = "TLS Upgrade using X.509 certificates" ]; + "Client" -> "Server" [ label = "authorize( [JWT (credential, root_sign), ...] )" ]; + "Server" abox "Server" [ label = "Validate each credential using root public key" ] ; + "Client" <- "Server" [ label = "authorize( [JWT (credential, root_sign), ...] ) )" ]; + "Client" abox "Client" [ label = "Validate each crential using root public key" ] ; + + "Client" abox "Client" [ label = "Create list of services matching server credentials" ] ; + "Client" -> "Server" [ label = "service_announce( [service_name, ... ])" ]; + "Server" abox "Server" [ label = "Create list of services matching client credentials" ] ; + "Client" <- "Server" [ label = "service_announce( [service_name, ... ])" ]; + + "Client" -> "Server" [ label = "message( service_name, arguments)" ]; + + "Server" -> "Client" [ label = "message( service_name, arguments)" ]; +} + diff --git a/doc/msc/rvi_protocol_frag1.msc b/doc/msc/rvi_protocol_frag1.msc new file mode 100644 index 0000000..11d467f --- /dev/null +++ b/doc/msc/rvi_protocol_frag1.msc @@ -0,0 +1,23 @@ +# +# +# Sequence diagram description +# +# The sequence diagram description below is translated to +# a PNG image by mscgen (http://www.mcternan.me.uk/mscgen/) +# +# Recompile updated diagrams to a png image with: +# +# mscgen -T png rvi_protocol_frag1.msc +# + +msc { + width="400"; + "Client", "Server"; + "Client" -> "Server" [ label = "{frg, [ID, Size, Offs1, Bin1]}" ]; + "Client" <- "Server" [ label = "{frg-get, [ID, Offs2, Bytes2]}" ]; + "Client" -> "Server" [ label = "{frg, [ID, Size, Offs2, Bin2]}" ]; + "Client" <- "Server" [ label = "{frg-get, [ID, Offs3, Bytes3]}" ]; + "Client" -> "Server" [ label = "{frg, [ID, Size, Offs3, Bin3]}" ]; + "Client" <- "Server" [ label = "{frg-end, [ID, ResultCode]}" ]; + "Client" abox "Server" [ label = "Message complete" ] ; +} diff --git a/doc/rvi_fragmentation.md b/doc/rvi_fragmentation.md new file mode 100644 index 0000000..077cb49 --- /dev/null +++ b/doc/rvi_fragmentation.md @@ -0,0 +1,122 @@ +# The RVI Core Fragmentation Protocol + +## Abstract + +The Remote Vehicle Interaction (RVI) system is a framework for secure interaction between +vehicles and other devices and/or cloud services. RVI is designed to be agnostic in regard +to connectivity options and intermittent connectivity. One consequence of this is that +large messages may have to be partially transmitted via one type of connection, and completed +on another. The fragmentation protocol described below allows for varying Message Transfer +Unit (MTU) and lets the remote client request fragments as needed. + +## Status of This Memo + +This document is not an Internet Standards Track specification; it is +published for informational purposes. + +## Copyright Notice + +Copyright (C) 2016 Jaguar Land Rover + +This document is licensed under Creative Commons +Attribution-ShareAlike 4.0 International. + +## Table of Contents + +1. [Introduction](#introduction) +2. [Terminology](#terminology) +3. [System Overview](#system-overview) +4. [Notation](#notation) +5. [References](#references) + +## Introduction + + + +## Terminology + +Term | Meaning +----------|-------------------------------- +`Client` | Sending side of the interaction +`Server` | Receiving side of the interaction +`MTU` | Message Transfer Unit + +## System Overview + +The fragmentation support is intended to operate immediately on top of the transport +layer. In + +Overview + +## Notation + +The fragmentation protocol does not specify any particular encoding method. +In this document, JSON notation is used. In practice, a byte-oriented JSON-like +encoding, like msgpack [MSGP] would be more suitable. + +## Messages + +The fragment messages are deliberately compact, in order to steal as little of +the available transfer window from the fragment itself. + +**Fragment message:** + + { "frg": [ id, size, offset, fragment ] } + +The sending side initiates fragment transfer by sending a first fragment. The +size of the first fragment is determined by the sending side. Subsequent fragments +are requested by the receiver, in which case the receiver also decides how large +a fragment it wants. The sender is allowed to send a smaller fragment, but not +a larger one. + +Note that `size` denotes the size of the *whole* message, not the fragment. + +**Fragment request message:** + + { "frg-get": [ id, offset, size ] } + +This message is sent by the receiving side in order to request the next fragment. +The `offset` will typically be the position following the most recently received +fragment, but could also represent a "hole" in the message from a missing fragment. + +**Fragment acknowledgement message:** + + { "frg-end": [ id, result_code ] } + +**Fragment error message:** + + { "frg-err": [ id, result_code ] } + +`id` (string): Message identity. This value needs to be unique within the scope +of the current connection. + +`size` (integer): A positive integer denoting either the size of the whole message +(as in the `"frg"` message) or the size of the requested fragment (as in the `"frg-get"` +message). + +`offset` (integer): A positive integer denoting the starting byte of the fragment, +relative to the whole message. The first fragment starts at `1`. + +`fragment` (binary): A byte sequence denoting the current fragment. Note that the +`"frg"` message doesn't contain a size indicator for the fragment. However an +encoding such as [MSGP] does include a size indicator. + +`result_code` (integer): A number denoting the outcome of the transfer and reassembly. +A zero (`0`) means all went well; a negative number indicates failure. Predefined values +are: + +Code or range | Definition +--------------| ---------------------- +`0` | Message was successfully transfered and reassembled +`-99 ... -1` | Reserved for standard error codes +`-1` | Unknown message (i.e. in a `"frg-err"` response to a `"fgr-get"` message) +`-2` | Protocol error +`-3` | Timeout error +`< -99` | Application-defined error codes + +## References + +[RVI] Remote Vehicle Interaction (RVI) + https://github.com/PDXOstc/rvi_core +[MSGP] msgpack encoding + http://msgpack.org \ No newline at end of file diff --git a/doc/rvi_protocol.md b/doc/rvi_protocol.md index fc0a2f8..62765a3 100644 --- a/doc/rvi_protocol.md +++ b/doc/rvi_protocol.md @@ -1,4 +1,4 @@ -Copyright (C) 2015 Jaguar Land Rover +Copyright (C) 2015-16 Jaguar Land Rover This document is licensed under Creative Commons Attribution-ShareAlike 4.0 International. @@ -56,7 +56,7 @@ nodes once they have become aware of each other's presence. The stack schematics is shown below. -RVI Core protocol Stack +RVI Core protocol Stack ## RVI Core protocol codec The RVI core protocol uses MessagePack [3] as its @@ -94,7 +94,7 @@ RVI credentials. The figure below shows how this is done. -X.509 - RVI Protocol integration +X.509 - RVI Protocol integration ## JSON Web token usage JSON Web Tokens (JWT) [2] are used to encode RVI credentials, which are @@ -109,7 +109,7 @@ Please note that the protocol is fully symmetrical and that the client-server terminology only denotes who initiates the connection (client), and who receives that connection (server). -RVI Core protocol Sequence Diagram +RVI Core protocol Sequence Diagram ## Authorize command The ```authorize``` command contains a list of RVI credentials, each specifying @@ -138,7 +138,7 @@ shown below. Connection 1 | Connection 2 :------:|:------: -RVI Core protocol Double Connect | RVI Core protocol Double Connect +RVI Core protocol Double Connect | RVI Core protocol Double Connect A double connect can be detected by either side by checking if the remote peer address already has a connection established. @@ -181,7 +181,7 @@ fragmented. The protocol is as follows: -RVI Core fragmentation Sequence Diagram +RVI Core fragmentation Sequence Diagram ### Enabling fragmentation diff --git a/doc/rvi_protocol_double_connect1.msc b/doc/rvi_protocol_double_connect1.msc deleted file mode 100644 index eb22f83..0000000 --- a/doc/rvi_protocol_double_connect1.msc +++ /dev/null @@ -1,23 +0,0 @@ -# -# -# Sequence diagram description -# -# The sequence diagram description below is translated to -# a PNG image by mscgen (http://www.mcternan.me.uk/mscgen/) -# -# Recompile updated diagrams to a png image with: -# -# mscgen -T png rvi_core_double_connect.msc -# - -msc { - width="400"; - "Client", "Server"; - "Client" -> "Server" [ label = "Connect" ]; - "Client" <-> "Server" [ label = "TLS Upgrade" ]; - "Client" -> "Server" [ label = "authorize(...)" ]; - "Client" <- "Server" [ label = "authorize(...)" ]; - "Client" abox "Server" [ label = "Race Condition" ] ; -} - - diff --git a/doc/rvi_protocol_double_connect1.png b/doc/rvi_protocol_double_connect1.png deleted file mode 100644 index 21ad892..0000000 Binary files a/doc/rvi_protocol_double_connect1.png and /dev/null differ diff --git a/doc/rvi_protocol_double_connect2.msc b/doc/rvi_protocol_double_connect2.msc deleted file mode 100644 index 0240df5..0000000 --- a/doc/rvi_protocol_double_connect2.msc +++ /dev/null @@ -1,10 +0,0 @@ -msc { - width="400"; - "Client", "Server"; - "Server" -> "Client" [ label = "Connect" ]; - "Server" <-> "Client" [ label = "TLS Upgrade" ]; - "Client" <- "Server" [ label = "authorize(...)" ]; - "Client" -> "Server" [ label = "authorize(...)" ]; - "Client" abox "Server" [ label = "Race Condition" ] ; -} - diff --git a/doc/rvi_protocol_double_connect2.png b/doc/rvi_protocol_double_connect2.png deleted file mode 100644 index d14f92d..0000000 Binary files a/doc/rvi_protocol_double_connect2.png and /dev/null differ diff --git a/doc/rvi_protocol_flow.msc b/doc/rvi_protocol_flow.msc deleted file mode 100644 index f4a84b3..0000000 --- a/doc/rvi_protocol_flow.msc +++ /dev/null @@ -1,32 +0,0 @@ -# -# -# Sequence diagram description -# -# The sequence diagram description below is translated to -# a PNG image by mscgen (http://www.mcternan.me.uk/mscgen/) -# -# Recompile updated diagrams to a png image with: -# -# mscgen -T png swm.msc -# - -msc { - width="1024"; - "Client", "Server"; - "Client" -> "Server" [ label = "connect" ]; - "Client" -> "Server" [ label = "TLS Upgrade using X.509 certificates" ]; - "Client" -> "Server" [ label = "authorize( [JWT (credential, root_sign), ...] )" ]; - "Server" abox "Server" [ label = "Validate each credential using root public key" ] ; - "Client" <- "Server" [ label = "authorize( [JWT (credential, root_sign), ...] ) )" ]; - "Client" abox "Client" [ label = "Validate each crential using root public key" ] ; - - "Client" abox "Client" [ label = "Create list of services matching server credentials" ] ; - "Client" -> "Server" [ label = "service_announce( [service_name, ... ])" ]; - "Server" abox "Server" [ label = "Create list of services matching client credentials" ] ; - "Client" <- "Server" [ label = "service_announce( [service_name, ... ])" ]; - - "Client" -> "Server" [ label = "message( service_name, arguments)" ]; - - "Server" -> "Client" [ label = "message( service_name, arguments)" ]; -} - diff --git a/doc/rvi_protocol_flow.png b/doc/rvi_protocol_flow.png deleted file mode 100644 index eb06363..0000000 Binary files a/doc/rvi_protocol_flow.png and /dev/null differ diff --git a/doc/rvi_protocol_frag1.msc b/doc/rvi_protocol_frag1.msc deleted file mode 100644 index 11d467f..0000000 --- a/doc/rvi_protocol_frag1.msc +++ /dev/null @@ -1,23 +0,0 @@ -# -# -# Sequence diagram description -# -# The sequence diagram description below is translated to -# a PNG image by mscgen (http://www.mcternan.me.uk/mscgen/) -# -# Recompile updated diagrams to a png image with: -# -# mscgen -T png rvi_protocol_frag1.msc -# - -msc { - width="400"; - "Client", "Server"; - "Client" -> "Server" [ label = "{frg, [ID, Size, Offs1, Bin1]}" ]; - "Client" <- "Server" [ label = "{frg-get, [ID, Offs2, Bytes2]}" ]; - "Client" -> "Server" [ label = "{frg, [ID, Size, Offs2, Bin2]}" ]; - "Client" <- "Server" [ label = "{frg-get, [ID, Offs3, Bytes3]}" ]; - "Client" -> "Server" [ label = "{frg, [ID, Size, Offs3, Bin3]}" ]; - "Client" <- "Server" [ label = "{frg-end, [ID, ResultCode]}" ]; - "Client" abox "Server" [ label = "Message complete" ] ; -} diff --git a/doc/rvi_protocol_frag1.png b/doc/rvi_protocol_frag1.png deleted file mode 100644 index aedb46e..0000000 Binary files a/doc/rvi_protocol_frag1.png and /dev/null differ diff --git a/doc/rvi_protocol_stack.png b/doc/rvi_protocol_stack.png deleted file mode 100644 index 043beaa..0000000 Binary files a/doc/rvi_protocol_stack.png and /dev/null differ diff --git a/doc/rvi_protocol_x509_credential.png b/doc/rvi_protocol_x509_credential.png deleted file mode 100644 index d63bb24..0000000 Binary files a/doc/rvi_protocol_x509_credential.png and /dev/null differ diff --git a/doc/rvi_protocol_x509_pub_key.png b/doc/rvi_protocol_x509_pub_key.png deleted file mode 100644 index f685ad7..0000000 Binary files a/doc/rvi_protocol_x509_pub_key.png and /dev/null differ -- cgit v1.2.1 From 3d44dd4ca67427d859d65aec9c592cec3f67e921 Mon Sep 17 00:00:00 2001 From: Ulf Wiger Date: Sat, 30 Jan 2016 11:10:08 +0100 Subject: typo in rvi_fragmentation.md --- doc/rvi_fragmentation.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/doc/rvi_fragmentation.md b/doc/rvi_fragmentation.md index 077cb49..78362c9 100644 --- a/doc/rvi_fragmentation.md +++ b/doc/rvi_fragmentation.md @@ -44,10 +44,16 @@ Term | Meaning ## System Overview The fragmentation support is intended to operate immediately on top of the transport -layer. In +layer. In essence, the sending side (Client) asks the fragmentation support to +deliver a message. The fragmentation support determines whether fragmentation is +needed. If it is, it will create a first fragment, encode it and send it to the +receiving end (Server). Overview +The fragmentation support can operate over a transport using its own fragment/reassembly +method (such as TCP), but does not require it, or makes any such assumptions. + ## Notation The fragmentation protocol does not specify any particular encoding method. @@ -56,6 +62,8 @@ encoding, like msgpack [MSGP] would be more suitable. ## Messages + Date: Mon, 1 Feb 2016 10:44:52 -0800 Subject: [53177] Add missing installation steps & fix typos Add steps to install g++ and libbluetooth-dev (for BlueZ headers) Add step to resolve authentication error for Erlang install Correct typos --- BUILD.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/BUILD.md b/BUILD.md index 87ac02a..436d64c 100644 --- a/BUILD.md +++ b/BUILD.md @@ -26,7 +26,7 @@ In order to build the system, the reader is assumed to be able to: 1. Have a basic understanding of Linux system operations. 2. Install packages on the system. -Please note that the configuraiton process, described in +Please note that the configuration process described in ```CONFIGURE.md``` may have additional skill requirements. # PREREQUISITES # @@ -37,12 +37,16 @@ Please note that the configuraiton process, described in # INSTALLATION PROCESS # -## INSTALL GIT ## +## INSTALL DEVELOPMENT TOOLS ## Use ```apt-get``` to install git, which is used to access the Automotive Grade Linux repositories where the code resides: - sudo apt-get git + sudo apt-get install git + +Also ensure that you have the latest BlueZ Linux Bluetooth headers and that g++ is installed on your system: + + sudo apt-get install libbluetooth-dev g++ ## INSTALL ERLANG ## @@ -59,6 +63,11 @@ Update and install erlang sudo apt-get update sudo apt-get install erlang +**If you receive an authentication error** (such as NO_PUBKEY): note the hexadecimal value (e.g., 6D975C4791E7EE5E) and request the key: + + sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys HEXVALUE + +where HEXVALUE is the hexadecimal value specified in the error. Then rerun the ```update``` and ```install``` commands. ## CLONE THE RVI REPOSITORY ## -- cgit v1.2.1 From 030a31cd8717e8fc3376c42dd4bd088b4a117797 Mon Sep 17 00:00:00 2001 From: Ulf Wiger Date: Fri, 12 Feb 2016 11:15:59 -0800 Subject: Adapt test suite to new scripts, scripts more flexible, bt not default - rvi_install & rvi_ctl adapted so they can be run from different directories - ensure that RVI_LOGDIR is respected consistently - RVI_RUNDIR allows for specifying where the boot scripts are stored - bt apps excluded by default, can be put back in through config if needed --- deps/setup/src/setup_gen.erl | 11 +++- priv/config/add_bt_apps.config | 5 ++ priv/config/rvi_common.config | 10 +-- priv/test_config/backend.config | 20 +++--- priv/test_config/basic_backend.config | 1 - priv/test_config/basic_sample.config | 3 +- priv/test_config/bt_backend.config | 1 + priv/test_config/sample.config | 10 +-- scripts/rvi_ctl.template | 25 ++++--- scripts/rvi_install | 79 +++++++++++++--------- test/rvi_core_SUITE.erl | 119 +++++++++++++++++++--------------- 11 files changed, 163 insertions(+), 121 deletions(-) create mode 100644 priv/config/add_bt_apps.config diff --git a/deps/setup/src/setup_gen.erl b/deps/setup/src/setup_gen.erl index 7a74107..d33ccc7 100644 --- a/deps/setup/src/setup_gen.erl +++ b/deps/setup/src/setup_gen.erl @@ -83,7 +83,7 @@ help() -> %% option. %% * `{remove_apps, Apps}' - Remove `Apps' from the list of applications. %% * `{sort_app, App, Before}' - Change the sort order so that `App' comes -%% before `Before'. +%% before `Before'. `Before' can be either %% * `{include, ConfigFile}' - include options from the given file. The file %% is processed using `file:script/2'. %% * `{include_lib, ConfigFile}' - As above, but ConfigFile is named as with @@ -600,7 +600,8 @@ sort_apps(Options, Apps) -> lists:foldl(fun({sort_app, A, Before}, Acc) -> case is_in_set(A, Acc) of {true, App} -> - insert_before(Acc -- [App], App, Before); + insert_before(Acc -- [App], App, + mk_set(Before)); false -> abort("Cannot re-sort ~p - not found~n", [A]) end; @@ -636,6 +637,12 @@ del_from_set(As, Set) -> end end, Set, As). +%% ensure that this is a 'set' (well, at least a list) +mk_set(Set) when is_list(Set) -> + Set; +mk_set(Entry) -> + [Entry]. + is_in_set(Entry, Set) -> A = if is_tuple(Entry) -> element(1, Entry); is_atom(Entry) -> Entry diff --git a/priv/config/add_bt_apps.config b/priv/config/add_bt_apps.config new file mode 100644 index 0000000..9eb9c9b --- /dev/null +++ b/priv/config/add_bt_apps.config @@ -0,0 +1,5 @@ +%% -*- erlang -*- +[ + {add_apps, [bt, dlink_bt]}, + {sort_app, bt, rvi_core} %% start bt before rvi_core (not required) +]. diff --git a/priv/config/rvi_common.config b/priv/config/rvi_common.config index c8aa389..0b6cb8d 100644 --- a/priv/config/rvi_common.config +++ b/priv/config/rvi_common.config @@ -9,8 +9,6 @@ %% Configuration include file for rvi config files %% Out = filename:absname(proplists:get_value(outdir, OPTIONS)). -LagerRoot = Out ++ "/log/lager". -LagerDebugFmt = [time,"<",module,"/",line,">",message,"\n"]. %% Parameters for simpler modification Env = fun(V, Def) -> @@ -22,6 +20,9 @@ Env = fun(V, Def) -> end end. +LogDir = Env("RVI_LOGDIR", Out ++ "/log"). +LagerRoot = LogDir ++ "/lager". +LagerDebugFmt = [time,"<",module,"/",line,">",message,"\n"]. LogLevel = Env("RVI_LOGLEVEL", info). [ %% All erlang apps needed to fire up a node. Do not touch. @@ -63,11 +64,9 @@ LogLevel = Env("RVI_LOGLEVEL", info). service_edge, authorize, schedule, - bt, dlink, dlink_tcp, dlink_tls, - dlink_bt, dlink_sms, proto_bert, proto_json, @@ -80,7 +79,8 @@ LogLevel = Env("RVI_LOGLEVEL", info). [ {setup, [ - {home, Out} + {home, Out}, + {log_dir, LogDir} ]}, {lager, [ diff --git a/priv/test_config/backend.config b/priv/test_config/backend.config index 361b3da..106a1ba 100644 --- a/priv/test_config/backend.config +++ b/priv/test_config/backend.config @@ -1,14 +1,14 @@ %% -*- erlang -*- {ok, CurDir} = file:get_cwd(). [ - {include_lib, "rvi_core/priv/config/rvi_backend.config"}, - {set_env, - [ - {rvi_core, - [{device_key, "$HOME/../../basic_backend_keys/device_key.pem"}, - {root_cert, "$HOME/../../root_keys/root_cert.crt"}, - {device_cert, "$HOME/../../basic_backend_keys/device_cert.crt"}, - {cred_dir, "$HOME/../../basic_backend_creds"} - ]} - ]} + {include_lib, "rvi_core/priv/config/rvi_backend.config"} + %% {set_env, + %% [ + %% {rvi_core, + %% [{device_key, "$HOME/../../basic_backend_keys/device_key.pem"}, + %% {root_cert, "$HOME/../../root_keys/root_cert.crt"}, + %% {device_cert, "$HOME/../../basic_backend_keys/device_cert.crt"}, + %% {cred_dir, "$HOME/../../basic_backend_creds"} + %% ]} + %% ]} ]. diff --git a/priv/test_config/basic_backend.config b/priv/test_config/basic_backend.config index 0c6aaa6..8640d76 100644 --- a/priv/test_config/basic_backend.config +++ b/priv/test_config/basic_backend.config @@ -2,7 +2,6 @@ {ok, CurDir} = file:get_cwd(). [ {include_lib, "rvi_core/priv/test_config/backend.config"}, - {remove_apps, [bt, dlink_bt]}, {set_env, [{rvi_core, [ diff --git a/priv/test_config/basic_sample.config b/priv/test_config/basic_sample.config index 56f9a4c..794f3b2 100644 --- a/priv/test_config/basic_sample.config +++ b/priv/test_config/basic_sample.config @@ -1,6 +1,5 @@ %% -*- erlang -*- {ok, CurDir} = file:get_cwd(). [ - {include_lib, "rvi_core/priv/test_config/sample.config"}, - {remove_apps, [bt, dlink_bt]} + {include_lib, "rvi_core/priv/test_config/sample.config"} ]. diff --git a/priv/test_config/bt_backend.config b/priv/test_config/bt_backend.config index 45cc5db..cb665d1 100644 --- a/priv/test_config/bt_backend.config +++ b/priv/test_config/bt_backend.config @@ -1,6 +1,7 @@ %% -*- erlang -*- [ {include_lib, "rvi_core/priv/test_config/backend.config"}, + {include_lib, "rvi_core/priv/config/add_bt_apps.config"}, {remove_apps, [dlink_tcp, dlink_tls]}, {set_env, diff --git a/priv/test_config/sample.config b/priv/test_config/sample.config index ea84a30..3238563 100644 --- a/priv/test_config/sample.config +++ b/priv/test_config/sample.config @@ -6,11 +6,11 @@ [ {rvi_core, [ - {node_service_prefix, "jlr.com/vin/abc"}, - {device_key, "$HOME/../../basic_sample_keys/device_key.pem"}, - {root_cert, "$HOME/../../root_keys/root_cert.crt"}, - {device_cert, "$HOME/../../basic_sample_keys/device_cert.crt"}, - {cred_dir, "$HOME/../../basic_sample_creds"} + {node_service_prefix, "jlr.com/vin/abc"} + %% {device_key, "$HOME/../../basic_sample_keys/device_key.pem"}, + %% {root_cert, "$HOME/../../root_keys/root_cert.crt"}, + %% {device_cert, "$HOME/../../basic_sample_keys/device_cert.crt"}, + %% {cred_dir, "$HOME/../../basic_sample_creds"} ]} ]} ]. diff --git a/scripts/rvi_ctl.template b/scripts/rvi_ctl.template index dc8dd9e..c6c8875 100644 --- a/scripts/rvi_ctl.template +++ b/scripts/rvi_ctl.template @@ -2,7 +2,7 @@ # # -# Mozilla Public License, version 2.0. The full text of the +# Mozilla Public License, version 2.0. The full text of the # Mozilla Public License is at https://www.mozilla.org/MPL/2.0/ # # @@ -20,7 +20,7 @@ echo ${ERL:=erl} > /dev/null usage() { - echo "Usage: $0 -d config_dir [-c config_file] -l log_dir \\" + echo "Usage: $0 -d config_dir [-c config_file] -l log_dir \\" echo " start|stop|console|attach|ping" echo echo " -c config_file Configuration file to launch rvi node with." @@ -32,7 +32,7 @@ usage() { echo " stop Stop an rvi node previously started with 'start'." echo echo " console Start an rvi in foreground mode." - echo + echo echo " attach Attach to an rvi node previously started with 'start'." echo echo "Environennt variables. Default value in paranthesis::" @@ -42,7 +42,7 @@ usage() { } CONFIG_FILE="" -SNAME=rvi +SNAME="__RVI_NAME__" COOKIE=rvi_cookie while getopts "c:" o; do case "${o}" in @@ -93,15 +93,21 @@ then echo "${CONFIG_FILE} cannot be opened for reading." usage fi - # + # # Generate a config file that will end up as # /tmp/rvi/[cfg]/sys.config # ( - rm -rf ${RUNDIR} + if [ -z "${RVI_RUNDIR}" ] + then + RUNDIR="/tmp/rvi_${$}" + rm -rf ${RUNDIR} + else + RUNDIR=${RVI_RUNDIR} + fi install -d --mode=0755 ${RUNDIR} cd ${RUNDIR} - ${RVI_BINDIR}/setup_gen rvi ${CONFIG_FILE} rvi + RVI_LOGDIR="${RVI_LOGDIR}" ${RVI_BINDIR}/setup_gen rvi ${CONFIG_FILE} rvi ) # Did we succeed with config generation? @@ -133,9 +139,8 @@ case "${CMD}" in exec ${RBI_BINDIR}/nodetool -sname ${SNAME} -setcookie ${COOKIE} ping ;; - attach) + attach) exec to_erl ${RUNDIR} ;; -esac - +esac diff --git a/scripts/rvi_install b/scripts/rvi_install index ac128e5..0bcb045 100755 --- a/scripts/rvi_install +++ b/scripts/rvi_install @@ -3,7 +3,7 @@ # Copyright (C) 2014, Jaguar Land Rover # # This program is licensed under the terms and conditions of the -# Mozilla Public License, version 2.0. The full text of the +# Mozilla Public License, version 2.0. The full text of the # Mozilla Public License is at https://www.mozilla.org/MPL/2.0/ # @@ -12,36 +12,45 @@ # # -SELF_DIR=$(dirname $(readlink -f "$0")) +# fqn : fully qualified name (e.g. realpath, but portable) +fqn() +{ + echo $(cd $(dirname $1); pwd)/$(basename $1) +} + +SELF_DIR=$(dirname $(fqn "$0")) SETUP_GEN=$SELF_DIR/setup_gen # Ulf's kitchen sink setup utility +TOP_DIR=$(dirname $SELF_DIR) usage() { cat < /dev/null 2>&1 +rm -rf ${TARGET_DIR} > /dev/null 2>&1 # Create log dirs install -m 0755 -d ${TARGET_DIR} install -m 0755 -d ${LOG_DIR} +TARGET_DIR=$(fqn $TARGET_DIR) +LOG_DIR=$(fqn $LOG_DIR) + # Copy over the relevant files to the target -FILE_SET=$(find ebin components deps -name ebin -o -name priv) -tar cf - ${FILE_SET} | (cd ${TARGET_DIR} ; tar xf - ) +(cd $TOP_DIR; FILE_SET=$(find priv ebin components deps -name ebin -o -name priv); +tar cf - ${FILE_SET} | (cd ${TARGET_DIR} ; tar xf - )) # If we have a prefix strip (for build systems not using # chroot), apply it to paths. -if [ -s "${PREFIX_STRIP}" ] +if [ -s "${PREFIX_STRIP}" ] then STRIP_TARGET_DIR=$(echo ${TARGET_DIR} | sed "s|^${PREFIX_STRIP}||") STRIP_LOG_DIR=$(echo ${LOG_DIR} | sed "s|^${PREFIX_STRIP}||") @@ -290,7 +305,8 @@ fi # Patch rvi_ctl.template to set its ERL_LIBS path correctly. sed -e "s|__RVI_BINDIR__|${STRIP_TARGET_DIR}|g" \ - -e "s|__RVI_LOGDIR__|${STRIP_LOG_DIR}|g" < scripts/rvi_ctl.template > /tmp/rvi_ctl + -e "s|__RVI_LOGDIR__|${STRIP_LOG_DIR}|g" \ + -e "s|__RVI_NAME__|${NAME}|g" < $TOP_DIR/scripts/rvi_ctl.template > /tmp/rvi_ctl # Install all relevant scripts. install -m 0755 -d ${TARGET_DIR}/priv/certificates @@ -302,13 +318,13 @@ install -m 0644 ${DEVICE_KEY} ${TARGET_DIR}/priv/keys/device_key.pem install -m 0644 ${DEVICE_CRED} ${TARGET_DIR}/priv/credentials install -m 0755 /tmp/rvi_ctl ${TARGET_DIR} rm /tmp/rvi_ctl -install -m 0755 scripts/setup_gen ${TARGET_DIR} -install -m 0755 rel/files/nodetool ${TARGET_DIR} -install -m 0755 python/rvi_service.py ${TARGET_DIR}/rvi_service -install -m 0755 python/rvi_call.py ${TARGET_DIR}/rvi_call -install -m 0644 python/rvilib.py ${TARGET_DIR} -install -m 0755 python/rvi_get_services.py ${TARGET_DIR}/rvi_get_services -install -m 0755 -D priv/config/rvi_common.config ${TARGET_DIR}/priv/config/rvi_common.config +install -m 0755 $TOP_DIR/scripts/setup_gen ${TARGET_DIR} +install -m 0755 $TOP_DIR/rel/files/nodetool ${TARGET_DIR} +install -m 0755 $TOP_DIR/python/rvi_service.py ${TARGET_DIR}/rvi_service +install -m 0755 $TOP_DIR/python/rvi_call.py ${TARGET_DIR}/rvi_call +install -m 0644 $TOP_DIR/python/rvilib.py ${TARGET_DIR} +install -m 0755 $TOP_DIR/python/rvi_get_services.py ${TARGET_DIR}/rvi_get_services +install -m 0755 -D $TOP_DIR/priv/config/rvi_common.config ${TARGET_DIR}/priv/config/rvi_common.config echo "RVI binary files installed under ${TARGET_DIR}" echo "RVI will log to ${LOG_DIR}" @@ -319,4 +335,3 @@ echo "Stop: ${TARGET_DIR}/rvi_ctl stop" echo "Start console mode: ${TARGET_DIR}/rvi_ctl -c console" echo exit 0 - diff --git a/test/rvi_core_SUITE.erl b/test/rvi_core_SUITE.erl index c61e8ce..bd1a996 100644 --- a/test/rvi_core_SUITE.erl +++ b/test/rvi_core_SUITE.erl @@ -219,90 +219,86 @@ t_sample_keys_and_cert(Config) -> generate_sota_cred(sample, Dir, CredDir, Config). t_install_backend_node(_Config) -> - install_rvi_node("basic_backend", env(), - [root(), "/priv/test_config/basic_backend.config"]). + install_backend_node("basic_backend"). t_install_sample_node(_Config) -> - install_sample_node("basic_sample", "basic_sample.config"). + install_sample_node("basic_sample"). t_install_sms_backend_node(_Config) -> - install_rvi_node("sms_backend", env(), - [root(), "/priv/test_config/sms_backend.config"]). + install_backend_node("sms_backend"). t_install_sms_sample_node(_Config) -> - install_sample_node("sms_sample", "sms_sample.config"). + install_sample_node("sms_sample"). t_install_tls_backend_node(_Config) -> - install_rvi_node("tls_backend", env(), - [root(), "/priv/test_config/tls_backend.config"]). + install_backend_node("tls_backend"). t_install_tls_sample_node(_Config) -> - install_sample_node("tls_sample", "tls_sample.config"). + install_sample_node("tls_sample"). t_install_tlsj_backend_node(_Config) -> - install_rvi_node("tlsj_backend", env(), - [root(), "/priv/test_config/tlsj_backend.config"]). + install_backend_node("tlsj_backend"). t_install_tlsj_sample_node(_Config) -> - install_sample_node("tlsj_sample", "tlsj_sample.config"). + install_sample_node("tlsj_sample"). t_install_tls_backend_noverify_node(_Config) -> - install_rvi_node("tls_backend_noverify", env(), - [root(), "/priv/test_config/tls_backend_noverify.config"]). + install_backend_node("tls_backend_noverify"). t_install_tls_sample_noverify_node(_Config) -> - install_sample_node("tls_sample_noverify", "tls_sample_noverify.config"). + install_sample_node("tls_sample_noverify"). t_install_bt_backend_node(_Config) -> - install_rvi_node("bt_backend", env(), - [root(), "/priv/test_config/bt_backend.config"]). + install_backend_node("bt_backend"). t_install_bt_sample_node(_Config) -> - install_sample_node("bt_sample", "bt_sample.config"). + install_sample_node("bt_sample"). -generic_start(Name) -> +start_backend(Name) -> generic_start(backend, Name). +start_sample (Name) -> generic_start(sample , Name). + +generic_start(Type, Name) -> + {ok,Cwd} = file:get_cwd(), F = filename:join([".", Name, "start_me.sh"]), - Cmd = [env(), - " ./", Name, "/rvi.sh", - " -s ", Name, - " -l ./", Name, "/rvi/log", - " -d ./", Name, - " -c ./", Name, "/priv/test_config/", Name, ".config", - " $1"], + Cmd = [env(Type), + " RVI_RUNDIR=", filename:join(Cwd, Name), + " ./", Name, "/rvi_core/rvi_ctl", + " -c ./", Name, "/rvi_core/priv/test_config/", Name, ".config", + " $*"], ok = save_cmd(F, Cmd), - cmd([F, " start"]), + cmd(["sh -x ", F, " start"]), await_started(Name). t_start_basic_backend(_Config) -> - generic_start("basic_backend"). + start_backend("basic_backend"). t_start_basic_sample(_Config) -> - generic_start("basic_sample"). + start_sample("basic_sample"). t_start_bt_backend(_Config) -> - generic_start("bt_backend"). + start_backend("bt_backend"). t_start_bt_sample(_Config) -> - generic_start("bt_sample"). + start_sample("bt_sample"). t_start_tls_backend(_Config) -> - generic_start("tls_backend"). + start_backend("tls_backend"). t_start_tls_sample(_Config) -> - generic_start("tls_sample"). + start_sample("tls_sample"). t_start_tlsj_backend(_Config) -> - generic_start("tlsj_backend"). + start_backend("tlsj_backend"). t_start_tlsj_sample(_Config) -> - generic_start("tlsj_sample"). + start_sample("tlsj_sample"). t_start_tls_backend_noverify(_Config) -> - generic_start("tls_backend_noverify"). + start_backend("tls_backend_noverify"). t_start_tls_sample_noverify(_Config) -> - generic_start("tls_sample_noverify"). + start_sample("tls_sample_noverify"). t_register_lock_service(_Config) -> Pid = @@ -706,6 +702,15 @@ ensure_dir(Dir) -> env() -> "RVI_LOGLEVEL=debug RVI_MYIP=127.0.0.1 RVI_BACKEND=127.0.0.1". +env(backend) -> + env(); +env(sample) -> + [env(), + " RVI_BACKEND=127.0.0.1 RVI_PORT=9000" + " RVI_MY_NODE_ADDR=127.0.0.1:9000"]. + + + root() -> code:lib_dir(rvi_core). @@ -724,18 +729,28 @@ service_edge("sample" ) -> "http://localhost:9001". rvi_log_addr("backend") -> "http://localhost:8809"; rvi_log_addr("sample" ) -> "http://localhost:9009". -install_rvi_node(Name, Env, _ConfigF) -> +install_backend_node(Name) -> + install_rvi_node(backend, Name). + +install_sample_node(Name) -> + install_rvi_node(sample, Name). + +install_rvi_node(Type, Name) -> Root = code:lib_dir(rvi_core), Scripts = filename:join(Root, "scripts"), ct:log("Root = ~p", [Root]), Cmd = lists:flatten( - [Env, " ", Scripts, "/rvi_install.sh ./", Name]), - + ["sh -x ", Scripts, "/rvi_install", + " -r ", filename:join(root_keys(), "root_cert.crt"), + " -d basic_backend_keys/device_cert.crt", + " -k basic_backend_keys/device_key.pem", + " -n ", Name, + creds(Type), + " ", Name, "/rvi_core"]), ct:log("Cmd = `~s`", [Cmd]), Res = cmd(Cmd), ct:log("install_rvi_node/1 -> ~p", [Res]), - Res1 = cmd(lists:flatten(["install -d --mode 0755 ./", Name])), ct:log("install_rvi_node/2 -> ~p", [Res1]), @@ -744,17 +759,12 @@ install_rvi_node(Name, Env, _ConfigF) -> Res2. -install_sample_node(Name, ConfigF) -> - Env = [env(), - " RVI_BACKEND=127.0.0.1 RVI_PORT=9000" - " RVI_MY_NODE_ADDR=127.0.0.1:9000"], - install_rvi_node(Name, Env, - [root(), "/priv/test_config/", ConfigF]). - -%% in_priv_dir(F, Cfg) -> -%% %% PrivDir = ?config(priv_dir, Cfg), -%% %% in_dir(PrivDir, F, Cfg). -%% F(Cfg). +creds(backend) -> + [" -c basic_backend_creds/backend_cred.jwt" + " -c basic_backend_creds/sota_backend_cred.jwt"]; +creds(sample) -> + [" -c basic_sample_creds/lock_cred.jwt" + " -c basic_sample_creds/sota_cred.jwt"]. cmd(C) -> cmd(C, []). @@ -896,7 +906,8 @@ no_errors(Dirs, PDir) -> ct:log("Will check errors in ~p", [Dirs]), true = lists:all( fun(D) -> - no_errors_(filename:join([PDir, D, "rvi", "log", "lager"]), D) + no_errors_(filename:join([PDir, D, "rvi_core", + "log", "lager"]), D) end, Dirs), ok. @@ -913,6 +924,6 @@ log_is_empty(Log, F, Name) -> ct:log("~s: ~s is not empty:~n~s", [Name, F, Content]), false; {error, Reason} -> - ct:log("~s: Cannot read log ~s (~p)", [Name, F, Reason]), + ct:log("~s: Cannot read log ~s (~p)", [Name, Log, Reason]), false end. -- cgit v1.2.1 From def54b8c51ed340ea2939db4d67fc45bc9ecb347 Mon Sep 17 00:00:00 2001 From: Ulf Wiger Date: Fri, 12 Feb 2016 11:23:07 -0800 Subject: incomplete doc of sort_app --- deps/setup/src/setup_gen.erl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/deps/setup/src/setup_gen.erl b/deps/setup/src/setup_gen.erl index d33ccc7..9f95030 100644 --- a/deps/setup/src/setup_gen.erl +++ b/deps/setup/src/setup_gen.erl @@ -83,7 +83,10 @@ help() -> %% option. %% * `{remove_apps, Apps}' - Remove `Apps' from the list of applications. %% * `{sort_app, App, Before}' - Change the sort order so that `App' comes -%% before `Before'. `Before' can be either +%% before `Before'. `Before' can be either an application +%% name or a list of names. In the latter case, `App' +%% is inserted before either of the applications in +%% the list, whichever comes first. %% * `{include, ConfigFile}' - include options from the given file. The file %% is processed using `file:script/2'. %% * `{include_lib, ConfigFile}' - As above, but ConfigFile is named as with -- cgit v1.2.1 From 7d62bffc14a7ea2bb1c31e61f38b0302f8aaee18 Mon Sep 17 00:00:00 2001 From: Ulf Wiger Date: Sat, 13 Feb 2016 10:46:32 -0800 Subject: fix fqn() to also work for prefix --- scripts/rvi_install | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/scripts/rvi_install b/scripts/rvi_install index 0bcb045..7f6207e 100755 --- a/scripts/rvi_install +++ b/scripts/rvi_install @@ -12,10 +12,42 @@ # # -# fqn : fully qualified name (e.g. realpath, but portable) +# join two path names (avoid things like //foo or /foo/../bar) +join() +{ + if [ "$1" = "/" ] + then + echo "/$2" + else + if [ "$2" = ".." ] + then + echo $(fqn $(dirname $1)) + else + echo "$1/$2" + fi + fi +} + +# fqn : fully qualified name +# (e.g. realpath, but portable & works even if path doesn't exist) fqn() { - echo $(cd $(dirname $1); pwd)/$(basename $1) + if [ "$1" = "." ] + then + echo $(pwd) + else + if [ "$1" = "/" ] + then + echo "/" + else + if [ -e $1 ] + then + echo $(join $(cd $(dirname $1); pwd) $(basename $1)) + else + echo $(join $(fqn $(dirname $1)) $(basename $1)) + fi + fi + fi } SELF_DIR=$(dirname $(fqn "$0")) @@ -194,7 +226,7 @@ while getopts "r:d:c:k:s:l:n:" o; do ;; s) - PREFIX_STRIP=${OPTARG} + PREFIX_STRIP=$(fqn ${OPTARG}) ;; n) NAME=${OPTARG} -- cgit v1.2.1 From e1bf772b317663313e32f9580888bf80023ed774 Mon Sep 17 00:00:00 2001 From: Anson Fan Date: Thu, 18 Feb 2016 18:58:04 -0800 Subject: Added in a python class rvi_ws_client that will spawn a blocking app which will register services with websockets and return messages to corresponding callback functions. Details on how to use this are included in the top comment block of the file --- python/rvi_ws.py | 141 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 python/rvi_ws.py diff --git a/python/rvi_ws.py b/python/rvi_ws.py new file mode 100644 index 0000000..cb73591 --- /dev/null +++ b/python/rvi_ws.py @@ -0,0 +1,141 @@ +# +# Copyright (C) 2016, Jaguar Land Rover +# +# This program is licensed under the terms and conditions of the +# Mozilla Public License, version 2.0. The full text of the +# Mozilla Public License is at https://www.mozilla.org/MPL/2.0/ +# +# rvi_ws 0.1.0 +# +# This module is the websocket implementation of for RVI services. + +# To use this code you will follow these steps. +# 1. Import the rvi_ws class using "import rvi_ws" +# 2. Instantiate a rvi_ws_client class object specifying the bundle_id, debug params, and host +# ex. +# rvi_client = rvi_ws.rvi_ws_client(bundle_id = , host = , debug = ) +# 3. Create a dictionary of services and their callback functions. The keys of the dictionary should be the string service name +# name and the value should be the pointer to the callback function. +# ex. +# def hello(...): +# ... +# def world(...): +# ... +# +# rvi_client.register_services({"hello":hello, "world":world}) +# +# 4. Register and run the services by invoking the services_run() function in the rvi_ws_client class. This will block all other code +# execution until the websocket connection closes in which case will return a None value. +# ex. +# rvi_client.services_run() +# +# Optionally there are a few more utility functions included in the rvi_ws_client class mainly setting properties of the class. +# + +import websocket +import json +import threading + +try: + import thread +# TODO use Threading instead of _thread in python3 +except ImportError: + import _thread as thread + +# rvi_ws_client will be in charge of handling all communication via websockets between the service bundle and RVI. + +class rvi_ws_client: + + def __init__(self, bundle_id = None, debug = False, host = "ws://localhost:9008"): + + self.DEBUG = debug + self.service_bundle_id = bundle_id + self.callback_funcs = {} + self.host = host + + # set_ws_debug takes in parameter debug_status which is type bool. Will toggle on or off all websocket related debug messages. + def set_ws_debug(self): + + if self.DEBUG: + websocket.enableTrace(True) + else: + websocket.enableTrace(False) + + # on_error will print an error if the websocket application encounters any and prints if debug is toggled on + def on_error(self,ws, error): + pass + + # TODO unregister service for clean close of websocket, for time being will just print out debug + def on_close(self,ws): + pass + # What to do on the open of the application. Note we must register_services for this to do anything. + def on_open(self,ws): + + def run(*args): + + payload = {} + payload['json-rpc'] = "2.0" + payload['id'] = "0" + payload['method'] = "register_service" + + for service_name, callback in self.callback_funcs.items(): + payload['params'] = {"service_name":self.service_bundle_id+"/"+service_name} + ws.send(json.dumps(payload)) + + opening = threading.Thread(target=run) + opening.start() + + # on_message will route the message from the websocket to it's corresponding callback function that registered the service + def on_message(self,ws, message): + + message_dict = json.loads(message) + + try: + if (message_dict['method'] == 'message') and (message_dict['params']['service_name'][(2+len(self.service_bundle_id)):] in self.callback_funcs): + self.callback_funcs[message_dict['params']['service_name'][(2+len(self.service_bundle_id)):]](**message_dict['params']['parameters']) + except: + pass + + + # set_host will expect a string parameter that will change the class variable host which will connect to our websocket server + def set_host(self,target_host): + + self.host = target_host + return True + + # register_services will take in a dictionary of services to register. + # The keys of the dictionary will be the service name and the value will be the callback function + # will return success on successfully changing the class' callback function dictionary + # Please make sure that the service name keys are strings. + # For example: + # services = { + # :, + # :, + # .... + # } + def register_services(self,services): + + self.callback_funcs = services + return True + # set_service_bundle expects a string parameter that will change the class variable service_bundle_id as the bundle_id tro register + def set_service_bundle(self, service_bundle): + self.service_bundle_id = service_bundle + return True + + # services_run is a callable function for after everything is set to start the websocket client. + # Will block all remaining code until the websocket connection is broken. In which case will return None + def services_run(self): + + if self.service_bundle_id == None: + raise NameError('No Specified bundle_id') + + self.set_ws_debug() + + ws = websocket.WebSocketApp(self.host, + on_message = self.on_message, + on_error = self.on_error, + on_close = self.on_close) + ws.on_open = self.on_open + + return ws.run_forever() + -- cgit v1.2.1 From abee27880cb70cbc755a1bba0f5f0721159bfff8 Mon Sep 17 00:00:00 2001 From: Rudolf J Streif Date: Fri, 19 Feb 2016 19:00:24 +0000 Subject: Added template for Raspbian build and packaging Added raspbian_template directory which contains the Debian build and packaging for Raspbian. Added raspbian_package target to makefile. Signed-off-by: Rudolf J Streif --- Makefile | 25 +++++++++++ raspbian_template/README.Debian | 10 +++++ raspbian_template/README.source | 6 +++ raspbian_template/changelog | 5 +++ raspbian_template/compat | 1 + raspbian_template/control | 13 ++++++ raspbian_template/copyright | 11 +++++ raspbian_template/docs | 0 raspbian_template/rules | 21 +++++++++ raspbian_template/rvi.init | 70 ++++++++++++++++++++++++++++++ raspbian_template/rvi.lintian-overrides | 3 ++ raspbian_template/rvi.postinst | 45 +++++++++++++++++++ raspbian_template/rvi.postrm | 40 +++++++++++++++++ raspbian_template/rvi.service | 18 ++++++++ raspbian_template/source/format | 1 + raspbian_template/source/lintian-overrides | 1 + 16 files changed, 270 insertions(+) create mode 100644 raspbian_template/README.Debian create mode 100644 raspbian_template/README.source create mode 100644 raspbian_template/changelog create mode 100644 raspbian_template/compat create mode 100644 raspbian_template/control create mode 100644 raspbian_template/copyright create mode 100644 raspbian_template/docs create mode 100755 raspbian_template/rules create mode 100755 raspbian_template/rvi.init create mode 100644 raspbian_template/rvi.lintian-overrides create mode 100644 raspbian_template/rvi.postinst create mode 100644 raspbian_template/rvi.postrm create mode 100644 raspbian_template/rvi.service create mode 100644 raspbian_template/source/format create mode 100644 raspbian_template/source/lintian-overrides diff --git a/Makefile b/Makefile index 1c594cc..72bbb4b 100644 --- a/Makefile +++ b/Makefile @@ -71,6 +71,9 @@ ubuntu_clean: debian_clean: rm -rf ./debian_build +raspbian_clean: + rm -rf ./raspbian_build + rpm_clean: rm -rf ./rpm/BUILD/* \ ./rpm/BUILDROOT/* \ @@ -137,6 +140,28 @@ debian_package: clean debian_clean escript (cd ./debian_build/rvi-$(VERSION); debuild -uc -us) +# Create a raspbian package +raspbian_package: clean raspbian_clean escript + install --mode=0755 -d ./raspbian_build + +# Pack up all relevant files, and debian/, necessary for a build. +# Add rvi-$(VERSION) at the beginning of each file so +# that they get packed up into a correctly named subdirectory +# + tar czf ./raspbian_build/rvi_$(VERSION).orig.tar.gz \ + --exclude-vcs --transform="s|^|./rvi-$(VERSION)/|" \ + $(SRC_LIST) \ + raspbian_template + rm -rf raspbian/missing-sources +# Unpack the created tar file + (cd ./raspbian_build; tar xf rvi_$(VERSION).orig.tar.gz) +# Move the debian template to be the debian package + mv ./raspbian_build/rvi-$(VERSION)/raspbian_template ./raspbian_build/rvi-$(VERSION)/debian + install -d -m 0755 ./raspbian_build/rvi-$(VERSION)/debian/missing-sources +# Descend into the unpacked directory and build. + (cd ./raspbian_build/rvi-$(VERSION); debuild --prepend-path /usr/local/bin -uc -us) + + rpm: rpmclean rpm_tarball rpmbuild --define "_topdir $$PWD/rpm" -ba rpm/SPECS/rvi-$(VERSION).spec diff --git a/raspbian_template/README.Debian b/raspbian_template/README.Debian new file mode 100644 index 0000000..f80c683 --- /dev/null +++ b/raspbian_template/README.Debian @@ -0,0 +1,10 @@ +rvi for Debian +-------------- + +Will rely on existing Erlang installation to work. + +We will copy out the Erlang VM BEAM files to /opt/rvi and the configuration files to /etc/opt/rvi + +/opt/rvi/rvi.sh is the main control program. + + -- Magnus Feuer Fri, 27 Nov 2015 15:34:39 -0800 diff --git a/raspbian_template/README.source b/raspbian_template/README.source new file mode 100644 index 0000000..9e3c927 --- /dev/null +++ b/raspbian_template/README.source @@ -0,0 +1,6 @@ +rvi for Debian +-------------- + + + -- Magnus Feuer Fri, 27 Nov 2015 15:34:39 -0800 + diff --git a/raspbian_template/changelog b/raspbian_template/changelog new file mode 100644 index 0000000..3d774a4 --- /dev/null +++ b/raspbian_template/changelog @@ -0,0 +1,5 @@ +rvi (0.5.0-1) jessie; urgency=low + + * Initial release + + -- Magnus Feuer Fri, 27 Nov 2015 15:34:39 -0800 diff --git a/raspbian_template/compat b/raspbian_template/compat new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/raspbian_template/compat @@ -0,0 +1 @@ +9 diff --git a/raspbian_template/control b/raspbian_template/control new file mode 100644 index 0000000..0fb7b83 --- /dev/null +++ b/raspbian_template/control @@ -0,0 +1,13 @@ +Source: rvi +Section: net +Priority: optional +Maintainer: Magnus Feuer +Build-Depends: debhelper (>= 9), libbluetooth-dev +Standards-Version: 3.9.6 +Homepage: https://github.com/PDXostc/rvi_core + +Package: rvi +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, bluez, erlang (>= 1:18.2), python-jsonrpclib (>= 0.1.3-1), python (>= 2.7.9-1) +Description: Remote Vehicle Interaction + GENIVI Remote Vehicle Interaction Core diff --git a/raspbian_template/copyright b/raspbian_template/copyright new file mode 100644 index 0000000..89597cf --- /dev/null +++ b/raspbian_template/copyright @@ -0,0 +1,11 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: rvi +Source: http://github.com/PDXostc/rvi_core + +Files: * +Copyright: Copyright 2014,2015,2016 Jaguar Land Rover +License: MPL-2.0 + This program is licensed under the terms and conditions of the + Mozilla Public License, version 2.0. The full text of the + Mozilla Public License is at https://www.mozilla.org/MPL/2.0/ + diff --git a/raspbian_template/docs b/raspbian_template/docs new file mode 100644 index 0000000..e69de29 diff --git a/raspbian_template/rules b/raspbian_template/rules new file mode 100755 index 0000000..b6b8c0a --- /dev/null +++ b/raspbian_template/rules @@ -0,0 +1,21 @@ +#!/usr/bin/make -f +# -*- makefile --* + +# Uncomment this to turn on verbose mode. +export DH_VERBOSE=1 + +%: + dh $@ + +override_dh_auto_install: + ./scripts/rvi_install \ + -s ./debian/rvi \ + -k priv/keys/insecure_device_key.pem \ + -r priv/certificates/insecure_root_cert.crt \ + -d priv/certificates/insecure_device_cert.crt \ + -c priv/credentials/insecure_credential.jwt \ + -l ./debian/rvi/var/log/rvi ./debian/rvi/usr/lib/rvi_core +# Copy out rvi_ctl to /usr/bin + install -D -m 0755 ./debian/rvi/usr/lib/rvi_core/rvi_ctl ./debian/rvi/usr/bin/rvi_ctl +# Install default config + install -D -m 0644 ./priv/config/rvi_ubuntu.config ./debian/rvi/etc/rvi/rvi.config diff --git a/raspbian_template/rvi.init b/raspbian_template/rvi.init new file mode 100755 index 0000000..9cd4e59 --- /dev/null +++ b/raspbian_template/rvi.init @@ -0,0 +1,70 @@ +#!/bin/sh +# +# Copyright (C) 2014, Jaguar Land Rover +# +# This program is licensed under the terms and conditions of the +# Mozilla Public License, version 2.0. The full text of the +# Mozilla Public License is at https://www.mozilla.org/MPL/2.0/ +# +# +# Init.d script to start and stop an RVI system installed +# through an RPM. +# +### BEGIN INIT INFO +# Provides: rvi +# Required-Start: $network $syslog $remote_fs +# Required-Stop: $network $syslog $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start/Stop RVI node at boot time +# Description: Manage Remote Vehicle Interaction Node run state. +### END INIT INFO + +export PATH="/bin/:/usr/bin:/sbin:/usr/sbin" +export HOME=/usr/lib/rvi_core +. /lib/lsb/init-functions + +set -e + +case "$1" in + start) + log_daemon_msg "Starting Remote Vehicle Interaction Node..." "rvi" + if /usr/bin/rvi_ctl -c /etc/rvi/rvi.config start; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + stop) + log_daemon_msg "Stopping Remote Vehicle Interaction Node..." "rvi" + if /usr/bin/rvi_ctl stop; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + + restart) + log_daemon_msg "Restarting Remote Vehicle Interaction Node..." "rvi" + if /usr/bin/rvi_ctl restart; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + + force-reload) + log_daemon_msg "Restarting Remote Vehicle Interaction Node..." "rvi" + if /usr/bin/rvi_ctl restart; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + *) + log_action_msg "Usage: /etc/init.d/rvi {start|stop|restart}" + exit 1 +esac + +exit 0 + diff --git a/raspbian_template/rvi.lintian-overrides b/raspbian_template/rvi.lintian-overrides new file mode 100644 index 0000000..c307106 --- /dev/null +++ b/raspbian_template/rvi.lintian-overrides @@ -0,0 +1,3 @@ +executable-not-elf-or-script +missing-dep-for-interpreter +binary-without-manpage \ No newline at end of file diff --git a/raspbian_template/rvi.postinst b/raspbian_template/rvi.postinst new file mode 100644 index 0000000..10c11fe --- /dev/null +++ b/raspbian_template/rvi.postinst @@ -0,0 +1,45 @@ +#!/bin/sh +# postinst script for rvi +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +# source debconf library +. /usr/share/debconf/confmodule + +case "$1" in + + configure) + # Set up our config + cat /proc/sys/kernel/random/uuid > /etc/rvi/device_id + echo "RVI Device ID set to $(cat /etc/rvi/device_id) in /etc/rvi/device_id" + #DEBHELPER# + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + exit 0 + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; + +esac + +db_stop + +exit 0 diff --git a/raspbian_template/rvi.postrm b/raspbian_template/rvi.postrm new file mode 100644 index 0000000..a0c5d5b --- /dev/null +++ b/raspbian_template/rvi.postrm @@ -0,0 +1,40 @@ +#!/bin/sh +# postrm script for rvi +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +# source debconf library +. /usr/share/debconf/confmodule + +case "$1" in + + remove|purge|upgrde|disappear) + rm -f /etc/init.d/rvi + #DEBHELPER# + ;; + + *) + exit 0 + ;; + + +esac + +db_stop + +exit 0 diff --git a/raspbian_template/rvi.service b/raspbian_template/rvi.service new file mode 100644 index 0000000..d9ae979 --- /dev/null +++ b/raspbian_template/rvi.service @@ -0,0 +1,18 @@ +# systemd(8) setup for Debian + +[Unit] +Description=Remote Vehicle Interaction Service +Wants=network-online.target + +[Service] +Environment="HOME=/usr/lib/rvi_core" +Type=forking +StandardOutput=journal +StandardError=journal +ExecStart=/usr/bin/rvi_ctl -c /etc/rvi/rvi.config start +ExecStop=/usr/bin/rvi_ctl stop +GuessMainPID=yes +RemainAfterExit=yes + +[Install] +WantedBy=graphical.target multi-user.target diff --git a/raspbian_template/source/format b/raspbian_template/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/raspbian_template/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/raspbian_template/source/lintian-overrides b/raspbian_template/source/lintian-overrides new file mode 100644 index 0000000..463abe9 --- /dev/null +++ b/raspbian_template/source/lintian-overrides @@ -0,0 +1 @@ +source-is-missing -- cgit v1.2.1 From 5cffa3d484ba8f9dc4873fbea66f0a2730480feb Mon Sep 17 00:00:00 2001 From: Rudolf J Streif Date: Tue, 23 Feb 2016 08:24:48 -0800 Subject: Unified configuration files The configuration file rvi_yocto.config still represented a previous state. Made it the same as rvi_ubuntu.config which represents the newest configuration settings. Since there also was no rvi_debian.config (the rvi_ubuntu.config file was used when building for Debian), I created that for consistency reasons. Future will tell if we actually need separate configuration files for the different build and deployment environments. If not then we can consolidate easily later. Signed-off-by: Rudolf J Streif --- debian_template/rules | 2 +- priv/config/rvi_debian.config | 344 ++++++++++++++++++++++++++++++++++++++++++ priv/config/rvi_ubuntu.config | 6 +- priv/config/rvi_yocto.config | 22 +-- 4 files changed, 355 insertions(+), 19 deletions(-) create mode 100644 priv/config/rvi_debian.config diff --git a/debian_template/rules b/debian_template/rules index b6b8c0a..fc2f6c0 100755 --- a/debian_template/rules +++ b/debian_template/rules @@ -18,4 +18,4 @@ override_dh_auto_install: # Copy out rvi_ctl to /usr/bin install -D -m 0755 ./debian/rvi/usr/lib/rvi_core/rvi_ctl ./debian/rvi/usr/bin/rvi_ctl # Install default config - install -D -m 0644 ./priv/config/rvi_ubuntu.config ./debian/rvi/etc/rvi/rvi.config + install -D -m 0644 ./priv/config/rvi_debian.config ./debian/rvi/etc/rvi/rvi.config diff --git a/priv/config/rvi_debian.config b/priv/config/rvi_debian.config new file mode 100644 index 0000000..e075fa4 --- /dev/null +++ b/priv/config/rvi_debian.config @@ -0,0 +1,344 @@ +%% -*- erlang -*- + +%% Copyright (C) 2014,2015,2016 Jaguar Land Rover +%% +%% This program is licensed under the terms and conditions of the +%% Mozilla Public License, version 2.0. The full text of the +%% Mozilla Public License is at https://www.mozilla.org/MPL/2.0/ +%% +%% Configuration file for RVI deployed on Debian systems. +%% +%% See ../CONFIGURE.md for a details on the configuration process +%% itself. +%% + +%% Parameters for simpler modification +Env = fun(V, Def) -> + case os:getenv(V) of + false -> Def; + Str when is_integer(Def) -> list_to_integer(Str); + Str when is_atom(Def) -> list_to_atom(Str); + Str -> Str + end + end. +IPPort = fun(IP, Port) -> + IP ++ ":" ++ integer_to_list(Port) + end. +MyPort = Env("RVI_PORT", 9000). +MyIP = Env("RVI_MYIP", "127.0.0.1"). +MyNodeAddr = Env("RVI_MY_NODE_ADDR", IPPort(MyIP, MyPort)). +BackendIP = Env("RVI_BACKEND", "38.129.64.31"). +BackendPort = Env("RVI_BACKEND_PORT", 8807). +LogLevel = Env("RVI_LOGLEVEL", notice). + +[ + %% All erlang apps needed to fire up a node. Do not touch. + {include_lib, "rvi_core/priv/config/rvi_common.config"}, + + %% + %% Custom environment settings + %% for all apps running on the node. + %% + {env, + [ + + %% All RVI configuration is done here. + %% + %% Please note that the rvi_node.sh launch script + %% can still override the port range and static nodes + %% through its command line parameters. + %% + %% Value substitution: + %% All string values under the rvi tuple tree are scanned + %% for specific dokens during startup. If a token is + %% found, it will be replaced with a value referenced by it. + %% Tokens can one of the following: + %% + %% $rvi_file(FileName,Default) - File content + %% When an $rvi_file() token is encountered, the first line of + %% the referenced file is read. The line (without the newline) + %% replaces the token. + %% + %% Example: + %% { node_service_prefix, "jlr.com/vin/$rvi_file(/etc/vin,default_vin)"}, + %% + %% will be substituted with the first line from the file + %% /etc/vin: + %% + %% { node_service_prefix, "jlr.com/vin/2GKEG25HXP4093669"}, + %% + %% If /etc/vin cannot be opened, the value default_vin + %% will be used instead. + %% + %% + %% $rvi_env(EnvironemtnName,Default) - Environment variable + %% When an $rvi_env() token is encountered, the value of + %% the Linux process environment variable (such as $HOME) is read + %% to replace the token. + %% + %% Example: + %% { node_service_prefix, "jlr.com/vin/$rvi_env(VIN,default_vin)"}, + %% + %% will be substituted with the value of the $VIN environment + %% variable: + %% + %% { node_service_prefix, "jlr.com/vin/2GKEG25HXP4093669"}, + %% + %% If VIN is not a defined environment variable, the value + %% default_vin will be used instead. + %% + %% + %% $rvi_uuid(Default) - Unique machine identifier + %% When an $rvi_uuid() token is encountered, the UUID of the root + %% disk used by the system is read to replace the token. + %% The UUID of the root disk is retrieved by opening /proc/cmdline + %% and extracting the root=UUID=[DiskUUID] value. + %% This value is generated at system install time and is reasonably + %% world wide unique. + %% + %% Example: + %% { node_service_prefix, "jlr.com/vin/$uuid(default_vin)"}, + %% + %% will be substituted with the value of the root disk UUID: + %% + %% { node_service_prefix, + %% "jlr.com/vin/afc0a6d8-0264-4f8a-bb3e-51ff8655b51c"}, + %% + %% If the root UUID cannot be retrieved, the value default_vin + %% will be used instead. + %% + + {rvi_core, + [ + %% Specify the node address that data_link uses to listen to + %% incoming traffic from other rvi nodes. + %% + %% This is the address that is announced to + %% other rvi nodes during service discovery and should be + %% forwarded through firewalls and port forwarding to to the port + %% specified by the configuration entry rvi -> components -> + %% data_link ->json_rpc_server (see below). + %% + %% If this node is sitting behind a firewall and cannot + %% receive incomign connections on any address, its + %% node_address should be set to "0.0.0.0:0" to inform + %% the remote node that it should not attempt to + %% connect back to self. + { node_address, MyNodeAddr }, + + %% Specify the prefix of all services that this rvi node is hosting. + %% + %% All local services regsitering with service edge will be prefixed with + %% the string below when they are announced to remote rvi nodes + %% that connect to this node (using the address specified + %% by node_address above). + %% + %% If a locally connected service registers itself as + %% "hvac/fan_speed", and the node_service_prefix is + %% "jlr.com/vin/1234/", this node will announce the service + %% "jlr.com/vin/1234/hvac/fan_speed" as being available + %% to remotely connected rvi nodes. + %% + %% Two rvi nodes should never have the same node_service_prefix + %% value unless all services add a system-wide unique name + %% to it. + %% + { node_service_prefix, "jlr.com/vin/$rvi_uuid(default_vin)/"}, + + + %% Routing rules determine how to get a message targeting a specific + %% service to its destination. + %% + %% Please note that if a remotely initiated (== client) data link is + %% available and has announced that the targeted service is available, + %% that data link will be used regardless of what it is. + %% + %% In other words, if you setup routing rules for how to reach out + %% to a vehicle using SMS, and that vehicle happens to have a 3G + %% connection up when the message is sent, the 3G connection will be used. + %% + %% We will add a blacklist feature in the future to optionally block + %% such opportunistic routing in the future. + %% + { routing_rules, + [ + %% Service name prefix that rules are specified for + %% The service prefix with the longest match against the service targeted + %% by the message will be used. + %% + %% Example: Targeted service = jlr.com/backend/sota/get_updates + %% + %% Prefix1: { "jlr.com/backend", [...]} + %% Prefix2: { "jlr.com/backend/sota", [...]} + %% + %% Prefix2 will be used. + %% + %% This allows you, for example, to setup different servers + %% for different types of services (SOTA, remote door unlock, + %% HVAC etc). + %% + + %% Make sure to have a default if you don't want your message + %% to error out immediately. With a default the message will + %% be queued until it times out, waiting for a remote node + %% to connect and announce that it can handle the targeted service. + { "", + [ + { proto_json_rpc, dlink_tcp_rpc} + ] + }, + + { "jlr.com/backend/", + %% Which protocol and data link pair to use when transmitting the message + %% to the targeted service. If a pair reports a failure, the next pair is tried. + [ + { proto_json_rpc, { dlink_tcp_rpc, + % {"38.129.64.13", 8807} + [ { target, IPPort(BackendIP, BackendPort) } ]}} + ] + }, + + %% Used to communicate with vehicles + { "jlr.com/vin/", + [ + { proto_json_rpc, { dlink_tcp_rpc, [ broadcast, { interface, "wlan0" } ] } }, + { proto_json_rpc, { server_3g, [ initiate_outbound ]} }, + + %% Protocols can have hinting as well. + %% In this case JSON-RPC should only be used if the + %% resulting message size can fit in an SMS (140 bytes). + + { { proto_json_rpc, [ { max_msg_size, 140 } ] } , server_sms } + ] + } + ] + }, + + { components, + [ + %% A note about JSON-RPC calls vs gen_server calls: + %% + %% All locally connected services communicate with Service Edge + %% through JSON-RPC. + %% + %% Communication between the internal RVI components, however, + %% can be either JSON-RPC or gen_server calls. + %% + %% JSON-RPC calls provide compatability with replacement components + %% written in languages other than Erlang. + %% + %% Gen_server calls provide native erlang inter-process calls that + %% are about 4x faster than JSON-RPC when transmitting large data volumes. + %% + %% If one or more of the components below are replaced with external + %% components, use JSON-RPC by specifying IP address and port in + %% json_rpc_address for all interfaced by the external components. + %% + %% If you are running an all-native erlang system, use gen_server calls + %% by specifying gen_server for all components + %% + %% Please note that communication between two RVI nodes are + %% not affected by this since dlink_tcp will use + %% JSON-RPC to communicate ( using the address/port specified + %% by proto_json_rpc). + %% + + {rvi_common, + [ + {rvi_log, gen_server, + [{json_rpc_address, MyPort+9}] + } + ]}, + %% Service_edge. + %% The service_edge tuple is a top level configuration + %% container for everything about service edge. + %% In theory, we can support multiple different service edge + %% components (written in different languages). + %% + %% However, until we've sorted out internal routing, we will + %% only support the native service_edge_rpc component, + %% accessed either as a gen_server or through JSON-RPC. + %% + {service_edge, + [ + %% Service_edge_rpc component is used as a gen_server + { service_edge_rpc, gen_server, + [ + %% JSON-RPC address will be translated to + %% an URL looking like this: + %% http://127.0.0.1:8801 + %% + %% This URL is used both for communication with + %% locally connected services and for intra-component + %% communication in case the access method for + %% service_edge_rpc is specified as json_rpc. + { json_rpc_address, { MyIP, MyPort+1 } }, % {"127.0.0.1",8801} + { msgpack_rpc_address, { MyIP, MyPort + 21 } }, + + %% Websocket is used for websocket access, preferably + %% through the rvi.js package available for Javascript + %% apps in browsers and crosswalk who wants to interface + %% RVI. + { websocket, [ { port, MyPort+8}]} % 9008 + ] + } + ] + }, + { service_discovery, + [ { service_discovery_rpc, gen_server, + [ + { json_rpc_address, { MyIP, MyPort+2 }} % {"127.0.0.1",9002} + ] + } + ] + }, + { schedule, + [ { schedule_rpc, gen_server, + [ + { json_rpc_address, { MyIP, MyPort+3 }} % {"127.0.0.1",9003} + ] + } + ] + }, + { authorize, + [ { authorize_rpc, gen_server, + [ + { json_rpc_address, { MyIP, MyPort+4 } } % {"127.0.0.1",9004} + ] + } + ] + }, + { protocol, + [ { proto_json_rpc, gen_server, + [ + { json_rpc_address, { MyIP, MyPort+5 } } % {"127.0.0.1",9005} + ] + } + ] + }, + { data_link, + [ { dlink_tcp_rpc, gen_server, + [ + { json_rpc_address, { MyIP, MyPort+6 } }, % 9006 + %% data link TCP server specifies the port we should + %% listen to for incoming connections + %% from other rvi nodes. + %% A specific NIC address can also be specified + %% through the {ip, "192.168.0.1" } tuple. + { server_opts, [ { port, MyPort+7 }]}, + { persistent_connections, [ IPPort(BackendIP, BackendPort) ]} + ] + }, + { dlink_tls_rpc, gen_server, + [ + { json_rpc_address, { MyIP, MyPort+11} }, + { server_opts, [ {port, MyPort+10} ]} + ] + } + ] + } + ] + } + ]} + ]} +]. diff --git a/priv/config/rvi_ubuntu.config b/priv/config/rvi_ubuntu.config index 57ffd37..9c09cca 100644 --- a/priv/config/rvi_ubuntu.config +++ b/priv/config/rvi_ubuntu.config @@ -1,14 +1,12 @@ %% -*- erlang -*- -%% Copyright (C) 2014, Jaguar Land Rover +%% Copyright (C) 2014,2015,2016 Jaguar Land Rover %% %% This program is licensed under the terms and conditions of the %% Mozilla Public License, version 2.0. The full text of the %% Mozilla Public License is at https://www.mozilla.org/MPL/2.0/ %% -%% Configuration file for the (in-vehicle) IVI used by the hvac_demo -%% -%% See ../hvac_demo/README.md for details on the demo. +%% Configuration file for RVI deployed on Ubuntu systems. %% %% See ../CONFIGURE.md for a details on the configuration process %% itself. diff --git a/priv/config/rvi_yocto.config b/priv/config/rvi_yocto.config index 6e7863a..c0cb162 100644 --- a/priv/config/rvi_yocto.config +++ b/priv/config/rvi_yocto.config @@ -1,14 +1,13 @@ %% -*- erlang -*- -%% Copyright (C) 2014, Jaguar Land Rover +%% Copyright (C) 2014,2015,2016 Jaguar Land Rover %% %% This program is licensed under the terms and conditions of the %% Mozilla Public License, version 2.0. The full text of the %% Mozilla Public License is at https://www.mozilla.org/MPL/2.0/ %% -%% Configuration file for the (in-vehicle) IVI used by the hvac_demo -%% -%% See ../hvac_demo/README.md for details on the demo. +%% Configuration file for RVI built and deployed with the +%% Yocto Project %% %% See ../CONFIGURE.md for a details on the configuration process %% itself. @@ -23,14 +22,14 @@ Env = fun(V, Def) -> Str -> Str end end. +IPPort = fun(IP, Port) -> + IP ++ ":" ++ integer_to_list(Port) + end. MyPort = Env("RVI_PORT", 9000). MyIP = Env("RVI_MYIP", "127.0.0.1"). -MyNodeAddr = Env("RVI_MY_NODE_ADDR", "0.0.0.0:0"). +MyNodeAddr = Env("RVI_MY_NODE_ADDR", IPPort(MyIP, MyPort)). BackendIP = Env("RVI_BACKEND", "38.129.64.31"). BackendPort = Env("RVI_BACKEND_PORT", 8807). -IPPort = fun(IP, Port) -> - IP ++ ":" ++ integer_to_list(Port) - end. LogLevel = Env("RVI_LOGLEVEL", notice). [ @@ -112,12 +111,6 @@ LogLevel = Env("RVI_LOGLEVEL", notice). {rvi_core, [ - - {key_pair, {openssl_pem, "rvi_core/priv/sample_keys/insecure_device_bkey_priv.pem"}}, - {provisioning_key, "rvi_core/priv/sample_keys/insecure_root_key_pub.pem"}, - {authorize_jwt, "rvi_core/priv/sample_keys/insecure_device_key_pub_sign.jwt"}, - {cert_dir, "rvi_core/priv/sample_certs"}, - %% Specify the node address that data_link uses to listen to %% incoming traffic from other rvi nodes. %% @@ -281,6 +274,7 @@ LogLevel = Env("RVI_LOGLEVEL", notice). %% communication in case the access method for %% service_edge_rpc is specified as json_rpc. { json_rpc_address, { MyIP, MyPort+1 } }, % {"127.0.0.1",8801} + { msgpack_rpc_address, { MyIP, MyPort + 21 } }, %% Websocket is used for websocket access, preferably %% through the rvi.js package available for Javascript -- cgit v1.2.1 From 519542e12c73a70ee423c73ed8fe617ca4fa69a1 Mon Sep 17 00:00:00 2001 From: Rudolf J Streif Date: Tue, 23 Feb 2016 10:34:13 -0800 Subject: Changed service prefixes in device configurations to genivi.org Since RVI is an open source project under the umbrella of GENIVI the device prefixes should be genivi.org rather than jlr.com. Signed-off-by: Rudolf J Streif --- priv/config/rvi_debian.config | 28 ++++++++++++++-------------- priv/config/rvi_ubuntu.config | 28 ++++++++++++++-------------- priv/config/rvi_yocto.config | 28 ++++++++++++++-------------- 3 files changed, 42 insertions(+), 42 deletions(-) diff --git a/priv/config/rvi_debian.config b/priv/config/rvi_debian.config index e075fa4..4e1eeb5 100644 --- a/priv/config/rvi_debian.config +++ b/priv/config/rvi_debian.config @@ -60,12 +60,12 @@ LogLevel = Env("RVI_LOGLEVEL", notice). %% replaces the token. %% %% Example: - %% { node_service_prefix, "jlr.com/vin/$rvi_file(/etc/vin,default_vin)"}, + %% { node_service_prefix, "genivi.org/vin/$rvi_file(/etc/vin,default_vin)"}, %% %% will be substituted with the first line from the file %% /etc/vin: %% - %% { node_service_prefix, "jlr.com/vin/2GKEG25HXP4093669"}, + %% { node_service_prefix, "genivi.org/vin/2GKEG25HXP4093669"}, %% %% If /etc/vin cannot be opened, the value default_vin %% will be used instead. @@ -77,12 +77,12 @@ LogLevel = Env("RVI_LOGLEVEL", notice). %% to replace the token. %% %% Example: - %% { node_service_prefix, "jlr.com/vin/$rvi_env(VIN,default_vin)"}, + %% { node_service_prefix, "genivi.org/vin/$rvi_env(VIN,default_vin)"}, %% %% will be substituted with the value of the $VIN environment %% variable: %% - %% { node_service_prefix, "jlr.com/vin/2GKEG25HXP4093669"}, + %% { node_service_prefix, "genivi.org/vin/2GKEG25HXP4093669"}, %% %% If VIN is not a defined environment variable, the value %% default_vin will be used instead. @@ -97,12 +97,12 @@ LogLevel = Env("RVI_LOGLEVEL", notice). %% world wide unique. %% %% Example: - %% { node_service_prefix, "jlr.com/vin/$uuid(default_vin)"}, + %% { node_service_prefix, "genivi.org/vin/$uuid(default_vin)"}, %% %% will be substituted with the value of the root disk UUID: %% %% { node_service_prefix, - %% "jlr.com/vin/afc0a6d8-0264-4f8a-bb3e-51ff8655b51c"}, + %% "genivi.org/vin/afc0a6d8-0264-4f8a-bb3e-51ff8655b51c"}, %% %% If the root UUID cannot be retrieved, the value default_vin %% will be used instead. @@ -135,15 +135,15 @@ LogLevel = Env("RVI_LOGLEVEL", notice). %% %% If a locally connected service registers itself as %% "hvac/fan_speed", and the node_service_prefix is - %% "jlr.com/vin/1234/", this node will announce the service - %% "jlr.com/vin/1234/hvac/fan_speed" as being available + %% "genivi.org/vin/1234/", this node will announce the service + %% "genivi.org/vin/1234/hvac/fan_speed" as being available %% to remotely connected rvi nodes. %% %% Two rvi nodes should never have the same node_service_prefix %% value unless all services add a system-wide unique name %% to it. %% - { node_service_prefix, "jlr.com/vin/$rvi_uuid(default_vin)/"}, + { node_service_prefix, "genivi.org/vin/$rvi_uuid(default_vin)/"}, %% Routing rules determine how to get a message targeting a specific @@ -166,10 +166,10 @@ LogLevel = Env("RVI_LOGLEVEL", notice). %% The service prefix with the longest match against the service targeted %% by the message will be used. %% - %% Example: Targeted service = jlr.com/backend/sota/get_updates + %% Example: Targeted service = genivi.org/backend/sota/get_updates %% - %% Prefix1: { "jlr.com/backend", [...]} - %% Prefix2: { "jlr.com/backend/sota", [...]} + %% Prefix1: { "genivi.org/backend", [...]} + %% Prefix2: { "genivi.org/backend/sota", [...]} %% %% Prefix2 will be used. %% @@ -188,7 +188,7 @@ LogLevel = Env("RVI_LOGLEVEL", notice). ] }, - { "jlr.com/backend/", + { "genivi.org/backend/", %% Which protocol and data link pair to use when transmitting the message %% to the targeted service. If a pair reports a failure, the next pair is tried. [ @@ -199,7 +199,7 @@ LogLevel = Env("RVI_LOGLEVEL", notice). }, %% Used to communicate with vehicles - { "jlr.com/vin/", + { "genivi.org/vin/", [ { proto_json_rpc, { dlink_tcp_rpc, [ broadcast, { interface, "wlan0" } ] } }, { proto_json_rpc, { server_3g, [ initiate_outbound ]} }, diff --git a/priv/config/rvi_ubuntu.config b/priv/config/rvi_ubuntu.config index 9c09cca..65319db 100644 --- a/priv/config/rvi_ubuntu.config +++ b/priv/config/rvi_ubuntu.config @@ -60,12 +60,12 @@ LogLevel = Env("RVI_LOGLEVEL", notice). %% replaces the token. %% %% Example: - %% { node_service_prefix, "jlr.com/vin/$rvi_file(/etc/vin,default_vin)"}, + %% { node_service_prefix, "genivi.org/vin/$rvi_file(/etc/vin,default_vin)"}, %% %% will be substituted with the first line from the file %% /etc/vin: %% - %% { node_service_prefix, "jlr.com/vin/2GKEG25HXP4093669"}, + %% { node_service_prefix, "genivi.org/vin/2GKEG25HXP4093669"}, %% %% If /etc/vin cannot be opened, the value default_vin %% will be used instead. @@ -77,12 +77,12 @@ LogLevel = Env("RVI_LOGLEVEL", notice). %% to replace the token. %% %% Example: - %% { node_service_prefix, "jlr.com/vin/$rvi_env(VIN,default_vin)"}, + %% { node_service_prefix, "genivi.org/vin/$rvi_env(VIN,default_vin)"}, %% %% will be substituted with the value of the $VIN environment %% variable: %% - %% { node_service_prefix, "jlr.com/vin/2GKEG25HXP4093669"}, + %% { node_service_prefix, "genivi.org/vin/2GKEG25HXP4093669"}, %% %% If VIN is not a defined environment variable, the value %% default_vin will be used instead. @@ -97,12 +97,12 @@ LogLevel = Env("RVI_LOGLEVEL", notice). %% world wide unique. %% %% Example: - %% { node_service_prefix, "jlr.com/vin/$uuid(default_vin)"}, + %% { node_service_prefix, "genivi.org/vin/$uuid(default_vin)"}, %% %% will be substituted with the value of the root disk UUID: %% %% { node_service_prefix, - %% "jlr.com/vin/afc0a6d8-0264-4f8a-bb3e-51ff8655b51c"}, + %% "genivi.org/vin/afc0a6d8-0264-4f8a-bb3e-51ff8655b51c"}, %% %% If the root UUID cannot be retrieved, the value default_vin %% will be used instead. @@ -135,15 +135,15 @@ LogLevel = Env("RVI_LOGLEVEL", notice). %% %% If a locally connected service registers itself as %% "hvac/fan_speed", and the node_service_prefix is - %% "jlr.com/vin/1234/", this node will announce the service - %% "jlr.com/vin/1234/hvac/fan_speed" as being available + %% "genivi.org/vin/1234/", this node will announce the service + %% "genivi.org/vin/1234/hvac/fan_speed" as being available %% to remotely connected rvi nodes. %% %% Two rvi nodes should never have the same node_service_prefix %% value unless all services add a system-wide unique name %% to it. %% - { node_service_prefix, "jlr.com/vin/$rvi_uuid(default_vin)/"}, + { node_service_prefix, "genivi.org/vin/$rvi_uuid(default_vin)/"}, %% Routing rules determine how to get a message targeting a specific @@ -166,10 +166,10 @@ LogLevel = Env("RVI_LOGLEVEL", notice). %% The service prefix with the longest match against the service targeted %% by the message will be used. %% - %% Example: Targeted service = jlr.com/backend/sota/get_updates + %% Example: Targeted service = genivi.org/backend/sota/get_updates %% - %% Prefix1: { "jlr.com/backend", [...]} - %% Prefix2: { "jlr.com/backend/sota", [...]} + %% Prefix1: { "genivi.org/backend", [...]} + %% Prefix2: { "genivi.org/backend/sota", [...]} %% %% Prefix2 will be used. %% @@ -188,7 +188,7 @@ LogLevel = Env("RVI_LOGLEVEL", notice). ] }, - { "jlr.com/backend/", + { "genivi.org/backend/", %% Which protocol and data link pair to use when transmitting the message %% to the targeted service. If a pair reports a failure, the next pair is tried. [ @@ -199,7 +199,7 @@ LogLevel = Env("RVI_LOGLEVEL", notice). }, %% Used to communicate with vehicles - { "jlr.com/vin/", + { "genivi.org/vin/", [ { proto_json_rpc, { dlink_tcp_rpc, [ broadcast, { interface, "wlan0" } ] } }, { proto_json_rpc, { server_3g, [ initiate_outbound ]} }, diff --git a/priv/config/rvi_yocto.config b/priv/config/rvi_yocto.config index c0cb162..76a1064 100644 --- a/priv/config/rvi_yocto.config +++ b/priv/config/rvi_yocto.config @@ -61,12 +61,12 @@ LogLevel = Env("RVI_LOGLEVEL", notice). %% replaces the token. %% %% Example: - %% { node_service_prefix, "jlr.com/vin/$rvi_file(/etc/vin,default_vin)"}, + %% { node_service_prefix, "genivi.org/vin/$rvi_file(/etc/vin,default_vin)"}, %% %% will be substituted with the first line from the file %% /etc/vin: %% - %% { node_service_prefix, "jlr.com/vin/2GKEG25HXP4093669"}, + %% { node_service_prefix, "genivi.org/vin/2GKEG25HXP4093669"}, %% %% If /etc/vin cannot be opened, the value default_vin %% will be used instead. @@ -78,12 +78,12 @@ LogLevel = Env("RVI_LOGLEVEL", notice). %% to replace the token. %% %% Example: - %% { node_service_prefix, "jlr.com/vin/$rvi_env(VIN,default_vin)"}, + %% { node_service_prefix, "genivi.org/vin/$rvi_env(VIN,default_vin)"}, %% %% will be substituted with the value of the $VIN environment %% variable: %% - %% { node_service_prefix, "jlr.com/vin/2GKEG25HXP4093669"}, + %% { node_service_prefix, "genivi.org/vin/2GKEG25HXP4093669"}, %% %% If VIN is not a defined environment variable, the value %% default_vin will be used instead. @@ -98,12 +98,12 @@ LogLevel = Env("RVI_LOGLEVEL", notice). %% world wide unique. %% %% Example: - %% { node_service_prefix, "jlr.com/vin/$uuid(default_vin)"}, + %% { node_service_prefix, "genivi.org/vin/$uuid(default_vin)"}, %% %% will be substituted with the value of the root disk UUID: %% %% { node_service_prefix, - %% "jlr.com/vin/afc0a6d8-0264-4f8a-bb3e-51ff8655b51c"}, + %% "genivi.org/vin/afc0a6d8-0264-4f8a-bb3e-51ff8655b51c"}, %% %% If the root UUID cannot be retrieved, the value default_vin %% will be used instead. @@ -136,15 +136,15 @@ LogLevel = Env("RVI_LOGLEVEL", notice). %% %% If a locally connected service registers itself as %% "hvac/fan_speed", and the node_service_prefix is - %% "jlr.com/vin/1234/", this node will announce the service - %% "jlr.com/vin/1234/hvac/fan_speed" as being available + %% "genivi.org/vin/1234/", this node will announce the service + %% "genivi.org/vin/1234/hvac/fan_speed" as being available %% to remotely connected rvi nodes. %% %% Two rvi nodes should never have the same node_service_prefix %% value unless all services add a system-wide unique name %% to it. %% - { node_service_prefix, "jlr.com/vin/$rvi_uuid(default_vin)/"}, + { node_service_prefix, "genivi.org/vin/$rvi_uuid(default_vin)/"}, %% Routing rules determine how to get a message targeting a specific @@ -167,10 +167,10 @@ LogLevel = Env("RVI_LOGLEVEL", notice). %% The service prefix with the longest match against the service targeted %% by the message will be used. %% - %% Example: Targeted service = jlr.com/backend/sota/get_updates + %% Example: Targeted service = genivi.org/backend/sota/get_updates %% - %% Prefix1: { "jlr.com/backend", [...]} - %% Prefix2: { "jlr.com/backend/sota", [...]} + %% Prefix1: { "genivi.org/backend", [...]} + %% Prefix2: { "genivi.org/backend/sota", [...]} %% %% Prefix2 will be used. %% @@ -189,7 +189,7 @@ LogLevel = Env("RVI_LOGLEVEL", notice). ] }, - { "jlr.com/backend/", + { "genivi.org/backend/", %% Which protocol and data link pair to use when transmitting the message %% to the targeted service. If a pair reports a failure, the next pair is tried. [ @@ -200,7 +200,7 @@ LogLevel = Env("RVI_LOGLEVEL", notice). }, %% Used to communicate with vehicles - { "jlr.com/vin/", + { "genivi.org/vin/", [ { proto_json_rpc, { dlink_tcp_rpc, [ broadcast, { interface, "wlan0" } ] } }, { proto_json_rpc, { server_3g, [ initiate_outbound ]} }, -- cgit v1.2.1 From c238130ce0f80c0b4c13a22bc37d3db5a719e905 Mon Sep 17 00:00:00 2001 From: Rudolf J Streif Date: Thu, 11 Feb 2016 14:44:18 -0800 Subject: Resolved Debian Packaging Issues - Fixed rvi.postinst and rvi.postrm files to address lintian complains. - Fixed changelog for correct Debian versioning. - Fixed rules and control for various issues. Signed-off-by: Rudolf J Streif --- debian_template/changelog | 2 +- debian_template/control | 2 +- debian_template/rules | 2 +- debian_template/rvi.postinst | 9 ++------- debian_template/rvi.postrm | 22 +++++++++++----------- 5 files changed, 16 insertions(+), 21 deletions(-) diff --git a/debian_template/changelog b/debian_template/changelog index 378c78c..3d774a4 100644 --- a/debian_template/changelog +++ b/debian_template/changelog @@ -1,4 +1,4 @@ -rvi (0.5.0) jessie; urgency=low +rvi (0.5.0-1) jessie; urgency=low * Initial release diff --git a/debian_template/control b/debian_template/control index a112832..bab7968 100644 --- a/debian_template/control +++ b/debian_template/control @@ -3,7 +3,7 @@ Section: net Priority: optional Maintainer: Magnus Feuer Build-Depends: debhelper (>= 9), libbluetooth-dev, esl-erlang (>= 1:18.2) -Standards-Version: 3.9.5 +Standards-Version: 3.9.6 Homepage: https://github.com/PDXostc/rvi_core Package: rvi diff --git a/debian_template/rules b/debian_template/rules index f332d29..2eb3045 100755 --- a/debian_template/rules +++ b/debian_template/rules @@ -5,7 +5,7 @@ export DH_VERBOSE=1 %: - dh --with systemd $@ + dh $@ override_dh_auto_install: ./scripts/rvi_install \ diff --git a/debian_template/rvi.postinst b/debian_template/rvi.postinst index f6d5de5..10c11fe 100644 --- a/debian_template/rvi.postinst +++ b/debian_template/rvi.postinst @@ -23,10 +23,10 @@ set -e case "$1" in configure) - # Set up our config for apache + # Set up our config cat /proc/sys/kernel/random/uuid > /etc/rvi/device_id echo "RVI Device ID set to $(cat /etc/rvi/device_id) in /etc/rvi/device_id" - update-rc.d rvi defaults + #DEBHELPER# ;; abort-upgrade|abort-remove|abort-deconfigure) @@ -40,11 +40,6 @@ case "$1" in esac -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - db_stop exit 0 diff --git a/debian_template/rvi.postrm b/debian_template/rvi.postrm index 0ded6f8..0c7252f 100644 --- a/debian_template/rvi.postrm +++ b/debian_template/rvi.postrm @@ -6,14 +6,15 @@ set -e # summary of how this script can be called: -# * `configure' -# * `abort-upgrade' -# * `abort-remove' `in-favour' -# -# * `abort-remove' -# * `abort-deconfigure' `in-favour' -# `removing' -# +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package @@ -24,7 +25,8 @@ case "$1" in remove|purge|upgrde|disappear) rm -f /etc/init.d/rvi - update-rc.d rvi remove + rm -rf /etc/rvi + #DEBHELPER# ;; *) @@ -34,8 +36,6 @@ case "$1" in esac -#DEBHELPER# - db_stop exit 0 -- cgit v1.2.1 From 060405d01015c193108d37d9db9c8dfc919f1a3b Mon Sep 17 00:00:00 2001 From: Magnus Feuer Date: Fri, 12 Feb 2016 11:04:51 -0800 Subject: ADded ubuntu build instruction draft --- README_ubuntu_14_04.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 README_ubuntu_14_04.md diff --git a/README_ubuntu_14_04.md b/README_ubuntu_14_04.md new file mode 100644 index 0000000..da36e13 --- /dev/null +++ b/README_ubuntu_14_04.md @@ -0,0 +1,20 @@ +# INSTALL INSTRUCTIONS FOR UBUNTU 14.04 PRECISE + +1. Install dependent libraries +sudo apt-get install python-simplejson python-jsonrpclib libwxgtk2.8-0 + +2. Download esl-erlang 18.2 +wget ttps://packages.erlang-solutions.com/erlang/esl-erlang/FLAVOUR_1_general/esl-erlang_18.2-1~ubuntu~precise_amd64.deb + +3. Install esl-erlang +sudo dpkg -i esl-erlang_18.2-1~ubuntu~precise_amd64.deb + +4. Install RVI +sudo dpkg -i rvi_0.5.0-1ubuntu1_amd64.deb + +5. Setup device keys +Assumes that root key pair is already generated. +doc/rvi_protocol.md + +6. Setup device X.509 Certificates + -- cgit v1.2.1 From 7a989b386748007e759b6e8e92d5688d52ab474f Mon Sep 17 00:00:00 2001 From: Rudolf J Streif Date: Fri, 12 Feb 2016 16:57:22 -0800 Subject: Various Fixes for Debian Packaging 1. Minor typo fixes in Makefile 2. rvi.postrm should not remove /etc/rvi 3. systemd rvi.service a) incorrect path for HOME b) when starting daemon from shell script RemainAfterExit=yes needs to be added to prevent systemd from calling ExecStop right after ExecStart. Signed-off-by: Rudolf J Streif --- Makefile | 4 ++-- debian_template/rvi.postrm | 1 - debian_template/rvi.service | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index ad3bd82..9aaeb4f 100644 --- a/Makefile +++ b/Makefile @@ -101,7 +101,7 @@ ubuntu_package: clean ubuntu_clean escript # Pack up all relevant files, and ubuntu/, necessary for a build. # Add rvi-$(VERSION) at the beginning of each file so -# that theu get packed up into a correctly named subdirectory +# that they get packed up into a correctly named subdirectory # tar czf ./ubuntu_build/rvi_$(VERSION).orig.tar.gz \ --exclude-vcs --transform="s|^|./rvi-$(VERSION)/|" \ @@ -123,7 +123,7 @@ debian_package: clean debian_clean escript # Pack up all relevant files, and debian/, necessary for a build. # Add rvi-$(VERSION) at the beginning of each file so -# that theu get packed up into a correctly named subdirectory +# that they get packed up into a correctly named subdirectory # tar czf ./debian_build/rvi_$(VERSION).orig.tar.gz \ --exclude-vcs --transform="s|^|./rvi-$(VERSION)/|" \ diff --git a/debian_template/rvi.postrm b/debian_template/rvi.postrm index 0c7252f..a0c5d5b 100644 --- a/debian_template/rvi.postrm +++ b/debian_template/rvi.postrm @@ -25,7 +25,6 @@ case "$1" in remove|purge|upgrde|disappear) rm -f /etc/init.d/rvi - rm -rf /etc/rvi #DEBHELPER# ;; diff --git a/debian_template/rvi.service b/debian_template/rvi.service index 5e98259..43788bd 100644 --- a/debian_template/rvi.service +++ b/debian_template/rvi.service @@ -5,14 +5,14 @@ Description=Remote Vehicle Interaction Service Wants=network-online.target [Service] -Environment="HOME=/usr/lib/rvi" +Environment="HOME=/usr/lib/rvi_core" Type=forking StandardOutput=journal StandardError=journal -#ExecStartPre=/opt/rvi-0.5.0/erts-5.10.4/bin/epmd -daemon ExecStart=/bin/sh /usr/bin/rvi_ctl -c /etc/rvi/rvi.config start ExecStop=/bin/sh /usr/bin/rvi_ctl stop GuessMainPID=yes +RemainAfterExit=yes [Install] WantedBy=graphical.target multi-user.target -- cgit v1.2.1 From 02a3e1b495fd2d95624f6f34a282e2374294d23b Mon Sep 17 00:00:00 2001 From: Rudolf J Streif Date: Mon, 15 Feb 2016 12:02:38 -0800 Subject: Comment in rvi.service to reflect Debian The comment said that the script is for Tizen when it actually is for Debian. Signed-off-by: Rudolf J Streif --- debian_template/rvi.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian_template/rvi.service b/debian_template/rvi.service index 43788bd..710b7d1 100644 --- a/debian_template/rvi.service +++ b/debian_template/rvi.service @@ -1,4 +1,4 @@ -# systemd(8) setup usde by Tizen and others. +# systemd(8) setup for Debian [Unit] Description=Remote Vehicle Interaction Service -- cgit v1.2.1 From 147623918ac4d566e06df4f47a2b29b51b110848 Mon Sep 17 00:00:00 2001 From: Rudolf J Streif Date: Mon, 15 Feb 2016 12:49:29 -0800 Subject: Cleaned up SysVInit init and systemd service files Removed the SysVInit init and system service files from the scripts subdirectory and added them to the packaging templates. Debian (and therefore also Ubuntu packaging) expect the init and service files in the packaging subdirectory from there debuild will pick them up automatically. Also adjusted the rules files in debian_template and ubuntu_template to remove the explicit copy of the init file. Added yocto_template to hold the init/service files for Yocto Project builds. Now all SysVInit init scripts and systemd service files are maintained with their respective OS template which makes things more transparent and compliant with the respective OS packaging rules. Signed-off-by: Rudolf J Streif --- Makefile | 7 ++--- debian_template/rules | 2 -- debian_template/rvi.init | 70 ++++++++++++++++++++++++++++++++++++++++++++ scripts/rvi.init.debian | 70 -------------------------------------------- scripts/rvi.init.ubuntu | 70 -------------------------------------------- scripts/rvi.init.yocto | 73 ---------------------------------------------- scripts/rvi.service | 16 ---------- scripts/rvi.service.yocto | 18 ------------ ubuntu_template/rules | 2 -- ubuntu_template/rvi.init | 70 ++++++++++++++++++++++++++++++++++++++++++++ yocto_template/rvi.init | 73 ++++++++++++++++++++++++++++++++++++++++++++++ yocto_template/rvi.service | 17 +++++++++++ 12 files changed, 232 insertions(+), 256 deletions(-) create mode 100755 debian_template/rvi.init delete mode 100755 scripts/rvi.init.debian delete mode 100755 scripts/rvi.init.ubuntu delete mode 100755 scripts/rvi.init.yocto delete mode 100644 scripts/rvi.service delete mode 100644 scripts/rvi.service.yocto create mode 100755 ubuntu_template/rvi.init create mode 100755 yocto_template/rvi.init create mode 100644 yocto_template/rvi.service diff --git a/Makefile b/Makefile index 9aaeb4f..1c594cc 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,6 @@ SRC_LIST=BUILD.md \ rel \ RELEASE.md \ scripts/setup_gen \ - scripts/rvi.service \ scripts/rvi_ctl.template \ scripts/rvi_install \ python/*.py \ @@ -106,8 +105,7 @@ ubuntu_package: clean ubuntu_clean escript tar czf ./ubuntu_build/rvi_$(VERSION).orig.tar.gz \ --exclude-vcs --transform="s|^|./rvi-$(VERSION)/|" \ $(SRC_LIST) \ - ubuntu_template \ - scripts/rvi.init.ubuntu + ubuntu_template rm -rf ubuntu/missing-sources # Unpack the created tar file (cd ./ubuntu_build; tar xf rvi_$(VERSION).orig.tar.gz) @@ -128,8 +126,7 @@ debian_package: clean debian_clean escript tar czf ./debian_build/rvi_$(VERSION).orig.tar.gz \ --exclude-vcs --transform="s|^|./rvi-$(VERSION)/|" \ $(SRC_LIST) \ - debian_template \ - scripts/rvi.init.debian + debian_template rm -rf debian/missing-sources # Unpack the created tar file (cd ./debian_build; tar xf rvi_$(VERSION).orig.tar.gz) diff --git a/debian_template/rules b/debian_template/rules index 2eb3045..b6b8c0a 100755 --- a/debian_template/rules +++ b/debian_template/rules @@ -19,5 +19,3 @@ override_dh_auto_install: install -D -m 0755 ./debian/rvi/usr/lib/rvi_core/rvi_ctl ./debian/rvi/usr/bin/rvi_ctl # Install default config install -D -m 0644 ./priv/config/rvi_ubuntu.config ./debian/rvi/etc/rvi/rvi.config -# Install start/stop scripts - install -D -m 0755 ./scripts/rvi.init.debian ./debian/rvi/etc/init.d/rvi diff --git a/debian_template/rvi.init b/debian_template/rvi.init new file mode 100755 index 0000000..9cd4e59 --- /dev/null +++ b/debian_template/rvi.init @@ -0,0 +1,70 @@ +#!/bin/sh +# +# Copyright (C) 2014, Jaguar Land Rover +# +# This program is licensed under the terms and conditions of the +# Mozilla Public License, version 2.0. The full text of the +# Mozilla Public License is at https://www.mozilla.org/MPL/2.0/ +# +# +# Init.d script to start and stop an RVI system installed +# through an RPM. +# +### BEGIN INIT INFO +# Provides: rvi +# Required-Start: $network $syslog $remote_fs +# Required-Stop: $network $syslog $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start/Stop RVI node at boot time +# Description: Manage Remote Vehicle Interaction Node run state. +### END INIT INFO + +export PATH="/bin/:/usr/bin:/sbin:/usr/sbin" +export HOME=/usr/lib/rvi_core +. /lib/lsb/init-functions + +set -e + +case "$1" in + start) + log_daemon_msg "Starting Remote Vehicle Interaction Node..." "rvi" + if /usr/bin/rvi_ctl -c /etc/rvi/rvi.config start; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + stop) + log_daemon_msg "Stopping Remote Vehicle Interaction Node..." "rvi" + if /usr/bin/rvi_ctl stop; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + + restart) + log_daemon_msg "Restarting Remote Vehicle Interaction Node..." "rvi" + if /usr/bin/rvi_ctl restart; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + + force-reload) + log_daemon_msg "Restarting Remote Vehicle Interaction Node..." "rvi" + if /usr/bin/rvi_ctl restart; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + *) + log_action_msg "Usage: /etc/init.d/rvi {start|stop|restart}" + exit 1 +esac + +exit 0 + diff --git a/scripts/rvi.init.debian b/scripts/rvi.init.debian deleted file mode 100755 index 9cd4e59..0000000 --- a/scripts/rvi.init.debian +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2014, Jaguar Land Rover -# -# This program is licensed under the terms and conditions of the -# Mozilla Public License, version 2.0. The full text of the -# Mozilla Public License is at https://www.mozilla.org/MPL/2.0/ -# -# -# Init.d script to start and stop an RVI system installed -# through an RPM. -# -### BEGIN INIT INFO -# Provides: rvi -# Required-Start: $network $syslog $remote_fs -# Required-Stop: $network $syslog $remote_fs -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Start/Stop RVI node at boot time -# Description: Manage Remote Vehicle Interaction Node run state. -### END INIT INFO - -export PATH="/bin/:/usr/bin:/sbin:/usr/sbin" -export HOME=/usr/lib/rvi_core -. /lib/lsb/init-functions - -set -e - -case "$1" in - start) - log_daemon_msg "Starting Remote Vehicle Interaction Node..." "rvi" - if /usr/bin/rvi_ctl -c /etc/rvi/rvi.config start; then - log_end_msg 0 - else - log_end_msg 1 - fi - ;; - stop) - log_daemon_msg "Stopping Remote Vehicle Interaction Node..." "rvi" - if /usr/bin/rvi_ctl stop; then - log_end_msg 0 - else - log_end_msg 1 - fi - ;; - - restart) - log_daemon_msg "Restarting Remote Vehicle Interaction Node..." "rvi" - if /usr/bin/rvi_ctl restart; then - log_end_msg 0 - else - log_end_msg 1 - fi - ;; - - force-reload) - log_daemon_msg "Restarting Remote Vehicle Interaction Node..." "rvi" - if /usr/bin/rvi_ctl restart; then - log_end_msg 0 - else - log_end_msg 1 - fi - ;; - *) - log_action_msg "Usage: /etc/init.d/rvi {start|stop|restart}" - exit 1 -esac - -exit 0 - diff --git a/scripts/rvi.init.ubuntu b/scripts/rvi.init.ubuntu deleted file mode 100755 index 9cd4e59..0000000 --- a/scripts/rvi.init.ubuntu +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2014, Jaguar Land Rover -# -# This program is licensed under the terms and conditions of the -# Mozilla Public License, version 2.0. The full text of the -# Mozilla Public License is at https://www.mozilla.org/MPL/2.0/ -# -# -# Init.d script to start and stop an RVI system installed -# through an RPM. -# -### BEGIN INIT INFO -# Provides: rvi -# Required-Start: $network $syslog $remote_fs -# Required-Stop: $network $syslog $remote_fs -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Start/Stop RVI node at boot time -# Description: Manage Remote Vehicle Interaction Node run state. -### END INIT INFO - -export PATH="/bin/:/usr/bin:/sbin:/usr/sbin" -export HOME=/usr/lib/rvi_core -. /lib/lsb/init-functions - -set -e - -case "$1" in - start) - log_daemon_msg "Starting Remote Vehicle Interaction Node..." "rvi" - if /usr/bin/rvi_ctl -c /etc/rvi/rvi.config start; then - log_end_msg 0 - else - log_end_msg 1 - fi - ;; - stop) - log_daemon_msg "Stopping Remote Vehicle Interaction Node..." "rvi" - if /usr/bin/rvi_ctl stop; then - log_end_msg 0 - else - log_end_msg 1 - fi - ;; - - restart) - log_daemon_msg "Restarting Remote Vehicle Interaction Node..." "rvi" - if /usr/bin/rvi_ctl restart; then - log_end_msg 0 - else - log_end_msg 1 - fi - ;; - - force-reload) - log_daemon_msg "Restarting Remote Vehicle Interaction Node..." "rvi" - if /usr/bin/rvi_ctl restart; then - log_end_msg 0 - else - log_end_msg 1 - fi - ;; - *) - log_action_msg "Usage: /etc/init.d/rvi {start|stop|restart}" - exit 1 -esac - -exit 0 - diff --git a/scripts/rvi.init.yocto b/scripts/rvi.init.yocto deleted file mode 100755 index adbeef5..0000000 --- a/scripts/rvi.init.yocto +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/sh -# -# Copyright (C) 2014, Jaguar Land Rover -# -# This program is licensed under the terms and conditions of the -# Mozilla Public License, version 2.0. The full text of the -# Mozilla Public License is at https://www.mozilla.org/MPL/2.0/ -# -# -# Init.d script to start and stop an RVI system installed -# through an RPM. -# -### BEGIN INIT INFO -# Provides: rvi -# Default-Start: 3 5 -# Default-Stop: 0 1 2 6 -# Short-Description: RVI Framework -### END INIT INFO - - -export PATH="/bin/:/usr/bin:/sbin:/usr/sbin" -. /etc/init.d/functions - -set -e - -DAEMON_PATH="/opt/rvi" -DAEMON_NAME="rvi" - -case "$1" in - start) - echo -n "Starting $DAEMON_NAME: " - $DAEMON_PATH/rvi_ctl start - RETVAL=$? - if [ $RETVAL -eq 0 ] ; then - echo "OK" - else - echo "FAIL" - fi - ;; - - stop) - echo -n "Stopping $DAEMON_NAME: " - $DAEMON_PATH/rvi_ctl stop - RETVAL=$? - if [ $RETVAL -eq 0 ] ; then - echo "OK" - else - echo "FAIL" - fi - ;; - - restart) - echo -n "Restarting $DAEMON_NAME: " - $DAEMON_PATH/rvi_ctl restart - RETVAL=$? - if [ $RETVAL -eq 0 ] ; then - echo "OK" - else - echo "FAIL" - fi - ;; - - status) - status $DAEMON_NAME - RETVAL=$? - ;; - - *) - echo "usage: $0 { start | stop | status | restart | status }" - ;; -esac - -exit $RETVAL diff --git a/scripts/rvi.service b/scripts/rvi.service deleted file mode 100644 index d58dae0..0000000 --- a/scripts/rvi.service +++ /dev/null @@ -1,16 +0,0 @@ -# systemd(8) setup usde by Tizen and others. -[Unit] -Description=Remote Vehicle Interaction Service -Wants=network-online.target - -[Service] -Environment="HOME=/opt/rvi" -Type=forking -StandardOutput=journal -StandardError=journal -ExecStart=/bin/sh /opt/rvi/rvi_ctl start -ExecStop=/bin/sh /opt/rvi/rvi_ctl stop -GuessMainPID=yes - -[Install] -WantedBy=graphical.target multi-user.target diff --git a/scripts/rvi.service.yocto b/scripts/rvi.service.yocto deleted file mode 100644 index 1ddae5d..0000000 --- a/scripts/rvi.service.yocto +++ /dev/null @@ -1,18 +0,0 @@ -# systemd(8) setup usde by Tizen and others. -[Unit] -Description=Remote Vehicle Interaction Service -Wants=network-online.target - -[Service] -Environment="HOME=/opt/rvi" -Type=forking -StandardOutput=journal -StandardError=journal -ExecStartPre=epmd -daemon -ExecStart=/bin/sh /opt/rvi/rvi.sh -d /etc/opt/rvi -c /etc/opt/rvi/rvi_yocto.config start -ExecStop=/bin/sh /opt/rvi/rvi stop -ExecStopPost=epmd -kill -GuessMainPID=yes - -[Install] -# WantedBy=graphical.target multi-user.target diff --git a/ubuntu_template/rules b/ubuntu_template/rules index 0d2cf19..b6b8c0a 100755 --- a/ubuntu_template/rules +++ b/ubuntu_template/rules @@ -19,5 +19,3 @@ override_dh_auto_install: install -D -m 0755 ./debian/rvi/usr/lib/rvi_core/rvi_ctl ./debian/rvi/usr/bin/rvi_ctl # Install default config install -D -m 0644 ./priv/config/rvi_ubuntu.config ./debian/rvi/etc/rvi/rvi.config -# Install start/stop scripts - install -D -m 0755 ./scripts/rvi.init.ubuntu ./debian/rvi/etc/init.d/rvi diff --git a/ubuntu_template/rvi.init b/ubuntu_template/rvi.init new file mode 100755 index 0000000..9cd4e59 --- /dev/null +++ b/ubuntu_template/rvi.init @@ -0,0 +1,70 @@ +#!/bin/sh +# +# Copyright (C) 2014, Jaguar Land Rover +# +# This program is licensed under the terms and conditions of the +# Mozilla Public License, version 2.0. The full text of the +# Mozilla Public License is at https://www.mozilla.org/MPL/2.0/ +# +# +# Init.d script to start and stop an RVI system installed +# through an RPM. +# +### BEGIN INIT INFO +# Provides: rvi +# Required-Start: $network $syslog $remote_fs +# Required-Stop: $network $syslog $remote_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start/Stop RVI node at boot time +# Description: Manage Remote Vehicle Interaction Node run state. +### END INIT INFO + +export PATH="/bin/:/usr/bin:/sbin:/usr/sbin" +export HOME=/usr/lib/rvi_core +. /lib/lsb/init-functions + +set -e + +case "$1" in + start) + log_daemon_msg "Starting Remote Vehicle Interaction Node..." "rvi" + if /usr/bin/rvi_ctl -c /etc/rvi/rvi.config start; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + stop) + log_daemon_msg "Stopping Remote Vehicle Interaction Node..." "rvi" + if /usr/bin/rvi_ctl stop; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + + restart) + log_daemon_msg "Restarting Remote Vehicle Interaction Node..." "rvi" + if /usr/bin/rvi_ctl restart; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + + force-reload) + log_daemon_msg "Restarting Remote Vehicle Interaction Node..." "rvi" + if /usr/bin/rvi_ctl restart; then + log_end_msg 0 + else + log_end_msg 1 + fi + ;; + *) + log_action_msg "Usage: /etc/init.d/rvi {start|stop|restart}" + exit 1 +esac + +exit 0 + diff --git a/yocto_template/rvi.init b/yocto_template/rvi.init new file mode 100755 index 0000000..adbeef5 --- /dev/null +++ b/yocto_template/rvi.init @@ -0,0 +1,73 @@ +#!/bin/sh +# +# Copyright (C) 2014, Jaguar Land Rover +# +# This program is licensed under the terms and conditions of the +# Mozilla Public License, version 2.0. The full text of the +# Mozilla Public License is at https://www.mozilla.org/MPL/2.0/ +# +# +# Init.d script to start and stop an RVI system installed +# through an RPM. +# +### BEGIN INIT INFO +# Provides: rvi +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Short-Description: RVI Framework +### END INIT INFO + + +export PATH="/bin/:/usr/bin:/sbin:/usr/sbin" +. /etc/init.d/functions + +set -e + +DAEMON_PATH="/opt/rvi" +DAEMON_NAME="rvi" + +case "$1" in + start) + echo -n "Starting $DAEMON_NAME: " + $DAEMON_PATH/rvi_ctl start + RETVAL=$? + if [ $RETVAL -eq 0 ] ; then + echo "OK" + else + echo "FAIL" + fi + ;; + + stop) + echo -n "Stopping $DAEMON_NAME: " + $DAEMON_PATH/rvi_ctl stop + RETVAL=$? + if [ $RETVAL -eq 0 ] ; then + echo "OK" + else + echo "FAIL" + fi + ;; + + restart) + echo -n "Restarting $DAEMON_NAME: " + $DAEMON_PATH/rvi_ctl restart + RETVAL=$? + if [ $RETVAL -eq 0 ] ; then + echo "OK" + else + echo "FAIL" + fi + ;; + + status) + status $DAEMON_NAME + RETVAL=$? + ;; + + *) + echo "usage: $0 { start | stop | status | restart | status }" + ;; +esac + +exit $RETVAL diff --git a/yocto_template/rvi.service b/yocto_template/rvi.service new file mode 100644 index 0000000..7e84825 --- /dev/null +++ b/yocto_template/rvi.service @@ -0,0 +1,17 @@ +# systemd(8) setup usde by Yocto Project +[Unit] +Description=Remote Vehicle Interaction Service +Wants=network-online.target + +[Service] +Environment="HOME=/opt/rvi" +Type=forking +StandardOutput=journal +StandardError=journal +ExecStart=/opt/rvi/rvi_ctl start +ExecStop=/opt/rvi/rvi_ctl stop +GuessMainPID=yes +RemainAfterExit=yes + +[Install] +WantedBy=graphical.target multi-user.target -- cgit v1.2.1 From 8ea6a20ccd5a84451beac54bcd37d7d0f18a000a Mon Sep 17 00:00:00 2001 From: Rudolf J Streif Date: Mon, 15 Feb 2016 16:29:28 -0800 Subject: Debian rvi.service reverted back The Debian rvi.service file reverted back to having /bin/sh as part of ExecStart and ExecStop which should not be used when launching shell scripts with systemd. Signed-off-by: Rudolf J Streif --- debian_template/rvi.service | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian_template/rvi.service b/debian_template/rvi.service index 710b7d1..d9ae979 100644 --- a/debian_template/rvi.service +++ b/debian_template/rvi.service @@ -9,8 +9,8 @@ Environment="HOME=/usr/lib/rvi_core" Type=forking StandardOutput=journal StandardError=journal -ExecStart=/bin/sh /usr/bin/rvi_ctl -c /etc/rvi/rvi.config start -ExecStop=/bin/sh /usr/bin/rvi_ctl stop +ExecStart=/usr/bin/rvi_ctl -c /etc/rvi/rvi.config start +ExecStop=/usr/bin/rvi_ctl stop GuessMainPID=yes RemainAfterExit=yes -- cgit v1.2.1 From 935a8a230608fae5bfcb13a22afeacf218ae59aa Mon Sep 17 00:00:00 2001 From: Rudolf J Streif Date: Mon, 15 Feb 2016 18:47:22 -0800 Subject: Yocto Project SysVInit and systemd setup Adjusted and tested SysVInit script and systemd service file. Signed-off-by: Rudolf J Streif --- yocto_template/rvi.init | 4 ++-- yocto_template/rvi.service | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/yocto_template/rvi.init b/yocto_template/rvi.init index adbeef5..069d78a 100755 --- a/yocto_template/rvi.init +++ b/yocto_template/rvi.init @@ -23,13 +23,13 @@ export PATH="/bin/:/usr/bin:/sbin:/usr/sbin" set -e -DAEMON_PATH="/opt/rvi" +DAEMON_PATH="/opt/rvi_core" DAEMON_NAME="rvi" case "$1" in start) echo -n "Starting $DAEMON_NAME: " - $DAEMON_PATH/rvi_ctl start + $DAEMON_PATH/rvi_ctl -c /etc/opt/rvi/rvi.config start RETVAL=$? if [ $RETVAL -eq 0 ] ; then echo "OK" diff --git a/yocto_template/rvi.service b/yocto_template/rvi.service index 7e84825..7e38b78 100644 --- a/yocto_template/rvi.service +++ b/yocto_template/rvi.service @@ -4,12 +4,12 @@ Description=Remote Vehicle Interaction Service Wants=network-online.target [Service] -Environment="HOME=/opt/rvi" +Environment="HOME=/opt/rvi_core" Type=forking StandardOutput=journal StandardError=journal -ExecStart=/opt/rvi/rvi_ctl start -ExecStop=/opt/rvi/rvi_ctl stop +ExecStart=/opt/rvi_core/rvi_ctl -c /etc/opt/rvi/rvi.config start +ExecStop=/opt/rvi_core/rvi_ctl stop GuessMainPID=yes RemainAfterExit=yes -- cgit v1.2.1 From 1529f48c8c2e4d98a99b2f3a28cbe01f8be9cc43 Mon Sep 17 00:00:00 2001 From: Tatiana Jamison Date: Tue, 23 Feb 2016 16:46:58 -0800 Subject: [53177] Update installation docs Add install instructions for Ubuntu 14.04 Add install instructions for Raspbian Add install instructions for Debian Update build, readme files to point to install instructions --- BUILD.md | 24 +++++++---- INSTALL_debian.md | 113 +++++++++++++++++++++++++++++++++++++++++++++++++ INSTALL_raspbian.md | 109 +++++++++++++++++++++++++++++++++++++++++++++++ INSTALL_ubuntu.md | 104 +++++++++++++++++++++++++++++++++++++++++++++ README.debian_build | 14 ------ README.md | 12 ++++-- README_ubuntu_14_04.md | 20 --------- 7 files changed, 349 insertions(+), 47 deletions(-) create mode 100644 INSTALL_debian.md create mode 100644 INSTALL_raspbian.md create mode 100644 INSTALL_ubuntu.md delete mode 100644 README.debian_build delete mode 100644 README_ubuntu_14_04.md diff --git a/BUILD.md b/BUILD.md index d7367e6..567b32d 100644 --- a/BUILD.md +++ b/BUILD.md @@ -13,8 +13,10 @@ Attribution-ShareAlike 4.0 International. # BUILD INSTRUCTIONS FOR RVI # -This document describes the build process for the RVI project on an -Ubuntu 14.04 Linux machine. +This document describes the build process from source for the RVI +project on an Ubuntu 14.04 Linux machine. Packages are also available +for [Ubuntu](INSTALL_ubuntu.md), [Debian](INSTALL_debian.md), +and [Raspbian](INSTALL_raspbian.md). Please see ```README.md``` for a general description of the project and its structure. @@ -54,7 +56,8 @@ Grade Linux repositories where the code resides: sudo apt-get install git -Also ensure that you have the latest BlueZ Linux Bluetooth headers and that g++ is installed on your system: +Also ensure that you have the latest BlueZ Linux Bluetooth headers +and that g++ is installed on your system: sudo apt-get install libbluetooth-dev g++ @@ -62,22 +65,25 @@ Also ensure that you have the latest BlueZ Linux Bluetooth headers and that g++ Install Erlang 18.2, or a later version 18 release: -Tested packages of the latest versions of Erlang can be downloaded from [packages.erlang-solutions.com](https://www.erlang-solutions.com/resources/download.html) +Tested packages of the latest versions of Erlang can be downloaded from +[packages.erlang-solutions.com](https://www.erlang-solutions.com/resources/download.html) Add the following line to your /etc/apt/sources.list deb http://packages.erlang-solutions.com/ubuntu trusty contrib -Update and install erlang +Update and install esl-erlang sudo apt-get update - sudo apt-get install erlang + sudo apt-get install esl-erlang -**If you receive an authentication error** (such as NO_PUBKEY): note the hexadecimal value (e.g., 6D975C4791E7EE5E) and request the key: +**If you receive an authentication error** (such as NO_PUBKEY): +note the hexadecimal value (e.g., 6D975C4791E7EE5E) and request the key: - sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys HEXVALUE + sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys HEX -where HEXVALUE is the hexadecimal value specified in the error. Then rerun the ```update``` and ```install``` commands. +where HEX is the hexadecimal value specified in the error. +Then rerun the ```update``` and ```install``` commands. ## CLONE THE RVI REPOSITORY ## diff --git a/INSTALL_debian.md b/INSTALL_debian.md new file mode 100644 index 0000000..cd8ef9c --- /dev/null +++ b/INSTALL_debian.md @@ -0,0 +1,113 @@ +Copyright (C) 2014-2016, Jaguar Land Rover + +This document is licensed under Creative Commons +Attribution-ShareAlike 4.0 International. + +**Version 0.5.0** + +# INSTALLATION OF RVI (DEBIAN) # + +This document describes the installation process for the RVI project +on a Debian 8 ("jessie") Linux machine. Packages are also available +for [Ubuntu](INSTALL_ubuntu.md) and [Raspbian](INSTALL_raspbian.md). +See ```BUILD.md``` for building from source. + +Please see ```README.md``` for a general description of the project +and its structure. + +Please see ```CONFIGURE.md``` for details on configuring and launching +the system once it has been built. + +The first milestone of the RVI project is the HVAC demo. Please see +```hvac_demo/README.md``` for details on how to setup, launch and +drive the demo. + +# READER ASSUMPTIONS # +In order to build the system, the reader is assumed to be able to: + +1. Have a basic understanding of Linux system operations. +2. Install packages on the system. + +Please note that the configuration process described in +```CONFIGURE.md``` may have additional skill requirements. + +# PREREQUISITES # + +1. The Debian 8 system has the latest updates installed. +2. The user can gain root access to install packages. +3. There is at least 5GB of space availabled for packages and code. + +---- + +# INSTALLATION PROCESS # + +## INSTALL DEPENDENCIES ## + +Install dependent libraries via ```apt-get``` - note you must be root: + + apt-get install python-jsonrpclib + +## INSTALL ESL-ERLANG ## + +Install `esl-erlang` 18.2, or a later version 18 release: + +Tested packages of the latest versions of Erlang can be downloaded from +[packages.erlang-solutions.com](https://www.erlang-solutions.com/resources/download.html) + +Add the following line to your /etc/apt/sources.list + + deb http://packages.erlang-solutions.com/debian jessie contrib + +Update and install `esl-erlang`: + + apt-get update + apt-get install esl-erlang + +**If you receive an authentication error** (such as NO_PUBKEY): note +the hexadecimal value (e.g., 6D975C4791E7EE5E) and request the key: + + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys HEX + +where HEX is the hexadecimal value specified in the error. +Then rerun the ```update``` and ```install``` commands. + +## DOWNLOAD AND INSTALL RVI ## + +Download the RVI package from the remote location: + + wget http://(TODO)/rvi_0.5.0-1_amd64.deb + +Then install RVI via dpkg: + + sudo dpkg -i rvi_0.5.0-1_amd64.deb + +---- + +## TEST THE RVI SYSTEM ## + +To confirm that RVI has started, use `systemctl` as root user: + + systemctl status rvi + +Expected output: + + ● rvi.service - Remote Vehicle Interaction Service + Loaded: loaded (/lib/systemd/system/rvi.service; disabled) + Active: active (running) since Mon 2016-02-22 14:16:27 PST; 15min ago + Process: 1922 ExecStart=/usr/bin/rvi_ctl -c /etc/rvi/rvi.config start (code=exited, status=0/SUCCESS) + Main PID: 1954 (run_erl) + CGroup: /system.slice/rvi.service + ├─1954 run_erl -daemon /tmp/rvi_1922/ /var/log/rvi exec erl -boot /tmp/rvi_1922/rvi/start -sname rvi -config /tmp/rvi_1922/rvi/sys -setcookie rvi_cookie + ├─1955 /usr/lib/erlang/erts-7.2/bin/beam.smp -- -root /usr/lib/erlang -progname erl -- -home /usr/lib/rvi_core -- -boot /tmp/rvi_1922/rvi/start -sname rvi -config /tmp/rvi_1922/rvi/sys -setcookie rvi_cookie + ├─1962 /usr/lib/erlang/erts-7.2/bin/epmd -daemon + ├─1983 /usr/lib/rvi_core/deps/bt/priv/bt + ├─1989 inet_gethost 4 + └─1990 inet_gethost 4 + +## CREATE A RELEASE ## + +The installer configures a release with default (insecure) credentials. + +See ```CONFIGURE.md``` for additional details on configuring and +creating a developer and production release. + diff --git a/INSTALL_raspbian.md b/INSTALL_raspbian.md new file mode 100644 index 0000000..ea8db69 --- /dev/null +++ b/INSTALL_raspbian.md @@ -0,0 +1,109 @@ +Copyright (C) 2014-2016, Jaguar Land Rover + +This document is licensed under Creative Commons +Attribution-ShareAlike 4.0 International. + +**Version 0.5.0** + +# INSTALLATION OF RVI (RASPBIAN) # + +This document describes the installation process for the RVI project +on Raspbian. Packages are also available for +[Ubuntu](INSTALL_ubuntu.md) and [Raspbian](INSTALL_raspbian.md). +See ```BUILD.md``` for building from source. + +Please see ```README.md``` for a general description of the project +and its structure. + +Please see ```CONFIGURE.md``` for details on configuring and launching +the system once it has been built. + +The first milestone of the RVI project is the HVAC demo. Please see +```hvac_demo/README.md``` for details on how to setup, launch and +drive the demo. + +# READER ASSUMPTIONS # +In order to build the system, the reader is assumed to be able to: + +1. Have a basic understanding of Linux system operations. +2. Install packages on the system. + +Please note that the configuration process described in +```CONFIGURE.md``` may have additional skill requirements. + +# PREREQUISITES # + +1. The Raspbian system has the latest updates installed. +2. The user has sudo access to install packages. +3. There is at least 5GB of space availabled for packages and code. + +---- + +# INSTALLATION PROCESS # + +## GET RASPBIAN PACKAGES ## + +Download Erlang and RVI for Raspbian: + + wget (TODO)/erlang-18.2.tar.bz2 + wget (TODO)/rvi_0.5.0-1_armhf.deb + +Also download the install script: + + wget (TODO)/installRVI + +## INSTALL ERLANG AND RVI ## + +Make the install script executable: + + sudo chmod +x installRVI + +Then run the install script: + + ./installRVI + +This does the following: + +1. Extracts the Erlang tarball +2. Installs the required Erlang packages + * `erlang-base` + * `erlang-asnl` + * `erlang-crypto` + * `erlang-eunit` + * `erlang-public key` + * `erlang-ssl` + * `erlang-syntax-tools` +3. Installs other dependencies (`bluez` and `python-jsonrpclib`) +4. Installs `rvi` +5. Starts `rvi` via `systemctl` +6. Checks the status of `rvi` via `systemctl`. + +---- + +## TEST THE RVI SYSTEM ## + +To confirm that RVI has started, use `systemctl` as root user: + + systemctl status rvi + +Expected output: + + ● rvi.service - Remote Vehicle Interaction Service + Loaded: loaded (/lib/systemd/system/rvi.service; disabled) + Active: active (running) since Tue 2016-02-23 18:30:03 UTC; 48ms ago + Process: 6049 ExecStart=/usr/bin/rvi_ctl -c /etc/rvi/rvi.config start (code=exited, status=0/SUCCESS) + Main PID: 6081 (run_erl) + CGroup: /system.slice/rvi.service + ├─6081 run_erl -daemon /tmp/rvi_6049/ /var/log/rvi exec erl -boot /tmp/rvi_6049/rvi/start -sname rvi -config /tmp/rvi_6049/rvi/sys -setcookie rvi_cookie + ├─6084 /usr/lib/erlang/erts-7.2/bin/erlexec -boot /tmp/rvi_6049/rvi/start -sname rvi -config /tmp/rvi_6049/rvi/sys -setcookie rvi_cookie + ├─6093 sh -c "/usr/lib/erlang/erts-7.2/bin/epmd" -daemon + └─6094 /usr/lib/erlang/erts-7.2/bin/epmd -daemon + + +## CREATE A RELEASE ## + +The installer configures a release with default (insecure) credentials. + +See ```CONFIGURE.md``` for additional details on configuring and +creating a developer and production release. + diff --git a/INSTALL_ubuntu.md b/INSTALL_ubuntu.md new file mode 100644 index 0000000..fa4a8f7 --- /dev/null +++ b/INSTALL_ubuntu.md @@ -0,0 +1,104 @@ +Copyright (C) 2014-2016, Jaguar Land Rover + +This document is licensed under Creative Commons +Attribution-ShareAlike 4.0 International. + +**Version 0.5.0** + +# INSTALLATION OF RVI (UBUNTU 14.04 TRUSTY) # + +This document describes the installation process for the RVI project on +an Ubuntu 14.04 Linux machine. Packages are also available for +[Debian](BUILD_debian.md) and [Raspbian](BUILD_raspbian.md). +See [```BUILD.md```](BUILD.md) for building from source. + +Please see [```README.md```](README.md) for a general description of the project +and its structure. + +Please see [```CONFIGURE.md```](CONFIGURE.md) for details on configuring and launching +the system once it has been built. + +The first milestone of the RVI project is the HVAC demo. Please see +```hvac_demo/README.md``` for details on how to setup, launch and +drive the demo. + +# READER ASSUMPTIONS # +In order to build the system, the reader is assumed to be able to: + +1. Have a basic understanding of Linux system operations. +2. Install packages on the system. + +Please note that the configuration process described in +```CONFIGURE.md``` may have additional skill requirements. + +# PREREQUISITES # + +1. The Ubuntu 14.04 system have the latest updates installed. +2. The user can gain root access to install packages. +3. There is at least 5GB of space availabled for packages and code. + +---- + +
+ +# INSTALLATION PROCESS # + +## INSTALL DEPENDENCIES ## + +Install dependent libraries via `apt-get`: + + sudo apt-get install python-jsonrpclib + +## INSTALL ESL-ERLANG ## + +Install `esl-erlang` 18.2, or a later version 18 release: + +Tested packages of the latest versions of Erlang can be downloaded from +[packages.erlang-solutions.com](https://www.erlang-solutions.com/resources/download.html) + +Add the following line to your /etc/apt/sources.list + + deb http://packages.erlang-solutions.com/ubuntu trusty contrib + +Update and install esl-erlang + + sudo apt-get update + sudo apt-get install esl-erlang + +**If you receive an authentication error** (such as NO_PUBKEY): +note the hexadecimal value (e.g., 6D975C4791E7EE5E) and request the key: + + sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys HEX + +where HEX is the hexadecimal value specified in the error. +Then rerun the ```update``` and ```install``` commands. + +## DOWNLOAD AND INSTALL RVI ## + +Download the RVI package from the remote location: + + wget http://(TODO)/rvi_0.5.0-1ubuntu1_amd64.deb + +Then install RVI via dpkg: + + sudo dpkg -i rvi_0.5.0-1ubuntu1_amd64.deb + +---- + +## TEST THE RVI SYSTEM ## + +To confirm that RVI has installed successfully, run: + + sudo service rvi status + +Expected output: + + TODO + +## CREATE A RELEASE ## + +The installer configures a release with default (insecure) values. + +See ```CONFIGURE.md``` for details on configuring and creating a +developer and production release that can be launched. + diff --git a/README.debian_build b/README.debian_build deleted file mode 100644 index 8614727..0000000 --- a/README.debian_build +++ /dev/null @@ -1,14 +0,0 @@ -Erlang - -apt-get install devscripts -apt-get install bluez -apt-get install libbluetooth-dev -apt-get install git -apt-get install g++ -apt-get install make -apt-get install python-jsonrpclib -apt-get install libwxgtk3.0-0 -apt-get install dh-systemd - -wget https://packages.erlang-solutions.com/erlang/esl-erlang/FLAVOUR_1_general/esl-erlang_18.2-1~debian~jessie_amd64.deb -dpkg -i esl-erlang_18.2-1~debian~jessie_amd64.deb diff --git a/README.md b/README.md index 1c1b405..c23db32 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -Copyright (C) 2014-2015 Jaguar Land Rover +Copyright (C) 2014-2016 Jaguar Land Rover This document is licensed under Creative Commons Attribution-ShareAlike 4.0 International. -# REMOTE VEHICLE INTERACTION (RVI) 0.4.0 # +# REMOTE VEHICLE INTERACTION (RVI) 0.5.0 # This document gives a brief introduction to the codebase of the RVI project and explains the reasoning behind some of the technical @@ -14,10 +14,14 @@ For a high level description, with an exhaustive master usecase walkthrough, please see the High Level Design document [here](https://wiki.automotivelinux.org/_media/eg-rvi/15-456-poc-rvi-hld_reva.pdf) -Git branch management is JLR OSTCs standard git document -[Git strategy](https://docs.google.com/document/d/1xG86q2o5Y-aSn7m8QARIH8hcTpH_yNMWCLQJD47IP48/edit/) +Git branch management is JLR OSTCs standard git document: +[Git strategy](https://docs.google.com/document/d/1xG86q2o5Y-aSn7m8QARIH8hcTpH_yNMWCLQJD47IP48/edit/) | [Git strategy](https://docs.google.com/document/d/1ko12dTXGeb2-E18SHOzGuC1318hGYSCIq3ADSzFOlGM/edit) +Packages are available for some distributions. See installation +instructions for [Ubuntu](INSTALL_ubuntu.md), [Debian](INSTALL_debian.md), +and [Raspbian](INSTALL_raspbian.md). + For build instructions, please check the build instructions: [Markdown](BUILD.md) | [PDF](doc/pdf/BUILD.pdf) diff --git a/README_ubuntu_14_04.md b/README_ubuntu_14_04.md deleted file mode 100644 index da36e13..0000000 --- a/README_ubuntu_14_04.md +++ /dev/null @@ -1,20 +0,0 @@ -# INSTALL INSTRUCTIONS FOR UBUNTU 14.04 PRECISE - -1. Install dependent libraries -sudo apt-get install python-simplejson python-jsonrpclib libwxgtk2.8-0 - -2. Download esl-erlang 18.2 -wget ttps://packages.erlang-solutions.com/erlang/esl-erlang/FLAVOUR_1_general/esl-erlang_18.2-1~ubuntu~precise_amd64.deb - -3. Install esl-erlang -sudo dpkg -i esl-erlang_18.2-1~ubuntu~precise_amd64.deb - -4. Install RVI -sudo dpkg -i rvi_0.5.0-1ubuntu1_amd64.deb - -5. Setup device keys -Assumes that root key pair is already generated. -doc/rvi_protocol.md - -6. Setup device X.509 Certificates - -- cgit v1.2.1 From 269d60a0545cfb86c2467a09ddb2c4b9b9e31fca Mon Sep 17 00:00:00 2001 From: Rudolf J Streif Date: Tue, 23 Feb 2016 20:55:36 -0800 Subject: Removed Erlang packages as runtime dependency from Raspbian build Since there currently is no official Erlang 18.2 package for Raspbian that could be installed from the Debian/Raspbian repos using apt-get having this dependency in the RVI package causes issues with dpkg on the target. Since we manually install the Erlang packages on the RPi using dpkg directly the package dependency on erlang cannot be fulfilled as this package is a meta package that only lists the other Erlang packages as dependencies. However, meta packages only work with apt-get which provides dependency resolution which dpkg does not. Even if you install RVI with dpkg -i --ignore-depends=erlang rvi_0.5.0-1_armhf.deb dpkg and apt-get will continue to complain that erlang is not installed and refuse to install any package despite the fact that the dependencies are fulfilled. We can reinstantiate this in the future when Raspbian provides Erlang 18.2. Signed-off-by: Rudolf J Streif --- raspbian_template/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/raspbian_template/control b/raspbian_template/control index 0fb7b83..f0836a6 100644 --- a/raspbian_template/control +++ b/raspbian_template/control @@ -8,6 +8,6 @@ Homepage: https://github.com/PDXostc/rvi_core Package: rvi Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, bluez, erlang (>= 1:18.2), python-jsonrpclib (>= 0.1.3-1), python (>= 2.7.9-1) +Depends: ${shlibs:Depends}, ${misc:Depends}, bluez, python-jsonrpclib (>= 0.1.3-1), python (>= 2.7.9-1) Description: Remote Vehicle Interaction GENIVI Remote Vehicle Interaction Core -- cgit v1.2.1 From 5bfeebd7c59a531977ed50c1f4009fd6dcbd94e3 Mon Sep 17 00:00:00 2001 From: Tatiana Jamison Date: Wed, 24 Feb 2016 08:59:17 -0800 Subject: [53177] Fix typos Fix typos in README.md --- README.md | 49 +++++++++++++++++++++++++------------------------ 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index c23db32..869e39c 100644 --- a/README.md +++ b/README.md @@ -82,8 +82,8 @@ RVI shall be able to function over transient and unreliable data channels, but a # TECHNOLOGY CHOICES # The following chapters describe the technology choices made for the reference implementation. An overall goal was to avoid technology -lock-in while easing adoption by allowing organiztions to replace -individual components with in-house developted variants using their +lock-in while easing adoption by allowing organizations to replace +individual components with in-house developed variants using their own technology. ## INTERCHANGEABILITY ## @@ -104,7 +104,7 @@ and a backend server, in an RVI network. An organization is free to integrate with any existing protocols, or develop new ones, as necessary. -The reference implemantation provides an example of how to handle a +The reference implementation provides an example of how to handle a classic client-server model. The RVI design, however, can easily handle such cases such as wakeup-SMS (used to get a vehicle to call in to a server), packet-based data, peer-to-peer networks without any @@ -116,7 +116,7 @@ management and data encoding / decoding over any media (IP or non-IP). [Erlang](http://www.erlang.org) was chosen to implementation the core components of the RVI system. Each component (see the [HLD](https://wiki.automotivelinux.org/_media/eg-rvi/15-456-poc-rvi-hld_reva.pdf) -for details) run as an erlang application inside a single erlang node. +for details) run as an Erlang application inside a single Erlang node. Several reasons exist for this somewhat unorthodox choice of implementation language: @@ -124,32 +124,32 @@ implementation language: * **Robustness**
Erlang has the ability to gracefully handle component crashes / restarts without availability degradation. This makes a deployment -resiliant against the occasional bug and malfunction. In a similar +resilient against the occasional bug and malfunction. In a similar manner, redundant sites can be setup to handle catastrophic failures and geographically distributed deployments. * **Tool availability**
-There are a multitude of open source erlang components available to +There are a multitude of open source Erlang components available to handle SMS, GPIO, CAN buses, GPS, PPP links, and almost any protocol -out there. Since erlang was designed to handle the mobile +out there. Since Erlang was designed to handle the mobile communication requirements that is at the center of the connected vehicle, integrating with existing systems and protocols is often a straight-forward process. * **Scalability**
-The concurrent nature of an erlang system sets the stage for +The concurrent nature of an Erlang system sets the stage for horizontal scalaility by simply adding hosts to a deployment, allowing -an organziation to expand from a pilot fleet to a full fledged +an organization to expand from a pilot fleet to a full fledged international deployment. * **Carrier grade availability**
-The robustness and scalaiblity, in conjunction with the built-in -erlang feature of runtime code upgrades, is a part of erlang's +The robustness and scalability, in conjunction with the built-in +Erlang feature of runtime code upgrades, is a part of Erlang's five-nines uptime design that is rapidly becoming a core requirement of the automotive industry. * **Proven embedded system solution**
-Erlang has been adapted to operate well in embeded environments +Erlang has been adapted to operate well in embedded environments with unreliable power, limited resources, and the need to integrate with a wide variety of hardware. @@ -157,7 +157,7 @@ with a wide variety of hardware. Python is used to implement all demonstrations, beginning with the HVAC demo available in the `hvac_demo` subdirectory. -By using Python for the demos, which is better known than erlang, +By using Python for the demos, which is better known than Erlang, examples are given on how to write applications and services interfacing with the RVI system. @@ -170,38 +170,39 @@ understanding and adoption. One example is the use of JSON-RPC (over HTTP) to handle internal communication between components in a single Erlang node. -Using a traditional erlang solution such as genserver, the +Using a traditional Erlang solution such as genserver, the overhead for internal transactions could be cut to a few percent in comparison with the current JSON-RPC implementation. That route, however, would force all components of the RVI system to be -implemented in Erlang, thus severly limiting an organizations +implemented in Erlang, thus severely limiting an organization's abilities to replace individual components with their own versions. ## CODE STRATEGY ## -All code in the RVI reference implementaion and its demonstrations are +All code in the RVI reference implementation and its demonstrations are written with a minimum of complexity and "magic". Readability is -paramount, even if it severly impact performance and memory usage. +paramount, even if it severely impacts performance and memory usage. -All components in the RVI are kept small and distcinct, with a -well-defined JSON-RPC external interface and a simple call flows. + +All components in the RVI are kept small and distinct, with a +well-defined JSON-RPC external interface and simple call flows. Only three external modules (lager, bert and exo) are used by the code, with two more (setup and edown) used for release and documentation management. The reason for minimizing external module usage is to make the code -comprehensible and minimize the time a developer has to travesrse +comprehensible and minimize the time a developer has to traverse through obscure libraries trying to understand what a specific call flow actually does. -The entire reference implementation (as of the first alpa release) is +The entire reference implementation (as of the first alpha release) is 2800 lines of code, broken down into six standalone modules and one library of shared primitive functions. ## JSON-RPC ## -JSON-RPC is used for all communication between components in an RVI -system, and also to communicate with services connected to it. The -ubiquity of JSON-RPC, and its close relationship with Java/Javascript, +JSON-RPC is used for all communication between components in an RVI +system, and also to communicate with services connected to it. The +ubiquity of JSON-RPC, and its close relationship with Java/JavaScript, provides maximum of freedom of technology choices when new components, services, and applications are developed. -- cgit v1.2.1 From f7ea6e3b12dd343cefd0565be87cef4329e51124 Mon Sep 17 00:00:00 2001 From: Ulf Wiger Date: Wed, 24 Feb 2016 18:10:16 +0100 Subject: doc and code bug fixes --- README.md | 16 +- components/dlink_bt/src/dlink_bt_rpc.erl | 19 +- components/dlink_sms/src/dlink_sms_rpc.erl | 25 +- components/dlink_tcp/src/dlink_tcp_rpc.erl | 58 ++-- components/dlink_tls/src/dlink_tls_rpc.erl | 47 ++- components/proto_json/src/proto_json_rpc.erl | 13 +- components/proto_msgpack/src/proto_msgpack_rpc.erl | 10 +- components/service_edge/src/service_edge_rpc.erl | 2 +- doc/rvi_certificates.md | 252 +++++++++++++++ doc/rvi_fragmentation.md | 9 +- doc/rvi_protocol.md | 337 +++++---------------- doc/rvi_services.md | 31 +- test/rvi_core_SUITE.erl | 62 ++-- 13 files changed, 489 insertions(+), 392 deletions(-) create mode 100644 doc/rvi_certificates.md diff --git a/README.md b/README.md index 1c1b405..d4299c8 100644 --- a/README.md +++ b/README.md @@ -18,14 +18,26 @@ Git branch management is JLR OSTCs standard git document [Git strategy](https://docs.google.com/document/d/1xG86q2o5Y-aSn7m8QARIH8hcTpH_yNMWCLQJD47IP48/edit/) [Git strategy](https://docs.google.com/document/d/1ko12dTXGeb2-E18SHOzGuC1318hGYSCIq3ADSzFOlGM/edit) -For build instructions, please check the build instructions: +For build instructions, please check the **build instructions**: [Markdown](BUILD.md) | [PDF](doc/pdf/BUILD.pdf) -For configuration and launch instructions, please check the configuration documentation: +For configuration and launch instructions, please check the **configuration documentation**: [Markdown](CONFIGURE.md) | [PDF](doc/pdf/CONFIGURE.pdf) +For instructions on how to create RVI Core certificates, keys and credentials, please check the **certificates documentation**: +[Markdown](doc/rvi_certificates.md) | +[PDF](doc/pdf/rvi_certificates.pdf) + +For instructions on using the Services API, please check the **services documentation**: +[Markdown](doc/rvi_services.md) | +[PDF](doc/pdf/rvi_services.pdf) + +For a detailed description of the RVI Core Peer-to-peer protocol, please check the **rvi_protocol documentation**: +[Markdown](doc/rvi_protocol.md) | +[PDF](doc/pdf/rvi_protocol.pdf) + Technical RVI disussions are held at the GENIVI project mailing list: [GENIVI](https://lists.genivi.org/mailman/listinfo/genivi-projects) diff --git a/components/dlink_bt/src/dlink_bt_rpc.erl b/components/dlink_bt/src/dlink_bt_rpc.erl index 74a49cc..c4276bd 100644 --- a/components/dlink_bt/src/dlink_bt_rpc.erl +++ b/components/dlink_bt/src/dlink_bt_rpc.erl @@ -338,6 +338,13 @@ process_authorize(FromPid, PeerBTAddr, PeerBTChannel, ?info("dlink_bt:authorize(): Protocol: ~p", [ Protocol ]), ?debug("dlink_bt:authorize(): Credentials: ~p", [ Credentials ]), + case Protocol of + <<"1.", _/binary>> -> ok; + undefined -> ok; + _ -> + throw({protocol_failure, {unknown_version, Protocol}}) + end, + %% If FromPid (the genserver managing the socket) is not yet registered %% with the conneciton manager, this is an incoming connection %% from the client. We should respond with our own authorize followed by @@ -368,9 +375,15 @@ handle_socket(FromPid, PeerBTAddr, PeerChannel, data, ?DLINK_ARG_CREDENTIALS], Elems, undefined), - process_authorize(FromPid, PeerBTAddr, RemoteChannel, - RemoteAddress, RemoteChannel, - RVIProtocol, Credentials, CS); + try + process_authorize(FromPid, PeerBTAddr, RemoteChannel, + RemoteAddress, RemoteChannel, + RVIProtocol, Credentials, CS) + catch + throw:{protocol_failure, What} -> + ?error("Protocol failure (~p): ~p", [FromPid, What]), + exit(FromPid, protocol_failure) + end; ?DLINK_CMD_SERVICE_ANNOUNCE -> [ Status, diff --git a/components/dlink_sms/src/dlink_sms_rpc.erl b/components/dlink_sms/src/dlink_sms_rpc.erl index 4bf5f14..2f20d2d 100644 --- a/components/dlink_sms/src/dlink_sms_rpc.erl +++ b/components/dlink_sms/src/dlink_sms_rpc.erl @@ -305,12 +305,10 @@ handle_sms(FromPid, Addr, data, Payload, [CompSpec]) -> case opt(?DLINK_ARG_CMD, Elems, undefined) of ?DLINK_CMD_AUTHORIZE -> [ TransactionID, - RemoteAddress, ProtoVersion, CertificatesTmp, Signature ] = opts([?DLINK_ARG_TRANSACTION_ID, - ?DLINK_ARG_ADDRESS, ?DLINK_ARG_VERSION, ?DLINK_ARG_CERTIFICATES, ?DLINK_ARG_SIGNATURE], @@ -321,8 +319,15 @@ handle_sms(FromPid, Addr, data, Payload, [CompSpec]) -> {array, C} -> C; undefined -> [] end, - process_authorize(FromPid, Addr, TransactionID, RemoteAddress, - ProtoVersion, Signature, Certificates, CompSpec); + try + process_authorize( + FromPid, Addr, TransactionID, + ProtoVersion, Signature, Certificates, CompSpec) + catch + throw:{protocol_failure, What} -> + ?error("Protocol failure (~p): ~p", [FromPid, What]), + exit(FromPid, protocol_failure) + end; ?DLINK_CMD_SERVICE_ANNOUNCE -> [ TransactionID, @@ -613,14 +618,20 @@ availability_msg(Availability, Services) -> status_string(available ) -> ?DLINK_ARG_AVAILABLE; status_string(unavailable) -> ?DLINK_ARG_UNAVAILABLE. -process_authorize(FromPid, PeerAddr, TransactionID, RemoteAddress, +process_authorize(FromPid, PeerAddr, TransactionID, ProtoVersion, Signature, Certificates, CompSpec) -> ?info("dlink_sms:authorize(): Peer Address: ~p" , [PeerAddr]), - ?info("dlink_sms:authorize(): Remote Address: ~p" , [RemoteAddress]), ?info("dlink_sms:authorize(): Protocol Ver: ~p" , [ProtoVersion]), ?debug("dlink_sms:authorize(): TransactionID: ~p", [TransactionID]), ?debug("dlink_sms:authorize(): Signature: ~p", [Signature]), + case ProtoVersion of + <<"1.", _/binary>> -> ok; + undefined -> ok; + _ -> + throw({protocol_failure, {unknown_version, ProtoVersion}}) + end, + Conn = {PeerAddr, 0}, % add dummy port (necessary?) case validate_auth_jwt(Signature, Certificates, Conn, CompSpec) of true -> @@ -631,14 +642,12 @@ process_authorize(FromPid, PeerAddr, TransactionID, RemoteAddress, end. send_authorize(Pid, CompSpec) -> - LocalAddr = rvi_common:node_msisdn(), sms_connection:send_auth( Pid, term_to_json( {struct, [ { ?DLINK_ARG_TRANSACTION_ID, 1 }, { ?DLINK_ARG_CMD, ?DLINK_CMD_AUTHORIZE }, - { ?DLINK_ARG_ADDRESS, LocalAddr }, { ?DLINK_ARG_VERSION, ?DLINK_SMS_VERSION }, { ?DLINK_ARG_CERTIFICATES, {array, get_certificates(CompSpec)} }, { ?DLINK_ARG_SIGNATURE, get_authorize_jwt(CompSpec) } ]})). diff --git a/components/dlink_tcp/src/dlink_tcp_rpc.erl b/components/dlink_tcp/src/dlink_tcp_rpc.erl index 31184bd..f094fff 100644 --- a/components/dlink_tcp/src/dlink_tcp_rpc.erl +++ b/components/dlink_tcp/src/dlink_tcp_rpc.erl @@ -338,19 +338,20 @@ handle_socket_(FromPid, PeerIP, PeerPort, data, Elems, CompSpec) -> case opt(?DLINK_ARG_CMD, Elems, undefined) of ?DLINK_CMD_AUTHORIZE -> ?debug("got authorize ~s:~w", [PeerIP, PeerPort]), - [ RemoteAddress, - RemotePort, - ProtoVersion, + [ ProtoVersion, Credentials ] = - opts([?DLINK_ARG_ADDRESS, - ?DLINK_ARG_PORT, - ?DLINK_ARG_VERSION, + opts([?DLINK_ARG_VERSION, ?DLINK_ARG_CREDENTIALS], Elems, undefined), - process_authorize(FromPid, PeerIP, PeerPort, - RemoteAddress, RemotePort, - ProtoVersion, Credentials, CS); + try + process_authorize(FromPid, PeerIP, PeerPort, + ProtoVersion, Credentials, CS) + catch + throw:{protocol_failure, What} -> + ?error("Protocol failure (~p): ~p", [FromPid, What]), + exit(FromPid, protocol_failure) + end; ?DLINK_CMD_SERVICE_ANNOUNCE -> ?debug("got service_announce ~s:~w", [PeerIP, PeerPort]), @@ -663,19 +664,18 @@ availability_msg(Availability, Services, CompSpec) -> status_string(available ) -> ?DLINK_ARG_AVAILABLE; status_string(unavailable) -> ?DLINK_ARG_UNAVAILABLE. -bin(S) -> - iolist_to_binary(S). +%% bin(S) -> +%% iolist_to_binary(S). -process_authorize(FromPid, PeerIP, PeerPort, RemoteAddress, - RemotePort, ProtoVersion, Credentials, CompSpec) -> +process_authorize(FromPid, PeerIP, PeerPort, + ProtoVersion, Credentials, CompSpec) -> ?info("dlink_tcp:authorize(): Peer Address: ~p:~p", [PeerIP, PeerPort ]), - ?info("dlink_tcp:authorize(): Remote Address: ~p~p", [ RemoteAddress, RemotePort ]), ?info("dlink_tcp:authorize(): Protocol Ver: ~p", [ ProtoVersion ]), ?debug("dlink_tcp:authorize(): Credentials: ~p", [ [authorize_keys:abbrev_bin(C) || C <- Credentials] ]), F = fun() -> - process_authorize_(FromPid, PeerIP, PeerPort, RemoteAddress, - RemotePort, ProtoVersion, Credentials, CompSpec) + process_authorize_(FromPid, PeerIP, PeerPort, + ProtoVersion, Credentials, CompSpec) end, case connection_manager:find_connection_by_address(PeerIP, PeerPort) of not_found -> @@ -704,27 +704,23 @@ deconflict_conns(APid, BPid, CsA, F) -> end. -process_authorize_(FromPid, PeerIP, PeerPort, RemoteAddress, RemotePort, - _ProtoVersion, Credentials, CompSpec) -> - {NRemoteAddress, NRemotePort} = Conn = {PeerIP, PeerPort}, - %% {NRemoteAddress, NRemotePort} = Conn = - %% case { RemoteAddress, RemotePort } of - %% { "0.0.0.0", 0 } -> - %% ?info("dlink_tcp:authorize(): Remote is behind firewall. Will use ~p:~p", - %% [ PeerIP, PeerPort]), - %% { PeerIP, PeerPort }; - %% _ -> { RemoteAddress, RemotePort} - %% end, - log(result, "auth ~s:~w", [NRemoteAddress, NRemotePort], CompSpec), +process_authorize_(FromPid, PeerIP, PeerPort, + ProtoVersion, Credentials, CompSpec) -> + case ProtoVersion of + <<"1.", _/binary>> -> ok; + undefined -> ok; + _ -> + ?error("Unknown/unsupported protocol version: ~p", [ProtoVersion]), + throw({protocol_failure, {unknown_version, ProtoVersion}}) + end, + Conn = {PeerIP, PeerPort}, + log(result, "auth ~s:~w", [PeerIP, PeerPort], CompSpec), authorize_rpc:store_creds(CompSpec, Credentials, Conn), connection_authorized(FromPid, Conn, CompSpec). send_authorize(Pid, CompSpec) -> - {LocalIP, LocalPort} = rvi_common:node_address_tuple(), connection:send(Pid, [{ ?DLINK_ARG_CMD, ?DLINK_CMD_AUTHORIZE }, - { ?DLINK_ARG_ADDRESS, bin(LocalIP) }, - { ?DLINK_ARG_PORT, integer_to_binary(LocalPort) }, { ?DLINK_ARG_VERSION, ?DLINK_TCP_VERSION }, { ?DLINK_ARG_CREDENTIALS, get_credentials(CompSpec) } | log_id_tail(CompSpec) ]). diff --git a/components/dlink_tls/src/dlink_tls_rpc.erl b/components/dlink_tls/src/dlink_tls_rpc.erl index 6a90129..ad0d512 100644 --- a/components/dlink_tls/src/dlink_tls_rpc.erl +++ b/components/dlink_tls/src/dlink_tls_rpc.erl @@ -365,16 +365,20 @@ handle_socket(FromPid, PeerIP, PeerPort, data, Elems, CompSpec) -> case opt(?DLINK_ARG_CMD, Elems, undefined) of ?DLINK_CMD_AUTHORIZE -> ?debug("got authorize ~s:~w", [PeerIP, PeerPort]), - [ RemoteAddress, - RemotePort, + [ ProtoVersion, Credentials ] = - opts([?DLINK_ARG_ADDRESS, - ?DLINK_ARG_PORT, + opts([?DLINK_ARG_VERSION, ?DLINK_ARG_CREDENTIALS], Elems, undefined), - process_authorize(FromPid, PeerIP, PeerPort, RemoteAddress, RemotePort, - Credentials, CS); + try + process_authorize(FromPid, PeerIP, PeerPort, + Credentials, ProtoVersion, CS) + catch + throw:{protocol_failure, What} -> + ?error("Protocol failure (~p): ~p", [FromPid, What]), + exit(FromPid, protocol_failure) + end; %% ?DLINK_CMD_CRED_EXCHANGE -> %% ?debug("got cred exch ~s:~w", [PeerIP, PeerPort]), @@ -684,40 +688,29 @@ availability_msg(Availability, Services) -> status_string(available ) -> ?DLINK_ARG_AVAILABLE; status_string(unavailable) -> ?DLINK_ARG_UNAVAILABLE. -process_authorize(FromPid, PeerIP, PeerPort, RemoteAddress, - RemotePort, Credentials, CompSpec) -> +process_authorize(FromPid, PeerIP, PeerPort, + Credentials, ProtoVersion, CompSpec) -> ?info("dlink_tls:authorize(): Peer Address: ~s:~p", [PeerIP, PeerPort ]), - ?info("dlink_tls:authorize(): Remote Address: ~s:~p", [ RemoteAddress, RemotePort ]), - - {NRemoteAddress, NRemotePort} = Conn = {PeerIP, PeerPort}, - %% { NRemoteAddress, NRemotePort} = Conn = - %% case { RemoteAddress, RemotePort } of - %% { <<"0.0.0.0">>, 0 } -> - - %% ?info("dlink_tls:authorize(): Remote is behind firewall. Will use ~p:~p", - %% [ PeerIP, PeerPort]), - %% { PeerIP, PeerPort }; - %% _ -> { RemoteAddress, RemotePort} - %% end, - log("auth ~s:~w", [NRemoteAddress, NRemotePort], CompSpec), + case ProtoVersion of + <<"1.", _/binary>> -> ok; + undefined -> ok; + _ -> + throw({protocol_failure, {unknown_version, ProtoVersion}}) + end, + Conn = {PeerIP, PeerPort}, + log("auth ~s:~w", [PeerIP, PeerPort], CompSpec), PeerCert = rvi_common:get_value(dlink_tls_peer_cert, not_found, CompSpec), authorize_rpc:store_creds(CompSpec, Credentials, Conn, PeerCert), connection_authorized(FromPid, Conn, CompSpec). send_authorize(Pid, CompSpec) -> ?debug("send_authorize() Pid = ~p; CompSpec = ~p", [Pid, abbrev(CompSpec)]), - {LocalIP, LocalPort} = rvi_common:node_address_tuple(), Creds = get_credentials(CompSpec), dlink_tls_conn:send(Pid, rvi_common:pass_log_id( [{?DLINK_ARG_CMD, ?DLINK_CMD_AUTHORIZE}, {?DLINK_ARG_VERSION, ?DLINK_TLS_VERSION}, - {?DLINK_ARG_ADDRESS, bin(LocalIP)}, - {?DLINK_ARG_PORT, LocalPort}, {?DLINK_ARG_CREDENTIALS, Creds}], CompSpec)). -bin(S) -> - iolist_to_binary(S). - connection_authorized(FromPid, {RemoteIP, RemotePort} = Conn, CompSpec) -> %% If FromPid (the genserver managing the socket) is not yet registered %% with the connection manager, this is an incoming connection diff --git a/components/proto_json/src/proto_json_rpc.erl b/components/proto_json/src/proto_json_rpc.erl index 9f10ee3..85f1aa6 100644 --- a/components/proto_json/src/proto_json_rpc.erl +++ b/components/proto_json/src/proto_json_rpc.erl @@ -129,12 +129,10 @@ handle_call({rvi, send_message, ?debug(" protocol:send(): data_link_mod: ~p~n", [DataLinkMod]), ?debug(" protocol:send(): data_link_opts: ~p~n", [DataLinkOpts]), ?debug(" protocol:send(): parameters: ~p~n", [Parameters]), - Data = jsx:encode([ - { <<"tid">>, TID }, - { <<"service">>, ServiceName }, - { <<"timeout">>, Timeout }, - { <<"parameters">>, Parameters } - ]), + Data = [{ <<"service">>, ServiceName }, + { <<"timeout">>, Timeout }, + { <<"parameters">>, Parameters } + ], RviOpts = rvi_common:rvi_options(Parameters), Res = DataLinkMod:send_data( St#st.cs, ?MODULE, ServiceName, RviOpts ++ DataLinkOpts, Data), @@ -145,9 +143,8 @@ handle_call(Other, _From, St) -> { reply, [ invalid_command ], St}. %% Convert list-based data to binary. -handle_cast({rvi, receive_message, [Payload, IP, Port | _LogId]} = Msg, St) -> +handle_cast({rvi, receive_message, [Elems, IP, Port | _LogId]} = Msg, St) -> ?debug("~p:handle_cast(~p)", [?MODULE, Msg]), - Elems = jsx:decode(iolist_to_binary(Payload)), [ ServiceName, Timeout, Parameters ] = opts([<<"service">>, <<"timeout">>, <<"parameters">>], diff --git a/components/proto_msgpack/src/proto_msgpack_rpc.erl b/components/proto_msgpack/src/proto_msgpack_rpc.erl index c8b083a..07352eb 100644 --- a/components/proto_msgpack/src/proto_msgpack_rpc.erl +++ b/components/proto_msgpack/src/proto_msgpack_rpc.erl @@ -132,10 +132,9 @@ handle_call({rvi, send_message, ?debug(" protocol:send(): data_link_mod: ~p~n", [DataLinkMod]), ?debug(" protocol:send(): data_link_opts: ~p~n", [DataLinkOpts]), ?debug(" protocol:send(): parameters: ~p~n", [Parameters]), - Data = msgpack:pack([ { <<"tid">>, TID }, - { <<"service">>, ServiceName }, - { <<"timeout">>, Timeout }, - { <<"parameters">>, Parameters } ], St#st.pack_opts), + Data = [ { <<"service">>, ServiceName }, + { <<"timeout">>, Timeout }, + { <<"parameters">>, Parameters } ], RviOpts = rvi_common:rvi_options(Parameters), Res = DataLinkMod:send_data( St#st.cs, ?MODULE, ServiceName, RviOpts ++ DataLinkOpts, Data), @@ -147,9 +146,8 @@ handle_call(Other, _From, St) -> %% Convert list-based data to binary. -handle_cast({rvi, receive_message, [Payload, IP, Port | LogId]} = Msg, St) -> +handle_cast({rvi, receive_message, [Elems, IP, Port | LogId]} = Msg, St) -> ?debug("~p:handle_cast(~p)", [?MODULE, Msg]), - {ok, Elems} = msgpack:unpack(Payload, St#st.pack_opts), [ ServiceName, Timeout, Parameters ] = opts([<<"service">>, <<"timeout">>, <<"parameters">>], diff --git a/components/service_edge/src/service_edge_rpc.erl b/components/service_edge/src/service_edge_rpc.erl index f27448e..bee503e 100644 --- a/components/service_edge/src/service_edge_rpc.erl +++ b/components/service_edge/src/service_edge_rpc.erl @@ -619,7 +619,7 @@ do_handle_local_message_([SvcName, TimeoutArg, Parameters | _Tail], CS) -> [TimeoutArg]), (Now * 1000) + TimeoutArg; - false -> %% Absolute timoeut. Convert to unix time msec + false -> %% Absolute timeout. Convert to unix time msec TimeoutArg * 1000 end, %% diff --git a/doc/rvi_certificates.md b/doc/rvi_certificates.md new file mode 100644 index 0000000..7b10292 --- /dev/null +++ b/doc/rvi_certificates.md @@ -0,0 +1,252 @@ + +Copyright (C) 2015-16 Jaguar Land Rover + +This document is licensed under Creative Commons +Attribution-ShareAlike 4.0 International. + +# CREATING RVI CERTIFICATES + +This document describes how to generate the necessary certificates, +keys and credentials needed for RVI Core. The example certificates +are used in (rvi_protocol.md)[rvi_protocol.md]. + +# STANDARDS USED +[1] JSON Web Token RFC7519- JWT (link)[https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32]
+[2] base64url - (link)[https://en.wikipedia.org/wiki/Base64)
+[3] Transport Layer Security (TLS) - (link)[https://en.wikipedia.org/wiki/Transport_Layer_Security]
+[4] X.509 Certificates - (link)[https://en.wikipedia.org/wiki/X.509]
+ +For all examples below the following certificates are used: + +## Sample root certificate +The self signed root certificate used in the examples throughout this +document was generated using the following commands: + +```Shell +# Create root key pair +openssl genrsa -out insecure_root_key.pem 1024 + +# Create a self-signed root CA certificate, signed by the root key created above +openssl req -x509 -new -nodes -key insecure_root_key.pem -days 365 -out insecure +_root_cert.crt +``` + +The content of the sample ```insecure_root_key.pem``` private key +file, which has no password protection, is: + +``` +-----BEGIN RSA PRIVATE KEY----- +MIICXAIBAAKBgQDg5A1uZ5F36vQEYbMWCV4wY4OVmicYWEjjl/8YPA01tsz4x68i +/NnlMNalqpGCIZ0AwqGI5DZAWWoR400L3SAmYD6sWj2L9ViIAPk3ceDU8olYrf/N +wj78wVoG7qqNLgMoBNM584nlY4jy8zJ0Ka9WFBS2aDtB3Aulc1Q8ZfhuewIDAQAB +AoGAfD+C7CxsQkSc7I7N0q76SuGwIUc5skmUe6nOViVXZwXH2Or55+qqt+VzsbO7 +EJphk7n0ZR0wm/zKjXd3acaRq5j3fOyXip9fDoNj+oUKAowDJ9vub0NOPpU2bgb0 +xDnDeR0BRVBOTWqrkDeDPBSxw5RlJunesDkamAmj4VXHHgECQQDzqDtaEuEZ7x7d +kJKCmfGyP01s+YPlquDgogzAeMAsz17TFt8JS4RO0rX71+lmx7qqpRqIxVXIsR58 +NI2Th7tRAkEA7Eh1C1WahLCxojQOam/l7GyE+2ignZYExqonOOvsk6TG0LcFm7W9 +x39ouTlfChM26f8VYAsPxIrvsDlI1DDCCwJBAITmA8lzdrgQhwNOsbrugLg6ct63 +kcuZUqLzgIUS168ZRJ1aYjjNqdLcd0pwT+wxkI03FKv5Bns6sGgKuhX3+KECQFm/ +Z93HRSrTZpViynr5R88WpShNZHyW5/eB1+YSDslB1FagvhuX2570MRXxybys8bXN +sxPI/9M6prI8AALBBmMCQD+2amH2Y9ukJy10WuYei943mrCsp1oosWjcoMADRCpj +ZA2UwSzj67PBc5umDIAlhVRMX0zH/gLj54rfIkH5zLk= +-----END RSA PRIVATE KEY----- +``` + +The root key above is checked in as ```priv/keys/insecure_root_key.pem```. + +
+ +The content of the sample ```insecure_root_cert.crt``` file is: + +``` +-----BEGIN CERTIFICATE----- +MIICUjCCAbugAwIBAgIJAMI080XZPsPUMA0GCSqGSIb3DQEBCwUAMEIxCzAJBgNV +BAYTAlVTMQ8wDQYDVQQIDAZPcmVnb24xETAPBgNVBAcMCFBvcnRsYW5kMQ8wDQYD +VQQKDAZHRU5JVkkwHhcNMTUxMTI3MjMxMTQ0WhcNMTYxMTI2MjMxMTQ0WjBCMQsw +CQYDVQQGEwJVUzEPMA0GA1UECAwGT3JlZ29uMREwDwYDVQQHDAhQb3J0bGFuZDEP +MA0GA1UECgwGR0VOSVZJMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDg5A1u +Z5F36vQEYbMWCV4wY4OVmicYWEjjl/8YPA01tsz4x68i/NnlMNalqpGCIZ0AwqGI +5DZAWWoR400L3SAmYD6sWj2L9ViIAPk3ceDU8olYrf/Nwj78wVoG7qqNLgMoBNM5 +84nlY4jy8zJ0Ka9WFBS2aDtB3Aulc1Q8ZfhuewIDAQABo1AwTjAdBgNVHQ4EFgQU +4Sz8rAMA+dHymJTlZSkap65qnfswHwYDVR0jBBgwFoAU4Sz8rAMA+dHymJTlZSka +p65qnfswDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOBgQDFOapf3DNEcXgp +1u/g8YtBW24QsyB+RRavA9oKcFiIaHMkbJyUsOergwOXxBYhduuwVzQQo9P5nR0W +RdUfwtE0GuaiC8WUmjR//vKwakj9Bjuu73ldYj9ji9+eXsL/gtpGWTIlHeGugpFs +mVrUm0lY/n2ilJQ1hzBZ9lFLq0wfjw== +-----END CERTIFICATE----- +``` + +The root certificate above is checked in as ```priv/certificates/insecure_root_cert.crt```. + + +**DO NOT USE THE KEYS AND CERTIFICATES ABOVE IN PRODUCTION!
+ANY PRODUCTION KEYS SHOULD BE GENERATED BY THE ORGANIZATION AND BE 4096 BITS LONG.** + +## Sample device certificate + +The sample device x.509 certificate, signed by the root certificate above, +was generated with the following command: + +```Shell +# Create the device key. In production, increase the bit size to 4096+ +openssl genrsa -out insecure_device_key.pem 1024 + +# Create a certificate signing request +openssl req -new -key insecure_device_key.pem -out insecure_device_cert.csr + +# Sign the signing request and create the insecure_device_cert.crt file +openssl x509 -req -days 365 -in insecure_device_cert.csr \ + -CA insecure_root_cert.crt -CAkey insecure_root_key.pem \ + -set_serial 01 -out insecure_device_cert.crt +``` + + +The ```insecure_device_cert.csr``` intermediate certificate signing +request can be deleted once the three steps above have been executed. + +The content of the sample ```insecure_device_key.pem``` private key +file, which has no password protection, is: + +``` +-----BEGIN RSA PRIVATE KEY----- +MIICXAIBAAKBgQCbb4jPAESKxarj3NJsgfQbhfTHZAP9kmram2TFnkzlCRxq4wQx +BDC0O85PAMgZou0armGGbOu0si4cpVRioerCQJXnMWx1MI+3GUktW5ijI3ui+tYC +sMQZtjSBVNXFZdoyZU2lPVWITOMZOe8o9vJ5DcUmFj9b2xV9jQ19oh+2+QIDAQAB +AoGAVCYV0rs6YEaTNbke0k+ocB4dXrTu1CCoaKEn9TS2PGiqUdOFOWQjWe/myS6L +JhXmd0Ng2P2uvayY+jknbh5qkNeEgTDhXJlAjiXlCADYArhgib+evRHgKz7RLTjX +tGklbmc7oECTEpjkchJC5XcJhXzHCIjroyOJvBuAVa+SeAECQQDNC+KW7fTKQpiG +YNGIt5MxCMjRparLz0fWod9J9U56wrWzU9Rnb7h9iwzTEJUEcVl9z8rnUdWtYQ8X +3lsz5cDhAkEAwg+kDWbLtXWlIvXhhla7q0+RfKb8vu/gXnkXJa6rcJdJztKRbP3b +9fehVeu9m+1+abahjC1zmQimwd2QVc8BGQJADbtfCGaVPzpoho9TWQmaRO1mrYuf +vZh7IiejEYvpHpWNn53cmrTDsTyvti7lG/APYzqYRxeW7M6UOS/+AaLAYQJAJbEW +AwhZPphoB59MO2RzNPXSYyyn4IoEwTSxuz7uy4KG8mXRmyK/a0m6i06rWDLLn8q6 +G9jkH/AfO35GP3RiWQJBAJLWBlKpHf8TxT65jAwxBhd9ZOkC2w0WidbSYjX9wkkD +38K7ZDm1LSIR69Ut6tdwotkytXvDniOMPY6ENar5IUs= +-----END RSA PRIVATE KEY----- +``` + +
+ +The content of the sample ```insecure_device_cert.crt``` file is: + +``` +-----BEGIN CERTIFICATE----- +MIIB8zCCAVwCAQEwDQYJKoZIhvcNAQELBQAwQjELMAkGA1UEBhMCVVMxDzANBgNV +BAgMBk9yZWdvbjERMA8GA1UEBwwIUG9ydGxhbmQxDzANBgNVBAoMBkdFTklWSTAe +Fw0xNTExMjcyMzE0NTJaFw0xNjExMjYyMzE0NTJaMEIxCzAJBgNVBAYTAlVTMQ8w +DQYDVQQIDAZPcmVnb24xETAPBgNVBAcMCFBvcnRsYW5kMQ8wDQYDVQQKDAZHRU5J +VkkwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJtviM8ARIrFquPc0myB9BuF +9MdkA/2SatqbZMWeTOUJHGrjBDEEMLQ7zk8AyBmi7RquYYZs67SyLhylVGKh6sJA +lecxbHUwj7cZSS1bmKMje6L61gKwxBm2NIFU1cVl2jJlTaU9VYhM4xk57yj28nkN +xSYWP1vbFX2NDX2iH7b5AgMBAAEwDQYJKoZIhvcNAQELBQADgYEAhbqVr9E/0M72 +9nc6DI+qgqsRSMfoyvA3Cmn/ECxl1ybGkuzO7sB8fGjgMQ9zzcb6q1uP3wGjPioq +MymiYYjUmCTvzdvRBZ+6SDjrZfwUuYexiKqI9AP6XKaHlAL14+rK+6HN4uIkZcIz +PwSMHih1bsTRpyY5Z3CUDcDJkYtVbYs= +-----END CERTIFICATE----- +``` + +These files are checked into ```priv/certifcates``` and ```priv/keys```. + +**DO NOT USE THE KEYS AND CERTIFICATES ABOVE IN PRODUCTION!
+ANY PRODUCTION KEYS SHOULD BE GENERATED BY THE ORGANIZATION AND BE 4096 BITS LONG.** + +## RVI credentials format + +A credential is a JWT-encoded JSON structure, signed by the root X.509 +certificate's private key, describing the rights that the sender +has. A received RVI credential is validated as follows. + +1. **Receive remote party's X.509 device certificate**
+The TLS handshake process will exchange the X.509 certificates setup in +the previous chapter. + +2. **Validate remote party's X.509 device certificate**
+The received device X.509 certificate has its signature validated by the +root X.509 certificate that is pre-provisioned in all RVI nodes.
+The receiver now knows that the remote RVI node has an identiy +generated by a trusted provsioning server using the private root key. + +3. **Receive one or more RVI credentials**
+Each credential is encoded as JWT, signed by the root X.509 certificate. + +4. **Validate each RVI credential signature**
+The root X.509 certificate is used to validate the signature of each +received RVI credential.
+A successful validation proves that the certificate was generated by a +trusted provisioning server using the private root key. + +5. **Validate the credential-embedded X.509 device certificate**
+Each received RVI credential will have its embedded device X.509 +certificate compared with the device X.509 certificate received in +step 1 above.
+A match proves that the certificate was generated by a trusted provisioning +server explictly for the RVI node at the remote end. + +An RVI credential has the following format in its native JSON state: + +```JSON +{ + "create_timestamp": 1439925416, + "right_to_invoke": [ + "jlr.com/vin/" + ], + "right_to_register": [ + "jlr.com/backend/sota" + ], + "id": "insecure_cert", + "iss": "jaguarlandrover.com", + "device_cert": "", + "validity": { + "start": 1420099200, + "stop": 1925020799 + } +} +``` + +
+ +The members are as follows: + +Member | Description +--------------------|--------------------- +create\_timestamp | Unix timestamp of when the credential was created +right\_to\_invoke | A list of service prefixes that the sender has the right to invoke on any node that has registered matching services that start with the given string(s). +right\_to\_register | A list of services that the sender has the right to to register for other nodes to invoke. +id | A system-wide unique identifier for the credential. +iss | The issuing organization. +device_certificate | The PEM-encoded device X.509 certificate to match against the sender's TLS certificate. +validity.start | The Unix timestamps when the credential becomes active. +validity.stop | The Unix timestamps when the credential becomes inactive. + +## Generating RVI credentials + +To create a credential, tie it to a device X.509 certificate, and sign it with a root X.509 certificate private key, the following command is used: + + +```Shell +rvi_create_credential.py --cred_out="insecure_credential.json" \ + --jwt_out='insecure_credential.jwt' \ + --id="xxx" \ + --issuer="genivi.org" \ + --root_key=insecure_root_key.pem \ + --device_cert=insecure_device_cert.crt \ + --invoke='genivi.org/' \ + --register='genivi.org/' +``` + +The following command line parameters are accepted: + +Parameter | Required | Description +-------------- | -------- | --------- +--cred\_out | No | Output file containing the JSON-formatted un-encoded credential. +--jwt\_out | Yes | JWT-encoded, JSON-formatted, root keyp-signed credential. +--issuer | Yes | Organization that issued the credential. +--root\_key | Yes | Private, PEM-encoded root key to sign the credential. Must be the same key used to sign the root X.509 certificate. +--device\_cert | Yes | The PEM-encoded device X.509 certificate to embed into the credential as the device_cert member. +--invoke | Yes | Space separated list (within quotes) of RVI service prefixes that the owner of the credential has the right to invoke. +--register | Yes | Space separated list (within quotes) of RVI service prefixes that the owner of the credential has the right to register for others to call (with the right credential). +--start | No | The Unix timestamps when the credential becomes active. +--stop | No | The Unix timestamps when the credential becomes inactive. + +The generated ```insecure_credential.json``` +and ```insecure_credential.jwt``` are checked into ```priv/credentials```. diff --git a/doc/rvi_fragmentation.md b/doc/rvi_fragmentation.md index 0992005..1cad4a5 100644 --- a/doc/rvi_fragmentation.md +++ b/doc/rvi_fragmentation.md @@ -1,9 +1,4 @@ - + # The RVI Core Fragmentation Protocol ## Abstract @@ -49,7 +44,7 @@ Term | Meaning `Server` | Receiving side of the interaction `MTU` | Message Transfer Unit -
+
## System Overview diff --git a/doc/rvi_protocol.md b/doc/rvi_protocol.md index ce9c445..6536111 100644 --- a/doc/rvi_protocol.md +++ b/doc/rvi_protocol.md @@ -1,9 +1,4 @@ - + Copyright (C) 2015-16 Jaguar Land Rover This document is licensed under Creative Commons @@ -12,13 +7,15 @@ Attribution-ShareAlike 4.0 International. # RVI CORE PROTOCOL This document describes the core protocol between two RVI nodes. +For all examples below the certificates and credentials used are the samples +created as described in [rvi_certificates.md](rvi_certificates.md). + # STANDARDS USED -[1] Transport Layer Security - TLS (link)[https://tools.ietf.org/html/rfc5246]
-[2] JSON Web Token RFC7519- JWT (link)[https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32]
-[3] MessagePack - (link)[http://msgpack.org/index.html]
-[4] base64url - (link)[https://en.wikipedia.org/wiki/Base64)
-[5] Transport Layer Security (TLS) - (link)[https://en.wikipedia.org/wiki/Transport_Layer_Security]
-[6] X.509 Certificates - (link)[https://en.wikipedia.org/wiki/X.509]
+[1] [Transport Layer Security - TLS](https://tools.ietf.org/html/rfc5246)
+[2] [JSON Web Token RFC7519 - JWT](https://tools.ietf.org/html/draft-ietf-oauth-json-web-token-32)
+[3] [MessagePack](http://msgpack.org/index.html)
+[4] [base64url](https://en.wikipedia.org/wiki/Base64)
+[5] [X.509 Certificates](https://en.wikipedia.org/wiki/X.509)
# FEATURES COVERED BY PROTOCOL 1. **Authorization**
@@ -33,7 +30,7 @@ is authorized to invoke. Invoke services on remote RVI nodes. # FEATURES NOT COVERED BY PROTOCOL -For all but the last item, TLS 1.2 [5] an be used as an underlying +For all but the last item, TLS 1.2 [1] an be used as an underlying protocol to provide the features lacking in RVI Core protocol. 1. **Authentication**
@@ -55,7 +52,7 @@ Public Key Infrastructure and certificate distribution. 6. **RVI Node Discovery**
Allowing two unconnected RVI nodes to discover each other so that they can initiate connection. -
+
# OVERVIEW The RVI core protocol is the default protocol used between two RVI @@ -73,7 +70,7 @@ peer. ## Certificates and credentials Three types of certificates and credentials are used by the RVI Core -protocol in conjunciton with TLS. See [6] for details on X.509. +protocol in conjunciton with TLS. See [5] for details on X.509. 1. **Root certificate [X.509]**
Generated by a trusted provisioning server and pre-provisioned on all @@ -90,7 +87,7 @@ services that the device has right to register. Embeds the device X.509 certificate as a PEM-encoded string. Signed by root cert. -
+
## Integration between TLS and RVI Core RVI Client and server X.509 certificates are exchanged when the original @@ -109,6 +106,14 @@ signed by the root x.509 certificate. # PROTOCOL FLOW +The messages used for illustration below are all presented in JSON format. +Other encodings (currently only msgpack) are supported, but all RVI messages +can be encoded as JSON. Each message is identified by a `"cmd": Cmd` +attribute, where `Cmd` can be `"au"`, `"sa"`, `"rcv"`, `"frg"`, `"ping"`. + +The receiver of a message should be able to handle the presence of attributes +other than the ones described here. + ## Sequence Diagram The diagram below outlines the sequence between the client and the server. @@ -118,20 +123,38 @@ client-server terminology only denotes who initiates the connection RVI Core protocol Sequence Diagram -
+
## Authorize command The ```authorize``` command contains a list of RVI credentials, each specifying a set of services that the sender has the right to invoke on the receiving node, and a set of services that the sender has the right to register. -Please see the "RVI Credentials" chapter for detailss on RVI credentials. +```json +{"cmd" : "au", + "ver" : "1.1", + "creds": [ "eyJhbGci..." ] +} +``` + +Attributes that may be present, but not currently used: `"addr"`, `"port"`. + +Please see the [rvi_certificates.md](rvi_certificates.md) document for details on RVI credentials. ## Service Announce command The ```service_authorize``` command contains a list of services available on the sender that match services listed in RVI credentials received from the remote party. +```json +{"cmd" : "sa", + "stat" : "av" | "un", + "svcs" : [ "genivi.com/vin/d32cef88-.../hvac/seat_heat_left", ... ] +} +``` + +The `"stat"` attribute can have the value `"av"` (available) or `"un"` (unavailable) and indicates the status of all services listed in `"svcs"`. + ## Message command The ```message``` command contains a service name and a number of arguments to be presented to the corresponding service at the @@ -139,6 +162,37 @@ receiving end. This is an asynchronous command that does not expect an answer. Replies, publish/subscribe, and other higher-level functions are (for now) outside the scope of the RVI Core protocol. +```json +{"cmd" : "rcv", + "tid" : Tid, + "mod" : Mod, + "data" : Data +} +``` + +Note: The `"tid"` attribute is currently not checked by RVI. + +The content of `Data` is parsed and then encoded according to the +protocol used to forward the message. The modules `proto_json_rpc` and +`proto_msgpack` expect it to be a 'struct' (or corresponding), as follows: + +```json +{"service" : ServiceName, + "timeout" : Timeout, + "parameters: Parameters +} +``` + +`Timeout` is either a relative time in milliseconds, or an absolut time +(unix time) in seconds. + +`Parameters` is a 'struct' containing named arguments to be passed to the +service. It _can_ also contain RVI-specific arguments, named as `"rvi.Opt"`. +Currently supported RVI options are + +* `"rvi.max_msg_size"` (integer > 0) +* `"rvi.reliable"` (true | false) + ## Double connect resolution There is a risk that two parties try to initiate a connection to each other in a race condition, creating two connections between them, as @@ -179,7 +233,7 @@ Node1 Address | Node2 Address | Connecting side to be terminated The connection is terminated regardless of its current protocol session state. -
+
## Chunking of large messages @@ -209,7 +263,8 @@ will currently be unreliable when using JSON encoding, due to escaping of binary data. When including these options in the "parameters" list of a message invocation, -the names can be prefixed with "rvi.", e.g. "rvi.max_msg_size". +the names can be prefixed with "rvi.", e.g. "rvi.max_msg_size", or +"rvi.reliable". **TODO**: Introduce timers. Currently there are none. @@ -221,7 +276,7 @@ fragment (with a starting offset of 1), and then wait for the receiving side to request more fragments using "frg-get" messages. When the sending side receives a "frg-end" message, it will forget about the message. -
+
### Encoding @@ -238,7 +293,7 @@ non-whitespace byte. Configuring fragmentation encoding in RVI Core is done for the specific data link module, e.g. -``` +```json { data_link, [ { dlink_tcp_rpc, gen_server, [ @@ -251,241 +306,3 @@ data link module, e.g. ] } ``` - -# PROTOCOL DEFINITION -This chapter describes the protocol message formats and how the various fields are used. - -For all examples below the following certifcates are used: - -## Sample root certificate -The self signed root certificate used in the examples throughout this -document was generated using the following commands: - -```Shell -# Create root key pair -openssl genrsa -out insecure_root_key.pem 1024 - -# Create a self-signed root CA certificate, signed by the root key created above -openssl req -x509 -new -nodes -key insecure_root_key.pem -days 365 -out insecure_root_cert.crt -``` - -The content of the sample ```insecure_root_key.pem``` private key -file, which has no password protection, is: - -``` ------BEGIN RSA PRIVATE KEY----- -MIICXAIBAAKBgQDg5A1uZ5F36vQEYbMWCV4wY4OVmicYWEjjl/8YPA01tsz4x68i -/NnlMNalqpGCIZ0AwqGI5DZAWWoR400L3SAmYD6sWj2L9ViIAPk3ceDU8olYrf/N -wj78wVoG7qqNLgMoBNM584nlY4jy8zJ0Ka9WFBS2aDtB3Aulc1Q8ZfhuewIDAQAB -AoGAfD+C7CxsQkSc7I7N0q76SuGwIUc5skmUe6nOViVXZwXH2Or55+qqt+VzsbO7 -EJphk7n0ZR0wm/zKjXd3acaRq5j3fOyXip9fDoNj+oUKAowDJ9vub0NOPpU2bgb0 -xDnDeR0BRVBOTWqrkDeDPBSxw5RlJunesDkamAmj4VXHHgECQQDzqDtaEuEZ7x7d -kJKCmfGyP01s+YPlquDgogzAeMAsz17TFt8JS4RO0rX71+lmx7qqpRqIxVXIsR58 -NI2Th7tRAkEA7Eh1C1WahLCxojQOam/l7GyE+2ignZYExqonOOvsk6TG0LcFm7W9 -x39ouTlfChM26f8VYAsPxIrvsDlI1DDCCwJBAITmA8lzdrgQhwNOsbrugLg6ct63 -kcuZUqLzgIUS168ZRJ1aYjjNqdLcd0pwT+wxkI03FKv5Bns6sGgKuhX3+KECQFm/ -Z93HRSrTZpViynr5R88WpShNZHyW5/eB1+YSDslB1FagvhuX2570MRXxybys8bXN -sxPI/9M6prI8AALBBmMCQD+2amH2Y9ukJy10WuYei943mrCsp1oosWjcoMADRCpj -ZA2UwSzj67PBc5umDIAlhVRMX0zH/gLj54rfIkH5zLk= ------END RSA PRIVATE KEY----- -``` - -The root key above is checked in as ```priv/keys/insecure_root_key.pem```. - -
- -The content of the sample ```insecure_root_cert.crt``` file is: - -``` ------BEGIN CERTIFICATE----- -MIICUjCCAbugAwIBAgIJAMI080XZPsPUMA0GCSqGSIb3DQEBCwUAMEIxCzAJBgNV -BAYTAlVTMQ8wDQYDVQQIDAZPcmVnb24xETAPBgNVBAcMCFBvcnRsYW5kMQ8wDQYD -VQQKDAZHRU5JVkkwHhcNMTUxMTI3MjMxMTQ0WhcNMTYxMTI2MjMxMTQ0WjBCMQsw -CQYDVQQGEwJVUzEPMA0GA1UECAwGT3JlZ29uMREwDwYDVQQHDAhQb3J0bGFuZDEP -MA0GA1UECgwGR0VOSVZJMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDg5A1u -Z5F36vQEYbMWCV4wY4OVmicYWEjjl/8YPA01tsz4x68i/NnlMNalqpGCIZ0AwqGI -5DZAWWoR400L3SAmYD6sWj2L9ViIAPk3ceDU8olYrf/Nwj78wVoG7qqNLgMoBNM5 -84nlY4jy8zJ0Ka9WFBS2aDtB3Aulc1Q8ZfhuewIDAQABo1AwTjAdBgNVHQ4EFgQU -4Sz8rAMA+dHymJTlZSkap65qnfswHwYDVR0jBBgwFoAU4Sz8rAMA+dHymJTlZSka -p65qnfswDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOBgQDFOapf3DNEcXgp -1u/g8YtBW24QsyB+RRavA9oKcFiIaHMkbJyUsOergwOXxBYhduuwVzQQo9P5nR0W -RdUfwtE0GuaiC8WUmjR//vKwakj9Bjuu73ldYj9ji9+eXsL/gtpGWTIlHeGugpFs -mVrUm0lY/n2ilJQ1hzBZ9lFLq0wfjw== ------END CERTIFICATE----- -``` - -The root certificate above is checked in as ```priv/certificates/insecure_root_cert.crt```. - - -**DO NOT USE THE KEYS AND CERTIFICATES ABOVE IN PRODUCTION!
-ANY PRODUCTION KEYS SHOULD BE GENERATED BY THE ORGANIZATION AND BE 4096 BITS LONG.** - -## Sample device certificate - -The sample device x.509 certificate, signed by the root certificate above, -was generated with the following command: - -```Shell -# Create the device key. In production, increase the bit size to 4096+ -openssl genrsa -out insecure_device_key.pem 1024 - -# Create a certificate signing request -openssl req -new -key insecure_device_key.pem -out insecure_device_cert.csr - -# Sign the signing request and create the insecure_device_cert.crt file -openssl x509 -req -days 365 -in insecure_device_cert.csr \ - -CA insecure_root_cert.crt -CAkey insecure_root_key.pem \ - -set_serial 01 -out insecure_device_cert.crt -``` - - -The ```insecure_device_cert.csr``` intermediate certificate signing -request can be deleted once the three steps above have been executed. - -The content of the sample ```insecure_device_key.pem``` private key -file, which has no password protection, is: - -``` ------BEGIN RSA PRIVATE KEY----- -MIICXAIBAAKBgQCbb4jPAESKxarj3NJsgfQbhfTHZAP9kmram2TFnkzlCRxq4wQx -BDC0O85PAMgZou0armGGbOu0si4cpVRioerCQJXnMWx1MI+3GUktW5ijI3ui+tYC -sMQZtjSBVNXFZdoyZU2lPVWITOMZOe8o9vJ5DcUmFj9b2xV9jQ19oh+2+QIDAQAB -AoGAVCYV0rs6YEaTNbke0k+ocB4dXrTu1CCoaKEn9TS2PGiqUdOFOWQjWe/myS6L -JhXmd0Ng2P2uvayY+jknbh5qkNeEgTDhXJlAjiXlCADYArhgib+evRHgKz7RLTjX -tGklbmc7oECTEpjkchJC5XcJhXzHCIjroyOJvBuAVa+SeAECQQDNC+KW7fTKQpiG -YNGIt5MxCMjRparLz0fWod9J9U56wrWzU9Rnb7h9iwzTEJUEcVl9z8rnUdWtYQ8X -3lsz5cDhAkEAwg+kDWbLtXWlIvXhhla7q0+RfKb8vu/gXnkXJa6rcJdJztKRbP3b -9fehVeu9m+1+abahjC1zmQimwd2QVc8BGQJADbtfCGaVPzpoho9TWQmaRO1mrYuf -vZh7IiejEYvpHpWNn53cmrTDsTyvti7lG/APYzqYRxeW7M6UOS/+AaLAYQJAJbEW -AwhZPphoB59MO2RzNPXSYyyn4IoEwTSxuz7uy4KG8mXRmyK/a0m6i06rWDLLn8q6 -G9jkH/AfO35GP3RiWQJBAJLWBlKpHf8TxT65jAwxBhd9ZOkC2w0WidbSYjX9wkkD -38K7ZDm1LSIR69Ut6tdwotkytXvDniOMPY6ENar5IUs= ------END RSA PRIVATE KEY----- -``` - -
- -The content of the sample ```insecure_device_cert.crt``` file is: - -``` ------BEGIN CERTIFICATE----- -MIIB8zCCAVwCAQEwDQYJKoZIhvcNAQELBQAwQjELMAkGA1UEBhMCVVMxDzANBgNV -BAgMBk9yZWdvbjERMA8GA1UEBwwIUG9ydGxhbmQxDzANBgNVBAoMBkdFTklWSTAe -Fw0xNTExMjcyMzE0NTJaFw0xNjExMjYyMzE0NTJaMEIxCzAJBgNVBAYTAlVTMQ8w -DQYDVQQIDAZPcmVnb24xETAPBgNVBAcMCFBvcnRsYW5kMQ8wDQYDVQQKDAZHRU5J -VkkwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAJtviM8ARIrFquPc0myB9BuF -9MdkA/2SatqbZMWeTOUJHGrjBDEEMLQ7zk8AyBmi7RquYYZs67SyLhylVGKh6sJA -lecxbHUwj7cZSS1bmKMje6L61gKwxBm2NIFU1cVl2jJlTaU9VYhM4xk57yj28nkN -xSYWP1vbFX2NDX2iH7b5AgMBAAEwDQYJKoZIhvcNAQELBQADgYEAhbqVr9E/0M72 -9nc6DI+qgqsRSMfoyvA3Cmn/ECxl1ybGkuzO7sB8fGjgMQ9zzcb6q1uP3wGjPioq -MymiYYjUmCTvzdvRBZ+6SDjrZfwUuYexiKqI9AP6XKaHlAL14+rK+6HN4uIkZcIz -PwSMHih1bsTRpyY5Z3CUDcDJkYtVbYs= ------END CERTIFICATE----- -``` - -These files are checked into ```priv/certifcates``` and ```priv/keys```. - -**DO NOT USE THE KEYS AND CERTIFICATES ABOVE IN PRODUCTION!
-ANY PRODUCTION KEYS SHOULD BE GENERATED BY THE ORGANIZATION AND BE 4096 BITS LONG.** - - -## RVI credentials format - -A credential is a JWT-encoded JSON structure, signed by the root X.509 -certificate's private key, describing the rights that the sender -has. A received RVI credential is validated as follows. - -1. **Receive remote party's X.509 device certificate**
-The TLS handshake process will exchange the X.509 certificates setup in -the previous chapter. - -2. **Validate remote party's X.509 device certificate**
-The received device X.509 certificate has its signature validated by the -root X.509 certificate that is pre-provisioned in all RVI nodes.
-The receiver now knows that the remote RVI node has an identiy -generated by a trusted provsioning server using the private root key. - -3. **Receive one or more RVI credentials**
-Each credential is encoded as JWT, signed by the root X.509 certificate. - -4. **Validate each RVI credential signature**
-The root X.509 certificate is used to validate the signature of each -received RVI credential.
-A successful validation proves that the certificate was generated by a -trusted provisioning server using the private root key. - -5. **Validate the credential-embedded X.509 device certificate**
-Each received RVI credential will have its embedded device X.509 -certificate compared with the device X.509 certificate received in -step 1 above.
-A match proves that the certificate was generated by a trusted provisioning -server explictly for the RVI node at the remote end. - -An RVI credential has the following format in its native JSON state: - -```JSON -{ - "create_timestamp": 1439925416, - "right_to_invoke": [ - "jlr.com/vin/" - ], - "right_to_register": [ - "jlr.com/backend/sota" - ], - "id": "insecure_cert", - "iss": "jaguarlandrover.com", - "device_cert": "", - "validity": { - "start": 1420099200, - "stop": 1925020799 - } -} -``` - -
- -The members are as follows: - -Member | Description ---------------------|--------------------- -create\_timestamp | Unix timestamp of when the credential was created -right\_to\_invoke | A list of service prefixes that the sender has the right to invoke on any node that has registered matching services that start with the given string(s). -right\_to\_register | A list of services that the sender has the right to to register for other nodes to invoke. -id | A system-wide unique identifier for the credential. -iss | The issuing organization. -device_certificate | The PEM-encoded device X.509 certificate to match against the sender's TLS certificate. -validity.start | The Unix timestamps when the credential becomes active. -validity.stop | The Unix timestamps when the credential becomes inactive. - -## Generating RVI credentials - -To create a credential, tie it to a device X.509 certificate, and sign it with a root X.509 certificate private key, the following command is used: - - -```Shell -rvi_create_credential.py --cred_out="insecure_credential.json" \ - --jwt_out='insecure_credential.jwt' \ - --id="xxx" \ - --issuer="genivi.org" \ - --root_key=insecure_root_key.pem \ - --device_cert=insecure_device_cert.crt \ - --invoke='genivi.org/' \ - --register='genivi.org/' -``` - -The following command line parameters are accepted: - -Parameter | Required | Description --------------- | -------- | --------- ---cred\_out | No | Output file containing the JSON-formatted un-encoded credential. ---jwt\_out | Yes | JWT-encoded, JSON-formatted, root keyp-signed credential. ---issuer | Yes | Organization that issued the credential. ---root\_key | Yes | Private, PEM-encoded root key to sign the credential. Must be the same key used to sign the root X.509 certificate. ---device\_cert | Yes | The PEM-encoded device X.509 certificate to embed into the credential as the device_cert member. ---invoke | Yes | Space separated list (within quotes) of RVI service prefixes that the owner of the credential has the right to invoke. ---register | Yes | Space separated list (within quotes) of RVI service prefixes that the owner of the credential has the right to register for others to call (with the right credential). ---start | No | The Unix timestamps when the credential becomes active. ---stop | No | The Unix timestamps when the credential becomes inactive. - -The generated ```insecure_credential.json``` -and ```insecure_credential.jwt``` are checked into ```priv/credentials```. diff --git a/doc/rvi_services.md b/doc/rvi_services.md index 11d77da..9a288d4 100644 --- a/doc/rvi_services.md +++ b/doc/rvi_services.md @@ -1,9 +1,4 @@ - + Copyright (C) 2014, 2015 Jaguar Land Rover This document is licensed under Creative Commons @@ -109,7 +104,7 @@ The parameters are: After receiving a key the device will typically store it in its key store. -
+
##### Provision Certificate @@ -159,7 +154,7 @@ The parameters are: After receiving an erase certificate request the device must remove it from its certificate store. -
+
##### Clear Certificates @@ -258,7 +253,7 @@ The parameters are: * variables - An array of dictionaries with variable names and values. * value - The value of the variable. -
+
##### Write Configuration Variables @@ -315,7 +310,7 @@ Sequence of events: 6. Once the client receives the `finish` message and has assembled and verified the download it sends `download_complete` to the server with a status indicator. -
+
#### Notify @@ -364,7 +359,7 @@ The parameters are: match the ID from the `notify` message this message is sent in response to. -
+
#### Start Download @@ -411,7 +406,7 @@ The parameters are: may not arrive in order. * msg - File chunk encoded with base64. -
+
#### Finish Transmission @@ -456,7 +451,7 @@ The parameters are: match the ID from the `notify` message this message is sent in response to. -
+
#### Cancel Download @@ -506,7 +501,7 @@ The parameters are: * channels - An array with the data channels to subscribe to. * reporting_interval - The reporting interval in milliseconds [ms]. -
+
#### Unsubscribe @@ -563,7 +558,7 @@ The parameters are: JSON data type. In particular `value` can be a dictionary in itself, as it is with the `location` channel. -
+
Currently defined channels: @@ -617,7 +612,7 @@ The parameters are: ```trunk``` is the rear trunk.
```hood``` is the rear hood. -
+
#### Start / Stop Engine @@ -662,7 +657,7 @@ The parameters are: ```open``` open the trunk.
```close``` close the trunk. -
+
#### Horn Activate the horn. @@ -839,7 +834,7 @@ will be listed. } } -
+
The parameters are: diff --git a/test/rvi_core_SUITE.erl b/test/rvi_core_SUITE.erl index bd1a996..63a36ca 100644 --- a/test/rvi_core_SUITE.erl +++ b/test/rvi_core_SUITE.erl @@ -141,9 +141,9 @@ groups() -> t_register_lock_service, t_register_sota_service, t_call_lock_service, - t_call_sota_service, - t_multicall_sota_service, - t_remote_call_lock_service, + %% t_call_sota_service, + %% t_multicall_sota_service, + %% t_remote_call_lock_service, t_no_errors ]} ]. @@ -327,19 +327,35 @@ t_multicall_sota_service(_Config) -> client3, client4, client5]], - collect(Pids). + Ref = erlang:send_after(5000, self(), collect_timeout), + collect(Pids, Ref). -collect([{Pid, Ref} | T]) -> +collect([{_, Ref} | T] = L, TRef) -> receive {'DOWN', Ref, _, _, {ok, ok}} -> - collect(T); + collect(T, Ref); {'DOWN', Ref, _, _, Reason} -> - [exit(P, kill) || {P,_} <- T], - error(Reason) + flush_reqs(T), + error(Reason); + {timeout, TRef, collect_timeout} -> + flush_reqs(T), + error(timeout) after 30000 -> + flush_reqs(L), error(timeout) end; -collect([]) -> +collect([], _) -> + ok. + +flush_reqs([{Pid, Ref}|T]) -> + receive + {'DOWN', Ref, _, _, _} -> + flush_reqs(T) + after 0 -> + erlang:demonitor(Ref), + exit(Pid, kill) + end; +flush_reqs([]) -> ok. @@ -367,7 +383,7 @@ call_sota_service_(RegName, Data) -> {message, Other} -> ct:log("wrong message: ~p", [Other]), error({unmatched, Other}) - after 30000 -> + after 5000 -> error(timeout) end. @@ -456,7 +472,11 @@ sota_bin() -> "00000000000000000000000000000000000000000000000000">>. json_result({ok, {http_response, {_V1, _V2}, 200, _Text, _Hdr}, JSON}) -> - jsx:decode(JSON). + jsx:decode(JSON); +json_result(Other) -> + ct:log("json_result(~p)", [Other]), + error({unexpected, Other}). + start_json_rpc_server(Port) -> {ok, Pid} = exo_http_server:start(Port, [{request_handler, @@ -464,7 +484,7 @@ start_json_rpc_server(Port) -> save({server,Port}, Pid), Pid. -handle_body(Socket, Request, Body, St) -> +handle_body(Socket, _Request, Body, _St) -> ct:log("handle_body(Body = ~p)", [Body]), JSON = jsx:decode(Body), ct:log("Got JSON Req: ~p", [JSON]), @@ -889,15 +909,15 @@ hex(X) when X >= 10, X =< 15 -> $a + X - 10. -json_rpc(URL, Method, Args) -> - Req = binary_to_list( - iolist_to_binary( - exo_json:encode({struct, [{"jsonrpc", "2.0"}, - {"id", 1}, - {"method", Method}, - {"params", Args}]}))), - Hdrs = [{'Content-Type', "application/json"}], - exo_http:wpost(URL, {1,1}, Hdrs, Req, 1000). +%% json_rpc(URL, Method, Args) -> +%% Req = binary_to_list( +%% iolist_to_binary( +%% exo_json:encode({struct, [{"jsonrpc", "2.0"}, +%% {"id", 1}, +%% {"method", Method}, +%% {"params", Args}]}))), +%% Hdrs = [{'Content-Type', "application/json"}], +%% exo_http:wpost(URL, {1,1}, Hdrs, Req, 1000). t_no_errors(Config) -> no_errors(?config(test_nodes, Config), ?config(test_dir, Config)). -- cgit v1.2.1 From 04c54e8dd6728387209ff18071af488dcd49f6fd Mon Sep 17 00:00:00 2001 From: Tatiana Jamison Date: Wed, 24 Feb 2016 11:26:30 -0800 Subject: [53177] Update Ubuntu install documentation Add steps for verifying successful Ubuntu installation --- INSTALL_ubuntu.md | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/INSTALL_ubuntu.md b/INSTALL_ubuntu.md index fa4a8f7..c9be22b 100644 --- a/INSTALL_ubuntu.md +++ b/INSTALL_ubuntu.md @@ -89,11 +89,52 @@ Then install RVI via dpkg: To confirm that RVI has installed successfully, run: - sudo service rvi status + sudo service rvi start Expected output: - TODO + * Starting Remote Vehicle Interaction Node... rvi [ OK ] + +Find out which services are registered through `rvi_get_services`: + + /usr/lib/rvi_core/rvi_get_services + +The command should return no output, since we have not registered any services yet. + +Register a service by calling `rvi_service` -- start with "hello": + + /usr/lib/rvi_core/rvi_service hello + +Expected output: + + RVI General Service. + RVI node URL: http://localhost:9001 + Service: genivi.org/vin/default_vin/hello + Press enter to quit: + +In another terminal, call `rvi_get_services` again to see the newly registered service: + + genivi.org/vin/default_vin/hello + +Invoke the service through `rvi_call` and the full service name: + + /usr/lib/rvi_core/rvi_call genivi.org/vin/default_vin/hello + +In terminal 1 (where you called `rvi_service`), you should see the following output: + + Service invoked! + args: {} + +In terminal 2 (where you called `rvi_call`), you should see the following output: + + RVI Node: http://localhost:9001 + Service: genivi.org/vin/default_vin/hello + args: {} + +You can pass arguments to a service call with the format name=value: + + /usr/lib/rvi_core/rvi_call genivi.org/vin/default_vin/hello \ + a=b message=hello ## CREATE A RELEASE ## -- cgit v1.2.1 From 33c6854a7cb6220c5fc0500457028f19ed237214 Mon Sep 17 00:00:00 2001 From: Ulf Wiger Date: Wed, 24 Feb 2016 20:55:26 +0100 Subject: generate PDF files --- BUILD.md | 13 +++---------- doc/pdf/BUILD.pdf | Bin 295900 -> 321115 bytes doc/pdf/CONFIGURE.pdf | Bin 1642409 -> 1654047 bytes doc/pdf/rvi_certificates.pdf | Bin 0 -> 595909 bytes doc/pdf/rvi_fragmentation.pdf | Bin 424532 -> 428947 bytes doc/pdf/rvi_protocol.pdf | Bin 1083617 -> 738301 bytes doc/pdf/rvi_services.pdf | Bin 1576836 -> 1667867 bytes doc/rvi_certificates.md | 8 +++++--- doc/rvi_protocol.md | 2 ++ doc/rvi_services.md | 25 ++++++++++++++----------- 10 files changed, 24 insertions(+), 24 deletions(-) create mode 100644 doc/pdf/rvi_certificates.pdf diff --git a/BUILD.md b/BUILD.md index d7367e6..fb196c0 100644 --- a/BUILD.md +++ b/BUILD.md @@ -1,9 +1,4 @@ - + Copyright (C) 2014-2016, Jaguar Land Rover This document is licensed under Creative Commons @@ -43,7 +38,7 @@ Please note that the configuration process described in ---- -
+
# INSTALLATION PROCESS # @@ -88,7 +83,7 @@ to the build system. The clone will be downloaded into a newly created ```rvi_core``` subdirectory. ----- +
## BUILD THE RVI SYSTEM ## @@ -101,8 +96,6 @@ The local ```rebar``` command is used to retrieve the dependencies. See ```rebar.config``` and ```deps/*/rebar.config``` for a list of dependencies. -
- See the [rebar](https://github.com/basho/rebar) project for a detailed description of the rebar Erlang build tool. diff --git a/doc/pdf/BUILD.pdf b/doc/pdf/BUILD.pdf index dc14200..d7e886b 100644 Binary files a/doc/pdf/BUILD.pdf and b/doc/pdf/BUILD.pdf differ diff --git a/doc/pdf/CONFIGURE.pdf b/doc/pdf/CONFIGURE.pdf index 013da57..d4afa45 100644 Binary files a/doc/pdf/CONFIGURE.pdf and b/doc/pdf/CONFIGURE.pdf differ diff --git a/doc/pdf/rvi_certificates.pdf b/doc/pdf/rvi_certificates.pdf new file mode 100644 index 0000000..f3cc127 Binary files /dev/null and b/doc/pdf/rvi_certificates.pdf differ diff --git a/doc/pdf/rvi_fragmentation.pdf b/doc/pdf/rvi_fragmentation.pdf index 754566d..164bd82 100644 Binary files a/doc/pdf/rvi_fragmentation.pdf and b/doc/pdf/rvi_fragmentation.pdf differ diff --git a/doc/pdf/rvi_protocol.pdf b/doc/pdf/rvi_protocol.pdf index 95f72e1..1030081 100644 Binary files a/doc/pdf/rvi_protocol.pdf and b/doc/pdf/rvi_protocol.pdf differ diff --git a/doc/pdf/rvi_services.pdf b/doc/pdf/rvi_services.pdf index b42829f..bfc5f21 100644 Binary files a/doc/pdf/rvi_services.pdf and b/doc/pdf/rvi_services.pdf differ diff --git a/doc/rvi_certificates.md b/doc/rvi_certificates.md index 7b10292..1d46259 100644 --- a/doc/rvi_certificates.md +++ b/doc/rvi_certificates.md @@ -104,6 +104,8 @@ openssl x509 -req -days 365 -in insecure_device_cert.csr \ The ```insecure_device_cert.csr``` intermediate certificate signing request can be deleted once the three steps above have been executed. +
+ The content of the sample ```insecure_device_key.pem``` private key file, which has no password protection, is: @@ -125,8 +127,6 @@ G9jkH/AfO35GP3RiWQJBAJLWBlKpHf8TxT65jAwxBhd9ZOkC2w0WidbSYjX9wkkD -----END RSA PRIVATE KEY----- ``` -
- The content of the sample ```insecure_device_cert.crt``` file is: ``` @@ -145,11 +145,13 @@ PwSMHih1bsTRpyY5Z3CUDcDJkYtVbYs= -----END CERTIFICATE----- ``` -These files are checked into ```priv/certifcates``` and ```priv/keys```. +These files are checked into ```priv/certificates``` and ```priv/keys```. **DO NOT USE THE KEYS AND CERTIFICATES ABOVE IN PRODUCTION!
ANY PRODUCTION KEYS SHOULD BE GENERATED BY THE ORGANIZATION AND BE 4096 BITS LONG.** +
+ ## RVI credentials format A credential is a JWT-encoded JSON structure, signed by the root X.509 diff --git a/doc/rvi_protocol.md b/doc/rvi_protocol.md index 6536111..85c3290 100644 --- a/doc/rvi_protocol.md +++ b/doc/rvi_protocol.md @@ -193,6 +193,8 @@ Currently supported RVI options are * `"rvi.max_msg_size"` (integer > 0) * `"rvi.reliable"` (true | false) +
+ ## Double connect resolution There is a risk that two parties try to initiate a connection to each other in a race condition, creating two connections between them, as diff --git a/doc/rvi_services.md b/doc/rvi_services.md index 9a288d4..ce32997 100644 --- a/doc/rvi_services.md +++ b/doc/rvi_services.md @@ -38,7 +38,7 @@ manage all subpaths below itself. A typical service name for a vehicle that specifies a service to lock a door: message:jaguarlandrover.com/vin/1HGCM82633A004352/services/body/lock - + Services can freely be defined and implemented by anyone for any purpose as long as the global name space is not violated (hence the organization). RVI defines a couple of core services that are specified by this document. @@ -60,7 +60,7 @@ Procedure Calls (RPC) (JSON-RPC). "reporting_interval": 5000 } } - + * jsonrpc - JSON-RPC version number. * id - Request ID, used to match the response to the request. * method - Method to be invoked. For RVI the method is ```message```. @@ -101,7 +101,7 @@ The parameters are: * keyid - Unique key ID. * key - JWT encoded key, signed by the private root key, where the payload is a JWK-formatted JSON object. - + After receiving a key the device will typically store it in its key store.
@@ -128,7 +128,7 @@ The parameters are: * certid - Unique certificate ID. * checksum - The md5 checksum calculated over the entire certificate * certificate - The certificate encoded as base64. - + After receiving a certificate the device will typically store it in its certificate store. @@ -150,7 +150,7 @@ Erase a certificate from the device's certificate store. The parameters are: * certid - Unique certificate ID. - + After receiving an erase certificate request the device must remove it from its certificate store. @@ -175,7 +175,6 @@ The parameters are: * dummy - Placeholder parameter - After receiving an erase certificate request the device must remove all certificates from its certificate store. @@ -199,7 +198,7 @@ from it. The parameters are: * certid - Unique certificate ID. - + After receiving a revoke certificate request the device must add it to its certificate blacklist. When the device is presented with a blacklisted certificate or a certificate that has been derived from a blacklisted certificate it must @@ -209,6 +208,8 @@ reject that certificate as invalid. Services to manage device configuration. +
+ ##### Read Configuration Variables Retrieve the value of one or more configuration variables from the device. @@ -229,7 +230,7 @@ The server sends to the device: The parameters are: * variable - The name of the variable. - + The device responds with: { @@ -246,7 +247,7 @@ The device responds with: ] } } - + The parameters are: * vin - The VIN of the device reporting the variable. @@ -359,7 +360,7 @@ The parameters are: match the ID from the `notify` message this message is sent in response to. -
+
#### Start Download @@ -696,8 +697,8 @@ The parameters are: * duration - The duration, in milliseconds, that the lights should be on for +
- #### Windows Open/close windows and other hatches @@ -713,6 +714,8 @@ Open/close windows and other hatches } } +
+ The parameters are: * windows - The windows to operate on -- cgit v1.2.1 From c39fdcd245b5aa33e8198dabd17ccca4333c4d34 Mon Sep 17 00:00:00 2001 From: Ulf Wiger Date: Wed, 24 Feb 2016 21:01:47 +0100 Subject: remove path footers --- doc/pdf/CONFIGURE.pdf | Bin 1654047 -> 1655447 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/doc/pdf/CONFIGURE.pdf b/doc/pdf/CONFIGURE.pdf index d4afa45..3b697d1 100644 Binary files a/doc/pdf/CONFIGURE.pdf and b/doc/pdf/CONFIGURE.pdf differ -- cgit v1.2.1 From 0d3dd80845744bf99f32689d9e477a20fe8bcb43 Mon Sep 17 00:00:00 2001 From: Ulf Wiger Date: Wed, 24 Feb 2016 21:34:11 +0100 Subject: Removed line about branching strategy --- README.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index d4299c8..3f1db3b 100644 --- a/README.md +++ b/README.md @@ -10,13 +10,10 @@ project and explains the reasoning behind some of the technical choices. # ADDITIONAL DOCUMENTATION AND RESOURCES# -For a high level description, with an exhaustive master usecase -walkthrough, please see the High Level Design document -[here](https://wiki.automotivelinux.org/_media/eg-rvi/15-456-poc-rvi-hld_reva.pdf) -Git branch management is JLR OSTCs standard git document -[Git strategy](https://docs.google.com/document/d/1xG86q2o5Y-aSn7m8QARIH8hcTpH_yNMWCLQJD47IP48/edit/) -[Git strategy](https://docs.google.com/document/d/1ko12dTXGeb2-E18SHOzGuC1318hGYSCIq3ADSzFOlGM/edit) +For a high level description, with an exhaustive master use-case +walkthrough, please see the High Level Design document +[here](https://wiki.automotivelinux.org/_media/eg-rvi/15-456-poc-rvi-hld_reva.pdf) (**NOTE: HLD not updated to reflect RVI Core 0.5.0**) For build instructions, please check the **build instructions**: [Markdown](BUILD.md) | -- cgit v1.2.1 From 19bab285b8a91b6d4ff3dff442f41cd2fb2505a2 Mon Sep 17 00:00:00 2001 From: Tatiana Jamison Date: Wed, 24 Feb 2016 13:05:10 -0800 Subject: [53177] Add URLs to Github release page Add URLs to Github release page for Debian, Raspbian, and Ubuntu installation instructions. --- INSTALL_debian.md | 4 +--- INSTALL_raspbian.md | 9 +-------- INSTALL_ubuntu.md | 4 +--- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/INSTALL_debian.md b/INSTALL_debian.md index cd8ef9c..590bc12 100644 --- a/INSTALL_debian.md +++ b/INSTALL_debian.md @@ -73,9 +73,7 @@ Then rerun the ```update``` and ```install``` commands. ## DOWNLOAD AND INSTALL RVI ## -Download the RVI package from the remote location: - - wget http://(TODO)/rvi_0.5.0-1_amd64.deb +Download the RVI package from https://github.com/PDXostc/rvi_core/releases. Then install RVI via dpkg: diff --git a/INSTALL_raspbian.md b/INSTALL_raspbian.md index ea8db69..7d0da34 100644 --- a/INSTALL_raspbian.md +++ b/INSTALL_raspbian.md @@ -43,14 +43,7 @@ Please note that the configuration process described in ## GET RASPBIAN PACKAGES ## -Download Erlang and RVI for Raspbian: - - wget (TODO)/erlang-18.2.tar.bz2 - wget (TODO)/rvi_0.5.0-1_armhf.deb - -Also download the install script: - - wget (TODO)/installRVI +Download the Raspbian package from https://github.com/PDXostc/rvi_core/releases. Then extract the tarball to get packages for Erlang and RVI, as well as an install script. ## INSTALL ERLANG AND RVI ## diff --git a/INSTALL_ubuntu.md b/INSTALL_ubuntu.md index c9be22b..36ca07c 100644 --- a/INSTALL_ubuntu.md +++ b/INSTALL_ubuntu.md @@ -75,9 +75,7 @@ Then rerun the ```update``` and ```install``` commands. ## DOWNLOAD AND INSTALL RVI ## -Download the RVI package from the remote location: - - wget http://(TODO)/rvi_0.5.0-1ubuntu1_amd64.deb +Download the RVI package from https://github.com/PDXostc/rvi_core/releases. Then install RVI via dpkg: -- cgit v1.2.1 From b3d0291216b06b01cc7975297d1219570e942e5e Mon Sep 17 00:00:00 2001 From: Ulf Wiger Date: Wed, 24 Feb 2016 22:41:02 +0100 Subject: merge tjamison:53177 & new PDFs --- BUILD.md | 5 +++-- doc/pdf/BUILD.pdf | Bin 321115 -> 321970 bytes 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/BUILD.md b/BUILD.md index f63581b..0af810b 100644 --- a/BUILD.md +++ b/BUILD.md @@ -136,6 +136,7 @@ The compiled code is available under ```ebin/```, ```components/*/ebin``` and `` ## CREATE A RELEASE ## -See ```CONFIGURE.md``` for details on configuring and creating a -developer and production release that can be launched. +See [CONFIGURE.md](CONFIGURE.md) ([PDF](doc/pdf/CONFIGURE.pdf)) for details +on configuring and creating a developer and production release that can be +launched. diff --git a/doc/pdf/BUILD.pdf b/doc/pdf/BUILD.pdf index d7e886b..4760113 100644 Binary files a/doc/pdf/BUILD.pdf and b/doc/pdf/BUILD.pdf differ -- cgit v1.2.1