Reference Guide

Table Of Contents
if (dh.isSupported(VlanHandlerFacet.class)) {
// use the Devcie Handler to get the Handler Facet
VlanHandler hf = dh.getFacet(VlanHandlerFacet.class);
// use the Handler Facet to get vlan information
vlans = hf.getVlans();
}
} catch (Exception e) {
e.printStackTrace();
}
return vlans;
}
/**
* Returns the IP address associated with the DeviceInfo object.
*
* @param di DeviceInfo object
* @return IP address for the DeviceInfo object
*/
private IpAddress getIp(DeviceInfo di) {
DeviceIdentity facet = di.getFacet(com.hp.device.DeviceIdentity.class);
return facet.getIpAddress();
}
The method above demonstrated how to get a Handler Facet and use the Handler Facet. This
method is used to obtain information about vlans that have been configured on a device. This
method is passed 3 parameters.
- ds: A reference to the Device Service. The Device Service is used to get the Device object
that contains information about a device.
- ddm: A reference to the Device Driver Service. The Device Driver Service is needed to
allocate a Device Handler. A Device Handler is needed to get a Handler Facet.
- dpid: This parameter contains the OpenFlow Data Path ID for the device. This is the
device that vlan information will be read from.
This method will return a Set of VlanInfo objects for the specified device. Each VlanInfo object
contains information about one vlan.
At line 15 the reference to the Device Service (ds) is used to get a Device object (dev) for the Data
Path ID.
At line 17 the Device object is used to get a DeviceInfo object (di). The DeviceInfo object is
needed to get a Device Handler and to get the IP address of the device. Both are needed to get a
Handler Facet.
At line 19 the Device Driver Service (dds) is used to get a Device Handler that is associated with
the DeviceInfo object. The device’s IP address is needed to create a Device Handler. The local
124