# Testing IS-07 MQTT

When testing IS-07 MQTT implementations, there are some configuration issues to consider.

* The testing tool does not launch its own MQTT broker.
  The broker to be used by the node under test must be configured and launched separately.
* Automatic discovery of the MQTT broker by nodes relies on an instance of the DNS-SD service type `_nmos-mqtt._tcp` being advertised, as specified by IS-07.
  * When the `DNS_SD_MODE` is set to `'multicast'`, the MQTT broker should be advertised via mDNS.
    If the broker does not do so itself, the advertisements should be configured manually.
    For example, when running a broker on a Linux host with the Avahi utilities installed, a [static service definition](https://linux.die.net/man/5/avahi.service) may be configured,
    or an equivalent [`avahi-publish`](https://linux.die.net/man/1/avahi-publish-service) command may be used, like:
    ```
    avahi-publish -s mqttrelay _nmos-mqtt._tcp -d local 1883 api_proto=http api_auth=false &
    ```
    Or with mDNSResponder installed, on Linux or Windows, the `dns-sd` tool may be used, like so:
    ```
    dns-sd -R mqttrelay _nmos-mqtt._tcp local 1883 api_proto=http api_auth=false &
    ```
  * When the `DNS_SD_MODE` configuration parameter is set to `'unicast'` to [test with unicast discovery](2.1.%20Usage%20-%20Testing%20Unicast%20Discovery.md),
    `ENABLE_MQTT_BROKER` may be set to `True` to add a broker to the testing tool's own mock DNS server.
    Each of the parameters which begins `MQTT_BROKER_` should be configured correctly.

The test suite must be able to connect to the broker(s) specified in each sender's active transport parameters and subscribe to the relevant topics.

* The test suite requires the broker to support MQTT version 5, though the node under test may use version 3.1.1.
* The config parameters `MQTT_USERNAME` and `MQTT_PASSWORD` may be changed to specify authentication details for connecting to the broker.
