use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.Messages in project lispflowmapping by opendaylight.
the class LispSouthboundRPC method createGetStatsOutput.
private static GetStatsOutput createGetStatsOutput(ConcurrentLispSouthboundStats stats) {
long[] rxStats = stats.getRx();
long[] txStats = stats.getTx();
ControlMessageStatsBuilder cmsb = new ControlMessageStatsBuilder();
cmsb.setRxUnknown(stats.getRxUnknown());
cmsb.setTxErrors(stats.getTxErrors());
List<ControlMessage> messages = new ArrayList<ControlMessage>();
for (int i = 0; i <= ConcurrentLispSouthboundStats.MAX_LISP_TYPES; i++) {
if (MessageType.forValue(i) == null) {
continue;
}
ControlMessageBuilder cmb = new ControlMessageBuilder();
cmb.setMsgType(MessageType.forValue(i));
cmb.setRxCount(rxStats[i]);
cmb.setTxCount(txStats[i]);
messages.add(cmb.build());
}
cmsb.setControlMessage(messages);
MapRegisterCacheStatsBuilder mrcsb = new MapRegisterCacheStatsBuilder();
mrcsb.setHits(stats.getCacheHits());
mrcsb.setMisses(stats.getCacheMisses());
return new GetStatsOutputBuilder().setControlMessageStats(cmsb.build()).setMapRegisterCacheStats(mrcsb.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.Messages in project bgpcep by opendaylight.
the class NeighborStateCliUtils method printMessagesState.
private static void printMessagesState(final State neighborState, final ShellTable table) {
final BgpNeighborStateAugmentation state = neighborState.getAugmentation(BgpNeighborStateAugmentation.class);
if (state == null) {
return;
}
addHeader(table, "Messages state");
final Messages messages = state.getMessages();
table.addRow().addContent("Messages Received", "");
final Received received = messages.getReceived();
table.addRow().addContent("NOTIFICATION", received.getNOTIFICATION());
table.addRow().addContent("UPDATE", received.getUPDATE());
final Sent sent = messages.getSent();
table.addRow().addContent("Messages Sent", "");
table.addRow().addContent("NOTIFICATION", sent.getNOTIFICATION());
table.addRow().addContent("UPDATE", sent.getUPDATE());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.Messages in project bgpcep by opendaylight.
the class PCEPSessionImplTest method testCapabilityNotSupported.
@Test
public void testCapabilityNotSupported() {
this.session.handleMalformedMessage(PCEPErrors.CAPABILITY_NOT_SUPPORTED);
Assert.assertEquals(2, this.msgsSend.size());
Assert.assertTrue(this.msgsSend.get(0) instanceof Pcerr);
final Pcerr pcErr = (Pcerr) this.msgsSend.get(0);
final ErrorObject errorObj = pcErr.getPcerrMessage().getErrors().get(0).getErrorObject();
Assert.assertEquals(PCEPErrors.CAPABILITY_NOT_SUPPORTED, PCEPErrors.forValue(errorObj.getType(), errorObj.getValue()));
Assert.assertEquals(1, this.session.getMessages().getUnknownMsgReceived().intValue());
// exceeded max. unknown messages count - terminate session
Assert.assertTrue(this.msgsSend.get(1) instanceof CloseMessage);
final CloseMessage closeMsg = (CloseMessage) this.msgsSend.get(1);
Assert.assertEquals(TerminationReason.TOO_MANY_UNKNOWN_MSGS, TerminationReason.forValue(closeMsg.getCCloseMessage().getCClose().getReason()));
Mockito.verify(this.channel, Mockito.times(1)).close();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.Messages in project bgpcep by opendaylight.
the class PcepStateUtilsTest method createPcepSessionState.
private PcepSessionState createPcepSessionState() {
final LocalPref pref = new LocalPrefBuilder().setKeepalive((short) 30).setDeadtimer((short) 120).setIpAddress(IP_ADDRESS).setSessionId(0).addAugmentation(PcepEntityIdStatsAug.class, new PcepEntityIdStatsAugBuilder().setSpeakerEntityIdValue(SPEAKER_ID).build()).build();
final PeerCapabilities capa = new PeerCapabilitiesBuilder().addAugmentation(StatefulCapabilitiesStatsAug.class, new StatefulCapabilitiesStatsAugBuilder().setStateful(true).setInstantiation(true).setActive(true).build()).build();
final ReplyTime reply = new ReplyTimeBuilder().setAverageTime(1L).setMaxTime(3L).setMinTime(2L).build();
final ErrorMessages errorMsg = new ErrorMessagesBuilder().setReceivedErrorMsgCount(1L).setSentErrorMsgCount(2L).build();
final StatefulMessagesStatsAug statefulMsg = new StatefulMessagesStatsAugBuilder().setLastReceivedRptMsgTimestamp(1512043769L).setSentUpdMsgCount(1L).setReceivedRptMsgCount(2L).setSentInitMsgCount(3L).build();
final Messages messages = new MessagesBuilder().setLastSentMsgTimestamp(1512043828L).setUnknownMsgReceived(1).setSentMsgCount(5L).setReceivedMsgCount(4L).setReplyTime(reply).setErrorMessages(errorMsg).addAugmentation(StatefulMessagesStatsAug.class, statefulMsg).build();
return new PcepSessionStateBuilder().setSynchronized(true).setSessionDuration("0:00:01:26").setDelegatedLspsCount(1).setLocalPref(pref).setPeerPref(new PeerPrefBuilder(pref).build()).setPeerCapabilities(capa).setMessages(messages).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180321.network.instances.network.instance.protocols.protocol.bgp.neighbors.neighbor.state.Messages in project openflowplugin by opendaylight.
the class FlowNodeReconciliationImpl method createMessages.
private Messages createMessages(final NodeRef nodeRef, final Optional<FlowCapableNode> flowNode) {
final List<Message> messages = new ArrayList<>();
messages.add(new MessageBuilder().setNode(nodeRef).setBundleInnerMessage(new BundleRemoveFlowCaseBuilder().setRemoveFlowCaseData(new RemoveFlowCaseDataBuilder(getDeleteAllFlow()).build()).build()).build());
messages.add(new MessageBuilder().setNode(nodeRef).setBundleInnerMessage(new BundleRemoveGroupCaseBuilder().setRemoveGroupCaseData(new RemoveGroupCaseDataBuilder(getDeleteAllGroup()).build()).build()).build());
if (flowNode.get().getGroup() != null) {
for (Group gr : flowNode.get().getGroup()) {
messages.add(new MessageBuilder().setNode(nodeRef).setBundleInnerMessage(new BundleAddGroupCaseBuilder().setAddGroupCaseData(new AddGroupCaseDataBuilder(gr).build()).build()).build());
}
}
if (flowNode.get().getTable() != null) {
for (Table table : flowNode.get().getTable()) {
for (Flow flow : table.getFlow()) {
messages.add(new MessageBuilder().setNode(nodeRef).setBundleInnerMessage(new BundleAddFlowCaseBuilder().setAddFlowCaseData(new AddFlowCaseDataBuilder(flow).build()).build()).build());
}
}
}
LOG.debug("The size of the flows and group messages created in createMessage() {}", messages.size());
return new MessagesBuilder().setMessage(messages).build();
}
Aggregations