Search in sources :

Example 1 with VendorInformationObjectBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.objects.VendorInformationObjectBuilder 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.viObjAct = new TestVendorInformationActivator();
    this.act.start(this.ctx);
    this.viObjAct.start(this.ctx);
    this.objectRegistry = this.ctx.getObjectHandlerRegistry();
    final RpBuilder rpBuilder = new RpBuilder();
    rpBuilder.setProcessingRule(true);
    rpBuilder.setIgnore(false);
    rpBuilder.setReoptimization(false);
    rpBuilder.setBiDirectional(false);
    rpBuilder.setLoose(true);
    rpBuilder.setMakeBeforeBreak(false);
    rpBuilder.setOrder(false);
    rpBuilder.setPathKey(false);
    rpBuilder.setSupplyOf(false);
    rpBuilder.setFragmentation(false);
    rpBuilder.setP2mp(false);
    rpBuilder.setEroCompression(false);
    rpBuilder.setPriority((short) 1);
    rpBuilder.setRequestId(new RequestId(10L));
    rpBuilder.setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rp.object.rp.TlvsBuilder().build());
    this.rpTrue = rpBuilder.build();
    rpBuilder.setProcessingRule(false);
    this.rpFalse = rpBuilder.build();
    final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.OpenBuilder openBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.OpenBuilder();
    openBuilder.setProcessingRule(false);
    openBuilder.setIgnore(false);
    openBuilder.setDeadTimer((short) 1);
    openBuilder.setKeepalive((short) 1);
    openBuilder.setSessionId((short) 0);
    openBuilder.setVersion(new ProtocolVersion((short) 1));
    openBuilder.setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.open.TlvsBuilder().build());
    this.open = openBuilder.build();
    final NoPathBuilder npbuilder = new NoPathBuilder();
    npbuilder.setProcessingRule(false);
    npbuilder.setIgnore(false);
    npbuilder.setNatureOfIssue((short) 0);
    npbuilder.setUnsatisfiedConstraints(false);
    npbuilder.setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcrep.message.pcrep.message.replies.result.failure._case.no.path.TlvsBuilder().build());
    this.noPath = npbuilder.build();
    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();
    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 OfBuilder ofBuilder = new OfBuilder();
    ofBuilder.setIgnore(false);
    ofBuilder.setProcessingRule(false);
    ofBuilder.setCode(new OfId(0));
    ofBuilder.setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.of.object.of.TlvsBuilder().build());
    this.of = ofBuilder.build();
    final Ipv4Builder afi = new Ipv4Builder();
    afi.setSourceIpv4Address(new Ipv4Address("255.255.255.255"));
    afi.setDestinationIpv4Address(new Ipv4Address("255.255.255.255"));
    final EndpointsObjBuilder epBuilder = new EndpointsObjBuilder();
    epBuilder.setIgnore(false);
    epBuilder.setProcessingRule(true);
    epBuilder.setAddressFamily(new Ipv4CaseBuilder().setIpv4(afi.build()).build());
    this.endpoints = epBuilder.build();
    final SvecBuilder sBuilder = new SvecBuilder();
    sBuilder.setIgnore(false);
    sBuilder.setProcessingRule(false);
    sBuilder.setLinkDiverse(false);
    sBuilder.setNodeDiverse(false);
    sBuilder.setSrlgDiverse(false);
    sBuilder.setRequestsIds(Lists.newArrayList(new RequestId(1L)));
    this.svec = sBuilder.build();
    this.viObjects = Lists.newArrayList();
    final TestEnterpriseSpecificInformation esInfo = new TestEnterpriseSpecificInformation(5);
    final VendorInformationObject viObj = new VendorInformationObjectBuilder().setEnterpriseNumber(new EnterpriseNumber(0L)).setEnterpriseSpecificInformation(esInfo).build();
    this.viObjects.add(viObj);
    this.monitoring = new MonitoringBuilder().setMonitoringId(100L).setFlags(new Flags(false, false, false, false, false)).setTlvs(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.monitoring.object.monitoring.TlvsBuilder().build()).build();
    this.pccIdReq = new PccIdReqBuilder().setIpAddress(new IpAddress(new Ipv4Address("127.0.0.1"))).build();
    this.pceId = new PceIdBuilder().setIpAddress(new IpAddress(new Ipv4Address("127.0.0.2"))).build();
    final ProcTimeBuilder procTimeBuilder = new ProcTimeBuilder();
    procTimeBuilder.setEstimated(false);
    procTimeBuilder.setCurrentProcTime(1L);
    procTimeBuilder.setMinProcTime(2L);
    procTimeBuilder.setMaxProcTime(3L);
    procTimeBuilder.setAverageProcTime(4L);
    procTimeBuilder.setVarianceProcTime(5L);
    this.procTime = procTimeBuilder.build();
    this.overload = new OverloadBuilder().setDuration(120).build();
}
Also used : LspaBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lspa.object.LspaBuilder) AsNumberCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.AsNumberCaseBuilder) PceIdBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pce.id.object.PceIdBuilder) ProtocolVersion(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ProtocolVersion) SpecificMetricsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.monitoring.response.monitoring.metrics.list.specific.metrics.list.SpecificMetricsBuilder) MetricsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.attributes.MetricsBuilder) PccIdReqBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcc.id.req.object.PccIdReqBuilder) OverloadBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.overload.object.OverloadBuilder) Float32(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ieee754.rev130819.Float32) EroBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.EroBuilder) NoPathBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcrep.message.pcrep.message.replies.result.failure._case.NoPathBuilder) OpenBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.OpenBuilder) RequestId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.RequestId) BaseParserExtensionActivator(org.opendaylight.protocol.pcep.parser.BaseParserExtensionActivator) TlvsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.close.object.c.close.TlvsBuilder) RpBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rp.object.RpBuilder) AttributeFilter(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.AttributeFilter) Subobject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.include.route.object.iro.Subobject) ProcTimeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.proc.time.object.ProcTimeBuilder) Notifications(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcntf.message.pcntf.message.Notifications) Collections(java.util.Collections) Ipv4Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.address.family.ipv4._case.Ipv4Builder) VendorInformationObjectBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.objects.VendorInformationObjectBuilder) SubobjectBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.include.route.object.iro.SubobjectBuilder) AsNumberBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.as.number._case.AsNumberBuilder) Ipv4CaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.address.family.Ipv4CaseBuilder) TestEnterpriseSpecificInformation(org.opendaylight.protocol.pcep.impl.TestVendorInformationTlvParser.TestEnterpriseSpecificInformation) OfId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.OfId) VendorInformationObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.objects.VendorInformationObject) EnterpriseNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber) SimplePCEPExtensionProviderContext(org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext) MetricBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.metric.object.MetricBuilder) EndpointsObjBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.endpoints.object.EndpointsObjBuilder) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) Subobject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.include.route.object.iro.Subobject) MonitoringBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.monitoring.object.MonitoringBuilder) SvecBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.svec.object.SvecBuilder) Flags(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.monitoring.object.Monitoring.Flags) OfBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.of.object.OfBuilder) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) IroBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.include.route.object.IroBuilder) Before(org.junit.Before)

Example 2 with VendorInformationObjectBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.objects.VendorInformationObjectBuilder in project bgpcep by opendaylight.

the class PCEPObjectParserTest method testVendorInformationObject.

@Test
public void testVendorInformationObject() throws PCEPDeserializerException {
    final byte[] viObjBytes = { /* vendor-information object */
    0x22, 0x10, 0x00, 0x0C, /* enterprise number */
    0x00, 0x00, 0x00, 0x00, /* enterprise specific information */
    0x00, 0x00, 0x00, 0x05 };
    final TestVendorInformationObjectParser parser = new TestVendorInformationObjectParser();
    final TestEnterpriseSpecificInformation esInfo = new TestEnterpriseSpecificInformation(5);
    final VendorInformationObject viObj = new VendorInformationObjectBuilder().setEnterpriseNumber(new EnterpriseNumber(0L)).setEnterpriseSpecificInformation(esInfo).build();
    final ByteBuf result = Unpooled.wrappedBuffer(viObjBytes);
    result.readerIndex(8);
    final VendorInformationObject o = (VendorInformationObject) parser.parseObject(new ObjectHeaderImpl(false, false), result.readSlice(result.readableBytes()));
    assertEquals(viObj, o);
    final ByteBuf buf = Unpooled.buffer(viObjBytes.length);
    parser.serializeObject(viObj, buf);
    assertArrayEquals(result.array(), ByteArray.getAllBytes(buf));
}
Also used : ObjectHeaderImpl(org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl) TestEnterpriseSpecificInformation(org.opendaylight.protocol.pcep.impl.TestVendorInformationTlvParser.TestEnterpriseSpecificInformation) VendorInformationObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.objects.VendorInformationObject) EnterpriseNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber) VendorInformationObjectBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.objects.VendorInformationObjectBuilder) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 3 with VendorInformationObjectBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.objects.VendorInformationObjectBuilder in project bgpcep by opendaylight.

the class AbstractVendorInformationObjectParser method parseObject.

@Override
public final Object parseObject(final ObjectHeader header, final ByteBuf buffer) throws PCEPDeserializerException {
    Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
    final VendorInformationObjectBuilder builder = new VendorInformationObjectBuilder();
    builder.setEnterpriseNumber(new EnterpriseNumber(getEnterpriseNumber()));
    builder.setEnterpriseSpecificInformation(parseEnterpriseSpecificInformation(buffer));
    return builder.build();
}
Also used : EnterpriseNumber(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber) VendorInformationObjectBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.objects.VendorInformationObjectBuilder)

Example 4 with VendorInformationObjectBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.objects.VendorInformationObjectBuilder in project bgpcep by opendaylight.

the class AbstractMessageParserTest method setUp.

@Before
public void setUp() throws PCEPDeserializerException {
    MockitoAnnotations.initMocks(this);
    this.object = new ErrorObjectBuilder().setType((short) 1).setValue((short) 1).build();
    this.viObject = new VendorInformationObjectBuilder().setEnterpriseNumber(EN).build();
    Mockito.doNothing().when(this.registry).serializeVendorInformationObject(Mockito.any(VendorInformationObject.class), Mockito.any(ByteBuf.class));
    Mockito.doReturn(Optional.of(this.viObject)).when(this.registry).parseVendorInformationObject(Mockito.eq(EN), Mockito.eq(new ObjectHeaderImpl(true, true)), Mockito.any(ByteBuf.class));
    Mockito.doNothing().when(this.registry).serializeObject(Mockito.any(Object.class), Mockito.any(ByteBuf.class));
    Mockito.doReturn(this.object).when(this.registry).parseObject(13, 1, new ObjectHeaderImpl(true, true), Unpooled.wrappedBuffer(new byte[] { 0, 0, 1, 1 }));
}
Also used : VendorInformationObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.objects.VendorInformationObject) Object(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object) VendorInformationObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.objects.VendorInformationObject) ErrorObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.ErrorObject) VendorInformationObjectBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.objects.VendorInformationObjectBuilder) ByteBuf(io.netty.buffer.ByteBuf) ErrorObjectBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.ErrorObjectBuilder) Before(org.junit.Before)

Aggregations

VendorInformationObjectBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.objects.VendorInformationObjectBuilder)4 EnterpriseNumber (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber)3 VendorInformationObject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.objects.VendorInformationObject)3 ByteBuf (io.netty.buffer.ByteBuf)2 Before (org.junit.Before)2 TestEnterpriseSpecificInformation (org.opendaylight.protocol.pcep.impl.TestVendorInformationTlvParser.TestEnterpriseSpecificInformation)2 Collections (java.util.Collections)1 Test (org.junit.Test)1 BaseParserExtensionActivator (org.opendaylight.protocol.pcep.parser.BaseParserExtensionActivator)1 ObjectHeaderImpl (org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl)1 SimplePCEPExtensionProviderContext (org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext)1 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)1 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)1 Float32 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ieee754.rev130819.Float32)1 OpenBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.OpenBuilder)1 Object (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object)1 OfId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.OfId)1 ProtocolVersion (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ProtocolVersion)1 RequestId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.RequestId)1 TlvsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.close.object.c.close.TlvsBuilder)1