# A Novel Routing Scheme for Creating Opportunistic Context-Virtual Networks in IoT Scenarios +
## 4 Opportunistic Context-Virtual Networks  
In this section, the Opportunistic Context-Virtual Network (OCVN) concept is defined. In order to describe it, a set of additional concepts related to the main components of the considered network environment must be previously defined:  
**IoT device or node:** An IoT node is a general IoT device that has, at least, one wireless network interface, independent of the specific nature of the wireless technology. Two types of nodes are considered: (i) a fixed IoT node capable of gathering information from the environment (e.g., humidity sensor, presence sensor, etc.) and acting according to specific users' needs (e.g., increase the temperature in the room, play a specific music playlist, etc. ); and (ii) a mobile IoT node that has the ability to move through a geographical area and perform opportunistic connections with other IoT nodes by means of short-range communication technologies. Each node in the network is able to create its own Virtual profile (VP). In addition, a history heap is stored in each node with historical information about the number and duration of contacts between nodes with the same interests. In particular, this heap contains, for each contacted node, the next information: timestamp of the last contact, hardware address, skills' ids, and goals' ids. These skill ids and goal ids allow us to improve the behavior of the virtual network when it is formed by heterogeneous devices from different vendors and with different capabilities. **Opportunistic Context-Virtual Network (OCVN)**: An OCVN is a virtual network composed of a set of IoT nodes where: (i) all of the nodes share interests (goals/skills) in common; and (ii) it is possible to send information from one node to other nodes by means of opportunistic interactions. From a general point of view, nodes of an OCVN can be either placed at the same geographical area at a given time slot or not share the same spatio-temporal features. An example of the latter would be when two nodes were connected during a period of time, shared their VPs, and after a while, one of them left the physical place where they were located (e.g., a room). Each node will store information about the VPs of the rest of the nodes in the OCVN during a certain period of time. The reason for performing this storage is to (potentially) forward these VPs to other nodes in the future, which could be interested in the goals/skills of the nodes of the former OCVN. In order to better understand the concept of OCVN, Figure 2 shows an example where seven IoT nodes coexist in the same geographical area and three different OCVNs are created. Green nodes are mobile nodes (e.g., smartphones), and their goals are described in the table shown at the right side of the figure. Regarding the set of fixed heterogeneous IoT nodes, they represent an air conditioning machine with the skill of setting the temperature, a smart light-bulb to adjust the luminance, and a smart HIFI system able to play music according to musical preferences. In this example, we assume that the coverage range, represented by dashed-line circles, is the same for each node, and a short-range  
Figure 1: Example of the situational context. communication is performed when two nodes get in contact. Colored lines represent the limits of each OCVN. It can be seen that, although Mobile Node 4 (MN4) is isolated, and hence it does not belong to any OCVN, it can still store information about the last OCVN it joined. For instance, if it is moving towards the south of the scenario, it could have belonged to the yellow OCVN in the past since one of its goals was a specific type of music. In this way, MN4 is able to store information of such OCVN during a predefined period of time to be potentially shared with other nodes in the future. Therefore, in our OCVN-based scenarios, the use of expiration timers is mandatory to reduce both network overhead and the use of storage hardware resources at nodes.