• No results found

7.2 Bigraphical model

7.2.2 Network events

Now we turn our attention to the reaction rules that represent the network events, which include moving in and out of the router’s range, and the granting and revoking of DHCP leases. We discuss each one of the four events in turn, and we describe them by means of a graphical representation. A summary of all the reaction rules including their algebraic forms

R

W Internet

S

Figure 7.2: Initial configuration S0 :  → csjb.

y

Properties

S M R

W S

MAC

y

R W S

Figure 7.3: Reaction rule RA(MAC): a new machine appears in the router’s signal range.

is given in Table 7.3. We note that all the reaction rules respect sorting ΣHW.

The first event occurs when machine MAC appears in the signal range of the router. It is encoded by reaction rule RA(MAC) : mr → h bc sbr, {y}i given in Figure 7.3. On the left-hand side, the router is in the range of its signal and possibly other signals. This is expressed by the region surrounding the r-node. On the right-hand side, a new machine is in the range of the router’s signal. The router senses the new machine’s signal and possibly other signals.

This is expressed by nodes R and M being in the intersection of the two s-nodes and the region surrounding R. A property box (i.e. a b-node) is also linked to M. Note that the only configuration setting specified at this stage is the MAC address of the new machine M. This is witnessed by the p-node placed inside Properties. Observe that this reaction rule forces all m-nodes to be shared by only two s-nodes. This means our model does not capture any interference between the signals of the machines in the system: our model is based solely on information provided by the router. It other words, we can only model what the router senses.

The second event occurs when machine MAC is no longer in the router’s signal range.

This happens because either a machine switches off its network interface or it moves into a location not reachable by router’s signal. It is encoded by the reaction rule RR(MAC) given in Figure 7.4. On the left-hand side, a m-node is linked to a b-node and placed within an s-node.

These correspond to a machine, its configuration properties and its signal range, respectively.

The extra region enclosing M and the site are necessary to allow the machine modelled in the left-hand side to be in the range of the router and possibly other machines. On the

right-Properties

S M

MAC

Figure 7.4: Reaction rule RR(MAC): a machine is no longer in the router’s signal range.

Properties M

W

y x

Properties' M

W

y x

Figure 7.5: Reaction rule RJ1. A new machine joins the WLAN (1): all stations already in the WLAN are tagged.

hand side, all the nodes have disappeared. This models the absence of the machine from the system. We note that without sharing, the orphan site does not exist. But in our case, we need it because on the left-hand side, there could be another entity matched by the site (e.g.

the router), which would persist even after we remove the parent node S. The interface of the reaction rule is given by: RR(MAC) :mr → h bc sbm, ∅i.

The third event occurs when a machine joins the WLAN and a DHCP lease is granted.

We use three reaction rules to describe how the system changes. This requires distinguishing between the new machine and those already in the network. We do so by tagging the latter.

The first rule, RJ1, implements the tagging, the second rule, RJ2(MAC, IP, Hostname), es-tablishes the network aspects of the untagged machine (i.e. IP address etc.), and the third rule, RJ3(MAC), establishes the communication channels between the new machine and the tagged machines and then it revokes the tags. Reaction RJ1 : cpio → hmwb, {x, y}i, in Figure 7.5, is used to tag all the machines in the system that are already part of the WLAN. On the left-hand side we have an m-node linked to the w-node. The actual tag-ging is implemented in the right-hand side, where a node of control Properties0 takes the place of the corresponding node of control Properties in the left-hand side. Reaction rule RJ2(MAC, IP, Hostname) models the DHCP server granting a lease to the machine, as depic-ted in Figure 7.6. On the left-hand side, a machine is not part of the network and the only configuration property already specified is the MAC address. This is shown by the absence of a link between the m-node and the w node and the absence of a site inside the node of control Properties. On the right-hand side, the machines joins the WLAN, IP address and

Properties M

W

y x

Internet

MAC IP Hostname

Properties M

W

y x

Internet

MAC

Figure 7.6: Reaction rule RJ2(MAC, IP, Hostname). A new machine joins the WLAN (2): Hostname and IP address are set and communication channels with the Internet are established.

Properties

Properties'

Properties

Properties

y x

y x

MAC MAC

Figure 7.7: Reaction rule RJ3(MAC). A new machine joins the WLAN (3): Communication channels are created between the station and all the machines already present in the WLAN.

hostname are set, and two communication channels with the external world are established.

The interface is given by:

RJ2(MAC, IP, Hostname) : bio → hmwbj, {x, y}i .

Note that the channels are uni-directional and so we have to define a pair (one for incoming traffic, one for outgoing traffic). In reaction rule RJ3(MAC) a pair of communication channels is established between the new machine and the machines already part of the WLAN, see Fig-ure 7.7. On the left-hand side, a node of control Properties and a node of control Properties0 specify the configurations of the new machine and a machine already in the WLAN, respect-ively. On the right-hand side, a pair of communication channels is established and a node of control Properties replaces the corresponding node of control Properties0 in the left-hand side. The interface of the reaction is RJ3(MAC) : cpio cpio → hbb, {x, y}i. We note that this event is encoded by a sequence of application of the three reaction rules described above.

Initially, all machines that have already joined the WLAN are tagged, using reaction RJ1. This means the reaction is applied n times, where n is the number of machines in the net-work. The resulting interleaving of applications is confluent, therefore, only one sequence

Properties Properties y

MAC

y

MAC

Figure 7.8: Reaction rule RL1(MAC). A machine leaves the WLAN (1): Pairs of communication channels are removed.

Figure 7.9: Reaction rule RL2(MAC, IP, Hostname). A machine leaves the WLAN (2): DHCP leases are revoked.

need be considered. Then, reaction RJ2(MAC, IP, Hostname) is applied once. Finally, re-action RJ3(MAC) is applied n times. Again, due to confluence, only one sequence need be considered. We will describe in more detail how sequences of applications are used to generate models of the network in real-time in Section 7.3.

The last event takes place when a machine leaves the WLAN and the lease is revoked.

This is represented by two rules. Note, this does not automatically imply that the machine is also leaving the router’s signal range. Reaction rule RL1(MAC) : cpio → hbbio, {x, y}i is given in Figure 7.8. The left-hand side specifies a property box for the machine and a pair of channels. The site also allows the reaction to be applied when other nodes are inside the node of control Properties. On the right-hand side the two communication channels are removed.

Reaction rule RL2(MAC, IP, Hostname) revokes the machine’s DHCP lease. This is encoded by the removal of nodes of control Hostname and IP and the breaking of link between M and W, as depicted in Figure 7.9. The interface of the reaction rule is given by

RL2(MAC, IP, Hostname) :  → hmwb, {x, y}i .

Note that reaction RL1(MAC) is applied first, until no other channels can be removed. Again, the order in which the channels are removed is not important and only one sequence of reac-tions need be considered. Second, reaction rule RL2(MAC, IP, Hostname) is applied once.

The algebraic forms for all the seven reaction rules of the model are given in Table 7.3.

RA(MAC) = R1 I R01

R1 = /x share (Rx.Wy.1 k id) by [{1, 2}, {0}] in (Sx.(id | id) k id1,yx) R01 = /x/z/p share (Rx.Wy.1 k /yMyzp.1 k id) by [{1, 2, , 3}, {1, 2}, {0}]

in ((Sx.(id | id) | Sz | Propertiesp.MAC.1) k id1,yxzp) RR(MAC) = R2 I 1 k 1 k 0

R2 = /x/p share (/yMxyp.1 k id) by [{1, 2}, {0}]

in ((Sx.(id | id) | Propertiesp.MAC.1) k id1,xp)

RJ1 = /p(Myxp.1 k Wy.1 k Propertiesp) I /p(Myxp.1 k Wy.1 k Properties0p) RJ2(MAC, IP, Hostname) = R3b I R3b0

R3b= /p(/yMxyp.1 k Wy.1 k Propertiesp.MAC.1 k Internet) R03b= /p/l/h Mxyp.1 k Wy.1

k Propertiesp.(MAC.1 | Hostname.1 | IP.1 | Ih.1 | Ol.1) k Internet.(id | Il.1 | Oh.1)

RJ3(MAC) = R3c I R03c

R3c= Propertiesx.(id | MAC.1) k Properties0y R03c= /l/h Propertiesx.(id | MAC.1 | Il.1 | Oh.1)

k Propertiesy.(id | Ih.1 | Ol.1) RL1(MAC) = R4a I R04a

R4a = /l/h(Propertiesy.(id | MAC.1 | Il.1 | Oh.1) k (Ih.1 | Ol.1)) R04a = Propertiesy.(id | MAC.1) k 1

RL2(MAC, IP, Hostname) = R4b I R4b0

R4b= /p(Myxp.1 k Wy.1 k Propertiesp.(MAC.1 | Hostname.1 | IP.1)) R04b= /p(/yMyxp.1 k Wy.1 k Propertiesp.MAC.1)

Table 7.3: Reaction rules for network events.

Properties M

W

y x

Properties p

MAC

MAC

Figure 7.10: Bigraphs BϕMAC (left) and BψMAC (right).