Skip to content

Com-AugustCellars/TestClient

Repository files navigation

TestClient - Scripted CoAP test client

Build Status

The Constrained Application Protocol (CoAP) (https://datatracker.ietf.org/doc/draft-ietf-core-coap/) is a RESTful web transfer protocol for resource-constrained networks and nodes.

TestClient provides for a script based method of doing simple testing of the different features of a CoAP based REST interface. This can be augmented by creating code based tests which can be run with a single command.

Reviews and suggestions would be appreciated.

Copyright

Copyright (c) 2017, Jim Schaad ietf@augustcellars.com

Building the sources

I am currently sync-ed up to Visual Studio 2017 and have started using language features of C# v7.0 that are supported both in Visual Studio and in the latest version of mono.

Writing Scripts

A script consists of a text file with one command per line. All commands are case insensitive as are most arguments for commands. Commands which create CoAP messages are generally performed asynchronusly, and thus a liberal sprinkling of sleep commands can help trying to figure out what happens which a script is running. All state created while a script is running is retained when the script finishes.

Commands

This summary is probably going to be incomplete. With any luck the internal help will be more complete. The syntax of a command is .

CoAP Methods:

methods are: GET, PUT, DELETE, POST, FETCH, PATCH, iPATCH psudeo-methods are: OBSERVE, UNOBSERVE, DISCOVER

uri or parital uri: the URI to send the command to. Parital URIs will be resolved relative to the internal HOST parameter.

payload: Currently is a text value. Multiple words may be enclosed in double quotes.

DISCOVER does not automatically use the partial uri of /.well-known/core.

State Commands:

This commands will modify the internal state. Anything in the state will be added to any coap request that is created and sent.

CLEAR-OPTION - Remove all instances of option from the state HOST - Resolve all relative URIs to with this URI. Defaults to the empty string. OPTION - SET-ENDPOINT < TCP | UDP > - Use a TCP or a UDP endpoint for sending the commands. Defaults to UDP on start.

Keying

ADD-OSCOAP - Create an OSCOAP key with the given name ADD-OSCOAP-GROUP - Create an OSCOAP group context with the given name USE-OSCOAP - Use a OSCOAP context on the message. The name NONE is reserved to remove the key. OSCOAP-PIV -

ADD-TLSKEY - Add the key to the set of TLS keys and given it . USE-TLSKEY - Use a TLS/DTLS version of the end point with this key. Currently only symmetric keys are supported.

Other Commands:

COMMENT - No command executed. Text is not echoed. EXIT - quit the program. Using EXIT in a script will cause the program not the script to exit. HELP - print a summary of the commands LOG-LEVEL <NONE | INFO | FATAL> - control the level of logging produced by the system. Defaults to NONE. PAUSE - Stop script execution until a is entered on the console. SCRIPT - run the commands in a script SLEEP - sleeps for n seconds

Test Suites:

EDHOC - Runs a set of EDHOC commands to test that protocol. OSCOAP-TEST - Run test number n from the OSCOAP test suite.

License

See LICENSE for more info.

About

A script based client that can be used for testing purposes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages