Hi there,
I am trying to using chirpstack-api/protobuf/as/external/api to add 10 thousands device with java for performance testing. The first step to add ServiceProfile first, but could not make it happen. Here is what I am doing below, any suggestion are welcome
-
create Java codes with proto files in chirpstack-api/protobuf/as/external/api
-
create TLS priavet key and certificaiton file with chirpstack-certificates repository files
-
Configure tls_key in Chirpstack-Application-Server.toml file below
[application_server.external_api]ip:port to bind the (user facing) http server to (web-interface and REST / gRPC api)
bind=“0.0.0.0:8080”
http server TLS certificate (optional)
#tls_cert="/home/dou/brocaar/loraserver/private/server.crt"
tls_cert=""http server TLS key (optional)
tls_key="/home/dou/brocaar/chirpstack-certificates/certs/lora-app-server/api/server/lora-app-server-api-server-key.pem"
#tls_key="" -
Using below codes try to add Service Profile first
public static void main( String[] args )
{ManagedChannel channel = null;
try {String key = "E:\\\\projects\\\\IoT\\\\tls-files\\\\lora-app-server-api-client-key.pem"; SslContext sslContext = buildSslContext(null, null, key); channel = NettyChannelBuilder.forAddress("192.168.3.73", 8080) .negotiationType(NegotiationType.TLS) .sslContext(sslContext) .build(); ServiceProfile.Builder serviceProfileBuilder = ServiceProfile.newBuilder(); serviceProfileBuilder.setName("PT-CN470") .setNetworkServerId(NetworkID); ServiceProfile srvProfile = serviceProfileBuilder.build(); CreateServiceProfileRequest srvProfileReq = CreateServiceProfileRequest .newBuilder() .setServiceProfile(srvProfile) .build(); ServiceProfileServiceGrpc.ServiceProfileServiceBlockingStub srvStub = ServiceProfileServiceGrpc.newBlockingStub(channel); api.ServiceProfile.CreateServiceProfileResponse srvProfileRsp = srvStub.create(srvProfileReq); System.out.println("Create Device Profile succesfully");
}catch(Exception e) {
e.printStackTrace();
}
}
But alwasy got exception below:
Caused by: io.netty.handler.ssl.NotSslRecordException: not an SSL/TLS record: 485454502f312e31203430302042616420526571756573740d0a436f6e74656e742d547970653a20746578742f706c61696e3b20636861727365743d7574662d380d0a436f6e6e656374696f6e3a20636c6f73650d0a0d0a343030204261642052657175657374
Not sure if I did something wrong, any suggestion are appreciated.
Thansk,
-Anfeng