Showing
10 changed files
with
113 additions
and
7 deletions
1 | +livetribe.slp.da.expired.services.purge.period=60 | ||
2 | +livetribe.slp.sa.client.connect.address=127.0.0.1 | ||
3 | +livetribe.slp.sa.client.factory=org.livetribe.slp.sa.StandardServiceAgentClient$Factory | ||
4 | +livetribe.slp.sa.factory=org.livetribe.slp.sa.StandardServiceAgent$Factory | ||
5 | +livetribe.slp.sa.service.renewal.enabled=true | ||
6 | +livetribe.slp.sa.unicast.prefer.tcp=false | ||
7 | +livetribe.slp.tcp.connector.factory=org.livetribe.slp.spi.net.SocketTCPConnector$Factory | ||
8 | +livetribe.slp.tcp.connector.server.factory=org.livetribe.slp.spi.net.SocketTCPConnectorServer$Factory | ||
9 | +livetribe.slp.tcp.message.max.length=4096 | ||
10 | +livetribe.slp.tcp.read.timeout=300000 | ||
11 | +livetribe.slp.ua.client.factory=org.livetribe.slp.ua.StandardUserAgentClient$Factory | ||
12 | +livetribe.slp.ua.factory=org.livetribe.slp.ua.StandardUserAgent$Factory | ||
13 | +livetribe.slp.ua.unicast.prefer.tcp=false | ||
14 | +livetribe.slp.udp.connector.factory=org.livetribe.slp.spi.net.SocketUDPConnector$Factory | ||
15 | +livetribe.slp.udp.connector.server.factory=org.livetribe.slp.spi.net.SocketUDPConnectorServer$Factory | ||
16 | +net.slp.DAAddresses= | ||
17 | +net.slp.DAAttributes= | ||
18 | +net.slp.DAHeartBeat=10800 | ||
19 | +net.slp.MTU=1400 | ||
20 | +net.slp.SAAttributes= | ||
21 | +net.slp.broadcastAddress=255.255.255.255 | ||
22 | +net.slp.datagramTimeouts=150,250,400 | ||
23 | +net.slp.interfaces=0.0.0.0 | ||
24 | +net.slp.isBroadcastOnly=false | ||
25 | +net.slp.locale=en | ||
26 | +net.slp.multicastAddress=239.255.255.253 | ||
27 | +net.slp.multicastMaximumWait=15000 | ||
28 | +net.slp.multicastTTL=255 | ||
29 | +net.slp.multicastTimeouts=150,250,400,600,1000 | ||
30 | +net.slp.notificationPort=1847 | ||
31 | +net.slp.port=427 | ||
32 | +net.slp.useScopes=default | ||
33 | + | ||
34 | +org.onlab.cluster.name = TV-ONOS |
... | @@ -17,7 +17,7 @@ import static com.google.common.collect.Lists.newArrayList; | ... | @@ -17,7 +17,7 @@ import static com.google.common.collect.Lists.newArrayList; |
17 | public class NodesListCommand extends AbstractShellCommand { | 17 | public class NodesListCommand extends AbstractShellCommand { |
18 | 18 | ||
19 | private static final String FMT = | 19 | private static final String FMT = |
20 | - "id=%s, ip=%s, state=%s %s"; | 20 | + "id=%s, address=%s:%s, state=%s %s"; |
21 | 21 | ||
22 | @Override | 22 | @Override |
23 | protected void execute() { | 23 | protected void execute() { |
... | @@ -26,7 +26,7 @@ public class NodesListCommand extends AbstractShellCommand { | ... | @@ -26,7 +26,7 @@ public class NodesListCommand extends AbstractShellCommand { |
26 | Collections.sort(nodes, Comparators.NODE_COMPARATOR); | 26 | Collections.sort(nodes, Comparators.NODE_COMPARATOR); |
27 | ControllerNode self = service.getLocalNode(); | 27 | ControllerNode self = service.getLocalNode(); |
28 | for (ControllerNode node : nodes) { | 28 | for (ControllerNode node : nodes) { |
29 | - print(FMT, node.id(), node.ip(), | 29 | + print(FMT, node.id(), node.ip(), node.tcpPort(), |
30 | service.getState(node.id()), | 30 | service.getState(node.id()), |
31 | node.equals(self) ? "*" : ""); | 31 | node.equals(self) ? "*" : ""); |
32 | } | 32 | } | ... | ... |
1 | package org.onlab.onos.cluster; | 1 | package org.onlab.onos.cluster; |
2 | 2 | ||
3 | +import org.onlab.packet.IpPrefix; | ||
4 | + | ||
3 | /** | 5 | /** |
4 | * Service for administering the cluster node membership. | 6 | * Service for administering the cluster node membership. |
5 | */ | 7 | */ |
6 | public interface ClusterAdminService { | 8 | public interface ClusterAdminService { |
7 | 9 | ||
8 | /** | 10 | /** |
11 | + * Adds a new controller node to the cluster. | ||
12 | + * | ||
13 | + * @param nodeId controller node identifier | ||
14 | + * @param ip node IP listen address | ||
15 | + * @param tcpPort tcp listen port | ||
16 | + * @return newly added node | ||
17 | + */ | ||
18 | + ControllerNode addNode(NodeId nodeId, IpPrefix ip, int tcpPort); | ||
19 | + | ||
20 | + /** | ||
9 | * Removes the specified node from the cluster node list. | 21 | * Removes the specified node from the cluster node list. |
10 | * | 22 | * |
11 | * @param nodeId controller node identifier | 23 | * @param nodeId controller node identifier | ... | ... |
1 | package org.onlab.onos.cluster; | 1 | package org.onlab.onos.cluster; |
2 | 2 | ||
3 | import org.onlab.onos.store.Store; | 3 | import org.onlab.onos.store.Store; |
4 | +import org.onlab.packet.IpPrefix; | ||
4 | 5 | ||
5 | import java.util.Set; | 6 | import java.util.Set; |
6 | 7 | ||
... | @@ -40,6 +41,16 @@ public interface ClusterStore extends Store<ClusterEvent, ClusterStoreDelegate> | ... | @@ -40,6 +41,16 @@ public interface ClusterStore extends Store<ClusterEvent, ClusterStoreDelegate> |
40 | ControllerNode.State getState(NodeId nodeId); | 41 | ControllerNode.State getState(NodeId nodeId); |
41 | 42 | ||
42 | /** | 43 | /** |
44 | + * Adds a new controller node to the cluster. | ||
45 | + * | ||
46 | + * @param nodeId controller node identifier | ||
47 | + * @param ip node IP listen address | ||
48 | + * @param tcpPort tcp listen port | ||
49 | + * @return newly added node | ||
50 | + */ | ||
51 | + ControllerNode addNode(NodeId nodeId, IpPrefix ip, int tcpPort); | ||
52 | + | ||
53 | + /** | ||
43 | * Removes the specified node from the inventory of cluster nodes. | 54 | * Removes the specified node from the inventory of cluster nodes. |
44 | * | 55 | * |
45 | * @param nodeId controller instance identifier | 56 | * @param nodeId controller instance identifier | ... | ... |
... | @@ -35,4 +35,12 @@ public interface ControllerNode { | ... | @@ -35,4 +35,12 @@ public interface ControllerNode { |
35 | */ | 35 | */ |
36 | IpPrefix ip(); | 36 | IpPrefix ip(); |
37 | 37 | ||
38 | + | ||
39 | + /** | ||
40 | + * Returns the TCP port on which the node listens for connections. | ||
41 | + * | ||
42 | + * @return TCP port | ||
43 | + */ | ||
44 | + int tcpPort(); | ||
45 | + | ||
38 | } | 46 | } | ... | ... |
... | @@ -11,13 +11,17 @@ import static com.google.common.base.MoreObjects.toStringHelper; | ... | @@ -11,13 +11,17 @@ import static com.google.common.base.MoreObjects.toStringHelper; |
11 | */ | 11 | */ |
12 | public class DefaultControllerNode implements ControllerNode { | 12 | public class DefaultControllerNode implements ControllerNode { |
13 | 13 | ||
14 | + private static final int DEFAULT_PORT = 9876; | ||
15 | + | ||
14 | private final NodeId id; | 16 | private final NodeId id; |
15 | private final IpPrefix ip; | 17 | private final IpPrefix ip; |
18 | + private final int tcpPort; | ||
16 | 19 | ||
17 | // For serialization | 20 | // For serialization |
18 | private DefaultControllerNode() { | 21 | private DefaultControllerNode() { |
19 | this.id = null; | 22 | this.id = null; |
20 | this.ip = null; | 23 | this.ip = null; |
24 | + this.tcpPort = 0; | ||
21 | } | 25 | } |
22 | 26 | ||
23 | /** | 27 | /** |
... | @@ -27,8 +31,19 @@ public class DefaultControllerNode implements ControllerNode { | ... | @@ -27,8 +31,19 @@ public class DefaultControllerNode implements ControllerNode { |
27 | * @param ip instance IP address | 31 | * @param ip instance IP address |
28 | */ | 32 | */ |
29 | public DefaultControllerNode(NodeId id, IpPrefix ip) { | 33 | public DefaultControllerNode(NodeId id, IpPrefix ip) { |
34 | + this(id, ip, DEFAULT_PORT); | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * Creates a new instance with the specified id and IP address and TCP port. | ||
39 | + * | ||
40 | + * @param id instance identifier | ||
41 | + * @param ip instance IP address | ||
42 | + */ | ||
43 | + public DefaultControllerNode(NodeId id, IpPrefix ip, int tcpPort) { | ||
30 | this.id = id; | 44 | this.id = id; |
31 | this.ip = ip; | 45 | this.ip = ip; |
46 | + this.tcpPort = tcpPort; | ||
32 | } | 47 | } |
33 | 48 | ||
34 | @Override | 49 | @Override |
... | @@ -42,6 +57,11 @@ public class DefaultControllerNode implements ControllerNode { | ... | @@ -42,6 +57,11 @@ public class DefaultControllerNode implements ControllerNode { |
42 | } | 57 | } |
43 | 58 | ||
44 | @Override | 59 | @Override |
60 | + public int tcpPort() { | ||
61 | + return tcpPort; | ||
62 | + } | ||
63 | + | ||
64 | + @Override | ||
45 | public int hashCode() { | 65 | public int hashCode() { |
46 | return Objects.hash(id); | 66 | return Objects.hash(id); |
47 | } | 67 | } |
... | @@ -60,7 +80,8 @@ public class DefaultControllerNode implements ControllerNode { | ... | @@ -60,7 +80,8 @@ public class DefaultControllerNode implements ControllerNode { |
60 | 80 | ||
61 | @Override | 81 | @Override |
62 | public String toString() { | 82 | public String toString() { |
63 | - return toStringHelper(this).add("id", id).add("ip", ip).toString(); | 83 | + return toStringHelper(this).add("id", id) |
84 | + .add("ip", ip).add("tcpPort", tcpPort).toString(); | ||
64 | } | 85 | } |
65 | 86 | ||
66 | } | 87 | } | ... | ... |
... | @@ -16,10 +16,12 @@ import org.onlab.onos.cluster.ControllerNode; | ... | @@ -16,10 +16,12 @@ import org.onlab.onos.cluster.ControllerNode; |
16 | import org.onlab.onos.cluster.NodeId; | 16 | import org.onlab.onos.cluster.NodeId; |
17 | import org.onlab.onos.event.AbstractListenerRegistry; | 17 | import org.onlab.onos.event.AbstractListenerRegistry; |
18 | import org.onlab.onos.event.EventDeliveryService; | 18 | import org.onlab.onos.event.EventDeliveryService; |
19 | +import org.onlab.packet.IpPrefix; | ||
19 | import org.slf4j.Logger; | 20 | import org.slf4j.Logger; |
20 | 21 | ||
21 | import java.util.Set; | 22 | import java.util.Set; |
22 | 23 | ||
24 | +import static com.google.common.base.Preconditions.checkArgument; | ||
23 | import static com.google.common.base.Preconditions.checkNotNull; | 25 | import static com.google.common.base.Preconditions.checkNotNull; |
24 | import static org.slf4j.LoggerFactory.getLogger; | 26 | import static org.slf4j.LoggerFactory.getLogger; |
25 | 27 | ||
... | @@ -81,6 +83,14 @@ public class ClusterManager implements ClusterService, ClusterAdminService { | ... | @@ -81,6 +83,14 @@ public class ClusterManager implements ClusterService, ClusterAdminService { |
81 | } | 83 | } |
82 | 84 | ||
83 | @Override | 85 | @Override |
86 | + public ControllerNode addNode(NodeId nodeId, IpPrefix ip, int tcpPort) { | ||
87 | + checkNotNull(nodeId, INSTANCE_ID_NULL); | ||
88 | + checkNotNull(ip, "IP address cannot be null"); | ||
89 | + checkArgument(tcpPort > 5000, "TCP port must be > 5000"); | ||
90 | + return store.addNode(nodeId, ip, tcpPort); | ||
91 | + } | ||
92 | + | ||
93 | + @Override | ||
84 | public void removeNode(NodeId nodeId) { | 94 | public void removeNode(NodeId nodeId) { |
85 | checkNotNull(nodeId, INSTANCE_ID_NULL); | 95 | checkNotNull(nodeId, INSTANCE_ID_NULL); |
86 | store.removeNode(nodeId); | 96 | store.removeNode(nodeId); | ... | ... |
... | @@ -67,7 +67,7 @@ public class DistributedClusterStore | ... | @@ -67,7 +67,7 @@ public class DistributedClusterStore |
67 | // Loads the initial set of cluster nodes | 67 | // Loads the initial set of cluster nodes |
68 | private void loadClusterNodes() { | 68 | private void loadClusterNodes() { |
69 | for (Member member : theInstance.getCluster().getMembers()) { | 69 | for (Member member : theInstance.getCluster().getMembers()) { |
70 | - addMember(member); | 70 | + addNode(node(member)); |
71 | } | 71 | } |
72 | } | 72 | } |
73 | 73 | ||
... | @@ -103,6 +103,11 @@ public class DistributedClusterStore | ... | @@ -103,6 +103,11 @@ public class DistributedClusterStore |
103 | } | 103 | } |
104 | 104 | ||
105 | @Override | 105 | @Override |
106 | + public ControllerNode addNode(NodeId nodeId, IpPrefix ip, int tcpPort) { | ||
107 | + return addNode(new DefaultControllerNode(nodeId, ip, tcpPort)); | ||
108 | + } | ||
109 | + | ||
110 | + @Override | ||
106 | public void removeNode(NodeId nodeId) { | 111 | public void removeNode(NodeId nodeId) { |
107 | synchronized (this) { | 112 | synchronized (this) { |
108 | rawNodes.remove(serialize(nodeId)); | 113 | rawNodes.remove(serialize(nodeId)); |
... | @@ -111,8 +116,7 @@ public class DistributedClusterStore | ... | @@ -111,8 +116,7 @@ public class DistributedClusterStore |
111 | } | 116 | } |
112 | 117 | ||
113 | // Adds a new node based on the specified member | 118 | // Adds a new node based on the specified member |
114 | - private synchronized ControllerNode addMember(Member member) { | 119 | + private synchronized ControllerNode addNode(DefaultControllerNode node) { |
115 | - DefaultControllerNode node = node(member); | ||
116 | rawNodes.put(serialize(node.id()), serialize(node)); | 120 | rawNodes.put(serialize(node.id()), serialize(node)); |
117 | nodes.put(node.id(), Optional.of(node)); | 121 | nodes.put(node.id(), Optional.of(node)); |
118 | states.put(node.id(), State.ACTIVE); | 122 | states.put(node.id(), State.ACTIVE); |
... | @@ -135,7 +139,7 @@ public class DistributedClusterStore | ... | @@ -135,7 +139,7 @@ public class DistributedClusterStore |
135 | @Override | 139 | @Override |
136 | public void memberAdded(MembershipEvent membershipEvent) { | 140 | public void memberAdded(MembershipEvent membershipEvent) { |
137 | log.info("Member {} added", membershipEvent.getMember()); | 141 | log.info("Member {} added", membershipEvent.getMember()); |
138 | - ControllerNode node = addMember(membershipEvent.getMember()); | 142 | + ControllerNode node = addNode(node(membershipEvent.getMember())); |
139 | notifyDelegate(new ClusterEvent(INSTANCE_ACTIVATED, node)); | 143 | notifyDelegate(new ClusterEvent(INSTANCE_ACTIVATED, node)); |
140 | } | 144 | } |
141 | 145 | ... | ... |
... | @@ -68,6 +68,11 @@ public class SimpleClusterStore | ... | @@ -68,6 +68,11 @@ public class SimpleClusterStore |
68 | } | 68 | } |
69 | 69 | ||
70 | @Override | 70 | @Override |
71 | + public ControllerNode addNode(NodeId nodeId, IpPrefix ip, int tcpPort) { | ||
72 | + return null; | ||
73 | + } | ||
74 | + | ||
75 | + @Override | ||
71 | public void removeNode(NodeId nodeId) { | 76 | public void removeNode(NodeId nodeId) { |
72 | } | 77 | } |
73 | 78 | ... | ... |
... | @@ -9,6 +9,7 @@ | ... | @@ -9,6 +9,7 @@ |
9 | <bundle>mvn:org.apache.commons/commons-lang3/3.3.2</bundle> | 9 | <bundle>mvn:org.apache.commons/commons-lang3/3.3.2</bundle> |
10 | <bundle>mvn:com.google.guava/guava/18.0</bundle> | 10 | <bundle>mvn:com.google.guava/guava/18.0</bundle> |
11 | <bundle>mvn:io.netty/netty/3.9.2.Final</bundle> | 11 | <bundle>mvn:io.netty/netty/3.9.2.Final</bundle> |
12 | + <bundle>mvn:org.livetribe.slp/livetribe-slp-osgi/2.2.1</bundle> | ||
12 | 13 | ||
13 | <bundle>mvn:com.hazelcast/hazelcast/3.3</bundle> | 14 | <bundle>mvn:com.hazelcast/hazelcast/3.3</bundle> |
14 | <bundle>mvn:com.eclipsesource.minimal-json/minimal-json/0.9.1</bundle> | 15 | <bundle>mvn:com.eclipsesource.minimal-json/minimal-json/0.9.1</bundle> | ... | ... |
-
Please register or login to post a comment