Network Protocol Design and Evaluation 04 - Protocol Specification, - - PowerPoint PPT Presentation

network protocol design and evaluation
SMART_READER_LITE
LIVE PREVIEW

Network Protocol Design and Evaluation 04 - Protocol Specification, - - PowerPoint PPT Presentation

Network Protocol Design and Evaluation 04 - Protocol Specification, Part II Stefan Rhrup University of Freiburg Computer Networks and Telematics Summer 2009 Overview In Part I of this chapter: Modeling with state machines and


slide-1
SLIDE 1

University of Freiburg Computer Networks and Telematics Summer 2009

Network Protocol Design and Evaluation

04 - Protocol Specification, Part II

Stefan Rührup

slide-2
SLIDE 2

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Overview

  • In Part I of this chapter:
  • Modeling with state machines and UML
  • Part II:
  • Formal state machine models revisited
  • SDL - The specification and description language
  • Describing scenarios with Message Sequence Charts

2

slide-3
SLIDE 3

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Formal State Machine Models

  • Limited expressiveness of FSMs
  • UML state charts more powerful, but semantic variation points
  • Formal semantics needed (esp. for validation)
  • Extended state machine models and formal languages:
  • Communicating FSMs (addition: message queues)
  • Extended FSMs (addition: variables)
  • SDL (based on ext. FSMs, adds structural concepts)

3

slide-4
SLIDE 4

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Communicating FSMs

4

  • Automata connected by bounded FIFO message queues

(asynchronous communication)

  • Input and output = send and receive

states & transitions

message queues

in

  • ut

states & transitions

message queues

  • ut

in

slide-5
SLIDE 5

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Communicating FSMs

  • Automata connected by bounded FIFO message queues

(asynchronous communication)

  • Changes to the Mealy finite state machine model:
  • Input and output queues (finite)
  • Simplification of the transition function:
  • state transitions are triggered by either input or output

(here called action), but not by both

  • closer to reality: send and receive operations are usually

not coupled

  • finiteness is still maintained

5 [Holzmann 1991]

slide-6
SLIDE 6

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Example for Communicating FSMs (1)

  • A simplified variant of the alternating bit protocol

[Holzmann 1991]

  • Sender sends messages with a control bit, the

alternating bit, indicated by msg0 and msg1.

  • Messages are acknowledged by the receiver, also

using the alternating bit, indicated by ack0 and ack1.

  • After sending msg0, the sender expects ack0.
  • If it receives ack1 instead, msg0 is re-transmitted.
  • Notation: ! = send, ? = receive
  • We implicitly assume a single channel

6

slide-7
SLIDE 7

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Example for Communicating FSMs (2)

  • CFSM specification of the protocol [Holzmann 1991]

7

q2 q0 q1 q4 q3 q5

?msg1 !ack0 !ack1 ?msg0 !ack1 ?msg1 ?msg0 !ack0 Sender

q2 q0 q1 q3

?ack1 !msg0 ?ack0 !msg1 ?ack1 ?ack0 Receiver

slide-8
SLIDE 8

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Example for Communicating FSMs (3)

  • State transition table of the receiver protocol [Holzmann 1991]

8 State In Out Next state q0 msg1

  • q1

q0 msg0

  • q2

q1

  • ack1

q3 q2

  • ack0

q0 q3 msg0

  • q4

q3 msg1

  • q5

q4

  • ack0

q0 q5

  • ack1

q3

q2 q0 q1 q4 q3 q5

?msg1 !ack0 !ack1 ?msg0 !ack1 ?msg1 ?msg0 !ack0 Receiver

slide-9
SLIDE 9

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Definition of a CFSM

  • A message queue is a triple (S, N, C), where
  • S is a finite set called the queue/message vocabulary
  • N defines the size of the queue, and C its contents
  • A communicating finite state machine is a tuple (Q,q0,M,T), where
  • Q is a finite, non-empty set of states,
  • q0 ∈ Q is the initial state,
  • M is a set of message queues, and
  • T is a state transition relation, T: Q x A → Q,

where A is the set of actions (input, output, or ε)

9 [Holzmann 1991]

slide-10
SLIDE 10

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Definition of a CFSM

  • The state transition relation maps a state and an action to a

successor state.

  • An action can be input, output or null action.
  • We denote input actions by ? and output actions by !

example: T(q0, !msg) = q1

  • Input and output actions change exactly one message queue
  • T(q,a) = ∅ unless otherwise specified

10 [Holzmann 1991]

slide-11
SLIDE 11

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Extended FSMs

  • So far...
  • Message exchange between CFSMs
  • Still missing in CFSMs:
  • Variables
  • the ability to exchange arbitrary values

11

slide-12
SLIDE 12

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Extended FSMs

  • Extensions to the CFSM model:
  • Variables (integer, finite range)
  • Queues can transfer integer values
  • Set of arithmetic and logical operators

12

slide-13
SLIDE 13

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Definition of an Extended FSM

  • A extended finite state machine is a tuple (Q,q0,M,V,T), where
  • Q is a finite, non-empty set of states,
  • q0 ∈ Q is the initial state,
  • M is a set of message queues,
  • V is a set of variables, and
  • T is a state transition relation, T: Q x A → Q,

where A is the set of actions (input, output, boolean conditions, assignments, or ε)

13 [Holzmann 1991]

slide-14
SLIDE 14

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Extended FSMs, Example

14

q0

in?x,y x<y y==0

q1 q3 q4 q2 q5

x>y [cf. Holzmann 1991] x=x-y y=y-x

  • ut!x

asssignments and conditions input channel

  • utput

channel (assume x≠0)

slide-15
SLIDE 15

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Extended FSMs

15

  • Formal model for specification of concurrent processes
  • FSM minimization and combination can be applied here
  • FSM minimization: Find an equivalent state machine with

the minimum number of states

slide-16
SLIDE 16

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

FSM Minimization

Define an boolean array E of dimension |Q| × |Q|, init = false for all entries E[i,j] if the states i and j are defined for the same actions, set E[i,j] := true (regardless of the next state) end for repeat for all true entries E[i,j] Check, if their next states are equivalent for all actions,

  • therwise set E[i,j] := false

end for until the number of false entries is not increased

16 [Holzmann 1991]

slide-17
SLIDE 17

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

FSM Minimization

17 State In Out Next state q0 msg1

  • q1

q0 msg0

  • q2

q1

  • ack1

q3 q2

  • ack0

q0 q3 msg0

  • q4

q3 msg1

  • q5

q4

  • ack0

q0 q5

  • ack1

q3 q0 1 q1 1 q2 1 q3 1 1 q4 1 1 q5 1 1 q0 q1 q2 q3 q4 q5

Equivalence table E State transition table T

Step 1: for all entries E[i,j] if the states i and j are defined for the same actions, set E[i,j] := true (regardless of the next state)

slide-18
SLIDE 18

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

FSM Minimization

18 State In Out Next state q0 msg1

  • q1

q0 msg0

  • q2

q1

  • ack1

q3 q2

  • ack0

q0 q3 msg0

  • q4

q3 msg1

  • q5

q4

  • ack0

q0 q5

  • ack1

q3 q0 1 q1 1 q2 1 q3 1 1 q4 1 1 q5 1 1 q0 q1 q2 q3 q4 q5

Equivalence table E State transition table T

Step 2: for all true entries E[i,j] Check, if their next states are equivalent for all actions, i.e. ∀ a E[T(i,a),T(j,a)], otherwise set E[i,j] := false

Action a T(q0,a) T(q3,a) msg1 q1 q5 E[q1,q5] = 1 msg0 q2 q4 E[q2,q4] = 1

slide-19
SLIDE 19

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

FSM Minimization

19 State In Out Next state q0 msg1

  • q1

q0 msg0

  • q2

q1

  • ack1

q3 q2

  • ack0

q0 q3 msg0

  • q4

q3 msg1

  • q5

q4

  • ack0

q0 q5

  • ack1

q3 q0 1 q1 1 q2 1 q3 1 1 q4 1 1 q5 1 1 q0 q1 q2 q3 q4 q5

Equivalence table E State transition table T

Step 2: for all true entries E[i,j] Check, if their next states are equivalent for all actions, i.e. ∀ a E[T(i,a),T(j,a)], otherwise set E[i,j] := false

Action a T(q2,a) T(q4,a) ack1 q0 q0 E[q0,q0] = 1

slide-20
SLIDE 20

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

FSM Minimization

20 State In Out Next state q0 msg1

  • q1

q0 msg0

  • q2

q1

  • ack1

q3 q2

  • ack0

q0 q3 msg0

  • q4

q3 msg1

  • q5

q4

  • ack0

q0 q5

  • ack1

q3 q0 1 q1 1 q2 1 q3 1 1 q4 1 1 q5 1 1 q0 q1 q2 q3 q4 q5

Equivalence table E State transition table T

Step 2: for all true entries E[i,j] Check, if their next states are equivalent for all actions, i.e. ∀ a E[T(i,a),T(j,a)], otherwise set E[i,j] := false

Action a T(q1,a) T(q5,a) ack1 q3 q3 E[q3,q3] = 1

slide-21
SLIDE 21

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

FSM Minimization

21 State In Out Next state new q0 msg1

  • q1

q0 msg0

  • q2

q1

  • ack1

q3 q0 q2

  • ack0

q0 q0 q3 msg0

  • q4

(q2) q3 msg1

  • q5

(q3) q4

  • ack0

q0 q5

  • ack1

q3 q0 1 q1 1 q2 1 q3 1 1 q4 1 1 q5 1 1 q0 q1 q2 q3 q4 q5

Equivalence table E State transition table T

Result:

slide-22
SLIDE 22

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

FSM Minimization

22

q2 q0 q1 q4 q3 q5

?msg1 !ack0 !ack1 ?msg0 !ack1 ?msg1 ?msg0 !ack0 Receiver

Result:

State In Out Next state new q0 msg1

  • q1

q0 msg0

  • q2

q1

  • ack1

q3 q0 q2

  • ack0

q0 q3 msg0

  • q4

(q2) q3 msg1

  • q5

(q3) q4

  • ack0

q0 q5

  • ack1

q3

State transition table T

!ack1

slide-23
SLIDE 23

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

FSM Composition

  • Composition of Q1 and Q2
  • Q = Q1 × Q2, M’ = M1 ∪ M2
  • q0 = q01q02
  • Foreach state q1q2 define transitions (non-deterministic):

∀ a: T(q1q2,a) = T1(q1,a) ∪ T2(q2,a)

  • Minimize the machine

23

slide-24
SLIDE 24

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Coupling of FSMs

24

q2 q0 q1

?msg1 ?msg0 !ack0 !ack1 Sender

q2 q0 q1 q3

?ack1 !msg0 ?ack0 !msg1 ?ack1 ?ack0 Receiver

q2,0 q0,0 q1,2 q3,1

msg0 ack0 msg1 ack1

Synchronous coupling

slide-25
SLIDE 25

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Coupling of FSMs

25

q2 q0 q1

?msg1 !ack1 !msg0 ?ack0 ?msg1,!msg1 !ack1,?ack1

Synchronous coupling, 2nd example

Terminal 1 Terminal 2

q2 q0 q1

?msg0 !ack0 !msg1 ?ack1

q0,0 q2,2 q1,1

!msg0,?msg0 ?ack0,!ack0

  • Synchronous coupling ignores the transmission delay
slide-26
SLIDE 26

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Coupling of FSMs

26

  • Incoming messages are added to the input queue
  • The process consumes the first message in queue (FIFO)

q2 q0 q1

?msg1 !ack1 !msg0 ?ack0

Asynchronous coupling

Terminal 1 Terminal 2

q2 q0 q1

?msg0 !ack0 !msg1 ?ack1

msg1 msg0

input queue input queue

slide-27
SLIDE 27
  • -,?ack1

?ack0,--

  • -,!msg1

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Coupling of FSMs

27

q2 q0 q1

?msg1 !ack1 !msg0 ?ack0

Asynchronous coupling

Terminal 1 Terminal 2

q2 q0 q1

?msg0 !ack0 !msg1 ?ack1

  • -,!msg1

!msg0,--

q0,0 q1,2

  • -,?msg0

q1,0 q1,1

?msg1,--

q2,2 q0,2

  • k
  • k

!msg0,-- ...T2 cannot send ack0 in q2 ...T1 cannot send ack1 in q2

Specification incomplete!

The protocol blocks here, because...

slide-28
SLIDE 28

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Extended FSMs

  • Abstract model for communicating processes
  • can be transformed into program code
  • ... or verification languages (e.g. PROMELA)
  • The Specification and Description Language (SDL) is

based on Extended FSMs

28

slide-29
SLIDE 29

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

SDL and MSC

  • Specification and Description Language

(SDL) [ITU-T Recommendation Z.100]

  • riginally developed for the specification of

telecommunication systems (esp. telephone exchanges)

  • formal language, based on extended FSMs
  • used, e.g., for ISDN protocols, IEEE standards
  • strong tool support
  • Message Sequence Charts (MSC) [ITU-T Z.120]
  • riginally part of SDL; similar to UML sequence diagrams

Source: http://www.itu.int/ITU-T/studygroups/com10/languages/

29

slide-30
SLIDE 30

process transceive

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

SDL Example

30

receive send process start procedure call state

SDL process diagram for Lynch’s protocol

get next char get next char ERR NACK ACK receive

  • NACK

ACK ACK

next state = previous state

slide-31
SLIDE 31

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

SDL Elements

31

  • SDL describes concurrent processes and their interaction
  • Basic concept: Extended (communicating) finite state machines
  • Graphical and textual notation
  • SDL/GR (graphic representation)
  • SDL/PR (phrase representation)
  • An SDL specification of a system describes
  • Structure
  • Communication
  • Behaviour
  • Data
slide-32
SLIDE 32

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Basic SDL Elements

32

  • Processes describe behavior (Extended FSM)
  • They run in parallel and can communicate
  • Processes are grouped into blocks

block process

Extended FSM

process

Extended FSM

slide-33
SLIDE 33

system

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Basic SDL Elements

33 block

process

EFSM

process

EFSM

  • Blocks describe the structure.
  • They can be connected to or contained in other blocks
  • The outermost block is called the system
  • Blocks and processes are called agents

block

slide-34
SLIDE 34

system

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Basic SDL Elements

34 block

process

EFSM

process

EFSM

  • Agents communicate
  • asynchronously by a signal (via a channel) or
  • synchronously by a procedure call
  • Channels describe the communication paths

block

slide-35
SLIDE 35
  • System: the enclosing block

that interfaces the environment

  • The overall system consists of

blocks and processes (agents)

  • Blocks are structural elements.

They can contain other blocks and/or processes

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Blocks

35

[R. Reed, SDL-2000 Presentation, sdl-forum.org/sdl2000present/]

b11

slide-36
SLIDE 36
  • Processes describe behavior
  • Processes usually contain an

extended finite state machine

  • They are not concurrent
  • They cannot contain blocks
  • Processes communicate by

signals.

  • Processes can contain and/
  • r call procedures

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Processes

36

[R. Reed, SDL-2000 Presentation, sdl-forum.org/sdl2000present/]

slide-37
SLIDE 37

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Definition of a Block

37

b11

diagram heading page number block channel signal gates channel name process (reference to)

slide-38
SLIDE 38

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Definition of a Channel

  • Channels are used to interconnect agents
  • ...also called communication paths or signal routes

(distinction between channels and signal routes in SDL-88)

  • Signals are sent via channels

38 bidirectional, without delay bidirectional, without delay bidirectional, with delay uniderectional, with delay channel types: ch1 [msg,ack] channel name signals

slide-39
SLIDE 39

block

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Processes

39 diagram heading page number state start state connector (for splitting diagrams) procedure (reference to) procedure call input

p2

appearance of p2 inside a block:

slide-40
SLIDE 40

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Procedures

40 diagram heading page number state procedure start return symbol create process input

slide-41
SLIDE 41

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Structuring elements

41

[R. Reed, SDL-2000 Presentation, sdl-forum.org/sdl2000present/]

b11

slide-42
SLIDE 42

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Describing Behavior: Processes

  • Behavior is specified by processes, following the concept
  • f an extended FSM.
  • Processes can
  • receive, save, and send signals
  • set and reset timers
  • manipulate variables
  • call procedures
  • create other processes

42

slide-43
SLIDE 43

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Elements of a process

43

[sdl-forum.org/sdl88tutorial/]

S1 start symbol

(only one per agent)

task

c:=0;

proc

state procedure call termination

proc

procedure insertion (reference)

* (S1,S2)

all states

(except those listed)

descr. text extension

  • return to

previous state

slide-44
SLIDE 44

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Branches

44

BREAK label

label

(outcome) ELSE

expr. decision (branch) join parts can be separated by BREAK and connectors connector

slide-45
SLIDE 45

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Examples of Decisions

45

[sdl-forum.org/sdl88tutorial/]

(0) (1)

x

(true) (false)

x = y

length(header)

(>0) (<0)

x - y

(“A”)

TYPE

ELSE (“B”) (“ERR”)

(=0) (0) ELSE (16)

slide-46
SLIDE 46

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Processes and signals (1)

46

  • Every process instance has its input queue (FIFO)
  • Signals can be received at any time
  • Signals from the so-called complete valid input signal set

are added to the queue

  • If a process is in a certain state and the queue is not

empty and there are signals associated with transitions from that state, then the signal is removed from the queue and the transition is triggered.

  • For unspecified signal/state combinations, the signal is

consumed without any action (implicit transition)

[sdl-forum.org/sdl88tutorial/]

slide-47
SLIDE 47

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Processes and signals (2)

47

b a a b process1 a a process2

input queue input queue

a

  • Processes communicate asynchronously via FIFO queues
  • Each process has exactly one input queue
slide-48
SLIDE 48

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

I/O Elements (1)

48

B

save signal (msg.

remains in queue, no

  • utgoing transition)

*

abort

continuous signal with enabling condition B priority input save all other signals B A input signal

  • utput signal

SIGNAL A,B; signal declaration SIGNALLIST sl1 = A,B; SIGNALLIST sl2 = sl1,C;

slide-49
SLIDE 49

A

TO Dest

Dest: Process ID

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

I/O Elements (2)

49

A

TO SELF

A

TO SENDER

A

VIA ch1

Sending to a specific receiver: sending via a channel sending back to the sender sending a self-message

PARENT OFFSPRING

Further addresses: the creating instance last created instance by this instance

slide-50
SLIDE 50

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

I/O Elements (3)

Input and Output in layered protocols (Notation used in IEEE Standards, not official part of Z.100)

50

in_pkt

  • ut_frame

in_frame

  • ut_pkt

signals from or to processes logically above or parallel to this process pointer or wedge to the right pointer or wedge to the left signals from or to processes logically below this process

slide-51
SLIDE 51

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Handling signals, Example (1)

51

S3 b c S2 a S1 a b a

c

  • The process is in state “S1”
  • Message “c” is first in queue
slide-52
SLIDE 52

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Handling signals, Example (2)

52

S3 c S2 S1 a b a

c

  • “c” is saved and remains ‘passively’ in queue

b a

slide-53
SLIDE 53

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Handling signals, Example (3)

53

S3 b S2 a S1

c

c a b a

  • “a” is consumed and removed from the queue
  • It triggers the transition to S2
slide-54
SLIDE 54

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Handling signals, Example (4)

54

S3 S2 S1

c

c b a

  • “c” is now consumed and triggers the transition to S3

S2 c S3 b a

slide-55
SLIDE 55

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Handling signals, Example (5)

55

b a S3 c b S4 S3

  • If a transition leads back to the same state, a signal

triggering this transition is effectively discarded.

S2 c S3

slide-56
SLIDE 56

A

TO Dest

Dest: Process ID

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

I/O Notation

56

A

TO SELF

A

TO SENDER

A

VIA ch1

Sending to a specific receiver: sending via a channel sending back to the sender sending a self-message

PARENT OFFSPRING

Further addresses: the creating instance last created instance by this instance

slide-57
SLIDE 57

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Sending signals, Example

57

  • Signal “A” is sent via channel ch2
  • “A” is put into the input queue of process p2

block example

p2 p1

ch1 ch2 process p1

S1 S2

A VIA ch2

slide-58
SLIDE 58

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Variables

58

  • Variables are declared in a text symbol
  • They are manipulated in an task

[sdl-forum.org/sdl88tutorial/]

DCL counter Integer := 0, increment Integer :=1;

Declare keyword Variable name Type Initial value

counter := counter + increment;

Task symbol Text symbol comma-separated list

slide-59
SLIDE 59

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Timers

59

[sdl-forum.org/sdl88tutorial/]

TIMER T; SET(now+50, T) RESET(T)

T Timer definition Timer setting

(predefined function)

Timer activation (self-message) Timer reset

(predefined function)

b a a b process1

Timer signals are added to the input queue

T

  • Timers are self-messages which are added to the input queue
slide-60
SLIDE 60

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Timers, Example

60

[sdl-forum.org/sdl88tutorial/]

DCL expirytime Time := 0.0; DCL period Duration := 13; TIMER T; expirytime := expirytime + period; SET (expirytime, T)

T Wait

Wait4Timer PeriodAction Declaration in-connector

  • ut-connector

Alternative: expirytime := NOW + period;

slide-61
SLIDE 61

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Passing data variables

61

  • Signals can contain data values
  • Input and output must be compatible

Block b1

[sdl-forum.org/sdl88tutorial/]

SIGNAL A(Integer,Boolean);

[A] ch

p1 p2

Process P2

DCL V1 Integer, V2 Boolean;

Process P1

A(v1,v2) A_recvd A(4,True)

S S

A_sent

slide-62
SLIDE 62

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Import and Export of Variables

  • Instead of passing a signal, a variable can be exported by

a process and imported by another process

62

[sdl-forum.org/sdl88tutorial/]

DCL EXPORTED sum Integer; EXPORT(sum) IMPORT(sum, exporterID)

slide-63
SLIDE 63

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Process creation and termination

63

[sdl-forum.org/sdl88tutorial/]

Block Example [A]

p1 p1

Process P1 S2 A S1 P2(4,True) Process P2 FPAR V1 Integer, V2 Boolean

create symbol create line

A S1

process terminates

B Dynamic process creation

slide-64
SLIDE 64

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Composite States

64

process type Agent 2 (2)

Yes via retry

  • pened

No retry busy failure Clear

  • pened

release idle

  • pen
  • pen

state open 1 (4) retry

*

busy waitch

init

req(ch)

tidy

cong announ cong busy waitch

  • k

composite state

[R. Reed, SDL-2000 Presentation, sdl-forum.org/sdl2000present/]

substate definition return symbol

slide-65
SLIDE 65

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Exceptions

65

EXCEPTION someError;

someError

eh

S

someError

eh

Exception definition Raising the exception Exception handler State with associated exception handler Handle

slide-66
SLIDE 66

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Data Types

  • SDL follows the concept of Abstract Data Types (ADT)
  • ADT = sorts + operators
  • Predefined types (with operations):
  • Boolean, Character, Charstring, Integer, Natural, Real,

Duration, Time, Bitstring, Octet, Octetstring, Pid

  • Parameterized: Strings (i.e. lists) of any type, Arrays,

Structures, Choice, Powerset, Bag

  • Different sets of predef. types in SDL-88 and SDL-2000
  • User-defined types:

Value types, Object types, Syntypes (with range check)

66

[R. Reed, SDL-2000 Presentation, sdl-forum.org/sdl2000present/]

slide-67
SLIDE 67

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Data Types, Example

67

  • bject type Linkedlist

<type Elementsort> struct prev, next this Linkedlist; data Elementsort;

  • perators

"in" (Elementsort, Linkedlist)

  • >Boolean;

methods delete (Elementsort);

  • perator "in" referenced;

method delete referenced; endobject type Linkedlist;

  • bject type Natlist

inherits Linkedlist <Natural> endobject type Natlist; dcl primes Natlist := (. Null, Null, 1 .);

[R. Reed, SDL-2000 Presentation, sdl-forum.org/sdl2000present/]

slide-68
SLIDE 68

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Object orientation

  • Classes and objects in SDL: types and instances
  • All instance definitions (agents, states...) define an agent

type implicitly

  • Explicit definition:

68 block type B block type B2 inherits B adding block type C

B2 c b:B2

slide-69
SLIDE 69

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

SDL/GR vs. SDL/PR

69

system convert; signal s,t; channel c_out nodelay from B to env with t; endchannel c_in; channel c_in nodelay from env to B with s; endchannelc_out; block B referenced; endsystem convert; block B; channel rin nodelay from env to P with s; endchannel rin; channel rout nodelay from P to env with t; endchannel rout; process P referenced; connect c_out and rout; connect c_in and rin; endblock B; process P; start; nextstate idle; state idle; input s;

  • utput t;

nextstate idle; endstate idle; endprocess P;

signal s,t; t s B

1(1)

system convert c_in c_out

[R. Reed, SDL-2000 Presentation, sdl-forum.org/sdl2000present/]

SDL/PR phrase representation SDL/GR graphical representation

slide-70
SLIDE 70

Activity information flow set of documents Analysis classified information Draft Design SDL+ Methodology Requirements capture Documentation draft designs product descriptions Test Specification Validation Test Execution test results Implementation product validation result formal SDL+ description tests c

  • l

l e c t e d r e q u i r e m e n t s Formalization

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

SDL in the development process

70

[ITU-T Z.100 Supplement 1]

Scope of SDL+ (SDL and MSC with ASN.1) and recommended methodology

slide-71
SLIDE 71

12%-&('1-)-/+3 1-)-/+34506"7 83*9$:&%',&;$&%- <)9/:)-/+3')3: )::=,&(+<& >?@'A&):&,%B >?@4C)-)4 41&,</*& =D'E+,'1F?'G'?H'D= >HCI4J&3&,)-/+34 41F? =D'%-)-/+3'<&,%/+3'D= 83*9$:&%'&3*,2K-/+3L E,)M(&3-)-/+3L')3: K+N&,'%)<&';$&$/3MB 83*9$:&%'C@OL P-%=@-%L'?*Q'G @OR?*QL',&-,/&%L @ORK+99',&%K+3%&L ?-/('A)3:9/3ML )3:'H1RH+99B '>?@4>)3)M&(&3-4 41&,</*& '=D'E+,'1F?'G'?H'D= 83*9$:&%'>?@'>8SL >8S')**&%%L')3: E/9-&,/3M'+E'>9(& ,&;$&%-')3:'*+3E/,(B 83*9$:&%'%*)3L'V+/3L 0&)*+3=:N&99')3: >?@41?H >)I3/-:)-)B/3:/*)-/+3L >)I3/-:)-)1-)-$%B/3:/*)-/+3 >)I3/-:)-)B,&;$&%- F1CI >%:$P&;$&%- >%:$@+3E/,( FHCI ?-/(XL H:$@+3E/,(L' @EH+99&: P1CI >%:$83:/*)-& 1>4>T>U41?H 6>9(&@+3E/,(1/M3)9%7L 6>9(&83:/*)-/+31/M3)9%7 6>9(&P&;$&%-1/M3)9%7 >>JF 6>(M-P&;$&%-1/M3)9%7 6>(M-@+3E/,(1/M3)9%7L 6>(M-83:/*)-/+31/M3)9%7 >>FY >(P&;$&%-L H%@A)3M&L H%P&%K+3%& >(@+3E/,(L H%83;$/,2

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

SDL in practice: 802.11 Specification

71 [IEEE Std. 802.11-2007]

System specification (part)

slide-72
SLIDE 72

SDL in practice: 802.11 Specification

$%&'()*+,-./0..0&- 1+,-./0123,435 67)*80.)9%&'():&;.)&'1;1< )))%;=;%)1+,-.>;+.)&>)?@AB. )))>+&/)18;)?CD)1&)18;)@EF )))1+,-./011;+G)H;-;+,10-H )))IDJ)>0;%:.),-:)0-.;+10-H )))10/;.1,/K)=,%L;.)M8;+; *P+R *PD&->0+/ $(&> $(A&-;

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

72 [IEEE Std. 802.11-2007]

Transmission block specification (part)

)))9,'(&>>G),)$(A&-;).0H-,% )))0.)+;1L+-;:)1&)18;).;-:;+ )))&>)18;)$,'(&>>).0H-,%),1 )))18;)'&++;'1)10/;)1&).;-: ))),)*PQ;RL;.1O))*8;)/;:0L/ ))).1,1;)LK:,1;.)49L.NG)0:%;G ))).%&15)>+&/)D8,--;%2J1,1; ))),+;)>&+M,+:;:)1&)$,'(&>>2 )))@+&';:L+;)=0,)A,1,2@L/K )))1&)K+;=;-1):;'+;/;-10-H )))18;)9,'(&>>)'&L-1)M80%; )))1+,-./0110-H)D1.)&+)C'( )))>+,/;.O))*80.)9%&'()0.)L.;: )))0-)9&18).1,10&-),-:)C@O)76 A,1,2@L/K 43G35 $,'(&>>2@+&';:L+; 43G35 *PQ;RL;.1 IM:D. $L.NG T:%;G J%&1 $,'(&>>G D,-';% @8N*PJ1,+1O'&->0+/G @8N*PZ-:O'&->0+/G @8NA,1,O'&->0+/ )DJ I+&/D. $L.NG)T:%;G)J%&1

slide-73
SLIDE 73

$%&'())*+,'-&../$%&'(01%( 2,'-&../32456 78*9:;)*<%&'())*<(%.&%=)*>:( +,'-&..*$%&'(01%(*4)((*#?5?@?56A %(>1%B;BC*D&B(4E36*F:(B*9G*=,H 2(C;BA*&%*D&B(4BIJK6*;.*',B'(LL(0? +,'-&..4'FAE36*)>,%>)*B(F*%,B0&= 2,'-&..?**+,'-&..4GABIJK6*%()1=() ',B'(LL(0*2,'-&..?**+,'-&..4KAK6 )(B0)*D&B(4E36*F:(B*MN*;0L(?**87 78*****OB<1>*P;CB,L*P1==,%H +QPR*;)*)(B>*2H*S:,BB(L/P>,>( ***F:(B*>:(*MN*':,BC()*.%&=*;0L( ***>&*21)H*01(*>&*SST*,B07&%*UTVA ***,B0*2H*D,>,/$1=<*,>*9GP>,%>? STUSWX*;)*)(B>*2H*9GS&&%0;B,>;&B ***>&*>(%=;B,>(*,*2,'-&..*,B0*%(>1%B ***>:(*%();01,L*2,'-&..*'&1B>*Y,L1(? ODXW*;)*)(B>*2H*S:,BB(L/P>,>(*,>*>:( ***(B0*&.*>:(*N5*;B>(%Y,L*4)((*#?5?3K6 ***>:,>*21)H*MN*:,)*2((B*;0L(*4SST*Z ***UTV6*.&%*DO[P*4WO[P*,.>(%*\G*(%%&%6? PX]9*;)*)(B>*2H*S:,BB(L/P>,>(*,>*>:( ***(B0*&.*(,':*N5*;B>(%Y,L*4)((*#?5?3K6 ***F:;L(*>:(*MN*;)*;0L(? +1)HA*O0L(*,B0*PL&>*,%(*.&%F,%0(0 .%&=*S:,BB(L/P>,>(*Y;,*D,>,/$1=< F:(B*>%,B)=;>*;)*B&>*;B*<%&C%())?**87 U&/+,'-&.. +,'-&.. 4'FA*'B>6 'F*;)*'&B>(B>;&B F;B0&FA*'B>*;) )L&>*'&1B>*.%&= <%(Y;&1)*+-D&B(? O.*'B>`KA*,*B(F %,B0&=*'&1B> ;)*C(B(%,>(0? )&1%'(_J )(B0(%A =+-O$_J>%1( P,Y(*$O0*.%&= %(a1()>*>&*1)( ,)*,00%*&.*D&B(? (G<&%> 4=+-O$6 'B> )L&>SB>_J*',LL \,B0&=4'F6 S:&&)(*%,B0&= 2,'-&..*'&1B> ;.*'B>*J*E3? S:,BB(L/+1)H T>*)>,%>*,))1=(*>:,>*>:(*MN ;)*21)H*1B>;L*%('(;Y;BC*,*);CB,L F:;':*;B0;',>()*>:(*MN*;)*;0L(? O0L( 9%,B);>;&B)*>& S:,BB(L/O0L( ,L)&*,L;CB*>:( +,'-&..*);CB,L ,%%;Y,L*>;=(*>& )L&>*2&1B0,%H 4N56*>;=;BC? PL&> PL&>*&BLH*)(B> +1)H S,B'(L )B0/ )L&>SB>_J*'B> \()1=(*F;>:*'&1B> .%&=*',B'(LL(0 2,'-&..*;.*'B>IJK? **4`K6 **4IJK6

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

SDL in practice: 802.11 Specification

73 [IEEE Std. 802.11-2007]

Backoff process specification (part)

slide-74
SLIDE 74

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

History of SDL

  • 1968 ITU-T study on the impact of stored program control

(SPC) systems (telephone exchanges)

  • 1972 follow-up study on languages for human-machine

interaction, specification and description, and programming

  • 1976 first SDL standard (CCITT Orange book) with basic

graphical language

  • 1980 description of semantics (CCITT Yellow book)
  • 1984 SDL becomes a formal language (CCITT Red book),

data elements, graphical and textual notation

74

[R. Reed, “Notes on SDL-2000 for the new millennium, Computer Networks (35), 2001]

slide-75
SLIDE 75

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

History of SDL

  • 1988 formalization completed, syntax, language grammar

and semantics consolidated. SDL-88 is the foundation of all subsequent versions. [sdl-forum.org/sdl88tutorial/]

  • 1992 object features introduced in SDL-92
  • 1995 SDL with ASN.1 (ITU-T Recommendation Z.105)
  • 1996 SDL-96 = SDL-92 + corrections and extentions
  • 1999 object modeling and a new data model in SDL-2000

75

[R. Reed, “Notes on SDL-2000 for the new millennium, Computer Networks (35), 2001]

slide-76
SLIDE 76

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

SDL and UML History

76

SDL-88 SDL-92 SDL-2000 SDL-76 UML 2.0

(2005)

MSC-92

Harel’s state charts (’87)

MSC-2000 UML 1.1

(1997)

UML draft

(1995)

SysML 1.0

(2007)

UML 2.2

(2009)

state machines Booch, OMT SDL UML Profile

2000 1990 1980 2010

slide-77
SLIDE 77

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

SDL and UML

77

  • B. Møller-Pedersen: “SDL combined with UML”, Telektronikk 4.2000]

UML SDL

collection of notations for describing different views of a system, including structure, state machine, interaction, collaboration etc. weak semantics with many variation points formal language focusing on structural and state machine views interactions are modeled by MSC complete semantics mapping of subsets UMLSDL ↔ SDLUML defined in [ITU Z.109]

slide-78
SLIDE 78

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

SDL and UML

78 [B. Møller-Pedersen: “SDL combined with UML”, Telektronikk 4.2000]

Mapping subsets of UML and SDL

Use Cases Collaborations Interactions Activity Deployment Action Language Object/Class Instance/Type State Machine State Machine

UMLSDL UML SDLUML SDL

UML-SDL Profile

slide-79
SLIDE 79

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Lessons learned

  • Basic finite state machine models are not sufficient to

model concurrent and communicating processes such as network protocols.

  • Therefore extended FSMs with channels and variables

were introduced

  • Processes in SDL are based on this concept
  • There are similarities to UML state machines. However,

SDL has the stronger semantics

79

slide-80
SLIDE 80

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Message Sequence Charts

  • Similar to UML Sequence Diagrams
  • formal graphical language
  • defined in [ITU-T Recommendation Z.120]

Source: http://www.itu.int/ITU-T/studygroups/com10/languages/

  • describes behavior of communicating instances for

specific executions (scenarios, traces)

80

slide-81
SLIDE 81

msc cs_operation

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

MSC Basics: Instances

81

client server

time instance name instance head instance axis instance end instance

request(sid) response(data,status)

message name message parameters

  • utput

input

slide-82
SLIDE 82

msc cs_operation

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

MSC Basics: Messages

82

client server

self-message

req data1

transmission delay

data2 m

lost message with intended target

req

server client

found message with supposed source

init

message from the environment

slide-83
SLIDE 83

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

MSC Basic assumptions

83

  • Communication is performed by means of messages
  • Sending and receiving is asynchronous
  • No event ordering
  • There is a global clock
  • Events of different instances are ordered via messages

(send before receive, partial ordering)

slide-84
SLIDE 84

msc cs_operation

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Instance creation and termination

84

client server

parameters

(p1,p2)

stop symbol

confirm stop confirm

createline symbol

slide-85
SLIDE 85

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Timers

85

inst1

timer name (required), timer instance name (optional)

t1 t2,ti1 t2 [10,15] t2 [2] t3

timer start duration (optional) with duration [min,max] restart timeout timer stop

t3 t1

timeout duration = [0,infinity] unless

  • therwise specified
slide-86
SLIDE 86

msc cs_operation client server req

guarding condition

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Conditions

86

when connected response

setting condition

disconnected process request

action

slide-87
SLIDE 87

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Conditions

  • Conditions contain labels (condition names)
  • Setting conditions
  • a state-like condition requires setting of the respective

labels associated with the covered instances

  • Guard conditions
  • true, if the labels have a non-empty intersection with

the labels associated with the covered instances

  • may contain boolean expressions
  • dynamic variables of the guard are only from the active

instance (only one instance can be active)

87

slide-88
SLIDE 88

msc cs_operation client server req

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

MSC Reference

88

response

MSC reference

dispatcher ds_operation

MSC reference name

g1 g2

gate

msc ds_operation server dispatcher

req response conn reply(state) ack data

slide-89
SLIDE 89

msc cs_operation client server req

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

MSC Reference

89

ack

MSC reference

dispatcher conn_establishment

MSC reference name

g1 g2

gate

loop<2,4> ds_operation

executed 2 - 4 times

disconnect fin

further execution

  • ptions:

exc

  • pt

exception

  • ptional

par

parallel

seq

sequential

slide-90
SLIDE 90

msc setupChannel msc exchangeData msc disconnect

msc connection

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

MSC Reference Example

90

[Grabowski, Reed: “ ASN.1, MSC, SDL and TTCN Today”, Tutorial, WITUL 2004] Infrastr. connected idle

disconnect setupChannel exchangeData

Base Mobile ConnReq Ready SyncAck Sync Close Ack

Confirm RserveCh ChDown Unlock DataReq

Base Mobile Base Mobile Base Mobile

Locked Lock DataAck Confirm CfAck Lookup Data Response Ack

when idle

slide-91
SLIDE 91

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Inline expressions

91 msc example alt Two alternatives Inline expression separator Inst1 Inst2

t1 t1

conn_reset data_ack conn_req conn_ack data

t1

slide-92
SLIDE 92

msc inline_example_2 loop<0,inf>

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Nested and guarded inline expressions

92 alt when conn_established Inst1 Inst2

t1 t1

conn_reset data_ack conn_req conn_ack data

t1

Nested inline expression Guard

slide-93
SLIDE 93

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Time observation

93

[Ø. Haugen: “MSC-2000 Interaction for the new Millenium”, sdl-forum.org/MSC2000present]

Absolute Time Relative Time

?r2 @a1 call openConnection(port) call requestAccess(uid,pwd) response reply

slide-94
SLIDE 94

msc time_example

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Time constraints

94

[Ø. Haugen: “MSC-2000 Interaction for the new Millenium”, sdl-forum.org/MSC2000present]

Relative time constraint for execution Relative time constraint for msg duration Relative measurement of msg duration Inst1 Inst2

call proc1(x) proc1(x)

Inst3

msg1 time &t msg2 time (0,2*t]

disconnect

[1,2*t)

slide-95
SLIDE 95

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Method calls and control flow

95 msc call_example Inst1 Inst2

call p3 p3

Inst3

call p2(x,y) p2(x,y)

Reply Reply gate Method call gate Suspension area Method area

call p1 p1

Method call

slide-96
SLIDE 96

msc systemOverview

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

High level MSCs

96

[Ø. Haugen: “MSC-2000 Interaction for the new Millenium”, sdl-forum.org/MSC2000present]

MSC Reference Loop Connection point HMSC start Restrictive condition Alternative User rejected User accepted Idle Unlocked timeout Unlocked reset Unlocked unclosed unlocked

slide-97
SLIDE 97

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

High-level MSCs

  • HMSCs describe the combination of basic MSCs
  • Elements are references to MSCs and their connections
  • HMSCs give an overview of alternative message

sequences

  • Higher level of abstraction: instances and interactions

(message transmissions) are hidden

97

slide-98
SLIDE 98

4HJGKAHLHM$& 6H?>A$&NAJLH& 4.4",& 46"7/65*BM%& 4.4",& 46"7/65*AHO& 4.4", 46"7/65*PNL& 4.4",& 4"1#=6"*PNL& 4HJGKAHLHM$& 6HOKHG$&NAJLH& 4.4", 46"<="#5*BM%& 4.4",& 4"1#=6"*AHO& 4.4", 46"<="#5*AHO& 4.4", 46"<="#5*PNL&

!"# "$"# %###&'()*++&!,-& "$"# !"# %###&'()*++&!,-

3HPBGB>M&$>&AHOKHG$& LHJGKAHLHM$&NA>L&?HHA& #51& 3HPBGB>M&$>&JPPH?$& LHJGKAHLHM$&AHOKHG$& NA>L&?HHA&#51& 4HJGKAHLHM$& ?A>PHGG& 0>L?BFH& LHJGKAHLHM$& AH?>A$& 4HJGKAHLHM$& AHOKHG$& P>L?FH$H%&

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

MSC in practice: 802.11 Specification

98 [IEEE Std. 802.11-2007]

  • Msg. sequence of a channel measurement

station management entity MAC sublayer management entity

slide-99
SLIDE 99

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

MSC Review

  • Graphical formal language for describing inter-object behaviour
  • Application: specifying requirements in the form of scenarios,

documenting test cases etc.

  • Partial order semantics, no causality
  • Extensions: High level MSCs
  • Are MSCs sufficient to generate code?

99

slide-100
SLIDE 100

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Shortcomings of MSC Semantics

  • Existential or universal?
  • Description of a sample run or mandatory protocol?
  • Safety and Liveness
  • MSCs only express safety (no more bad things happen),

but not liveness (something will eventually happen)

  • Progress cannot be enforced
  • No simultaneous events
  • Rudimentary timing and conditions without semantics before

MSC-2000

100

[M. Brill, W. Damm, J. Klose, B. Westphal, H. Wittke: Live Sequence Charts: An Introduction to Lines, Arrows, and Strange Boxes in the Context of Formal Verification. SoftSpez Final Report 2004]

slide-101
SLIDE 101

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Code generation from scenario- based specifications

  • Can a state machine be derived from an MSC?
  • MSC and semantic variation:
  • Does a system contain at most, at least, or all

components specified in the MSC?

  • Is the described message exchange complete?

... or are there other message sequences allowed?

101

[I. Krüger, R. Grosu, P . Scholz, and M. Broy, “From MSCs to Statecharts”, DIPES’98]

slide-102
SLIDE 102

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

A Semantic Model for MSCs

  • A system consists of components and channels
  • Components operate by reading input, calculating the
  • utput and writing output
  • There is a global discrete clock
  • Asynchronous communication
  • Exact description: The message sequences occur only
  • nce and there are no other possible interactions

102

[I. Krüger, R. Grosu, P . Scholz, and M. Broy, “From MSCs to Statecharts”, DIPES’98]

slide-103
SLIDE 103

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

From an MSC to a Statechart

  • 5-stage process:

1. Projection of MSCs onto the component 2. Normalization 3. Transformation into an MSC automaton 4. Transformation into an automaton 5. Optimization (minimization etc.)

103

[I. Krüger, R. Grosu, P . Scholz, and M. Broy, “From MSCs to Statecharts”, DIPES’98]

slide-104
SLIDE 104

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Example

  • Car locking system
  • Informal description:
  • Components: KeyControl, left door motor and right

door motor

  • The driver can lock or unlock the door with his remote

control (signals: “lock” and “unlock”)

  • The locked/unlocked status is set after the motors

finished their action and sent a “ready” message

104

[I. Krüger, R. Grosu, P . Scholz, and M. Broy, “From MSCs to Statecharts”, DIPES’98]

slide-105
SLIDE 105

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Example MSCs

105

msc locking

KeyControl LeftMotor RightMotor unlocked lock

  • ff
  • ff
  • ff
  • ff

locked lm_down down down rm_down rm_ready lm_ready

msc unlocking

KeyControl LeftMotor RightMotor locked unlock

  • ff
  • ff
  • ff
  • ff

unlocked lm_up up up rm_up rm_ready lm_ready

[I. Krüger, R. Grosu, P . Scholz, and M. Broy, “From MSCs to Statecharts”, DIPES’98]

slide-106
SLIDE 106

msc locking

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Projection

106

  • Focus on the component C of

which the state machine should be derived

  • Remove all other instance axes

and all messages that are neither sent nor received by C

[I. Krüger, R. Grosu, P . Scholz, and M. Broy, “From MSCs to Statecharts”, DIPES’98]

KeyControl LeftMotor RightMotor unlocked lock

  • ff
  • ff
  • ff
  • ff

locked lm_down down down rm_down rm_ready lm_ready

slide-107
SLIDE 107

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Projection

107

msc lockSeq

KeyControl unlocked lock locked lm_down rm_down rm_ready lm_ready

msc locking

KeyControl LeftMotor RightMotor unlocked lock

  • ff
  • ff
  • ff
  • ff

locked lm_down down down rm_down rm_ready lm_ready

[I. Krüger, R. Grosu, P . Scholz, and M. Broy, “From MSCs to Statecharts”, DIPES’98]

slide-108
SLIDE 108

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Normalization

108

  • A normalized MSC begins and ends

with a condition symbol.

  • It has exactly these two conditions and

a (empty or non-empty) sequence of messages in between

  • MSCs with more condition symbols

are split (the example MSC is alread normalized)

msc lockSeq

KeyControl unlocked lock locked lm_down rm_down rm_ready lm_ready

[I. Krüger, R. Grosu, P . Scholz, and M. Broy, “From MSCs to Statecharts”, DIPES’98]

slide-109
SLIDE 109

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Transformation into MSC Automaton

109

msc lockSeq

KeyControl unlocked lock locked lm_down rm_down rm_ready lm_ready

msc unlockSeq

KeyControl locked unlock unlocked lm_up rm_up rm_ready lm_ready

locked unlocked

lockSeq unlockSeq

[I. Krüger, R. Grosu, P . Scholz, and M. Broy, “From MSCs to Statecharts”, DIPES’98]

States = conditions Transitions = MSCs beginning and ending with the respective conditions

slide-110
SLIDE 110

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Transformation into CFSM

110

locked unlocked

lockSeq unlockSeq ?lock !lm_down !rm_down ?rm_ready ?lm_ready ?unlock !lm_up !rm_up ?rm_ready ?lm_ready

locked unlocked u1 u2 u3 u4 l4 l3 l2 l1

[I. Krüger, R. Grosu, P . Scholz, and M. Broy, “From MSCs to Statecharts”, DIPES’98]

expand transitions

slide-111
SLIDE 111

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Optimization

111 ?lock !lm_down !rm_down ?rm_ready ?lm_ready ?unlock !lm_up !rm_up ?rm_ready ?lm_ready

locked unlocked u1 u2 u3 u4 l4 l3 l2 l1 locked unlocked u l

?lock/ !lm_down, !rm_down ?unlock/ !lm_up, !rm_up ?lm_ready, ?rm_ready ?lm_ready, ?rm_ready

[I. Krüger, R. Grosu, P . Scholz, and M. Broy, “From MSCs to Statecharts”, DIPES’98]

slide-112
SLIDE 112

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Life Sequence Charts

  • Extending MSCs by liveness annotations

(Extension of MSC-96)

  • Mandatory (hot) and provisional (cold) elements
  • Existential and universal charts
  • Asynchronous and instantaneous messages
  • Conditions and invariants

112 [W. Damm, D. Harel: “LSCs: Breathing Life into Message Sequence Charts”, Formal Methods in System Design, 19, 45–80, 2001]

slide-113
SLIDE 113

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

LSC Basics (1)

113 mandatory condition asynchronous message instantaneous message LSC: Example1a AC: Act AM: Invariant activation mode

∈ {initial, invariant, iterative}

activation condition sync1 Inst1 Inst2 Env Inst3 sync1r condition1 sync2r sync2 sync3r sync3 async1 async2

[M. Brill, W. Damm, J. Klose, B. Westphal, H. Wittke: Live Sequence Charts: An Introduction to Lines, Arrows, and Strange Boxes in the Context of Formal Verification. SoftSpez Final Report 2004]

universal chart

slide-114
SLIDE 114

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

LSC Basics (2)

114 LSC: Example1b AC: Act AM: Invariant sync1 Inst1 Inst2 Env Inst3 sync1r invariant1 sync2r sync2 sync3r sync3 mandatory invariant async1 async2

[M. Brill, W. Damm, J. Klose, B. Westphal, H. Wittke: Live Sequence Charts: An Introduction to Lines, Arrows, and Strange Boxes in the Context of Formal Verification. SoftSpez Final Report 2004]

hot location

(progress enforced, solid line)

cold location

(dashed line)

existential chart

slide-115
SLIDE 115

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Safety and Liveness in LSCs

115

Mandatory (notation: solid line) Provisional (notation: dashed line) Chart universal must be fulfilled by all runs existential describes a possible run Locations hot progress is enforced cold staying without progress is allowed Messages hot has to be delivered cold may be lost Conditions hot must hold, otherwise abort cold exit current chart if not met

[W. Damm, D. Harel: “LSCs: Breathing Life into Message Sequence Charts”, Formal Methods in System Design, 19, 45–80, 2001]

slide-116
SLIDE 116

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Timing Constraints

116 min,max delay LSC: Example2 AC: Act AM: Invariant Inst2 Inst3

msg1 msg3 msg4

timer reset

[M. Brill, W. Damm, J. Klose, B. Westphal, H. Wittke: Live Sequence Charts: An Introduction to Lines, Arrows, and Strange Boxes in the Context of Formal Verification. SoftSpez Final Report 2004]

Inst1

T1(10) [1,5) T2(2) msg2[2,3] T2

timer set

slide-117
SLIDE 117

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

From LSCs to Symbolic Automata

  • Transformation of a LSC into a symbolic timed automaton

that describes valid message sequences (unwinding)

  • Basis for formal verification and validation
  • Automaton model: Symbolic timed automaton
  • accepts infinite words (based on Büchi automata)
  • timed words: time is associated to symbols of a word,

required that time is non-decreasing and progressing

117

slide-118
SLIDE 118

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Unwinding (1)

  • Process the elements of the LSC from top to bottom while
  • beying the partial order
  • Elements are atoms (instance heads, instance ends,

sending and receiving messages, conditions) and the borderline between processed and unprocessed elements is called a cut.

  • An atom can be enabled and processed
  • if its predecessors on the same axis have been processed
  • in case of a receive element: if the sending operation has

been processed

  • in case of a shared condition: if all other condition atoms

are enabled

118

slide-119
SLIDE 119

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Unwinding (2)

119 LSC: Example2 AC: Act AM: Invariant c a b d e Inst1 Inst2 Inst3 Inst4 Cut Cold cut c0 c1 c2 c3 c4 c5

Moving a cut from top to bottom through the LSC:

slide-120
SLIDE 120

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Unwinding (3)

120

  • Cuts become states in the automaton
  • Transitions represent the successor relation among the

cuts (successor relation reflects the partial order)

  • Cold cuts become the acceptance states
slide-121
SLIDE 121

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Example (1)

121

q1 q2

¬a ∧ ¬b a ∧ b

q3 q4 q5 q0

¬c ∧ ¬d c ∧ d c d c d ¬d ¬c e true

LSC: Example2 AC: Act AM: Invariant c a b d e Inst1 Inst2 Inst3 Inst4

Cut Cold cut

c0 c1 c2 c3 c4 c5

slide-122
SLIDE 122

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Example (2)

122

  • Language of the automaton

describes valid message sequences: {(a,b,d,c,e), (a,b,c,d,e),...}

  • Note, that this is not a state

machine as an implementation model

q1 q2

¬a ∧ ¬b a ∧ b

q3 q4 q5 q0

¬c ∧ ¬d c ∧ d c d c d ¬d ¬c e true

slide-123
SLIDE 123

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Code generation and Verification

123

LSC, MSC

State machine(s)

transformation

Require- ments

code generation

descriptive view constructive view Implemen- tation

slide-124
SLIDE 124

code generation

Implemen- tation

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Code generation and Verification

124

LSC

State machine(s)

manual design

Require- ments

Symbolic Automaton

verification/ consistency check

descriptive view constructive view

transformation

slide-125
SLIDE 125

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

MSCs, LSCs, and UML

125

UML 2.0

(2005)

MSC-92 MSC-2000 UML 1.1

(1997)

2000 1990 2010

MSC-96 LSC

slide-126
SLIDE 126

Network Protocol Design and Evaluation Stefan Rührup, Summer 2009 Computer Networks and Telematics University of Freiburg

Lessons learned

  • MSCs are widely accepted as an intuitive way for

describing scenarios

  • The transformation into a state machine requires an

additonal semantic model

  • LSCs extend MSCs by new elements and a stronger

semantic.

  • No additonal assumptions needed to transform LSCs into

state machines

  • State machines generated from MSCs/LSCs can specify a

single process or define valid message sequenes

126