Moved template files to separate directory.
Modified onos.sh and onos_node.conf to be able to config hazelcast.xml.
Modified some of onos.sh parameters to use default value.
Modified ZooKeeper's log dir to be configurable.
Refactored onos.sh.
- Aggregated parameters' default value to declaration point.
- Segregate common routines to functions.
Change-Id: Ia1e83fc9666c58b8897d4e2daef0326c400f48bd
diff --git a/conf/template/hazelcast.xml.template b/conf/template/hazelcast.xml.template
new file mode 100644
index 0000000..77db87c
--- /dev/null
+++ b/conf/template/hazelcast.xml.template
@@ -0,0 +1,104 @@
+<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config
+ http://www.hazelcast.com/schema/config/hazelcast-config-3.0.xsd"
+ xmlns="http://www.hazelcast.com/schema/config"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <!-- Configuration of maps used as a data store. -->
+ <map name="datastore://*">
+ <!-- must use 'sync' backup to imitate other data store -->
+ <backup-count>3</backup-count>
+ <async-backup-count>0</async-backup-count>
+ <!-- must be false for strong consistency -->
+ <read-backup-data>false</read-backup-data>
+ <!-- near cache must not be used -->
+ </map>
+
+ <map name="*">
+
+ <!--
+ Number of sync-backups. If 1 is set as the backup-count for example,
+ then all entries of the map will be copied to another JVM for
+ ail-safety. Valid numbers are 0 (no backup), 1, 2, 3.
+ -->
+ <backup-count>0</backup-count>
+
+ <!--
+ Number of async-backups. If 1 is set as the backup-count for example,
+ then all entries of the map will be copied to another JVM for
+ fail-safety. Valid numbers are 0 (no backup), 1, 2, 3.
+ -->
+ <async-backup-count>3</async-backup-count>
+
+ <!--
+ Can we read the local backup entries? Default value is false for
+ strong consistency. Being able to read backup data will give you
+ greater performance.
+ -->
+ <read-backup-data>true</read-backup-data>
+
+ <near-cache>
+ <!--
+ Maximum size of the near cache. When max size is reached,
+ cache is evicted based on the policy defined.
+ Any integer between 0 and Integer.MAX_VALUE. 0 means
+ Integer.MAX_VALUE. Default is 0.
+ -->
+ <max-size>0</max-size>
+ <!--
+ Maximum number of seconds for each entry to stay in the near cache.
+ Entries that are older than <time-to-live-seconds> will get
+ automatically evicted from the near cache.
+ Any integer between 0 and Integer.MAX_VALUE. 0 means infinite.
+ Default is 0.
+ -->
+ <time-to-live-seconds>0</time-to-live-seconds>
+
+ <!--
+ Maximum number of seconds each entry can stay in the near cache as
+ untouched (not-read).
+ Entries that are not read (touched) more than <max-idle-seconds>
+ value will get removed from the near cache.
+ Any integer between 0 and Integer.MAX_VALUE. 0 means
+ Integer.MAX_VALUE. Default is 0.
+ -->
+ <max-idle-seconds>0</max-idle-seconds>
+
+ <!--
+ Valid values are:
+ NONE (no extra eviction, <time-to-live-seconds> may still apply),
+ LRU (Least Recently Used),
+ LFU (Least Frequently Used).
+ LRU is the default.
+ Regardless of the eviction policy used, <time-to-live-seconds> will
+ still apply.
+ -->
+ <eviction-policy>NONE</eviction-policy>
+
+ <!--
+ Should the cached entries get evicted if the entries are changed
+ (updated or removed).
+ true of false. Default is true.
+ -->
+ <invalidate-on-change>true</invalidate-on-change>
+
+ </near-cache>
+ </map>
+
+ <topic name="*">
+ <global-ordering-enabled>false</global-ordering-enabled>
+ </topic>
+
+ <network>
+ <port auto-increment="true">5701</port>
+ <join>
+__HC_NETWORK__
+ <aws enabled="false">
+ </aws>
+ </join>
+ </network>
+
+ <properties>
+ <property name="hazelcast.logging.type">slf4j</property>
+ <property name="hazelcast.version.check.enabled">false</property>
+ </properties>
+</hazelcast>
diff --git a/conf/template/logback.xml.template b/conf/template/logback.xml.template
new file mode 100644
index 0000000..aef06ed
--- /dev/null
+++ b/conf/template/logback.xml.template
@@ -0,0 +1,24 @@
+<configuration scan="true" scanPeriod="1 minutes" debug="true">
+<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+<encoder>
+<pattern>%level [%logger:%thread] %msg%n</pattern>
+</encoder>
+</appender>
+
+<appender name="FILE" class="ch.qos.logback.core.FileAppender">
+<file>__FILENAME__</file>
+<encoder>
+<pattern>%date %level [%thread] %logger{10} [%file:%line] %msg%n</pattern>
+<immediateFlush>true</immediateFlush>
+</encoder>
+</appender>
+
+<logger name="org" level="WARN"/>
+<logger name="LogService" level="WARN"/> <!-- Restlet access logging -->
+<logger name="net.floodlightcontroller.logging" level="WARN"/>
+<logger name="com.hazelcast" level="INFO"/>
+
+<root level="DEBUG">
+<appender-ref ref="FILE" />
+</root>
+</configuration>
\ No newline at end of file
diff --git a/conf/template/zoo.cfg.template b/conf/template/zoo.cfg.template
new file mode 100644
index 0000000..39dc329
--- /dev/null
+++ b/conf/template/zoo.cfg.template
@@ -0,0 +1,37 @@
+# The number of milliseconds of each tick
+tickTime=2000
+# The number of ticks that the initial
+# synchronization phase can take
+initLimit=10
+# The number of ticks that can pass between
+# sending a request and getting an acknowledgement
+syncLimit=5
+# the directory where the snapshot is stored.
+# do not use /tmp for storage, /tmp here is just
+# example sakes.
+dataDir=__DATADIR__
+# the port at which the clients will connect
+clientPort=2181
+#
+# specify all servers in the Zookeeper ensemble
+#server.1=onosgui1:2888:3888
+#server.2=onosgui2:2888:3888
+#server.3=onosgui3:2888:3888
+#server.4=onosgui4:2888:3888
+#server.5=onosgui5:2888:3888
+#server.6=onosgui6:2888:3888
+#server.7=onosgui7:2888:3888
+#server.8=onosgui8:2888:3888
+#
+#
+# Be sure to read the maintenance section of the
+# administrator guide before turning on autopurge.
+#
+# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
+#
+# The number of snapshots to retain in dataDir
+#autopurge.snapRetainCount=3
+# Purge task interval in hours
+# Set to "0" to disable auto purge feature
+#autopurge.purgeInterval=1
+__HOSTS__