1 import org.opendaylight.mwtn.config.impl.AkkaConfig;
2 import org.opendaylight.mwtn.config.impl.AkkaConfig.ClusterNodeInfo;
4 public class AkkaConfigTest {
6 private static String getAkkaConfigSingleNodeText()
9 "odl-cluster-data {\n" +
14 " canonical.hostname = \"127.0.0.1\"\n" +
15 " canonical.port = 2550\n" +
18 " hostname = \"127.0.0.1\"\n" +
21 " # when under load we might trip a false positive on the failure detector\n" +
22 " # transport-failure-detector {\n" +
23 " # heartbeat-interval = 4 s\n" +
24 " # acceptable-heartbeat-pause = 16s\n" +
29 " # Remove \".tcp\" when using artery.\n" +
30 " seed-nodes = [\"akka.tcp://opendaylight-cluster-data@127.0.0.1:2550\"]\n" +
39 " # By default the snapshots/journal directories live in KARAF_HOME. You can choose to put it somewhere else by\n" +
40 " # modifying the following two properties. The directory location specified may be a relative or absolute path. \n" +
41 " # The relative path is always relative to KARAF_HOME.\n" +
43 " # snapshot-store.local.dir = \"target/snapshots\"\n" +
44 " # journal.leveldb.dir = \"target/journal\"\n" +
48 " # Set native = off to use a Java-only implementation of leveldb.\n" +
49 " # Note that the Java-only version is not currently considered by Akka to be production quality.\n" +
58 private static String getAkkaConfigClusterNodeText()
61 "odl-cluster-data {\n" +
64 " loglevel = \"\"\n" +
67 " hostname = \"zltcmtn23arbc01.2f0377.mtn23a.tci.att.com\"\n" +
73 " autoreceive = on\n" +
77 " event-stream = on\n" +
81 " seed-nodes = [\"akka.tcp://opendaylight-cluster-data@zltcmtn23arbc01.2f0377.mtn23a.tci.att.com:2550\", \"akka.tcp://opendaylight-cluster-data@zltcmtn23arbc02.2f0377.mtn23a.tci.att.com:2550\", \"akka.tcp://opendaylight-cluster-data@zltcmtn23arbc03.2f0377.mtn23a.tci.att.com:2550\", \"akka.tcp://opendaylight-cluster-data@zltcmtn23brbc01.f84e7a.mtn23b.tci.att.com:2550\", \"akka.tcp://opendaylight-cluster-data@zltcmtn23brbc02.f84e7a.mtn23b.tci.att.com:2550\", \"akka.tcp://opendaylight-cluster-data@zltcmtn23brbc03.f84e7a.mtn23b.tci.att.com:2550\"]\n" +
82 " seed-node-timeout = 15s\n" +
83 " roles = [\"member-1\"]\n" +
87 " journal-plugin-fallback {\n" +
88 " circuit-breaker {\n" +
89 " max-failures = 10\n" +
90 " call-timeout = 60s\n" +
91 " reset-timeout = 30s\n" +
98 "odl-cluster-rpc {\n" +
101 " loglevel = \"\"\n" +
104 " hostname = \"zltcmtn23arbc01.2f0377.mtn23a.tci.att.com\"\n" +
110 " autoreceive = on\n" +
111 " lifecycle = on\n" +
112 " unhandled = on\n" +
114 " event-stream = on\n" +
118 " seed-nodes = [\"akka.tcp://odl-cluster-rpc@zltcmtn23arbc01.2f0377.mtn23a.tci.att.com:2551\", \"akka.tcp://odl-cluster-rpc@zltcmtn23arbc02.2f0377.mtn23a.tci.att.com:2551\", \"akka.tcp://odl-cluster-rpc@zltcmtn23arbc03.2f0377.mtn23a.tci.att.com:2551\", \"akka.tcp://odl-cluster-rpc@zltcmtn23brbc01.f84e7a.mtn23b.tci.att.com:2551\", \"akka.tcp://odl-cluster-rpc@zltcmtn23brbc02.f84e7a.mtn23b.tci.att.com:2551\", \"akka.tcp://odl-cluster-rpc@zltcmtn23brbc03.f84e7a.mtn23b.tci.att.com:2551\"]\n" +
119 " seed-node-timeout = 15s\n" +
122 " journal-plugin-fallback {\n" +
123 " circuit-breaker {\n" +
124 " max-failures = 10\n" +
125 " call-timeout = 60s\n" +
126 " reset-timeout = 30s\n" +
135 public static void main(String[] args)
139 System.out.println("testing clusternode config1");
140 System.out.println("===========================");
141 cfg = AkkaConfig.parse(getAkkaConfigClusterNodeText());
142 System.out.println("succeeded: ");
143 System.out.println(cfg.toString());
144 System.out.println(String.format("found %d cluster nodes",cfg.getClusterConfig().getSeedNodes().size()));
145 for(ClusterNodeInfo n : cfg.getClusterConfig().getSeedNodes())
147 System.out.println(n.toString());
149 } catch (Exception e) {
150 System.out.println("failed: "+e.getMessage());
153 System.out.println("testing singlenode config1");
154 System.out.println("===========================");
155 cfg = AkkaConfig.parse(getAkkaConfigSingleNodeText());
156 System.out.println("succeeded: ");
157 System.out.println(cfg.toString());
158 } catch (Exception e) {
159 System.out.println("failed: "+e.getMessage());