Permalink
Browse files

Support for multiple controllers.

  • Loading branch information...
1 parent beeb1c9 commit 5a63aa7b9ef743881761863bccda523adf126360 @alnvdl alnvdl committed Oct 4, 2012
@@ -25,6 +25,9 @@
#define FAILURE 0
#define SUCCESS 1
+// TODO: proper support for ID
+#define ID 289
+
namespace vigil {
static Vlog_module lg("rfproxy");
@@ -126,7 +129,7 @@ Disposition rfproxy::on_datapath_up(const Event& e) {
for (int i = 0; i < dj.ports.size(); i++) {
if (dj.ports[i].port_no <= OFPP_MAX) {
- DatapathPortRegister msg(dj.datapath_id.as_host(), dj.ports[i].port_no);
+ DatapathPortRegister msg(ID, dj.datapath_id.as_host(), dj.ports[i].port_no);
ipc->send(RFSERVER_RFPROXY_CHANNEL, RFSERVER_ID, msg);
VLOG_INFO(lg,
@@ -151,7 +154,7 @@ Disposition rfproxy::on_datapath_down(const Event& e) {
table.delete_dp(dp_id);
// Notify RFServer
- DatapathDown dd(dp_id);
+ DatapathDown dd(ID, dp_id);
ipc->send(RFSERVER_RFPROXY_CHANNEL, RFSERVER_ID, dd);
return CONTINUE;
}
@@ -193,7 +196,7 @@ Disposition rfproxy::on_packet_in(const Event& e) {
}
// If the packet came from RFVS, redirect it to the right switch port
- if (dp_id == RFVS_DPID) {
+ if (IS_RFVS(dp_id)) {
PORT dp_port = table.vs_port_to_dp_port(dp_id, in_port);
if (dp_port != NONE)
send_packet_out(dp_port.first, dp_port.second, *(pi.get_buffer()));
@@ -203,7 +206,6 @@ Disposition rfproxy::on_packet_in(const Event& e) {
}
// If the packet came from a switch, redirect it to the right RFVS port
else {
-
PORT vs_port = table.dp_port_to_vs_port(dp_id, in_port);
if (vs_port != NONE)
send_packet_out(vs_port.first, vs_port.second, *(pi.get_buffer()));
@@ -250,7 +252,7 @@ void rfproxy::configure(const Configuration* c) {
}
void rfproxy::install() {
- ipc = new MongoIPCMessageService(MONGO_ADDRESS, MONGO_DB_NAME, RFPROXY_ID);
+ ipc = new MongoIPCMessageService(MONGO_ADDRESS, MONGO_DB_NAME, to_string<uint64_t>(ID));
factory = new RFProtocolFactory();
ipc->listen(RFSERVER_RFPROXY_CHANNEL, factory, this, false);
View
@@ -59,7 +59,10 @@ def delete_dp(self, dp_id):
# to the wrong places. We have to fix this.
netmask_prefix = lambda a: sum([bin(int(x)).count("1") for x in a.split(".", 4)])
-ipc = MongoIPC.MongoIPCMessageService(MONGO_ADDRESS, MONGO_DB_NAME, RFPROXY_ID)
+
+# TODO: proper support for ID
+ID = 140
+ipc = MongoIPC.MongoIPCMessageService(MONGO_ADDRESS, MONGO_DB_NAME, str(ID))
table = Table()
# Logging
@@ -146,7 +149,7 @@ def on_datapath_up(event):
ports = topology.getEntityByID(dp_id).ports
for port in ports:
if port <= OFPP_MAX:
- msg = DatapathPortRegister(dp_id=dp_id, dp_port=port)
+ msg = DatapathPortRegister(ct_id=ID, dp_id=dp_id, dp_port=port)
ipc.send(RFSERVER_RFPROXY_CHANNEL, RFSERVER_ID, msg)
log.info("Registering datapath port (dp_id=%s, dp_port=%d)",
@@ -159,7 +162,7 @@ def on_datapath_down(event):
table.delete_dp(dp_id)
- msg = DatapathDown(dp_id=dp_id)
+ msg = DatapathDown(ct_id=ID, dp_id=dp_id)
ipc.send(RFSERVER_RFPROXY_CHANNEL, RFSERVER_ID, msg)
def on_packet_in(event):
@@ -184,7 +187,7 @@ def on_packet_in(event):
return
# If the packet came from RFVS, redirect it to the right switch port
- if event.dpid == RFVS_DPID:
+ if is_rfvs(event.dpid):
dp_port = table.vs_port_to_dp_port(dp_id, in_port)
if dp_port is not None:
dp_id, dp_port = dp_port
View
@@ -14,7 +14,8 @@
#define SYSLOGFACILITY LOG_LOCAL7
-#define RFVS_DPID 0x7266767372667673
+#define RFVS_PREFIX 0x72667673
+#define IS_RFVS(dp_id) !((dp_id >> 32) ^ RFVS_PREFIX)
#define RF_ETH_PROTO 0x0A0A /* RF ethernet protocol */
View
@@ -12,7 +12,8 @@
DEFAULT_RFCLIENT_INTERFACE = "eth0"
-RFVS_DPID = 0x7266767372667673
+RFVS_PREFIX = 0x72667673
+is_rfvs = lambda dp_id: not ((dp_id >> 32) ^ RFVS_PREFIX)
RF_ETH_PROTO = 0x0A0A # RF ethernet protocol
@@ -8,6 +8,7 @@ PortConfig
i32 operation_id
DatapathConfig
+ i64 ct_id
i64 dp_id
i32 operation_id
@@ -22,6 +23,7 @@ RouteInfo
bool is_removal
FlowMod
+ i64 ct_id
i64 dp_id
ip address
ip netmask
@@ -31,10 +33,12 @@ FlowMod
bool is_removal
DatapathPortRegister
+ i64 ct_id
i64 dp_id
i32 dp_port
DatapathDown
+ i64 ct_id
i64 dp_id
VirtualPlaneMap
@@ -44,6 +48,7 @@ VirtualPlaneMap
i32 vs_port
DataPlaneMap
+ i64 ct_id
i64 dp_id
i32 dp_port
i64 vs_id
Oops, something went wrong.

0 comments on commit 5a63aa7

Please sign in to comment.