Reference Guide

Table Of Contents
Controller-Controller Communication via REST (Sideways APIs)
RESTful Web Services (or REST APIs) [2] [1] also represent a convenient way to enable
communication between controllers, and the HP VAN SDN Controller framework provides some
facilities to do so. This section illustrates a way to enable such communication. This section is
optional and the code illustrated here won’t be part of our sample application, it is just a section
dedicated to illustrate this useful communication mechanism. Also note this should not be the
preferred mechanism to enable communication between controllers, the HP VAN SDN Controller
Framework offers other services based on Hazelcast [39] to achieve that. For more information see
Distributed Coordination Serivce on page 67.
Figure 55 illustrates the intuitive idea. In order to enable communication, a new service in charge
of the communication is created to decouple the business logic from the specifics of the underlying
communication technology. The implementation of the communication service sends HTTP requests
to the destination REST Web Service and processed HTTP responses. By introducing this
communication service it is possible to define higher-level (type-safe) communication methods.
Figure 55 Controller-Controller Communication via REST (Sideway API)
For example assume there is a need to retrieve all the open flow switches controlled by a remote
system. A sideway (or transfer) API could be defined to take care of such communication as shown
in the following listing.
SwitchTransferService.java:
package com.hp.hm.api;
...
public interface SwitchTransferService {
public Set<Switch> getControlledDevices(IpAddress system);
}
The following listing shows an extract of the communication service implementation using the
facilities provided by the HP VAN SDN Controller framework to handle HTTP requests and
responses.
SwitchTransferManager.java:
package com.hp.hm.impl;
import javax.ws.rs.core.Response.Status;
import com.hp.hm.api.SwitchTransferService;
190