Search in sources :

Example 11 with Message

use of org.eclipse.bpmn2.Message in project bgpcep by opendaylight.

the class UtilTest method testCreateErrorMessageWithOpen.

@Test
public void testCreateErrorMessageWithOpen() {
    final Message msg = Util.createErrorMessage(PCEPErrors.BAD_LABEL_VALUE, OPEN);
    Assert.assertTrue(msg instanceof Pcerr);
    final Pcerr errMsg = (Pcerr) msg;
    Assert.assertTrue(errMsg.getPcerrMessage().getErrorType() instanceof SessionCase);
    final SessionCase sessionCase = (SessionCase) errMsg.getPcerrMessage().getErrorType();
    Assert.assertEquals(OPEN, sessionCase.getSession().getOpen());
    final ErrorObject errorObject = errMsg.getPcerrMessage().getErrors().get(0).getErrorObject();
    Assert.assertEquals(PCEPErrors.BAD_LABEL_VALUE.getErrorType(), errorObject.getType().shortValue());
    Assert.assertEquals(PCEPErrors.BAD_LABEL_VALUE.getErrorValue(), errorObject.getValue().shortValue());
}
Also used : Message(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message) Pcerr(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Pcerr) ErrorObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.ErrorObject) SessionCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.pcerr.message.error.type.SessionCase) Test(org.junit.Test)

Example 12 with Message

use of org.eclipse.bpmn2.Message in project bgpcep by opendaylight.

the class PCCMockCommon method checkResyncSession.

static void checkResyncSession(final Optional<Integer> startAtNumberLsp, final int expectedNumberOfLsp, final int expectedTotalMessages, final BigInteger startingDBVersion, final BigInteger expectedDBVersion, final TestingSessionListener pceSessionListener) throws Exception {
    assertNotNull(pceSessionListener.getSession());
    assertTrue(pceSessionListener.isUp());
    final List<Message> messages;
    checkReceivedMessages(pceSessionListener, expectedTotalMessages);
    if (startAtNumberLsp.isPresent()) {
        messages = pceSessionListener.messages().subList(startAtNumberLsp.get(), startAtNumberLsp.get() + expectedNumberOfLsp);
    } else {
        messages = pceSessionListener.messages();
    }
    checkEquals(() -> checkSequequenceDBVersionSync(pceSessionListener, expectedDBVersion));
    assertEquals(expectedNumberOfLsp, messages.size());
    final PCEPSession session = pceSessionListener.getSession();
    checkSession(session, DEAD_TIMER, KEEP_ALIVE);
    assertTrue(session.getRemoteTlvs().getAugmentation(Tlvs1.class).getStateful().getAugmentation(Stateful1.class).isInitiation());
    final BigInteger pceDBVersion = session.getLocalTlvs().getAugmentation(Tlvs3.class).getLspDbVersion().getLspDbVersionValue();
    assertEquals(startingDBVersion, pceDBVersion);
}
Also used : PCEPSession(org.opendaylight.protocol.pcep.PCEPSession) Message(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message) BigInteger(java.math.BigInteger)

Example 13 with Message

use of org.eclipse.bpmn2.Message in project bgpcep by opendaylight.

the class Stateful07TopologySessionListenerTest method testOnErrorMessage.

@Test
public void testOnErrorMessage() throws InterruptedException, ExecutionException {
    final Message errorMsg = MsgBuilderUtil.createErrorMsg(PCEPErrors.NON_ZERO_PLSPID, 1L);
    this.listener.onSessionUp(this.session);
    final Future<RpcResult<AddLspOutput>> futureOutput = this.topologyRpcs.addLsp(createAddLspInput());
    this.listener.onMessage(this.session, errorMsg);
    final AddLspOutput output = futureOutput.get().getResult();
    assertEquals(FailureType.Failed, output.getFailure());
    assertEquals(1, output.getError().size());
    final ErrorObject err = output.getError().get(0).getErrorObject();
    assertEquals(PCEPErrors.NON_ZERO_PLSPID.getErrorType(), err.getType().shortValue());
    assertEquals(PCEPErrors.NON_ZERO_PLSPID.getErrorValue(), err.getValue().shortValue());
}
Also used : AddLspOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.AddLspOutput) Message(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message) ErrorObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.ErrorObject) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) Test(org.junit.Test)

Example 14 with Message

use of org.eclipse.bpmn2.Message in project bgpcep by opendaylight.

the class Stateful07TopologySessionListenerTest method testOnUnhandledErrorMessage.

@Test
public void testOnUnhandledErrorMessage() {
    final Message errorMsg = AbstractMessageParser.createErrorMsg(PCEPErrors.NON_ZERO_PLSPID, Optional.absent());
    this.listener.onSessionUp(this.session);
    assertTrue(this.listener.onMessage(Optional.<AbstractTopologySessionListener.MessageContext>absent().orNull(), errorMsg));
}
Also used : Message(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message) Test(org.junit.Test)

Example 15 with Message

use of org.eclipse.bpmn2.Message in project bgpcep by opendaylight.

the class AbstractMessageParserTest method testParseVendorInformationObject.

@Test
public void testParseVendorInformationObject() throws PCEPDeserializerException {
    final Abs parser = new Abs(this.registry);
    final ByteBuf buffer = Unpooled.buffer();
    parser.serializeVendorInformationObjects(Lists.newArrayList(this.viObject), buffer);
    Mockito.verify(this.registry, Mockito.only()).serializeVendorInformationObject(Mockito.any(VendorInformationObject.class), Mockito.any(ByteBuf.class));
    final Message msg = parser.parseMessage(Unpooled.wrappedBuffer(new byte[] { 0x22, 0x13, 0x00, 0x08, 0, 0, 0, 0 }), Collections.emptyList());
    assertEquals(this.viObject, ((Pcrep) msg).getPcrepMessage().getReplies().get(0).getVendorInformationObject().get(0));
}
Also used : Message(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message) VendorInformationObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.objects.VendorInformationObject) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Aggregations

Message (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message)16 RootElement (org.eclipse.bpmn2.RootElement)15 Message (org.eclipse.bpmn2.Message)13 ArrayList (java.util.ArrayList)10 AdHocSubProcess (org.eclipse.bpmn2.AdHocSubProcess)10 ItemDefinition (org.eclipse.bpmn2.ItemDefinition)10 Process (org.eclipse.bpmn2.Process)10 SubProcess (org.eclipse.bpmn2.SubProcess)10 Escalation (org.eclipse.bpmn2.Escalation)9 Signal (org.eclipse.bpmn2.Signal)9 Test (org.junit.Test)9 Entry (java.util.Map.Entry)8 FlowElement (org.eclipse.bpmn2.FlowElement)8 FlowElementsContainer (org.eclipse.bpmn2.FlowElementsContainer)8 SimpleFeatureMapEntry (org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry)8 FeatureMap (org.eclipse.emf.ecore.util.FeatureMap)8 CallActivity (org.eclipse.bpmn2.CallActivity)7 MessageEventDefinition (org.eclipse.bpmn2.MessageEventDefinition)7 Activity (org.eclipse.bpmn2.Activity)6 CompensateEventDefinition (org.eclipse.bpmn2.CompensateEventDefinition)6