use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcep.error.object.ErrorObject in project bgpcep by opendaylight.
the class UtilTest method testCreateErrorMessage.
@Test
public void testCreateErrorMessage() {
final Pcerr errMsg = Util.createErrorMessage(PCEPErrors.BAD_LABEL_VALUE, null);
assertNull(errMsg.getPcerrMessage().getErrorType());
final ErrorObject errorObject = errMsg.getPcerrMessage().getErrors().get(0).getErrorObject();
assertEquals(PCEPErrors.BAD_LABEL_VALUE.getErrorType(), errorObject.getType());
assertEquals(PCEPErrors.BAD_LABEL_VALUE.getErrorValue(), errorObject.getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcep.error.object.ErrorObject in project bgpcep by opendaylight.
the class StatefulErrorMessageParser method insertObject.
private static State insertObject(final State state, final Object obj, final List<Errors> errorObjects, final List<Rps> requestParameters, final List<Srps> srps, final PcerrMessageBuilder builder) {
switch(state) {
case ERROR_IN:
if (obj instanceof ErrorObject) {
final ErrorObject o = (ErrorObject) obj;
errorObjects.add(new ErrorsBuilder().setErrorObject(o).build());
return State.ERROR_IN;
}
// fall through
case RP_IN:
if (obj instanceof Rp) {
final Rp o = (Rp) obj;
requestParameters.add(new RpsBuilder().setRp(o).build());
return State.RP_IN;
}
// fall through
case SRP_IN:
if (obj instanceof Srp) {
final Srp o = (Srp) obj;
srps.add(new SrpsBuilder().setSrp(o).build());
return State.SRP_IN;
}
// fall through
case OPEN:
if (obj instanceof Open) {
builder.setErrorType(new SessionCaseBuilder().setSession(new SessionBuilder().setOpen((Open) obj).build()).build());
return State.OPEN_IN;
}
// fall through
case ERROR:
if (obj instanceof ErrorObject) {
final ErrorObject o = (ErrorObject) obj;
errorObjects.add(new ErrorsBuilder().setErrorObject(o).build());
return State.ERROR;
}
// fall through
case OPEN_IN:
case END:
return State.END;
default:
return state;
}
}
Aggregations