#!/bin/bash
+# In this test we will send a incorrect message (AAR) to the server peer:
+# Warning | source/diameter/codec/Message.cpp (387) | Internal Avp decoding error (avp code = 443): Avp format error, the avp length is incorrect (must be multiple of 4 on grouped type)
+#
+# The server shall answer with the FailedAVP and we will check this to validate the test.
+
#############
# VARIABLES #
#############
-
+# Paths from the point of view of ADL executable:
+REQ1_HEX=./hex_examples/aar-bad.hex
#############
# FUNCTIONS #
# Source utils:
source common.sh
-# xxxx
-echo "testing ..."
+# Clean traffic traces:
+rm ../launcher.log*
+
+# Send incorrect AAR:
+send_hex $REQ1_HEX &
+
+# Monitor activity:
+monitor_4_message ../launcher.log.recvfe 10
+
+# Check if message was received:
+[ $? -ne 0 ] && test_failed "Missing answer from the server"
+
+# Check launcher.log.recvfe:
+check_pattern "<avp name=\"Result-Code\" data=\"5004\" alias=\"DIAMETER_INVALID_AVP_VALUE\"/>" ../launcher.log.recvfe
+check_pattern "<avp name=\"Failed-AVP\">( *)<avp name=\"Subscription-Id\"" ../launcher.log.recvfe
+
+# Test OK
+test_ok "Received answer to bad-aar message indicating Failed-AVP as Subscription-Id"
+