Search in sources :

Example 1 with SidCaseBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.sid.label.index.sid.label.index.SidCaseBuilder in project bgpcep by opendaylight.

the class SrAttributeParserTest method addSubTlvs.

private static void addSubTlvs(final List<SubTlvs> rangeSubTlvs) {
    rangeSubTlvs.add(new SubTlvsBuilder().setRangeSubTlv(new SidLabelTlvCaseBuilder().setSidLabelIndex(new SidCaseBuilder().setSid(Uint32.valueOf(16909060L)).build()).build()).build());
    rangeSubTlvs.add(new SubTlvsBuilder().setRangeSubTlv(new PrefixSidTlvCaseBuilder().setPrefixSidTlv(new PrefixSidTlvBuilder().setFlags(ISIS_PREFIX_FLAGS).setAlgorithm(Algorithm.StrictShortestPathFirst).setSidLabelIndex(new LocalLabelCaseBuilder().setLocalLabel(new MplsLabel(Uint32.valueOf(66048))).build()).build()).build()).build());
    final List<BindingSubTlvs> bindingSubTlvs = new ArrayList<>();
    addBindingSubTlvs(bindingSubTlvs);
    rangeSubTlvs.add(new SubTlvsBuilder().setRangeSubTlv(new BindingSidTlvCaseBuilder().setWeight(new Weight(Uint8.valueOf(5))).setFlags(BINDING_FLAGS).setBindingSubTlvs(bindingSubTlvs).build()).build());
}
Also used : PrefixSidTlvBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.range.sub.tlvs.range.sub.tlv.prefix.sid.tlv._case.PrefixSidTlvBuilder) BindingSubTlvsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sid.tlv.BindingSubTlvsBuilder) SubTlvsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.range.tlv.SubTlvsBuilder) LocalLabelCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.sid.label.index.sid.label.index.LocalLabelCaseBuilder) SidCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.sid.label.index.sid.label.index.SidCaseBuilder) PrefixSidCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sub.tlvs.binding.sub.tlv.PrefixSidCaseBuilder) ArrayList(java.util.ArrayList) PrefixSidTlvCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.range.sub.tlvs.range.sub.tlv.PrefixSidTlvCaseBuilder) MplsLabel(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.MplsLabel) SidLabelTlvCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.range.sub.tlvs.range.sub.tlv.SidLabelTlvCaseBuilder) Weight(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.Weight) BindingSubTlvs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sid.tlv.BindingSubTlvs) BindingSidTlvCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.range.sub.tlvs.range.sub.tlv.BindingSidTlvCaseBuilder)

Example 2 with SidCaseBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.sid.label.index.sid.label.index.SidCaseBuilder in project bgpcep by opendaylight.

the class SrAttributeParserTest method testSrCapabilities.

// tools.ietf.org/html/draft-gredler-idr-bgp-ls-segment-routing-ext-00#section-2.1.1
@Test
public void testSrCapabilities() {
    final byte[] bytesIsis = { (byte) 0xC0, 0, 0, 0, 10, 4, (byte) 0x89, 0, 4, 1, 2, 3, 4 };
    final byte[] bytesOspf = { 0, 0, 0, 0, 10, 4, (byte) 0x89, 0, 4, 1, 2, 3, 4 };
    final SrCapabilities capsIsis = new SrCapabilitiesBuilder().setMplsIpv4(Boolean.TRUE).setMplsIpv6(Boolean.TRUE).setSrIpv6(Boolean.FALSE).setSidLabelIndex(new SidCaseBuilder().setSid(Uint32.valueOf(16909060L)).build()).setRangeSize(new Uint24(Uint32.TEN)).build();
    final SrCapabilities capsOspf = new SrCapabilitiesBuilder().setMplsIpv4(Boolean.FALSE).setMplsIpv6(Boolean.FALSE).setSrIpv6(Boolean.FALSE).setSidLabelIndex(new SidCaseBuilder().setSid(Uint32.valueOf(16909060L)).build()).setRangeSize(new Uint24(Uint32.TEN)).build();
    assertEquals(capsIsis, SrNodeAttributesParser.parseSrCapabilities(Unpooled.wrappedBuffer(bytesIsis), ProtocolId.IsisLevel1));
    assertEquals(capsOspf, SrNodeAttributesParser.parseSrCapabilities(Unpooled.wrappedBuffer(bytesIsis), ProtocolId.Ospf));
    final ByteBuf encodedIsis = Unpooled.buffer();
    final ByteBuf encodedOspf = Unpooled.buffer();
    SrNodeAttributesParser.serializeSrCapabilities(capsIsis, encodedIsis);
    SrNodeAttributesParser.serializeSrCapabilities(capsOspf, encodedOspf);
    assertArrayEquals(bytesIsis, ByteArray.readAllBytes(encodedIsis));
    assertArrayEquals(bytesOspf, ByteArray.readAllBytes(encodedOspf));
}
Also used : SrCapabilities(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.node.state.SrCapabilities) SidCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.sid.label.index.sid.label.index.SidCaseBuilder) PrefixSidCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sub.tlvs.binding.sub.tlv.PrefixSidCaseBuilder) Uint24(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.types.rev171204.Uint24) ByteBuf(io.netty.buffer.ByteBuf) SrCapabilitiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.node.state.SrCapabilitiesBuilder) Test(org.junit.Test)

Example 3 with SidCaseBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.sid.label.index.sid.label.index.SidCaseBuilder in project bgpcep by opendaylight.

the class SrAttributeParserTest method testSrPrefix.

// tools.ietf.org/html/draft-gredler-idr-bgp-ls-segment-routing-ext-00#section-2.3.1
@Test
public void testSrPrefix() {
    final byte[] bytes = { (byte) 0xA0, 0, 0, 0, 1, 2, 3, 4 };
    final byte[] bytesOspf = { (byte) 0x20, 0, 0, 0, 1, 2, 3, 4 };
    final SrPrefix prefixIsis = new SrPrefixBuilder().setFlags(ISIS_PREFIX_FLAGS).setAlgorithm(Algorithm.ShortestPathFirst).setSidLabelIndex(new SidCaseBuilder().setSid(Uint32.valueOf(16909060L)).build()).build();
    final SrPrefix prefixOspf = new SrPrefixBuilder().setFlags(OSPF_PREFIX_FLAGS).setAlgorithm(Algorithm.ShortestPathFirst).setSidLabelIndex(new SidCaseBuilder().setSid(Uint32.valueOf(16909060L)).build()).build();
    assertEquals(prefixIsis, SrPrefixAttributesParser.parseSrPrefix(Unpooled.wrappedBuffer(bytes), ProtocolId.IsisLevel1));
    assertEquals(prefixOspf, SrPrefixAttributesParser.parseSrPrefix(Unpooled.wrappedBuffer(bytes), ProtocolId.Ospf));
    final ByteBuf serializedPrefix = Unpooled.buffer();
    final ByteBuf serializedPrefixOspf = Unpooled.buffer();
    SrPrefixAttributesParser.serializeSrPrefix(prefixIsis, serializedPrefix);
    SrPrefixAttributesParser.serializeSrPrefix(prefixOspf, serializedPrefixOspf);
    assertArrayEquals(bytes, ByteArray.readAllBytes(serializedPrefix));
    assertArrayEquals(bytesOspf, ByteArray.readAllBytes(serializedPrefixOspf));
}
Also used : SrPrefix(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.prefix.state.SrPrefix) Ipv6SrPrefix(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.prefix.state.Ipv6SrPrefix) SrPrefixBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.prefix.state.SrPrefixBuilder) Ipv6SrPrefixBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.prefix.state.Ipv6SrPrefixBuilder) SidCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.sid.label.index.sid.label.index.SidCaseBuilder) PrefixSidCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sub.tlvs.binding.sub.tlv.PrefixSidCaseBuilder) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 4 with SidCaseBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.sid.label.index.sid.label.index.SidCaseBuilder in project bgpcep by opendaylight.

the class SrAttributeParserTest method addBindingSubTlvs.

private static void addBindingSubTlvs(final List<BindingSubTlvs> bindingSubTlvs) {
    bindingSubTlvs.add(new BindingSubTlvsBuilder().setBindingSubTlv(new PrefixSidCaseBuilder().setPrefixSid(new PrefixSidBuilder().setFlags(ISIS_PREFIX_FLAGS).setAlgorithm(Algorithm.StrictShortestPathFirst).setSidLabelIndex(new SidCaseBuilder().setSid(Uint32.valueOf(16909060L)).build()).build()).build()).build());
    bindingSubTlvs.add(new BindingSubTlvsBuilder().setBindingSubTlv(new SidLabelCaseBuilder().setSidLabelIndex(new SidCaseBuilder().setSid(Uint32.valueOf(16909060L)).build()).build()).build());
    bindingSubTlvs.add(new BindingSubTlvsBuilder().setBindingSubTlv(new EroMetricCaseBuilder().setEroMetric(new TeMetric(Uint32.valueOf(6))).build()).build());
    bindingSubTlvs.add(new BindingSubTlvsBuilder().setBindingSubTlv(new Ipv4EroCaseBuilder().setIpv4Ero(new Ipv4EroBuilder().setLoose(Boolean.FALSE).setAddress(new Ipv4AddressNoZone("9.8.7.6")).build()).build()).build());
    bindingSubTlvs.add(new BindingSubTlvsBuilder().setBindingSubTlv(new UnnumberedInterfaceIdEroCaseBuilder().setUnnumberedInterfaceIdEro(new UnnumberedInterfaceIdEroBuilder().setLoose(Boolean.FALSE).setRouterId(Uint32.valueOf(16843009L)).setInterfaceId(Uint32.valueOf(33686018L)).build()).build()).build());
    bindingSubTlvs.add(new BindingSubTlvsBuilder().setBindingSubTlv(new Ipv4EroBackupCaseBuilder().setIpv4EroBackup(new Ipv4EroBackupBuilder().setLoose(Boolean.FALSE).setAddress(new Ipv4AddressNoZone("3.4.5.6")).build()).build()).build());
    bindingSubTlvs.add(new BindingSubTlvsBuilder().setBindingSubTlv(new UnnumberedInterfaceIdBackupEroCaseBuilder().setUnnumberedInterfaceIdBackupEro(new UnnumberedInterfaceIdBackupEroBuilder().setLoose(Boolean.FALSE).setRouterId(Uint32.valueOf(50529027L)).setInterfaceId(Uint32.valueOf(67372036L)).build()).build()).build());
}
Also used : TeMetric(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.TeMetric) Ipv4AddressNoZone(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone) PrefixSidCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sub.tlvs.binding.sub.tlv.PrefixSidCaseBuilder) UnnumberedInterfaceIdEroBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sub.tlvs.binding.sub.tlv.unnumbered._interface.id.ero._case.UnnumberedInterfaceIdEroBuilder) UnnumberedInterfaceIdBackupEroBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sub.tlvs.binding.sub.tlv.unnumbered._interface.id.backup.ero._case.UnnumberedInterfaceIdBackupEroBuilder) SidLabelCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sub.tlvs.binding.sub.tlv.SidLabelCaseBuilder) BindingSubTlvsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sid.tlv.BindingSubTlvsBuilder) Ipv4EroCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sub.tlvs.binding.sub.tlv.Ipv4EroCaseBuilder) UnnumberedInterfaceIdEroCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sub.tlvs.binding.sub.tlv.UnnumberedInterfaceIdEroCaseBuilder) Ipv4EroBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sub.tlvs.binding.sub.tlv.ipv4.ero._case.Ipv4EroBuilder) UnnumberedInterfaceIdBackupEroCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sub.tlvs.binding.sub.tlv.UnnumberedInterfaceIdBackupEroCaseBuilder) SidCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.sid.label.index.sid.label.index.SidCaseBuilder) PrefixSidCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sub.tlvs.binding.sub.tlv.PrefixSidCaseBuilder) EroMetricCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sub.tlvs.binding.sub.tlv.EroMetricCaseBuilder) PrefixSidBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sub.tlvs.binding.sub.tlv.prefix.sid._case.PrefixSidBuilder) Ipv4EroBackupCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sub.tlvs.binding.sub.tlv.Ipv4EroBackupCaseBuilder) Ipv4EroBackupBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sub.tlvs.binding.sub.tlv.ipv4.ero.backup._case.Ipv4EroBackupBuilder)

Aggregations

PrefixSidCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sub.tlvs.binding.sub.tlv.PrefixSidCaseBuilder)4 SidCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.sid.label.index.sid.label.index.SidCaseBuilder)4 ByteBuf (io.netty.buffer.ByteBuf)2 Test (org.junit.Test)2 BindingSubTlvsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sid.tlv.BindingSubTlvsBuilder)2 ArrayList (java.util.ArrayList)1 Ipv4AddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone)1 Uint24 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.types.rev171204.Uint24)1 SrCapabilities (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.node.state.SrCapabilities)1 SrCapabilitiesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.node.state.SrCapabilitiesBuilder)1 Ipv6SrPrefix (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.prefix.state.Ipv6SrPrefix)1 Ipv6SrPrefixBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.prefix.state.Ipv6SrPrefixBuilder)1 SrPrefix (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.prefix.state.SrPrefix)1 SrPrefixBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.prefix.state.SrPrefixBuilder)1 Weight (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.Weight)1 BindingSubTlvs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sid.tlv.BindingSubTlvs)1 EroMetricCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sub.tlvs.binding.sub.tlv.EroMetricCaseBuilder)1 Ipv4EroBackupCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sub.tlvs.binding.sub.tlv.Ipv4EroBackupCaseBuilder)1 Ipv4EroCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sub.tlvs.binding.sub.tlv.Ipv4EroCaseBuilder)1 SidLabelCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.segment.routing.ext.rev200120.binding.sub.tlvs.binding.sub.tlv.SidLabelCaseBuilder)1