Rammbock icon indicating copy to clipboard operation
Rammbock copied to clipboard

Multicast support in Rammbock using IGMP

Open harshm opened this issue 11 years ago • 5 comments

Is there any way I can send IGMP messages so that I can Join a multicast group and send and receive UDP messages from that group?

I know the IGMP protocol is not currently support by rammbock directly, but some insight on how it can be done will be really appreciated.

If required, I can provide more details.

Thanks.

harshm avatar Mar 27 '13 14:03 harshm

Hi!

There is presumably, a way to implement this kind of functionality to Rammbock. However if the feature request doesn't come from inside NSN, it is highly unlikely that it will be implemented. Pull requests are of course more than welcome.

http://stackoverflow.com/questions/4313560/how-to-send-an-ip-packet-in-python http://en.wikipedia.org/wiki/Internet_Group_Management_Protocol

kontulai avatar Mar 28 '13 08:03 kontulai

HI Ilmari,

Thank you for your response.

I added a method in the rammbock core to start up a client that sends out the IGMP Join for me. I did this by setting up the socket options after I bind to my local port.

Here's the code snippet. Might be helpful to someone.

CORE:

    def start_multicast_udp_client(self, multicastip=None, ip=None, port=None, name=None, timeout=None, protocol=None):
            """Starts a new Multicast UDP client.
            Client can be optionally given `ip` and `port` to bind to, as well as
            `name`, default `timeout` and a `protocol`. You should use `Connect`
            keyword to connect client to a host.

           Client should be given a Multicast Group Address 'multicastip'

            Examples:
            | Start Multicast UDP client | 239.0.56.125 |
            | Start UDP client | 239.0.56.125 | name=Client1 | protocol=GTPV2 |
            | Start UDP client | 239.0.56.125 | 10.10.10.2 | 53 | name=Server1 | protocol=GTPV2 |
            | Start UDP client | timeout=5 |
           """

           self._start_client(UDPClient, ip, port, name, timeout, protocol)
           client, name = self._clients.get_with_name(name)
           client.join_multicast(multicastip, ip)

NETWORKING:

    def join_multicast(self, multicastip=None, localip=None):
            self._socket.setsockopt(socket.SOL_IP, socket.IP_MULTICAST_IF, socket.inet_aton(localip))
            self._socket.setsockopt(socket.SOL_IP, socket.IP_ADD_MEMBERSHIP, socket.inet_aton(multicastip) +    socket.inet_aton(localip))

harshm avatar Mar 28 '13 13:03 harshm

Thanks for the contribution. BTW, in future if you make a change like this, I highly recommend doing it in your own fork and then just making a pull request. Pull requests make it very easy for us to incorporate a diff.

jussimalinen avatar Oct 08 '13 09:10 jussimalinen

Can I still do this?

I have never contributed to a project like this before.

Please let me know if there is a guideline on how to add contribution and make a pull request.

I will be more than happy to submit what I have.

Thanks, Harsh

On Tue, Oct 8, 2013 at 5:17 AM, Jussi Malinen [email protected]:

Thanks for the contribution. BTW, in future if you make a change like this, I highly recommend doing it in your own fork and then just making a pull request. Pull requests make it very easy for us to incorporate a diff.

— Reply to this email directly or view it on GitHubhttps://github.com/robotframework/Rammbock/issues/12#issuecomment-25875157 .

Harsh Hitesh Mehta Master of Sciencehttp://www.seas.upenn.edu/prospective-students/graduate/masters/index.php | Telecommunication & Networking http://www.seas.upenn.edu/profprog/tcom/, University of Pennsylvania http://www.upenn.edu. Senior Project Electrical Engineer - Embeddedhttp://www.linkedin.com/in/harshmehta1111/ Lutron Electronics Inc. http://www.lutron.com

harshm avatar Oct 08 '13 13:10 harshm

Hi!

Yes, you most certainly can :) Just create your own fork of the project, and do the changes to that forked repository, then press "pull request" and thats it!

https://help.github.com/articles/using-pull-requests

If you want to make this a full patch (and make incorporating it as fast as possible), you can also add some test(s) for this new functionality. All acceptance tests from atest folder can be executed with execute_regression_tests.sh (or win_execute_regression_tests.cmd)

jussimalinen avatar Oct 08 '13 13:10 jussimalinen