[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r24226 - gnunet/src/testbed
From: |
gnunet |
Subject: |
[GNUnet-SVN] r24226 - gnunet/src/testbed |
Date: |
Mon, 8 Oct 2012 16:50:23 +0200 |
Author: harsha
Date: 2012-10-08 16:50:23 +0200 (Mon, 08 Oct 2012)
New Revision: 24226
Modified:
gnunet/src/testbed/gnunet-service-testbed.c
gnunet/src/testbed/test_testbed_api_3peers_3controllers.c
gnunet/src/testbed/test_testbed_api_controllerlink.c
Log:
added get peer config forwarding
Modified: gnunet/src/testbed/gnunet-service-testbed.c
===================================================================
--- gnunet/src/testbed/gnunet-service-testbed.c 2012-10-08 13:30:01 UTC (rev
24225)
+++ gnunet/src/testbed/gnunet-service-testbed.c 2012-10-08 14:50:23 UTC (rev
24226)
@@ -2042,8 +2042,20 @@
peer = peer_list[peer_id];
if (GNUNET_YES == peer->is_remote)
{
- /* FIXME: forward to sub controller */
- GNUNET_break (0);
+ struct ForwardedOperationContext *fopc;
+
+ fopc = GNUNET_malloc (sizeof (struct ForwardedOperationContext));
+ GNUNET_SERVER_client_keep (client);
+ fopc->client = client;
+ fopc->operation_id = GNUNET_ntohll (msg->operation_id);
+ fopc->opc =
+ GNUNET_TESTBED_forward_operation_msg_ (peer->details.remote.controller,
+ fopc->operation_id,
&msg->header,
+
&forwarded_operation_reply_relay,
+ fopc);
+ fopc->timeout_task =
+ GNUNET_SCHEDULER_add_delayed (TIMEOUT, &forwarded_operation_timeout,
+ fopc);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
@@ -2683,8 +2695,6 @@
sizeof (struct GNUNET_PeerIdentity));
rocc->hello = GNUNET_malloc (hsize);
memcpy (rocc->hello, msg->hello, hsize);
- /* GNUNET_TRANSPORT_offer_hello (th, msg->hello, NULL, NULL); */
- /* GNUNET_TRANSPORT_try_connect (th, &msg->peer_identity); */
rocc->attempt_connect_task_id =
GNUNET_SCHEDULER_add_now (&attempt_connect_task, rocc);
rocc->timeout_rocc_task_id =
Modified: gnunet/src/testbed/test_testbed_api_3peers_3controllers.c
===================================================================
--- gnunet/src/testbed/test_testbed_api_3peers_3controllers.c 2012-10-08
13:30:01 UTC (rev 24225)
+++ gnunet/src/testbed/test_testbed_api_3peers_3controllers.c 2012-10-08
14:50:23 UTC (rev 24226)
@@ -688,8 +688,7 @@
break;
default:
GNUNET_assert (0);
- }
-
+ }
}
@@ -709,7 +708,7 @@
GNUNET_assert (NULL != host);
cfg = GNUNET_CONFIGURATION_dup (config);
cp1 = GNUNET_TESTBED_controller_start ("127.0.0.1", host, cfg, status_cb,
- NULL);
+ NULL);
abort_task =
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_MINUTES, 3), &do_abort,
@@ -718,7 +717,9 @@
/**
- * Function to check if password-less SSH logins to given ip work
+ * Function to check if
+ * 1. Password-less SSH logins to given ip work
+ * 2. gnunet-helper-testbed is found on the PATH on the remote side
*
* @param host_str numeric representation of the host's ip
* @return GNUNET_YES if password-less SSH login to the given host works;
@@ -728,8 +729,9 @@
check_ssh (char *host_str)
{
char *const remote_args[] = {
- "ssh", "-o", "BatchMode=yes", "-o", "CheckHostIP=no", "-q",
- host_str, "echo", "SSH", "works", NULL
+ "ssh", "-o", "BatchMode=yes", "-o", "CheckHostIP=no",
+ "-o", "NoHostAuthenticationForLocalhost=yes", "-q",
+ host_str, "which", "gnunet-helper-testbed", NULL
};
struct GNUNET_OS_Process *auxp;
enum GNUNET_OS_ProcessStatusType type;
@@ -760,8 +762,8 @@
main (int argc, char **argv)
{
char *const argv2[] = { "test_testbed_api_3peers_3controllers",
- "-c", "test_testbed_api.conf",
- NULL
+ "-c", "test_testbed_api.conf",
+ NULL
};
struct GNUNET_GETOPT_CommandLineOption options[] = {
GNUNET_GETOPT_OPTION_END
Modified: gnunet/src/testbed/test_testbed_api_controllerlink.c
===================================================================
--- gnunet/src/testbed/test_testbed_api_controllerlink.c 2012-10-08
13:30:01 UTC (rev 24225)
+++ gnunet/src/testbed/test_testbed_api_controllerlink.c 2012-10-08
14:50:23 UTC (rev 24226)
@@ -71,6 +71,16 @@
MASTER_STARTED,
/**
+ * A peer has been created on master
+ */
+ MASTER_PEER_CREATE_SUCCESS,
+
+ /**
+ * Peer on master controller has been started successfully.
+ */
+ MASTER_PEER_START_SUCCESS,
+
+ /**
* The first slave has been registered at master controller
*/
SLAVE1_REGISTERED,
@@ -116,6 +126,11 @@
SLAVE2_PEER_START_SUCCESS,
/**
+ * Try to connect peers on master and slave 2.
+ */
+ MASTER_SLAVE2_PEERS_CONNECTED,
+
+ /**
* Peer on slave 2 successfully stopped
*/
SLAVE2_PEER_STOP_SUCCESS,
@@ -146,9 +161,9 @@
SLAVE3_GET_CONFIG_SUCCESS,
/**
- * Slave 1 has linked to slave 3; Also marks test as success
+ * Slave 1 has linked to slave 3;
*/
- SLAVE3_LINK_SUCCESS,
+ SLAVE3_LINK_SUCCESS
};
@@ -218,6 +233,11 @@
static struct GNUNET_TESTBED_Peer *slave2_peer;
/**
+ * Handle to a peer started at master controller
+ */
+static struct GNUNET_TESTBED_Peer *master_peer;
+
+/**
* Event mask
*/
uint64_t event_mask;
@@ -305,7 +325,7 @@
op = GNUNET_TESTBED_peer_stop (slave1_peer, NULL, NULL);
GNUNET_assert (NULL != op);
break;
- case SLAVE2_PEER_START_SUCCESS:
+ case MASTER_SLAVE2_PEERS_CONNECTED:
op = GNUNET_TESTBED_peer_stop (slave2_peer, NULL, NULL);
GNUNET_assert (NULL != op);
break;
@@ -327,29 +347,32 @@
static void
peer_create_cb (void *cls, struct GNUNET_TESTBED_Peer *peer, const char *emsg)
{
+ GNUNET_assert (NULL != peer);
+ GNUNET_assert (NULL == emsg);
switch (result)
{
+ case MASTER_STARTED:
+ result = MASTER_PEER_CREATE_SUCCESS;
+ master_peer = peer;
+ GNUNET_TESTBED_operation_done (op);
+ op = GNUNET_TESTBED_peer_start (master_peer, NULL, NULL);
+ break;
case SLAVE2_LINK_SUCCESS:
- GNUNET_assert (NULL != peer);
- GNUNET_assert (NULL == emsg);
result = SLAVE1_PEER_CREATE_SUCCESS;
slave1_peer = peer;
GNUNET_TESTBED_operation_done (op);
op = GNUNET_TESTBED_peer_create (mc, slave2, cfg, peer_create_cb, NULL);
- GNUNET_assert (NULL != op);
break;
case SLAVE1_PEER_CREATE_SUCCESS:
- GNUNET_assert (NULL != peer);
- GNUNET_assert (NULL == emsg);
result = SLAVE2_PEER_CREATE_SUCCESS;
slave2_peer = peer;
GNUNET_TESTBED_operation_done (op);
op = GNUNET_TESTBED_peer_start (slave1_peer, NULL, NULL);
- GNUNET_assert (NULL != op);
break;
default:
GNUNET_assert (0);
}
+ GNUNET_assert (NULL != op);
}
@@ -411,6 +434,17 @@
op = GNUNET_TESTBED_peer_create (mc, slave, cfg, peer_create_cb, NULL);
GNUNET_assert (NULL != op);
break;
+ case MASTER_PEER_CREATE_SUCCESS:
+ GNUNET_assert (GNUNET_TESTBED_ET_PEER_START == event->type);
+ GNUNET_assert (event->details.peer_start.host == host);
+ GNUNET_assert (event->details.peer_start.peer == master_peer);
+ GNUNET_TESTBED_operation_done (op);
+ result = MASTER_PEER_START_SUCCESS;
+ slave = GNUNET_TESTBED_host_create_with_id (1, "127.0.0.1", NULL, 0);
+ GNUNET_assert (NULL != slave);
+ rh = GNUNET_TESTBED_register_host (mc, slave, ®istration_cont, NULL);
+ GNUNET_assert (NULL != rh);
+ break;
case SLAVE2_PEER_CREATE_SUCCESS:
GNUNET_assert (GNUNET_TESTBED_ET_PEER_START == event->type);
GNUNET_assert (event->details.peer_start.host == slave);
@@ -435,11 +469,22 @@
GNUNET_assert (event->details.peer_start.peer == slave2_peer);
GNUNET_TESTBED_operation_done (op);
result = SLAVE2_PEER_START_SUCCESS;
+ op = GNUNET_TESTBED_overlay_connect (mc, NULL, NULL, master_peer,
+ slave2_peer);
+ break;
+ case SLAVE2_PEER_START_SUCCESS:
+ GNUNET_assert (NULL != event);
+ GNUNET_assert (GNUNET_TESTBED_ET_CONNECT == event->type);
+ GNUNET_assert (event->details.peer_connect.peer1 == master_peer);
+ GNUNET_assert (event->details.peer_connect.peer2 == slave2_peer);
+ result = MASTER_SLAVE2_PEERS_CONNECTED;
+ GNUNET_TESTBED_operation_done (op);
+ op = NULL;
GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
(GNUNET_TIME_UNIT_SECONDS, 1), &delay_task,
NULL);
break;
- case SLAVE2_PEER_START_SUCCESS:
+ case MASTER_SLAVE2_PEERS_CONNECTED:
GNUNET_assert (GNUNET_TESTBED_ET_PEER_STOP == event->type);
GNUNET_assert (event->details.peer_stop.peer == slave2_peer);
GNUNET_TESTBED_operation_done (op);
@@ -506,7 +551,7 @@
rh = NULL;
switch (result)
{
- case MASTER_STARTED:
+ case MASTER_PEER_START_SUCCESS:
GNUNET_assert (NULL == emsg);
GNUNET_assert (NULL != mc);
result = SLAVE1_REGISTERED;
@@ -563,10 +608,8 @@
&controller_cb, NULL);
GNUNET_assert (NULL != mc);
result = MASTER_STARTED;
- slave = GNUNET_TESTBED_host_create_with_id (1, "127.0.0.1", NULL, 0);
- GNUNET_assert (NULL != slave);
- rh = GNUNET_TESTBED_register_host (mc, slave, ®istration_cont, NULL);
- GNUNET_assert (NULL != rh);
+ op = GNUNET_TESTBED_peer_create (mc, host, cfg, peer_create_cb, NULL);
+ GNUNET_assert (NULL != op);
break;
default:
GNUNET_break (0);
@@ -601,26 +644,26 @@
/**
- * Main function
+ * Function to check if
+ * 1. Password-less SSH logins to given ip work
+ * 2. gnunet-helper-testbed is found on the PATH on the remote side
+ *
+ * @param host_str numeric representation of the host's ip
+ * @return GNUNET_YES if password-less SSH login to the given host works;
+ * GNUNET_NO if not
*/
-int
-main (int argc, char **argv)
+static int
+check_ssh (char *host_str)
{
- int ret;
-
- char *const argv2[] = { "test_testbed_api_controllerlink",
- "-c", "test_testbed_api.conf",
- NULL
- };
- struct GNUNET_GETOPT_CommandLineOption options[] = {
- GNUNET_GETOPT_OPTION_END
- };
char *const remote_args[] = {
- "ssh", "-o", "BatchMode=yes", "127.0.0.1", "echo", "Hello", "World", NULL
+ "ssh", "-o", "BatchMode=yes", "-o", "CheckHostIP=no",
+ "-o", "NoHostAuthenticationForLocalhost=yes", "-q",
+ host_str, "which", "gnunet-helper-testbed", NULL
};
struct GNUNET_OS_Process *auxp;
enum GNUNET_OS_ProcessStatusType type;
unsigned long code;
+ int ret;
auxp =
GNUNET_OS_start_process_vap (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, NULL,
@@ -635,13 +678,27 @@
while (GNUNET_NO == ret);
(void) GNUNET_OS_process_wait (auxp);
GNUNET_OS_process_destroy (auxp);
- if (0 != code)
- {
- (void) printf ("Unable to run the test as this system is not configured "
- "to use password less SSH logins to localhost.\n"
- "Marking test as successful\n");
- return 0;
- }
+ return (0 != code) ? GNUNET_NO : GNUNET_YES;
+}
+
+
+/**
+ * Main function
+ */
+int
+main (int argc, char **argv)
+{
+ char *const argv2[] = { "test_testbed_api_controllerlink",
+ "-c", "test_testbed_api.conf",
+ NULL
+ };
+ struct GNUNET_GETOPT_CommandLineOption options[] = {
+ GNUNET_GETOPT_OPTION_END
+ };
+ int ret;
+
+ if (GNUNET_YES != check_ssh ("127.0.0.1"))
+ goto error_exit;
result = INIT;
ret =
GNUNET_PROGRAM_run ((sizeof (argv2) / sizeof (char *)) - 1, argv2,
@@ -650,6 +707,13 @@
if ((GNUNET_OK != ret) || (SLAVE3_LINK_SUCCESS != result))
return 1;
return 0;
+
+ error_exit:
+ (void) PRINTF ("%s",
+ "Unable to run the test as this system is not configured "
+ "to use password less SSH logins to localhost.\n"
+ "Marking test as successful\n");
+ return 0;
}
/* end of test_testbed_api_controllerlink.c */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r24226 - gnunet/src/testbed,
gnunet <=