## 6 Network Reconfigurations
- Removing a storage entity: The fact that every equivalence class of entities must have a storage entity implies that a storage entity can be removed if and only if there remains at least one storage entity in its equivalence class. The name of the storage entity must be removed from the labeling tables; however, these tables should already contain references to other equivalent entities, so nothing else needs to be changed. In practice, the different storage entities in an equivalence class may have different contents, and if so, some contents may have to be copied, but we leave this as an implementation issue. Removing an application entity: In our example, this would be removing a _workstation_. In this scenario, we need also to check the equivalence classes. We have two cases:

1. If the equivalence class that contains the entity to remove has at least another application entity in it, we only remove the intended entity and we leave the corresponding storage entities for the other application entities. The name of the entity must be removed from the labeling tables. 2. Otherwise, we remove the intended entity and all the equivalent storage entities since none of them is required anymore. The names of all such entities must be removed from the labeling tables. The following pseudocode summarizes the steps for removing entities from our configuration Algorithm 2. ``` Input: Initial implementation configuration Output: Updated implementation configuration
1: Procedure RemoveEntity(Entity E)
2: If E is a sensor, then
3: RemoveSensorEntity(E)
4: Else
5: If E is a database (storage entity), then
6: RemoveStorageEntity(E)
7: Else If E is a workstation, then
8: RemoveWorkstationEntity(E)
9: End if
10: End if
11: End procedure
12: Procedure RemoveSensorEntity(Entity E)
13: RemoveEntityFromConfiguration(E)
14: RemoveEntriesFromLabelingTables(E)
15: End procedure
16: Procedure RemoveStorageEntity(Entity E)
17: RemoveEntityFromConfiguration(E)
18: RemoveEntriesFromLabelingTables(E)
19: End procedure
20: Procedure RemoveWorkstationEntity(Entity E)
21: If EquivalenceClassContainsOtherEntities(E) then
22: RemoveEntityFromConfiguration(E)
23: RemoveEntriesFromLabelingTables(E)
24: Else
25: RemoveEntityFromConfiguration(E)
26: RemoveCorrespondingStorageEntity(E)
27: RemoveEntriesFromLabelingTables(E, CorrespondingStorageEntity)
28: End if
29: End procedure
30: Function EquivalenceClassContainsOtherEntities(Entity E)
31: // Check if the equivalence class of E contains at least one other application layer entity
32: End function
33: Function RemoveEntityFromConfiguration(Entity E)
34: // Remove entity E from the implementation configuration
35: End function 36: Function RemoveEntriesFromLabelingTables(Entity E, Optional Entity F)  
37: // Remove all entries of entity E from the labeling tables  
38: If F is provided then  
39: // Also remove entries of entity F from the labeling tables  
40: End if  
41: End function  
42: Input: Initial implementation configuration  
43: Output: Updated implementation configuration  
44: For each Entity E to remove in ImplementationConfiguration do  
45: RemoveEntity(E)  
46: End for  
47: Return UpdatedConfiguration  
* _Label changes_: Changing the label of an entity is equivalent to removing the entity and then adding it with the new label, so it can be done by combining the two procedures. This change has no effect on the implementation configuration: the entity remains in its place. The labeling tables will have to be consistent with the new labels. It should be stressed that these are not manual operations, and in the above, we have described the algorithms to perform them.