You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by tr...@apache.org on 2013/10/09 23:17:59 UTC
svn commit: r1530798 - in /qpid/trunk/qpid/extras/dispatch: etc/
python/qpid/dispatch/config/ src/ tests/
Author: tross
Date: Wed Oct 9 21:17:58 2013
New Revision: 1530798
URL: http://svn.apache.org/r1530798
Log:
QPID-5220 - Added configuration support for three operational modes of the router.
Modified:
qpid/trunk/qpid/extras/dispatch/etc/qpid-dispatch.conf
qpid/trunk/qpid/extras/dispatch/python/qpid/dispatch/config/schema.py
qpid/trunk/qpid/extras/dispatch/src/dispatch.c
qpid/trunk/qpid/extras/dispatch/src/router_node.c
qpid/trunk/qpid/extras/dispatch/src/router_private.h
qpid/trunk/qpid/extras/dispatch/src/router_pynode.c
qpid/trunk/qpid/extras/dispatch/tests/threerouters-A.conf
qpid/trunk/qpid/extras/dispatch/tests/threerouters-B.conf
qpid/trunk/qpid/extras/dispatch/tests/threerouters-C.conf
qpid/trunk/qpid/extras/dispatch/tests/tworouters-A.conf
qpid/trunk/qpid/extras/dispatch/tests/tworouters-B.conf
Modified: qpid/trunk/qpid/extras/dispatch/etc/qpid-dispatch.conf
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/dispatch/etc/qpid-dispatch.conf?rev=1530798&r1=1530797&r2=1530798&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/dispatch/etc/qpid-dispatch.conf (original)
+++ qpid/trunk/qpid/extras/dispatch/etc/qpid-dispatch.conf Wed Oct 9 21:17:58 2013
@@ -125,49 +125,27 @@ connector {
##
router {
##
- ## area and router-id - Each router is assigned an area name and a
- ## router-id that is unique within the area.
- ##
- area: all
- router-id: Router.A
-
- ##
- ## hello-interval - The interval, in seconds, between HELLO messages
- ## sent between connected routers. This interval can be relatively
- ## fast because HELLO messages do not propagate beyond one hop on the
- ## network. A good value is 1 second.
- ##
- hello-interval: 1
-
+ ## Router Mode:
##
- ## hello-max-age - The maximum time, in seconds, that can elapse
- ## without receiving a HELLO message from a neighbor before that
- ## neighbor is declared absent. A good value is 3 seconds.
+ ## standalone - Standalone router. In standalone mode, the router operates as
+ ## a single component. It does not participate in the routing protocol
+ ## and therefore will not coorperate with other routers.
+ ## interior - Interior router. The router operates in cooreration with other
+ ## interior routers in an interconnected network.
+ ## edge - Edge router. The router operates with an uplink into an interior
+ ## router network. Edge routers are typically used as connection concentrators
+ ## or as security firewalls for access into the interior network.
##
- hello-max-age: 3
+ mode: standalone
##
- ## ra-interval - The interval, in seconds, between RA (Router
- ## Advertisement) messages sent by this router. This interval should
- ## be considerably longer than the hello interval because RA messages
- ## propagate across the area. A good value is 30 seconds.
+ ## For Interior router mode only.
##
- ra-interval: 30
-
- ##
- ## remote-ls-max-age - The maximum age, in seconds, of a remote
- ## link-state record. Any such records that are not updated and time
- ## out shall be removed from the set and the topology shall be
- ## recomputed. A good value is 60 seconds.
- ##
- remote-ls-max-age: 60
-
- ##
- ## mobile-addr-max-age - The maximum age, in seconds, of a remote
- ## mobile address record. Any record that exceeds this age shall be
- ## removed from the routing table. A good value is 60 seconds.
+ ## area and router-id - Each router is assigned an area name and a
+ ## router-id that is unique within the area.
##
- mobile-addr-max-age: 60
+ area: all
+ router-id: Router.A
}
Modified: qpid/trunk/qpid/extras/dispatch/python/qpid/dispatch/config/schema.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/dispatch/python/qpid/dispatch/config/schema.py?rev=1530798&r1=1530797&r2=1530798&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/dispatch/python/qpid/dispatch/config/schema.py (original)
+++ qpid/trunk/qpid/extras/dispatch/python/qpid/dispatch/config/schema.py Wed Oct 9 21:17:58 2013
@@ -71,6 +71,7 @@ config_schema = {
'allow-redirect' : (bool, None, "", True)
}),
'router' : (True, {
+ 'mode' : (str, None, "", 'standalone'),
'router-id' : (str, None, "M"),
'area' : (str, None, "", None),
'hello-interval' : (int, None, "", 1),
Modified: qpid/trunk/qpid/extras/dispatch/src/dispatch.c
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/dispatch/src/dispatch.c?rev=1530798&r1=1530797&r2=1530798&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/dispatch/src/dispatch.c (original)
+++ qpid/trunk/qpid/extras/dispatch/src/dispatch.c Wed Oct 9 21:17:58 2013
@@ -24,6 +24,7 @@
#include "dispatch_private.h"
#include "alloc_private.h"
#include "log_private.h"
+#include "router_private.h"
/**
* Private Function Prototypes
@@ -34,7 +35,7 @@ void dx_server_free(dx_server
dx_container_t *dx_container(dx_dispatch_t *dx);
void dx_container_setup_agent(dx_dispatch_t *dx);
void dx_container_free(dx_container_t *container);
-dx_router_t *dx_router(dx_dispatch_t *dx, const char *area, const char *id);
+dx_router_t *dx_router(dx_dispatch_t *dx, dx_router_mode_t mode, const char *area, const char *id);
void dx_router_setup_late(dx_dispatch_t *dx);
void dx_router_free(dx_router_t *router);
dx_agent_t *dx_agent(dx_dispatch_t *dx);
@@ -53,10 +54,13 @@ dx_dispatch_t *dx_dispatch(const char *c
{
dx_dispatch_t *dx = NEW(dx_dispatch_t);
- int thread_count = 0;
- const char *container_name = 0;
- const char *router_area = 0;
- const char *router_id = 0;
+ int thread_count = 0;
+ const char *container_name = 0;
+ const char *router_mode_str = 0;
+ const char *router_area = 0;
+ const char *router_id = 0;
+
+ dx_router_mode_t router_mode = DX_ROUTER_MODE_STANDALONE;
DEQ_INIT(dx->config_listeners);
DEQ_INIT(dx->config_connectors);
@@ -78,8 +82,9 @@ dx_dispatch_t *dx_dispatch(const char *c
count = dx_config_item_count(dx->config, CONF_ROUTER);
if (count == 1) {
- router_area = dx_config_item_value_string(dx->config, CONF_ROUTER, 0, "area");
- router_id = dx_config_item_value_string(dx->config, CONF_ROUTER, 0, "router-id");
+ router_mode_str = dx_config_item_value_string(dx->config, CONF_ROUTER, 0, "mode");
+ router_area = dx_config_item_value_string(dx->config, CONF_ROUTER, 0, "area");
+ router_id = dx_config_item_value_string(dx->config, CONF_ROUTER, 0, "router-id");
}
}
@@ -89,6 +94,12 @@ dx_dispatch_t *dx_dispatch(const char *c
if (!container_name)
container_name = "00000000-0000-0000-0000-000000000000"; // TODO - gen a real uuid
+ if (router_mode_str && strcmp(router_mode_str, "interior") == 0)
+ router_mode = DX_ROUTER_MODE_INTERIOR;
+
+ if (router_mode_str && strcmp(router_mode_str, "edge") == 0)
+ router_mode = DX_ROUTER_MODE_EDGE;
+
if (!router_area)
router_area = "area";
@@ -97,7 +108,7 @@ dx_dispatch_t *dx_dispatch(const char *c
dx->server = dx_server(thread_count, container_name);
dx->container = dx_container(dx);
- dx->router = dx_router(dx, router_area, router_id);
+ dx->router = dx_router(dx, router_mode, router_area, router_id);
dx->agent = dx_agent(dx);
dx_alloc_setup_agent(dx);
Modified: qpid/trunk/qpid/extras/dispatch/src/router_node.c
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/dispatch/src/router_node.c?rev=1530798&r1=1530797&r2=1530798&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/dispatch/src/router_node.c (original)
+++ qpid/trunk/qpid/extras/dispatch/src/router_node.c Wed Oct 9 21:17:58 2013
@@ -973,7 +973,7 @@ static dx_node_type_t router_node = {"ro
static int type_registered = 0;
-dx_router_t *dx_router(dx_dispatch_t *dx, const char *area, const char *id)
+dx_router_t *dx_router(dx_dispatch_t *dx, dx_router_mode_t mode, const char *area, const char *id)
{
if (!type_registered) {
type_registered = 1;
@@ -994,6 +994,7 @@ dx_router_t *dx_router(dx_dispatch_t *dx
dx->router = router;
router->dx = dx;
+ router->router_mode = mode;
router->router_area = area;
router->router_id = id;
router->node = dx_container_set_default_node_type(dx, &router_node, (void*) router, DX_DIST_BOTH);
@@ -1021,8 +1022,10 @@ dx_router_t *dx_router(dx_dispatch_t *dx
// Create addresses for all of the routers in the topology. It will be registered
// locally later in the initialization sequence.
//
- router->router_addr = dx_router_register_address(dx, "qdxrouter", 0, 0);
- router->hello_addr = dx_router_register_address(dx, "qdxhello", 0, 0);
+ if (router->router_mode == DX_ROUTER_MODE_INTERIOR) {
+ router->router_addr = dx_router_register_address(dx, "qdxrouter", 0, 0);
+ router->hello_addr = dx_router_register_address(dx, "qdxhello", 0, 0);
+ }
//
// Inform the field iterator module of this router's id and area. The field iterator
@@ -1035,7 +1038,12 @@ dx_router_t *dx_router(dx_dispatch_t *dx
//
dx_python_start();
- dx_log(module, LOG_INFO, "Router started, area=%s id=%s", area, id);
+ switch (router->router_mode) {
+ case DX_ROUTER_MODE_STANDALONE: dx_log(module, LOG_INFO, "Router started in Standalone mode"); break;
+ case DX_ROUTER_MODE_INTERIOR: dx_log(module, LOG_INFO, "Router started in Interior mode, area=%s id=%s", area, id); break;
+ case DX_ROUTER_MODE_EDGE: dx_log(module, LOG_INFO, "Router started in Edge mode"); break;
+ }
+
return router;
}
Modified: qpid/trunk/qpid/extras/dispatch/src/router_private.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/dispatch/src/router_private.h?rev=1530798&r1=1530797&r2=1530798&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/dispatch/src/router_private.h (original)
+++ qpid/trunk/qpid/extras/dispatch/src/router_private.h Wed Oct 9 21:17:58 2013
@@ -30,6 +30,12 @@ void dx_pyrouter_tick(dx_router_t *route
void dx_router_agent_setup(dx_router_t *router);
typedef enum {
+ DX_ROUTER_MODE_STANDALONE, // Standalone router. No routing protocol participation
+ DX_ROUTER_MODE_INTERIOR, // Interior router. Full participation in routing protocol.
+ DX_ROUTER_MODE_EDGE // Edge router. No routing protocol participation, access via other protocols.
+} dx_router_mode_t;
+
+typedef enum {
DX_LINK_ENDPOINT, // A link to a connected endpoint
DX_LINK_ROUTER, // A link to a peer router in the same area
DX_LINK_AREA // A link to a peer router in a different area (area boundary)
@@ -122,6 +128,7 @@ DEQ_DECLARE(dx_address_t, dx_address_lis
struct dx_router_t {
dx_dispatch_t *dx;
+ dx_router_mode_t router_mode;
const char *router_area;
const char *router_id;
dx_node_t *node;
Modified: qpid/trunk/qpid/extras/dispatch/src/router_pynode.c
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/dispatch/src/router_pynode.c?rev=1530798&r1=1530797&r2=1530798&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/dispatch/src/router_pynode.c (original)
+++ qpid/trunk/qpid/extras/dispatch/src/router_pynode.c Wed Oct 9 21:17:58 2013
@@ -444,6 +444,13 @@ static PyTypeObject RouterAdapterType =
void dx_router_python_setup(dx_router_t *router)
{
+ //
+ // If we are not operating as an interior router, don't start the
+ // router module.
+ //
+ if (router->router_mode != DX_ROUTER_MODE_INTERIOR)
+ return;
+
PyObject *pDispatchModule = dx_python_module();
RouterAdapterType.tp_new = PyType_GenericNew;
@@ -534,7 +541,7 @@ void dx_pyrouter_tick(dx_router_t *route
PyObject *pArgs;
PyObject *pValue;
- if (router->pyTick) {
+ if (router->pyTick && router->router_mode == DX_ROUTER_MODE_INTERIOR) {
dx_python_lock();
pArgs = PyTuple_New(0);
pValue = PyObject_CallObject(router->pyTick, pArgs);
Modified: qpid/trunk/qpid/extras/dispatch/tests/threerouters-A.conf
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/dispatch/tests/threerouters-A.conf?rev=1530798&r1=1530797&r2=1530798&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/dispatch/tests/threerouters-A.conf (original)
+++ qpid/trunk/qpid/extras/dispatch/tests/threerouters-A.conf Wed Oct 9 21:17:58 2013
@@ -59,3 +59,11 @@ connector {
sasl-mechanisms: ANONYMOUS
}
+router {
+ mode: interior
+ area: A
+ router-id: QDR.A
+}
+
+
+
Modified: qpid/trunk/qpid/extras/dispatch/tests/threerouters-B.conf
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/dispatch/tests/threerouters-B.conf?rev=1530798&r1=1530797&r2=1530798&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/dispatch/tests/threerouters-B.conf (original)
+++ qpid/trunk/qpid/extras/dispatch/tests/threerouters-B.conf Wed Oct 9 21:17:58 2013
@@ -59,3 +59,9 @@ connector {
sasl-mechanisms: ANONYMOUS
}
+
+router {
+ mode: interior
+ area: A
+ router-id: QDR.B
+}
Modified: qpid/trunk/qpid/extras/dispatch/tests/threerouters-C.conf
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/dispatch/tests/threerouters-C.conf?rev=1530798&r1=1530797&r2=1530798&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/dispatch/tests/threerouters-C.conf (original)
+++ qpid/trunk/qpid/extras/dispatch/tests/threerouters-C.conf Wed Oct 9 21:17:58 2013
@@ -52,3 +52,9 @@ listener {
sasl-mechanisms: ANONYMOUS
}
+
+router {
+ mode: interior
+ area: A
+ router-id: QDR.C
+}
Modified: qpid/trunk/qpid/extras/dispatch/tests/tworouters-A.conf
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/dispatch/tests/tworouters-A.conf?rev=1530798&r1=1530797&r2=1530798&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/dispatch/tests/tworouters-A.conf (original)
+++ qpid/trunk/qpid/extras/dispatch/tests/tworouters-A.conf Wed Oct 9 21:17:58 2013
@@ -52,3 +52,8 @@ listener {
sasl-mechanisms: ANONYMOUS
}
+router {
+ mode: interior
+ area: A
+ router-id: QDR.A
+}
Modified: qpid/trunk/qpid/extras/dispatch/tests/tworouters-B.conf
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/extras/dispatch/tests/tworouters-B.conf?rev=1530798&r1=1530797&r2=1530798&view=diff
==============================================================================
--- qpid/trunk/qpid/extras/dispatch/tests/tworouters-B.conf (original)
+++ qpid/trunk/qpid/extras/dispatch/tests/tworouters-B.conf Wed Oct 9 21:17:58 2013
@@ -59,3 +59,8 @@ connector {
sasl-mechanisms: ANONYMOUS
}
+router {
+ mode: interior
+ area: A
+ router-id: QDR.B
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org