Search in sources :

Example 1 with PcepEntityIdRpcAugBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.PcepEntityIdRpcAugBuilder in project bgpcep by opendaylight.

the class TopologyStatsRpcServiceImpl method transformStatefulAugmentation.

/*
     * Replace stateful topology augmentations with ones for rpc in PCEP session
     * stats data
     */
private static PcepSessionState transformStatefulAugmentation(final PcepSessionState pcepSessionState) {
    if (pcepSessionState == null) {
        return null;
    }
    final PcepSessionStateBuilder sb = new PcepSessionStateBuilder(pcepSessionState);
    final Messages topoMessage = pcepSessionState.getMessages();
    if (topoMessage != null) {
        final StatefulMessagesStatsAug messageStatsAug = topoMessage.augmentation(StatefulMessagesStatsAug.class);
        if (messageStatsAug != null) {
            sb.setMessages(new MessagesBuilder(topoMessage).removeAugmentation(StatefulMessagesStatsAug.class).addAugmentation(new StatefulMessagesRpcAugBuilder().setLastReceivedRptMsgTimestamp(messageStatsAug.getLastReceivedRptMsgTimestamp()).setReceivedRptMsgCount(messageStatsAug.getReceivedRptMsgCount()).setSentInitMsgCount(messageStatsAug.getSentInitMsgCount()).setSentUpdMsgCount(messageStatsAug.getSentUpdMsgCount()).build()).build());
        }
    }
    final PeerCapabilities topoPeerCapability = pcepSessionState.getPeerCapabilities();
    if (topoPeerCapability != null) {
        final StatefulCapabilitiesStatsAug capabilityStatsAug = topoPeerCapability.augmentation(StatefulCapabilitiesStatsAug.class);
        if (capabilityStatsAug != null) {
            sb.setPeerCapabilities(new PeerCapabilitiesBuilder(topoPeerCapability).removeAugmentation(StatefulCapabilitiesStatsAug.class).addAugmentation(new StatefulCapabilitiesRpcAugBuilder().setActive(capabilityStatsAug.getActive()).setInstantiation(capabilityStatsAug.getInstantiation()).setStateful(capabilityStatsAug.getStateful()).build()).build());
        }
    }
    final LocalPref topoLocalPref = pcepSessionState.getLocalPref();
    if (topoLocalPref != null) {
        final PcepEntityIdStatsAug entityStatsAug = topoLocalPref.augmentation(PcepEntityIdStatsAug.class);
        if (entityStatsAug != null) {
            sb.setLocalPref(new LocalPrefBuilder(topoLocalPref).removeAugmentation(PcepEntityIdStatsAug.class).addAugmentation(new PcepEntityIdRpcAugBuilder().setSpeakerEntityIdValue(entityStatsAug.getSpeakerEntityIdValue()).build()).build());
        }
    }
    return sb.build();
}
Also used : LocalPrefBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.LocalPrefBuilder) StatefulCapabilitiesStatsAug(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.StatefulCapabilitiesStatsAug) Messages(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.Messages) PcepEntityIdRpcAugBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.PcepEntityIdRpcAugBuilder) StatefulCapabilitiesRpcAugBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.StatefulCapabilitiesRpcAugBuilder) MessagesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.MessagesBuilder) PcepEntityIdStatsAug(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.PcepEntityIdStatsAug) LocalPref(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.LocalPref) PcepSessionStateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.grouping.PcepSessionStateBuilder) StatefulMessagesRpcAugBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.StatefulMessagesRpcAugBuilder) PeerCapabilities(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.PeerCapabilities) PeerCapabilitiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.PeerCapabilitiesBuilder) StatefulMessagesStatsAug(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.StatefulMessagesStatsAug)

Example 2 with PcepEntityIdRpcAugBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.PcepEntityIdRpcAugBuilder in project bgpcep by opendaylight.

the class TopologyStatsRpcServiceImplTest method createRpcSessionState.

private static PcepSessionState createRpcSessionState() {
    final ReplyTime replyTime = new ReplyTimeBuilder().setAverageTime(Uint32.ONE).setMaxTime(Uint32.valueOf(3)).setMinTime(Uint32.TWO).build();
    final ErrorMessages errorMsg = new ErrorMessagesBuilder().setReceivedErrorMsgCount(Uint32.ONE).setSentErrorMsgCount(Uint32.TWO).build();
    final StatefulMessagesRpcAug statefulMsg = new StatefulMessagesRpcAugBuilder().setLastReceivedRptMsgTimestamp(Uint32.valueOf(1553183614L)).setSentUpdMsgCount(Uint32.ONE).setReceivedRptMsgCount(Uint32.TWO).setSentInitMsgCount(Uint32.valueOf(3)).build();
    final Messages messages = new MessagesBuilder().setLastSentMsgTimestamp(Uint32.valueOf(1553183734L)).setUnknownMsgReceived(Uint16.ONE).setSentMsgCount(Uint32.valueOf(5)).setReceivedMsgCount(Uint32.valueOf(4)).setReplyTime(replyTime).setErrorMessages(errorMsg).addAugmentation(statefulMsg).build();
    final PeerCapabilities capabilities = new PeerCapabilitiesBuilder().addAugmentation(new StatefulCapabilitiesRpcAugBuilder().setStateful(true).setInstantiation(true).setActive(true).build()).build();
    final LocalPref localPref = new LocalPrefBuilder().setKeepalive(Uint8.valueOf(30)).setDeadtimer(Uint8.valueOf(120)).setIpAddress("127.0.0.1").setSessionId(Uint16.ZERO).addAugmentation(new PcepEntityIdRpcAugBuilder().setSpeakerEntityIdValue(new byte[] { 0x01, 0x02, 0x03, 0x04 }).build()).build();
    return new PcepSessionStateBuilder().setSynchronized(true).setSessionDuration("0:00:05:18").setDelegatedLspsCount(Uint16.ONE).setLocalPref(localPref).setPeerPref(new PeerPrefBuilder(localPref).build()).setPeerCapabilities(capabilities).setMessages(messages).build();
}
Also used : LocalPrefBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.LocalPrefBuilder) Messages(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.Messages) ErrorMessages(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.error.messages.grouping.ErrorMessages) PcepEntityIdRpcAugBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.PcepEntityIdRpcAugBuilder) StatefulCapabilitiesRpcAugBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.StatefulCapabilitiesRpcAugBuilder) PeerPrefBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.PeerPrefBuilder) ReplyTime(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.reply.time.grouping.ReplyTime) MessagesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.MessagesBuilder) ErrorMessagesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.error.messages.grouping.ErrorMessagesBuilder) ErrorMessages(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.error.messages.grouping.ErrorMessages) ReplyTimeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.reply.time.grouping.ReplyTimeBuilder) LocalPref(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.LocalPref) PcepSessionStateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.grouping.PcepSessionStateBuilder) ErrorMessagesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.error.messages.grouping.ErrorMessagesBuilder) StatefulMessagesRpcAugBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.StatefulMessagesRpcAugBuilder) PeerCapabilities(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.PeerCapabilities) StatefulMessagesRpcAug(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.StatefulMessagesRpcAug) PeerCapabilitiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.PeerCapabilitiesBuilder)

Aggregations

PcepEntityIdRpcAugBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.PcepEntityIdRpcAugBuilder)2 StatefulCapabilitiesRpcAugBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.StatefulCapabilitiesRpcAugBuilder)2 StatefulMessagesRpcAugBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.StatefulMessagesRpcAugBuilder)2 LocalPref (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.LocalPref)2 LocalPrefBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.LocalPrefBuilder)2 Messages (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.Messages)2 MessagesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.MessagesBuilder)2 PeerCapabilities (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.PeerCapabilities)2 PeerCapabilitiesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.PeerCapabilitiesBuilder)2 PcepSessionStateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.grouping.PcepSessionStateBuilder)2 PcepEntityIdStatsAug (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.PcepEntityIdStatsAug)1 StatefulCapabilitiesStatsAug (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.StatefulCapabilitiesStatsAug)1 StatefulMessagesRpcAug (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.StatefulMessagesRpcAug)1 StatefulMessagesStatsAug (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.StatefulMessagesStatsAug)1 ErrorMessages (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.error.messages.grouping.ErrorMessages)1 ErrorMessagesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.error.messages.grouping.ErrorMessagesBuilder)1 PeerPrefBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.PeerPrefBuilder)1 ReplyTime (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.reply.time.grouping.ReplyTime)1 ReplyTimeBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.reply.time.grouping.ReplyTimeBuilder)1