Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document using ttn-lw-migrate to migrate from v2 #130

Merged
merged 7 commits into from
Feb 9, 2021

Conversation

benolayinka
Copy link
Contributor

Summary

Update documentation to use ttn-lw-migrate instead of ttnctl for migrating from v2 to v3.

Checklist

  • Scope: The referenced issue is addressed, there are no unrelated changes.
  • Run Locally: Verified that the docs build using make server
  • New Features Marked: Documentation for new features is marked using the new-in-version shortcode, according to the guidelines in CONTRIBUTING.
  • Style Guidelines: Documentation obeys style guidelines in CONTRIBUTING.
  • Commits: Commit messages follow guidelines in CONTRIBUTING, there are no fixup commits left.

Copy link
Contributor

@neoaggelos neoaggelos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, minor suggestion.


## Export End Devices from {{% ttnv2 %}}

In order to export a single device, use the following command. The device with ID `mydevice` will exported and saved to `device.json`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In order to export a single device, use the following command. The device with ID `mydevice` will exported and saved to `device.json`.
In order to export a single device, use the following command. The device with ID `mydevice` will be exported and saved to `device.json`.

@@ -11,6 +11,14 @@ This section documents the process of migrating end devices from {{% ttnv2 %}} t

For a breakdown of differences between {{% ttnv2 %}} and {{% tts %}}, see the [Major Changes]({{< relref "major-changes" >}}) section.

>**Note**:
>
>When migrating devices from the Public Community Network to {{< tts >}} Cloud, you may choose to transfer the active device sessions as well, which means that your devices will continue to work with {{% tts %}}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
>When migrating devices from the Public Community Network to {{< tts >}} Cloud, you may choose to transfer the active device sessions as well, which means that your devices will continue to work with {{% tts %}}.
>When migrating devices from the Public Community Network to {{% tts %}} Cloud, you may choose to transfer the active device sessions as well, which means that your devices will continue to work with {{% tts %}}.

>
>When migrating from a private {{% ttnv2 %}}, devices that are outside of the DevAddr address block supported by {{% tts %}} Cloud will have to rejoin the network, otherwise {{% tts %}} will be unable to route their uplink and downlink traffic.
>
>{{% tts %}} Dedicated Cloud, Enterprise and Marketplace Launcher deployments are not affected by this issue.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then use the distributions for this section?

@@ -19,13 +27,82 @@ For a breakdown of differences between {{% ttnv2 %}} and {{% tts %}}, see the [M

**Finally**: Once you are confident that your end devices are working properly, migrate the rest of your devices and gateways to {{% tts %}}.

## Configure V2 CLI
## Configure ttn-lw-migrate
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Configure ttn-lw-migrate
## Configure `ttn-lw-migrate`

## Configure V2 CLI
## Configure ttn-lw-migrate

End devices and applications can easily be migrated from {{% ttnv2 %}} to {{% tts %}} with the [`ttn-lw-migrate`](https://github.com/TheThingsNetwork/lorawan-stack-migrate) tool. This tool is used for exporting end devices and applications to a [JSON file]({{< ref "getting-started/migrating/device-json.md" >}}) containing their description. This file can later be imported in {{% tts %}} as described in the [Import End Devices in The Things Stack]({{< ref "getting-started/migrating/import-devices.md" >}}) section.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
End devices and applications can easily be migrated from {{% ttnv2 %}} to {{% tts %}} with the [`ttn-lw-migrate`](https://github.com/TheThingsNetwork/lorawan-stack-migrate) tool. This tool is used for exporting end devices and applications to a [JSON file]({{< ref "getting-started/migrating/device-json.md" >}}) containing their description. This file can later be imported in {{% tts %}} as described in the [Import End Devices in The Things Stack]({{< ref "getting-started/migrating/import-devices.md" >}}) section.
End devices and applications can easily be migrated from {{% ttnv2 %}} to {{% tts %}} with the [`ttn-lw-migrate`](https://github.com/TheThingsNetwork/lorawan-stack-migrate) tool. This tool is used for exporting end devices and applications to a [JSON file]({{< ref "getting-started/migrating/device-json.md" >}}) containing their description. This file can later be imported in {{% tts %}} as described in the [Import End Devices in {{% tts %}}]({{< ref "getting-started/migrating/import-devices.md" >}}) section.


>**Note:**: Payload formatters are not exported. See [Payload Formatters](https://thethingsstack.io/integrations/payload-formatters/).

>**Warning:**: Active device sessions are exported by default. You can disable this by using the `--ttnv2.with-session=false` flag. It is recommended that you do not export session keys for devices that can instead re-join on The Things Stack.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Too many colons here (2x)
  • What are "active device sessions"? Probably just sessions
  • Why is this not recommended? People can't really go to their devices and power cycle them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@neoaggelos i don't have these answers so I'm reassigning you


An end device can only be registered in one Network Server at a time. After importing an end device to {{% tts %}}, you should remove it from {{% ttnv2 %}}.

For OTAA devices, it is enough to simply change the AppKey, so the device can no longer join but the existing session is preserved. Next time the device joins, the activation will be handled by {{% tts %}}.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not if people imported the session as well


For OTAA devices, it is enough to simply change the AppKey, so the device can no longer join but the existing session is preserved. Next time the device joins, the activation will be handled by {{% tts %}}.

It is important that you unset the `AppKey` property of your exported devices, so that they are able to join properly on {{% tts %}}. This can be done from
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean with "join properly"?


In this step, the end devices from {{% ttnv2 %}} will be exported in a JSON format that can then be parsed and imported by {{% tts %}}.
> Optional: define an alias on ttnctl --config /home/<user_name>/.ttnctl/community.yml to go faster
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> Optional: define an alias on ttnctl --config /home/<user_name>/.ttnctl/community.yml to go faster
> **Optional:** define an alias on `ttnctl --config /home/<user_name>/.ttnctl/community.yml` to go faster

How?

### Disable Exported End Devices on V2

After exporting, make sure to clear the AppKey of your OTAA devices. This can be achieved with the following command:
To clear the AppKey of an OTAA device, use the following command:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means that the session is still in V2, and that V2 is still sending downlink messages and managing the end device's MAC state, which may lead to problems

@johanstokking
Copy link
Member

Why is this not followed up on?

@neoaggelos if you don't request reviews, it does not show up on the list for reviews and nothing happens.

$ ttnctl devices convert-all-to-abp --save-to-attribute "original-app-key"
# dry run first, verify that no errors occur
$ ttn-lw-migrate application --verbose --dry-run --source ttnv2 "my-ttn-app" > all-devices.json
# export device
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# export device
# export devices

@@ -4,9 +4,17 @@ weight: 2
aliases: "/getting-started/migrating-from-v2/gateway-migration"
---

For instructions on adding gateways to {{% tts %}} using the CLI or Console, see [Adding Gateways]({{< ref "gateways/adding-gateways" >}}).
Migrating gateway is a two step process.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Migrating gateway is a two step process.
Migrating gateways is a two step process.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


Update the server address in the gateway configuration settings.
- When using the Semtech UDP Packet Forwarder, make sure to update the `server_address` in the gateway configuration settings to the address of the ateway Server (e.g. `my-tts-network.nam1.cloud.thethings.industries`).
- When using the LoRa Basics Station protocol refer [LoRa Basics Station document]({{< ref "gateways/lora-basics-station" >}})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refer to

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -74,9 +73,10 @@ Read more on [HTTP Webhooks]({{< ref "/integrations/webhooks" >}}).

#### Storage Integration

{{% tts %}} does not currently support a Storage integration similar to {{% ttnv2 %}}. This feature will be added in a future release.
{{% tts %}} does support a Storage integration similar to {{% ttnv2 %}}. Refer [Storage Integration]({{< ref "/integrations/storage" >}}).
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refer to

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


## Pre-requisites

1. User account in V2.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

User account in {{% ttnv2 %}}
User account in {{% tts %}} v3

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -64,7 +84,7 @@ $ ttn-lw-migrate devices --dry-run --verbose --source ttnv2 "mydevice" > devices
$ ttn-lw-migrate device --source ttnv2 "mydevice" > devices.json
```

{{< warning >}} The export process will clear the device root keys (**AppKey**) and session (**AppSKey**, **NwkSKey**, **DevAddr**, **FCntUp** and **FCntDown**) from {{% ttnv2 %}}. Execute any commands with the `--dry-run` first, which will do everything except delete the device keys from {{% ttnv2 %}}. {{</ warning >}}
{{< warning >}} The export process will clear the device root keys (**AppKey**) and session (**AppSKey**, **NwkSKey**, **DevAddr**, **FCntUp** and **FCntDown**) from {{% ttnv2 %}} by default. You can disable this by using the `--ttnv2.with-session=false` flag. {{</ warning >}}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use --dry-run ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding the --dry-run flag, the usage is already mentioned in the same section.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, it makes sense to say to use that and then use it in the example. I don't think it make sense to say

"disable this by using the --ttnv2.with-session=false flag"

and then

$ ttn-lw-migrate device --source ttnv2 --dry-run "mydevice" > devices.json

that is confusing. Let's stick to one. @neoaggelos recommended --dry-run, so i prefer that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benolayinka, By default the export process will export session information of the device and clears off all the info from V2. If the --ttnv2.with-session=false flag is used, it will not include session info in the exported file and doesn’t delete it from V2.

So if the customer wants to export their devices without session info, --ttnv2.with-session=false flag needs to be added in the command. Hence, the purpose of this is different from that of the --dry-run flag.

@htdvisser htdvisser removed their request for review February 3, 2021 15:48
@benolayinka
Copy link
Contributor Author

this is critical documentation so i vote if there are no serious issues that we merge now and improve along the way. @johanstokking, waiting on your review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants