import org.opendaylight.protocol.util.Ipv4Util;
import org.opendaylight.protocol.util.Ipv6Util;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.SidType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.SrSubobject;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.subobject.Nai;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.subobject.nai.IpAdjacency;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.subobject.nai.IpAdjacencyBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.subobject.nai.IpNodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.subobject.nai.IpNodeIdBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.subobject.nai.UnnumberedAdjacency;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.subobject.nai.UnnumberedAdjacencyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.NaiType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.SrSubobject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.Nai;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.IpAdjacency;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.IpAdjacencyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.IpNodeId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.IpNodeIdBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.Ipv6Local;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.Ipv6LocalBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.UnnumberedAdjacency;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.UnnumberedAdjacencyBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
import org.opendaylight.yangtools.yang.common.netty.ByteBufUtils;
protected static final int F_FLAG_POSITION = 4;
protected static final int MPLS_LABEL_OFFSET = 12;
- private static final int SID_TYPE_BITS_OFFSET = 4;
+ private static final int NAI_TYPE_BITS_OFFSET = 4;
private static class SrSubobjectImpl implements SrSubobject {
private final boolean mflag;
private final boolean cflag;
- private final SidType sidType;
+ private final NaiType naiType;
private final Uint32 sid;
private final Nai nai;
- SrSubobjectImpl(final boolean mflag, final boolean cflag, final SidType sidType, final Uint32 sid,
+ SrSubobjectImpl(final boolean mflag, final boolean cflag, final NaiType naiType, final Uint32 sid,
final Nai nai) {
this.mflag = mflag;
this.cflag = cflag;
- this.sidType = sidType;
+ this.naiType = naiType;
this.sid = sid;
this.nai = nai;
}
}
@Override
- public SidType getSidType() {
- return this.sidType;
+ public NaiType getNaiType() {
+ return this.naiType;
}
@Override
}
public ByteBuf serializeSubobject(final SrSubobject srSubobject) {
+ checkArgument(srSubobject.getNai() != null || srSubobject.getSid() != null,
+ "Both SID and NAI are absent in SR subobject.");
+
final ByteBuf buffer = Unpooled.buffer(MINIMAL_LENGTH);
- // sid type
- buffer.writeByte(srSubobject.getSidType().getIntValue() << SID_TYPE_BITS_OFFSET);
+ /* Write NAI Type */
+ buffer.writeByte(srSubobject.getNaiType().getIntValue() << NAI_TYPE_BITS_OFFSET);
+
+ /* Flags set according to RFC8664#section 4.3.1 */
final BitArray bits = new BitArray(BITSET_LENGTH);
bits.set(M_FLAG_POSITION, srSubobject.isMFlag());
- bits.set(C_FLAG_POSITION, srSubobject.isCFlag());
+ /* C flag MUST be set to 0 if M flag is set to 0 */
+ if (!srSubobject.isMFlag()) {
+ bits.set(C_FLAG_POSITION, Boolean.FALSE);
+ } else {
+ bits.set(C_FLAG_POSITION, srSubobject.isCFlag());
+ }
+ /* M & C flags MUST be set to 0 if S flag is set to 1 */
if (srSubobject.getSid() == null) {
+ bits.set(M_FLAG_POSITION, Boolean.FALSE);
+ bits.set(C_FLAG_POSITION, Boolean.FALSE);
bits.set(S_FLAG_POSITION, Boolean.TRUE);
}
- if (srSubobject.getNai() == null) {
+ /* F flag MUST be set if NT=0 or NAI is absent */
+ if ((srSubobject.getNai() == null) || (srSubobject.getNaiType().getIntValue() == 0)) {
bits.set(F_FLAG_POSITION, Boolean.TRUE);
}
- // bits
+ /* Write Flags */
bits.toByteBuf(buffer);
- // sid
- checkArgument(srSubobject.getNai() != null || srSubobject.getSid() != null,
- "Both SID and NAI are absent in SR subobject.");
+
+ /* Write SID */
if (srSubobject.getSid() != null) {
if (srSubobject.isMFlag()) {
buffer.writeInt(srSubobject.getSid().intValue() << MPLS_LABEL_OFFSET);
ByteBufUtils.writeOrZero(buffer, srSubobject.getSid());
}
}
- // nai
+
+ /* Write NAI */
final Nai nai = srSubobject.getNai();
if (nai != null) {
- serializeNai(nai, srSubobject.getSidType() ,buffer);
+ serializeNai(nai, srSubobject.getNaiType(), buffer);
}
return buffer;
}
- private static void serializeNai(final Nai nai, final SidType sidType, final ByteBuf buffer) {
- switch (sidType) {
+ private static void serializeNai(final Nai nai, final NaiType naiType, final ByteBuf buffer) {
+ switch (naiType) {
case Ipv4NodeId:
Ipv4Util.writeIpv4Address(((IpNodeId) nai).getIpAddress().getIpv4AddressNoZone(), buffer);
break;
ByteBufUtils.writeOrZero(buffer, unnumbered.getRemoteNodeId());
ByteBufUtils.writeOrZero(buffer, unnumbered.getRemoteInterfaceId());
break;
+ case Ipv6Local:
+ final Ipv6Local ipv6Local = (Ipv6Local) nai;
+ Ipv6Util.writeIpv6Address(ipv6Local.getLocalIpv6Address(), buffer);
+ ByteBufUtils.writeOrZero(buffer, ipv6Local.getLocalId());
+ Ipv6Util.writeIpv6Address(ipv6Local.getRemoteIpv6Address(), buffer);
+ ByteBufUtils.writeOrZero(buffer, ipv6Local.getRemoteId());
+ break;
default:
break;
}
}
- private static Nai parseNai(final SidType sidType, final ByteBuf buffer) {
- switch (sidType) {
+ private static Nai parseNai(final NaiType naiType, final ByteBuf buffer) {
+ switch (naiType) {
case Ipv4NodeId:
return new IpNodeIdBuilder().setIpAddress(new IpAddressNoZone(Ipv4Util.addressForByteBuf(buffer)))
.build();
.setLocalInterfaceId(ByteBufUtils.readUint32(buffer))
.setRemoteNodeId(ByteBufUtils.readUint32(buffer))
.setRemoteInterfaceId(ByteBufUtils.readUint32(buffer)).build();
+ case Ipv6Local:
+ return new Ipv6LocalBuilder()
+ .setLocalIpv6Address(Ipv6Util.addressForByteBuf(buffer))
+ .setLocalId(ByteBufUtils.readUint32(buffer))
+ .setRemoteIpv6Address(Ipv6Util.addressForByteBuf(buffer))
+ .setRemoteId(ByteBufUtils.readUint32(buffer)).build();
default:
return null;
}
}
protected static SrSubobject parseSrSubobject(final ByteBuf buffer) throws PCEPDeserializerException {
- final int sidTypeByte = buffer.readByte() >> SID_TYPE_BITS_OFFSET;
- final SidType sidType = SidType.forValue(sidTypeByte);
+ final int naiTypeByte = buffer.readByte() >> NAI_TYPE_BITS_OFFSET;
+ final NaiType naiType = NaiType.forValue(naiTypeByte);
final BitArray bitSet = BitArray.valueOf(buffer.readByte());
final boolean f = bitSet.get(F_FLAG_POSITION);
final boolean s = bitSet.get(S_FLAG_POSITION);
sid = null;
}
final Nai nai;
- if (sidType != null && !f) {
- nai = parseNai(sidType, buffer);
+ if (naiType != null && naiType.getIntValue() != 0 && !f) {
+ nai = parseNai(naiType, buffer);
} else {
nai = null;
}
- return new SrSubobjectImpl(m, c, sidType, sid, nai);
+ return new SrSubobjectImpl(m, c, naiType, sid, nai);
}
}
import java.net.InetSocketAddress;
import org.opendaylight.protocol.pcep.PCEPCapability;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.Tlvs1Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.pce.capability.tlv.SrPceCapabilityBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.Tlvs1Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.pce.capability.tlv.SrPceCapabilityBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.TlvsBuilder;
import org.opendaylight.yangtools.yang.common.Uint8;
public void setCapabilityProposal(final InetSocketAddress address, final TlvsBuilder builder) {
if (this.isSegmentRoutingCapable) {
builder.addAugmentation(new Tlvs1Builder()
- .setSrPceCapability(new SrPceCapabilityBuilder().setMsd(Uint8.ZERO).build())
+ .setSrPceCapability(new SrPceCapabilityBuilder().setNFlag(Boolean.FALSE).setXFlag(Boolean.FALSE)
+ .setMsd(Uint8.ZERO).build())
.build());
}
}
import org.opendaylight.protocol.pcep.spi.TlvRegistry;
import org.opendaylight.protocol.pcep.spi.VendorInformationTlvRegistry;
import org.opendaylight.protocol.pcep.sync.optimizations.SyncOptimizationsOpenObjectParser;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.Tlvs1;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.Tlvs1Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.pce.capability.tlv.SrPceCapability;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.Tlvs1;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.Tlvs1Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.pce.capability.tlv.SrPceCapability;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Tlv;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.Tlvs;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.TlvsBuilder;
import org.opendaylight.protocol.pcep.spi.TlvRegistry;
import org.opendaylight.protocol.pcep.spi.VendorInformationTlvRegistry;
import org.opendaylight.protocol.pcep.spi.pojo.AbstractPCEPExtensionProviderActivator;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.add.lsp.input.arguments.ero.subobject.subobject.type.SrEroType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.add.lsp.input.arguments.rro.subobject.subobject.type.SrRroType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.pce.capability.tlv.SrPceCapability;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.add.lsp.input.arguments.ero.subobject.subobject.type.SrEroType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.add.lsp.input.arguments.rro.subobject.subobject.type.SrRroType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.pce.capability.tlv.SrPceCapability;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.Open;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.path.setup.type.tlv.PathSetupType;
import org.opendaylight.yangtools.concepts.Registration;
public class SegmentRoutingActivator extends AbstractPCEPExtensionProviderActivator {
+ @Deprecated
private final boolean ianaSrSubobjectsType;
public SegmentRoutingActivator() {
- this.ianaSrSubobjectsType = false;
+ this.ianaSrSubobjectsType = true;
}
+ @Deprecated
public SegmentRoutingActivator(final boolean ianaSrSubobjectsType) {
this.ianaSrSubobjectsType = ianaSrSubobjectsType;
}
final SrEroSubobjectParser srEroSubobjectParser = new SrEroSubobjectParser(this.ianaSrSubobjectsType);
regs.add(context.registerEROSubobjectParser(srEroSubobjectParser.getCodePoint(), srEroSubobjectParser));
regs.add(context.registerEROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
- .pcep.segment.routing.rev181109.network.topology.topology.node.path.computation.client.reported.lsp.path.ero
+ .pcep.segment.routing.rev200720.network.topology.topology.node.path.computation.client.reported.lsp.path.ero
.subobject.subobject.type.SrEroType.class,srEroSubobjectParser));
regs.add(context.registerEROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
- .pcep.segment.routing.rev181109.pcinitiate.pcinitiate.message.requests.ero.subobject.subobject.type
+ .pcep.segment.routing.rev200720.pcinitiate.pcinitiate.message.requests.ero.subobject.subobject.type
.SrEroType.class, srEroSubobjectParser));
regs.add(context.registerEROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
- .pcep.segment.routing.rev181109.pcrep.pcrep.message.replies.result.success._case.success.paths.ero.subobject
+ .pcep.segment.routing.rev200720.pcrep.pcrep.message.replies.result.success._case.success.paths.ero.subobject
.subobject.type.SrEroType.class, srEroSubobjectParser));
regs.add(context.registerEROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
- .pcep.segment.routing.rev181109.pcrpt.pcrpt.message.reports.path.ero.subobject.subobject.type
+ .pcep.segment.routing.rev200720.pcrpt.pcrpt.message.reports.path.ero.subobject.subobject.type
.SrEroType.class, srEroSubobjectParser));
regs.add(context.registerEROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
- .pcep.segment.routing.rev181109.pcupd.pcupd.message.updates.path.ero.subobject.subobject.type
+ .pcep.segment.routing.rev200720.pcupd.pcupd.message.updates.path.ero.subobject.subobject.type
.SrEroType.class, srEroSubobjectParser));
regs.add(context.registerEROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
- .pcep.segment.routing.rev181109.update.lsp.input.arguments.ero.subobject.subobject.type.SrEroType.class,
+ .pcep.segment.routing.rev200720.update.lsp.input.arguments.ero.subobject.subobject.type.SrEroType.class,
srEroSubobjectParser));
regs.add(context.registerEROSubobjectSerializer(SrEroType.class, srEroSubobjectParser));
final SrRroSubobjectParser srRroSubobjectParser = new SrRroSubobjectParser(this.ianaSrSubobjectsType);
regs.add(context.registerRROSubobjectParser(srRroSubobjectParser.getCodePoint(), srRroSubobjectParser));
regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
- .pcep.segment.routing.rev181109.network.topology.topology.node.path.computation.client.reported.lsp.path.rro
+ .pcep.segment.routing.rev200720.network.topology.topology.node.path.computation.client.reported.lsp.path.rro
.subobject.subobject.type.SrRroType.class, srRroSubobjectParser));
regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
- .pcep.segment.routing.rev181109.pcinitiate.pcinitiate.message.requests.rro.subobject.subobject.type
+ .pcep.segment.routing.rev200720.pcinitiate.pcinitiate.message.requests.rro.subobject.subobject.type
.SrRroType.class, srRroSubobjectParser));
regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
- .pcep.segment.routing.rev181109.pcrep.pcrep.message.replies.result.failure._case.rro.subobject.subobject
+ .pcep.segment.routing.rev200720.pcrep.pcrep.message.replies.result.failure._case.rro.subobject.subobject
.type.SrRroType.class, srRroSubobjectParser));
regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
- .pcep.segment.routing.rev181109.pcreq.pcreq.message.requests.segment.computation.p2p.reported.route.rro
+ .pcep.segment.routing.rev200720.pcreq.pcreq.message.requests.segment.computation.p2p.reported.route.rro
.subobject.subobject.type.SrRroType.class, srRroSubobjectParser));
regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
- .pcep.segment.routing.rev181109.pcrpt.pcrpt.message.reports.path.rro.subobject.subobject.type
+ .pcep.segment.routing.rev200720.pcrpt.pcrpt.message.reports.path.rro.subobject.subobject.type
.SrRroType.class, srRroSubobjectParser));
regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
- .pcep.segment.routing.rev181109.pcupd.pcupd.message.updates.path.rro.subobject.subobject.type
+ .pcep.segment.routing.rev200720.pcupd.pcupd.message.updates.path.rro.subobject.subobject.type
.SrRroType.class, srRroSubobjectParser));
regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
- .pcep.segment.routing.rev181109.update.lsp.input.arguments.rro.subobject.subobject.type.SrRroType.class,
+ .pcep.segment.routing.rev200720.update.lsp.input.arguments.rro.subobject.subobject.type.SrRroType.class,
srRroSubobjectParser));
regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
- .pcep.segment.routing.rev181109.pcrep.pcrep.message.replies.result.success._case.success.paths.rro.subobject
+ .pcep.segment.routing.rev200720.pcrep.pcrep.message.replies.result.success._case.success.paths.rro.subobject
.subobject.type.SrRroType.class, srRroSubobjectParser));
regs.add(context.registerRROSubobjectSerializer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
- .pcep.segment.routing.rev181109.pcreq.pcreq.message.requests.segment.computation.p2p.rro.subobject.subobject
+ .pcep.segment.routing.rev200720.pcreq.pcreq.message.requests.segment.computation.p2p.rro.subobject.subobject
.type.SrRroType.class, srRroSubobjectParser));
regs.add(context.registerRROSubobjectSerializer(SrRroType.class, srRroSubobjectParser));
import org.opendaylight.protocol.pcep.spi.EROSubobjectSerializer;
import org.opendaylight.protocol.pcep.spi.EROSubobjectUtil;
import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.SrSubobject;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.add.lsp.input.arguments.ero.subobject.subobject.type.SrEroTypeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.SrSubobject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.add.lsp.input.arguments.ero.subobject.subobject.type.SrEroTypeBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.Subobject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.SubobjectBuilder;
public class SrEroSubobjectParser extends AbstractSrSubobjectParser implements EROSubobjectParser,
EROSubobjectSerializer {
+ @Deprecated
private static final int LEGACY_TYPE = 5;
- private static final int PROPOSED_TYPE = 36;
+ private static final int IANA_TYPE = 36;
+ @Deprecated
private final int type;
+ SrEroSubobjectParser() {
+ this.type = IANA_TYPE;
+ }
+
+ @Deprecated
SrEroSubobjectParser(final boolean isIanaAssignedType) {
- this.type = isIanaAssignedType ? PROPOSED_TYPE : LEGACY_TYPE;
+ this.type = isIanaAssignedType ? IANA_TYPE : LEGACY_TYPE;
}
@Override
return subobjectBuilder.build();
}
+ @Deprecated
public int getCodePoint() {
return this.type;
}
import org.opendaylight.protocol.pcep.spi.TlvParser;
import org.opendaylight.protocol.pcep.spi.TlvSerializer;
import org.opendaylight.protocol.pcep.spi.TlvUtil;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.pce.capability.tlv.SrPceCapability;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.pce.capability.tlv.SrPceCapabilityBuilder;
+import org.opendaylight.protocol.util.BitArray;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.pce.capability.tlv.SrPceCapability;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.pce.capability.tlv.SrPceCapabilityBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Tlv;
import org.opendaylight.yangtools.yang.common.netty.ByteBufUtils;
public class SrPceCapabilityTlvParser implements TlvParser, TlvSerializer {
public static final int TYPE = 26;
- private static final int MSD_LENGTH = 1;
+ private static final int BITSET_LENGTH = 8;
+ private static final int N_FLAG_POSITION = 7;
+ private static final int X_FLAG_POSITION = 6;
private static final int CONTENT_LENGTH = 4;
- private static final int OFFSET = CONTENT_LENGTH - MSD_LENGTH;
+ private static final int OFFSET = 2;
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
checkArgument(tlv instanceof SrPceCapability, "SrPceCapability is mandatory.");
final ByteBuf body = Unpooled.buffer(CONTENT_LENGTH);
+
+ /* Reserved 2 bytes */
body.writerIndex(OFFSET);
- ByteBufUtils.writeOrZero(body, ((SrPceCapability) tlv).getMsd());
+
+ /* Flags */
+ final SrPceCapability srPceCapability = (SrPceCapability) tlv;
+ final BitArray bits = new BitArray(BITSET_LENGTH);
+ bits.set(N_FLAG_POSITION, srPceCapability.isNFlag());
+ bits.set(X_FLAG_POSITION, srPceCapability.isXFlag());
+ bits.toByteBuf(body);
+
+ /* MSD */
+ ByteBufUtils.writeOrZero(body, srPceCapability.getMsd());
+
TlvUtil.formatTlv(TYPE, body, buffer);
}
if (buffer == null) {
return null;
}
+ final BitArray bitSet = BitArray.valueOf(buffer.readerIndex(OFFSET).readByte());
+ final boolean n = bitSet.get(N_FLAG_POSITION);
+ final boolean x = bitSet.get(X_FLAG_POSITION);
+
return new SrPceCapabilityBuilder()
- .setMsd(ByteBufUtils.readUint8(buffer.readerIndex(OFFSET)))
+ .setNFlag(n)
+ .setXFlag(x)
+ .setMsd(ByteBufUtils.readUint8(buffer))
.build();
}
}
import org.opendaylight.protocol.pcep.spi.RROSubobjectParser;
import org.opendaylight.protocol.pcep.spi.RROSubobjectSerializer;
import org.opendaylight.protocol.pcep.spi.RROSubobjectUtil;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.SrSubobject;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.add.lsp.input.arguments.rro.subobject.subobject.type.SrRroTypeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.SrSubobject;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.add.lsp.input.arguments.rro.subobject.subobject.type.SrRroTypeBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.reported.route.object.rro.Subobject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.reported.route.object.rro.SubobjectBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.SubobjectType;
public class SrRroSubobjectParser extends AbstractSrSubobjectParser implements RROSubobjectParser,
RROSubobjectSerializer {
+ @Deprecated
private static final int LEGACY_TYPE = 6;
- private static final int PROPOSED_TYPE = 36;
+ private static final int IANA_TYPE = 36;
+ @Deprecated
private final int type;
+ SrRroSubobjectParser() {
+ this.type = IANA_TYPE;
+ }
+
+ @Deprecated
SrRroSubobjectParser(final boolean isIanaAssignedType) {
- this.type = isIanaAssignedType ? PROPOSED_TYPE : LEGACY_TYPE;
+ this.type = isIanaAssignedType ? IANA_TYPE : LEGACY_TYPE;
}
@Override
return subobjectBuilder.build();
}
+ @Deprecated
public int getCodePoint() {
return this.type;
}
description
"This module contains the data model of PCEP Extensions for Segment Routing,
- draft-ietf-pce-segment-routing-01.
+ as defined in RFC 8664.
Copyright (c)2015 Cisco Systems, Inc. All rights reserved.
accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html";
+ revision "2020-07-20" {
+ description "Update to RFC 8664";
+ reference "RFC8664: https://tools.ietf.org/html/rfc8664";
+ }
+
revision "2018-11-09" {
description
"P2MP extension.";
grouping sr-pce-capability-tlv {
description "SR-PCE-CAPABILITY TLV";
- reference "http://tools.ietf.org/html/draft-ietf-pce-segment-routing-01#section-5.1.1";
+ reference "http://tools.ietf.org/html/rfc8664#section-4.1.2";
container sr-pce-capability {
uses pcep:tlv;
+ leaf n-flag {
+ description "N flag used by a PCC to indicate that it is capable of resolving a NAI to a SID";
+ type boolean;
+ default false;
+ }
+ leaf x-flag {
+ description " X flag used by a PCC to indicate that it does not impose any limit to the MSD";
+ type boolean;
+ default false;
+ }
leaf msd {
description "Maximum SID Depth";
type uint8;
}
augment "/msg:open/msg:open-message/msg:open/msg:tlvs" {
- reference "http://tools.ietf.org/html/draft-ietf-pce-segment-routing-01#section-5.1";
+ reference "http://tools.ietf.org/html/rfc4664#section-4.1";
uses sr-pce-capability-tlv;
}
augment "/msg:pcerr/msg:pcerr-message/msg:error-type/msg:session-case/msg:session/msg:open/msg:tlvs" {
- reference "http://tools.ietf.org/html/draft-ietf-pce-segment-routing-01#section-5.1";
+ reference "http://tools.ietf.org/html/rfc8664#section-5.1";
uses sr-pce-capability-tlv;
}
- typedef sid-type {
- reference "http://tools.ietf.org/html/draft-ietf-pce-segment-routing-01#section-5.3.1";
+ typedef nai-type {
+ reference "http://tools.ietf.org/html/rfc8664#section-4.3.1";
type enumeration {
enum ipv4-node-id {
value 1;
enum unnumbered {
value 5;
}
+ enum ipv6-local {
+ value 6;
+ }
}
}
grouping sr-subobject {
description "Common grouping for both SR-ERO and SR-RRO subobjects as they share the same content representation.";
- leaf c-flag {
- type boolean;
- default false;
+ leaf nai-type {
+ description "Node or Adjacency Identifier Type (NT)";
+ type nai-type;
}
leaf m-flag {
+ description "If this bit is set to 1, the SID value represents an MPLS label stack entry";
type boolean;
default false;
}
- leaf sid-type {
- type sid-type;
+ leaf c-flag {
+ description "TC, S & TTL fields in the MPLS label are specified by the PCE if M & C are set to 1";
+ type boolean;
+ default false;
}
+ /* S-Flag is represented by the presence of the SID TLV: isSflag() is equivalent to getSid() != null */
leaf sid {
description "Segment Identifier";
type uint32;
}
+ /* F-Flag is represented by the presence of the NAI TLV: isFflag() is equivalent to getNai() != null */
choice nai {
- reference "http://tools.ietf.org/html/draft-ietf-pce-segment-routing-01#section-5.3.2";
+ reference "http://tools.ietf.org/html/rfc8664#section-4.3.2";
description "Node or Adjacency Identifier";
case ip-node-id {
- when "../sid-type = 'ipv4-node-id' or ../sid-type = 'ipv6-node-id'";
+ when "../nai-type = 'ipv4-node-id' or ../nai-type = 'ipv6-node-id'";
description "IP Node ID";
leaf ip-address {
type inet:ip-address-no-zone;
}
}
case ip-adjacency {
- when "../sid-type = 'ipv4-adjacency' or ../sid-type = 'ipv6-adjacency'";
+ when "../nai-type = 'ipv4-adjacency' or ../nai-type = 'ipv6-adjacency'";
description "IP Adjacency";
leaf local-ip-address {
type inet:ip-address-no-zone;
}
}
case unnumbered-adjacency {
- when "../sid-type = 'unnumbered'";
+ when "../nai-type = 'unnumbered'";
description "Unnumbered Adjacency with IPv4 NodeIDs";
leaf local-node-id {
type uint32;
mandatory true;
}
}
+ case ipv6-local {
+ when "../nai-type = 'ipv6-local'";
+ description "IPv6 adjacency with link-local IPv6 addresses";
+ leaf local-ipv6-address {
+ type inet:ipv6-address-no-zone;
+ mandatory true;
+ }
+ leaf local-id {
+ type uint32;
+ mandatory true;
+ }
+ leaf remote-ipv6-address {
+ type inet:ipv6-address-no-zone;
+ mandatory true;
+ }
+ leaf remote-id {
+ type uint32;
+ mandatory true;
+ }
+ }
}
}
// kept both groupings in case draft changes and they won't be equal
grouping sr-ero-subobject {
- reference "http://tools.ietf.org/html/draft-ietf-pce-segment-routing-01#section-5.3.1";
+ reference "http://tools.ietf.org/html/rfc8664#section-4.3";
+ /* L(oose)-flag is already present within the ERO subObject */
uses sr-subobject;
}
grouping sr-rro-subobject {
- reference "http://tools.ietf.org/html/draft-ietf-pce-segment-routing-01#section-5.4";
+ reference "http://tools.ietf.org/html/rfc8664#section-4.4";
uses sr-subobject;
}
container pcep-segment-routing-config {
leaf iana-sr-subobjects-type {
- description "If false (default) SR-ERO type (=5) and SR-RRO type (=6) is used,
- else proposed type (36) is used for parsing/serialization";
+ description "If true (default) IANA Types for SR-ERO type (=36) and SR-RRO type (=36) are used,
+ else historical types (5 & 6) are used for parsing/serialization";
type boolean;
- default false;
+ default true;
}
leaf sr-capable {
- description "Advertize segment-routing capability";
+ description "Advertize segment-routing capability with historical type values (SR-ERO = 5 & SR-RRO = 6)";
type boolean;
- default true;
+ default false;
}
}
}
\ No newline at end of file
import org.junit.Assert;
import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.pce.capability.tlv.SrPceCapabilityBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.pce.capability.tlv.SrPceCapabilityBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.Tlvs;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.TlvsBuilder;
import org.opendaylight.yangtools.yang.common.Uint8;
public class PCEPSegmentRoutingCapabilityTest {
private static final Tlvs EXPECTED_TLVS =
new TlvsBuilder().addAugmentation(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep
- .segment.routing.rev181109.Tlvs1Builder().setSrPceCapability(new SrPceCapabilityBuilder()
- .setMsd(Uint8.ZERO).build()).build()).build();
+ .segment.routing.rev200720.Tlvs1Builder().setSrPceCapability(new SrPceCapabilityBuilder()
+ .setNFlag(Boolean.FALSE).setXFlag(Boolean.FALSE).setMsd(Uint8.ZERO).build()).build()).build();
@Test
public void testSegmentRoutingCapability() {
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.SidType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.add.lsp.input.arguments.ero.subobject.subobject.type.SrEroTypeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.subobject.nai.IpAdjacencyBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.subobject.nai.IpNodeIdBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.subobject.nai.UnnumberedAdjacencyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.NaiType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.add.lsp.input.arguments.ero.subobject.subobject.type.SrEroTypeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.IpAdjacencyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.IpNodeIdBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.UnnumberedAdjacencyBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.SubobjectBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
public class SrEroSubobjectParserTest {
private static final byte[] SR_ERO_SUBOBJECT_WITH_IPV4_NODEID = {
- 0x05,0x0c,(byte) 0x10,0x00,
+ 0x24,0x0c,(byte) 0x10,0x00,
0x00,0x01,(byte) 0xe2,0x40,
0x4A,0x7D,0x2b,0x63,
};
private static final byte[] SR_ERO_SUBOBJECT_WITH_IPV6_NODEID = {
- 0x05,0x18,(byte) 0x20,0x00,
+ 0x24,0x18,(byte) 0x20,0x00,
0x00,0x01,(byte) 0xe2,0x40,
(byte) 0xFE,(byte) 0x80,(byte) 0xCD,0x00,
0x00,0x00,0x00,0x00,
};
private static final byte[] SR_ERO_SUBOBJECT_WITH_IPV4_ADJ = {
- 0x05,0x10,(byte) 0x30,0x00,
+ 0x24,0x10,(byte) 0x30,0x00,
0x00,0x01,(byte) 0xe2,0x40,
0x4A,0x7D,0x2b,0x63,
0x4A,0x7D,0x2b,0x64,
};
private static final byte[] SR_ERO_SUBOBJECT_WITH_IPV6_ADJ = {
- 0x05,0x28,(byte) 0x40,0x00,
+ 0x24,0x28,(byte) 0x40,0x00,
0x00,0x01,(byte) 0xe2,0x40,
(byte) 0xFE,(byte) 0x80,(byte) 0xCD,0x00,
0x00,0x00,0x00,0x00,
};
private static final byte[] SR_ERO_SUBOBJECT_WITH_UNNUMBERED = {
- 0x05,0x18,(byte) 0x50,0x00,
+ 0x24,0x18,(byte) 0x50,0x00,
0x00,0x01,(byte) 0xe2,0x40,
0x00,0x00,0x00,0x01,
0x00,0x00,0x00,0x02,
};
private static final byte[] SR_ERO_SUBOBJECT_WITHOUT_NAI = {
- 0x05,0x08,(byte) 0x10,0x08,
+ 0x24,0x08,(byte) 0x10,0x08,
0x00,0x01,(byte) 0xe2,0x40
};
private static final byte[] SR_ERO_SUBOBJECT_WITHOUT_SID = {
- 0x05,0x08,(byte) 0x10,0x04,
+ 0x24,0x08,(byte) 0x10,0x04,
0x4A,0x7D,0x2b,0x63,
};
private static final byte[] SR_ERO_SUBOBJECT_WITH_IPV4_NODEID_MFLAG = {
- 0x05,0x0c,(byte) 0x10,0x01,
+ 0x24,0x0c,(byte) 0x10,0x01,
0x07,0x5B,(byte) 0xCD,0x15,
0x4A,0x7D,0x2b,0x63,
};
private static final byte[] SR_ERO_SUBOBJECT_WITH_IPV4_NODEID_MFLAG_AFTER = {
- 0x05,0x0c,(byte) 0x10,0x01,
+ 0x24,0x0c,(byte) 0x10,0x01,
0x07,0x5B,(byte) 0xC0,0x00,
0x4A,0x7D,0x2b,0x63,
};
this.ctx = new SimplePCEPExtensionProviderContext();
this.act = new SegmentRoutingActivator();
this.act.start(this.ctx);
- final boolean isIanaAssignedType = false;
- this.parser = new SrEroSubobjectParser(isIanaAssignedType);
+ this.parser = new SrEroSubobjectParser();
}
@Test
public void testSrEroSubobjectIpv4NodeIdNAI() throws PCEPDeserializerException {
final SrEroTypeBuilder builder = new SrEroTypeBuilder()
- .setSidType(SidType.Ipv4NodeId)
+ .setNaiType(NaiType.Ipv4NodeId)
.setSid(Uint32.valueOf(123456))
.setCFlag(false)
.setMFlag(false)
@Test
public void testSrEroSubobjectIpv6NodeIdNAI() throws PCEPDeserializerException {
final SrEroTypeBuilder builder = new SrEroTypeBuilder()
- .setSidType(SidType.Ipv6NodeId)
+ .setNaiType(NaiType.Ipv6NodeId)
.setSid(Uint32.valueOf(123456))
.setCFlag(false)
.setMFlag(false)
@Test
public void testSrEroSubobjectIpv4AdjacencyNAI() throws PCEPDeserializerException {
final SrEroTypeBuilder builder = new SrEroTypeBuilder()
- .setSidType(SidType.Ipv4Adjacency)
+ .setNaiType(NaiType.Ipv4Adjacency)
.setSid(Uint32.valueOf(123456))
.setCFlag(false)
.setMFlag(false)
@Test
public void testSrEroSubobjectIpv6AdjacencyNAI() throws PCEPDeserializerException {
final SrEroTypeBuilder builder = new SrEroTypeBuilder()
- .setSidType(SidType.Ipv6Adjacency)
+ .setNaiType(NaiType.Ipv6Adjacency)
.setSid(Uint32.valueOf(123456))
.setCFlag(false)
.setMFlag(false)
@Test
public void testSrEroSubobjectUnnumberedNAI() throws PCEPDeserializerException {
final SrEroTypeBuilder builder = new SrEroTypeBuilder()
- .setSidType(SidType.Unnumbered)
+ .setNaiType(NaiType.Unnumbered)
.setSid(Uint32.valueOf(123456))
.setCFlag(false)
.setMFlag(false)
@Test
public void testSrEroSubobjectWithoutNAI() throws PCEPDeserializerException {
final SrEroTypeBuilder builder = new SrEroTypeBuilder()
- .setSidType(SidType.Ipv4NodeId)
+ .setNaiType(NaiType.Ipv4NodeId)
.setSid(Uint32.valueOf(123456))
.setCFlag(false)
.setMFlag(false);
@Test
public void testSrEroSubobjectWithoutBody() throws PCEPDeserializerException {
final SrEroTypeBuilder builder = new SrEroTypeBuilder()
- .setSidType(SidType.Ipv4NodeId)
+ .setNaiType(NaiType.Ipv4NodeId)
.setCFlag(false)
.setMFlag(false)
.setNai(new IpNodeIdBuilder().setIpAddress(new IpAddressNoZone(
final SrEroTypeBuilder builder = new SrEroTypeBuilder()
.setCFlag(false)
.setMFlag(true)
- .setSidType(SidType.Ipv4NodeId)
+ .setNaiType(NaiType.Ipv4NodeId)
.setSid(Uint32.valueOf(30140))
.setNai(new IpNodeIdBuilder().setIpAddress(new IpAddressNoZone(new Ipv4AddressNoZone("74.125.43.99")))
.build());
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.sync.optimizations.rev200720.Tlvs3Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.SidType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.Tlvs1Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.add.lsp.input.arguments.ero.subobject.subobject.type.SrEroTypeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.pce.capability.tlv.SrPceCapabilityBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.subobject.nai.IpNodeIdBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.NaiType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.Tlvs1Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.add.lsp.input.arguments.ero.subobject.subobject.type.SrEroTypeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.pce.capability.tlv.SrPceCapabilityBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.IpNodeIdBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ProtocolVersion;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.EroBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.Subobject;
0x20,0x1e,0x78,0x01,
/* sr-capability-tlv */
0x00,0x1a,0x00,0x04,
- 0x00,0x00,0x00,0x01};
+ 0x00,0x00,0x03,0x01};
private static final byte[] SR_ERO_OBJECT_BYTES = {
0x07,0x10,0x00,0x10,
/* ero-subobject */
- 0x05,0x0c,(byte) 0x10,0x00,
+ 0x24,0x0c,(byte) 0x10,0x00,
0x00,0x01,(byte)0xe2,0x40,
0x4A,0x7D,0x2b,0x63,
};
.addAugmentation(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful
.rev200720.Tlvs1Builder().build())
.addAugmentation(new Tlvs1Builder()
- .setSrPceCapability(new SrPceCapabilityBuilder().setMsd(Uint8.ONE).build())
+ .setSrPceCapability(new SrPceCapabilityBuilder().setNFlag(Boolean.TRUE).setXFlag(Boolean.TRUE)
+ .setMsd(Uint8.ONE).build())
.build())
.addAugmentation(new Tlvs3Builder().build()).build());
final SrEroTypeBuilder srEroSubBuilder = new SrEroTypeBuilder()
.setCFlag(false)
.setMFlag(false)
- .setSidType(SidType.Ipv4NodeId)
+ .setNaiType(NaiType.Ipv4NodeId)
.setSid(Uint32.valueOf(123456))
.setNai(new IpNodeIdBuilder().setIpAddress(new IpAddressNoZone(
new Ipv4AddressNoZone("74.125.43.99"))).build());
builder.setProcessingRule(false);
builder.setIgnore(false);
- final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.update.lsp
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.update.lsp
.input.arguments.ero.subobject.subobject.type.SrEroTypeBuilder srEroSubBuilder =
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720
.update.lsp.input.arguments.ero.subobject.subobject.type.SrEroTypeBuilder()
.setCFlag(false)
.setMFlag(false)
- .setSidType(SidType.Ipv4NodeId)
+ .setNaiType(NaiType.Ipv4NodeId)
.setSid(Uint32.valueOf(123456))
.setNai(new IpNodeIdBuilder().setIpAddress(new IpAddressNoZone(
new Ipv4AddressNoZone("74.125.43.99"))).build());
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.SidType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.add.lsp.input.arguments.rro.subobject.subobject.type.SrRroTypeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.subobject.nai.IpAdjacencyBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.subobject.nai.IpNodeIdBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.subobject.nai.UnnumberedAdjacencyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.NaiType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.add.lsp.input.arguments.rro.subobject.subobject.type.SrRroTypeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.IpAdjacencyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.IpNodeIdBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.UnnumberedAdjacencyBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.reported.route.object.rro.SubobjectBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
public class SrRroSubobjectParserTest {
private static final byte[] SR_RRO_SUBOBJECT_WITH_IPV4_NODEID = {
- 0x06,0x0c,(byte) 0x10,0x00,
+ 0x24,0x0c,(byte) 0x10,0x00,
0x00,0x01,(byte) 0xe2,0x40,
0x4A,0x7D,0x2b,0x63,
};
private static final byte[] SR_RROR_SUBOBJECT_WITH_IPV6_NODEID = {
- 0x06,0x18,(byte) 0x20,0x00,
+ 0x24,0x18,(byte) 0x20,0x00,
0x00,0x01,(byte) 0xe2,0x40,
(byte) 0xFE,(byte) 0x80,(byte) 0xCD,0x00,
0x00,0x00,0x00,0x00,
};
private static final byte[] SR_RRO_SUBOBJECT_WITH_IPV4_ADJ = {
- 0x06,0x10,(byte) 0x30,0x00,
+ 0x24,0x10,(byte) 0x30,0x00,
0x00,0x01,(byte) 0xe2,0x40,
0x4A,0x7D,0x2b,0x63,
0x4A,0x7D,0x2b,0x64,
};
private static final byte[] SR_RRO_SUBOBJECT_WITH_IPV6_ADJ = {
- 0x06,0x28,(byte) 0x40,0x00,
+ 0x24,0x28,(byte) 0x40,0x00,
0x00,0x01,(byte) 0xe2,0x40,
(byte) 0xFE,(byte) 0x80,(byte) 0xCD,0x00,
0x00,0x00,0x00,0x00,
};
private static final byte[] SR_RRO_SUBOBJECT_WIT_UNNUMBERED = {
- 0x06,0x18,(byte) 0x50,0x00,
+ 0x24,0x18,(byte) 0x50,0x00,
0x00,0x01,(byte) 0xe2,0x40,
0x00,0x00,0x00,0x01,
0x00,0x00,0x00,0x02,
};
private static final byte[] SR_RRO_SUBOBJECT_WITHOUT_NAI = {
- 0x06,0x08, (byte) 0x10,0xb,
+ 0x24,0x08, (byte) 0x10,0xb,
0x1e,0x24,(byte)-32, 0x00,
};
private static final byte[] SR_RRO_SUBOBJECT_WITHOUT_SID = {
- 0x06,0x08,(byte) 0x10,0x04,
+ 0x24,0x08,(byte) 0x10,0x04,
0x4A,0x7D,0x2b,0x63,
};
private SimplePCEPExtensionProviderContext ctx;
private SegmentRoutingActivator act;
- private boolean isIanaAssignedType;
private SrRroSubobjectParser parser;
@Before
this.ctx = new SimplePCEPExtensionProviderContext();
this.act = new SegmentRoutingActivator();
this.act.start(this.ctx);
- this.isIanaAssignedType = false;
- this.parser = new SrRroSubobjectParser(this.isIanaAssignedType);
+ this.parser = new SrRroSubobjectParser();
}
@Test
public void testSrRroSubobjectIpv4NodeIdNAI() throws PCEPDeserializerException {
final SrRroTypeBuilder builder = new SrRroTypeBuilder()
- .setSidType(SidType.Ipv4NodeId)
+ .setNaiType(NaiType.Ipv4NodeId)
.setSid(Uint32.valueOf(123456))
.setCFlag(false)
.setMFlag(false)
@Test
public void testSrRroSubobjectIpv6NodeIdNAI() throws PCEPDeserializerException {
final SrRroTypeBuilder builder = new SrRroTypeBuilder()
- .setSidType(SidType.Ipv6NodeId)
+ .setNaiType(NaiType.Ipv6NodeId)
.setCFlag(false)
.setMFlag(false)
.setSid(Uint32.valueOf(123456))
@Test
public void testSrRroSubobjectIpv4AdjacencyNAI() throws PCEPDeserializerException {
final SrRroTypeBuilder builder = new SrRroTypeBuilder()
- .setSidType(SidType.Ipv4Adjacency)
+ .setNaiType(NaiType.Ipv4Adjacency)
.setSid(Uint32.valueOf(123456))
.setCFlag(false)
.setMFlag(false)
@Test
public void testSrRroSubobjectIpv6AdjacencyNAI() throws PCEPDeserializerException {
final SrRroTypeBuilder builder = new SrRroTypeBuilder()
- .setSidType(SidType.Ipv6Adjacency)
+ .setNaiType(NaiType.Ipv6Adjacency)
.setSid(Uint32.valueOf(123456))
.setCFlag(false)
.setMFlag(false)
@Test
public void testSrRroSubobjectUnnumberedNAI() throws PCEPDeserializerException {
final SrRroTypeBuilder builder = new SrRroTypeBuilder()
- .setSidType(SidType.Unnumbered)
+ .setNaiType(NaiType.Unnumbered)
.setSid(Uint32.valueOf(123456))
.setCFlag(false)
.setMFlag(false)
@Test
public void testSrRroSubobjectWithoutNAI() throws PCEPDeserializerException {
final SrRroTypeBuilder builder = new SrRroTypeBuilder()
- .setSidType(SidType.Ipv4NodeId)
+ .setNaiType(NaiType.Ipv4NodeId)
.setSid(Uint32.valueOf(123470))
.setCFlag(true)
.setMFlag(true);
@Test
public void testSrRroSubobjectWithoutBody() throws PCEPDeserializerException {
final SrRroTypeBuilder builder = new SrRroTypeBuilder()
- .setSidType(SidType.Ipv4NodeId)
+ .setNaiType(NaiType.Ipv4NodeId)
.setCFlag(false)
.setMFlag(false)
.setNai(new IpNodeIdBuilder().setIpAddress(new IpAddressNoZone(new Ipv4AddressNoZone("74.125.43.99")))
import org.junit.Test;
import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.util.ByteArray;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.pce.capability.tlv.SrPceCapability;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.pce.capability.tlv.SrPceCapabilityBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.pce.capability.tlv.SrPceCapability;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.pce.capability.tlv.SrPceCapabilityBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.path.setup.type.tlv.PathSetupType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.path.setup.type.tlv.PathSetupTypeBuilder;
import org.opendaylight.yangtools.yang.common.Uint8;
public class SrTlvParserTest {
- private static final byte[] SPC_TLV_BYTES = { 0x0, 0x1a, 0x0, 0x4, 0x0, 0x0, 0x0, 0x1 };
+ private static final byte[] SPC_TLV_BYTES = { 0x0, 0x1a, 0x0, 0x4, 0x0, 0x0, 0x3, 0x1 };
private static final byte[] SR_TE_PST_BYTES = { 0x0, 0x1C, 0x0, 0x4, 0x0, 0x0, 0x0, 0x1 };
@Test
public void testSrPceCapabilityParser() throws PCEPDeserializerException {
final SrPceCapabilityTlvParser parser = new SrPceCapabilityTlvParser();
- final SrPceCapability spcTlv = new SrPceCapabilityBuilder().setMsd(Uint8.ONE).build();
+ final SrPceCapability spcTlv = new SrPceCapabilityBuilder().setNFlag(Boolean.TRUE).setXFlag(Boolean.TRUE)
+ .setMsd(Uint8.ONE).build();
assertEquals(spcTlv, parser.parseTlv(Unpooled.wrappedBuffer(ByteArray.cutBytes(SPC_TLV_BYTES, 4))));
final ByteBuf buff = Unpooled.buffer();
parser.serializeTlv(spcTlv, buff);
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcrpt.message.pcrpt.message.reports.PathBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.srp.object.SrpBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.symbolic.path.name.tlv.SymbolicPathNameBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.SidType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.network.topology.topology.node.path.computation.client.reported.lsp.path.ero.subobject.subobject.type.SrEroType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.pcrpt.pcrpt.message.reports.path.ero.subobject.subobject.type.SrEroTypeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.subobject.nai.IpNodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.subobject.nai.IpNodeIdBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.NaiType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.network.topology.topology.node.path.computation.client.reported.lsp.path.ero.subobject.subobject.type.SrEroType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.pcrpt.pcrpt.message.reports.path.ero.subobject.subobject.type.SrEroTypeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.IpNodeId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.IpNodeIdBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.Ero;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.EroBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.Subobject;
final SrEroTypeBuilder srEroBuilder = new SrEroTypeBuilder()
.setCFlag(false)
.setMFlag(false)
- .setSidType(SidType.Ipv4NodeId)
+ .setNaiType(NaiType.Ipv4NodeId)
.setSid(Uint32.valueOf(123456))
.setNai(new IpNodeIdBuilder().setIpAddress(new IpAddressNoZone(new Ipv4AddressNoZone(nai)))
.build());
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.PcerrBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Pcrep;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.PcrepBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.SidType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.pcrep.pcrep.message.replies.result.success._case.success.paths.ero.subobject.subobject.type.SrEroType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.pcrep.pcrep.message.replies.result.success._case.success.paths.ero.subobject.subobject.type.SrEroTypeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev181109.sr.subobject.nai.IpAdjacencyBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.NaiType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.pcrep.pcrep.message.replies.result.success._case.success.paths.ero.subobject.subobject.type.SrEroType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.pcrep.pcrep.message.replies.result.success._case.success.paths.ero.subobject.subobject.type.SrEroTypeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.subobject.nai.IpAdjacencyBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.NoPathVectorTlv.Flags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.RequestId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.bandwidth.object.BandwidthBuilder;
SrEroType srEro = null;
if ((path.getLocalIpv4() != null) && (path.getRemoteIpv4() != null)) {
srEro = new SrEroTypeBuilder()
- .setSidType(SidType.Ipv4Adjacency)
+ .setNaiType(NaiType.Ipv4Adjacency)
.setSid(path.getSid())
.setCFlag(false)
.setMFlag(true)
}
if ((path.getLocalIpv6() != null) && (path.getRemoteIpv6() != null)) {
srEro = new SrEroTypeBuilder()
- .setSidType(SidType.Ipv6Adjacency)
+ .setNaiType(NaiType.Ipv6Adjacency)
.setSid(path.getSid())
.setCFlag(false)
.setMFlag(true)