use of org.onosproject.cpman.DefaultControlMessage in project onos by opennetworkinglab.
the class DefaultControlMessageTest method testBasic.
/**
* Tests creation of a DefaultControlMessage using a regular constructor.
*/
@Test
public void testBasic() {
final DeviceId deviceId = DeviceId.deviceId("of:0000000000000001");
final DefaultControlMessage cm = new DefaultControlMessage(INBOUND_PACKET, deviceId, 0L, 1L, 2L, 3L);
assertThat(cm.type(), is(INBOUND_PACKET));
assertThat(cm.load(), is(0L));
assertThat(cm.rate(), is(1L));
assertThat(cm.count(), is(2L));
assertThat(cm.timestamp(), is(3L));
}
use of org.onosproject.cpman.DefaultControlMessage in project onos by opennetworkinglab.
the class ControlMessageManagerTest method updateStatsInfo.
/**
* Tests the updateStatsInfo method.
*/
@Test
public void updateStatsInfo() {
Set<ControlMessage> cms = Sets.newHashSet();
ControlMessage.Type in = ControlMessage.Type.INBOUND_PACKET;
ControlMessage.Type out = ControlMessage.Type.OUTBOUND_PACKET;
ControlMessage.Type mod = ControlMessage.Type.FLOW_MOD_PACKET;
ControlMessage.Type rmv = ControlMessage.Type.FLOW_REMOVED_PACKET;
ControlMessage.Type req = ControlMessage.Type.REQUEST_PACKET;
ControlMessage.Type rep = ControlMessage.Type.REPLY_PACKET;
cms.add(new DefaultControlMessage(in, DID, 0, 0, 0, 0));
cms.add(new DefaultControlMessage(out, DID, 0, 0, 0, 0));
cms.add(new DefaultControlMessage(mod, DID, 0, 0, 0, 0));
cms.add(new DefaultControlMessage(rmv, DID, 0, 0, 0, 0));
cms.add(new DefaultControlMessage(req, DID, 0, 0, 0, 0));
cms.add(new DefaultControlMessage(rep, DID, 0, 0, 0, 0));
providerService.updateStatsInfo(DID, cms);
validateEvents(ControlMessageEvent.Type.STATS_UPDATE);
cms.clear();
}
Aggregations