diff --git a/uat/testing-features/src/main/java/com/aws/greengrass/steps/MqttControlSteps.java b/uat/testing-features/src/main/java/com/aws/greengrass/steps/MqttControlSteps.java index 59cd161cd..ea2da18fc 100644 --- a/uat/testing-features/src/main/java/com/aws/greengrass/steps/MqttControlSteps.java +++ b/uat/testing-features/src/main/java/com/aws/greengrass/steps/MqttControlSteps.java @@ -785,6 +785,27 @@ public void connect(String clientDeviceId, String componentId, String brokerId, throw lastException; } + /** + * Renames connection. + * + * @param clientDeviceId the id of the device (thing name) as defined by user in scenario + * @param newConnectionName new name of the connection + * @throws RuntimeException throws in fail case + */ + @And("I rename connection {string} to {string}") + public void renameConnection(String clientDeviceId, String newConnectionName) { + final String clientDeviceThingName = getClientDeviceThingName(clientDeviceId); + ConnectionControl connectionControl = getConnectionControl(clientDeviceThingName); + + // Add test id to new name + final String newConnectionNameWithTestId = getClientDeviceThingName(newConnectionName); + connectionControl.setConnectionName(newConnectionNameWithTestId); + + log.info("Connection {} was renamed to {}", + clientDeviceThingName, + newConnectionNameWithTestId); + } + /** * Try to create MQTT connection to broker and ensure connection has been failed. * diff --git a/uat/testing-features/src/main/resources/greengrass/features/ggmq-1.feature b/uat/testing-features/src/main/resources/greengrass/features/ggmq-1.feature index cc814fb9f..e44af7f4f 100644 --- a/uat/testing-features/src/main/resources/greengrass/features/ggmq-1.feature +++ b/uat/testing-features/src/main/resources/greengrass/features/ggmq-1.feature @@ -1820,6 +1820,116 @@ Feature: GGMQ-1 | mqtt-v | name | agent | recipe | publish-status-na | | v5 | paho-python | aws.greengrass.client.Mqtt5PythonPahoClient | client_python_paho.yaml | 0 | + @GGMQ-1-T25 + Scenario Outline: GGMQ-1-T25--: As a customer, I connect with same client id twice (not reconnect) and be able to publish and subscribe to messages. + When I create a Greengrass deployment with components + | aws.greengrass.clientdevices.Auth | LATEST | + | aws.greengrass.clientdevices.mqtt.EMQX | LATEST | + | aws.greengrass.clientdevices.IPDetector | LATEST | + | | classpath:/local-store/recipes/ | + And I create client device "publisher" + And I create client device "subscriber" + When I associate "publisher" with ggc + When I associate "subscriber" with ggc + And I update my Greengrass deployment configuration, setting the component aws.greengrass.clientdevices.Auth configuration to: + """ +{ + "MERGE":{ + "deviceGroups":{ + "formatVersion":"2021-03-05", + "definitions":{ + "MyPermissiveDeviceGroup":{ + "selectionRule":"thingName: ${publisher} OR thingName: ${subscriber}", + "policyName":"MyPermissivePolicy" + } + }, + "policies":{ + "MyPermissivePolicy":{ + "AllowAll":{ + "statementDescription":"Allow client devices to perform all actions.", + "operations":[ + "*" + ], + "resources":[ + "*" + ] + } + } + } + } + } +} + """ + + And I update my Greengrass deployment configuration, setting the component configuration to: + """ +{ + "MERGE":{ + "controlAddresses":"${mqttControlAddresses}", + "controlPort":"${mqttControlPort}" + } +} + """ + + And I deploy the Greengrass deployment configuration + Then the Greengrass deployment is COMPLETED on the device after 5 minutes + And the aws.greengrass.clientdevices.mqtt.EMQX log on the device contains the line "is running now!." within 1 minutes + + Then I discover core device broker as "localMqttBroker1" from "publisher" in OTF + Then I discover core device broker as "localMqttBroker2" from "subscriber" in OTF + And I connect device "publisher" on to "localMqttBroker1" using mqtt "" + And I connect device "subscriber" on to "localMqttBroker2" using mqtt "" + + When I subscribe "subscriber" to "iot_data_0" with qos 1 + When I publish from "publisher" to "iot_data_0" with qos 1 and message "Test message" + And message "Test message" received on "subscriber" from "iot_data_0" topic within 5 seconds + And I rename connection "publisher" to "publisher_old" + + # Reconnect publisher with the same device id + And I connect device "publisher" on to "localMqttBroker1" using mqtt "" + When I publish from "publisher" to "iot_data_0" with qos 1 and message "Connect again" + And message "Connect again" received on "subscriber" from "iot_data_0" topic within 5 seconds + + @mqtt3 @sdk-java + Examples: + | mqtt-v | name | agent | recipe | + | v3 | sdk-java | aws.greengrass.client.Mqtt5JavaSdkClient | client_java_sdk.yaml | + + @mqtt3 @mosquitto-c @SkipOnWindows + Examples: + | mqtt-v | name | agent | recipe | + | v3 | mosquitto-c | aws.greengrass.client.MqttMosquittoClient | client_mosquitto_c.yaml | + + @mqtt3 @paho-java + Examples: + | mqtt-v | name | agent | recipe | + | v3 | paho-java | aws.greengrass.client.Mqtt5JavaPahoClient | client_java_paho.yaml | + + @mqtt3 @paho-python + Examples: + | mqtt-v | name | agent | recipe | + | v3 | paho-python | aws.greengrass.client.Mqtt5PythonPahoClient | client_python_paho.yaml | + + @mqtt5 @sdk-java + Examples: + | mqtt-v | name | agent | recipe | + | v5 | sdk-java | aws.greengrass.client.Mqtt5JavaSdkClient | client_java_sdk.yaml | + + @mqtt5 @mosquitto-c @SkipOnWindows + Examples: + | mqtt-v | name | agent | recipe | + | v5 | mosquitto-c | aws.greengrass.client.MqttMosquittoClient | client_mosquitto_c.yaml | + + @mqtt5 @paho-java + Examples: + | mqtt-v | name | agent | recipe | + | v5 | paho-java | aws.greengrass.client.Mqtt5JavaPahoClient | client_java_paho.yaml | + + @mqtt5 @paho-python + Examples: + | mqtt-v | name | agent | recipe | + | v5 | paho-python | aws.greengrass.client.Mqtt5PythonPahoClient | client_python_paho.yaml | + @GGMQ-1-T27 @OffTheNetwork Scenario Outline: GGMQ-1-T27--: As a customer, my Greengrass-issued certificate does not rotate when mqtt reconnects