From 62862b3e96336c02789eb141b2a5937249f581f7 Mon Sep 17 00:00:00 2001 From: Krishna Iyer Easwaran Date: Thu, 15 Jun 2023 16:03:10 +0200 Subject: [PATCH 1/4] api: Update HTTP API route for parsing QR codes --- api/api.md | 4 +- api/api.swagger.json | 110 +++++++++++++-------------- api/qrcodegenerator.proto | 4 +- pkg/ttnpb/qrcodegenerator.pb.go | 24 +++--- pkg/ttnpb/qrcodegenerator.pb.gw.go | 12 +-- sdk/js/generated/api-definition.json | 4 +- sdk/js/generated/api.json | 4 +- 7 files changed, 81 insertions(+), 81 deletions(-) diff --git a/api/api.md b/api/api.md index e846089230..3824c298f7 100644 --- a/api/api.md +++ b/api/api.md @@ -8675,8 +8675,8 @@ The Pba service allows clients to manage peering through Packet Broker. | `GetFormat` | `GET` | `/api/v3/qr-codes/end-devices/formats/{format_id}` | | | `ListFormats` | `GET` | `/api/v3/qr-codes/end-devices/formats` | | | `Generate` | `POST` | `/api/v3/qr-codes/end-devices` | `*` | -| `Parse` | `POST` | `/api/v3/qr-code/end-devices/parse` | `*` | -| `Parse` | `POST` | `/api/v3/qr-code/end-devices/{format_id}/parse` | `*` | +| `Parse` | `POST` | `/api/v3/qr-codes/end-devices/parse` | `*` | +| `Parse` | `POST` | `/api/v3/qr-codes/end-devices/{format_id}/parse` | `*` | ## File `lorawan-stack/api/regional.proto` diff --git a/api/api.swagger.json b/api/api.swagger.json index c6e15c7c2c..4321bba9e5 100644 --- a/api/api.swagger.json +++ b/api/api.swagger.json @@ -13846,15 +13846,15 @@ ] } }, - "/qr-code/end-devices/parse": { + "/qr-codes/end-devices": { "post": { - "summary": "Parse QR Codes of known formats and return the information contained within.", - "operationId": "EndDeviceQRCodeGenerator_Parse", + "summary": "Generates a QR code.", + "operationId": "EndDeviceQRCodeGenerator_Generate", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/v3ParseEndDeviceQRCodeResponse" + "$ref": "#/definitions/v3GenerateQRCodeResponse" } }, "default": { @@ -13870,7 +13870,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/v3ParseEndDeviceQRCodeRequest" + "$ref": "#/definitions/v3GenerateEndDeviceQRCodeRequest" } } ], @@ -13879,15 +13879,15 @@ ] } }, - "/qr-code/end-devices/{format_id}/parse": { - "post": { - "summary": "Parse QR Codes of known formats and return the information contained within.", - "operationId": "EndDeviceQRCodeGenerator_Parse2", + "/qr-codes/end-devices/formats": { + "get": { + "summary": "Returns the supported formats.", + "operationId": "EndDeviceQRCodeGenerator_ListFormats", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/v3ParseEndDeviceQRCodeResponse" + "$ref": "#/definitions/v3QRCodeFormats" } }, "default": { @@ -13897,44 +13897,20 @@ } } }, - "parameters": [ - { - "name": "format_id", - "description": "QR code format identifier.\nEnumerate available formats with the rpc `ListFormats`.\nIf this field is not specified, the server will attempt to parse the data with each known format.", - "in": "path", - "required": true, - "type": "string" - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "qr_code": { - "type": "string", - "format": "byte", - "description": "Raw QR code contents." - } - } - } - } - ], "tags": [ "EndDeviceQRCodeGenerator" ] } }, - "/qr-codes/end-devices": { - "post": { - "summary": "Generates a QR code.", - "operationId": "EndDeviceQRCodeGenerator_Generate", + "/qr-codes/end-devices/formats/{format_id}": { + "get": { + "summary": "Return the QR code format.", + "operationId": "EndDeviceQRCodeGenerator_GetFormat", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/v3GenerateQRCodeResponse" + "$ref": "#/definitions/v3QRCodeFormat" } }, "default": { @@ -13946,12 +13922,11 @@ }, "parameters": [ { - "name": "body", - "in": "body", + "name": "format_id", + "description": "QR code format identifier. Enumerate available formats with rpc ListFormats in the EndDeviceQRCodeGenerator service.", + "in": "path", "required": true, - "schema": { - "$ref": "#/definitions/v3GenerateEndDeviceQRCodeRequest" - } + "type": "string" } ], "tags": [ @@ -13959,15 +13934,15 @@ ] } }, - "/qr-codes/end-devices/formats": { - "get": { - "summary": "Returns the supported formats.", - "operationId": "EndDeviceQRCodeGenerator_ListFormats", + "/qr-codes/end-devices/parse": { + "post": { + "summary": "Parse QR Codes of known formats and return the information contained within.", + "operationId": "EndDeviceQRCodeGenerator_Parse", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/v3QRCodeFormats" + "$ref": "#/definitions/v3ParseEndDeviceQRCodeResponse" } }, "default": { @@ -13977,20 +13952,30 @@ } } }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v3ParseEndDeviceQRCodeRequest" + } + } + ], "tags": [ "EndDeviceQRCodeGenerator" ] } }, - "/qr-codes/end-devices/formats/{format_id}": { - "get": { - "summary": "Return the QR code format.", - "operationId": "EndDeviceQRCodeGenerator_GetFormat", + "/qr-codes/end-devices/{format_id}/parse": { + "post": { + "summary": "Parse QR Codes of known formats and return the information contained within.", + "operationId": "EndDeviceQRCodeGenerator_Parse2", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/v3QRCodeFormat" + "$ref": "#/definitions/v3ParseEndDeviceQRCodeResponse" } }, "default": { @@ -14003,10 +13988,25 @@ "parameters": [ { "name": "format_id", - "description": "QR code format identifier. Enumerate available formats with rpc ListFormats in the EndDeviceQRCodeGenerator service.", + "description": "QR code format identifier.\nEnumerate available formats with the rpc `ListFormats`.\nIf this field is not specified, the server will attempt to parse the data with each known format.", "in": "path", "required": true, "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "qr_code": { + "type": "string", + "format": "byte", + "description": "Raw QR code contents." + } + } + } } ], "tags": [ diff --git a/api/qrcodegenerator.proto b/api/qrcodegenerator.proto index 7e1b699092..b757b02b78 100644 --- a/api/qrcodegenerator.proto +++ b/api/qrcodegenerator.proto @@ -104,10 +104,10 @@ service EndDeviceQRCodeGenerator { // Parse QR Codes of known formats and return the information contained within. rpc Parse(ParseEndDeviceQRCodeRequest) returns (ParseEndDeviceQRCodeResponse){ option (google.api.http) = { - post: "/qr-code/end-devices/parse", + post: "/qr-codes/end-devices/parse", body: "*" additional_bindings { - post: "/qr-code/end-devices/{format_id}/parse" + post: "/qr-codes/end-devices/{format_id}/parse" body: "*" } }; diff --git a/pkg/ttnpb/qrcodegenerator.pb.go b/pkg/ttnpb/qrcodegenerator.pb.go index 8125ed9eea..0b49f4c958 100644 --- a/pkg/ttnpb/qrcodegenerator.pb.go +++ b/pkg/ttnpb/qrcodegenerator.pb.go @@ -576,7 +576,7 @@ var file_lorawan_stack_api_qrcodegenerator_proto_rawDesc = []byte{ 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x74, 0x74, 0x6e, 0x2e, 0x6c, 0x6f, 0x72, 0x61, 0x77, 0x61, 0x6e, 0x2e, 0x76, 0x33, 0x2e, 0x45, 0x6e, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x52, 0x11, 0x65, 0x6e, 0x64, 0x44, 0x65, - 0x76, 0x69, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x32, 0xce, 0x04, 0x0a, + 0x76, 0x69, 0x63, 0x65, 0x54, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x32, 0xd0, 0x04, 0x0a, 0x18, 0x45, 0x6e, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x51, 0x52, 0x43, 0x6f, 0x64, 0x65, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x6f, 0x72, 0x12, 0x84, 0x01, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x12, 0x26, 0x2e, 0x74, 0x74, 0x6e, 0x2e, 0x6c, 0x6f, @@ -602,22 +602,22 @@ var file_lorawan_stack_api_qrcodegenerator_proto_rawDesc = []byte{ 0x72, 0x61, 0x74, 0x65, 0x51, 0x52, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x3a, 0x01, 0x2a, 0x22, 0x15, 0x2f, 0x71, 0x72, 0x2d, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x2f, 0x65, 0x6e, 0x64, 0x2d, 0x64, 0x65, 0x76, - 0x69, 0x63, 0x65, 0x73, 0x12, 0xb6, 0x01, 0x0a, 0x05, 0x50, 0x61, 0x72, 0x73, 0x65, 0x12, 0x2b, + 0x69, 0x63, 0x65, 0x73, 0x12, 0xb8, 0x01, 0x0a, 0x05, 0x50, 0x61, 0x72, 0x73, 0x65, 0x12, 0x2b, 0x2e, 0x74, 0x74, 0x6e, 0x2e, 0x6c, 0x6f, 0x72, 0x61, 0x77, 0x61, 0x6e, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x45, 0x6e, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x51, 0x52, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x74, 0x74, 0x6e, 0x2e, 0x6c, 0x6f, 0x72, 0x61, 0x77, 0x61, 0x6e, 0x2e, 0x76, 0x33, 0x2e, 0x50, 0x61, 0x72, 0x73, 0x65, 0x45, 0x6e, 0x64, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x51, 0x52, 0x43, 0x6f, 0x64, - 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x52, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x4c, 0x3a, 0x01, 0x2a, 0x5a, 0x2b, 0x3a, 0x01, 0x2a, 0x22, 0x26, 0x2f, 0x71, 0x72, 0x2d, 0x63, - 0x6f, 0x64, 0x65, 0x2f, 0x65, 0x6e, 0x64, 0x2d, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, - 0x7b, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x70, 0x61, 0x72, 0x73, - 0x65, 0x22, 0x1a, 0x2f, 0x71, 0x72, 0x2d, 0x63, 0x6f, 0x64, 0x65, 0x2f, 0x65, 0x6e, 0x64, 0x2d, - 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x70, 0x61, 0x72, 0x73, 0x65, 0x42, 0x31, 0x5a, - 0x2f, 0x67, 0x6f, 0x2e, 0x74, 0x68, 0x65, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x73, 0x2e, 0x6e, 0x65, - 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x6c, 0x6f, 0x72, 0x61, 0x77, 0x61, 0x6e, 0x2d, 0x73, 0x74, - 0x61, 0x63, 0x6b, 0x2f, 0x76, 0x33, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x74, 0x74, 0x6e, 0x70, 0x62, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x54, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x4e, 0x3a, 0x01, 0x2a, 0x5a, 0x2c, 0x3a, 0x01, 0x2a, 0x22, 0x27, 0x2f, 0x71, 0x72, 0x2d, 0x63, + 0x6f, 0x64, 0x65, 0x73, 0x2f, 0x65, 0x6e, 0x64, 0x2d, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, + 0x2f, 0x7b, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x5f, 0x69, 0x64, 0x7d, 0x2f, 0x70, 0x61, 0x72, + 0x73, 0x65, 0x22, 0x1b, 0x2f, 0x71, 0x72, 0x2d, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x2f, 0x65, 0x6e, + 0x64, 0x2d, 0x64, 0x65, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x70, 0x61, 0x72, 0x73, 0x65, 0x42, + 0x31, 0x5a, 0x2f, 0x67, 0x6f, 0x2e, 0x74, 0x68, 0x65, 0x74, 0x68, 0x69, 0x6e, 0x67, 0x73, 0x2e, + 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x6c, 0x6f, 0x72, 0x61, 0x77, 0x61, 0x6e, 0x2d, + 0x73, 0x74, 0x61, 0x63, 0x6b, 0x2f, 0x76, 0x33, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x74, 0x74, 0x6e, + 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pkg/ttnpb/qrcodegenerator.pb.gw.go b/pkg/ttnpb/qrcodegenerator.pb.gw.go index 624b07dbc7..8ad037f3d1 100644 --- a/pkg/ttnpb/qrcodegenerator.pb.gw.go +++ b/pkg/ttnpb/qrcodegenerator.pb.gw.go @@ -327,7 +327,7 @@ func RegisterEndDeviceQRCodeGeneratorHandlerServer(ctx context.Context, mux *run inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/ttn.lorawan.v3.EndDeviceQRCodeGenerator/Parse", runtime.WithHTTPPathPattern("/qr-code/end-devices/parse")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/ttn.lorawan.v3.EndDeviceQRCodeGenerator/Parse", runtime.WithHTTPPathPattern("/qr-codes/end-devices/parse")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -352,7 +352,7 @@ func RegisterEndDeviceQRCodeGeneratorHandlerServer(ctx context.Context, mux *run inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/ttn.lorawan.v3.EndDeviceQRCodeGenerator/Parse", runtime.WithHTTPPathPattern("/qr-code/end-devices/{format_id}/parse")) + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/ttn.lorawan.v3.EndDeviceQRCodeGenerator/Parse", runtime.WithHTTPPathPattern("/qr-codes/end-devices/{format_id}/parse")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -482,7 +482,7 @@ func RegisterEndDeviceQRCodeGeneratorHandlerClient(ctx context.Context, mux *run inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/ttn.lorawan.v3.EndDeviceQRCodeGenerator/Parse", runtime.WithHTTPPathPattern("/qr-code/end-devices/parse")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/ttn.lorawan.v3.EndDeviceQRCodeGenerator/Parse", runtime.WithHTTPPathPattern("/qr-codes/end-devices/parse")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -504,7 +504,7 @@ func RegisterEndDeviceQRCodeGeneratorHandlerClient(ctx context.Context, mux *run inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) var err error var annotatedContext context.Context - annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/ttn.lorawan.v3.EndDeviceQRCodeGenerator/Parse", runtime.WithHTTPPathPattern("/qr-code/end-devices/{format_id}/parse")) + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/ttn.lorawan.v3.EndDeviceQRCodeGenerator/Parse", runtime.WithHTTPPathPattern("/qr-codes/end-devices/{format_id}/parse")) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return @@ -530,9 +530,9 @@ var ( pattern_EndDeviceQRCodeGenerator_Generate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"qr-codes", "end-devices"}, "")) - pattern_EndDeviceQRCodeGenerator_Parse_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"qr-code", "end-devices", "parse"}, "")) + pattern_EndDeviceQRCodeGenerator_Parse_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"qr-codes", "end-devices", "parse"}, "")) - pattern_EndDeviceQRCodeGenerator_Parse_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"qr-code", "end-devices", "format_id", "parse"}, "")) + pattern_EndDeviceQRCodeGenerator_Parse_1 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"qr-codes", "end-devices", "format_id", "parse"}, "")) ) var ( diff --git a/sdk/js/generated/api-definition.json b/sdk/js/generated/api-definition.json index ab1b1d496b..2c7043cf87 100644 --- a/sdk/js/generated/api-definition.json +++ b/sdk/js/generated/api-definition.json @@ -5501,13 +5501,13 @@ "http": [ { "method": "post", - "pattern": "/qr-code/end-devices/parse", + "pattern": "/qr-codes/end-devices/parse", "body": "*", "parameters": [] }, { "method": "post", - "pattern": "/qr-code/end-devices/{format_id}/parse", + "pattern": "/qr-codes/end-devices/{format_id}/parse", "body": "*", "parameters": [ "format_id" diff --git a/sdk/js/generated/api.json b/sdk/js/generated/api.json index e91a5e5a55..951378bb53 100644 --- a/sdk/js/generated/api.json +++ b/sdk/js/generated/api.json @@ -40391,12 +40391,12 @@ "rules": [ { "method": "POST", - "pattern": "/qr-code/end-devices/parse", + "pattern": "/qr-codes/end-devices/parse", "body": "*" }, { "method": "POST", - "pattern": "/qr-code/end-devices/{format_id}/parse", + "pattern": "/qr-codes/end-devices/{format_id}/parse", "body": "*" } ] From d7d07fece40eed91c7ef16450bea13919e46371a Mon Sep 17 00:00:00 2001 From: Krishna Iyer Easwaran Date: Thu, 15 Jun 2023 16:10:17 +0200 Subject: [PATCH 2/4] dev: Update changelog --- CHANGELOG.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c79ee502c1..81381d9589 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,9 @@ For details about compatibility between different releases, see the **Commitment ### Fixed - Fix payload formatter page launching malformed requests in the Console. +- HTTP API routes for parsing QR codes for the QR Generator service. We exercise our right to break compatibility with third party HTTP clients since this is a bug. + - `/qr-code/end-devices/parse` is changed to `/qr-codes/end-devices/parse`. + - `/qr-code/end-devices/{format_id}/parse` is changed to `/qr-codes/end-devices/{format_id}/parse`. ### Security @@ -117,7 +120,7 @@ For details about compatibility between different releases, see the **Commitment - Device claiming that transfer devices between applications is now deprecated and will be removed in a future version of The Things Stack. Device claiming on Join Servers, including The Things Join Server, remains functional. This deprecates the following components: - API for managing application claim authorization (`EndDeviceClaimingServer.AuthorizeApplication` and `EndDeviceClaimingServer.UnauthorizeApplication`) - CLI commands to manage application claim settings (`ttn-lw-cli application claim [authorize|unauthorize]`) - - CLI command to claim end devices (`ttn-lw-cli devices claim`) + - CLI command to claim end devices (`ttn-lw-cli devices claim`) ### Fixed @@ -251,10 +254,10 @@ For details about compatibility between different releases, see the **Commitment ### Changed - Option to ignore logs from selected gRPC methods now supports ignoring logs for selected errors on method. - Examples: - - `--grpc.log-ignore-methods="/ttn.lorawan.v3.GsNs/HandleUplink"`: log is skipped when no error occurs. - - `--grpc.log-ignore-methods="/ttn.lorawan.v3.GsNs/HandleUplink:pkg/networkserver:duplicate_uplink;pkg/networkserver:device_not_found"`: log is skipped when either `pkg/networkserver:duplicate_uplink` or `pkg/networkserver:device_not_found` error occurs (but not on success). - - `--grpc.log-ignore-methods="/ttn.lorawan.v3.GsNs/HandleUplink:;pkg/networkserver:duplicate_uplink"`: log is skipped on success or when `pkg/networkserver:duplicate_uplink` error occurs. + Examples: + - `--grpc.log-ignore-methods="/ttn.lorawan.v3.GsNs/HandleUplink"`: log is skipped when no error occurs. + - `--grpc.log-ignore-methods="/ttn.lorawan.v3.GsNs/HandleUplink:pkg/networkserver:duplicate_uplink;pkg/networkserver:device_not_found"`: log is skipped when either `pkg/networkserver:duplicate_uplink` or `pkg/networkserver:device_not_found` error occurs (but not on success). + - `--grpc.log-ignore-methods="/ttn.lorawan.v3.GsNs/HandleUplink:;pkg/networkserver:duplicate_uplink"`: log is skipped on success or when `pkg/networkserver:duplicate_uplink` error occurs. - The Gateway Server now takes into consideration the extra duty cycle checks present in the LoRa Basics Station forwarder. Previously the Gateway Server may accept the scheduling of downlinks which the packet forwarder would silently drop. - Note that in some rare cases in which the LoRa Basics Station duty cycle is stricter than the windowed approach used by The Things Stack, the scheduling will fail and this will be visible via `ns.down.data.schedule.fail` events. Note that this is actually a positive outcome - it allows the Network Server to schedule the downlink via another gateway, while previously the downlink would be scheduled but get silently dropped on the gateway. From 3667aaf9cd75f217b5482e9246268175d38838e9 Mon Sep 17 00:00:00 2001 From: Krishna Iyer Easwaran Date: Thu, 15 Jun 2023 16:21:55 +0200 Subject: [PATCH 3/4] console: Update cypress tests --- cypress/integration/console/devices/onboarding/qr-scan.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/integration/console/devices/onboarding/qr-scan.spec.js b/cypress/integration/console/devices/onboarding/qr-scan.spec.js index 224f868269..f9d21593a0 100644 --- a/cypress/integration/console/devices/onboarding/qr-scan.spec.js +++ b/cypress/integration/console/devices/onboarding/qr-scan.spec.js @@ -55,7 +55,7 @@ describe('Device onboarding with QR scan', () => { interceptDeviceRepo(appId) cy.intercept( 'POST', - '/api/v3/qr-code/end-devices/parse', + '/api/v3/qr-codes/end-devices/parse', composeQRGeneratorParseResponse({ ...device, vendorId: 428 }), ).as('qr-code-parse-request') cy.loginConsole({ user_id: user.ids.user_id, password: user.password }) From 80ded85ca59b642cbd35b2228d30509b8b7f21f0 Mon Sep 17 00:00:00 2001 From: Adrian-Stefan Mares Date: Thu, 22 Jun 2023 11:05:52 +0200 Subject: [PATCH 4/4] dcs: Fix EUI ordering --- pkg/deviceclaimingserver/grpc_end_devices.go | 2 +- pkg/deviceclaimingserver/grpc_end_devices_test.go | 13 +++++++++++-- pkg/deviceclaimingserver/util_test.go | 7 +++++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/pkg/deviceclaimingserver/grpc_end_devices.go b/pkg/deviceclaimingserver/grpc_end_devices.go index a0a0809dae..113b9d32eb 100644 --- a/pkg/deviceclaimingserver/grpc_end_devices.go +++ b/pkg/deviceclaimingserver/grpc_end_devices.go @@ -99,7 +99,7 @@ func (edcs *endDeviceClaimingServer) Claim( return nil, errClaimingNotSupported.WithAttributes("eui", joinEUI) } - err := claimer.Claim(ctx, devEUI, joinEUI, claimAuthenticationCode) + err := claimer.Claim(ctx, joinEUI, devEUI, claimAuthenticationCode) if err != nil { return nil, err } diff --git a/pkg/deviceclaimingserver/grpc_end_devices_test.go b/pkg/deviceclaimingserver/grpc_end_devices_test.go index 673e32f5f8..f9cf47d521 100644 --- a/pkg/deviceclaimingserver/grpc_end_devices_test.go +++ b/pkg/deviceclaimingserver/grpc_end_devices_test.go @@ -48,6 +48,7 @@ var ( registeredJoinEUI = types.EUI64{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0C} unRegisteredJoinEUI = types.EUI64{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D} registeredDevEUI = types.EUI64{0x00, 0x04, 0xA3, 0x0B, 0x00, 0x1C, 0x05, 0x30} + authenticationCode = "BEEF1234" ) func mustHavePeer(ctx context.Context, c *component.Component, role ttnpb.ClusterRole) { @@ -88,6 +89,14 @@ func TestEndDeviceClaimingServer(t *testing.T) { enddevices.Config{}, enddevices.WithClaimer("test", &MockClaimer{ JoinEUI: registeredJoinEUI, + ClaimFunc: func( + ctx context.Context, joinEUI, devEUI types.EUI64, claimAuthenticationCode string, + ) error { + a.So(joinEUI, should.Equal, registeredJoinEUI) + a.So(devEUI, should.Resemble, registeredDevEUI) + a.So(claimAuthenticationCode, should.Equal, authenticationCode) + return nil + }, }), ) a.So(err, should.BeNil) @@ -205,7 +214,7 @@ func TestEndDeviceClaimingServer(t *testing.T) { AuthenticatedIdentifiers: &ttnpb.ClaimEndDeviceRequest_AuthenticatedIdentifiers{ JoinEui: registeredJoinEUI.Bytes(), DevEui: registeredDevEUI.Bytes(), - AuthenticationCode: "TEST1234", + AuthenticationCode: authenticationCode, }, }, TargetApplicationIds: registeredApplicationIDs, @@ -223,7 +232,7 @@ func TestEndDeviceClaimingServer(t *testing.T) { AuthenticatedIdentifiers: &ttnpb.ClaimEndDeviceRequest_AuthenticatedIdentifiers{ JoinEui: registeredJoinEUI.Bytes(), DevEui: registeredDevEUI.Bytes(), - AuthenticationCode: "TEST1234", + AuthenticationCode: authenticationCode, }, }, TargetApplicationIds: registeredApplicationIDs, diff --git a/pkg/deviceclaimingserver/util_test.go b/pkg/deviceclaimingserver/util_test.go index ac4a4e9872..26405d2e20 100644 --- a/pkg/deviceclaimingserver/util_test.go +++ b/pkg/deviceclaimingserver/util_test.go @@ -24,6 +24,8 @@ import ( // MockClaimer is a mock Claimer. type MockClaimer struct { JoinEUI types.EUI64 + + ClaimFunc func(context.Context, types.EUI64, types.EUI64, string) error } // SupportsJoinEUI returns whether the Join Server supports this JoinEUI. @@ -32,9 +34,10 @@ func (m MockClaimer) SupportsJoinEUI(joinEUI types.EUI64) bool { } // Claim claims an End Device. -func (MockClaimer) Claim(_ context.Context, _, _ types.EUI64, _ string, +func (m MockClaimer) Claim( + ctx context.Context, joinEUI, devEUI types.EUI64, claimAuthenticationCode string, ) error { - return nil + return m.ClaimFunc(ctx, joinEUI, devEUI, claimAuthenticationCode) } // GetClaimStatus returns the claim status an End Device.