Enhanced a number of the test scripts and replaced hazelcast.xml with a mildly a…
…ugmented version of the 3.3 one.
Showing
16 changed files
with
76 additions
and
29 deletions
| 1 | package org.onlab.onos.store.impl; | 1 | package org.onlab.onos.store.impl; |
| 2 | 2 | ||
| 3 | +import com.hazelcast.config.Config; | ||
| 4 | +import com.hazelcast.config.FileSystemXmlConfig; | ||
| 3 | import com.hazelcast.core.Hazelcast; | 5 | import com.hazelcast.core.Hazelcast; |
| 4 | import com.hazelcast.core.HazelcastInstance; | 6 | import com.hazelcast.core.HazelcastInstance; |
| 5 | import de.javakaffee.kryoserializers.URISerializer; | 7 | import de.javakaffee.kryoserializers.URISerializer; |
| ... | @@ -25,6 +27,7 @@ import org.onlab.util.KryoPool; | ... | @@ -25,6 +27,7 @@ import org.onlab.util.KryoPool; |
| 25 | import org.slf4j.Logger; | 27 | import org.slf4j.Logger; |
| 26 | import org.slf4j.LoggerFactory; | 28 | import org.slf4j.LoggerFactory; |
| 27 | 29 | ||
| 30 | +import java.io.FileNotFoundException; | ||
| 28 | import java.net.URI; | 31 | import java.net.URI; |
| 29 | import java.util.ArrayList; | 32 | import java.util.ArrayList; |
| 30 | import java.util.HashMap; | 33 | import java.util.HashMap; |
| ... | @@ -36,6 +39,8 @@ import java.util.HashMap; | ... | @@ -36,6 +39,8 @@ import java.util.HashMap; |
| 36 | @Service | 39 | @Service |
| 37 | public class StoreManager implements StoreService { | 40 | public class StoreManager implements StoreService { |
| 38 | 41 | ||
| 42 | + private static final String HAZELCAST_XML_FILE = "etc/hazelcast.xml"; | ||
| 43 | + | ||
| 39 | private final Logger log = LoggerFactory.getLogger(getClass()); | 44 | private final Logger log = LoggerFactory.getLogger(getClass()); |
| 40 | 45 | ||
| 41 | protected HazelcastInstance instance; | 46 | protected HazelcastInstance instance; |
| ... | @@ -44,9 +49,14 @@ public class StoreManager implements StoreService { | ... | @@ -44,9 +49,14 @@ public class StoreManager implements StoreService { |
| 44 | 49 | ||
| 45 | @Activate | 50 | @Activate |
| 46 | public void activate() { | 51 | public void activate() { |
| 47 | - instance = Hazelcast.newHazelcastInstance(); | 52 | + try { |
| 53 | + Config config = new FileSystemXmlConfig(HAZELCAST_XML_FILE); | ||
| 54 | + instance = Hazelcast.newHazelcastInstance(config); | ||
| 48 | setupKryoPool(); | 55 | setupKryoPool(); |
| 49 | log.info("Started"); | 56 | log.info("Started"); |
| 57 | + } catch (FileNotFoundException e) { | ||
| 58 | + log.error("Unable to configure Hazelcast", e); | ||
| 59 | + } | ||
| 50 | } | 60 | } |
| 51 | 61 | ||
| 52 | /** | 62 | /** | ... | ... |
| ... | @@ -41,7 +41,7 @@ alias pp='python -m json.tool' | ... | @@ -41,7 +41,7 @@ alias pp='python -m json.tool' |
| 41 | 41 | ||
| 42 | # Short-hand to launch API docs and sample topology viewer GUI | 42 | # Short-hand to launch API docs and sample topology viewer GUI |
| 43 | alias docs='open $ONOS_ROOT/target/site/apidocs/index.html' | 43 | alias docs='open $ONOS_ROOT/target/site/apidocs/index.html' |
| 44 | -alias gui='open http://localhost:8181/onos/tvue' | 44 | +alias gui='onos-gui' |
| 45 | 45 | ||
| 46 | 46 | ||
| 47 | # Test related conveniences | 47 | # Test related conveniences | ... | ... |
| ... | @@ -16,6 +16,6 @@ env JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 | ... | @@ -16,6 +16,6 @@ env JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 |
| 16 | script | 16 | script |
| 17 | [ -f /opt/onos/options ] && . /opt/onos/options | 17 | [ -f /opt/onos/options ] && . /opt/onos/options |
| 18 | start-stop-daemon --signal INT --start --chuid sdn \ | 18 | start-stop-daemon --signal INT --start --chuid sdn \ |
| 19 | - --exec /opt/onos/bin/onos-ctl -- $ONOS_OPTS \ | 19 | + --exec /opt/onos/bin/onos-service -- $ONOS_OPTS \ |
| 20 | >/opt/onos/var/stdout.log 2>/opt/onos/var/stderr.log | 20 | >/opt/onos/var/stdout.log 2>/opt/onos/var/stderr.log |
| 21 | end script | 21 | end script | ... | ... |
| 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | -<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.2.xsd" | 2 | +<!-- |
| 3 | + ~ Copyright (c) 2008-2013, Hazelcast, Inc. All Rights Reserved. | ||
| 4 | + ~ | ||
| 5 | + ~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 6 | + ~ you may not use this file except in compliance with the License. | ||
| 7 | + ~ You may obtain a copy of the License at | ||
| 8 | + ~ | ||
| 9 | + ~ http://www.apache.org/licenses/LICENSE-2.0 | ||
| 10 | + ~ | ||
| 11 | + ~ Unless required by applicable law or agreed to in writing, software | ||
| 12 | + ~ distributed under the License is distributed on an "AS IS" BASIS, | ||
| 13 | + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 14 | + ~ See the License for the specific language governing permissions and | ||
| 15 | + ~ limitations under the License. | ||
| 16 | + --> | ||
| 17 | + | ||
| 18 | +<!-- | ||
| 19 | + The default Hazelcast configuration. This is used when: | ||
| 20 | + | ||
| 21 | + - no hazelcast.xml if present | ||
| 22 | + | ||
| 23 | +--> | ||
| 24 | +<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-3.3.xsd" | ||
| 3 | xmlns="http://www.hazelcast.com/schema/config" | 25 | xmlns="http://www.hazelcast.com/schema/config" |
| 4 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | 26 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
| 5 | <group> | 27 | <group> |
| ... | @@ -24,18 +46,6 @@ | ... | @@ -24,18 +46,6 @@ |
| 24 | <tcp-ip enabled="false"> | 46 | <tcp-ip enabled="false"> |
| 25 | <interface>127.0.0.1</interface> | 47 | <interface>127.0.0.1</interface> |
| 26 | </tcp-ip> | 48 | </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> | 49 | </join> |
| 40 | <interfaces enabled="true"> | 50 | <interfaces enabled="true"> |
| 41 | <interface>192.168.56.*</interface> | 51 | <interface>192.168.56.*</interface> |
| ... | @@ -61,9 +71,9 @@ | ... | @@ -61,9 +71,9 @@ |
| 61 | </symmetric-encryption> | 71 | </symmetric-encryption> |
| 62 | </network> | 72 | </network> |
| 63 | <partition-group enabled="false"/> | 73 | <partition-group enabled="false"/> |
| 64 | - <executor-service> | 74 | + <executor-service name="default"> |
| 65 | <pool-size>16</pool-size> | 75 | <pool-size>16</pool-size> |
| 66 | - <!-- Queue capacity. 0 means Integer.MAX_VALUE --> | 76 | + <!--Queue capacity. 0 means Integer.MAX_VALUE.--> |
| 67 | <queue-capacity>0</queue-capacity> | 77 | <queue-capacity>0</queue-capacity> |
| 68 | </executor-service> | 78 | </executor-service> |
| 69 | <queue name="default"> | 79 | <queue name="default"> |
| ... | @@ -81,13 +91,14 @@ | ... | @@ -81,13 +91,14 @@ |
| 81 | fail-safety. 0 means no backup. | 91 | fail-safety. 0 means no backup. |
| 82 | --> | 92 | --> |
| 83 | <backup-count>1</backup-count> | 93 | <backup-count>1</backup-count> |
| 94 | + | ||
| 84 | <!-- | 95 | <!-- |
| 85 | Number of async backups. 0 means no backup. | 96 | Number of async backups. 0 means no backup. |
| 86 | --> | 97 | --> |
| 87 | <async-backup-count>0</async-backup-count> | 98 | <async-backup-count>0</async-backup-count> |
| 99 | + | ||
| 88 | <empty-queue-ttl>-1</empty-queue-ttl> | 100 | <empty-queue-ttl>-1</empty-queue-ttl> |
| 89 | </queue> | 101 | </queue> |
| 90 | - | ||
| 91 | <map name="default"> | 102 | <map name="default"> |
| 92 | <!-- | 103 | <!-- |
| 93 | Data type that will be used for storing recordMap. | 104 | Data type that will be used for storing recordMap. |
| ... | @@ -97,6 +108,7 @@ | ... | @@ -97,6 +108,7 @@ |
| 97 | OFFHEAP : values will be stored in non-heap region of JVM | 108 | OFFHEAP : values will be stored in non-heap region of JVM |
| 98 | --> | 109 | --> |
| 99 | <in-memory-format>BINARY</in-memory-format> | 110 | <in-memory-format>BINARY</in-memory-format> |
| 111 | + | ||
| 100 | <!-- | 112 | <!-- |
| 101 | Number of backups. If 1 is set as the backup-count for example, | 113 | 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 | 114 | then all entries of the map will be copied to another JVM for |
| ... | @@ -144,6 +156,12 @@ | ... | @@ -144,6 +156,12 @@ |
| 144 | --> | 156 | --> |
| 145 | <eviction-percentage>25</eviction-percentage> | 157 | <eviction-percentage>25</eviction-percentage> |
| 146 | <!-- | 158 | <!-- |
| 159 | + Minimum time in milliseconds which should pass before checking | ||
| 160 | + if a partition of this map is evictable or not. | ||
| 161 | + Default value is 100 millis. | ||
| 162 | + --> | ||
| 163 | + <min-eviction-check-millis>100</min-eviction-check-millis> | ||
| 164 | + <!-- | ||
| 147 | While recovering from split-brain (network partitioning), | 165 | While recovering from split-brain (network partitioning), |
| 148 | map entries in the small cluster will merge into the bigger cluster | 166 | 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 | 167 | based on the policy set here. When an entry merge into the |
| ... | @@ -159,6 +177,7 @@ | ... | @@ -159,6 +177,7 @@ |
| 159 | com.hazelcast.map.merge.LatestUpdateMapMergePolicy ; entry with the latest update wins. | 177 | com.hazelcast.map.merge.LatestUpdateMapMergePolicy ; entry with the latest update wins. |
| 160 | --> | 178 | --> |
| 161 | <merge-policy>com.hazelcast.map.merge.PassThroughMergePolicy</merge-policy> | 179 | <merge-policy>com.hazelcast.map.merge.PassThroughMergePolicy</merge-policy> |
| 180 | + | ||
| 162 | </map> | 181 | </map> |
| 163 | 182 | ||
| 164 | <multimap name="default"> | 183 | <multimap name="default"> |
| ... | @@ -199,5 +218,6 @@ | ... | @@ -199,5 +218,6 @@ |
| 199 | <portable-version>0</portable-version> | 218 | <portable-version>0</portable-version> |
| 200 | </serialization> | 219 | </serialization> |
| 201 | 220 | ||
| 202 | - <services enable-defaults="true" /> | 221 | + <services enable-defaults="true"/> |
| 222 | + | ||
| 203 | </hazelcast> | 223 | </hazelcast> | ... | ... |
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | #------------------------------------------------------------------------------- | 2 | #------------------------------------------------------------------------------- |
| 3 | -# ONOS remote command-line client | 3 | +# ONOS remote command-line client. |
| 4 | #------------------------------------------------------------------------------- | 4 | #------------------------------------------------------------------------------- |
| 5 | 5 | ||
| 6 | [ -n "$1" ] && OCI=$1 && shift | 6 | [ -n "$1" ] && OCI=$1 && shift | ... | ... |
tools/test/bin/onos-gui
0 → 100755
| 1 | +#!/bin/bash | ||
| 2 | +#------------------------------------------------------------------------------- | ||
| 3 | +# Launches ONOS GUI on the specified node. | ||
| 4 | +#------------------------------------------------------------------------------- | ||
| 5 | + | ||
| 6 | +host=${1:-$OCI} | ||
| 7 | +host=${host:-localhost} | ||
| 8 | + | ||
| 9 | +open http://$host:8181/onos/tvue | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | #------------------------------------------------------------------------------- | 2 | #------------------------------------------------------------------------------- |
| 3 | -# Remotely pushes bits to a remote machine and installs ONOS. | 3 | +# Remotely pushes bits to a remote node and installs ONOS on it. |
| 4 | #------------------------------------------------------------------------------- | 4 | #------------------------------------------------------------------------------- |
| 5 | 5 | ||
| 6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | 6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | ... | ... |
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | #------------------------------------------------------------------------------- | 2 | #------------------------------------------------------------------------------- |
| 3 | -# Monitors remote ONOS log file. | 3 | +# Monitors remote ONOS log file on the specified node. |
| 4 | #------------------------------------------------------------------------------- | 4 | #------------------------------------------------------------------------------- |
| 5 | 5 | ||
| 6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | 6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | ... | ... |
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | #------------------------------------------------------------------------------- | 2 | #------------------------------------------------------------------------------- |
| 3 | -# Pushes the local id_rsa.pub to the remote ONOS host authorized_keys. | 3 | +# Pushes the local id_rsa.pub to the authorized_keys on a remote ONOS node. |
| 4 | #------------------------------------------------------------------------------- | 4 | #------------------------------------------------------------------------------- |
| 5 | 5 | ||
| 6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | 6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | ... | ... |
tools/test/bin/onos-service
0 → 100755
| 1 | +#!/bin/bash | ||
| 2 | +#------------------------------------------------------------------------------- | ||
| 3 | +# Remotely administers the ONOS service on the specified node. | ||
| 4 | +#------------------------------------------------------------------------------- | ||
| 5 | + | ||
| 6 | +[ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | ||
| 7 | +. $ONOS_ROOT/tools/build/envDefaults | ||
| 8 | + | ||
| 9 | +ssh $ONOS_USER@${1:-$OCI} "sudo service onos ${2:-status}" | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | #------------------------------------------------------------------------------- | 2 | #------------------------------------------------------------------------------- |
| 3 | -# Logs in to the remote ONOS instance. | 3 | +# Logs in to the remote ONOS node. |
| 4 | #------------------------------------------------------------------------------- | 4 | #------------------------------------------------------------------------------- |
| 5 | 5 | ||
| 6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | 6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | ... | ... |
| ... | @@ -9,5 +9,5 @@ | ... | @@ -9,5 +9,5 @@ |
| 9 | nodes=$(env | sort | egrep "OC[0-9]+" | cut -d= -f2) | 9 | nodes=$(env | sort | egrep "OC[0-9]+" | cut -d= -f2) |
| 10 | 10 | ||
| 11 | onos-package | 11 | onos-package |
| 12 | -for node in $nodes; do onos-install -f $node; done | 12 | +for node in $nodes; do printf "%s: " $node; onos-install -f $node; done |
| 13 | for node in $nodes; do onos-wait-for-start $node; done | 13 | for node in $nodes; do onos-wait-for-start $node; done | ... | ... |
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | #------------------------------------------------------------------------------- | 2 | #------------------------------------------------------------------------------- |
| 3 | -# Remotely stops & uninstalls ONOS. | 3 | +# Remotely stops & uninstalls ONOS on the specified node. |
| 4 | #------------------------------------------------------------------------------- | 4 | #------------------------------------------------------------------------------- |
| 5 | 5 | ||
| 6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | 6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | ... | ... |
| 1 | #!/bin/bash | 1 | #!/bin/bash |
| 2 | #------------------------------------------------------------------------------- | 2 | #------------------------------------------------------------------------------- |
| 3 | -# Waits for ONOS to reach run-level 100. | 3 | +# Waits for ONOS to reach run-level 100 on the specified remote node. |
| 4 | #------------------------------------------------------------------------------- | 4 | #------------------------------------------------------------------------------- |
| 5 | 5 | ||
| 6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | 6 | [ ! -d "$ONOS_ROOT" ] && echo "ONOS_ROOT is not defined" >&2 && exit 1 | ... | ... |
-
Please register or login to post a comment