Search in sources :

Example 81 with Peer

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.peers.Peer in project bgpcep by opendaylight.

the class PCEPTopologySessionListener method onSessionUp.

@Override
protected void onSessionUp(final PCEPSession session, final PathComputationClientBuilder pccBuilder) {
    final InetAddress peerAddress = session.getRemoteAddress();
    final Tlvs tlvs = session.getRemoteTlvs();
    if (tlvs != null && tlvs.augmentation(Tlvs1.class) != null) {
        final Stateful stateful = tlvs.augmentation(Tlvs1.class).getStateful();
        if (stateful != null) {
            setStatefulCapabilities(stateful);
            pccBuilder.setReportedLsp(Collections.emptyMap());
            if (isSynchronized()) {
                pccBuilder.setStateSync(PccSyncState.Synchronized);
            } else if (isTriggeredInitialSynchro()) {
                pccBuilder.setStateSync(PccSyncState.TriggeredInitialSync);
            } else if (isIncrementalSynchro()) {
                pccBuilder.setStateSync(PccSyncState.IncrementalSync);
            } else {
                pccBuilder.setStateSync(PccSyncState.InitialResync);
            }
            pccBuilder.setStatefulTlv(new StatefulTlvBuilder().addAugmentation(new StatefulTlv1Builder(tlvs.augmentation(Tlvs1.class)).build()).build());
        } else {
            LOG.debug("Peer {} does not advertise stateful TLV", peerAddress);
        }
    } else {
        LOG.debug("Peer {} does not advertise stateful TLV", peerAddress);
    }
}
Also used : Stateful(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.stateful.capability.tlv.Stateful) Tlvs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.Tlvs) StatefulTlv1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.StatefulTlv1Builder) InetAddress(java.net.InetAddress) Tlvs1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Tlvs1) StatefulTlvBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.StatefulTlvBuilder)

Example 82 with Peer

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.peers.Peer in project bgpcep by opendaylight.

the class AbstractTopologySessionListener method stateSynchronizationAchieved.

/**
 * Indicate that the peer has completed state synchronization.
 *
 * @param ctx Message context
 */
protected final synchronized void stateSynchronizationAchieved(final MessageContext ctx) {
    if (this.synced.getAndSet(true)) {
        LOG.debug("State synchronization achieved while synchronizing, not updating state");
        return;
    }
    if (this.triggeredResyncInProcess) {
        this.triggeredResyncInProcess = false;
    }
    updatePccNode(ctx, new PathComputationClientBuilder().setStateSync(PccSyncState.Synchronized).build());
    // The node has completed synchronization, cleanup metadata no longer reported back
    this.nodeState.cleanupExcept(this.lsps.values());
    LOG.debug("Session {} achieved synchronized state", this.session);
}
Also used : PathComputationClientBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.PathComputationClientBuilder)

Example 83 with Peer

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.peers.Peer in project bgpcep by opendaylight.

the class OriginatorIdAttributeParser method parseAttribute.

@Override
public void parseAttribute(final ByteBuf buffer, final AttributesBuilder builder, final RevisedErrorHandling errorHandling, final PeerSpecificParserConstraint constraint) throws BGPDocumentedException, BGPTreatAsWithdrawException {
    if (errorHandling == RevisedErrorHandling.EXTERNAL) {
        // RFC7606 section 7.9
        LOG.debug("Discarded ORIGINATOR_ID attribute from external peer");
        return;
    }
    final int readable = buffer.readableBytes();
    if (readable != Ipv4Util.IP4_LENGTH) {
        throw errorHandling.reportError(BGPError.ATTR_LENGTH_ERROR, "Length of byte array for ORIGINATOR_ID should be 4, but is %s", readable);
    }
    builder.setOriginatorId(new OriginatorIdBuilder().setOriginator(Ipv4Util.addressForByteBuf(buffer)).build());
}
Also used : PeerSpecificParserConstraint(org.opendaylight.protocol.bgp.parser.spi.PeerSpecificParserConstraint) OriginatorIdBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.attributes.OriginatorIdBuilder)

Aggregations

Test (org.junit.Test)29 ByteBuf (io.netty.buffer.ByteBuf)13 BGPDocumentedException (org.opendaylight.protocol.bgp.parser.BGPDocumentedException)11 IpAddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone)9 BGPSessionPreferences (org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionPreferences)8 Peer (org.opendaylight.protocol.bgp.rib.spi.Peer)8 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)7 ArrayList (java.util.ArrayList)6 AsNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)6 YangInstanceIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier)6 BGPRouteEntryExportParametersImpl (org.opendaylight.protocol.bgp.mode.impl.BGPRouteEntryExportParametersImpl)5 RIBSupport (org.opendaylight.protocol.bgp.rib.spi.RIBSupport)5 BGPRouteEntryExportParameters (org.opendaylight.protocol.bgp.rib.spi.policy.BGPRouteEntryExportParameters)5 BgpParameters (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.open.message.BgpParameters)5 PeerId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.PeerId)5 CommitInfo (org.opendaylight.mdsal.common.api.CommitInfo)4 PeerSpecificParserConstraint (org.opendaylight.protocol.bgp.parser.spi.PeerSpecificParserConstraint)4 Ipv4AddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone)4 Ipv4Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix)4 PortStatusMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessage)4