use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Srp1Builder in project bgpcep by opendaylight.
the class PCEPObjectParserTest method testSRPObjectWithPSTTlv.
@Test
public void testSRPObjectWithPSTTlv() throws PCEPDeserializerException {
final byte[] srpObjectWithPstTlvBytes = { 0x21, 0x10, 0x00, 0x14, 0x0, 0x0, 0x0, 0x01, 0x0, 0x0, 0x0, 0x01, /* pst-tlv */
0x0, 0x1C, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0 };
final CInitiated00SrpObjectParser parser = new CInitiated00SrpObjectParser(this.tlvRegistry, this.viTlvRegistry);
final SrpBuilder builder = new SrpBuilder();
builder.setProcessingRule(false);
builder.setIgnore(false);
builder.setOperationId(new SrpIdNumber(1L));
builder.addAugmentation(Srp1.class, new Srp1Builder().setRemove(true).build());
builder.setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.srp.TlvsBuilder().setPathSetupType(new PathSetupTypeBuilder().setPst((short) 0).build()).build());
final ByteBuf result = Unpooled.wrappedBuffer(srpObjectWithPstTlvBytes);
assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
final ByteBuf buf = Unpooled.buffer();
parser.serializeObject(builder.build(), buf);
assertArrayEquals(srpObjectWithPstTlvBytes, ByteArray.getAllBytes(buf));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Srp1Builder in project bgpcep by opendaylight.
the class CInitiated00SrpObjectParser method parseFlags.
@Override
protected void parseFlags(final SrpBuilder builder, final ByteBuf bytes) {
final BitArray flags = BitArray.valueOf(bytes, FLAGS_SIZE);
builder.addAugmentation(Srp1.class, new Srp1Builder().setRemove(flags.get(REMOVE_FLAG)).build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Srp1Builder in project bgpcep by opendaylight.
the class PCCTunnelManagerImplTest method createRequests.
private static Requests createRequests(final long plspId, final Optional<Boolean> remove, final Optional<Boolean> delegate) {
final RequestsBuilder reqBuilder = new RequestsBuilder();
reqBuilder.setEro(ERO);
final LspBuilder lsp = new LspBuilder().setTlvs(new TlvsBuilder().setSymbolicPathName(new SymbolicPathNameBuilder().setPathName(new SymbolicPathName(SYMBOLIC_NAME)).build()).build()).setPlspId(new PlspId(plspId));
if (delegate.isPresent()) {
lsp.setDelegate(Boolean.TRUE);
}
reqBuilder.setLsp(lsp.build());
final SrpBuilder srpBuilder = new SrpBuilder();
if (remove.isPresent()) {
srpBuilder.addAugmentation(Srp1.class, new Srp1Builder().setRemove(Boolean.TRUE).build());
}
reqBuilder.setSrp(srpBuilder.setOperationId(new SrpIdNumber(0L)).build());
return reqBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Srp1Builder in project bgpcep by opendaylight.
the class PCEPObjectParserTest method testSrpObject.
@Test
public void testSrpObject() throws IOException, PCEPDeserializerException {
final CInitiated00SrpObjectParser parser = new CInitiated00SrpObjectParser(this.tlvRegistry, this.viTlvRegistry);
final ByteBuf result = Unpooled.wrappedBuffer(new byte[] { (byte) 0x21, (byte) 0x10, (byte) 0x00, (byte) 0x0c, 0, 0, 0, (byte) 0x01, 0, 0, 0, (byte) 0x01 });
final SrpBuilder builder = new SrpBuilder();
builder.setProcessingRule(false);
builder.setIgnore(false);
builder.setOperationId(new SrpIdNumber(1L));
builder.addAugmentation(Srp1.class, new Srp1Builder().setRemove(true).build());
builder.setTlvs(new TlvsBuilder().build());
assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
final ByteBuf buf = Unpooled.buffer();
parser.serializeObject(builder.build(), buf);
assertArrayEquals(result.array(), ByteArray.getAllBytes(buf));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.crabbe.initiated.rev171025.Srp1Builder in project bgpcep by opendaylight.
the class PCEPValidatorTest method setUp.
@Before
public void setUp() throws Exception {
this.ctx = new SimplePCEPExtensionProviderContext();
this.act = new BaseParserExtensionActivator();
this.act.start(this.ctx);
final LspaBuilder lspaBuilder = new LspaBuilder();
lspaBuilder.setProcessingRule(false);
lspaBuilder.setIgnore(false);
lspaBuilder.setLocalProtectionDesired(false);
lspaBuilder.setHoldPriority((short) 0);
lspaBuilder.setSetupPriority((short) 0);
lspaBuilder.setExcludeAny(new AttributeFilter(0L));
lspaBuilder.setIncludeAll(new AttributeFilter(0L));
lspaBuilder.setIncludeAny(new AttributeFilter(0L));
lspaBuilder.setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lspa.object.lspa.TlvsBuilder().build());
this.lspa = lspaBuilder.build();
final MetricBuilder mBuilder = new MetricBuilder();
mBuilder.setIgnore(false);
mBuilder.setProcessingRule(false);
mBuilder.setComputed(false);
mBuilder.setBound(false);
mBuilder.setMetricType((short) 1);
mBuilder.setValue(new Float32(new byte[4]));
this.metrics = new MetricsBuilder().setMetric(mBuilder.build()).build();
this.eroASSubobject = new AsNumberCaseBuilder().setAsNumber(new AsNumberBuilder().setAsNumber(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber(0xFFFFL)).build()).build();
this.rroUnnumberedSub = new UnnumberedCaseBuilder().setUnnumbered(new UnnumberedBuilder().setRouterId(0x00112233L).setInterfaceId(0x00ff00ffL).build()).build();
final IroBuilder iroBuilder = new IroBuilder();
iroBuilder.setIgnore(false);
iroBuilder.setProcessingRule(false);
final List<Subobject> iroSubs = Lists.newArrayList();
iroSubs.add(new SubobjectBuilder().setSubobjectType(this.eroASSubobject).setLoose(false).build());
iroBuilder.setSubobject(iroSubs);
this.iro = iroBuilder.build();
final EroBuilder eroBuilder = new EroBuilder();
eroBuilder.setIgnore(false);
eroBuilder.setProcessingRule(false);
final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.Subobject> eroSubs = Lists.newArrayList();
eroSubs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.SubobjectBuilder().setSubobjectType(this.eroASSubobject).setLoose(false).build());
eroBuilder.setSubobject(eroSubs);
this.ero = eroBuilder.build();
final RroBuilder rroBuilder = new RroBuilder();
rroBuilder.setIgnore(false);
rroBuilder.setProcessingRule(false);
final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.rro.Subobject> rroSubs = Lists.newArrayList();
rroSubs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.rro.SubobjectBuilder().setSubobjectType(this.rroUnnumberedSub).setProtectionAvailable(false).setProtectionInUse(false).build());
rroBuilder.setSubobject(rroSubs);
this.rro = rroBuilder.build();
final SrpBuilder srpBuilder = new SrpBuilder();
srpBuilder.setIgnore(false);
srpBuilder.setProcessingRule(false);
srpBuilder.setOperationId(new SrpIdNumber(1L));
srpBuilder.addAugmentation(Srp1.class, new Srp1Builder().setRemove(false).build());
srpBuilder.setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.srp.TlvsBuilder().build());
this.srp = srpBuilder.build();
final LspBuilder lspBuilder = new LspBuilder();
lspBuilder.setIgnore(false);
lspBuilder.setProcessingRule(false);
lspBuilder.setAdministrative(false);
lspBuilder.setDelegate(false);
lspBuilder.setPlspId(new PlspId(0L));
lspBuilder.setOperational(OperationalStatus.Down);
lspBuilder.setSync(false);
lspBuilder.setRemove(false);
lspBuilder.setTlvs(new TlvsBuilder().build());
lspBuilder.addAugmentation(Lsp1.class, new Lsp1Builder().setCreate(false).build());
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4Builder builder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4Builder();
builder.setIpv4TunnelSenderAddress(new Ipv4Address("127.0.1.1"));
final LspId lspId = new LspId(1L);
final TunnelId tunnelId = new TunnelId(1);
builder.setIpv4ExtendedTunnelId(new Ipv4ExtendedTunnelId(new Ipv4Address("127.0.1.2")));
builder.setIpv4TunnelEndpointAddress(new Ipv4Address("127.0.1.3"));
final AddressFamily afiLsp = new Ipv4CaseBuilder().setIpv4(builder.build()).build();
final LspIdentifiers identifier = new LspIdentifiersBuilder().setAddressFamily(afiLsp).setLspId(lspId).setTunnelId(tunnelId).build();
this.lspSrp = lspBuilder.build();
this.lsp = lspBuilder.setTlvs(new TlvsBuilder().setLspIdentifiers(identifier).build()).build();
final Ipv4Builder afi = new Ipv4Builder();
afi.setSourceIpv4Address(new Ipv4Address("255.255.255.255"));
afi.setDestinationIpv4Address(new Ipv4Address("255.255.255.255"));
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.bandwidth.object.BandwidthBuilder bandwidthBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.bandwidth.object.BandwidthBuilder();
bandwidthBuilder.setIgnore(false);
bandwidthBuilder.setProcessingRule(false);
bandwidthBuilder.setBandwidth(new Bandwidth(new byte[] { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 }));
this.bandwidth = bandwidthBuilder.build();
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reoptimization.bandwidth.object.ReoptimizationBandwidthBuilder reoptimizationBandwidthBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reoptimization.bandwidth.object.ReoptimizationBandwidthBuilder();
reoptimizationBandwidthBuilder.setIgnore(false);
reoptimizationBandwidthBuilder.setProcessingRule(false);
reoptimizationBandwidthBuilder.setBandwidth(new Bandwidth(new byte[] { (byte) 0x47, (byte) 0x74, (byte) 0x24, (byte) 0x00 }));
this.reoptimizationBandwidth = reoptimizationBandwidthBuilder.build();
}
Aggregations