diff options
author | Lukasz Woznicki <lukasz.woznicki@softwareag.com> | 2022-02-09 12:59:13 +0000 |
---|---|---|
committer | Lukasz Woznicki <lukasz.woznicki@softwareag.com> | 2022-02-18 09:08:21 +0000 |
commit | b1907dc4780709bad572a7108314c563eb02b70a (patch) | |
tree | 3f6509c92eab17ade6ff1d824505699b98c4bd07 | |
parent | 9d2122d8775509e14aa519436f86987502ffcd77 (diff) |
Remove sm mapper from config scripts and update docs to not mention it
anymore
Signed-off-by: Lukasz Woznicki <lukasz.woznicki@softwareag.com>
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | configuration/debian/tedge_mapper/postinst | 2 | ||||
-rw-r--r-- | configuration/debian/tedge_mapper/prerm | 7 | ||||
-rw-r--r-- | configuration/init/systemd/tedge-mapper-sm-c8y.service | 12 | ||||
-rw-r--r-- | docs/src/howto-guides/004_connect.md | 8 | ||||
-rw-r--r-- | docs/src/howto-guides/008_config_local_mqtt_port.md | 14 | ||||
-rw-r--r-- | docs/src/howto-guides/012_install_and_enable_software_management.md | 4 | ||||
-rw-r--r-- | docs/src/howto-guides/014_thin_edge_logs.md | 15 | ||||
-rw-r--r-- | docs/src/tutorials/connect-c8y.md | 6 | ||||
-rw-r--r-- | docs/src/tutorials/software-management.md | 8 | ||||
-rw-r--r-- | tests/PySys/misc_features/custom_init_system/run.py | 12 | ||||
-rw-r--r-- | tests/PySys/software_management_end_to_end/sm_mapper_fail_and_reconnect/run.py | 20 | ||||
-rw-r--r-- | tests/PySys/tedge_connect/tedge_connect_test_sm_services/run.py | 11 | ||||
-rw-r--r-- | tests/PySys/tedge_connect/tedge_disconnect_test_sm_services/run.py | 12 |
14 files changed, 54 insertions, 80 deletions
@@ -22,3 +22,6 @@ tests/PySys/**/*.err **/__pycache__ tests/PySys/**/Output/ **/*venv* + +# Other files +Makefile.toml diff --git a/configuration/debian/tedge_mapper/postinst b/configuration/debian/tedge_mapper/postinst index 643afb73..cb473742 100644 --- a/configuration/debian/tedge_mapper/postinst +++ b/configuration/debian/tedge_mapper/postinst @@ -25,6 +25,6 @@ install -g tedge -o tedge -m 644 /dev/null /etc/tedge/operations/c8y/c8y_Restart install -g tedge -o tedge -m 644 /dev/null /etc/tedge/operations/c8y/c8y_LogfileRequest ### Initialize the sm mapper -tedge_mapper --init sm-c8y +tedge_mapper --init c8y #DEBHELPER# diff --git a/configuration/debian/tedge_mapper/prerm b/configuration/debian/tedge_mapper/prerm index a8563a9e..cf4bf9ba 100644 --- a/configuration/debian/tedge_mapper/prerm +++ b/configuration/debian/tedge_mapper/prerm @@ -6,7 +6,7 @@ print_hint() { echo "$1 is running. Stop $1 before installation, use: systemctl stop $1" echo "If you want to start $1 after installation, use: systemctl restart $1" echo "Make sure that other mappers are not running: systemctl is-active [mapper_name]" - echo "Known mappers are: tedge-mapper-c8y, tedge-mapper-collectd, tedge-mapper-sm-c8y, tedge-mapper-az". + echo "Known mappers are: tedge-mapper-c8y, tedge-mapper-collectd, tedge-mapper-az". } # Reenable the services only if systemctl is available @@ -16,11 +16,6 @@ if command -v systemctl >/dev/null; then exit 1 fi - if systemctl is-active --quiet tedge-mapper-sm-c8y; then - print_hint "tedge-mapper-sm-c8y" - exit 1 - fi - if systemctl is-active --quiet tedge-mapper-collectd; then print_hint "tedge-mapper-collectd" exit 1 diff --git a/configuration/init/systemd/tedge-mapper-sm-c8y.service b/configuration/init/systemd/tedge-mapper-sm-c8y.service deleted file mode 100644 index aa44986e..00000000 --- a/configuration/init/systemd/tedge-mapper-sm-c8y.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=tedge-mapper-sm-c8y converts SmartREST2.0 format to/from Software Management Thin Edge JSON format. -After=syslog.target network.target mosquitto.service - -[Service] -User=tedge-mapper -ExecStart=/usr/bin/tedge_mapper sm-c8y -Restart=on-failure -RestartPreventExitStatus=255 - -[Install] -WantedBy=multi-user.target diff --git a/docs/src/howto-guides/004_connect.md b/docs/src/howto-guides/004_connect.md index 0684df86..fb65fb5f 100644 --- a/docs/src/howto-guides/004_connect.md +++ b/docs/src/howto-guides/004_connect.md @@ -89,12 +89,6 @@ Starting tedge-agent service. Persisting tedge-agent on reboot. tedge-agent service successfully started and enabled! - -Starting tedge-mapper-sm-c8y service. - -Persisting tedge-mapper-sm-c8y on reboot. - -tedge-mapper-sm-c8y service successfully started and enabled! ``` ### Errors @@ -170,7 +164,7 @@ tedge-mapper service successfully started and enabled! Sending packets to check connection. This may take up to 10 seconds. Try 1 / 2: Sending a message to Cumulocity. ... No response. If the device is new, it's normal to get no response in the first try. -Try 2 / 2: Sending a message to Cumulocity. ... No response. +Try 2 / 2: Sending a message to Cumulocity. ... No response. Warning: Bridge has been configured, but Cumulocity connection check failed. ``` diff --git a/docs/src/howto-guides/008_config_local_mqtt_port.md b/docs/src/howto-guides/008_config_local_mqtt_port.md index f3cae02b..b506def0 100644 --- a/docs/src/howto-guides/008_config_local_mqtt_port.md +++ b/docs/src/howto-guides/008_config_local_mqtt_port.md @@ -8,24 +8,26 @@ The thin edge device has to be disconnected from the cloud using the `tedge` com ```shell tedge disconnect c8y/az -``` +``` -## Step 2: Set and verify the new mqtt port +## Step 2: Set and verify the new mqtt port Set the mqtt.port with a desired port using `tedge` command as below. - + ```shell tedge config set mqtt.port 1024 ``` + This will make sure that all the mqtt clients use the newer port that has been set. ## Verify the port configured/set Use below command to check the port has been set properly or not. - + ```shell tedge config get mqtt.port ``` + This prints out the port that has been set. ## Step 3: Connect the thin edge device to cloud @@ -33,7 +35,7 @@ This prints out the port that has been set. Using `tedge` command connect to the desired cloud as below. This will configure all the services (mosquitto, tedge-mapper-c8y.service, tedge-mapper-az.service, sm_agent, -tedge-agent.service, tedge-mapper-sm-c8y.service) to use the newely set port. +tedge-agent.service) to use the newly set port. ```shell tedge connect c8y @@ -43,7 +45,6 @@ tedge connect c8y tedge connect az ``` - Note: The step 1 and 2 can be followed in any order. ## Update to use default port @@ -53,6 +54,7 @@ To use the default port (1883), the mqtt.port has to be unset using the `tedge` ```shell tedge config unset mqtt.port ``` + Once the port is reverted to default, the [step 1](#Step-3:-Connect-the-thin-edge-device-to-cloud) and 3 has to be followed to use the default port. diff --git a/docs/src/howto-guides/012_install_and_enable_software_management.md b/docs/src/howto-guides/012_install_and_enable_software_management.md index 55d283b8..90ca6d4d 100644 --- a/docs/src/howto-guides/012_install_and_enable_software_management.md +++ b/docs/src/howto-guides/012_install_and_enable_software_management.md @@ -64,13 +64,13 @@ For debugging purpose or to disable/enable the software management services, one ```shell sudo systemctl start tedge-agent.service -sudo systemctl start tedge-mapper-sm-c8y.service +sudo systemctl start tedge-mapper-c8y.service ``` ### Stopping the services ```shell sudo systemctl stop tedge-agent.service -sudo systemctl stop tedge-mapper-sm-c8y.service +sudo systemctl stop tedge-mapper-c8y.service ``` diff --git a/docs/src/howto-guides/014_thin_edge_logs.md b/docs/src/howto-guides/014_thin_edge_logs.md index 2ede0854..85718662 100644 --- a/docs/src/howto-guides/014_thin_edge_logs.md +++ b/docs/src/howto-guides/014_thin_edge_logs.md @@ -55,15 +55,6 @@ tedge-agent : TTY=unknown ; PWD=/tmp ; USER=root ; COMMAND=/etc/tedge/sm-plugins > Note: Run `tedge_agent --debug` to log more debug messages -#### Tedge cumulocity sm mapper logs -The software management mapper service logs can be accessed as below - -`journalctl -u tedge-mapper-sm-c8y.service` - -For example: tedge_mapper[6696]: 2021-09-29T03:38:53.853+00:00 ERROR tedge_mapper::mapper: MQTT connection error: I/O: Connection refused - -> Note: Run `tedge_mapper --debug sm-c8y` to log more debug messages - ## Thirdparty component logs Thin-edge uses the third-party components `Mosquitto` as the mqtt broker and `Collectd` for monitoring purpose. The logs that are created by these components can be accessed on a thin-edge device as below. @@ -84,12 +75,12 @@ So, the collectd specific logs can be accessed using the `journalctl` as below ## Accessing logs remotely You can access logs from Cumulocity's "Logs" tab in Device Management. Do to this, go to the device you want to the logs for -and click on the "Logs" button on the left-hand side. Next, click on the "Request log file" button located in the top right corner. -This will bring a dropdown into view where you can select the date and time range, the type of log required as well as filter +and click on the "Logs" button on the left-hand side. Next, click on the "Request log file" button located in the top right corner. +This will bring a dropdown into view where you can select the date and time range, the type of log required as well as filter for any particular words in the logs (such as ERROR) and select the total number of lines to upload. ![Log request dropdown](images/log_request_dropdown.png) -Logs are uploaded in the "Events" tab, where you can download them. +Logs are uploaded in the "Events" tab, where you can download them. ![Log request events tab](images/log_request_events_tab.png) diff --git a/docs/src/tutorials/connect-c8y.md b/docs/src/tutorials/connect-c8y.md index 060822f3..9202e1b9 100644 --- a/docs/src/tutorials/connect-c8y.md +++ b/docs/src/tutorials/connect-c8y.md @@ -144,12 +144,6 @@ Starting tedge-agent service. Persisting tedge-agent on reboot. tedge-agent service successfully started and enabled! - -Starting tedge-mapper-sm-c8y service. - -Persisting tedge-mapper-sm-c8y on reboot. - -tedge-mapper-sm-c8y service successfully started and enabled! ``` ## Sending your first telemetry data diff --git a/docs/src/tutorials/software-management.md b/docs/src/tutorials/software-management.md index 8160114b..55057fc8 100644 --- a/docs/src/tutorials/software-management.md +++ b/docs/src/tutorials/software-management.md @@ -12,10 +12,10 @@ cloud using the **software management** feature of thin-edge.io. Three components are required on your devices to enable software management: 1. Software management mapper for Cumulocity cloud - Sm-mapper acts as a proxy between the cloud and the device. + mapper acts as a proxy between the cloud and the device. This translates the cloud specific message type into device specific type and vice-versa.(Example: Cumulocity smart-rest to/from thin-edge json) The messages from cloud will be translated and forwarded to the `tedge_agent` and messages from `tedge_agent` will be translated and sent to cumulocity cloud. - You can find this process with the name `tedge_mapper sm-c8y` in `ps` once it starts. + You can find this process with the name `tedge_mapper c8y` in `ps` once it starts. 2. Software management agent The thin-edge software management agent is the one that calls the plugins. @@ -105,7 +105,7 @@ Default plugin can be configured using the thin-edge cli command `tedge`. For example set `apt` plugin as a `default plugin` -``` -$ sudo tedge config set software.plugin.default apt +```shell +sudo tedge config set software.plugin.default apt ``` diff --git a/tests/PySys/misc_features/custom_init_system/run.py b/tests/PySys/misc_features/custom_init_system/run.py index eb4e6dd8..4a2b6eba 100644 --- a/tests/PySys/misc_features/custom_init_system/run.py +++ b/tests/PySys/misc_features/custom_init_system/run.py @@ -1,6 +1,7 @@ -from pysys.basetest import BaseTest import os +from pysys.basetest import BaseTest + """ Validate tedge connect/disconnect use a given init system config @@ -64,7 +65,8 @@ class CustomInitSystem(BaseTest): self.assertGrep("tedge_connect.out", "Error", contains=False) self.assertGrep("tedge_disconnect.out", "Error", contains=False) self.assertGrep(self.dummy_init_output, "Error", contains=False) - self.assertGrep(self.dummy_init_output, "The system config file '/etc/tedge/system.toml' doesn't exist.", contains=False) + self.assertGrep(self.dummy_init_output, + "The system config file '/etc/tedge/system.toml' doesn't exist.", contains=False) expected_output = [ "is_available", @@ -74,13 +76,9 @@ class CustomInitSystem(BaseTest): "enable tedge-mapper-c8y", "restart tedge-agent", "enable tedge-agent", - "restart tedge-mapper-sm-c8y", - "enable tedge-mapper-sm-c8y", "is-active mosquitto", "stop tedge-mapper-c8y", "disable tedge-mapper-c8y", - "stop tedge-mapper-sm-c8y", - "disable tedge-mapper-sm-c8y", "stop tedge-agent", "disable tedge-agent", ] @@ -89,7 +87,6 @@ class CustomInitSystem(BaseTest): for word in expected_output: self.assertGrep(self.dummy_init_output, word, contains=True) - def custom_cleanup(self): # Remove system.toml from /etc/tedge, otherwise other tests will use the config. remove_system_config_file = self.startProcess( @@ -104,4 +101,3 @@ class CustomInitSystem(BaseTest): arguments=["rm", "-rf", self.tmp_dir], stdouterr="remove_dummy_init", ) - diff --git a/tests/PySys/software_management_end_to_end/sm_mapper_fail_and_reconnect/run.py b/tests/PySys/software_management_end_to_end/sm_mapper_fail_and_reconnect/run.py index 4960f0e1..09c9d0b3 100644 --- a/tests/PySys/software_management_end_to_end/sm_mapper_fail_and_reconnect/run.py +++ b/tests/PySys/software_management_end_to_end/sm_mapper_fail_and_reconnect/run.py @@ -1,6 +1,6 @@ +import subprocess import sys import time -import subprocess from pathlib import Path from environment_tedge import TedgeEnvironment @@ -23,13 +23,15 @@ Then validate subscriber output for `503,c8y_SoftwareUpdate` for final result of Then test has passed """ -class SmMapperC8yReceiveLastMessageOnRestart(TedgeEnvironment): + +class SmMapperC8yReceiveLastMessageOnRestart(BaseTest): systemctl = "/usr/bin/systemctl" tedge = "/usr/bin/tedge" sudo = "/usr/bin/sudo" apt = "/usr/bin/apt-get" mqtt_sub = "/usr/bin/mosquitto_sub" rm = "/usr/bin/rm" + def setup(self): self.addCleanupFunction(self.smcleanup) @@ -61,7 +63,7 @@ class SmMapperC8yReceiveLastMessageOnRestart(TedgeEnvironment): time.sleep(2) self.startProcess( command=self.sudo, - arguments=[self.systemctl, "stop", "tedge-mapper-sm-c8y.service"], + arguments=[self.systemctl, "stop", "tedge-mapper-c8y.service"], stdouterr="sm_mapper_stop", ) @@ -74,10 +76,10 @@ class SmMapperC8yReceiveLastMessageOnRestart(TedgeEnvironment): # check if the agent has completed the operation time.sleep(15) - + self.startProcess( command=self.sudo, - arguments=[self.systemctl, "restart", "tedge-mapper-sm-c8y.service"], + arguments=[self.systemctl, "restart", "tedge-mapper-c8y.service"], stdouterr="sm_mapper_restart", ) @@ -98,8 +100,12 @@ class SmMapperC8yReceiveLastMessageOnRestart(TedgeEnvironment): self.assertGrep("tedge_sub.out", "503,c8y_SoftwareUpdate", contains=True) def smcleanup(self): - self.log.info("Stop sm-mapper and agent") - self.tedge_disconnect_c8y() + self.log.info("Stop c8y-mapper and agent") + self.startProcess( + command=self.sudo, + arguments=[self.tedge, "disconnect", "c8y"], + stdouterr="connect_c8y", + ) def setup_mosquitto(self): self.startProcess( diff --git a/tests/PySys/tedge_connect/tedge_connect_test_sm_services/run.py b/tests/PySys/tedge_connect/tedge_connect_test_sm_services/run.py index c852a2e1..06bd4196 100644 --- a/tests/PySys/tedge_connect/tedge_connect_test_sm_services/run.py +++ b/tests/PySys/tedge_connect/tedge_connect_test_sm_services/run.py @@ -1,8 +1,9 @@ import sys -sys.path.append("environments") from environment_c8y import EnvironmentC8y +sys.path.append("environments") + """ Run connection test while being connected (positive case): @@ -26,14 +27,12 @@ class TedgeConnectTestSMServices(EnvironmentC8y): super().validate() self.log.info("Validate") - # Validate if the Software management services are getting started and - # enabled properly on "tedge connect c8y". - # Hint: EnvironmentTedge captures the log messages in tedge_connect.out + # Validate if the Software management services are getting started and enabled properly on "tedge disconnect c8y" + # EnvironmentC8y captures the log messages in tedge_connect.out self.assertGrep( "tedge_connect_c8y.out", "tedge-agent service successfully started and enabled!", contains=True ) self.assertGrep( - "tedge_connect_c8y.out", "tedge-mapper-sm-c8y service successfully started and enabled!", contains=True + "tedge_connect.out", "tedge-mapper-c8y service successfully started and enabled!", contains=True ) - diff --git a/tests/PySys/tedge_connect/tedge_disconnect_test_sm_services/run.py b/tests/PySys/tedge_connect/tedge_disconnect_test_sm_services/run.py index c93022b4..a374736f 100644 --- a/tests/PySys/tedge_connect/tedge_disconnect_test_sm_services/run.py +++ b/tests/PySys/tedge_connect/tedge_disconnect_test_sm_services/run.py @@ -1,8 +1,9 @@ import sys -sys.path.append("environments") from environment_c8y import EnvironmentC8y +sys.path.append("environments") + """ Run connection test while being connected : @@ -16,12 +17,17 @@ Then the test has passed """ + class TedgeDisConnectTestSMServices(EnvironmentC8y): # The base class rexecutes the `sudo tedge connect c8y` def validate(self): super().validate() - self.tedge_disconnect_c8y() + self.startProcess( + command=self.sudo, + arguments=[self.tedge, "disconnect", "c8y"], + stdouterr="tedge_disconnect_c8y", + ) # Validate if the Software management services are getting stopped and disabled properly on "tedge disconnect c8y" self.assertGrep( @@ -29,5 +35,5 @@ class TedgeDisConnectTestSMServices(EnvironmentC8y): ) self.assertGrep( - "tedge_disconnect_c8y.out", "tedge-mapper-sm-c8y service successfully stopped and disabled!", contains=True + "tedge_disconnect_c8y.out", "tedge-mapper-c8y service successfully stopped and disabled!", contains=True ) |