Search in sources :

Example 1 with DefaultControlMessage

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));
}
Also used : DeviceId(org.onosproject.net.DeviceId) DefaultControlMessage(org.onosproject.cpman.DefaultControlMessage) Test(org.junit.Test)

Example 2 with DefaultControlMessage

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();
}
Also used : DefaultControlMessage(org.onosproject.cpman.DefaultControlMessage) ControlMessage(org.onosproject.cpman.ControlMessage) DefaultControlMessage(org.onosproject.cpman.DefaultControlMessage) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 DefaultControlMessage (org.onosproject.cpman.DefaultControlMessage)2 ControlMessage (org.onosproject.cpman.ControlMessage)1 DeviceId (org.onosproject.net.DeviceId)1