Testing Telecoms Software with Quick Check Thomas Arts

  • Slides: 24
Download presentation
Testing Telecoms Software with Quick. Check Thomas Arts John Hughes Chalmers/ITU Joakim Johansson Ulf

Testing Telecoms Software with Quick. Check Thomas Arts John Hughes Chalmers/ITU Joakim Johansson Ulf Wiger Ericsson

Session Border Gateway Monitors signalling traffic; opens and closes pinholes Opens media pinholes for

Session Border Gateway Monitors signalling traffic; opens and closes pinholes Opens media pinholes for calls in progress 2 x 1 G Ethernet Media Gateway Controller Linux ”blade” processor 2 x 10 G Ethernet Media Proxy Hardware for packet forwarding

Session Border Gateway Media Gateway Controller ITU standard protocol H. 248 (Megaco) Media Proxy

Session Border Gateway Media Gateway Controller ITU standard protocol H. 248 (Megaco) Media Proxy 150 KLOC Erlang 1. 5 MLOC C

A Quick. Check Property prop_reverse() -> ? FORALL(Xs, list(int()), lists: reverse(Xs)) == Xs). 6>

A Quick. Check Property prop_reverse() -> ? FORALL(Xs, list(int()), lists: reverse(Xs)) == Xs). 6> eqc: quickcheck(rev: prop_reverse()). . . . . . . OK, passed 100 tests true

A Wrong Property prop_reverse_wrong() -> ? FORALL(Xs, list(int()), lists: reverse(Xs) == Xs). 10> eqc:

A Wrong Property prop_reverse_wrong() -> ? FORALL(Xs, list(int()), lists: reverse(Xs) == Xs). 10> eqc: quickcheck(rev: prop_reverse_wrong()). . . . . Failed! After 22 tests. [-2, 4, 0] Shrinking. . . (6 times) [1, 0] false

Testing the Media Proxy Control Software Send random command sequences Check the responses Quick.

Testing the Media Proxy Control Software Send random command sequences Check the responses Quick. Check Media Proxy Generate random messages in a random command sequence But not completely random!

Message Example: ASN. 1 Description • A media descriptor contains a list of streams

Message Example: ASN. 1 Description • A media descriptor contains a list of streams Media. Descriptor { term. State. Descr streams { one. Stream multi. Stream } OPTIONAL, … } : : = SEQUENCE Termination. State. Descriptor OPTIONAL, CHOICE Stream. Parms, SEQUENCE OF Stream. Descriptor

…with IWD Restrictions • A media descriptor contains a list of streams Media. Descriptor

…with IWD Restrictions • A media descriptor contains a list of streams Media. Descriptor { term. State. Descr streams { one. Stream multi. Stream } OPTIONAL, … } : : = SEQUENCE Termination. State. Descriptor OPTIONAL, CHOICE Stream. Parms, SEQUENCE OF Stream. Descriptor

Quick. Check Generator for Erlang Records mediadescriptor(Streams) when Streams=/=[]-> {media. Descriptor, Generators can be

Quick. Check Generator for Erlang Records mediadescriptor(Streams) when Streams=/=[]-> {media. Descriptor, Generators can be #'Media. Descriptor'{ embedded in any data streams = case Streams of structure [{Id, Mode}] -> oneof([{one. Stream, stream. Parms(Mode)}, {multi. Stream, [stream(Id, Mode)]}]); _ -> {multi. Stream, [stream(I, M) || {I, M}<-Streams]} end}}. Message construction Logic from the IWD stream(I, Mode) -> Quick. Check #'Stream. Descriptor'{ stream. ID = I, stream. Parms = stream. Parms(Mode)}.

Local Control Descriptors Add Request Desc. Properties, Media Package M Comment M Stream Local

Local Control Descriptors Add Request Desc. Properties, Media Package M Comment M Stream Local control mode M Multiple Stream descriptors can be included. O Local. Control will be included in all cases except when no media (mline) is defined in the remote SDP. O The default value of the mode property is “Inactive”, the property is not mandatory if the wanted value is “Inactive”. Stream. Parms : : = SEQUENCE { local. Control. Descriptor Local. Control. Descriptor OPTIONAL, local. Descriptor Local. Remote. Descriptor OPTIONAL, remote. Descriptor Local. Remote. Descriptor OPTIONAL, …, statistics. Descriptor Statistics. Descriptor OPTIONAL }

Two Cases: With and Without Remote Media Random boolean with high probability stream. Parms(Mode)

Two Cases: With and Without Remote Media Random boolean with high probability stream. Parms(Mode) -> ? LET(Remote. Media. Defined, probably(), if Remote. Media. Defined -> #'Stream. Parms'{ local. Control. Descriptor = local. Control(Mode), local. Descriptor = local. Descriptor(Remote. Media. Defined), remote. Descriptor = remote. Descriptor(Remote. Media. Defined)}; true -> …… end).

Megaco Commands Context

Megaco Commands Context

Megaco Commands Context Termination Add Returns Context ID & Termination ID

Megaco Commands Context Termination Add Returns Context ID & Termination ID

Megaco Commands Context Uses context ID Add Context Termination Context

Megaco Commands Context Uses context ID Add Context Termination Context

Megaco Commands Context Termination Stream Modify Uses termination ID

Megaco Commands Context Termination Stream Modify Uses termination ID

Megaco Commands Context Subtract Context Termination Stream Context

Megaco Commands Context Subtract Context Termination Stream Context

Megaco Commands Context Termination Stream Subtract

Megaco Commands Context Termination Stream Subtract

Megaco Commands Context

Megaco Commands Context

Symbolic Test Cases [{set, 1, …, send_add, [? choose_cxt_id, Streams, Req]}, {assert, …, check_add,

Symbolic Test Cases [{set, 1, …, send_add, [? choose_cxt_id, Streams, Req]}, {assert, …, check_add, [{var, 1}], {set, 2, …, send_add, [{call, …, get_reply_cxt, [{var, 1}]}, Streams 2, Req 2]}, {assert, …, check_add, [{var, 2}]}] • Generated wrt an abstract state machine tracking contexts, terminations & streams

Encode/Decode Error • Recall the stream parameters… Stream. Parms : : = SEQUENCE {

Encode/Decode Error • Recall the stream parameters… Stream. Parms : : = SEQUENCE { local. Control. Descriptor Local. Control. Descriptor OPTIONAL, local. Descriptor Local. Remote. Descriptor OPTIONAL, remote. Descriptor Local. Remote. Descriptor OPTIONAL, …, statistics. Descriptor Statistics. Descriptor OPTIONAL }

Add/Modify Error Add Modify

Add/Modify Error Add Modify

Add/Subtract Error Add Subtract • There one day, gone the next…

Add/Subtract Error Add Subtract • There one day, gone the next…

Add/Modify Error Add Modify • If the terminations have different numbers of streams

Add/Modify Error Add Modify • If the terminations have different numbers of streams

Add/Sub/Add… Error Add Add Subtract • Extracted from a test case 160 commands long

Add/Sub/Add… Error Add Add Subtract • Extracted from a test case 160 commands long