(t *testing.T)
| 200 | } |
| 201 | |
| 202 | func TestHandleJoin(t *testing.T) { |
| 203 | _, ctx := test.New(t) |
| 204 | for _, tc := range []struct { |
| 205 | Name string |
| 206 | ContextFunc func(context.Context) context.Context |
| 207 | Authorizer joinserver.Authorizer |
| 208 | |
| 209 | KeyVault map[string][]byte |
| 210 | Device *ttnpb.EndDevice |
| 211 | ApplicationActivationSettings *ttnpb.ApplicationActivationSettings |
| 212 | |
| 213 | NextLastDevNonce uint32 |
| 214 | NextLastJoinNonce uint32 |
| 215 | NextUsedDevNonces []uint32 |
| 216 | |
| 217 | JoinRequest *ttnpb.JoinRequest |
| 218 | JoinResponse *ttnpb.JoinResponse |
| 219 | |
| 220 | ErrorAssertion func(error) bool |
| 221 | }{ |
| 222 | { |
| 223 | Name: "1.1.0/cluster auth/new device/no NwkKey", |
| 224 | ContextFunc: func(ctx context.Context) context.Context { return clusterauth.NewContext(ctx, nil) }, |
| 225 | Authorizer: joinserver.ClusterAuthorizer(ctx), |
| 226 | Device: &ttnpb.EndDevice{ |
| 227 | Ids: &ttnpb.EndDeviceIdentifiers{ |
| 228 | DevEui: types.EUI64{0x42, 0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}.Bytes(), |
| 229 | JoinEui: types.EUI64{0x42, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}.Bytes(), |
| 230 | ApplicationIds: &ttnpb.ApplicationIdentifiers{ApplicationId: "test-app"}, |
| 231 | DeviceId: "test-dev", |
| 232 | }, |
| 233 | RootKeys: &ttnpb.RootKeys{ |
| 234 | AppKey: &ttnpb.KeyEnvelope{ |
| 235 | Key: nwkKey.Bytes(), |
| 236 | }, |
| 237 | }, |
| 238 | LorawanVersion: ttnpb.MACVersion_MAC_V1_1, |
| 239 | NetworkServerAddress: nsAddr, |
| 240 | }, |
| 241 | NextLastJoinNonce: 1, |
| 242 | JoinRequest: &ttnpb.JoinRequest{ |
| 243 | SelectedMacVersion: ttnpb.MACVersion_MAC_V1_1, |
| 244 | RawPayload: []byte{ |
| 245 | /* MHDR */ |
| 246 | 0x00, |
| 247 | /* MACPayload */ |
| 248 | /** JoinEUI **/ |
| 249 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x42, |
| 250 | /** DevEUI **/ |
| 251 | 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x42, 0x42, |
| 252 | /** DevNonce **/ |
| 253 | 0x00, 0x00, |
| 254 | /* MIC */ |
| 255 | 0x55, 0x17, 0x54, 0x8e, |
| 256 | }, |
| 257 | DevAddr: types.DevAddr{0x42, 0xff, 0xff, 0xff}.Bytes(), |
| 258 | NetId: types.NetID{0x42, 0xff, 0xff}.Bytes(), |
| 259 | DownlinkSettings: &ttnpb.DLSettings{ |
nothing calls this directly
no test coverage detected