Thomas Vachuska
Committed by Gerrit Code Review

Adding multi-instance support for flow stats.

Change-Id: I428c5a7cb58f4f9773a125fc94fb368ed846cb0d
...@@ -61,6 +61,22 @@ public final class DefaultPortStatistics implements PortStatistics { ...@@ -61,6 +61,22 @@ public final class DefaultPortStatistics implements PortStatistics {
61 this.durationNano = durationNano; 61 this.durationNano = durationNano;
62 } 62 }
63 63
64 + // Constructor for serializer
65 + private DefaultPortStatistics() {
66 + this.deviceId = null;
67 + this.port = 0;
68 + this.packetsReceived = 0;
69 + this.packetsSent = 0;
70 + this.bytesReceived = 0;
71 + this.bytesSent = 0;
72 + this.packetsRxDropped = 0;
73 + this.packetsTxDropped = 0;
74 + this.packetsRxErrors = 0;
75 + this.packetsTxErrors = 0;
76 + this.durationSec = 0;
77 + this.durationNano = 0;
78 + }
79 +
64 /** 80 /**
65 * Creates a builder for DefaultPortStatistics object. 81 * Creates a builder for DefaultPortStatistics object.
66 * 82 *
......
...@@ -55,6 +55,7 @@ import org.onosproject.store.cluster.messaging.ClusterCommunicationService; ...@@ -55,6 +55,7 @@ import org.onosproject.store.cluster.messaging.ClusterCommunicationService;
55 import org.onosproject.store.cluster.messaging.ClusterMessage; 55 import org.onosproject.store.cluster.messaging.ClusterMessage;
56 import org.onosproject.store.cluster.messaging.ClusterMessageHandler; 56 import org.onosproject.store.cluster.messaging.ClusterMessageHandler;
57 import org.onosproject.store.cluster.messaging.MessageSubject; 57 import org.onosproject.store.cluster.messaging.MessageSubject;
58 +import org.onosproject.store.consistent.impl.DatabaseManager;
58 59
59 import java.io.IOException; 60 import java.io.IOException;
60 import java.util.Arrays; 61 import java.util.Arrays;
...@@ -157,7 +158,7 @@ public class GossipDeviceStoreTest { ...@@ -157,7 +158,7 @@ public class GossipDeviceStoreTest {
157 158
158 clusterCommunicator = createNiceMock(ClusterCommunicationService.class); 159 clusterCommunicator = createNiceMock(ClusterCommunicationService.class);
159 clusterCommunicator.addSubscriber(anyObject(MessageSubject.class), 160 clusterCommunicator.addSubscriber(anyObject(MessageSubject.class),
160 - anyObject(ClusterMessageHandler.class), anyObject(ExecutorService.class)); 161 + anyObject(ClusterMessageHandler.class), anyObject(ExecutorService.class));
161 expectLastCall().anyTimes(); 162 expectLastCall().anyTimes();
162 replay(clusterCommunicator); 163 replay(clusterCommunicator);
163 ClusterService clusterService = new TestClusterService(); 164 ClusterService clusterService = new TestClusterService();
...@@ -165,6 +166,10 @@ public class GossipDeviceStoreTest { ...@@ -165,6 +166,10 @@ public class GossipDeviceStoreTest {
165 testGossipDeviceStore = new TestGossipDeviceStore(deviceClockService, clusterService, clusterCommunicator); 166 testGossipDeviceStore = new TestGossipDeviceStore(deviceClockService, clusterService, clusterCommunicator);
166 testGossipDeviceStore.mastershipService = new TestMastershipService(); 167 testGossipDeviceStore.mastershipService = new TestMastershipService();
167 168
169 + TestDatabaseManager testDatabaseManager = new TestDatabaseManager();
170 + testDatabaseManager.init(clusterService, clusterCommunicator);
171 + testGossipDeviceStore.storageService = testDatabaseManager;
172 +
168 gossipDeviceStore = testGossipDeviceStore; 173 gossipDeviceStore = testGossipDeviceStore;
169 gossipDeviceStore.activate(); 174 gossipDeviceStore.activate();
170 deviceStore = gossipDeviceStore; 175 deviceStore = gossipDeviceStore;
...@@ -885,4 +890,12 @@ public class GossipDeviceStoreTest { ...@@ -885,4 +890,12 @@ public class GossipDeviceStoreTest {
885 nodeStates.put(NID2, ACTIVE); 890 nodeStates.put(NID2, ACTIVE);
886 } 891 }
887 } 892 }
893 +
894 + private class TestDatabaseManager extends DatabaseManager {
895 + void init(ClusterService clusterService,
896 + ClusterCommunicationService clusterCommunicator) {
897 + this.clusterService = clusterService;
898 + this.clusterCommunicator = clusterCommunicator;
899 + }
900 + }
888 } 901 }
......
...@@ -71,9 +71,11 @@ import org.onosproject.net.Port; ...@@ -71,9 +71,11 @@ import org.onosproject.net.Port;
71 import org.onosproject.net.PortNumber; 71 import org.onosproject.net.PortNumber;
72 import org.onosproject.net.device.DefaultDeviceDescription; 72 import org.onosproject.net.device.DefaultDeviceDescription;
73 import org.onosproject.net.device.DefaultPortDescription; 73 import org.onosproject.net.device.DefaultPortDescription;
74 +import org.onosproject.net.device.DefaultPortStatistics;
74 import org.onosproject.net.device.OchPortDescription; 75 import org.onosproject.net.device.OchPortDescription;
75 import org.onosproject.net.device.OduCltPortDescription; 76 import org.onosproject.net.device.OduCltPortDescription;
76 import org.onosproject.net.device.OmsPortDescription; 77 import org.onosproject.net.device.OmsPortDescription;
78 +import org.onosproject.net.device.PortStatistics;
77 import org.onosproject.net.flow.CompletedBatchOperation; 79 import org.onosproject.net.flow.CompletedBatchOperation;
78 import org.onosproject.net.flow.DefaultFlowEntry; 80 import org.onosproject.net.flow.DefaultFlowEntry;
79 import org.onosproject.net.flow.DefaultFlowRule; 81 import org.onosproject.net.flow.DefaultFlowRule;
...@@ -380,7 +382,9 @@ public final class KryoNamespaces { ...@@ -380,7 +382,9 @@ public final class KryoNamespaces {
380 IntentOperation.class, 382 IntentOperation.class,
381 FlowRuleExtPayLoad.class, 383 FlowRuleExtPayLoad.class,
382 Frequency.class, 384 Frequency.class,
383 - DefaultAnnotations.class 385 + DefaultAnnotations.class,
386 + PortStatistics.class,
387 + DefaultPortStatistics.class
384 ) 388 )
385 .register(new DefaultApplicationIdSerializer(), DefaultApplicationId.class) 389 .register(new DefaultApplicationIdSerializer(), DefaultApplicationId.class)
386 .register(new URISerializer(), URI.class) 390 .register(new URISerializer(), URI.class)
......
...@@ -14,7 +14,7 @@ cut -c7- $aux | cut -d\ -f1 | sort > $aux.1 ...@@ -14,7 +14,7 @@ cut -c7- $aux | cut -d\ -f1 | sort > $aux.1
14 14
15 # Normalize the expected apps 15 # Normalize the expected apps
16 apps=${ONOS_APPS:-drivers,openflow} 16 apps=${ONOS_APPS:-drivers,openflow}
17 -(for app in ${apps/,/ }; do echo org.onosproject.$app; done) | sort > $aux.2 17 +(for app in ${apps//,/ }; do echo org.onosproject.$app; done) | sort > $aux.2
18 18
19 # Check for differences 19 # Check for differences
20 diff $aux.1 $aux.2 20 diff $aux.1 $aux.2
......
1 +# Madan's ProxMox ONOS instances 1,2,3 & ONOS mininet box
2 +
3 +export ONOS_NIC="10.128.4.*"
4 +export OC1="10.128.4.2"
5 +export OC2="10.128.4.3"
6 +export OC3="10.128.4.4"
7 +export OCN="10.128.4.5"
1 -# Office ProxMox ONOS instances 1,2,3 & ONOS mininet box 1 +# Tom's ProxMox ONOS instances 1,2,3 & ONOS mininet box
2 2
3 -export ONOS_NIC=10.128.11.* 3 +export ONOS_NIC="10.128.11.*"
4 export OC1="10.128.11.1" 4 export OC1="10.128.11.1"
5 export OC2="10.128.11.2" 5 export OC2="10.128.11.2"
6 export OC3="10.128.11.3" 6 export OC3="10.128.11.3"
......
...@@ -850,7 +850,7 @@ public abstract class TopologyViewMessageHandlerBase extends UiMessageHandler { ...@@ -850,7 +850,7 @@ public abstract class TopologyViewMessageHandlerBase extends UiMessageHandler {
850 if (load != null) { 850 if (load != null) {
851 this.hasTraffic = hasTraffic || load.rate() > threshold; 851 this.hasTraffic = hasTraffic || load.rate() > threshold;
852 this.bytes += load.latest(); 852 this.bytes += load.latest();
853 - this.rate = load.rate(); 853 + this.rate += load.rate();
854 } 854 }
855 } 855 }
856 856
......