Thomas Vachuska

Merge remote-tracking branch 'origin/master'

1 package org.onlab.onos.fwd; 1 package org.onlab.onos.fwd;
2 2
3 +import static org.slf4j.LoggerFactory.getLogger;
4 +
5 +import java.util.Dictionary;
6 +import java.util.Set;
7 +
3 import org.apache.felix.scr.annotations.Activate; 8 import org.apache.felix.scr.annotations.Activate;
4 import org.apache.felix.scr.annotations.Component; 9 import org.apache.felix.scr.annotations.Component;
5 import org.apache.felix.scr.annotations.Deactivate; 10 import org.apache.felix.scr.annotations.Deactivate;
...@@ -30,11 +35,6 @@ import org.onlab.packet.Ethernet; ...@@ -30,11 +35,6 @@ import org.onlab.packet.Ethernet;
30 import org.osgi.service.component.ComponentContext; 35 import org.osgi.service.component.ComponentContext;
31 import org.slf4j.Logger; 36 import org.slf4j.Logger;
32 37
33 -import java.util.Dictionary;
34 -import java.util.Set;
35 -
36 -import static org.slf4j.LoggerFactory.getLogger;
37 -
38 /** 38 /**
39 * Sample reactive forwarding application. 39 * Sample reactive forwarding application.
40 */ 40 */
...@@ -206,7 +206,7 @@ public class ReactiveForwarding { ...@@ -206,7 +206,7 @@ public class ReactiveForwarding {
206 treat.setOutput(portNumber); 206 treat.setOutput(portNumber);
207 207
208 FlowRule f = new DefaultFlowRule(context.inPacket().receivedFrom().deviceId(), 208 FlowRule f = new DefaultFlowRule(context.inPacket().receivedFrom().deviceId(),
209 - builder.build(), treat.build(), PRIORITY, appId, TIMEOUT); 209 + builder.build(), treat.build(), PRIORITY, appId, TIMEOUT, false);
210 210
211 flowRuleService.applyFlowRules(f); 211 flowRuleService.applyFlowRules(f);
212 } 212 }
......
...@@ -21,7 +21,7 @@ import org.onlab.onos.net.device.DeviceService; ...@@ -21,7 +21,7 @@ import org.onlab.onos.net.device.DeviceService;
21 description = "Lists mastership roles of nodes for each device.") 21 description = "Lists mastership roles of nodes for each device.")
22 public class RolesCommand extends AbstractShellCommand { 22 public class RolesCommand extends AbstractShellCommand {
23 23
24 - private static final String FMT_HDR = "%s: master=%s, standbys=%s"; 24 + private static final String FMT_HDR = "%s: master=%s, standbys=[ %s]";
25 25
26 @Override 26 @Override
27 protected void execute() { 27 protected void execute() {
......
...@@ -3,10 +3,11 @@ package org.onlab.onos.cluster; ...@@ -3,10 +3,11 @@ package org.onlab.onos.cluster;
3 import java.util.List; 3 import java.util.List;
4 import java.util.Objects; 4 import java.util.Objects;
5 5
6 +import com.google.common.base.MoreObjects;
6 import com.google.common.collect.ImmutableList; 7 import com.google.common.collect.ImmutableList;
7 8
8 /** 9 /**
9 - * A container for detailed role information for a device, 10 + * An immutable container for role information for a device,
10 * within the current cluster. Role attributes include current 11 * within the current cluster. Role attributes include current
11 * master and a preference-ordered list of backup nodes. 12 * master and a preference-ordered list of backup nodes.
12 */ 13 */
...@@ -52,12 +53,9 @@ public class RoleInfo { ...@@ -52,12 +53,9 @@ public class RoleInfo {
52 53
53 @Override 54 @Override
54 public String toString() { 55 public String toString() {
55 - final StringBuilder builder = new StringBuilder(); 56 + return MoreObjects.toStringHelper(this.getClass())
56 - builder.append("master:").append(master).append(","); 57 + .add("master", master)
57 - builder.append("backups:"); 58 + .add("backups", backups)
58 - for (NodeId n : backups) { 59 + .toString();
59 - builder.append(" ").append(n);
60 - }
61 - return builder.toString();
62 } 60 }
63 } 61 }
......
1 package org.onlab.onos.mastership; 1 package org.onlab.onos.mastership;
2 2
3 import org.onlab.onos.cluster.NodeId; 3 import org.onlab.onos.cluster.NodeId;
4 +import org.onlab.onos.cluster.RoleInfo;
4 import org.onlab.onos.event.AbstractEvent; 5 import org.onlab.onos.event.AbstractEvent;
5 import org.onlab.onos.net.DeviceId; 6 import org.onlab.onos.net.DeviceId;
6 7
...@@ -9,9 +10,8 @@ import org.onlab.onos.net.DeviceId; ...@@ -9,9 +10,8 @@ import org.onlab.onos.net.DeviceId;
9 */ 10 */
10 public class MastershipEvent extends AbstractEvent<MastershipEvent.Type, DeviceId> { 11 public class MastershipEvent extends AbstractEvent<MastershipEvent.Type, DeviceId> {
11 12
12 - //do we worry about explicitly setting slaves/equals? probably not, 13 + //Contains master and standby information.
13 - //to keep it simple 14 + RoleInfo roleInfo;
14 - NodeId node;
15 15
16 /** 16 /**
17 * Type of mastership events. 17 * Type of mastership events.
...@@ -29,16 +29,16 @@ public class MastershipEvent extends AbstractEvent<MastershipEvent.Type, DeviceI ...@@ -29,16 +29,16 @@ public class MastershipEvent extends AbstractEvent<MastershipEvent.Type, DeviceI
29 } 29 }
30 30
31 /** 31 /**
32 - * Creates an event of a given type and for the specified device, master, 32 + * Creates an event of a given type and for the specified device,
33 - * and the current time. 33 + * role information, and the current time.
34 * 34 *
35 * @param type device event type 35 * @param type device event type
36 * @param device event device subject 36 * @param device event device subject
37 - * @param node master ID subject 37 + * @param info mastership role information subject
38 */ 38 */
39 - public MastershipEvent(Type type, DeviceId device, NodeId node) { 39 + public MastershipEvent(Type type, DeviceId device, RoleInfo info) {
40 super(type, device); 40 super(type, device);
41 - this.node = node; 41 + this.roleInfo = info;
42 } 42 }
43 43
44 /** 44 /**
...@@ -50,9 +50,9 @@ public class MastershipEvent extends AbstractEvent<MastershipEvent.Type, DeviceI ...@@ -50,9 +50,9 @@ public class MastershipEvent extends AbstractEvent<MastershipEvent.Type, DeviceI
50 * @param master master ID subject 50 * @param master master ID subject
51 * @param time occurrence time 51 * @param time occurrence time
52 */ 52 */
53 - public MastershipEvent(Type type, DeviceId device, NodeId master, long time) { 53 + public MastershipEvent(Type type, DeviceId device, RoleInfo info, long time) {
54 super(type, device, time); 54 super(type, device, time);
55 - this.node = master; 55 + this.roleInfo = info;
56 } 56 }
57 57
58 /** 58 /**
...@@ -63,7 +63,17 @@ public class MastershipEvent extends AbstractEvent<MastershipEvent.Type, DeviceI ...@@ -63,7 +63,17 @@ public class MastershipEvent extends AbstractEvent<MastershipEvent.Type, DeviceI
63 * 63 *
64 * @return node ID as a subject 64 * @return node ID as a subject
65 */ 65 */
66 + //XXX to-be removed - or keep for convenience?
66 public NodeId node() { 67 public NodeId node() {
67 - return node; 68 + return roleInfo.master();
69 + }
70 +
71 + /**
72 + * Returns the current role state for the subject.
73 + *
74 + * @return RoleInfo associated with Device ID subject
75 + */
76 + public RoleInfo roleInfo() {
77 + return roleInfo;
68 } 78 }
69 } 79 }
......
...@@ -27,7 +27,7 @@ public class DefaultFlowEntry extends DefaultFlowRule ...@@ -27,7 +27,7 @@ public class DefaultFlowEntry extends DefaultFlowRule
27 TrafficTreatment treatment, int priority, FlowEntryState state, 27 TrafficTreatment treatment, int priority, FlowEntryState state,
28 long life, long packets, long bytes, long flowId, 28 long life, long packets, long bytes, long flowId,
29 int timeout) { 29 int timeout) {
30 - super(deviceId, selector, treatment, priority, flowId, timeout); 30 + super(deviceId, selector, treatment, priority, flowId, timeout, false);
31 this.state = state; 31 this.state = state;
32 this.life = life; 32 this.life = life;
33 this.packets = packets; 33 this.packets = packets;
......
...@@ -24,16 +24,18 @@ public class DefaultFlowRule implements FlowRule { ...@@ -24,16 +24,18 @@ public class DefaultFlowRule implements FlowRule {
24 private final short appId; 24 private final short appId;
25 25
26 private final int timeout; 26 private final int timeout;
27 + private final boolean permanent;
27 28
28 29
29 public DefaultFlowRule(DeviceId deviceId, TrafficSelector selector, 30 public DefaultFlowRule(DeviceId deviceId, TrafficSelector selector,
30 TrafficTreatment treatment, int priority, long flowId, 31 TrafficTreatment treatment, int priority, long flowId,
31 - int timeout) { 32 + int timeout, boolean permanent) {
32 this.deviceId = deviceId; 33 this.deviceId = deviceId;
33 this.priority = priority; 34 this.priority = priority;
34 this.selector = selector; 35 this.selector = selector;
35 this.treatment = treatment; 36 this.treatment = treatment;
36 this.timeout = timeout; 37 this.timeout = timeout;
38 + this.permanent = permanent;
37 this.created = System.currentTimeMillis(); 39 this.created = System.currentTimeMillis();
38 40
39 this.appId = (short) (flowId >>> 48); 41 this.appId = (short) (flowId >>> 48);
...@@ -42,7 +44,7 @@ public class DefaultFlowRule implements FlowRule { ...@@ -42,7 +44,7 @@ public class DefaultFlowRule implements FlowRule {
42 44
43 public DefaultFlowRule(DeviceId deviceId, TrafficSelector selector, 45 public DefaultFlowRule(DeviceId deviceId, TrafficSelector selector,
44 TrafficTreatment treatement, int priority, ApplicationId appId, 46 TrafficTreatment treatement, int priority, ApplicationId appId,
45 - int timeout) { 47 + int timeout, boolean permanent) {
46 48
47 if (priority < FlowRule.MIN_PRIORITY) { 49 if (priority < FlowRule.MIN_PRIORITY) {
48 throw new IllegalArgumentException("Priority cannot be less than " + MIN_PRIORITY); 50 throw new IllegalArgumentException("Priority cannot be less than " + MIN_PRIORITY);
...@@ -54,6 +56,7 @@ public class DefaultFlowRule implements FlowRule { ...@@ -54,6 +56,7 @@ public class DefaultFlowRule implements FlowRule {
54 this.treatment = treatement; 56 this.treatment = treatement;
55 this.appId = appId.id(); 57 this.appId = appId.id();
56 this.timeout = timeout; 58 this.timeout = timeout;
59 + this.permanent = permanent;
57 this.created = System.currentTimeMillis(); 60 this.created = System.currentTimeMillis();
58 61
59 this.id = FlowId.valueOf((((long) this.appId) << 48) | (this.hash() & 0x0000ffffffffL)); 62 this.id = FlowId.valueOf((((long) this.appId) << 48) | (this.hash() & 0x0000ffffffffL));
...@@ -67,6 +70,7 @@ public class DefaultFlowRule implements FlowRule { ...@@ -67,6 +70,7 @@ public class DefaultFlowRule implements FlowRule {
67 this.appId = rule.appId(); 70 this.appId = rule.appId();
68 this.id = rule.id(); 71 this.id = rule.id();
69 this.timeout = rule.timeout(); 72 this.timeout = rule.timeout();
73 + this.permanent = rule.isPermanent();
70 this.created = System.currentTimeMillis(); 74 this.created = System.currentTimeMillis();
71 75
72 } 76 }
...@@ -157,4 +161,9 @@ public class DefaultFlowRule implements FlowRule { ...@@ -157,4 +161,9 @@ public class DefaultFlowRule implements FlowRule {
157 return timeout; 161 return timeout;
158 } 162 }
159 163
164 + @Override
165 + public boolean isPermanent() {
166 + return permanent;
167 + }
168 +
160 } 169 }
......
...@@ -59,8 +59,16 @@ public interface FlowRule extends BatchOperationTarget { ...@@ -59,8 +59,16 @@ public interface FlowRule extends BatchOperationTarget {
59 59
60 /** 60 /**
61 * Returns the timeout for this flow requested by an application. 61 * Returns the timeout for this flow requested by an application.
62 + *
62 * @return integer value of the timeout 63 * @return integer value of the timeout
63 */ 64 */
64 int timeout(); 65 int timeout();
65 66
67 + /**
68 + * Returns whether the flow is permanent i.e. does not time out.
69 + *
70 + * @return true if the flow is permanent, otherwise false
71 + */
72 + boolean isPermanent();
73 +
66 } 74 }
......
...@@ -327,6 +327,10 @@ public class FlowRuleManager ...@@ -327,6 +327,10 @@ public class FlowRuleManager
327 if (storedRule == null) { 327 if (storedRule == null) {
328 return false; 328 return false;
329 } 329 }
330 + if (storedRule.isPermanent()) {
331 + return true;
332 + }
333 +
330 final long timeout = storedRule.timeout() * 1000; 334 final long timeout = storedRule.timeout() * 1000;
331 final long currentTime = System.currentTimeMillis(); 335 final long currentTime = System.currentTimeMillis();
332 if (storedRule.packets() != swRule.packets()) { 336 if (storedRule.packets() != swRule.packets()) {
......
...@@ -117,7 +117,7 @@ public class LinkCollectionIntentInstaller implements IntentInstaller<LinkCollec ...@@ -117,7 +117,7 @@ public class LinkCollectionIntentInstaller implements IntentInstaller<LinkCollec
117 TrafficTreatment treatment = builder().setOutput(outPort).build(); 117 TrafficTreatment treatment = builder().setOutput(outPort).build();
118 118
119 FlowRule rule = new DefaultFlowRule(deviceId, 119 FlowRule rule = new DefaultFlowRule(deviceId,
120 - selector, treatment, 123, appId, 600); 120 + selector, treatment, 123, appId, 0, true);
121 121
122 return new FlowRuleBatchEntry(operation, rule); 122 return new FlowRuleBatchEntry(operation, rule);
123 } 123 }
......
...@@ -73,7 +73,7 @@ public class PathIntentInstaller implements IntentInstaller<PathIntent> { ...@@ -73,7 +73,7 @@ public class PathIntentInstaller implements IntentInstaller<PathIntent> {
73 73
74 FlowRule rule = new DefaultFlowRule(link.src().deviceId(), 74 FlowRule rule = new DefaultFlowRule(link.src().deviceId(),
75 builder.build(), treatment, 75 builder.build(), treatment,
76 - 123, appId, 15); 76 + 123, appId, 0, true);
77 rules.add(new FlowRuleBatchEntry(FlowRuleOperation.ADD, rule)); 77 rules.add(new FlowRuleBatchEntry(FlowRuleOperation.ADD, rule));
78 prev = link.dst(); 78 prev = link.dst();
79 } 79 }
...@@ -95,7 +95,7 @@ public class PathIntentInstaller implements IntentInstaller<PathIntent> { ...@@ -95,7 +95,7 @@ public class PathIntentInstaller implements IntentInstaller<PathIntent> {
95 .setOutput(link.src().port()).build(); 95 .setOutput(link.src().port()).build();
96 FlowRule rule = new DefaultFlowRule(link.src().deviceId(), 96 FlowRule rule = new DefaultFlowRule(link.src().deviceId(),
97 builder.build(), treatment, 97 builder.build(), treatment,
98 - 123, appId, 600); 98 + 123, appId, 0, true);
99 rules.add(new FlowRuleBatchEntry(FlowRuleOperation.REMOVE, rule)); 99 rules.add(new FlowRuleBatchEntry(FlowRuleOperation.REMOVE, rule));
100 prev = link.dst(); 100 prev = link.dst();
101 } 101 }
......
1 package org.onlab.onos.net.flow.impl; 1 package org.onlab.onos.net.flow.impl;
2 2
3 import static java.util.Collections.EMPTY_LIST; 3 import static java.util.Collections.EMPTY_LIST;
4 -import static org.junit.Assert.*; 4 +import static org.junit.Assert.assertEquals;
5 +import static org.junit.Assert.assertFalse;
6 +import static org.junit.Assert.assertNotNull;
7 +import static org.junit.Assert.assertTrue;
8 +import static org.junit.Assert.fail;
5 import static org.onlab.onos.net.flow.FlowRuleEvent.Type.RULE_ADDED; 9 import static org.onlab.onos.net.flow.FlowRuleEvent.Type.RULE_ADDED;
6 import static org.onlab.onos.net.flow.FlowRuleEvent.Type.RULE_REMOVED; 10 import static org.onlab.onos.net.flow.FlowRuleEvent.Type.RULE_REMOVED;
7 import static org.onlab.onos.net.flow.FlowRuleEvent.Type.RULE_UPDATED; 11 import static org.onlab.onos.net.flow.FlowRuleEvent.Type.RULE_UPDATED;
...@@ -115,7 +119,7 @@ public class FlowRuleManagerTest { ...@@ -115,7 +119,7 @@ public class FlowRuleManagerTest {
115 private FlowRule flowRule(int tsval, int trval) { 119 private FlowRule flowRule(int tsval, int trval) {
116 TestSelector ts = new TestSelector(tsval); 120 TestSelector ts = new TestSelector(tsval);
117 TestTreatment tr = new TestTreatment(trval); 121 TestTreatment tr = new TestTreatment(trval);
118 - return new DefaultFlowRule(DID, ts, tr, 10, appId, TIMEOUT); 122 + return new DefaultFlowRule(DID, ts, tr, 10, appId, TIMEOUT, false);
119 } 123 }
120 124
121 125
......
...@@ -5,6 +5,7 @@ import static org.junit.Assert.*; ...@@ -5,6 +5,7 @@ import static org.junit.Assert.*;
5 5
6 import java.util.Collections; 6 import java.util.Collections;
7 import java.util.Map; 7 import java.util.Map;
8 +import java.util.LinkedList;
8 import java.util.concurrent.CountDownLatch; 9 import java.util.concurrent.CountDownLatch;
9 import java.util.concurrent.TimeUnit; 10 import java.util.concurrent.TimeUnit;
10 11
...@@ -12,6 +13,7 @@ import org.junit.After; ...@@ -12,6 +13,7 @@ import org.junit.After;
12 import org.junit.Before; 13 import org.junit.Before;
13 import org.junit.Test; 14 import org.junit.Test;
14 import org.onlab.onos.cluster.NodeId; 15 import org.onlab.onos.cluster.NodeId;
16 +import org.onlab.onos.cluster.RoleInfo;
15 import org.onlab.onos.event.AbstractListenerRegistry; 17 import org.onlab.onos.event.AbstractListenerRegistry;
16 import org.onlab.onos.event.DefaultEventSinkRegistry; 18 import org.onlab.onos.event.DefaultEventSinkRegistry;
17 import org.onlab.onos.event.Event; 19 import org.onlab.onos.event.Event;
...@@ -87,7 +89,8 @@ public class ReplicaInfoManagerTest { ...@@ -87,7 +89,8 @@ public class ReplicaInfoManagerTest {
87 service.addListener(new MasterNodeCheck(latch, DID1, NID1)); 89 service.addListener(new MasterNodeCheck(latch, DID1, NID1));
88 90
89 // fake MastershipEvent 91 // fake MastershipEvent
90 - eventDispatcher.post(new MastershipEvent(Type.MASTER_CHANGED, DID1, NID1)); 92 + eventDispatcher.post(new MastershipEvent(Type.MASTER_CHANGED, DID1,
93 + new RoleInfo(NID1, new LinkedList<NodeId>())));
91 94
92 assertTrue(latch.await(1, TimeUnit.SECONDS)); 95 assertTrue(latch.await(1, TimeUnit.SECONDS));
93 } 96 }
......
...@@ -136,13 +136,13 @@ implements MastershipStore { ...@@ -136,13 +136,13 @@ implements MastershipStore {
136 rv.reassign(nodeId, STANDBY, NONE); 136 rv.reassign(nodeId, STANDBY, NONE);
137 roleMap.put(deviceId, rv); 137 roleMap.put(deviceId, rv);
138 updateTerm(deviceId); 138 updateTerm(deviceId);
139 - return new MastershipEvent(MASTER_CHANGED, deviceId, nodeId); 139 + return new MastershipEvent(MASTER_CHANGED, deviceId, rv.roleInfo());
140 case NONE: 140 case NONE:
141 rv.add(MASTER, nodeId); 141 rv.add(MASTER, nodeId);
142 rv.reassign(nodeId, STANDBY, NONE); 142 rv.reassign(nodeId, STANDBY, NONE);
143 roleMap.put(deviceId, rv); 143 roleMap.put(deviceId, rv);
144 updateTerm(deviceId); 144 updateTerm(deviceId);
145 - return new MastershipEvent(MASTER_CHANGED, deviceId, nodeId); 145 + return new MastershipEvent(MASTER_CHANGED, deviceId, rv.roleInfo());
146 default: 146 default:
147 log.warn("unknown Mastership Role {}", role); 147 log.warn("unknown Mastership Role {}", role);
148 return null; 148 return null;
...@@ -306,7 +306,7 @@ implements MastershipStore { ...@@ -306,7 +306,7 @@ implements MastershipStore {
306 roleMap.put(deviceId, rv); 306 roleMap.put(deviceId, rv);
307 Integer term = terms.get(deviceId); 307 Integer term = terms.get(deviceId);
308 terms.put(deviceId, ++term); 308 terms.put(deviceId, ++term);
309 - return new MastershipEvent(MASTER_CHANGED, deviceId, backup); 309 + return new MastershipEvent(MASTER_CHANGED, deviceId, rv.roleInfo());
310 } 310 }
311 } 311 }
312 312
...@@ -373,7 +373,7 @@ implements MastershipStore { ...@@ -373,7 +373,7 @@ implements MastershipStore {
373 return; 373 return;
374 } 374 }
375 notifyDelegate(new MastershipEvent( 375 notifyDelegate(new MastershipEvent(
376 - MASTER_CHANGED, event.getKey(), event.getValue().get(MASTER))); 376 + MASTER_CHANGED, event.getKey(), event.getValue().roleInfo()));
377 } 377 }
378 378
379 @Override 379 @Override
......
...@@ -10,6 +10,9 @@ import org.onlab.onos.cluster.NodeId; ...@@ -10,6 +10,9 @@ import org.onlab.onos.cluster.NodeId;
10 import org.onlab.onos.cluster.RoleInfo; 10 import org.onlab.onos.cluster.RoleInfo;
11 import org.onlab.onos.net.MastershipRole; 11 import org.onlab.onos.net.MastershipRole;
12 12
13 +import com.google.common.base.MoreObjects;
14 +import com.google.common.base.MoreObjects.ToStringHelper;
15 +
13 /** 16 /**
14 * A structure that holds node mastership roles associated with a 17 * A structure that holds node mastership roles associated with a
15 * {@link DeviceId}. This structure needs to be locked through IMap. 18 * {@link DeviceId}. This structure needs to be locked through IMap.
...@@ -109,14 +112,10 @@ public class RoleValue { ...@@ -109,14 +112,10 @@ public class RoleValue {
109 112
110 @Override 113 @Override
111 public String toString() { 114 public String toString() {
112 - final StringBuilder builder = new StringBuilder(); 115 + ToStringHelper helper = MoreObjects.toStringHelper(this.getClass());
113 for (Map.Entry<MastershipRole, List<NodeId>> el : value.entrySet()) { 116 for (Map.Entry<MastershipRole, List<NodeId>> el : value.entrySet()) {
114 - builder.append(el.getKey().toString()).append(": ["); 117 + helper.add(el.getKey().toString(), el.getValue());
115 - for (NodeId n : el.getValue()) {
116 - builder.append(n);
117 - }
118 - builder.append("]\n");
119 } 118 }
120 - return builder.toString(); 119 + return helper.toString();
121 } 120 }
122 } 121 }
......
...@@ -29,6 +29,8 @@ import org.onlab.onos.store.AbstractStore; ...@@ -29,6 +29,8 @@ import org.onlab.onos.store.AbstractStore;
29 import org.onlab.packet.IpPrefix; 29 import org.onlab.packet.IpPrefix;
30 import org.slf4j.Logger; 30 import org.slf4j.Logger;
31 31
32 +import com.google.common.collect.Lists;
33 +
32 import static org.onlab.onos.mastership.MastershipEvent.Type.*; 34 import static org.onlab.onos.mastership.MastershipEvent.Type.*;
33 35
34 /** 36 /**
...@@ -89,7 +91,8 @@ public class SimpleMastershipStore ...@@ -89,7 +91,8 @@ public class SimpleMastershipStore
89 } 91 }
90 } 92 }
91 93
92 - return new MastershipEvent(MASTER_CHANGED, deviceId, nodeId); 94 + return new MastershipEvent(MASTER_CHANGED, deviceId,
95 + new RoleInfo(nodeId, Lists.newLinkedList(backups)));
93 } 96 }
94 97
95 @Override 98 @Override
...@@ -196,7 +199,8 @@ public class SimpleMastershipStore ...@@ -196,7 +199,8 @@ public class SimpleMastershipStore
196 } else { 199 } else {
197 masterMap.put(deviceId, backup); 200 masterMap.put(deviceId, backup);
198 termMap.get(deviceId).incrementAndGet(); 201 termMap.get(deviceId).incrementAndGet();
199 - return new MastershipEvent(MASTER_CHANGED, deviceId, backup); 202 + return new MastershipEvent(MASTER_CHANGED, deviceId,
203 + new RoleInfo(backup, Lists.newLinkedList(backups)));
200 } 204 }
201 case STANDBY: 205 case STANDBY:
202 case NONE: 206 case NONE:
......
...@@ -78,7 +78,7 @@ public class FlowEntryBuilder { ...@@ -78,7 +78,7 @@ public class FlowEntryBuilder {
78 if (addedRule) { 78 if (addedRule) {
79 FlowRule rule = new DefaultFlowRule(DeviceId.deviceId(Dpid.uri(dpid)), 79 FlowRule rule = new DefaultFlowRule(DeviceId.deviceId(Dpid.uri(dpid)),
80 buildSelector(), buildTreatment(), stat.getPriority(), 80 buildSelector(), buildTreatment(), stat.getPriority(),
81 - stat.getCookie().getValue(), stat.getIdleTimeout()); 81 + stat.getCookie().getValue(), stat.getIdleTimeout(), false);
82 return new DefaultFlowEntry(rule, FlowEntryState.ADDED, 82 return new DefaultFlowEntry(rule, FlowEntryState.ADDED,
83 stat.getDurationSec(), stat.getPacketCount().getValue(), 83 stat.getDurationSec(), stat.getPacketCount().getValue(),
84 stat.getByteCount().getValue()); 84 stat.getByteCount().getValue());
...@@ -86,7 +86,7 @@ public class FlowEntryBuilder { ...@@ -86,7 +86,7 @@ public class FlowEntryBuilder {
86 } else { 86 } else {
87 FlowRule rule = new DefaultFlowRule(DeviceId.deviceId(Dpid.uri(dpid)), 87 FlowRule rule = new DefaultFlowRule(DeviceId.deviceId(Dpid.uri(dpid)),
88 buildSelector(), null, removed.getPriority(), 88 buildSelector(), null, removed.getPriority(),
89 - removed.getCookie().getValue(), removed.getIdleTimeout()); 89 + removed.getCookie().getValue(), removed.getIdleTimeout(), false);
90 return new DefaultFlowEntry(rule, FlowEntryState.REMOVED, removed.getDurationSec(), 90 return new DefaultFlowEntry(rule, FlowEntryState.REMOVED, removed.getDurationSec(),
91 removed.getPacketCount().getValue(), removed.getByteCount().getValue()); 91 removed.getPacketCount().getValue(), removed.getByteCount().getValue());
92 } 92 }
......