Class GossipDeviceStore
- java.lang.Object
-
- org.onosproject.store.AbstractStore<org.onosproject.net.device.DeviceEvent,org.onosproject.net.device.DeviceStoreDelegate>
-
- org.onosproject.store.device.impl.GossipDeviceStore
-
- All Implemented Interfaces:
org.onosproject.net.device.DeviceStore,org.onosproject.store.Store<org.onosproject.net.device.DeviceEvent,org.onosproject.net.device.DeviceStoreDelegate>
public class GossipDeviceStore extends org.onosproject.store.AbstractStore<org.onosproject.net.device.DeviceEvent,org.onosproject.net.device.DeviceStoreDelegate> implements org.onosproject.net.device.DeviceStoreManages inventory of infrastructure devices using gossip protocol to distribute information.
-
-
Field Summary
Fields Modifier and Type Field Description protected org.onosproject.store.cluster.messaging.ClusterCommunicationServiceclusterCommunicatorprotected org.onosproject.cluster.ClusterServiceclusterServiceprotected org.onosproject.net.device.DeviceClockServicedeviceClockServiceprotected org.onosproject.mastership.MastershipServicemastershipServiceprotected static org.onosproject.store.service.SerializerSERIALIZERprotected org.onosproject.store.service.StorageServicestorageServiceprotected org.onosproject.mastership.MastershipTermServicetermService
-
Constructor Summary
Constructors Constructor Description GossipDeviceStore()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivate()org.onosproject.net.device.PortStatisticscalcDeltaStats(org.onosproject.net.DeviceId deviceId, org.onosproject.net.device.PortStatistics prvStats, org.onosproject.net.device.PortStatistics newStats)Calculate delta statistics by subtracting previous from new statistics.org.onosproject.net.device.DeviceEventcreateOrUpdateDevice(org.onosproject.net.provider.ProviderId providerId, org.onosproject.net.DeviceId deviceId, org.onosproject.net.device.DeviceDescription deviceDescription)voiddeactivate()intgetAvailableDeviceCount()java.lang.Iterable<org.onosproject.net.Device>getAvailableDevices()org.onosproject.net.device.PortStatisticsgetDeltaStatisticsForPort(org.onosproject.net.DeviceId deviceId, org.onosproject.net.PortNumber portNumber)org.onosproject.net.DevicegetDevice(org.onosproject.net.DeviceId deviceId)intgetDeviceCount()java.lang.Iterable<org.onosproject.net.Device>getDevices()org.onosproject.net.PortgetPort(org.onosproject.net.DeviceId deviceId, org.onosproject.net.PortNumber portNumber)java.util.List<org.onosproject.net.device.PortStatistics>getPortDeltaStatistics(org.onosproject.net.DeviceId deviceId)org.onosproject.net.device.PortDescriptiongetPortDescription(org.onosproject.net.provider.ProviderId pid, org.onosproject.net.DeviceId deviceId, org.onosproject.net.PortNumber portNumber)java.util.stream.Stream<org.onosproject.net.device.PortDescription>getPortDescriptions(org.onosproject.net.provider.ProviderId pid, org.onosproject.net.DeviceId deviceId)java.util.List<org.onosproject.net.Port>getPorts(org.onosproject.net.DeviceId deviceId)java.util.List<org.onosproject.net.device.PortStatistics>getPortStatistics(org.onosproject.net.DeviceId deviceId)org.onosproject.net.device.PortStatisticsgetStatisticsForPort(org.onosproject.net.DeviceId deviceId, org.onosproject.net.PortNumber portNumber)booleanisAvailable(org.onosproject.net.DeviceId deviceId)org.onosproject.net.device.DeviceEventmarkOffline(org.onosproject.net.DeviceId deviceId)org.onosproject.net.device.DeviceEventmarkOnline(org.onosproject.net.DeviceId deviceId)org.onosproject.net.device.DeviceEventremoveDevice(org.onosproject.net.DeviceId deviceId)java.util.List<org.onosproject.net.device.DeviceEvent>updatePorts(org.onosproject.net.provider.ProviderId providerId, org.onosproject.net.DeviceId deviceId, java.util.List<org.onosproject.net.device.PortDescription> portDescriptions)org.onosproject.net.device.DeviceEventupdatePortStatistics(org.onosproject.net.provider.ProviderId providerId, org.onosproject.net.DeviceId deviceId, java.util.Collection<org.onosproject.net.device.PortStatistics> newStatsCollection)org.onosproject.net.device.DeviceEventupdatePortStatus(org.onosproject.net.provider.ProviderId providerId, org.onosproject.net.DeviceId deviceId, org.onosproject.net.device.PortDescription portDescription)-
Methods inherited from class org.onosproject.store.AbstractStore
hasDelegate, notifyDelegate, notifyDelegate, setDelegate, unsetDelegate
-
-
-
-
Field Detail
-
deviceClockService
protected org.onosproject.net.device.DeviceClockService deviceClockService
-
storageService
protected org.onosproject.store.service.StorageService storageService
-
clusterCommunicator
protected org.onosproject.store.cluster.messaging.ClusterCommunicationService clusterCommunicator
-
clusterService
protected org.onosproject.cluster.ClusterService clusterService
-
mastershipService
protected org.onosproject.mastership.MastershipService mastershipService
-
termService
protected org.onosproject.mastership.MastershipTermService termService
-
SERIALIZER
protected static final org.onosproject.store.service.Serializer SERIALIZER
-
-
Method Detail
-
activate
public void activate()
-
deactivate
public void deactivate()
-
getDeviceCount
public int getDeviceCount()
- Specified by:
getDeviceCountin interfaceorg.onosproject.net.device.DeviceStore
-
getAvailableDeviceCount
public int getAvailableDeviceCount()
- Specified by:
getAvailableDeviceCountin interfaceorg.onosproject.net.device.DeviceStore
-
getDevices
public java.lang.Iterable<org.onosproject.net.Device> getDevices()
- Specified by:
getDevicesin interfaceorg.onosproject.net.device.DeviceStore
-
getAvailableDevices
public java.lang.Iterable<org.onosproject.net.Device> getAvailableDevices()
- Specified by:
getAvailableDevicesin interfaceorg.onosproject.net.device.DeviceStore
-
getDevice
public org.onosproject.net.Device getDevice(org.onosproject.net.DeviceId deviceId)
- Specified by:
getDevicein interfaceorg.onosproject.net.device.DeviceStore
-
createOrUpdateDevice
public org.onosproject.net.device.DeviceEvent createOrUpdateDevice(org.onosproject.net.provider.ProviderId providerId, org.onosproject.net.DeviceId deviceId, org.onosproject.net.device.DeviceDescription deviceDescription)- Specified by:
createOrUpdateDevicein interfaceorg.onosproject.net.device.DeviceStore
-
markOffline
public org.onosproject.net.device.DeviceEvent markOffline(org.onosproject.net.DeviceId deviceId)
- Specified by:
markOfflinein interfaceorg.onosproject.net.device.DeviceStore
-
markOnline
public org.onosproject.net.device.DeviceEvent markOnline(org.onosproject.net.DeviceId deviceId)
- Specified by:
markOnlinein interfaceorg.onosproject.net.device.DeviceStore
-
updatePorts
public java.util.List<org.onosproject.net.device.DeviceEvent> updatePorts(org.onosproject.net.provider.ProviderId providerId, org.onosproject.net.DeviceId deviceId, java.util.List<org.onosproject.net.device.PortDescription> portDescriptions)- Specified by:
updatePortsin interfaceorg.onosproject.net.device.DeviceStore
-
updatePortStatus
public org.onosproject.net.device.DeviceEvent updatePortStatus(org.onosproject.net.provider.ProviderId providerId, org.onosproject.net.DeviceId deviceId, org.onosproject.net.device.PortDescription portDescription)- Specified by:
updatePortStatusin interfaceorg.onosproject.net.device.DeviceStore
-
getPorts
public java.util.List<org.onosproject.net.Port> getPorts(org.onosproject.net.DeviceId deviceId)
- Specified by:
getPortsin interfaceorg.onosproject.net.device.DeviceStore
-
getPortDescriptions
public java.util.stream.Stream<org.onosproject.net.device.PortDescription> getPortDescriptions(org.onosproject.net.provider.ProviderId pid, org.onosproject.net.DeviceId deviceId)- Specified by:
getPortDescriptionsin interfaceorg.onosproject.net.device.DeviceStore
-
updatePortStatistics
public org.onosproject.net.device.DeviceEvent updatePortStatistics(org.onosproject.net.provider.ProviderId providerId, org.onosproject.net.DeviceId deviceId, java.util.Collection<org.onosproject.net.device.PortStatistics> newStatsCollection)- Specified by:
updatePortStatisticsin interfaceorg.onosproject.net.device.DeviceStore
-
calcDeltaStats
public org.onosproject.net.device.PortStatistics calcDeltaStats(org.onosproject.net.DeviceId deviceId, org.onosproject.net.device.PortStatistics prvStats, org.onosproject.net.device.PortStatistics newStats)Calculate delta statistics by subtracting previous from new statistics.- Parameters:
deviceId- device identifierprvStats- previous port statisticsnewStats- new port statistics- Returns:
- PortStatistics
-
getPortStatistics
public java.util.List<org.onosproject.net.device.PortStatistics> getPortStatistics(org.onosproject.net.DeviceId deviceId)
- Specified by:
getPortStatisticsin interfaceorg.onosproject.net.device.DeviceStore
-
getStatisticsForPort
public org.onosproject.net.device.PortStatistics getStatisticsForPort(org.onosproject.net.DeviceId deviceId, org.onosproject.net.PortNumber portNumber)- Specified by:
getStatisticsForPortin interfaceorg.onosproject.net.device.DeviceStore
-
getPortDeltaStatistics
public java.util.List<org.onosproject.net.device.PortStatistics> getPortDeltaStatistics(org.onosproject.net.DeviceId deviceId)
- Specified by:
getPortDeltaStatisticsin interfaceorg.onosproject.net.device.DeviceStore
-
getDeltaStatisticsForPort
public org.onosproject.net.device.PortStatistics getDeltaStatisticsForPort(org.onosproject.net.DeviceId deviceId, org.onosproject.net.PortNumber portNumber)- Specified by:
getDeltaStatisticsForPortin interfaceorg.onosproject.net.device.DeviceStore
-
getPort
public org.onosproject.net.Port getPort(org.onosproject.net.DeviceId deviceId, org.onosproject.net.PortNumber portNumber)- Specified by:
getPortin interfaceorg.onosproject.net.device.DeviceStore
-
getPortDescription
public org.onosproject.net.device.PortDescription getPortDescription(org.onosproject.net.provider.ProviderId pid, org.onosproject.net.DeviceId deviceId, org.onosproject.net.PortNumber portNumber)- Specified by:
getPortDescriptionin interfaceorg.onosproject.net.device.DeviceStore
-
isAvailable
public boolean isAvailable(org.onosproject.net.DeviceId deviceId)
- Specified by:
isAvailablein interfaceorg.onosproject.net.device.DeviceStore
-
removeDevice
public org.onosproject.net.device.DeviceEvent removeDevice(org.onosproject.net.DeviceId deviceId)
- Specified by:
removeDevicein interfaceorg.onosproject.net.device.DeviceStore
-
-