Controller Test Harness
OpenSlice · OSL Controller Test Harness

Test your OpenSlice controller without OpenSlice.

The harness plays the OpenSlice side of the JMS contract: the TMF catalog and inventory, and OSOM in production and planning mode. Your controller runs unchanged. You only point spring.activemq.brokerUrl at the harness, then drive it, watch every message on the wire and get a pass/fail verdict against the contract.

Around the controller
Artemis · :61616
unchanged
Your controller
e.g. gcontroller, category gcontroller.examples.osl.etsi.org v0.1.0
brokerUrl=tcp://openslice-artemis:61616

A full OpenSlice deployment: TMF API, OSOM, Artemis, a database and the portal. That is a lot to stand up just to see whether a controller reports health correctly.

Health left undeclared

A report without operationalState + administrativeState folds to PENDING. The service never moves.

Dry-run with side effects

A planning request writes to the real inventory, using a placeholder resource id.

No HELD → UP

The planning progression never happens, so OSOM's wait loop runs out its budget.

A typo in a queue name

The message lands where nobody consumes it, and nothing complains.

In a full deployment, each of these shows up as an order that hangs with no error. In the harness, each one shows up as a contract violation.

The controller contract

What a controller has to get right

A controller (or adapter) takes over the lifecycle of the resources of one category for OSOM. The harness checks the contract set out in Creating an OpenSlice Controller. These are the parts that matter most.

How OSOM finds a controller

A Resource-Facing Service whose spec is not an NSD, a CR spec, a metrics query or a Chronos reservation is classified GRSPEC and handed to a generic controller.

Service order→AutomationCheck→GRSPEC→GCOrchestrationService→JMS queue

The category is the address

OSOM keeps no registry of controllers. It builds the queue name from the category and version of the spec. Register under one pair and listen on another, and you receive nothing.

CREATE/gcontroller.examples.osl.etsi.org/0.1.0/PLANNING

Verbs CREATE · UPDATE · DELETE. The /PLANNING suffix carries dry-runs only.

The reply is not the outcome

OSOM only checks that the synchronous reply parses as a Resource. That means "accepted". The outcome is whatever the controller writes to the inventory for org.etsi.osl.resourceId.

The service follows the resource's health

The TMF API recomputes the service state from the X.731 health of its supporting resources. resourceStatus is pool bookkeeping and moves nothing.

Don't echo your own write

Report with triggerServiceActionQueue=false, or your update comes back to you as a new day-2 action. Use org.etsi.osl.prefixName (gr + 8 chars of the id) for names that must not start with a digit.

How each verb reports

VerbReportsHealth
createHELD as soon as the request is accepted, then UP with the output status.* characteristics when it really runs, or DOWN with the reason in status.infoMessageHELD → UP / DOWN
updateApply the changed characteristics and report the resulting healthUP / DOWN
deleteRelease the real thing; DISABLE/SHUTDOWN, resourceStatus=UNKNOWN, usageState=IDLEGONE

Timeouts the controller lives under

20 sproduction request timeout
5 splanning request timeout
60 splanning wait budget, shared by the whole order
8passes of the planning check loop

Keep the simulated deploy delay in the hundreds of milliseconds (gcontroller uses PLANNING_SIMULATED_DEPLOY_DELAY_MS: 200). Real durations belong in the estimate, not in wall-clock waiting.

Estimates

Each planning callback carries the estimate for its own phase as org.etsi.osl.estimate.<phase>.<metric>, with phase creation, operation or teardown.

  • Fixed units, never sent: durationSeconds in seconds, energy in Wh, cost in cost units.
  • Absent is not zero. 0 means "measured: costs nothing". An omitted header means "not estimated".
  • No window, no operation estimate. Without org.etsi.osl.operationDurationSeconds, leave the operation headers out.
  • Echo org.etsi.osl.estimateOnly on cost enquiries, so a re-priced DELETE does not age a resource to GONE.
Architecture

One Spring Boot service, one broker, one controller

The harness is Java 17, Spring Boot 3 and Apache Camel, the same stack as the controllers. Every payload uses the org.etsi.osl.model.tmf classes, so the JSON on the wire is the same as a real OpenSlice sends. Select a component to see what it does.

Who drives it
HTTP :8090
osl-controller-testharness
JMS, same queue names as OpenSlice
Message flows

Watch the conversation on the wire

Pick a flow and press Play, or step through it. Every arrow is a JMS message the harness records. Select one to see its queue, headers and body. The right-hand panel shows what the harness concludes: the resource's health timeline and any contract violations. Ids and values are examples.

Harnessas OSOM + TMF API
Artemis:61616
Controllergcontroller 0.1.0
0 / 0
Harness view
Mode
–
Health
none yet
Wait loop
–
Estimates
–
Health timeline
No transitions recorded
Contract checks
Nothing evaluated yet
Wire log entry

Select an arrow to inspect its message.

ITU-T X.731 health

Health moves the service. Status does not.

Every report has to state operationalState and administrativeState. OpenSlice folds the pair into a verdict with Resource.deriveHealth(), and the harness uses the same model method rather than its own copy of the table. Order matters: SHUTDOWN wins, then LOCKED, then an unset attribute, then operationalState. Try the combinations.

usageState (IDLE / ACTIVE / BUSY) is informational and never moves a service.

Health verdict
HELD
JMS interface

Queues and headers

Catalog calls are request/reply over JMSReplyTo and JMSCorrelationID, with JSON bodies. Queue names come from application.yml under the same keys the controllers use. Unknown queues are not served, but they still show up in the wire log as unconsumed, which makes typos obvious.

Queue (controller → harness)HeadersBehaviour
CATALOG.UPDADD.RESOURCESPECaname, aversion, acategoryUpserts by (name, category, version). This is how a controller registers its specs at startup.
CATALOG.ADD.RESOURCESPEC · CATALOG.UPD.RESOURCESPECas in OpenSliceAdd / update a spec.
CATALOG.GET.RESOURCESPEC_BY_ID · …_BY_NAME_CATEGORYaname, acategory, aversionLookup.
CATALOG.GET.RESOURCESPEC_BY_CATEGORY · CATALOG.GET.RESOURCE_BY_CATEGORYacategory / categoryLists the specs with that category, or the production resources whose category matches (an SQL LIKE pattern), ordered by name.
CATALOG.GET.RESOURCES_BY_FILTERbody: ResourceFilterFilters production resources by spec, name, vendor, location, status, category and characteristic. Returns one page of summaries, or full resources with detail: full, along with totalCount and a continuationToken.
CATALOG.DELETE.RESOURCEresourceIdDeletes from the catalog and replies with the id. The harness keeps the entry as GONE; the catalog queues no longer return it. Errors come back with the error / errorMessage headers.
CATALOG.UPD.RESOURCEresourceId, triggerServiceActionQueueUpdates the production inventory and records a health transition. Flagged when the id is a planning placeholder.
CATALOG.UPDADD.RESOURCE · CATALOG.ADD.RESOURCE · CATALOG.GET.RESOURCEaname, aversion, acategory / resourceIdUpsert, add, lookup.
CATALOG.UPDADD.SERVICESPEC and friendsas in OpenSliceThe same store pattern for controllers that also register service specs.
CATALOG.GET.SERVICEORDER_BY_IDidReturns an example TMF ServiceOrder for any id.
PLANNING.RESOURCE.CREATEORUPDATEorg.etsi.osl.*, X.731, estimatesCreates or updates a tentative resource. Health is resolved like OSOM does it: headers first, then body, then a status fallback. Wakes the wait loop.
Contract checks

Eight rules, checked on every message

The ContractChecker evaluates the rules continuously over the wire log and the stores. Every violation names its rule, the resource and the message that caused it. Turn a card over to see what goes wrong in OpenSlice when the rule is broken.

Part 1: adapting a category

The production checklist from the controller guide

Part 2: supporting simulation

The planning checklist from the controller guide

Your controller's contract coverage
Ticked, verified by a harness ruleTicked, verified by a scenario or by hand

Tick what your controller does. The tags show how the harness proves each item: a rule id is checked on every message, a scenario step is checked when you run one.

Scenarios

Script it once, run it every time

A scenario is a YAML or JSON test the harness runs step by step against the controller, ending with a pass/fail report. It uses the same driver, stores and checks as the UI, so it does nothing you could not do by hand. Press Run, or select a step to see what it checks.


        
curl -s -X POST -H "Content-Type: application/yaml" \
  --data-binary @my-scenario.yaml \
  "http://localhost:8090/api/scenarios/run?wait=true" \
  | tee report.json | jq -e '.status == "PASSED"'

In CI, jq -e exits non-zero unless the run passed.

kubernetes-planning-roundtripREADY
    Fault injection

    Make OpenSlice misbehave on purpose

    Fault rules act on the queues the harness serves for the controller: the catalog queues and PLANNING.RESOURCE.CREATEORUPDATE. They never touch the CREATE / UPDATE / DELETE requests the harness sends. Each rule targets one queue; probability and remaining limit how often it fires.

    Controller
    request → CATALOG.UPD.RESOURCE← reply
    Harness
    Web UI

    A tour of the harness UI

    The single-page UI at /ui is fed by the REST API and the live event stream. Several controllers can share one harness, and the Dashboard, Inventory and Wire pages filter by controller.

    localhost:8090/ui/#dashboard
    Harness dashboard
    Quick start

    Try it with gcontroller

    The example Generic Controller registers ten specs (KubernetesCluster, RadioEngineer, 5GCore and more) and supports planning, which makes it the natural first controller to put in the harness.

    Start the harness

    mvn package -DskipTests
    docker build -t osl-controller-testharness .
    docker run --rm --name harness \
      -p 8090:8090 -p 61616:61616 osl-controller-testharness

    Or java -jar target/osl-controller-testharness.jar on Java 17. The broker listens on :61616; the UI is at localhost:8090/ui/ and Swagger at /swagger-ui.html.

    Point the controller at it

    mvn spring-boot:run -Dspring-boot.run.arguments=\
    --spring.activemq.brokerUrl=tcp://localhost:61616?jms.watchTopicAdvisories=false

    In Docker, put both containers on one network and use tcp://harness:61616?jms.watchTopicAdvisories=false.

    Check what the harness sees

    curl -s http://localhost:8090/api/specs

    The specs are listed, and the Dashboard shows consumers on CREATE/gcontroller.examples.osl.etsi.org/0.1.0[/PLANNING].

    Drive it

    scripts/walkthrough.sh
    # HARNESS=http://host:8090 to point elsewhere

    A production create reaches UP. A planning create shows HELD → UP about 200 ms apart with estimates and no catalog write. A planning delete reaches GONE.