use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.State in project openflowplugin by opendaylight.
the class NodeConnectorInventoryEventTranslatorTest method testNodeConnectorUpdateToAdminDown.
/**
* Test that checks if {@link NodeConnectorEventsObserver#nodeConnectorRemoved} is called
* for each FlowCapableNodeConnector item with administrative down state removed in
* {@link org.opendaylight.controller.md.sal.binding.api.DataTreeModification}.
*/
@Test
public void testNodeConnectorUpdateToAdminDown() {
FlowCapableNodeConnector fcnc = TestUtils.createFlowCapableNodeConnector(false, true).build();
DataTreeModification dataTreeModification = setupDataTreeChange(SUBTREE_MODIFIED, NODE_CONNECTOR_INSTANCE_IDENTIFIER, fcnc);
translator.onDataTreeChanged(Collections.singleton(dataTreeModification));
verify(eventsObserver).nodeConnectorRemoved(ID);
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.State in project openflowplugin by opendaylight.
the class QueueStatisticsToNotificationTransformer method transformToNotification.
/**
* Transform statistics to notification.
*
* @param mpReplyList raw multipart response from device
* @param deviceInfo device state
* @param ofVersion device version
* @param emulatedTxId emulated transaction Id
* @return notification containing flow stats
*/
public static QueueStatisticsUpdate transformToNotification(final List<MultipartReply> mpReplyList, final DeviceInfo deviceInfo, final OpenflowVersion ofVersion, final TransactionId emulatedTxId) {
QueueStatisticsUpdateBuilder notification = new QueueStatisticsUpdateBuilder();
notification.setId(deviceInfo.getNodeId());
notification.setMoreReplies(Boolean.FALSE);
notification.setTransactionId(emulatedTxId);
notification.setQueueIdAndStatisticsMap(new ArrayList<>());
for (MultipartReply mpReply : mpReplyList) {
MultipartReplyQueueCase caseBody = (MultipartReplyQueueCase) mpReply.getMultipartReplyBody();
MultipartReplyQueue replyBody = caseBody.getMultipartReplyQueue();
for (QueueStats queueStats : replyBody.getQueueStats()) {
QueueIdAndStatisticsMapBuilder statsBuilder = new QueueIdAndStatisticsMapBuilder();
statsBuilder.setNodeConnectorId(InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(deviceInfo.getDatapathId(), queueStats.getPortNo(), ofVersion));
statsBuilder.setTransmissionErrors(new Counter64(queueStats.getTxErrors()));
statsBuilder.setTransmittedBytes(new Counter64(queueStats.getTxBytes()));
statsBuilder.setTransmittedPackets(new Counter64(queueStats.getTxPackets()));
DurationBuilder durationBuilder = new DurationBuilder();
durationBuilder.setSecond(new Counter32(queueStats.getDurationSec()));
durationBuilder.setNanosecond(new Counter32(queueStats.getDurationNsec()));
statsBuilder.setDuration(durationBuilder.build());
statsBuilder.setQueueId(new QueueId(queueStats.getQueueId()));
notification.getQueueIdAndStatisticsMap().add(statsBuilder.build());
}
}
return notification.build();
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.State in project openflowplugin by opendaylight.
the class Activator method onSessionInitialized.
/**
* Invoked when consumer is registered to the MD-SAL.
*/
@Override
public void onSessionInitialized(ConsumerContext session) {
LOG.info("inSessionInitialized() passing");
/**
* We create instance of our LearningSwitchManager
* and set all required dependencies,
*
* which are
* Data Broker (data storage service) - for configuring flows and reading stored switch state
* PacketProcessingService - for sending out packets
* NotificationService - for receiving notifications such as packet in.
*/
learningSwitch = new LearningSwitchManagerMultiImpl();
learningSwitch.setDataBroker(session.getSALService(DataBroker.class));
learningSwitch.setPacketProcessingService(session.getRpcService(PacketProcessingService.class));
learningSwitch.setNotificationService(session.getSALService(NotificationService.class));
learningSwitch.start();
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.State in project openflowplugin by opendaylight.
the class PortTranslatorUtil method translatePortState.
public static State translatePortState(final PortState state) {
StateBuilder nstate = new StateBuilder();
if (state != null) {
nstate.setBlocked(state.isBlocked());
nstate.setLinkDown(state.isLinkDown());
nstate.setLive(state.isLive());
}
return nstate.build();
}
use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.State in project openflowplugin by opendaylight.
the class GroupStatisticsToNotificationTransformer method transformToNotification.
/**
* Transform statistics to notification.
* @param mpReplyList raw multipart response from device
* @param deviceInfo device state
* @param emulatedTxId emulated transaction id
* @param convertorExecutor convertor executor
* @return notification containing flow stats
*/
public static GroupStatisticsUpdated transformToNotification(final List<MultipartReply> mpReplyList, final DeviceInfo deviceInfo, final TransactionId emulatedTxId, final ConvertorExecutor convertorExecutor) {
VersionConvertorData data = new VersionConvertorData(deviceInfo.getVersion());
GroupStatisticsUpdatedBuilder notification = new GroupStatisticsUpdatedBuilder();
notification.setId(deviceInfo.getNodeId());
notification.setMoreReplies(Boolean.FALSE);
notification.setTransactionId(emulatedTxId);
notification.setGroupStats(new ArrayList<>());
for (MultipartReply mpReply : mpReplyList) {
MultipartReplyGroupCase caseBody = (MultipartReplyGroupCase) mpReply.getMultipartReplyBody();
MultipartReplyGroup replyBody = caseBody.getMultipartReplyGroup();
final Optional<List<GroupStats>> groupStatsList = convertorExecutor.convert(replyBody.getGroupStats(), data);
groupStatsList.ifPresent(groupStats -> notification.getGroupStats().addAll(groupStats));
}
return notification.build();
}
Aggregations