Showing
40 changed files
with
458 additions
and
244 deletions
... | @@ -169,7 +169,7 @@ public class ReactiveForwarding { | ... | @@ -169,7 +169,7 @@ public class ReactiveForwarding { |
169 | treat.add(Instructions.createOutput(portNumber)); | 169 | treat.add(Instructions.createOutput(portNumber)); |
170 | 170 | ||
171 | FlowRule f = new DefaultFlowRule(context.inPacket().receivedFrom().deviceId(), | 171 | FlowRule f = new DefaultFlowRule(context.inPacket().receivedFrom().deviceId(), |
172 | - builder.build(), treat.build()); | 172 | + builder.build(), treat.build(), 0); |
173 | 173 | ||
174 | flowRuleService.applyFlowRules(f); | 174 | flowRuleService.applyFlowRules(f); |
175 | } | 175 | } | ... | ... |
1 | -package org.onlab.onos.net.flow; | ||
2 | - | ||
3 | -import static com.google.common.base.MoreObjects.toStringHelper; | ||
4 | - | ||
5 | -import org.onlab.onos.net.DeviceId; | ||
6 | - | ||
7 | -public class DefaultFlowEntry extends DefaultFlowRule implements FlowEntry { | ||
8 | - | ||
9 | - private final int priority; | ||
10 | - private final long created; | ||
11 | - private final FlowId id; | ||
12 | - | ||
13 | - public DefaultFlowEntry(DefaultFlowEntry entry) { | ||
14 | - super(entry.deviceId(), entry.selector(), entry.treatment()); | ||
15 | - this.priority = entry.priority; | ||
16 | - this.created = entry.created; | ||
17 | - this.id = entry.id; | ||
18 | - } | ||
19 | - | ||
20 | - public DefaultFlowEntry(DeviceId deviceId, TrafficSelector selector, | ||
21 | - TrafficTreatment treatment, int priority) { | ||
22 | - super(deviceId, selector, treatment); | ||
23 | - this.priority = priority; | ||
24 | - this.created = System.currentTimeMillis(); | ||
25 | - this.id = FlowId.valueOf(this.hashCode()); | ||
26 | - } | ||
27 | - | ||
28 | - @Override | ||
29 | - public FlowId id() { | ||
30 | - return null; | ||
31 | - } | ||
32 | - | ||
33 | - @Override | ||
34 | - public int priority() { | ||
35 | - return priority; | ||
36 | - } | ||
37 | - | ||
38 | - @Override | ||
39 | - public long lifeMillis() { | ||
40 | - return (created - System.currentTimeMillis()); | ||
41 | - } | ||
42 | - | ||
43 | - @Override | ||
44 | - public long idleMillis() { | ||
45 | - return 0; | ||
46 | - } | ||
47 | - | ||
48 | - @Override | ||
49 | - public long packets() { | ||
50 | - return 0; | ||
51 | - } | ||
52 | - | ||
53 | - @Override | ||
54 | - public long bytes() { | ||
55 | - return 0; | ||
56 | - } | ||
57 | - | ||
58 | - @Override | ||
59 | - /* | ||
60 | - * currently uses the parts that definitely have a defined hashcode... | ||
61 | - * | ||
62 | - * (non-Javadoc) | ||
63 | - * @see java.lang.Object#hashCode() | ||
64 | - */ | ||
65 | - public int hashCode() { | ||
66 | - final int prime = 31; | ||
67 | - int result = prime * this.deviceId().hashCode(); | ||
68 | - result = prime * result + this.priority; | ||
69 | - result = prime * result + this.selector().hashCode(); | ||
70 | - result = prime * result + this.treatment().hashCode(); | ||
71 | - return result; | ||
72 | - } | ||
73 | - | ||
74 | - @Override | ||
75 | - /* | ||
76 | - * The priority and statistics can change on a given treatment and selector | ||
77 | - * | ||
78 | - * (non-Javadoc) | ||
79 | - * @see java.lang.Object#equals(java.lang.Object) | ||
80 | - */ | ||
81 | - public boolean equals(Object obj) { | ||
82 | - if (obj instanceof DefaultFlowEntry) { | ||
83 | - DefaultFlowEntry that = (DefaultFlowEntry) obj; | ||
84 | - if (!this.deviceId().equals(that.deviceId())) { | ||
85 | - return false; | ||
86 | - } | ||
87 | - if (!(this.priority == that.priority)) { | ||
88 | - return false; | ||
89 | - } | ||
90 | - return super.equals(obj); | ||
91 | - } | ||
92 | - return false; | ||
93 | - } | ||
94 | - | ||
95 | - @Override | ||
96 | - public String toString() { | ||
97 | - return toStringHelper(this) | ||
98 | - .add("id", id) | ||
99 | - .add("deviceId", deviceId()) | ||
100 | - .add("priority", priority) | ||
101 | - .add("selector", selector()) | ||
102 | - .add("treatment", treatment()) | ||
103 | - .toString(); | ||
104 | - } | ||
105 | - | ||
106 | -} |
1 | package org.onlab.onos.net.flow; | 1 | package org.onlab.onos.net.flow; |
2 | 2 | ||
3 | +import static com.google.common.base.MoreObjects.toStringHelper; | ||
4 | + | ||
3 | import org.onlab.onos.net.DeviceId; | 5 | import org.onlab.onos.net.DeviceId; |
4 | 6 | ||
5 | public class DefaultFlowRule implements FlowRule { | 7 | public class DefaultFlowRule implements FlowRule { |
6 | 8 | ||
9 | + private final DeviceId deviceId; | ||
10 | + private final int priority; | ||
7 | private final TrafficSelector selector; | 11 | private final TrafficSelector selector; |
8 | private final TrafficTreatment treatment; | 12 | private final TrafficTreatment treatment; |
9 | - private final DeviceId deviceId; | 13 | + private final FlowId id; |
14 | + private final long created; | ||
15 | + private long life; | ||
16 | + private long idle; | ||
17 | + private long packets; | ||
18 | + private long bytes; | ||
19 | + | ||
10 | 20 | ||
11 | public DefaultFlowRule(DeviceId deviceId, | 21 | public DefaultFlowRule(DeviceId deviceId, |
12 | - TrafficSelector selector, TrafficTreatment treatment) { | 22 | + TrafficSelector selector, TrafficTreatment treatment, int priority) { |
13 | - this.treatment = treatment; | ||
14 | - this.selector = selector; | ||
15 | this.deviceId = deviceId; | 23 | this.deviceId = deviceId; |
24 | + this.priority = priority; | ||
25 | + this.selector = selector; | ||
26 | + this.treatment = treatment; | ||
27 | + this.life = 0; | ||
28 | + this.idle = 0; | ||
29 | + this.packets = 0; | ||
30 | + this.bytes = 0; | ||
31 | + this.id = FlowId.valueOf(this.hashCode()); | ||
32 | + this.created = System.currentTimeMillis(); | ||
33 | + } | ||
34 | + | ||
35 | + // TODO: Decide whether to take the flowId from the underlying flowentry. | ||
36 | + public DefaultFlowRule(DeviceId deviceId, TrafficSelector selector, | ||
37 | + TrafficTreatment treatment, int priority, | ||
38 | + long life, long idle, long packets, long bytes) { | ||
39 | + this(deviceId, selector, treatment, priority); | ||
40 | + this.life = life; | ||
41 | + this.idle = idle; | ||
42 | + this.packets = packets; | ||
43 | + this.bytes = bytes; | ||
44 | + } | ||
45 | + | ||
46 | + | ||
47 | + @Override | ||
48 | + public FlowId id() { | ||
49 | + return id; | ||
16 | } | 50 | } |
17 | 51 | ||
18 | @Override | 52 | @Override |
19 | public int priority() { | 53 | public int priority() { |
20 | - // is this supposed to be 0? | 54 | + return priority; |
21 | - return 0; | ||
22 | } | 55 | } |
23 | 56 | ||
24 | @Override | 57 | @Override |
... | @@ -37,6 +70,32 @@ public class DefaultFlowRule implements FlowRule { | ... | @@ -37,6 +70,32 @@ public class DefaultFlowRule implements FlowRule { |
37 | } | 70 | } |
38 | 71 | ||
39 | @Override | 72 | @Override |
73 | + public long lifeMillis() { | ||
74 | + return life; | ||
75 | + } | ||
76 | + | ||
77 | + @Override | ||
78 | + public long idleMillis() { | ||
79 | + return idle; | ||
80 | + } | ||
81 | + | ||
82 | + @Override | ||
83 | + public long packets() { | ||
84 | + return packets; | ||
85 | + } | ||
86 | + | ||
87 | + @Override | ||
88 | + public long bytes() { | ||
89 | + return bytes; | ||
90 | + } | ||
91 | + | ||
92 | + @Override | ||
93 | + /* | ||
94 | + * The priority and statistics can change on a given treatment and selector | ||
95 | + * | ||
96 | + * (non-Javadoc) | ||
97 | + * @see java.lang.Object#equals(java.lang.Object) | ||
98 | + */ | ||
40 | public int hashCode() { | 99 | public int hashCode() { |
41 | final int prime = 31; | 100 | final int prime = 31; |
42 | int result = prime * this.deviceId().hashCode(); | 101 | int result = prime * this.deviceId().hashCode(); |
... | @@ -69,5 +128,16 @@ public class DefaultFlowRule implements FlowRule { | ... | @@ -69,5 +128,16 @@ public class DefaultFlowRule implements FlowRule { |
69 | return false; | 128 | return false; |
70 | } | 129 | } |
71 | 130 | ||
131 | + @Override | ||
132 | + public String toString() { | ||
133 | + return toStringHelper(this) | ||
134 | + .add("id", id) | ||
135 | + .add("deviceId", deviceId) | ||
136 | + .add("priority", priority) | ||
137 | + .add("selector", selector) | ||
138 | + .add("treatment", treatment) | ||
139 | + .add("created", created) | ||
140 | + .toString(); | ||
141 | + } | ||
72 | 142 | ||
73 | } | 143 | } | ... | ... |
1 | -package org.onlab.onos.net.flow; | ||
2 | - | ||
3 | -/** | ||
4 | - * Represents a flow rule and its associated accumulated metrics. | ||
5 | - */ | ||
6 | -public interface FlowEntry extends FlowRule { | ||
7 | - | ||
8 | - /** | ||
9 | - * Returns the ID of this flow. | ||
10 | - * | ||
11 | - * @return the flow ID | ||
12 | - */ | ||
13 | - FlowId id(); | ||
14 | - | ||
15 | - /** | ||
16 | - * Returns the number of milliseconds this flow rule has been applied. | ||
17 | - * | ||
18 | - * @return number of millis | ||
19 | - */ | ||
20 | - long lifeMillis(); | ||
21 | - | ||
22 | - /** | ||
23 | - * Returns the number of milliseconds this flow rule has been idle. | ||
24 | - * | ||
25 | - * @return number of millis | ||
26 | - */ | ||
27 | - long idleMillis(); | ||
28 | - | ||
29 | - /** | ||
30 | - * Returns the number of packets this flow rule has matched. | ||
31 | - * | ||
32 | - * @return number of packets | ||
33 | - */ | ||
34 | - long packets(); | ||
35 | - | ||
36 | - /** | ||
37 | - * Returns the number of bytes this flow rule has matched. | ||
38 | - * | ||
39 | - * @return number of bytes | ||
40 | - */ | ||
41 | - long bytes(); | ||
42 | - | ||
43 | -} |
... | @@ -9,6 +9,12 @@ import org.onlab.onos.net.DeviceId; | ... | @@ -9,6 +9,12 @@ import org.onlab.onos.net.DeviceId; |
9 | public interface FlowRule { | 9 | public interface FlowRule { |
10 | 10 | ||
11 | //TODO: build cookie value | 11 | //TODO: build cookie value |
12 | + /** | ||
13 | + * Returns the ID of this flow. | ||
14 | + * | ||
15 | + * @return the flow ID | ||
16 | + */ | ||
17 | + FlowId id(); | ||
12 | 18 | ||
13 | /** | 19 | /** |
14 | * Returns the flow rule priority given in natural order; higher numbers | 20 | * Returns the flow rule priority given in natural order; higher numbers |
... | @@ -40,4 +46,32 @@ public interface FlowRule { | ... | @@ -40,4 +46,32 @@ public interface FlowRule { |
40 | */ | 46 | */ |
41 | TrafficTreatment treatment(); | 47 | TrafficTreatment treatment(); |
42 | 48 | ||
49 | + /** | ||
50 | + * Returns the number of milliseconds this flow rule has been applied. | ||
51 | + * | ||
52 | + * @return number of millis | ||
53 | + */ | ||
54 | + long lifeMillis(); | ||
55 | + | ||
56 | + /** | ||
57 | + * Returns the number of milliseconds this flow rule has been idle. | ||
58 | + * | ||
59 | + * @return number of millis | ||
60 | + */ | ||
61 | + long idleMillis(); | ||
62 | + | ||
63 | + /** | ||
64 | + * Returns the number of packets this flow rule has matched. | ||
65 | + * | ||
66 | + * @return number of packets | ||
67 | + */ | ||
68 | + long packets(); | ||
69 | + | ||
70 | + /** | ||
71 | + * Returns the number of bytes this flow rule has matched. | ||
72 | + * | ||
73 | + * @return number of bytes | ||
74 | + */ | ||
75 | + long bytes(); | ||
76 | + | ||
43 | } | 77 | } | ... | ... |
... | @@ -21,7 +21,7 @@ public interface FlowRuleService { | ... | @@ -21,7 +21,7 @@ public interface FlowRuleService { |
21 | * @param deviceId device identifier | 21 | * @param deviceId device identifier |
22 | * @return collection of flow rules | 22 | * @return collection of flow rules |
23 | */ | 23 | */ |
24 | - Iterable<FlowEntry> getFlowEntries(DeviceId deviceId); | 24 | + Iterable<FlowRule> getFlowEntries(DeviceId deviceId); |
25 | 25 | ||
26 | // TODO: add createFlowRule factory method and execute operations method | 26 | // TODO: add createFlowRule factory method and execute operations method |
27 | 27 | ||
... | @@ -34,7 +34,7 @@ public interface FlowRuleService { | ... | @@ -34,7 +34,7 @@ public interface FlowRuleService { |
34 | * throws SomeKindOfException that indicates which ones were applied and | 34 | * throws SomeKindOfException that indicates which ones were applied and |
35 | * which ones failed | 35 | * which ones failed |
36 | */ | 36 | */ |
37 | - List<FlowEntry> applyFlowRules(FlowRule... flowRules); | 37 | + List<FlowRule> applyFlowRules(FlowRule... flowRules); |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * Removes the specified flow rules from their respective devices. If the | 40 | * Removes the specified flow rules from their respective devices. If the | ... | ... |
1 | package org.onlab.onos.net.provider; | 1 | package org.onlab.onos.net.provider; |
2 | 2 | ||
3 | import com.google.common.collect.ImmutableSet; | 3 | import com.google.common.collect.ImmutableSet; |
4 | +import org.onlab.onos.net.DeviceId; | ||
4 | 5 | ||
5 | import java.util.HashMap; | 6 | import java.util.HashMap; |
6 | import java.util.Map; | 7 | import java.util.Map; |
... | @@ -20,6 +21,7 @@ public abstract class AbstractProviderRegistry<P extends Provider, S extends Pro | ... | @@ -20,6 +21,7 @@ public abstract class AbstractProviderRegistry<P extends Provider, S extends Pro |
20 | 21 | ||
21 | private final Map<ProviderId, P> providers = new HashMap<>(); | 22 | private final Map<ProviderId, P> providers = new HashMap<>(); |
22 | private final Map<ProviderId, S> services = new HashMap<>(); | 23 | private final Map<ProviderId, S> services = new HashMap<>(); |
24 | + private final Map<String, P> providersByScheme = new HashMap<>(); | ||
23 | 25 | ||
24 | /** | 26 | /** |
25 | * Creates a new provider service bound to the specified provider. | 27 | * Creates a new provider service bound to the specified provider. |
... | @@ -65,4 +67,14 @@ public abstract class AbstractProviderRegistry<P extends Provider, S extends Pro | ... | @@ -65,4 +67,14 @@ public abstract class AbstractProviderRegistry<P extends Provider, S extends Pro |
65 | return providers.get(providerId); | 67 | return providers.get(providerId); |
66 | } | 68 | } |
67 | 69 | ||
70 | + /** | ||
71 | + * Returns the provider for the specified device ID based on URI scheme. | ||
72 | + * | ||
73 | + * @param deviceId device identifier | ||
74 | + * @return provider bound to the URI scheme | ||
75 | + */ | ||
76 | + protected synchronized P getProvider(DeviceId deviceId) { | ||
77 | + return providersByScheme.get(deviceId.uri().getScheme()); | ||
78 | + } | ||
79 | + | ||
68 | } | 80 | } | ... | ... |
... | @@ -9,6 +9,7 @@ import static com.google.common.base.MoreObjects.toStringHelper; | ... | @@ -9,6 +9,7 @@ import static com.google.common.base.MoreObjects.toStringHelper; |
9 | */ | 9 | */ |
10 | public class ProviderId { | 10 | public class ProviderId { |
11 | 11 | ||
12 | + private final String scheme; | ||
12 | private final String id; | 13 | private final String id; |
13 | 14 | ||
14 | /** | 15 | /** |
... | @@ -16,15 +17,26 @@ public class ProviderId { | ... | @@ -16,15 +17,26 @@ public class ProviderId { |
16 | * The providers are expected to follow the reverse DNS convention, e.g. | 17 | * The providers are expected to follow the reverse DNS convention, e.g. |
17 | * {@code org.onlab.onos.provider.of.device} | 18 | * {@code org.onlab.onos.provider.of.device} |
18 | * | 19 | * |
19 | - * @param id string identifier | 20 | + * @param scheme device URI scheme to which this provider is bound, e.g. "of", "snmp" |
21 | + * @param id string identifier | ||
20 | */ | 22 | */ |
21 | - public ProviderId(String id) { | 23 | + public ProviderId(String scheme, String id) { |
24 | + this.scheme = scheme; | ||
22 | this.id = id; | 25 | this.id = id; |
23 | } | 26 | } |
24 | 27 | ||
28 | + /** | ||
29 | + * Returns the device URI scheme to which this provider is bound. | ||
30 | + * | ||
31 | + * @return device URI scheme | ||
32 | + */ | ||
33 | + public String scheme() { | ||
34 | + return scheme; | ||
35 | + } | ||
36 | + | ||
25 | @Override | 37 | @Override |
26 | public int hashCode() { | 38 | public int hashCode() { |
27 | - return Objects.hash(id); | 39 | + return Objects.hash(scheme, id); |
28 | } | 40 | } |
29 | 41 | ||
30 | @Override | 42 | @Override |
... | @@ -36,12 +48,13 @@ public class ProviderId { | ... | @@ -36,12 +48,13 @@ public class ProviderId { |
36 | return false; | 48 | return false; |
37 | } | 49 | } |
38 | final ProviderId other = (ProviderId) obj; | 50 | final ProviderId other = (ProviderId) obj; |
39 | - return Objects.equals(this.id, other.id); | 51 | + return Objects.equals(this.scheme, other.scheme) && |
52 | + Objects.equals(this.id, other.id); | ||
40 | } | 53 | } |
41 | 54 | ||
42 | @Override | 55 | @Override |
43 | public String toString() { | 56 | public String toString() { |
44 | - return toStringHelper(this).add("id", id).toString(); | 57 | + return toStringHelper(this).add("scheme", scheme).add("id", id).toString(); |
45 | } | 58 | } |
46 | 59 | ||
47 | } | 60 | } | ... | ... |
... | @@ -13,7 +13,7 @@ import static org.onlab.onos.net.DeviceId.deviceId; | ... | @@ -13,7 +13,7 @@ import static org.onlab.onos.net.DeviceId.deviceId; |
13 | */ | 13 | */ |
14 | public class DefaultDeviceTest { | 14 | public class DefaultDeviceTest { |
15 | 15 | ||
16 | - private static final ProviderId PID = new ProviderId("foo"); | 16 | + private static final ProviderId PID = new ProviderId("of", "foo"); |
17 | private static final DeviceId DID1 = deviceId("of:foo"); | 17 | private static final DeviceId DID1 = deviceId("of:foo"); |
18 | private static final DeviceId DID2 = deviceId("of:bar"); | 18 | private static final DeviceId DID2 = deviceId("of:bar"); |
19 | private static final String MFR = "whitebox"; | 19 | private static final String MFR = "whitebox"; | ... | ... |
... | @@ -15,7 +15,7 @@ import static org.onlab.onos.net.PortNumber.portNumber; | ... | @@ -15,7 +15,7 @@ import static org.onlab.onos.net.PortNumber.portNumber; |
15 | */ | 15 | */ |
16 | public class DefaultEdgeLinkTest { | 16 | public class DefaultEdgeLinkTest { |
17 | 17 | ||
18 | - private static final ProviderId PID = new ProviderId("foo"); | 18 | + private static final ProviderId PID = new ProviderId("of", "foo"); |
19 | private static final DeviceId DID1 = deviceId("of:foo"); | 19 | private static final DeviceId DID1 = deviceId("of:foo"); |
20 | private static final HostId HID1 = hostId("nic:foobar"); | 20 | private static final HostId HID1 = hostId("nic:foobar"); |
21 | private static final HostId HID2 = hostId("nic:barfoo"); | 21 | private static final HostId HID2 = hostId("nic:barfoo"); | ... | ... |
... | @@ -15,7 +15,7 @@ import static org.onlab.onos.net.PortNumber.portNumber; | ... | @@ -15,7 +15,7 @@ import static org.onlab.onos.net.PortNumber.portNumber; |
15 | */ | 15 | */ |
16 | public class DefaultLinkTest { | 16 | public class DefaultLinkTest { |
17 | 17 | ||
18 | - private static final ProviderId PID = new ProviderId("foo"); | 18 | + private static final ProviderId PID = new ProviderId("of", "foo"); |
19 | private static final DeviceId DID1 = deviceId("of:foo"); | 19 | private static final DeviceId DID1 = deviceId("of:foo"); |
20 | private static final DeviceId DID2 = deviceId("of:bar"); | 20 | private static final DeviceId DID2 = deviceId("of:bar"); |
21 | private static final PortNumber P1 = portNumber(1); | 21 | private static final PortNumber P1 = portNumber(1); | ... | ... |
... | @@ -14,7 +14,7 @@ import static org.onlab.onos.net.PortNumber.portNumber; | ... | @@ -14,7 +14,7 @@ import static org.onlab.onos.net.PortNumber.portNumber; |
14 | */ | 14 | */ |
15 | public class DefaultPortTest { | 15 | public class DefaultPortTest { |
16 | 16 | ||
17 | - private static final ProviderId PID = new ProviderId("foo"); | 17 | + private static final ProviderId PID = new ProviderId("of", "foo"); |
18 | private static final DeviceId DID1 = deviceId("of:foo"); | 18 | private static final DeviceId DID1 = deviceId("of:foo"); |
19 | private static final DeviceId DID2 = deviceId("of:bar"); | 19 | private static final DeviceId DID2 = deviceId("of:bar"); |
20 | private static final PortNumber P1 = portNumber(1); | 20 | private static final PortNumber P1 = portNumber(1); | ... | ... |
... | @@ -17,7 +17,7 @@ import com.google.common.collect.Sets; | ... | @@ -17,7 +17,7 @@ import com.google.common.collect.Sets; |
17 | */ | 17 | */ |
18 | public abstract class TestDeviceParams { | 18 | public abstract class TestDeviceParams { |
19 | 19 | ||
20 | - protected static final ProviderId PID = new ProviderId("foo"); | 20 | + protected static final ProviderId PID = new ProviderId("of", "foo"); |
21 | protected static final DeviceId DID1 = deviceId("of:foo"); | 21 | protected static final DeviceId DID1 = deviceId("of:foo"); |
22 | protected static final DeviceId DID2 = deviceId("of:bar"); | 22 | protected static final DeviceId DID2 = deviceId("of:bar"); |
23 | protected static final MacAddress MAC1 = MacAddress.valueOf("00:11:00:00:00:01"); | 23 | protected static final MacAddress MAC1 = MacAddress.valueOf("00:11:00:00:00:01"); | ... | ... |
... | @@ -18,7 +18,7 @@ import org.onlab.onos.net.provider.ProviderId; | ... | @@ -18,7 +18,7 @@ import org.onlab.onos.net.provider.ProviderId; |
18 | public class DeviceEventTest extends AbstractEventTest { | 18 | public class DeviceEventTest extends AbstractEventTest { |
19 | 19 | ||
20 | private Device createDevice() { | 20 | private Device createDevice() { |
21 | - return new DefaultDevice(new ProviderId("foo"), deviceId("of:foo"), | 21 | + return new DefaultDevice(new ProviderId("of", "foo"), deviceId("of:foo"), |
22 | Device.Type.SWITCH, "box", "hw", "sw", "sn"); | 22 | Device.Type.SWITCH, "box", "hw", "sw", "sn"); |
23 | } | 23 | } |
24 | 24 | ... | ... |
... | @@ -34,7 +34,7 @@ public class HostEventTest extends AbstractEventTest { | ... | @@ -34,7 +34,7 @@ public class HostEventTest extends AbstractEventTest { |
34 | HostId hid = HostId.hostId(mac, vlan); | 34 | HostId hid = HostId.hostId(mac, vlan); |
35 | 35 | ||
36 | return new DefaultHost( | 36 | return new DefaultHost( |
37 | - new ProviderId("foo"), hid, mac, vlan, loc, ipset); | 37 | + new ProviderId("of", "foo"), hid, mac, vlan, loc, ipset); |
38 | } | 38 | } |
39 | 39 | ||
40 | @Override | 40 | @Override | ... | ... |
... | @@ -16,7 +16,7 @@ import static org.onlab.onos.net.PortNumber.portNumber; | ... | @@ -16,7 +16,7 @@ import static org.onlab.onos.net.PortNumber.portNumber; |
16 | public class LinkEventTest extends AbstractEventTest { | 16 | public class LinkEventTest extends AbstractEventTest { |
17 | 17 | ||
18 | private Link createLink() { | 18 | private Link createLink() { |
19 | - return new DefaultLink(new ProviderId("foo"), | 19 | + return new DefaultLink(new ProviderId("of", "foo"), |
20 | new ConnectPoint(deviceId("of:foo"), portNumber(1)), | 20 | new ConnectPoint(deviceId("of:foo"), portNumber(1)), |
21 | new ConnectPoint(deviceId("of:bar"), portNumber(2)), | 21 | new ConnectPoint(deviceId("of:bar"), portNumber(2)), |
22 | Link.Type.INDIRECT); | 22 | Link.Type.INDIRECT); | ... | ... |
... | @@ -28,14 +28,14 @@ public class AbstractProviderRegistryTest { | ... | @@ -28,14 +28,14 @@ public class AbstractProviderRegistryTest { |
28 | TestProviderRegistry registry = new TestProviderRegistry(); | 28 | TestProviderRegistry registry = new TestProviderRegistry(); |
29 | assertEquals("incorrect provider count", 0, registry.getProviders().size()); | 29 | assertEquals("incorrect provider count", 0, registry.getProviders().size()); |
30 | 30 | ||
31 | - ProviderId fooId = new ProviderId("foo"); | 31 | + ProviderId fooId = new ProviderId("of", "foo"); |
32 | TestProvider pFoo = new TestProvider(fooId); | 32 | TestProvider pFoo = new TestProvider(fooId); |
33 | TestProviderService psFoo = registry.register(pFoo); | 33 | TestProviderService psFoo = registry.register(pFoo); |
34 | assertEquals("incorrect provider count", 1, registry.getProviders().size()); | 34 | assertEquals("incorrect provider count", 1, registry.getProviders().size()); |
35 | assertThat("provider not found", registry.getProviders().contains(fooId)); | 35 | assertThat("provider not found", registry.getProviders().contains(fooId)); |
36 | assertEquals("incorrect provider", psFoo.provider(), pFoo); | 36 | assertEquals("incorrect provider", psFoo.provider(), pFoo); |
37 | 37 | ||
38 | - ProviderId barId = new ProviderId("bar"); | 38 | + ProviderId barId = new ProviderId("of", "bar"); |
39 | TestProvider pBar = new TestProvider(barId); | 39 | TestProvider pBar = new TestProvider(barId); |
40 | TestProviderService psBar = registry.register(pBar); | 40 | TestProviderService psBar = registry.register(pBar); |
41 | assertEquals("incorrect provider count", 2, registry.getProviders().size()); | 41 | assertEquals("incorrect provider count", 2, registry.getProviders().size()); |
... | @@ -52,7 +52,7 @@ public class AbstractProviderRegistryTest { | ... | @@ -52,7 +52,7 @@ public class AbstractProviderRegistryTest { |
52 | @Test(expected = IllegalStateException.class) | 52 | @Test(expected = IllegalStateException.class) |
53 | public void duplicateRegistration() { | 53 | public void duplicateRegistration() { |
54 | TestProviderRegistry registry = new TestProviderRegistry(); | 54 | TestProviderRegistry registry = new TestProviderRegistry(); |
55 | - TestProvider pFoo = new TestProvider(new ProviderId("foo")); | 55 | + TestProvider pFoo = new TestProvider(new ProviderId("of", "foo")); |
56 | registry.register(pFoo); | 56 | registry.register(pFoo); |
57 | registry.register(pFoo); | 57 | registry.register(pFoo); |
58 | } | 58 | } |
... | @@ -60,13 +60,13 @@ public class AbstractProviderRegistryTest { | ... | @@ -60,13 +60,13 @@ public class AbstractProviderRegistryTest { |
60 | @Test | 60 | @Test |
61 | public void voidUnregistration() { | 61 | public void voidUnregistration() { |
62 | TestProviderRegistry registry = new TestProviderRegistry(); | 62 | TestProviderRegistry registry = new TestProviderRegistry(); |
63 | - registry.unregister(new TestProvider(new ProviderId("foo"))); | 63 | + registry.unregister(new TestProvider(new ProviderId("of", "foo"))); |
64 | } | 64 | } |
65 | 65 | ||
66 | @Test(expected = IllegalStateException.class) | 66 | @Test(expected = IllegalStateException.class) |
67 | public void unregistration() { | 67 | public void unregistration() { |
68 | TestProviderRegistry registry = new TestProviderRegistry(); | 68 | TestProviderRegistry registry = new TestProviderRegistry(); |
69 | - TestProvider pFoo = new TestProvider(new ProviderId("foo")); | 69 | + TestProvider pFoo = new TestProvider(new ProviderId("of", "foo")); |
70 | TestProviderService psFoo = registry.register(pFoo); | 70 | TestProviderService psFoo = registry.register(pFoo); |
71 | registry.unregister(pFoo); | 71 | registry.unregister(pFoo); |
72 | psFoo.checkValidity(); | 72 | psFoo.checkValidity(); | ... | ... |
... | @@ -11,7 +11,7 @@ public class AbstractProviderTest { | ... | @@ -11,7 +11,7 @@ public class AbstractProviderTest { |
11 | 11 | ||
12 | @Test | 12 | @Test |
13 | public void basics() { | 13 | public void basics() { |
14 | - ProviderId id = new ProviderId("foo.bar"); | 14 | + ProviderId id = new ProviderId("of", "foo.bar"); |
15 | TestProvider provider = new TestProvider(id); | 15 | TestProvider provider = new TestProvider(id); |
16 | assertEquals("incorrect id", id, provider.id()); | 16 | assertEquals("incorrect id", id, provider.id()); |
17 | } | 17 | } | ... | ... |
... | @@ -11,8 +11,9 @@ public class ProviderIdTest { | ... | @@ -11,8 +11,9 @@ public class ProviderIdTest { |
11 | @Test | 11 | @Test |
12 | public void basics() { | 12 | public void basics() { |
13 | new EqualsTester() | 13 | new EqualsTester() |
14 | - .addEqualityGroup(new ProviderId("foo"), new ProviderId("foo")) | 14 | + .addEqualityGroup(new ProviderId("of", "foo"), new ProviderId("of", "foo")) |
15 | - .addEqualityGroup(new ProviderId("bar")) | 15 | + .addEqualityGroup(new ProviderId("snmp", "foo"), new ProviderId("snmp", "foo")) |
16 | + .addEqualityGroup(new ProviderId("of", "bar")) | ||
16 | .testEquals(); | 17 | .testEquals(); |
17 | } | 18 | } |
18 | 19 | ... | ... |
... | @@ -17,7 +17,6 @@ import org.onlab.onos.event.EventDeliveryService; | ... | @@ -17,7 +17,6 @@ import org.onlab.onos.event.EventDeliveryService; |
17 | import org.onlab.onos.net.Device; | 17 | import org.onlab.onos.net.Device; |
18 | import org.onlab.onos.net.DeviceId; | 18 | import org.onlab.onos.net.DeviceId; |
19 | import org.onlab.onos.net.device.DeviceService; | 19 | import org.onlab.onos.net.device.DeviceService; |
20 | -import org.onlab.onos.net.flow.FlowEntry; | ||
21 | import org.onlab.onos.net.flow.FlowRule; | 20 | import org.onlab.onos.net.flow.FlowRule; |
22 | import org.onlab.onos.net.flow.FlowRuleEvent; | 21 | import org.onlab.onos.net.flow.FlowRuleEvent; |
23 | import org.onlab.onos.net.flow.FlowRuleListener; | 22 | import org.onlab.onos.net.flow.FlowRuleListener; |
... | @@ -62,13 +61,13 @@ implements FlowRuleService, FlowRuleProviderRegistry { | ... | @@ -62,13 +61,13 @@ implements FlowRuleService, FlowRuleProviderRegistry { |
62 | } | 61 | } |
63 | 62 | ||
64 | @Override | 63 | @Override |
65 | - public Iterable<FlowEntry> getFlowEntries(DeviceId deviceId) { | 64 | + public Iterable<FlowRule> getFlowEntries(DeviceId deviceId) { |
66 | return store.getFlowEntries(deviceId); | 65 | return store.getFlowEntries(deviceId); |
67 | } | 66 | } |
68 | 67 | ||
69 | @Override | 68 | @Override |
70 | - public List<FlowEntry> applyFlowRules(FlowRule... flowRules) { | 69 | + public List<FlowRule> applyFlowRules(FlowRule... flowRules) { |
71 | - List<FlowEntry> entries = new ArrayList<FlowEntry>(); | 70 | + List<FlowRule> entries = new ArrayList<FlowRule>(); |
72 | 71 | ||
73 | for (int i = 0; i < flowRules.length; i++) { | 72 | for (int i = 0; i < flowRules.length; i++) { |
74 | FlowRule f = flowRules[i]; | 73 | FlowRule f = flowRules[i]; |
... | @@ -159,7 +158,7 @@ implements FlowRuleService, FlowRuleProviderRegistry { | ... | @@ -159,7 +158,7 @@ implements FlowRuleService, FlowRuleProviderRegistry { |
159 | } | 158 | } |
160 | 159 | ||
161 | @Override | 160 | @Override |
162 | - public void pushFlowMetrics(Iterable<FlowEntry> flowEntries) { | 161 | + public void pushFlowMetrics(Iterable<FlowRule> flowEntries) { |
163 | // TODO Auto-generated method stub | 162 | // TODO Auto-generated method stub |
164 | 163 | ||
165 | } | 164 | } | ... | ... |
1 | package org.onlab.onos.net.trivial.flow.impl; | 1 | package org.onlab.onos.net.trivial.flow.impl; |
2 | 2 | ||
3 | import org.onlab.onos.net.DeviceId; | 3 | import org.onlab.onos.net.DeviceId; |
4 | -import org.onlab.onos.net.flow.DefaultFlowEntry; | 4 | +import org.onlab.onos.net.flow.DefaultFlowRule; |
5 | -import org.onlab.onos.net.flow.FlowEntry; | ||
6 | import org.onlab.onos.net.flow.FlowRule; | 5 | import org.onlab.onos.net.flow.FlowRule; |
7 | import org.onlab.onos.net.flow.FlowRuleEvent; | 6 | import org.onlab.onos.net.flow.FlowRuleEvent; |
8 | 7 | ||
... | @@ -18,7 +17,7 @@ import static org.onlab.onos.net.flow.FlowRuleEvent.Type.*; | ... | @@ -18,7 +17,7 @@ import static org.onlab.onos.net.flow.FlowRuleEvent.Type.*; |
18 | public class SimpleFlowRuleStore { | 17 | public class SimpleFlowRuleStore { |
19 | 18 | ||
20 | // store entries as a pile of rules, no info about device tables | 19 | // store entries as a pile of rules, no info about device tables |
21 | - private final Multimap<DeviceId, FlowEntry> flowEntries = HashMultimap.create(); | 20 | + private final Multimap<DeviceId, FlowRule> flowEntries = HashMultimap.create(); |
22 | 21 | ||
23 | /** | 22 | /** |
24 | * Returns the flow entries associated with a device. | 23 | * Returns the flow entries associated with a device. |
... | @@ -26,19 +25,19 @@ public class SimpleFlowRuleStore { | ... | @@ -26,19 +25,19 @@ public class SimpleFlowRuleStore { |
26 | * @param deviceId the device ID | 25 | * @param deviceId the device ID |
27 | * @return the flow entries | 26 | * @return the flow entries |
28 | */ | 27 | */ |
29 | - Iterable<FlowEntry> getFlowEntries(DeviceId deviceId) { | 28 | + Iterable<FlowRule> getFlowEntries(DeviceId deviceId) { |
30 | return ImmutableSet.copyOf(flowEntries.get(deviceId)); | 29 | return ImmutableSet.copyOf(flowEntries.get(deviceId)); |
31 | } | 30 | } |
32 | 31 | ||
33 | /** | 32 | /** |
34 | - * Stores a new flow rule, and generates a FlowEntry for it. | 33 | + * Stores a new flow rule, and generates a FlowRule for it. |
35 | * | 34 | * |
36 | * @param rule the flow rule to add | 35 | * @param rule the flow rule to add |
37 | * @return a flow entry | 36 | * @return a flow entry |
38 | */ | 37 | */ |
39 | - FlowEntry storeFlowRule(FlowRule rule) { | 38 | + FlowRule storeFlowRule(FlowRule rule) { |
40 | DeviceId did = rule.deviceId(); | 39 | DeviceId did = rule.deviceId(); |
41 | - FlowEntry entry = new DefaultFlowEntry(did, | 40 | + FlowRule entry = new DefaultFlowRule(did, |
42 | rule.selector(), rule.treatment(), rule.priority()); | 41 | rule.selector(), rule.treatment(), rule.priority()); |
43 | flowEntries.put(did, entry); | 42 | flowEntries.put(did, entry); |
44 | return entry; | 43 | return entry; |
... | @@ -53,20 +52,14 @@ public class SimpleFlowRuleStore { | ... | @@ -53,20 +52,14 @@ public class SimpleFlowRuleStore { |
53 | FlowRuleEvent addOrUpdateFlowRule(FlowRule rule) { | 52 | FlowRuleEvent addOrUpdateFlowRule(FlowRule rule) { |
54 | DeviceId did = rule.deviceId(); | 53 | DeviceId did = rule.deviceId(); |
55 | 54 | ||
56 | - FlowEntry entry = new DefaultFlowEntry( | ||
57 | - did, | ||
58 | - rule.selector(), | ||
59 | - rule.treatment(), | ||
60 | - rule.priority()); | ||
61 | - | ||
62 | // check if this new rule is an update to an existing entry | 55 | // check if this new rule is an update to an existing entry |
63 | - for (FlowEntry fe : flowEntries.get(did)) { | 56 | + for (FlowRule fe : flowEntries.get(did)) { |
64 | - if (entry.equals(fe)) { | 57 | + if (rule.equals(fe)) { |
65 | - // TODO update the stats on this flowEntry? | 58 | + // TODO update the stats on this FlowRule? |
66 | return null; | 59 | return null; |
67 | } | 60 | } |
68 | } | 61 | } |
69 | - flowEntries.put(did, entry); | 62 | + flowEntries.put(did, rule); |
70 | return new FlowRuleEvent(RULE_ADDED, rule); | 63 | return new FlowRuleEvent(RULE_ADDED, rule); |
71 | } | 64 | } |
72 | 65 | ||
... | @@ -77,10 +70,8 @@ public class SimpleFlowRuleStore { | ... | @@ -77,10 +70,8 @@ public class SimpleFlowRuleStore { |
77 | */ | 70 | */ |
78 | FlowRuleEvent removeFlowRule(FlowRule rule) { | 71 | FlowRuleEvent removeFlowRule(FlowRule rule) { |
79 | 72 | ||
80 | - FlowEntry rem = new DefaultFlowEntry(rule.deviceId(), | ||
81 | - rule.selector(), rule.treatment(), rule.priority()); | ||
82 | synchronized (this) { | 73 | synchronized (this) { |
83 | - if (flowEntries.remove(rem.deviceId(), rem)) { | 74 | + if (flowEntries.remove(rule.deviceId(), rule)) { |
84 | return new FlowRuleEvent(RULE_REMOVED, rule); | 75 | return new FlowRuleEvent(RULE_REMOVED, rule); |
85 | } else { | 76 | } else { |
86 | return null; | 77 | return null; | ... | ... |
... | @@ -45,7 +45,7 @@ public class DefaultTopology extends AbstractModel implements Topology { | ... | @@ -45,7 +45,7 @@ public class DefaultTopology extends AbstractModel implements Topology { |
45 | private static final TarjanGraphSearch<TopologyVertex, TopologyEdge> TARJAN = | 45 | private static final TarjanGraphSearch<TopologyVertex, TopologyEdge> TARJAN = |
46 | new TarjanGraphSearch<>(); | 46 | new TarjanGraphSearch<>(); |
47 | 47 | ||
48 | - private static final ProviderId PID = new ProviderId("org.onlab.onos.net"); | 48 | + private static final ProviderId PID = new ProviderId("core", "org.onlab.onos.net"); |
49 | 49 | ||
50 | private final long time; | 50 | private final long time; |
51 | private final TopologyGraph graph; | 51 | private final TopologyGraph graph; | ... | ... |
... | @@ -74,7 +74,7 @@ public class DefaultTopologyProvider extends AbstractProvider | ... | @@ -74,7 +74,7 @@ public class DefaultTopologyProvider extends AbstractProvider |
74 | * Creates a provider with the supplier identifier. | 74 | * Creates a provider with the supplier identifier. |
75 | */ | 75 | */ |
76 | public DefaultTopologyProvider() { | 76 | public DefaultTopologyProvider() { |
77 | - super(new ProviderId("org.onlab.onos.provider.topology")); | 77 | + super(new ProviderId("core", "org.onlab.onos.provider.topology")); |
78 | } | 78 | } |
79 | 79 | ||
80 | @Activate | 80 | @Activate | ... | ... |
... | @@ -45,7 +45,7 @@ public class SimplePathManager implements PathService { | ... | @@ -45,7 +45,7 @@ public class SimplePathManager implements PathService { |
45 | 45 | ||
46 | private static final String ELEMENT_ID_NULL = "Element ID cannot be null"; | 46 | private static final String ELEMENT_ID_NULL = "Element ID cannot be null"; |
47 | 47 | ||
48 | - private static final ProviderId PID = new ProviderId("org.onlab.onos.core"); | 48 | + private static final ProviderId PID = new ProviderId("core", "org.onlab.onos.core"); |
49 | private static final PortNumber P0 = PortNumber.portNumber(0); | 49 | private static final PortNumber P0 = PortNumber.portNumber(0); |
50 | 50 | ||
51 | private static final EdgeLink NOT_HOST = new NotHost(); | 51 | private static final EdgeLink NOT_HOST = new NotHost(); | ... | ... |
... | @@ -38,7 +38,7 @@ import static org.onlab.onos.net.device.DeviceEvent.Type.*; | ... | @@ -38,7 +38,7 @@ import static org.onlab.onos.net.device.DeviceEvent.Type.*; |
38 | */ | 38 | */ |
39 | public class SimpleDeviceManagerTest { | 39 | public class SimpleDeviceManagerTest { |
40 | 40 | ||
41 | - private static final ProviderId PID = new ProviderId("foo"); | 41 | + private static final ProviderId PID = new ProviderId("of", "foo"); |
42 | private static final DeviceId DID1 = deviceId("of:foo"); | 42 | private static final DeviceId DID1 = deviceId("of:foo"); |
43 | private static final DeviceId DID2 = deviceId("of:bar"); | 43 | private static final DeviceId DID2 = deviceId("of:bar"); |
44 | private static final String MFR = "whitebox"; | 44 | private static final String MFR = "whitebox"; | ... | ... |
... | @@ -4,6 +4,8 @@ import static org.junit.Assert.assertEquals; | ... | @@ -4,6 +4,8 @@ import static org.junit.Assert.assertEquals; |
4 | import static org.junit.Assert.assertFalse; | 4 | import static org.junit.Assert.assertFalse; |
5 | import static org.junit.Assert.assertNotNull; | 5 | import static org.junit.Assert.assertNotNull; |
6 | import static org.junit.Assert.assertTrue; | 6 | import static org.junit.Assert.assertTrue; |
7 | +import static org.onlab.onos.net.flow.FlowRuleEvent.Type.RULE_ADDED; | ||
8 | +import static org.onlab.onos.net.flow.FlowRuleEvent.Type.RULE_REMOVED; | ||
7 | 9 | ||
8 | import java.util.ArrayList; | 10 | import java.util.ArrayList; |
9 | import java.util.List; | 11 | import java.util.List; |
... | @@ -21,9 +23,7 @@ import org.onlab.onos.net.Port; | ... | @@ -21,9 +23,7 @@ import org.onlab.onos.net.Port; |
21 | import org.onlab.onos.net.PortNumber; | 23 | import org.onlab.onos.net.PortNumber; |
22 | import org.onlab.onos.net.device.DeviceListener; | 24 | import org.onlab.onos.net.device.DeviceListener; |
23 | import org.onlab.onos.net.device.DeviceService; | 25 | import org.onlab.onos.net.device.DeviceService; |
24 | -import org.onlab.onos.net.flow.DefaultFlowEntry; | ||
25 | import org.onlab.onos.net.flow.DefaultFlowRule; | 26 | import org.onlab.onos.net.flow.DefaultFlowRule; |
26 | -import org.onlab.onos.net.flow.FlowEntry; | ||
27 | import org.onlab.onos.net.flow.FlowRule; | 27 | import org.onlab.onos.net.flow.FlowRule; |
28 | import org.onlab.onos.net.flow.FlowRuleEvent; | 28 | import org.onlab.onos.net.flow.FlowRuleEvent; |
29 | import org.onlab.onos.net.flow.FlowRuleListener; | 29 | import org.onlab.onos.net.flow.FlowRuleListener; |
... | @@ -41,14 +41,12 @@ import org.onlab.onos.net.provider.ProviderId; | ... | @@ -41,14 +41,12 @@ import org.onlab.onos.net.provider.ProviderId; |
41 | import com.google.common.collect.Lists; | 41 | import com.google.common.collect.Lists; |
42 | import com.google.common.collect.Sets; | 42 | import com.google.common.collect.Sets; |
43 | 43 | ||
44 | -import static org.onlab.onos.net.flow.FlowRuleEvent.Type.*; | ||
45 | - | ||
46 | /** | 44 | /** |
47 | * Test codifying the flow rule service & flow rule provider service contracts. | 45 | * Test codifying the flow rule service & flow rule provider service contracts. |
48 | */ | 46 | */ |
49 | public class SimpleFlowRuleManagerTest { | 47 | public class SimpleFlowRuleManagerTest { |
50 | 48 | ||
51 | - private static final ProviderId PID = new ProviderId("foo"); | 49 | + private static final ProviderId PID = new ProviderId("of", "foo"); |
52 | private static final DeviceId DID = DeviceId.deviceId("of:001"); | 50 | private static final DeviceId DID = DeviceId.deviceId("of:001"); |
53 | private static final Device DEV = new DefaultDevice( | 51 | private static final Device DEV = new DefaultDevice( |
54 | PID, DID, Type.SWITCH, "", "", "", ""); | 52 | PID, DID, Type.SWITCH, "", "", "", ""); |
... | @@ -81,7 +79,7 @@ public class SimpleFlowRuleManagerTest { | ... | @@ -81,7 +79,7 @@ public class SimpleFlowRuleManagerTest { |
81 | public void tearDown() { | 79 | public void tearDown() { |
82 | registry.unregister(provider); | 80 | registry.unregister(provider); |
83 | assertFalse("provider should not be registered", | 81 | assertFalse("provider should not be registered", |
84 | - registry.getProviders().contains(provider.id())); | 82 | + registry.getProviders().contains(provider.id())); |
85 | service.removeListener(listener); | 83 | service.removeListener(listener); |
86 | mgr.deactivate(); | 84 | mgr.deactivate(); |
87 | mgr.eventDispatcher = null; | 85 | mgr.eventDispatcher = null; |
... | @@ -91,7 +89,7 @@ public class SimpleFlowRuleManagerTest { | ... | @@ -91,7 +89,7 @@ public class SimpleFlowRuleManagerTest { |
91 | private FlowRule flowRule(int tsval, int trval) { | 89 | private FlowRule flowRule(int tsval, int trval) { |
92 | TestSelector ts = new TestSelector(tsval); | 90 | TestSelector ts = new TestSelector(tsval); |
93 | TestTreatment tr = new TestTreatment(trval); | 91 | TestTreatment tr = new TestTreatment(trval); |
94 | - return new DefaultFlowRule(DID, ts, tr); | 92 | + return new DefaultFlowRule(DID, ts, tr, 0); |
95 | } | 93 | } |
96 | 94 | ||
97 | private void addFlowRule(int hval) { | 95 | private void addFlowRule(int hval) { |
... | @@ -142,14 +140,14 @@ public class SimpleFlowRuleManagerTest { | ... | @@ -142,14 +140,14 @@ public class SimpleFlowRuleManagerTest { |
142 | FlowRule r3 = flowRule(1, 3); | 140 | FlowRule r3 = flowRule(1, 3); |
143 | 141 | ||
144 | //current FlowRules always return 0. FlowEntries inherit the value | 142 | //current FlowRules always return 0. FlowEntries inherit the value |
145 | - FlowEntry e1 = new DefaultFlowEntry(DID, ts, r1.treatment(), 0); | 143 | + FlowRule e1 = new DefaultFlowRule(DID, ts, r1.treatment(), 0); |
146 | - FlowEntry e2 = new DefaultFlowEntry(DID, ts, r2.treatment(), 0); | 144 | + FlowRule e2 = new DefaultFlowRule(DID, ts, r2.treatment(), 0); |
147 | - FlowEntry e3 = new DefaultFlowEntry(DID, ts, r3.treatment(), 0); | 145 | + FlowRule e3 = new DefaultFlowRule(DID, ts, r3.treatment(), 0); |
148 | - List<FlowEntry> fel = Lists.newArrayList(e1, e2, e3); | 146 | + List<FlowRule> fel = Lists.newArrayList(e1, e2, e3); |
149 | 147 | ||
150 | assertTrue("store should be empty", | 148 | assertTrue("store should be empty", |
151 | Sets.newHashSet(service.getFlowEntries(DID)).isEmpty()); | 149 | Sets.newHashSet(service.getFlowEntries(DID)).isEmpty()); |
152 | - List<FlowEntry> ret = mgr.applyFlowRules(r1, r2, r3); | 150 | + List<FlowRule> ret = mgr.applyFlowRules(r1, r2, r3); |
153 | assertEquals("3 rules should exist", 3, flowCount()); | 151 | assertEquals("3 rules should exist", 3, flowCount()); |
154 | assertTrue("3 entries should result", fel.containsAll(ret)); | 152 | assertTrue("3 entries should result", fel.containsAll(ret)); |
155 | } | 153 | } |
... | @@ -255,17 +253,12 @@ public class SimpleFlowRuleManagerTest { | ... | @@ -255,17 +253,12 @@ public class SimpleFlowRuleManagerTest { |
255 | public void removeFlowRule(FlowRule... flowRules) { | 253 | public void removeFlowRule(FlowRule... flowRules) { |
256 | } | 254 | } |
257 | 255 | ||
258 | - @Override | ||
259 | - public Iterable<FlowEntry> getFlowMetrics(DeviceId deviceId) { | ||
260 | - return null; | ||
261 | - } | ||
262 | - | ||
263 | } | 256 | } |
264 | 257 | ||
265 | private class TestSelector implements TrafficSelector { | 258 | private class TestSelector implements TrafficSelector { |
266 | 259 | ||
267 | //for controlling hashcode uniqueness; | 260 | //for controlling hashcode uniqueness; |
268 | - private int testval; | 261 | + private final int testval; |
269 | 262 | ||
270 | public TestSelector(int val) { | 263 | public TestSelector(int val) { |
271 | testval = val; | 264 | testval = val; |
... | @@ -293,7 +286,7 @@ public class SimpleFlowRuleManagerTest { | ... | @@ -293,7 +286,7 @@ public class SimpleFlowRuleManagerTest { |
293 | private class TestTreatment implements TrafficTreatment { | 286 | private class TestTreatment implements TrafficTreatment { |
294 | 287 | ||
295 | //for controlling hashcode uniqueness; | 288 | //for controlling hashcode uniqueness; |
296 | - private int testval; | 289 | + private final int testval; |
297 | 290 | ||
298 | public TestTreatment(int val) { | 291 | public TestTreatment(int val) { |
299 | testval = val; | 292 | testval = val; | ... | ... |
... | @@ -42,7 +42,7 @@ import static org.onlab.onos.net.host.HostEvent.Type.*; | ... | @@ -42,7 +42,7 @@ import static org.onlab.onos.net.host.HostEvent.Type.*; |
42 | */ | 42 | */ |
43 | public class SimpleHostManagerTest { | 43 | public class SimpleHostManagerTest { |
44 | 44 | ||
45 | - private static final ProviderId PID = new ProviderId("foo"); | 45 | + private static final ProviderId PID = new ProviderId("of", "foo"); |
46 | 46 | ||
47 | private static final VlanId VLAN1 = VlanId.vlanId((short) 1); | 47 | private static final VlanId VLAN1 = VlanId.vlanId((short) 1); |
48 | private static final VlanId VLAN2 = VlanId.vlanId((short) 2); | 48 | private static final VlanId VLAN2 = VlanId.vlanId((short) 2); | ... | ... |
... | @@ -40,7 +40,7 @@ import static org.onlab.onos.net.link.LinkEvent.Type.*; | ... | @@ -40,7 +40,7 @@ import static org.onlab.onos.net.link.LinkEvent.Type.*; |
40 | */ | 40 | */ |
41 | public class SimpleLinkManagerTest { | 41 | public class SimpleLinkManagerTest { |
42 | 42 | ||
43 | - private static final ProviderId PID = new ProviderId("foo"); | 43 | + private static final ProviderId PID = new ProviderId("of", "foo"); |
44 | private static final DeviceId DID1 = deviceId("of:foo"); | 44 | private static final DeviceId DID1 = deviceId("of:foo"); |
45 | private static final DeviceId DID2 = deviceId("of:bar"); | 45 | private static final DeviceId DID2 = deviceId("of:bar"); |
46 | private static final DeviceId DID3 = deviceId("of:goo"); | 46 | private static final DeviceId DID3 = deviceId("of:goo"); | ... | ... |
... | @@ -29,7 +29,7 @@ import static org.onlab.onos.net.trivial.topology.impl.SimpleTopologyManagerTest | ... | @@ -29,7 +29,7 @@ import static org.onlab.onos.net.trivial.topology.impl.SimpleTopologyManagerTest |
29 | */ | 29 | */ |
30 | public class DefaultTopologyTest { | 30 | public class DefaultTopologyTest { |
31 | 31 | ||
32 | - public static final ProviderId PID = new ProviderId("foo.bar"); | 32 | + public static final ProviderId PID = new ProviderId("of", "foo.bar"); |
33 | 33 | ||
34 | public static final DeviceId D1 = deviceId("of:1"); | 34 | public static final DeviceId D1 = deviceId("of:1"); |
35 | public static final DeviceId D2 = deviceId("of:2"); | 35 | public static final DeviceId D2 = deviceId("of:2"); | ... | ... |
... | @@ -43,7 +43,7 @@ import static org.onlab.onos.net.topology.TopologyEvent.Type.TOPOLOGY_CHANGED; | ... | @@ -43,7 +43,7 @@ import static org.onlab.onos.net.topology.TopologyEvent.Type.TOPOLOGY_CHANGED; |
43 | */ | 43 | */ |
44 | public class SimpleTopologyManagerTest { | 44 | public class SimpleTopologyManagerTest { |
45 | 45 | ||
46 | - private static final ProviderId PID = new ProviderId("foo"); | 46 | + private static final ProviderId PID = new ProviderId("of", "foo"); |
47 | 47 | ||
48 | private SimpleTopologyManager mgr; | 48 | private SimpleTopologyManager mgr; |
49 | 49 | ... | ... |
... | @@ -60,7 +60,7 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr | ... | @@ -60,7 +60,7 @@ public class OpenFlowDeviceProvider extends AbstractProvider implements DevicePr |
60 | * Creates an OpenFlow device provider. | 60 | * Creates an OpenFlow device provider. |
61 | */ | 61 | */ |
62 | public OpenFlowDeviceProvider() { | 62 | public OpenFlowDeviceProvider() { |
63 | - super(new ProviderId("org.onlab.onos.provider.openflow")); | 63 | + super(new ProviderId("of", "org.onlab.onos.provider.openflow")); |
64 | } | 64 | } |
65 | 65 | ||
66 | @Activate | 66 | @Activate | ... | ... |
providers/openflow/flow/src/main/java/org/onlab/onos/provider/of/flow/impl/OpenFlowRuleProvider.java
... | @@ -62,7 +62,7 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr | ... | @@ -62,7 +62,7 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr |
62 | * Creates an OpenFlow host provider. | 62 | * Creates an OpenFlow host provider. |
63 | */ | 63 | */ |
64 | public OpenFlowRuleProvider() { | 64 | public OpenFlowRuleProvider() { |
65 | - super(new ProviderId("org.onlab.onos.provider.openflow")); | 65 | + super(new ProviderId("of", "org.onlab.onos.provider.openflow")); |
66 | } | 66 | } |
67 | 67 | ||
68 | @Activate | 68 | @Activate |
... | @@ -131,11 +131,11 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr | ... | @@ -131,11 +131,11 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr |
131 | case FLOW_REMOVED: | 131 | case FLOW_REMOVED: |
132 | //TODO: make this better | 132 | //TODO: make this better |
133 | OFFlowRemoved removed = (OFFlowRemoved) msg; | 133 | OFFlowRemoved removed = (OFFlowRemoved) msg; |
134 | - FlowRule fr = new DefaultFlowRule(DeviceId.deviceId(Dpid.uri(dpid)), null, null); | 134 | + FlowRule fr = new DefaultFlowRule(DeviceId.deviceId(Dpid.uri(dpid)), null, null, 0); |
135 | providerService.flowRemoved(fr); | 135 | providerService.flowRemoved(fr); |
136 | break; | 136 | break; |
137 | case STATS_REPLY: | 137 | case STATS_REPLY: |
138 | - pushFlowMetrics((OFStatsReply) msg); | 138 | + pushFlowMetrics(dpid, (OFStatsReply) msg); |
139 | break; | 139 | break; |
140 | case BARRIER_REPLY: | 140 | case BARRIER_REPLY: |
141 | case ERROR: | 141 | case ERROR: |
... | @@ -145,18 +145,16 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr | ... | @@ -145,18 +145,16 @@ public class OpenFlowRuleProvider extends AbstractProvider implements FlowRulePr |
145 | 145 | ||
146 | } | 146 | } |
147 | 147 | ||
148 | - private void pushFlowMetrics(OFStatsReply stats) { | 148 | + private void pushFlowMetrics(Dpid dpid, OFStatsReply stats) { |
149 | if (stats.getStatsType() != OFStatsType.FLOW) { | 149 | if (stats.getStatsType() != OFStatsType.FLOW) { |
150 | return; | 150 | return; |
151 | } | 151 | } |
152 | final OFFlowStatsReply replies = (OFFlowStatsReply) stats; | 152 | final OFFlowStatsReply replies = (OFFlowStatsReply) stats; |
153 | final List<FlowRule> entries = Lists.newLinkedList(); | 153 | final List<FlowRule> entries = Lists.newLinkedList(); |
154 | for (OFFlowStatsEntry reply : replies.getEntries()) { | 154 | for (OFFlowStatsEntry reply : replies.getEntries()) { |
155 | - entries.add(new FlowRuleBuilder(reply).build()); | 155 | + entries.add(new FlowRuleBuilder(dpid, reply).build()); |
156 | } | 156 | } |
157 | providerService.pushFlowMetrics(entries); | 157 | providerService.pushFlowMetrics(entries); |
158 | - | ||
159 | - | ||
160 | } | 158 | } |
161 | 159 | ||
162 | } | 160 | } | ... | ... |
providers/openflow/host/src/main/java/org/onlab/onos/provider/of/host/impl/OpenFlowHostProvider.java
... | @@ -61,7 +61,7 @@ public class OpenFlowHostProvider extends AbstractProvider implements HostProvid | ... | @@ -61,7 +61,7 @@ public class OpenFlowHostProvider extends AbstractProvider implements HostProvid |
61 | * Creates an OpenFlow host provider. | 61 | * Creates an OpenFlow host provider. |
62 | */ | 62 | */ |
63 | public OpenFlowHostProvider() { | 63 | public OpenFlowHostProvider() { |
64 | - super(new ProviderId("org.onlab.onos.provider.openflow")); | 64 | + super(new ProviderId("of", "org.onlab.onos.provider.openflow")); |
65 | } | 65 | } |
66 | 66 | ||
67 | @Activate | 67 | @Activate | ... | ... |
providers/openflow/link/src/main/java/org/onlab/onos/provider/of/link/impl/OpenFlowLinkProvider.java
... | @@ -55,7 +55,7 @@ public class OpenFlowLinkProvider extends AbstractProvider implements LinkProvid | ... | @@ -55,7 +55,7 @@ public class OpenFlowLinkProvider extends AbstractProvider implements LinkProvid |
55 | * Creates an OpenFlow link provider. | 55 | * Creates an OpenFlow link provider. |
56 | */ | 56 | */ |
57 | public OpenFlowLinkProvider() { | 57 | public OpenFlowLinkProvider() { |
58 | - super(new ProviderId("org.onlab.onos.provider.openflow")); | 58 | + super(new ProviderId("of", "org.onlab.onos.provider.openflow")); |
59 | } | 59 | } |
60 | 60 | ||
61 | @Activate | 61 | @Activate | ... | ... |
... | @@ -48,7 +48,7 @@ public class OpenFlowPacketProvider extends AbstractProvider implements PacketPr | ... | @@ -48,7 +48,7 @@ public class OpenFlowPacketProvider extends AbstractProvider implements PacketPr |
48 | * Creates an OpenFlow link provider. | 48 | * Creates an OpenFlow link provider. |
49 | */ | 49 | */ |
50 | public OpenFlowPacketProvider() { | 50 | public OpenFlowPacketProvider() { |
51 | - super(new ProviderId("org.onlab.onos.provider.openflow")); | 51 | + super(new ProviderId("of", "org.onlab.onos.provider.openflow")); |
52 | } | 52 | } |
53 | 53 | ||
54 | @Activate | 54 | @Activate | ... | ... |
... | @@ -27,23 +27,37 @@ mkdir bin | ... | @@ -27,23 +27,37 @@ mkdir bin |
27 | # Stage the ONOS admin scripts and patch in Karaf service wrapper extras | 27 | # Stage the ONOS admin scripts and patch in Karaf service wrapper extras |
28 | cp -r $ONOS_ROOT/tools/package/bin . | 28 | cp -r $ONOS_ROOT/tools/package/bin . |
29 | cp -r $ONOS_ROOT/tools/package/wrapper/* $KARAF_DIST | 29 | cp -r $ONOS_ROOT/tools/package/wrapper/* $KARAF_DIST |
30 | +cp -r $ONOS_ROOT/tools/package/etc/* $KARAF_DIST/etc | ||
30 | 31 | ||
31 | # Stage the ONOS bundles | 32 | # Stage the ONOS bundles |
32 | mkdir -p $KARAF_DIST/system/org/onlab | 33 | mkdir -p $KARAF_DIST/system/org/onlab |
33 | cp -r $M2_REPO/org/onlab $KARAF_DIST/system/org/ | 34 | cp -r $M2_REPO/org/onlab $KARAF_DIST/system/org/ |
34 | 35 | ||
36 | +# Wrapper & Cellar Patching ---------------------------------------------------- | ||
37 | + | ||
38 | +# Patch the Apache Karaf distribution file to add Cellar features repository | ||
39 | +perl -pi.old -e "s|^(featuresRepositories=.*)|\1,mvn:org.apache.karaf.cellar/apache-karaf-cellar/3.0.0/xml/features|" \ | ||
40 | + $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg | ||
41 | + | ||
42 | +# Patch the Apache Karaf distribution file to load ONOS features | ||
43 | +perl -pi.old -e 's|^(featuresBoot=.*)|\1,wrapper,cellar|' \ | ||
44 | + $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg | ||
45 | + | ||
46 | +# ONOS Patching ---------------------------------------------------------------- | ||
47 | + | ||
35 | # Patch the Apache Karaf distribution file to add ONOS features repository | 48 | # Patch the Apache Karaf distribution file to add ONOS features repository |
36 | perl -pi.old -e "s|^(featuresRepositories=.*)|\1,mvn:org.onlab.onos/onos-features/$ONOS_VERSION/xml/features|" \ | 49 | perl -pi.old -e "s|^(featuresRepositories=.*)|\1,mvn:org.onlab.onos/onos-features/$ONOS_VERSION/xml/features|" \ |
37 | $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg | 50 | $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg |
38 | 51 | ||
39 | # Patch the Apache Karaf distribution file to load ONOS features | 52 | # Patch the Apache Karaf distribution file to load ONOS features |
40 | -perl -pi.old -e 's|^(featuresBoot=.*)|\1,wrapper,onos-api,onos-core,onos-cli,onos-rest,onos-gui,onos-openflow,onos-app-tvue|' \ | 53 | +perl -pi.old -e 's|^(featuresBoot=.*)|\1,onos-api,onos-core,onos-cli,onos-rest,onos-gui,onos-openflow,onos-app-tvue|' \ |
41 | $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg | 54 | $ONOS_STAGE/$KARAF_DIST/etc/org.apache.karaf.features.cfg |
42 | 55 | ||
43 | # Patch the Apache Karaf distribution with ONOS branding bundle | 56 | # Patch the Apache Karaf distribution with ONOS branding bundle |
44 | cp $M2_REPO/org/onlab/onos/onos-branding/$ONOS_VERSION/onos-branding-*.jar \ | 57 | cp $M2_REPO/org/onlab/onos/onos-branding/$ONOS_VERSION/onos-branding-*.jar \ |
45 | $ONOS_STAGE/$KARAF_DIST/lib | 58 | $ONOS_STAGE/$KARAF_DIST/lib |
46 | 59 | ||
60 | + | ||
47 | # Now package up the ONOS tar file | 61 | # Now package up the ONOS tar file |
48 | cd $ONOS_STAGE_ROOT | 62 | cd $ONOS_STAGE_ROOT |
49 | COPYFILE_DISABLE=1 tar zcf $ONOS_TAR $ONOS_BITS | 63 | COPYFILE_DISABLE=1 tar zcf $ONOS_TAR $ONOS_BITS | ... | ... |
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | # ONOS developer BASH profile conveniences | 2 | # ONOS developer BASH profile conveniences |
3 | +# Simply include in your own .bash_aliases or .bash_profile | ||
3 | 4 | ||
4 | # Root of the ONOS source tree | 5 | # Root of the ONOS source tree |
5 | export ONOS_ROOT=${ONOS_ROOT:-~/onos-next} | 6 | export ONOS_ROOT=${ONOS_ROOT:-~/onos-next} |
... | @@ -42,6 +43,23 @@ alias docs='open $ONOS_ROOT/target/site/apidocs/index.html' | ... | @@ -42,6 +43,23 @@ alias docs='open $ONOS_ROOT/target/site/apidocs/index.html' |
42 | alias gui='open http://localhost:8181/onos/tvue' | 43 | alias gui='open http://localhost:8181/onos/tvue' |
43 | 44 | ||
44 | 45 | ||
46 | +# Test related conveniences | ||
47 | + | ||
48 | +# Default virtual box ONOS instances 1,2 & 3 | ||
49 | +export OC1="192.168.56.101" | ||
50 | +export OC2="192.168.56.102" | ||
51 | +export OC3="192.168.56.103" | ||
52 | + | ||
53 | +# Default instance is #1 | ||
54 | +export OCI="$OC1" | ||
55 | + | ||
56 | +# SSH to a specified ONOS instance | ||
57 | +function sshctl { | ||
58 | + [ -n "$1" ] && OCI=$1 && shift | ||
59 | + ssh -Y sdn@$OCI "$@" | ||
60 | +} | ||
61 | + | ||
62 | + | ||
45 | # Miscellaneous | 63 | # Miscellaneous |
46 | function spy { | 64 | function spy { |
47 | ps -ef | egrep "$@" | grep -v egrep | 65 | ps -ef | egrep "$@" | grep -v egrep | ... | ... |
tools/package/etc/hazelcast.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.2.xsd" | ||
3 | + xmlns="http://www.hazelcast.com/schema/config" | ||
4 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
5 | + <group> | ||
6 | + <name>onos</name> | ||
7 | + <password>rocks</password> | ||
8 | + </group> | ||
9 | + <management-center enabled="false">http://localhost:8080/mancenter</management-center> | ||
10 | + <network> | ||
11 | + <port auto-increment="true" port-count="100">5701</port> | ||
12 | + <outbound-ports> | ||
13 | + <!-- | ||
14 | + Allowed port range when connecting to other nodes. | ||
15 | + 0 or * means use system provided port. | ||
16 | + --> | ||
17 | + <ports>0</ports> | ||
18 | + </outbound-ports> | ||
19 | + <join> | ||
20 | + <multicast enabled="true"> | ||
21 | + <multicast-group>224.2.2.3</multicast-group> | ||
22 | + <multicast-port>54327</multicast-port> | ||
23 | + </multicast> | ||
24 | + <tcp-ip enabled="false"> | ||
25 | + <interface>127.0.0.1</interface> | ||
26 | + </tcp-ip> | ||
27 | + <aws enabled="false"> | ||
28 | + <access-key>my-access-key</access-key> | ||
29 | + <secret-key>my-secret-key</secret-key> | ||
30 | + <!--optional, default is us-east-1 --> | ||
31 | + <region>us-west-1</region> | ||
32 | + <!--optional, default is ec2.amazonaws.com. If set, region shouldn't be set as it will override this property --> | ||
33 | + <host-header>ec2.amazonaws.com</host-header> | ||
34 | + <!-- optional, only instances belonging to this group will be discovered, default will try all running instances --> | ||
35 | + <security-group-name>hazelcast-sg</security-group-name> | ||
36 | + <tag-key>type</tag-key> | ||
37 | + <tag-value>hz-nodes</tag-value> | ||
38 | + </aws> | ||
39 | + </join> | ||
40 | + <interfaces enabled="true"> | ||
41 | + <interface>10.1.9.*</interface> | ||
42 | + </interfaces> | ||
43 | + <ssl enabled="false"/> | ||
44 | + <socket-interceptor enabled="false"/> | ||
45 | + <symmetric-encryption enabled="false"> | ||
46 | + <!-- | ||
47 | + encryption algorithm such as | ||
48 | + DES/ECB/PKCS5Padding, | ||
49 | + PBEWithMD5AndDES, | ||
50 | + AES/CBC/PKCS5Padding, | ||
51 | + Blowfish, | ||
52 | + DESede | ||
53 | + --> | ||
54 | + <algorithm>PBEWithMD5AndDES</algorithm> | ||
55 | + <!-- salt value to use when generating the secret key --> | ||
56 | + <salt>thesalt</salt> | ||
57 | + <!-- pass phrase to use when generating the secret key --> | ||
58 | + <password>thepass</password> | ||
59 | + <!-- iteration count to use when generating the secret key --> | ||
60 | + <iteration-count>19</iteration-count> | ||
61 | + </symmetric-encryption> | ||
62 | + </network> | ||
63 | + <partition-group enabled="false"/> | ||
64 | + <executor-service> | ||
65 | + <pool-size>16</pool-size> | ||
66 | + <!-- Queue capacity. 0 means Integer.MAX_VALUE --> | ||
67 | + <queue-capacity>0</queue-capacity> | ||
68 | + </executor-service> | ||
69 | + <queue name="default"> | ||
70 | + <!-- | ||
71 | + Maximum size of the queue. When a JVM's local queue size reaches the maximum, | ||
72 | + all put/offer operations will get blocked until the queue size | ||
73 | + of the JVM goes down below the maximum. | ||
74 | + Any integer between 0 and Integer.MAX_VALUE. 0 means | ||
75 | + Integer.MAX_VALUE. Default is 0. | ||
76 | + --> | ||
77 | + <max-size>0</max-size> | ||
78 | + <!-- | ||
79 | + Number of backups. If 1 is set as the backup-count for example, | ||
80 | + then all entries of the map will be copied to another JVM for | ||
81 | + fail-safety. 0 means no backup. | ||
82 | + --> | ||
83 | + <backup-count>1</backup-count> | ||
84 | + <!-- | ||
85 | + Number of async backups. 0 means no backup. | ||
86 | + --> | ||
87 | + <async-backup-count>0</async-backup-count> | ||
88 | + <empty-queue-ttl>-1</empty-queue-ttl> | ||
89 | + </queue> | ||
90 | + | ||
91 | + <map name="default"> | ||
92 | + <!-- | ||
93 | + Data type that will be used for storing recordMap. | ||
94 | + Possible values: | ||
95 | + BINARY (default): keys and values will be stored as binary data | ||
96 | + OBJECT : values will be stored in their object forms | ||
97 | + OFFHEAP : values will be stored in non-heap region of JVM | ||
98 | + --> | ||
99 | + <in-memory-format>BINARY</in-memory-format> | ||
100 | + <!-- | ||
101 | + Number of backups. If 1 is set as the backup-count for example, | ||
102 | + then all entries of the map will be copied to another JVM for | ||
103 | + fail-safety. 0 means no backup. | ||
104 | + --> | ||
105 | + <backup-count>1</backup-count> | ||
106 | + <!-- | ||
107 | + Number of async backups. 0 means no backup. | ||
108 | + --> | ||
109 | + <async-backup-count>0</async-backup-count> | ||
110 | + <!-- | ||
111 | + Maximum number of seconds for each entry to stay in the map. Entries that are | ||
112 | + older than <time-to-live-seconds> and not updated for <time-to-live-seconds> | ||
113 | + will get automatically evicted from the map. | ||
114 | + Any integer between 0 and Integer.MAX_VALUE. 0 means infinite. Default is 0. | ||
115 | + --> | ||
116 | + <time-to-live-seconds>0</time-to-live-seconds> | ||
117 | + <!-- | ||
118 | + Maximum number of seconds for each entry to stay idle in the map. Entries that are | ||
119 | + idle(not touched) for more than <max-idle-seconds> will get | ||
120 | + automatically evicted from the map. Entry is touched if get, put or containsKey is called. | ||
121 | + Any integer between 0 and Integer.MAX_VALUE. 0 means infinite. Default is 0. | ||
122 | + --> | ||
123 | + <max-idle-seconds>0</max-idle-seconds> | ||
124 | + <!-- | ||
125 | + Valid values are: | ||
126 | + NONE (no eviction), | ||
127 | + LRU (Least Recently Used), | ||
128 | + LFU (Least Frequently Used). | ||
129 | + NONE is the default. | ||
130 | + --> | ||
131 | + <eviction-policy>NONE</eviction-policy> | ||
132 | + <!-- | ||
133 | + Maximum size of the map. When max size is reached, | ||
134 | + map is evicted based on the policy defined. | ||
135 | + Any integer between 0 and Integer.MAX_VALUE. 0 means | ||
136 | + Integer.MAX_VALUE. Default is 0. | ||
137 | + --> | ||
138 | + <max-size policy="PER_NODE">0</max-size> | ||
139 | + <!-- | ||
140 | + When max. size is reached, specified percentage of | ||
141 | + the map will be evicted. Any integer between 0 and 100. | ||
142 | + If 25 is set for example, 25% of the entries will | ||
143 | + get evicted. | ||
144 | + --> | ||
145 | + <eviction-percentage>25</eviction-percentage> | ||
146 | + <!-- | ||
147 | + While recovering from split-brain (network partitioning), | ||
148 | + map entries in the small cluster will merge into the bigger cluster | ||
149 | + based on the policy set here. When an entry merge into the | ||
150 | + cluster, there might an existing entry with the same key already. | ||
151 | + Values of these entries might be different for that same key. | ||
152 | + Which value should be set for the key? Conflict is resolved by | ||
153 | + the policy set here. Default policy is PutIfAbsentMapMergePolicy | ||
154 | + | ||
155 | + There are built-in merge policies such as | ||
156 | + com.hazelcast.map.merge.PassThroughMergePolicy; entry will be added if there is no existing entry for the key. | ||
157 | + com.hazelcast.map.merge.PutIfAbsentMapMergePolicy ; entry will be added if the merging entry doesn't exist in the cluster. | ||
158 | + com.hazelcast.map.merge.HigherHitsMapMergePolicy ; entry with the higher hits wins. | ||
159 | + com.hazelcast.map.merge.LatestUpdateMapMergePolicy ; entry with the latest update wins. | ||
160 | + --> | ||
161 | + <merge-policy>com.hazelcast.map.merge.PassThroughMergePolicy</merge-policy> | ||
162 | + </map> | ||
163 | + | ||
164 | + <multimap name="default"> | ||
165 | + <backup-count>1</backup-count> | ||
166 | + <value-collection-type>SET</value-collection-type> | ||
167 | + </multimap> | ||
168 | + | ||
169 | + <multimap name="default"> | ||
170 | + <backup-count>1</backup-count> | ||
171 | + <value-collection-type>SET</value-collection-type> | ||
172 | + </multimap> | ||
173 | + | ||
174 | + <list name="default"> | ||
175 | + <backup-count>1</backup-count> | ||
176 | + </list> | ||
177 | + | ||
178 | + <set name="default"> | ||
179 | + <backup-count>1</backup-count> | ||
180 | + </set> | ||
181 | + | ||
182 | + <jobtracker name="default"> | ||
183 | + <max-thread-size>0</max-thread-size> | ||
184 | + <!-- Queue size 0 means number of partitions * 2 --> | ||
185 | + <queue-size>0</queue-size> | ||
186 | + <retry-count>0</retry-count> | ||
187 | + <chunk-size>1000</chunk-size> | ||
188 | + <communicate-stats>true</communicate-stats> | ||
189 | + <topology-changed-strategy>CANCEL_RUNNING_OPERATION</topology-changed-strategy> | ||
190 | + </jobtracker> | ||
191 | + | ||
192 | + <semaphore name="default"> | ||
193 | + <initial-permits>0</initial-permits> | ||
194 | + <backup-count>1</backup-count> | ||
195 | + <async-backup-count>0</async-backup-count> | ||
196 | + </semaphore> | ||
197 | + | ||
198 | + <serialization> | ||
199 | + <portable-version>0</portable-version> | ||
200 | + </serialization> | ||
201 | + | ||
202 | + <services enable-defaults="true" /> | ||
203 | +</hazelcast> |
tools/test/bin/onos-log
0 → 100755
1 | +#!/bin/bash | ||
2 | +#------------------------------------------------------------------------------- | ||
3 | +# Monitors remote ONOS log file. | ||
4 | +#------------------------------------------------------------------------------- | ||
5 | + | ||
6 | +[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | ||
7 | +. $ONOS_ROOT/tools/build/envDefaults | ||
8 | + | ||
9 | +remote=$ONOS_USER@${1:-$OCI} | ||
10 | + | ||
11 | +LOG=$ONOS_INSTALL_DIR/log/karaf.log | ||
12 | + | ||
13 | +ssh $remote " | ||
14 | + while true; do | ||
15 | + [ ! -f $LOG ] && sleep 2 && continue | ||
16 | + tail -n 512 --follow=name $LOG --sleep-interval 2 | ||
17 | + done | ||
18 | +" |
-
Please register or login to post a comment