Assign image keyname and pubkey at vnf level
[ccsdk/apps.git] / sdnr / wireless-transport / code-Carbon-SR1 / apps / devicemanager / impl / src / main / test / AkkaConfigTest.java
1 import org.opendaylight.mwtn.config.impl.AkkaConfig;
2 import org.opendaylight.mwtn.config.impl.AkkaConfig.ClusterNodeInfo;
3
4 public class AkkaConfigTest {
5
6         private static String getAkkaConfigSingleNodeText()
7         {
8 return "\n" +
9                 "odl-cluster-data {\n" +
10                 "  akka {\n" +
11                 "    remote {\n" +
12                 "      artery {\n" +
13                 "        enabled = off\n" +
14                 "        canonical.hostname = \"127.0.0.1\"\n" +
15                 "        canonical.port = 2550\n" +
16                 "      }\n" +
17                 "      netty.tcp {\n" +
18                 "        hostname = \"127.0.0.1\"\n" +
19                 "        port = 2550\n" +
20                 "      }\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" +
25                 "      # }\n" +
26                 "    }\n" +
27                 "\n" +
28                 "    cluster {\n" +
29                 "      # Remove \".tcp\" when using artery.\n" +
30                 "      seed-nodes = [\"akka.tcp://opendaylight-cluster-data@127.0.0.1:2550\"]\n" +
31                 "\n" +
32                 "      roles = [\n" +
33                 "        \"member-1\"\n" +
34                 "      ]\n" +
35                 "\n" +
36                 "    }\n" +
37                 "\n" +
38                 "    persistence {\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" +
42                 "\n" +
43                 "      # snapshot-store.local.dir = \"target/snapshots\"\n" +
44                 "      # journal.leveldb.dir = \"target/journal\"\n" +
45                 "\n" +
46                 "      journal {\n" +
47                 "        leveldb {\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" +
50                 "\n" +
51                 "          # native = off\n" +
52                 "        }\n" +
53                 "      }\n" +
54                 "    }\n" +
55                 "  }\n" +
56                 "}";
57         }
58         private static String getAkkaConfigClusterNodeText()
59         {
60                 return "\n" +
61                                 "odl-cluster-data {\n" +
62                                 "\n" +
63                                 "  akka {\n" +
64                                 "    loglevel = \"\"\n" +
65                                 "    remote {\n" +
66                                 "      netty.tcp {\n" +
67                                 "        hostname = \"zltcmtn23arbc01.2f0377.mtn23a.tci.att.com\"\n" +
68                                 "        port = 2550\n" +
69                                 "      }\n" +
70                                 "    }\n" +
71                                 "    actor {\n" +
72                                 "    debug{\n" +
73                                 "        autoreceive = on\n" +
74                                 "        lifecycle = on\n" +
75                                 "        unhandled = on\n" +
76                                 "        fsm = on\n" +
77                                 "        event-stream = on\n" +
78                                 "     }\n" +
79                                 "    }\n" +
80                                 "    cluster {\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" +
84                                 "\n" +
85                                 "    }\n" +
86                                 "    persistence {\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" +
92                                 "         }\n" +
93                                 "     }\n" +
94                                 "    }\n" +
95                                 "  }\n" +
96                                 "}\n" +
97                                 "\n" +
98                                 "odl-cluster-rpc {\n" +
99                                 "\n" +
100                                 "  akka {\n" +
101                                 "    loglevel = \"\"\n" +
102                                 "    remote {\n" +
103                                 "      netty.tcp {\n" +
104                                 "        hostname = \"zltcmtn23arbc01.2f0377.mtn23a.tci.att.com\"\n" +
105                                 "        port = 2551\n" +
106                                 "      }\n" +
107                                 "    }\n" +
108                                 "    actor {\n" +
109                                 "    debug{\n" +
110                                 "        autoreceive = on\n" +
111                                 "        lifecycle = on\n" +
112                                 "        unhandled = on\n" +
113                                 "        fsm = on\n" +
114                                 "        event-stream = on\n" +
115                                 "     }\n" +
116                                 "    }\n" +
117                                 "    cluster {\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" +
120                                 "    }\n" +
121                                 "    persistence {\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" +
127                                 "         }\n" +
128                                 "     }\n" +
129                                 "     }\n" +
130                                 "  }\n" +
131                                 "}\n" +
132                                 "\n" +
133                                 "";
134         }
135         public static void main(String[] args)
136         {
137                 AkkaConfig cfg;
138                 try {
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())
146                         {
147                                 System.out.println(n.toString());
148                         }
149                 } catch (Exception e) {
150                         System.out.println("failed: "+e.getMessage());
151                 }
152                 try {
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());
160                 }
161
162         }
163 }