[nox-dev] how to manage multiple switches with the help of NOX controller
hi! i am using multiple switches with a single controller than if i wantto flood the message at all the ports of all the switches than how would i knowthat what are the dpids of the switches. like i have to call this fuction to flood the messageon all the switches. def send_openflow(self, dp_id, buffer_id, packet, actions, inport=openflow.OFPP_CONTROLLER):Sends an openflow packet to a datapath. This function is a convenient wrapper for send_openflow_packet and send_openflow_buffer for situations where it is unknown inadvance whether the packet to be sent is buffered. If'buffer_id' is -1, it sends 'packet'; otherwise, it sends thebuffer represented by 'buffer_id'. dp_id - datapath to send packet tobuffer_id - id of buffer to send outpacket - data to put in openflow packetactions - list of actions or dp port to send out ofinport - dp port to mark as source (defaults to Controller port) ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev
Re: [nox-dev] how to manage multiple switches with the help of NOX controller
If you want to do it yourself, just monitor datapath_join events. These are fired whenever a switch connects, and the event object holds the dpid of the switch. Store these in a list. Or you can just make use of the topology component, which does pretty much exactly this (along with some other stuff), and then has a method to get a list of all connected switches. Hope that helps. -- Murphy On Jul 23, 2011, at 11:04 PM, ali ahmad wrote: hi! i am using multiple switches with a single controller than if i want to flood the message at all the ports of all the switches than how would i know that what are the dpids of the switches. like i have to call this fuction to flood the message on all the switches. def send_openflow(self, dp_id, buffer_id, packet, actions, inport=openflow.OFPP_CONTROLLER): Sends an openflow packet to a datapath. This function is a convenient wrapper for send_openflow_packet and send_openflow_buffer for situations where it is unknown in advance whether the packet to be sent is buffered. If 'buffer_id' is -1, it sends 'packet'; otherwise, it sends the buffer represented by 'buffer_id'. dp_id - datapath to send packet to buffer_id - id of buffer to send out packet - data to put in openflow packet actions - list of actions or dp port to send out of inport - dp port to mark as source (defaults to Controller port) ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev
Re: [nox-dev] how to manage multiple switches with the help of NOX controller
NOX comes with a number of components which implement different pieces of functionality, and topology is one example of such. For some more information, see the wiki: http://noxrepo.org/noxwiki/index.php/NOX_Components . For an example of using the topology component from Python, see the flowtracer component. But skipping the topology component for now and keeping your own list of of dpids might be more approachable for the moment. pyswitch actually demonstrates setting up callbacks for the datapath_join and datapath_leave events. All you need to do is write handlers that actually keep track of dpids (by adding and removing them from a Python set would be my suggestion). This is only a handful of lines of code. -- Murphy On Jul 24, 2011, at 3:09 AM, ali ahmad wrote: Off list Subject: Re: [nox-dev] how to manage multiple switches with the help of NOX controller From: jam...@nau.edu Date: Sun, 24 Jul 2011 02:53:44 -0700 CC: nox-dev@noxrepo.org To: aliahmad...@hotmail.com If you want to do it yourself, just monitor datapath_join events. These are fired whenever a switch connects, and the event object holds the dpid of the switch. Store these in a list. Or you can just make use of the topology component, which does pretty much exactly this (along with some other stuff), and then has a method to get a list of all connected switches. Hope that helps. -- Murphy On Jul 23, 2011, at 11:04 PM, ali ahmad wrote: hi! i am using multiple switches with a single controller than if i want to flood the message at all the ports of all the switches than how would i know that what are the dpids of the switches. like i have to call this fuction to flood the message on all the switches. def send_openflow(self, dp_id, buffer_id, packet, actions, inport=openflow.OFPP_CONTROLLER): Sends an openflow packet to a datapath. This function is a convenient wrapper for send_openflow_packet and send_openflow_buffer for situations where it is unknown in advance whether the packet to be sent is buffered. If 'buffer_id' is -1, it sends 'packet'; otherwise, it sends the buffer represented by 'buffer_id'. dp_id - datapath to send packet to buffer_id - id of buffer to send out packet - data to put in openflow packet actions - list of actions or dp port to send out of inport - dp port to mark as source (defaults to Controller port) ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev
Re: [nox-dev] how to manage multiple switches with the help of NOX controller
No and no. You should really ready pyswitch.py -- as I said, it does most of what you need already. However, here's the start of an untested component that doesn't do anything except keep track of dpids: from nox.lib.core import * class mycomponent (Component): def __init__ (self, ctxt): Component.__init__(self, ctxt) self.dpids = set() self.register_for_datapath_join(self.handle_datapath_join) self.register_for_datapath_leave(self.handle_datapath_leave) def handle_datapath_join (self, dpid): self.dpids.add(dpid) def handle_datapath_leave (self, dpid): self.dpids.remove(dpid) def getInterface (self): return self.__class__.__name__ def getFactory (): class Factory: def instance (self, ctxt): return mycomponent(ctxt) return Factory() Good luck. -- Murphy P.S., I am assuming you're dropping the CC to the mailing list by accident. Please be sure to reply all. On Jul 24, 2011, at 3:33 AM, ali ahmad wrote: Off list Subject: Re: [nox-dev] how to manage multiple switches with the help of NOX controller From: jam...@nau.edu Date: Sun, 24 Jul 2011 03:25:54 -0700 CC: nox-dev@noxrepo.org To: aliahmad...@hotmail.com NOX comes with a number of components which implement different pieces of functionality, and topology is one example of such. For some more information, see the wiki: http://noxrepo.org/noxwiki/index.php/NOX_Components . For an example of using the topology component from Python, see the flowtracer component. But skipping the topology component for now and keeping your own list of of dpids might be more approachable for the moment. pyswitch actually demonstrates setting up callbacks for the datapath_join and datapath_leave events. All you need to do is write handlers that actually keep track of dpids (by adding and removing them from a Python set would be my suggestion). This is only a handful of lines of code. -- Murphy On Jul 24, 2011, at 3:09 AM, ali ahmad wrote: Off list Subject: Re: [nox-dev] how to manage multiple switches with the help of NOX controller From: jam...@nau.edu Date: Sun, 24 Jul 2011 02:53:44 -0700 CC: nox-dev@noxrepo.org To: aliahmad...@hotmail.com If you want to do it yourself, just monitor datapath_join events. These are fired whenever a switch connects, and the event object holds the dpid of the switch. Store these in a list. Or you can just make use of the topology component, which does pretty much exactly this (along with some other stuff), and then has a method to get a list of all connected switches. Hope that helps. -- Murphy On Jul 23, 2011, at 11:04 PM, ali ahmad wrote: hi! i am using multiple switches with a single controller than if i want to flood the message at all the ports of all the switches than how would i know that what are the dpids of the switches. like i have to call this fuction to flood the message on all the switches. def send_openflow(self, dp_id, buffer_id, packet, actions, inport=openflow.OFPP_CONTROLLER): Sends an openflow packet to a datapath. This function is a convenient wrapper for send_openflow_packet and send_openflow_buffer for situations where it is unknown in advance whether the packet to be sent is buffered. If 'buffer_id' is -1, it sends 'packet'; otherwise, it sends the buffer represented by 'buffer_id'. dp_id - datapath to send packet to buffer_id - id of buffer to send out packet - data to put in openflow packet actions - list of actions or dp port to send out of inport - dp port to mark as source (defaults to Controller port) ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev
Re: [nox-dev] how to manage multiple switches with the help of NOX controller
thnks a lot but I am really sorry for bothering u again and again but it would be kind of u if u just tell me that what are these arguments inside the functions u hv inialized self.register_for_datapath_join(self.handle_datapath_join) self.register_for_datapath_leave(self.handle_datapath_leave)Subject: Re: [nox-dev] how to manage multiple switches with the help of NOX controller From: jam...@nau.edu Date: Sun, 24 Jul 2011 04:39:40 -0700 CC: nox-dev@noxrepo.org To: aliahmad...@hotmail.com No and no. You should really ready pyswitch.py -- as I said, it does most of what you need already. However, here's the start of an untested component that doesn't do anything except keep track of dpids: from nox.lib.core import * class mycomponent (Component): def __init__ (self, ctxt): Component.__init__(self, ctxt)self.dpids = set() self.register_for_datapath_join(self.handle_datapath_join) self.register_for_datapath_leave(self.handle_datapath_leave) def handle_datapath_join (self, dpid):self.dpids.add(dpid) def handle_datapath_leave (self, dpid):self.dpids.remove(dpid) def getInterface (self):return self.__class__.__name__ def getFactory (): class Factory:def instance (self, ctxt): return mycomponent(ctxt) return Factory() Good luck. -- Murphy P.S., I am assuming you're dropping the CC to the mailing list by accident. Please be sure to reply all. On Jul 24, 2011, at 3:33 AM, ali ahmad wrote:Off listSubject: Re: [nox-dev] how to manage multiple switches with the help of NOX controller From: jam...@nau.edu Date: Sun, 24 Jul 2011 03:25:54 -0700 CC: nox-dev@noxrepo.org To: aliahmad...@hotmail.com NOX comes with a number of components which implement different pieces of functionality, and topology is one example of such. For some more information, see the wiki: http://noxrepo.org/noxwiki/index.php/NOX_Components . For an example of using the topology component from Python, see the flowtracer component. But skipping the topology component for now and keeping your own list of of dpids might be more approachable for the moment. pyswitch actually demonstrates setting up callbacks for the datapath_join and datapath_leave events. All you need to do is write handlers that actually keep track of dpids (by adding and removing them from a Python set would be my suggestion). This is only a handful of lines of code. -- Murphy On Jul 24, 2011, at 3:09 AM, ali ahmad wrote:Off listSubject: Re: [nox-dev] how to manage multiple switches with the help of NOX controller From: jam...@nau.edu Date: Sun, 24 Jul 2011 02:53:44 -0700 CC: nox-dev@noxrepo.org To: aliahmad...@hotmail.com If you want to do it yourself, just monitor datapath_join events. These are fired whenever a switch connects, and the event object holds the dpid of the switch. Store these in a list. Or you can just make use of the topology component, which does pretty much exactly this (along with some other stuff), and then has a method to get a list of all connected switches. Hope that helps.-- Murphy On Jul 23, 2011, at 11:04 PM, ali ahmad wrote:hi! i am using multiple switches with a single controller than if i wantto flood the message at all the ports of all the switches than how would i knowthat what are the dpids of the switches. like i have to call this fuction to flood the messageon all the switches. def send_openflow(self, dp_id, buffer_id, packet, actions, inport=openflow.OFPP_CONTROLLER):Sends an openflow packet to a datapath. This function is a convenient wrapper for send_openflow_packet and send_openflow_buffer for situations where it is unknown inadvance whether the packet to be sent is buffered. If'buffer_id' is -1, it sends 'packet'; otherwise, it sends thebuffer represented by 'buffer_id'. dp_id - datapath to send packet tobuffer_id - id of buffer to send outpacket - data to put in openflow packetactions - list of actions or dp port to send out ofinport - dp port to mark as source (defaults to Controller port)___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev
[nox-dev] Nox on Fedora8
Hi all, I needed recently to run Nox on PlanetLab hosts running Fedora 8. It took me a bit to get the process right, so I have written down the steps I followed, in case others find it useful. http://groups.geni.net/geni/wiki/GeniExperimenter/NoxAndF8 I just needed to run the switch controller, so I haven't fully tested that all the necessary packages are there, for all controllers. Cheers, Niky ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev
Re: [nox-dev] Change the destination of packets
I mean a tcpdump of the control traffic. Not datapath. :) On 24 July 2011 10:04, Ricardo Bennesby ricardo.benne...@gmail.com wrote: Hi. The tcpdump .pcap file the print of a dump-flows command are attached. The dump-flows, tcp-dump and wireshark shows the same result: I first ping from 192.168.47.1 (h1- n2) to 10.0.0.2 (h2-n1) and take mac address, port and IP of h2. Then, when I ping from 192.168.47.1 to 192.168.47.2 (h2-n2) I want the packets be forwarded to 10.0.0.2. As the files shows, the packets are forwarded to MAC address desired, but it continues looking for the original IP, it means that it is not modified in the flow_mod. I tried in several way, fixing the original IP in the match field and setting an action to change the destination IP, but it didn't work. It con continues generating ARP request for 192.168.47.2. ofp_action_nw_addr *nwaction = (ofp_action_nw_addr *)malloc(sizeof(ofp_action_nw_addr)); nwaction-type = htons(OFPAT_SET_NW_DST); nwaction-len = htons(sizeof(ofp_action_nw_addr)); nwaction-nw_addr = inet_addr(10.0.0.2); In past discussions in the list, was said that openflow does routing in Layer 2. Is this a cause of destination IP does not change? Or am I missing something? Thank you very much for help. Best Regards. 2011/7/21 kk yap yap...@stanford.edu A tcpdump of the control traffic will be useful and easier. Regards KK On 21 July 2011 16:04, Ricardo Bennesby ricardo.benne...@gmail.com wrote: Hi KK. I tested as you suggested. ofm-match.nw_dst = htons(36677824); // I tested also ofm-match.nw_dst = flow.nw_dst; and in the action I did: nwaction-nw_addr = htons(new_ip); But it continue trying to send to IP 192.168.47.2... The Wireshark continues showing these: Ethernet II, Src: 5a:8c:01:8b:e0:fb (5a:8c:01:8b:e0:fb), Dst: 62:4c:de:97:90:e4 (62:4c:de:97:90:e4) Internet Protocol, Src: 192.168.47.1 (192.168.47.1), Dst: 192.168.47.2 (192.168.47.2) The MAC adress is of host with IP 10.0.0.2. So the dataframes arrive in this host. But the destination IP continues without midifications. Any suggestion? Thank you very much. Best Regards. 2011/7/21 kk yap yap...@stanford.edu Hi Ricardo, Try matching on the old IP, then rewrite to the new IP. Regards KK On 20 July 2011 14:50, Ricardo Bennesby ricardo.benne...@gmail.com wrote: Hi all. I would like to forward packets from one host to another. I have the following topology: c0 c0 | | s3- s3 / \ / \ h1 h2 h1 h2 Each host can ping each other. The two networks are connected by their switches (s3). In net1 h1 and h2 have IP 10.0.0.1 and 10.0.0.2. In net2 h1 and h2 have IP 192.168.47.1 and 192.168.47.2 I want that everytime I ping from some host in 192.168.47.2 the packets be forward to 10.0.0.2. I am using the switch.cc component and making some modifications on it. I set some actions to achieve this, using flow_mod and changing the out_port, destination mac_address and destination IP. Using wireshark, listening to the port where h2 (10.0.0.2) is, I saw that it got an ARP request from h1. So, looks like the packets arrive in the correct ethernet address, but it continue asking for 192.168.47.2. The destination IP was not modified. The code follows: if (flow.nw_dst == 36677824){//if destination ip=192.168.47.2 uint8_t no_of_actions_len = 56; uint8_t action_length = no_of_actions_len/(sizeof(struct ofp_action_header)); unsigned char *action_type = (unsigned char*)malloc(action_length*sizeof(struct ofp_action_header)); ofp_flow_mod* ofm; size_t size = sizeof *ofm + 7*sizeof(ofp_action_output); boost::shared_arraychar raw_of(new char[size]); ofm = (ofp_flow_mod*) raw_of.get(); ofm-header.version = OFP_VERSION; ofm-header.type = OFPT_FLOW_MOD; ofm-header.length = htons(size); //ofm-match.wildcards = htonl(0); ofm-match.wildcards = htonl(120 | 11); ofm-match.in_port = htons(flow.in_port); ofm-match.dl_vlan = flow.dl_vlan; ofm-match.dl_vlan_pcp = flow.dl_vlan_pcp; memcpy(ofm-match.dl_src, flow.dl_src.octet, sizeof ofm-match.dl_src); memcpy(ofm-match.dl_dst, new_mac.octet, sizeof ofm-match.dl_dst); ofm-match.dl_type = flow.dl_type; ofm-match.nw_src = flow.nw_src; ofm-match.nw_dst = new_ip; ofm-match.tp_src = flow.tp_src; ofm-match.tp_dst =
Re: [nox-dev] how to manage multiple switches with the help of NOX controller
The arguments the register functions are callbacks to be called when the corresponding events occur. In the case of my example program, these are two methods implemented on mycomponent (handle_datapath_join). The docstring for register_for_datapath_join (in core.py) has more info: def register_for_datapath_join(self, handler): Register a handler for a datapath join event. The handler will be called with: handler(dpid, attrs). 'dpid' is the datapath id of the switch 'attrs' is a dictionary with the following keys: N_BUFFERS, N_TABLES, CAPABILITIES, ACTIONS, PORTS The PORTS value is a list of port dictionaries where each dictionary has the keys listed in the register_for_port_status documentation. Note that this makes apparent a bug in my example program. handle_datapath_join() should have a second parameter (attrs). -- Murphy On Jul 24, 2011, at 5:04 AM, ali ahmad wrote: thnks a lot but I am really sorry for bothering u again and again but it would be kind of u if u just tell me that what are these arguments inside the functions u hv inialized self.register_for_datapath_join(self.handle_datapath_join) self.register_for_datapath_leave(self.handle_datapath_leave) Subject: Re: [nox-dev] how to manage multiple switches with the help of NOX controller From: jam...@nau.edu Date: Sun, 24 Jul 2011 04:39:40 -0700 CC: nox-dev@noxrepo.org To: aliahmad...@hotmail.com No and no. You should really ready pyswitch.py -- as I said, it does most of what you need already. However, here's the start of an untested component that doesn't do anything except keep track of dpids: from nox.lib.core import * class mycomponent (Component): def __init__ (self, ctxt): Component.__init__(self, ctxt) self.dpids = set() self.register_for_datapath_join(self.handle_datapath_join) self.register_for_datapath_leave(self.handle_datapath_leave) def handle_datapath_join (self, dpid): self.dpids.add(dpid) def handle_datapath_leave (self, dpid): self.dpids.remove(dpid) def getInterface (self): return self.__class__.__name__ def getFactory (): class Factory: def instance (self, ctxt): return mycomponent(ctxt) return Factory() Good luck. -- Murphy P.S., I am assuming you're dropping the CC to the mailing list by accident. Please be sure to reply all. On Jul 24, 2011, at 3:33 AM, ali ahmad wrote: Off list Subject: Re: [nox-dev] how to manage multiple switches with the help of NOX controller From: jam...@nau.edu Date: Sun, 24 Jul 2011 03:25:54 -0700 CC: nox-dev@noxrepo.org To: aliahmad...@hotmail.com NOX comes with a number of components which implement different pieces of functionality, and topology is one example of such. For some more information, see the wiki: http://noxrepo.org/noxwiki/index.php/NOX_Components . For an example of using the topology component from Python, see the flowtracer component. But skipping the topology component for now and keeping your own list of of dpids might be more approachable for the moment. pyswitch actually demonstrates setting up callbacks for the datapath_join and datapath_leave events. All you need to do is write handlers that actually keep track of dpids (by adding and removing them from a Python set would be my suggestion). This is only a handful of lines of code. -- Murphy On Jul 24, 2011, at 3:09 AM, ali ahmad wrote: Off list Subject: Re: [nox-dev] how to manage multiple switches with the help of NOX controller From: jam...@nau.edu Date: Sun, 24 Jul 2011 02:53:44 -0700 CC: nox-dev@noxrepo.org To: aliahmad...@hotmail.com If you want to do it yourself, just monitor datapath_join events. These are fired whenever a switch connects, and the event object holds the dpid of the switch. Store these in a list. Or you can just make use of the topology component, which does pretty much exactly this (along with some other stuff), and then has a method to get a list of all connected switches. Hope that helps. -- Murphy On Jul 23, 2011, at 11:04 PM, ali ahmad wrote: hi! i am using multiple switches with a single controller than if i want to flood the message at all the ports of all the switches than how would i know that what are the dpids of the switches. like i have to call this fuction to flood the message on all the switches. def send_openflow(self, dp_id, buffer_id, packet, actions, inport=openflow.OFPP_CONTROLLER): Sends an openflow packet to a datapath. This function is a convenient wrapper for send_openflow_packet and send_openflow_buffer for situations where it is unknown in advance whether the packet to be sent is buffered. If 'buffer_id' is -1, it sends 'packet'; otherwise, it sends the buffer represented by 'buffer_id'. dp_id - datapath to send packet to buffer_id - id of
Re: [nox-dev] Nox on Fedora8
Thanks Niky! If it's ok with you, I'll add your instructions here: http://noxrepo.org/noxwiki/index.php/Dependencies On Sun, Jul 24, 2011 at 5:22 AM, Niky Riga nr...@bbn.com wrote: Hi all, I needed recently to run Nox on PlanetLab hosts running Fedora 8. It took me a bit to get the process right, so I have written down the steps I followed, in case others find it useful. http://groups.geni.net/geni/**wiki/GeniExperimenter/NoxAndF8http://groups.geni.net/geni/wiki/GeniExperimenter/NoxAndF8 I just needed to run the switch controller, so I haven't fully tested that all the necessary packages are there, for all controllers. Cheers, Niky __**_ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/**listinfo/nox-devhttp://noxrepo.org/mailman/listinfo/nox-dev ___ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev