Adding New Events - Part 1

Some changes in the model can add new events to the simulation. These events inevitably change the default fingerprints, but they don’t necessarily invalidate the model. One option is to filter out the modules in which the new events take place, so they are not included in the fingerprint calculation. Taking into account the rest of the modules might show that the simulation trajectory, in fact, stayed the same.

To filter out modules, run the simulation with the --fingerprint-modules command-line option, e.g.:

$ inet -u Cmdenv -c Wifi -r 0 --sim-time-limit=5s --fingerprint=0000-0000/tplx --fingerprint-modules='"not fullPath=~**.wlan[*].mac.**"'

As a simplistic example, we will make changes to the Udp module’s code; the changes add new events but don’t alter the module’s behavior. However, the fingerprints will change; we will filter out the Udp module from the fingerprint calculation to verify the model. Here is the workflow:

We run the simulations without taking the Udp module into account (the order of the quotes is important). The fingerprint 0000-0000/tplx is a dummy value. It makes the run fail, and the run prints the calculated value:

$ inet -u Cmdenv -c Ethernet -r 0 --sim-time-limit=0.2s --fingerprint=0000-0000/tplx --fingerprint-modules='"not fullPath=~**.Udp"'
$ inet -u Cmdenv -c Wifi -r 0 --sim-time-limit=5s --fingerprint=0000-0000/tplx --fingerprint-modules='"not fullPath=~**.Udp"'
Fingerprint mismatch! calculated: XXXX-XXXX/tplx, expected: 0000-0000/tplx
Fingerprint mismatch! calculated: XXXX-XXXX/tplx, expected: 0000-0000/tplx

Note the two calculated values. There was no change in the model, so they are correct. The commands do not change the store.

Then we add a line to one of the functions in Udp.cc which schedules a self-message; we also add a handleSelfMessage() function which just deletes the message when it’s received:

--- /home/runner/work/inet/inet/tutorials/fingerprint/sources/Udp_orig.cc
+++ /home/runner/work/inet/inet/tutorials/fingerprint/sources/Udp_mod.cc
@@ -114,8 +114,16 @@
     }
 }
 
+void Udp::handleSelfMessage(cMessage *message)
+{
+    if (message->getKind() == 42) {
+        delete message;
+    }
+}
+
 void Udp::handleLowerPacket(Packet *packet)
 {
+    scheduleAt(simTime() + 1E-6, new cMessage(nullptr, 42));
     // received from IP layer
     ASSERT(packet->getControlInfo() == nullptr);
     auto protocol = packet->getTag<PacketProtocolTag>()->getProtocol();
@@ -1496,4 +1504,3 @@
 }
 
 } // namespace inet
-

We run the simulations again without the Udp module. This time we give the calculated values:

$ inet -u Cmdenv -c Ethernet -r 0 --sim-time-limit=0.2s --fingerprint=XXXX-XXXX/tplx --fingerprint-modules='"not fullPath=~**.Udp"'
$ inet -u Cmdenv -c Wifi -r 0 --sim-time-limit=5s --fingerprint=XXXX-XXXX/tplx --fingerprint-modules='"not fullPath=~**.Udp"'
Fingerprint successfully verified
Fingerprint successfully verified

The fingerprints match; the model is verified.

The store keeps the tplx values without the filter. Run the update command to record new values, if the model change needs them. This process is described in more detail in the Accepting Fingerprint Changes step.

Another option for dealing with the effect of new events is to filter out only the new event from the fingerprint calculation. This approach is beneficial because alternate fingerprints with different ingredients are not needed. If only the new event is filtered out, the fingerprints should stay the same.

As a simplistic example, we’ll make the same change to the Udp module as before. We’ll run the simulations with the baseline ingredients and the stored fingerprints. We filter out the new self-message by its id:

$ inet -u Cmdenv -c Ethernet -r 0 --sim-time-limit=0.2s --fingerprint=b7af-fca4/tplx --fingerprint-events='"not kind=~42"'
$ inet -u Cmdenv -c Wifi -r 0 --sim-time-limit=5s --fingerprint=daf0-4199/tplx --fingerprint-events='"not kind=~42"'
Fingerprint successfully verified
Fingerprint successfully verified

The fingerprints match, and the model is verified.

Note

As a rule of thumb, it is best to filter out specifically those aspects of the simulation which were affected by the change. The more specific the filtering, the better; if you filter specifically, the fingerprints will retain their sensitivity to a broad range of changes, but won’t be sensitive to that specific change.