control WANproxy through python openflow controller.

Juli Mallett juli at clockworksquid.com
Sat Mar 2 09:35:18 PST 2013


Boxiang,

With the changes I've made to the configuration system internally
(configuration files should still be the same), I think you'll have an
easier time seeing now how to create a proxy instance.  Look at
wanproxy_config_class_proxy.cc, namely.

You'd want to do something like:

new ProxyListener(co->name_, interface_codec, peer_codec,
interface->family_, interface_address, peer->family_, peer_address);

Where co->name_ is a string giving a name to this proxy instance.

interface_codec is a pointer to a WANProxyCodec structure, which you
can see in wanproxy_codec.h; just create an XCodec instance if you
need one, and set compression options.  Likewise for peer_codec.

interface->family_ gives the address family; you probably want
SocketAddressFamilyIP, or maybe SocketAddressFamilyIPv4 if you know
it's IPv4, etc.  Same for peer->family_.

interface_address and peer_address are both strings.
interface_address is the address to listen on, and peer_address is the
address to connect to.  So interface_address might be something like
"[0.0.0.0]:4290" to listen on port 4290 of all IPv4 interfaces.  And
then peer_address might be "[10.10.0.90]:4390" to connect to port 4390
on 10.10.0.90.

Note that the address strings do not need the brackets if they are not
IPv6 addresses, but I tend to use them anyway.  You can also use DNS
names instead, e.g. "wanproxy1.co.us.example.com:4390" if your peer
has a hostname associated with it.

I hope that's enough for you; let me know if you need something more.

Thanks,
Juli.

On Tue, Feb 19, 2013 at 12:47 AM, Boxiang Pan <aquarypbx at gmail.com> wrote:
> Hi, Juli,
>
> We really appreciate your quick reply. Yes, it will be very helpful for us
> if you could provide sample code for creating a proxy instance with C++, and
> the interface code where we may use python to call.  I don't really
> understand what you mean by "simple binary protocol over TCP, inject
> configuration over TCP", do you mean sending the conf files over TCP to
> WANProxy instances?
>
> For now, I think starting wanproxy from python is enough for us, we don't
> need to worry about control at this time.
>
> Details about our code flow:
>
> So we have a open flow controller that runs on a VM and rest of the networks
> can be tenants (or clients). Clients establish a tcp connection and send a
> service request via configuration file over TCP to the controller describing
> the type of functionality they want to avail (in our case its WANProxy) and
> also will tell a network path (or a set of switches) over which client wants
> the reservations to be made. This request is handled by an allocator which
> takes all the parameters from config file, passes the control to a module(we
> have to implement this) which will need to communicate with WANProxy
> (already installed on the switches in network path) and make the necessary
> reservations. Once this set up is done, we will repeatedly send same large
> file to measure the performance of WANProxy.
>
> What interface code do you think might be necessary?
>
> Thank you very much.
>
> On Sun, Feb 17, 2013 at 4:56 PM, Juli Mallett <juli at clockworksquid.com>
> wrote:
>>
>> Boxiang,
>>
>> Very excited to hear about your project.
>>
>> Really, if you're willing to write some bindings for the C++ code,
>> it's probably better to entirely do without the configuration system
>> if you're at all interested in scripting WANProxy.
>>
>> You would want to look at the ProxyListener and SSHProxyListener
>> classes right now; creating one of those is what creates a proxy
>> instance, and then you need only call 'event_main()' to get things off
>> and running.  I can provide sample code for creating a proxy instance
>> (SSH or otherwise) with C++ code instead of a config file if that
>> would be helpful for you.
>>
>> The drawback to that is that if I change anything in WANProxy, there's
>> a possibility that your bindings would need updated.  I could also
>> provide a simple binary protocol over TCP for creating proxy
>> instances, or even set up a listener that allows one to inject
>> configuration over TCP.
>>
>> Control is a trickier question.  Right now there's little in the way
>> of statistics and reporting; you can't even easily get a list of
>> current connections being proxied.  What kinds of control do you need?
>>  It may be that I can point you to something that's working right now,
>> or it may be that I need to add some code to provide an interface for
>> your project.
>>
>> Thanks,
>> Juli.
>>
>> On Sun, Feb 17, 2013 at 1:00 PM, Boxiang Pan <bopan at ucsd.edu> wrote:
>> > Hi,
>> >
>> > We are a group of graduate students from UCSD, and we are working on a
>> > class
>> > project using WANProxy. Our goal is to be able to start and control
>> > WANProxy
>> > from an openflow based controller written in python. We already have the
>> > openflow controller in python, and we would like to let it "talk" to
>> > WANProxy. So instead of directly type "wanproxy -c client.conf" in the
>> > terminal, we hope to type in a command in the openflow controller, and
>> > then
>> > let it start/control the WANProxy. We'd appreciate it very much if you
>> > could
>> > give us some guideline on how to integrate WANProxy with openflow
>> > controller, specifically which parts of the code in WANProxy are the
>> > interface/API that we should study? And what is the best tool to wrap
>> > WANProxy into python?
>> >
>> > Thank you for your help and suggestions.
>> >
>> > --
>> >
>> > Boxiang Pan
>> >
>>
>> --
>>
>> Boxiang Pan
>>
>> Department of Electrical and Computer Engineering
>> University of California, San Diego
>> Tel: 858-999-7655
>>
>>
>



More information about the wanproxy mailing list