use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.Messages in project openflowplugin by opendaylight.
the class SalBundleServiceImplTest method testAddBundleMessages.
@Test
public void testAddBundleMessages() throws Exception {
final List<Message> innerMessages = createMessages();
final Messages messages = new MessagesBuilder().setMessage(innerMessages).build();
final AddBundleMessagesInput input = new AddBundleMessagesInputBuilder().setNode(NODE_REF).setBundleId(BUNDLE_ID).setFlags(BUNDLE_FLAGS).setBundleProperty(properties).setMessages(messages).build();
final SalAddMessageDataBuilder dataBuilder = new SalAddMessageDataBuilder();
dataBuilder.setBundleId(BUNDLE_ID).setFlags(BUNDLE_FLAGS).setBundleProperty(properties);
final BundleAddMessageSalBuilder addMessageBuilder = new BundleAddMessageSalBuilder();
final SendExperimenterInputBuilder experimenterBuilder = new SendExperimenterInputBuilder().setNode(NODE_REF);
Mockito.when(experimenterMessageService.sendExperimenter(Matchers.any())).thenReturn(SettableFuture.create());
service.addBundleMessages(input);
for (Message msg : innerMessages) {
Mockito.verify(experimenterMessageService).sendExperimenter(experimenterBuilder.setExperimenterMessageOfChoice(addMessageBuilder.setSalAddMessageData(dataBuilder.setNode(NODE_REF).setBundleInnerMessage(msg.getBundleInnerMessage()).build()).build()).build());
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.Messages in project openflowplugin by opendaylight.
the class ConnectionAdapterImplStatisticsTest method testMessagePassCounter.
/**
* Test counter for pass messages to consumer (counter US_MESSAGE_PASS has to be enabled).
*/
@Test
public void testMessagePassCounter() {
if (!statCounters.isCounterEnabled(CounterEventTypes.US_MESSAGE_PASS)) {
Assert.fail("Counter " + CounterEventTypes.US_MESSAGE_PASS + " is not enabled");
}
when(channel.pipeline()).thenReturn(pipeline);
adapter = new ConnectionAdapterImpl(channel, InetSocketAddress.createUnresolved("10.0.0.1", 6653), true, CHANNEL_OUTBOUND_QUEUE_SIZE);
adapter.setMessageListener(messageListener);
adapter.setSystemListener(systemListener);
adapter.setConnectionReadyListener(readyListener);
cache = CacheBuilder.newBuilder().concurrencyLevel(1).expireAfterWrite(RPC_RESPONSE_EXPIRATION, TimeUnit.MINUTES).removalListener(REMOVAL_LISTENER).build();
adapter.setResponseCache(cache);
when(channel.disconnect()).thenReturn(channelFuture);
DataObject message = new EchoRequestMessageBuilder().build();
adapter.consume(message);
message = new ErrorMessageBuilder().build();
adapter.consume(message);
message = new ExperimenterMessageBuilder().build();
adapter.consume(message);
message = new FlowRemovedMessageBuilder().build();
adapter.consume(message);
message = new HelloMessageBuilder().build();
adapter.consume(message);
message = new MultipartReplyMessageBuilder().build();
adapter.consume(message);
message = new PacketInMessageBuilder().build();
adapter.consume(message);
message = new PortStatusMessageBuilder().build();
adapter.consume(message);
message = new EchoRequestMessageBuilder().build();
adapter.consume(message);
Assert.assertEquals("Wrong - bad counter value for ConnectionAdapterImpl consume method", 9, statCounters.getCounter(CounterEventTypes.US_MESSAGE_PASS).getCounterValue());
adapter.disconnect();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.Messages in project openflowplugin by opendaylight.
the class Activator method onDataTreeChanged.
@Override
public void onDataTreeChanged(@Nonnull Collection<DataTreeModification<FlowCapableNode>> modifications) {
for (DataTreeModification modification : modifications) {
if (modification.getRootNode().getModificationType() == ModificationType.WRITE) {
LOG.info("Node connected: {}", modification.getRootPath().getRootIdentifier().firstIdentifierOf(Node.class));
final NodeRef nodeRef = new NodeRef(modification.getRootPath().getRootIdentifier().firstIdentifierOf(Node.class));
final ControlBundleInput openBundleInput = new ControlBundleInputBuilder().setNode(nodeRef).setBundleId(BUNDLE_ID).setFlags(BUNDLE_FLAGS).setType(BundleControlType.ONFBCTOPENREQUEST).build();
final ControlBundleInput commitBundleInput = new ControlBundleInputBuilder().setNode(nodeRef).setBundleId(BUNDLE_ID).setFlags(BUNDLE_FLAGS).setType(BundleControlType.ONFBCTCOMMITREQUEST).build();
final List<Message> innerMessages = createMessages(nodeRef);
final Messages messages = new MessagesBuilder().setMessage(innerMessages).build();
final AddBundleMessagesInput addBundleMessagesInput = new AddBundleMessagesInputBuilder().setNode(nodeRef).setBundleId(BUNDLE_ID).setFlags(BUNDLE_FLAGS).setMessages(messages).build();
makeCompletableFuture(bundleService.controlBundle(openBundleInput)).thenComposeAsync(voidRpcResult -> {
LOG.debug("Open successful: {}, msg: {}", voidRpcResult.isSuccessful(), voidRpcResult.getErrors());
final CompletableFuture<RpcResult<Void>> addFuture = makeCompletableFuture(bundleService.addBundleMessages(addBundleMessagesInput));
return addFuture;
}).thenComposeAsync(voidRpcResult -> {
LOG.debug("AddBundleMessages successful: {}, msg: {}", voidRpcResult.isSuccessful(), voidRpcResult.getErrors());
final CompletableFuture<RpcResult<Void>> controlCommitFuture = makeCompletableFuture(bundleService.controlBundle(commitBundleInput));
return controlCommitFuture;
}).thenAccept(voidRpcResult -> {
LOG.debug("Commit successful: {}, msg: {}", voidRpcResult.isSuccessful(), voidRpcResult.getErrors());
});
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.Messages in project bgpcep by opendaylight.
the class TopologyStatsRpcServiceImplTest method createTopologySessionState.
private static PcepSessionState createTopologySessionState() {
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.valueOf(2)).build();
final StatefulMessagesStatsAug statefulMsg = new StatefulMessagesStatsAugBuilder().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 StatefulCapabilitiesStatsAugBuilder().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 PcepEntityIdStatsAugBuilder().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();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.openconfig.extensions.rev180329.network.instance.protocol.bgp.neighbor_state.augmentation.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.augmentation(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());
}
Aggregations