Search in sources :

Example 11 with Subobject

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.include.route.object.iro.Subobject in project bgpcep by opendaylight.

the class SrObjectParserTest method testSrEroObjectWithSubobjects.

@Test
public void testSrEroObjectWithSubobjects() throws PCEPDeserializerException {
    final PCEPExplicitRouteObjectParser parser = new PCEPExplicitRouteObjectParser(this.ctx.getEROSubobjectHandlerRegistry());
    final EroBuilder builder = new EroBuilder();
    builder.setProcessingRule(false);
    builder.setIgnore(false);
    final List<Subobject> subobjects = Lists.newArrayList();
    final SrEroTypeBuilder srEroSubBuilder = new SrEroTypeBuilder();
    srEroSubBuilder.setCFlag(false);
    srEroSubBuilder.setMFlag(false);
    srEroSubBuilder.setSidType(SidType.Ipv4NodeId);
    srEroSubBuilder.setSid(123456L);
    srEroSubBuilder.setNai(new IpNodeIdBuilder().setIpAddress(new IpAddress(new Ipv4Address("74.125.43.99"))).build());
    final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(srEroSubBuilder.build()).setLoose(false);
    subobjects.add(subobjBuilder.build());
    builder.setSubobject(subobjects);
    final ByteBuf result = Unpooled.wrappedBuffer(srEroObjectBytes);
    assertEquals(builder.build(), parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
    final ByteBuf buffer = Unpooled.buffer();
    parser.serializeObject(builder.build(), buffer);
    assertArrayEquals(srEroObjectBytes, ByteArray.getAllBytes(buffer));
}
Also used : SrEroTypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.add.lsp.input.arguments.ero.subobject.subobject.type.SrEroTypeBuilder) Subobject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.Subobject) ObjectHeaderImpl(org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl) IpNodeIdBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.sr.subobject.nai.IpNodeIdBuilder) EroBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.EroBuilder) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) ByteBuf(io.netty.buffer.ByteBuf) PCEPExplicitRouteObjectParser(org.opendaylight.protocol.pcep.parser.object.PCEPExplicitRouteObjectParser) SubobjectBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.SubobjectBuilder) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) Test(org.junit.Test)

Example 12 with Subobject

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.include.route.object.iro.Subobject in project bgpcep by opendaylight.

the class MsgBuilderUtil method createPath.

public static Path createPath(final List<Subobject> subobjects) {
    final PathBuilder pathBuilder = new PathBuilder();
    pathBuilder.setEro(new EroBuilder().setSubobject(subobjects).build());
    return pathBuilder.build();
}
Also used : PathBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcrpt.message.pcrpt.message.reports.PathBuilder) EroBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.EroBuilder)

Example 13 with Subobject

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.include.route.object.iro.Subobject in project bgpcep by opendaylight.

the class PCCTunnelBuilder method getDefaultEROEndpointHop.

private static Subobject getDefaultEROEndpointHop() {
    final SubobjectBuilder builder = new SubobjectBuilder();
    builder.setLoose(false);
    builder.setSubobjectType(new IpPrefixCaseBuilder().setIpPrefix(new IpPrefixBuilder().setIpPrefix(new IpPrefix(new Ipv4Prefix(ENDPOINT_PREFIX))).build()).build());
    return builder.build();
}
Also used : IpPrefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix) IpPrefixCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.IpPrefixCaseBuilder) IpPrefixBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.ip.prefix._case.IpPrefixBuilder) Ipv4Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix) SubobjectBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.SubobjectBuilder)

Example 14 with Subobject

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.include.route.object.iro.Subobject in project bgpcep by opendaylight.

the class PCCTunnelManagerImpl method reportToAll.

protected void reportToAll(final Updates update, final PCCSession session) {
    final PlspId plspId = update.getLsp().getPlspId();
    final PCCTunnel tunnel = this.tunnels.get(plspId);
    final long srpId = update.getSrp().getOperationId().getValue();
    if (tunnel != null) {
        if (hasDelegation(tunnel, session)) {
            final Srp srp = createSrp(update.getSrp().getOperationId().getValue());
            final Path path = updToRptPath(update.getPath());
            final List<Subobject> subobjects = update.getPath().getEro().getSubobject();
            final Lsp lsp = update.getLsp();
            sendToAll(tunnel, plspId, subobjects, srp, path, lsp);
            // update tunnel state
            tunnel.setLspState(path);
        } else {
            session.sendError(MsgBuilderUtil.createErrorMsg(PCEPErrors.UPDATE_REQ_FOR_NON_LSP, srpId));
        }
    } else {
        session.sendError(MsgBuilderUtil.createErrorMsg(PCEPErrors.UNKNOWN_PLSP_ID, srpId));
    }
}
Also used : MsgBuilderUtil.createSrp(org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createSrp) Srp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.srp.object.Srp) MsgBuilderUtil.updToRptPath(org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.updToRptPath) MsgBuilderUtil.reqToRptPath(org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.reqToRptPath) MsgBuilderUtil.createPath(org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createPath) Path(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.pcrpt.message.pcrpt.message.reports.Path) Subobject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.Subobject) MsgBuilderUtil.createLsp(org.opendaylight.protocol.pcep.pcc.mock.spi.MsgBuilderUtil.createLsp) Lsp(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.lsp.object.Lsp) PlspId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.PlspId)

Example 15 with Subobject

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.include.route.object.iro.Subobject in project bgpcep by opendaylight.

the class SrRroSubobjectParser method serializeSubobject.

@Override
public void serializeSubobject(Subobject subobject, ByteBuf buffer) {
    Preconditions.checkArgument(subobject.getSubobjectType() instanceof SrSubobject, "Unknown subobject instance. Passed %s. Needed SrSubobject.", subobject.getSubobjectType().getClass());
    final SrSubobject srSubobject = (SrSubobject) subobject.getSubobjectType();
    final ByteBuf body = serializeSubobject(srSubobject);
    RROSubobjectUtil.formatSubobject(this.type, body, buffer);
}
Also used : SrSubobject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev171025.SrSubobject) ByteBuf(io.netty.buffer.ByteBuf)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)61 IpPrefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix)21 PCEPDeserializerException (org.opendaylight.protocol.pcep.spi.PCEPDeserializerException)20 ArrayList (java.util.ArrayList)16 BitArray (org.opendaylight.protocol.util.BitArray)15 SubobjectBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.SubobjectBuilder)14 Subobject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.Subobject)12 IpPrefixSubobject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.IpPrefixSubobject)12 IpPrefixCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.IpPrefixCase)9 SubobjectBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.exclude.route.object.xro.SubobjectBuilder)7 EroBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.EroBuilder)7 SubobjectBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.rro.SubobjectBuilder)7 IpPrefixCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.IpPrefixCaseBuilder)7 IpPrefixBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.ip.prefix._case.IpPrefixBuilder)7 Preconditions (com.google.common.base.Preconditions)6 RSVPParsingException (org.opendaylight.protocol.rsvp.parser.spi.RSVPParsingException)5 PathKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.PathKey)5 PceId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.PceId)5 Test (org.junit.Test)4 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)4