Re: [nox-dev] Restricting packet flow on particular ports.

2010-11-27 Thread kk yap
Hi Kavitesh,

If I understand you right, this is a recurring theme.  NOX does not
provide any method to dynamically allocate bandwidth to a flow.  This
is because OpenFlow has not standardize any means to do so.  Unless
NOX gets into the mess of dealing with each individual OpenFlow
switch, this is somewhat hard.

However, if you can pre-allocate bandwidth in terms of queues, NOX can
allocate flows to queues.  These flows will then be subjected to the
bandwidth limits of these queues.  OpenFlow 1.0 supports only minimum
bandwidth from my understanding.

Regards
KK

On 27 November 2010 22:54, K Singh  wrote:
> Hi,
>
> Is there a way for restricting the bandwidth allocated TCP/UDP ports? Can
> NOX help in assigning some ports with high bandwidth and some with lower
> bandwidth based on packet inflow/outflow or any other parameter?
>
> --
> Regards,
> Kavitesh Singh.
>
>
> ___
> nox-dev mailing list
> nox-dev@noxrepo.org
> http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
>
>

___
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org


[nox-dev] Restricting packet flow on particular ports.

2010-11-27 Thread K Singh
Hi,

Is there a way for restricting the bandwidth allocated TCP/UDP ports? Can
NOX help in assigning some ports with high bandwidth and some with lower
bandwidth based on packet inflow/outflow or any other parameter?

-- 
Regards,
Kavitesh Singh.
___
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org


Re: [nox-dev] Ip Address

2010-11-27 Thread Murphy McCauley
This looks to me like the utility function convert_to_ipaddr() has some 
unfortunate and inconsistent behavior.  It could be that things rely on this, 
so this patch may actually break things.  I tried to do a quick look and fix 
where that happens, but I haven't tested even a little tiny bit.  It may 
correct the situation, though.  Let me know. :)

-- Murphy



fix_ipaddr.patch
Description: Binary data


On Nov 27, 2010, at 4:33 PM, Rohit Manohar wrote:

> I am trying to change the IP source for a flow. For that I am doing the 
> following:
> 
> src_ip = '10.0.0.4'
> actions = [[openflow.OFPAT_OUTPUT, [0, 
> prt[0]]],[openflow.OFPAT_SET_NW_SRC,src_ip]]
> 
> When I run the code, I get the following error. Any idea what might be 
> causing it?
> 
> 00035|pyrt|ERR:unable to invoke a Python event handler:
> Traceback (most recent call last):
>   File "./nox/lib/util.py", line 116, in f
> event.total_len, buffer_id, packet)
>   File "./nox/coreapps/examples/pyproject.py", line 166, in packet_in_callback
> forward_l2_packet(dpid, inport, packet, packet.arr, bufid)
>   File "./nox/coreapps/examples/pyproject.py", line 107, in forward_l2_packet
> inport, buf)
>   File "./nox/lib/core.py", line 378, in install_datapath_flow
> (idle_timeout, actions, buffer_id), hard_timeout)
>   File "./nox/lib/core.py", line 257, in send_flow_command
> oactions = self.make_action_array(actions)
>   File "./nox/lib/core.py", line 168, in make_action_array
> a = struct.pack("HHI", htons(action[0]), htons(8), iaddr.addr)
> AttributeError: 'int' object has no attribute 'addr'
> 
> 
> Regards,
> -- 
> Rohit Manohar
> Graduate Student
> North Carolina State University
> Raleigh, US.
> 
> ___
> nox-dev mailing list
> nox-dev@noxrepo.org
> http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org

___
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org


[nox-dev] Ip Address

2010-11-27 Thread Rohit Manohar
I am trying to change the IP source for a flow. For that I am doing the
following:

src_ip = '10.0.0.4'
actions = [[openflow.OFPAT_OUTPUT, [0,
prt[0]]],[openflow.OFPAT_SET_NW_SRC,src_ip]]

When I run the code, I get the following error. Any idea what might be
causing it?

00035|pyrt|ERR:unable to invoke a Python event handler:
Traceback (most recent call last):
  File "./nox/lib/util.py", line 116, in f
event.total_len, buffer_id, packet)
  File "./nox/coreapps/examples/pyproject.py", line 166, in
packet_in_callback
forward_l2_packet(dpid, inport, packet, packet.arr, bufid)
  File "./nox/coreapps/examples/pyproject.py", line 107, in
forward_l2_packet
inport, buf)
  File "./nox/lib/core.py", line 378, in install_datapath_flow
(idle_timeout, actions, buffer_id), hard_timeout)
  File "./nox/lib/core.py", line 257, in send_flow_command
oactions = self.make_action_array(actions)
  File "./nox/lib/core.py", line 168, in make_action_array
a = struct.pack("HHI", htons(action[0]), htons(8), iaddr.addr)
AttributeError: 'int' object has no attribute 'addr'


Regards,
-- 
Rohit Manohar
Graduate Student
North Carolina State University
Raleigh, US.
___
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org


Re: [nox-dev] Flow removed callback function input parameters.

2010-11-27 Thread K Singh
Thanks Murphy,

I was able to get all the required information from .flow parameter
mentioned by you.

I am trying to accomplish below mentioned statement, would like your or
other developers inputs on the approach chosen.

I am prioritizing the flows between end hosts on the basis of port numbers.
Say i allocate port 80,8080,100 etc as high priority ports and rest as low
priority. By default, i set the flow timeout to 5 secs. Initially i let all
the flows to start i.e. data is allowed on all the ports. I create a list of
dictionary which contains information about src_ip, dst_ip, src_port,
dst_port, timestamp, packetcount. When the program starts, i set the packet
count to 0, then when flow expires i find the dictionary value meeting the
ip/port information and update value of packet number and timestamp. This
means i have value of packets sent in last 5 seconds for that flow. That is
the reason i needed to obtain this information when the flow expired.

I am writing a logic (basic one) that once the flow expires i will get the
packet again in the NOX controller. I will check if this packet is in the
list of high priority ports, if yes then flow is renewed without further
processing. If the port is not a high priority, then i will compare the
packet value of this port with all the high priority ports' packet value. if
i find this to be higher than any of them, then i will not renew the flow
for that packet. Next time again the packet comes for that low priority
port, if the current and the timestamp stored value exceeds 1 sec then i
renew it else i dont renew the flow. I kept the value of 1 sec because if i
increase this value TCP times out and breaks the connection.

This might not be the best approach and it has few problems. First, the
packet comparison is having 5 second time lag. *I was looking for something
like dpctl's tcpdump in python where i can fetch the latest packet count for
comparison*.Second, If one host is connected to say port 80 and 300, then I
cannot do any bandwidth splitting based on port numbers. I can only do so if
one host is connected to two different hosts on different ports. Is there a
workaround for that? Third, I am using the concept of not renewing flow for
one second for low priority ports. Is there a better approach for doing so?

Thanks,
Kavitesh Singh

Graduate Student
North Carolina State University,
Raleigh,NC-USA



On Fri, Nov 26, 2010 at 6:42 AM, Murphy McCauley  wrote:

> Responses inline.
>
> On Nov 25, 2010, at 9:29 PM, K Singh wrote:
>
> > I was adding flow removed event in the pyswitch.py file.
> >
> >def install(self):
> > inst.register_for_packet_in(packet_in_callback)
> > inst.register_for_datapath_leave(datapath_leave_callback)
> > inst.register_for_datapath_join(datapath_join_callback)
> > inst.post_callback(1, timer_callback)
> > inst.register_for_flow_removed(flow_removed_callback)
> >
> > Then creating a callback function as below.
> >
> > def flow_removed_callback(dpid, duration_sec, duration_nsec,
> idle_timeout, packet_count, byte_count, cookie):
> > print "---flow removed---"
> > return CONTINUE
> >
> > The parameter for flow removed event have been obtained from
> ~/noxcore/src/include
>
> Tangential, but is this pulled from the noxcore_old repository?  That's
> quite old now...
>
> > where the parameters are defined as
> > Flow_removed_event(datapathid datapath_id_,
> >uint32_t duration_sec_, uint32_t duration_nsec_,
> >uint16_t idle_timeout_,
> >uint64_t packet_count_, uint64_t byte_count_,
> >uint64_t cookie_)
> >
> > when i run this code i get this error message:
> > TypeError: flow_removed_callback() takes exactly 7 arguments (1 given)
> >
> >
> > if I change the code in pyswitch.py for the flow removed callback
> function like below
> >
> > def flow_removed_callback(packet_count):
> > print "---flow removed---",packet_count
> > return CONTINUE
> >
> > the function executes but I see this printed on the terminal
> > ---flow removed--- Object of type 'pyevent *' at 0xb5118128>
> > which is not a correct value i think.
>
> The event handler gets called with a single argument: a Flow_removed_event
> object (actually a Pythonized version of one, but whatever). This object has
> a number of fields: datapath_id, duration_sec, duration_nsec, byte_count,
> etc.  So what you want is something like:
> def flow_removed_callback (e):
>  print "---flow removed---", e.packet_count
>  return CONTINUE
>
> > How can i obtain the values of the listed arguments when a flow
> expires/removed. Also when a flow is created in switch, is there some
> identification number attached to flows? How would I know which flow expired
> when flow_removed event is triggered as I cannot see any flow identification
> number. This would be essential if I would be dealing with multiple flow.
>
> So the Flow_removed_event has a .flow field whic