* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.protocol.rsvp.parser.impl.subobject.ero;
import com.google.common.base.Preconditions;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.subobjects.subobject.type.basic.protection._case.BasicProtectionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.subobjects.subobject.type.dynamic.control.protection._case.DynamicControlProtectionBuilder;
-public class SEROBasicProtectionSubobjectParser extends ProtectionCommonParser implements EROSubobjectParser,
- EROSubobjectSerializer {
+public class SEROBasicProtectionSubobjectParser extends ProtectionCommonParser
+ implements EROSubobjectParser, EROSubobjectSerializer {
public static final int TYPE = 37;
- public static final Short CTYPE = 1;
+ public static final short CTYPE = 1;
@Override
public SubobjectContainer parseSubobject(final ByteBuf buffer, final boolean loose) throws RSVPParsingException {
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.protocol.rsvp.parser.impl.subobject.ero;
import com.google.common.base.Preconditions;
* Parser for {@link DynamicControlProtectionCase}.
*/
public class SERODynamicProtectionSubobjectParser extends ProtectionCommonParser implements EROSubobjectSerializer {
-
public static final int TYPE = 37;
- public static final Short CTYPE = 2;
+ public static final short CTYPE = 2;
@Override
public void serializeSubobject(final SubobjectContainer subobject, final ByteBuf buffer) {
serializeBody(CTYPE, protObj, body);
EROSubobjectUtil.formatSubobject(TYPE, subobject.isLoose(), body, buffer);
}
-
}
\ No newline at end of file
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.protocol.rsvp.parser.impl.subobject.rro;
import com.google.common.base.Preconditions;
/**
* Parser for {@link BasicProtectionCase}.
*/
-public class SRROBasicProtectionSubobjectParser extends ProtectionCommonParser implements RROSubobjectParser,
- RROSubobjectSerializer {
-
+public class SRROBasicProtectionSubobjectParser extends ProtectionCommonParser
+ implements RROSubobjectParser, RROSubobjectSerializer {
public static final int TYPE = 37;
- public static final Short CTYPE = 1;
+ public static final short CTYPE = 1;
@Override
public SubobjectContainer parseSubobject(final ByteBuf buffer) throws RSVPParsingException {
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.protocol.rsvp.parser.impl.subobject.rro;
import com.google.common.base.Preconditions;
public class SRRODynamicProtectionSubobjectParser extends ProtectionCommonParser implements RROSubobjectSerializer {
public static final int TYPE = 37;
- public static final Short CTYPE = 2;
+ public static final short CTYPE = 2;
@Override
public void serializeSubobject(final SubobjectContainer subobject, final ByteBuf buffer) {
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.protocol.rsvp.parser.impl.te;
-import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeUnsignedByte;
-
import io.netty.buffer.ByteBuf;
import org.opendaylight.protocol.rsvp.parser.spi.RSVPParsingException;
import org.opendaylight.protocol.util.BitArray;
return sub.build();
}
- protected static void serializeBody(final Short ctype, final ProtectionSubobject protObj,
+ protected static void serializeBody(final short ctype, final ProtectionSubobject protObj,
final ByteBuf output) {
output.writeZero(BYTE_SIZE);
- writeUnsignedByte(ctype, output);
+ output.writeByte(ctype);
switch (ctype) {
case PROTECTION_SUBOBJECT_TYPE_1:
serializeBodyType1(protObj, output);
}
protected static ProtectionSubobject parseCommonProtectionBody(final short ctype, final ByteBuf byteBuf)
- throws RSVPParsingException {
- ProtectionSubobject protectionSubobject = null;
+ throws RSVPParsingException {
switch (ctype) {
case PROTECTION_SUBOBJECT_TYPE_1:
- protectionSubobject = parseCommonProtectionBodyType1(byteBuf);
- break;
+ return parseCommonProtectionBodyType1(byteBuf);
case PROTECTION_SUBOBJECT_TYPE_2:
- protectionSubobject = parseCommonProtectionBodyType2(byteBuf);
- break;
+ return parseCommonProtectionBodyType2(byteBuf);
default:
LOG.warn("Secondary Record Route Protection Subobject cType {} not supported", ctype);
- break;
+ return null;
}
- return protectionSubobject;
}
}