## 1 Introduction  
The Internet is growing fast with ever-increasing machine-to-machine communication (M2M), the expansion of micro and proximity services, the use of cloud services, and the continuous increase in the number of connected devices, among other reasons. The International Telecommunication Union report for the years 2020 to 2030 [1] estimates that there will be 100 billion connected devices by the year 2030. The fastest-growing mobile device category is M2M, followed by smartphones and other smart devices. Improving the legacy infrastructure to cope with the demand in terms of bandwidth, coverage, quality of service (QoS), and specific requirements for emerging applications is costly and, therefore, not the ultimate solution. Thus, offloading traffic from core networks is a concern. For that matter, device-to-device (D2D) communication [2] performs direct transmissions between peers in range without needing a base station. A type of network based on D2D communication is opportunistic networks (OppNets). OppNets are characterized by the mobility of their nodes, which leads to an undefined network topology that hinders contemporaneous end-to-end connectivity. Therefore, in OppNets, communication is led by the contact opportunity between peers. This paradigm is very convenient in networks as vehicular ad hoc networks [3], mobile wireless sensor networks [4], pocket-switched networks [5], people-centric networks [6], and mesh networks [7], among others. OppNets, due to the mobility of their nodes, are prone to frequent disconnections, segmentation, and long delay paths. Hence, traditional routing schemes based on end-to-end connectivity are not applicable. Therefore, OppNets nodes function as routers which use the store-carry-and-forward (SCF) principle [8] to forward data from the source to the destination on a hop-to-hop basis. Moreover, in OppNets, routing efficiency directly affects the network performance and is highly coupled with the type of application running over the OppNet [9]. In this environment, routing orchestration is a challenge. In this regard, software-defined networking (SDN) [10] is a network paradigm applied to connected networks that programmatically orchestrates the traffic routing and network configuration by using a program called a controller. The controller has an overview of the whole network and makes routing decisions based on this information. Although SDN protocols are based on TCP and, therefore, are not straightforwardly applicable to OppNets, we apply the concept of having a controller to orchestrate the OppNet traffic routing and agents receiving/sending information to the controller. Hence, the goal of this proposal consists of using the SDN building blocks to build a context-aware system over an OppNet. This context-aware system leverages context information to dynamically configure the OppNet's forwarding policy parameters aiming to achieve better performance. In the proposed context-aware system, some OppNet's nodes perform as SDN-like controllers (controllers) and the rest as SDN-like agents (nodes). The nodes gather context measurements, specifically device measurements, and send them opportunistically on a hop-to-hop basis to the controllers, which will use this information to dynamically tune the forwarding algorithm parameters. The nodes extend the SCF paradigm to (1) gather device context measurements, (2) aggregate the gathered measurements, (3) forward them to the controllers, and (4) apply the received policies generated by the controllers. In this manuscript, we name this paradigm GAFA. We refer to the OppNet extended with the control system and the GAFA functionalities as _controller-driven_ OppNet. In developing this proposal, we make the following contributions:  
* Design of the architecture of a novel context-aware system for OppNets inspired by the SDN paradigm where nodes operate based on the GAFA paradigm to feed controllers with device-context information and apply the controllers' policies.