Search in sources :

Example 1 with StatefulTlv1Builder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.StatefulTlv1Builder in project bgpcep by opendaylight.

the class Stateful07TopologySessionListener 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.getAugmentation(Tlvs1.class) != null) {
        final Stateful stateful = tlvs.getAugmentation(Tlvs1.class).getStateful();
        if (stateful != null) {
            setStatefulCapabilities(stateful);
            pccBuilder.setReportedLsp(Collections.emptyList());
            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(StatefulTlv1.class, new StatefulTlv1Builder(tlvs.getAugmentation(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.rev171025.stateful.capability.tlv.Stateful) Tlvs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.open.Tlvs) StatefulTlv1Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.StatefulTlv1Builder) InetAddress(java.net.InetAddress) Tlvs1(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Tlvs1) StatefulTlvBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.StatefulTlvBuilder)

Example 2 with StatefulTlv1Builder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.StatefulTlv1Builder 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)

Aggregations

InetAddress (java.net.InetAddress)2 StatefulTlv1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.StatefulTlv1Builder)1 Tlvs1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.Tlvs1)1 Stateful (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev171025.stateful.capability.tlv.Stateful)1 StatefulTlv1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.StatefulTlv1Builder)1 Tlvs1 (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Tlvs1)1 Stateful (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.stateful.capability.tlv.Stateful)1 Tlvs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.open.Tlvs)1 Tlvs (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open.object.open.Tlvs)1 StatefulTlvBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev171025.pcep.client.attributes.path.computation.client.StatefulTlvBuilder)1 StatefulTlvBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.rev200120.pcep.client.attributes.path.computation.client.StatefulTlvBuilder)1