Search in sources :

Example 1 with PingReport

use of org.openkilda.messaging.model.PingReport in project open-kilda by telstra.

the class FlowPingReportTest method serializeLoop.

@Test
public void serializeLoop() throws Exception {
    PingReport report = new PingReport("flowId-" + getClass().getSimpleName(), State.OPERATIONAL);
    FlowPingReport origin = new FlowPingReport(report);
    InfoMessage wrapper = new InfoMessage(origin, System.currentTimeMillis(), getClass().getSimpleName());
    serializer.serialize(wrapper);
    InfoMessage decodedWrapper = (InfoMessage) serializer.deserialize();
    InfoData decoded = decodedWrapper.getData();
    Assert.assertEquals(String.format("%s object have been mangled in serialisation/deserialization loop", origin.getClass().getName()), origin, decoded);
}
Also used : InfoMessage(org.openkilda.messaging.info.InfoMessage) InfoData(org.openkilda.messaging.info.InfoData) PingReport(org.openkilda.messaging.model.PingReport) Test(org.junit.Test)

Example 2 with PingReport

use of org.openkilda.messaging.model.PingReport in project open-kilda by telstra.

the class FailReporter method report.

private void report(Tuple input, String flowId, FlowObserver flowObserver, State state) throws PipelineException {
    String logMessage = String.format("{FLOW-PING} Flow %s become %s", flowId, state);
    if (state != State.OPERATIONAL) {
        String cookies = flowObserver.getFlowTreadsInState(state).stream().map(cookie -> String.format("0x%016x", cookie)).collect(Collectors.joining(", "));
        if (!cookies.isEmpty()) {
            logMessage += String.format("(%s)", cookies);
        }
    }
    log.info(logMessage);
    Values output = new Values(new PingReport(flowId, state), pullContext(input));
    getOutput().emit(input, output);
}
Also used : OutputFieldsDeclarer(org.apache.storm.topology.OutputFieldsDeclarer) PingObserver(org.openkilda.wfm.topology.ping.model.PingObserver) Iterator(java.util.Iterator) PingReport(org.openkilda.messaging.model.PingReport) HashMap(java.util.HashMap) Fields(org.apache.storm.tuple.Fields) FlowObserver(org.openkilda.wfm.topology.ping.model.FlowObserver) Collectors(java.util.stream.Collectors) State(org.openkilda.messaging.model.PingReport.State) TimeUnit(java.util.concurrent.TimeUnit) Values(org.apache.storm.tuple.Values) Tuple(org.apache.storm.tuple.Tuple) Flow(org.openkilda.model.Flow) PipelineException(org.openkilda.wfm.error.PipelineException) PingContext(org.openkilda.wfm.topology.ping.model.PingContext) Entry(java.util.Map.Entry) Values(org.apache.storm.tuple.Values) PingReport(org.openkilda.messaging.model.PingReport)

Aggregations

PingReport (org.openkilda.messaging.model.PingReport)2 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 Entry (java.util.Map.Entry)1 TimeUnit (java.util.concurrent.TimeUnit)1 Collectors (java.util.stream.Collectors)1 OutputFieldsDeclarer (org.apache.storm.topology.OutputFieldsDeclarer)1 Fields (org.apache.storm.tuple.Fields)1 Tuple (org.apache.storm.tuple.Tuple)1 Values (org.apache.storm.tuple.Values)1 Test (org.junit.Test)1 InfoData (org.openkilda.messaging.info.InfoData)1 InfoMessage (org.openkilda.messaging.info.InfoMessage)1 State (org.openkilda.messaging.model.PingReport.State)1 Flow (org.openkilda.model.Flow)1 PipelineException (org.openkilda.wfm.error.PipelineException)1 FlowObserver (org.openkilda.wfm.topology.ping.model.FlowObserver)1 PingContext (org.openkilda.wfm.topology.ping.model.PingContext)1 PingObserver (org.openkilda.wfm.topology.ping.model.PingObserver)1