Services including AF and local diameter server is now skipped as pytest test.
Another one was added as dummy services (stack 0 already loaded).
New ct script (CT automation) which needs 'netstat' tool in the ADML HTTP image.
This script:
* ask for re-build service image
* restart service container
* configure real services
* monitor service available
* ask for pytest global execution
New resources and examples needed are included.
Also fixed visilibity operation at SIGUSR2 interface: was returning
without updating response information.
COPY opt/adml/ /opt/adml
RUN apt-get update && apt-get install -y \
- procps
+ procps \
+ net-tools
COPY starter.sh /var/starter.sh
outfile.write(xmlString.c_str(), xmlString.size());
outfile.close();
} else if((opType == "hide") || (opType == "show") || (opType == "hidden") || (opType == "shown")) {
- return eop.visibility(opt_response, opType, param1, (param2 != "") ? atoi(param2.c_str()) : -1);
+ result = eop.visibility(opt_response, opType, param1, (param2 != "") ? atoi(param2.c_str()) : -1);
} else if((opType == "sendxml2e") || (opType == "sendhex2e")) {
anna::diameter::comm::Message *msg;
--- /dev/null
+#!/bin/bash
+
+#############
+# VARIABLES #
+#############
+
+REPO_DIR="$(git rev-parse --show-toplevel 2>/dev/null)"
+[ -z "$REPO_DIR" ] && { echo "You must execute under a valid git repository !" ; exit 1 ; }
+
+SERVICES=${REPO_DIR}/example/diameter/launcher/resources/rest_api/ct/resources/servicesJson-request.json
+ENDPOINT=http://localhost:8074
+PORT=$(echo ${ENDPOINT} | cut -d: -f3)
+C_NAME=adml-http
+
+#############
+# EXECUTION #
+#############
+cd $(dirname $0)
+
+# Basic requirement:
+nghttp --version 2>/dev/null
+[ $? -ne 0 ] && { echo -e "\nThe HTTP2 client 'nghttp' is required. Install with: sudo apt install nghttp\n" ; exit 1 ; }
+echo "Requirement found !"
+
+echo
+echo "Rebuild ADML HTTP service image (y/n) [y]:"
+read opt
+[ -z "${opt}" ] && opt=y
+[ "${opt}" = "y" ] && ${REPO_DIR}/tools/build-adml-http
+
+version=$(${REPO_DIR}/tools/version)
+echo "Restart ADML HTTP service image (version '${version}') ..."
+docker kill ${C_NAME} >/dev/null
+cid=$(docker run --rm -d -p ${PORT}:${PORT} --name ${C_NAME} anna-adml-http:${version})
+echo "Container id: ${cid} (deployed as '${C_NAME}')"
+
+echo
+echo "Configuring services (${SERVICES}) ..."
+sleep 4 # wait for docker running
+nghttp -H ":method: POST" -d ${SERVICES} ${ENDPOINT}/services
+echo
+
+echo
+echo -n "Waiting for server-client connection ..."
+while true
+do
+ docker exec -it ${C_NAME} bash -c "netstat -p $(pgrep ADML) --numeric-ports | grep -w 3868 | grep -w ESTABLISHED" >/dev/null
+ [ $? -eq 0 ] && break
+ echo -n .
+done
+echo "Ready !"
+
+echo
+echo "Press ENTER to start component test, CTRL-C to abort ..."
+read dummy
+
+pytest
+
--- /dev/null
+import pytest
+
+
+def test_001_given_test_indentifier_and_diameter_json_condition_i_want_to_add_test_id_waitfc_step(resources, admlc, admlf):
+
+ flow = admlf.getId()
+
+ requestBody = resources("condition-request.json")
+ responseBodyRef = { "success":"true", "response":"Done" }
+
+ # Send POST
+ response = admlc.post("/testid-waitfc/{}".format(flow), requestBody)
+
+ # Verify response
+ admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
+
+ # Cleanup
+ response = admlc.post("/test-clear")
+
import pytest
+@pytest.mark.skip(reason="this is run as part of 'ct.sh' wrapper script")
@pytest.mark.run(order=1)
@pytest.mark.xfail(reason="This will fail if already provisioned (if you want success here, restart the ADML HTTP Service)")
def test_001_given_services_json_representation_i_want_to_load_it_through_adml_service(resources, admlc):
### Verify response
admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
+
+def test_002_given_dummy_services_json_representation_i_want_to_load_it_through_adml_service(resources, admlc):
+
+ requestBody = resources("servicesDummyJson-request.json")
+ responseBodyRef = { "success":"true", "response":"loaded services correctly" }
+
+ # Send POST
+ response = admlc.post("/services", requestBody)
+
+ ### Verify response
+ admlc.assert_response__status_body_headers(response, 200, responseBodyRef)
+
--- /dev/null
+{
+ "servicesJson": {
+ "services": {
+ "stack": {
+ "@dictionary": "stacks/diameter_base.0.xml",
+ "@fixMode": "Never",
+ "@id": "0"
+ }
+ }
+ }
+}
--- /dev/null
+<!-- This is ignored as already registered on ADML HTTP start. Operation never fails -->
+<services>
+ <stack id="0" dictionary="stacks/diameter_base.0.xml" fixMode="Never"/>
+</services>
+