Reference Guide

Table Of Contents
Defining Model Objects
The application requires some standard data structures that act as transfer objects [31]. This
example uses a Switch data structure to hold all the information about the Open Flow Switch,
shown in the following listing (note that a better name would be OpenFlowSwitch, but a shorter
name was selected due space limitations illustrating code samples).
Switch.java:
package com.hp.hm.model;
import java.util.UUID;
import com.hp.api.Id;
import com.hp.api.Transportable;
import com.hp.sdn.BaseModel;
import com.hp.sdn.auditlog.AuditLogEntry;
import com.hp.sdn. Model;
public class Switch extends Model<Switch > {
...
private String name;
public Switch() {
super();
}
public Switch(String name) {
super();
this.name = name;
}
public Switch(Id<Switch UUID> id, String name) {
super(id);
this.name = name
}
// Implement setters and getters for mutable fields: name
// Good practice to override the following methods on transport objects:
// equals(Object), hashCode() and toString()
...
}
The Switch model object implements the Transportable interface which is part of the HP VAN SDN
Controller Framework; Model, which extends AbstractModel, offers a partial implementation of this
interface. In order to use such an interface and its partial implementation, the root POM file must
resolve the dependencies. The root POM file is used to resolve the dependencies because these
150