In OpenFlow, all stats are wrapped in a stats_request or stats_reply
object.  So, the table_stats object that you're looking for (there may
be more than one in a reply) will be in the list returned from
response.stats.

Take a look at how the ./tests/flow_stats.py test works.

Also, fwiw, there is a forum to discuss oftest at http://oftest.openflowhub.org/

Hope this helps,

- Rob
.


On Thu, Jul 5, 2012 at 12:25 PM, shreya pandita
<shreya.pand...@gmail.com> wrote:
> Hi All,
>
> I am trying to write a test-case, in which the controller will send a
> table_stats_request , the switch should reply back with a table_stats_reply
> .
> Also, the table_stats_reply should contain the counters like :
>
>
> class TableCounter(basic.SimpleProtocol):
>     """
>     Test Counters
>     """
>     def runTest(self):
>         tc_logger.info("Running TableCounter")
>         tc_logger.info("Inserting trial flow")
>         request = flow_mod_gen(tc_port_map, True)
>         rv = self.controller.message_send(request)
>         self.assertTrue(rv != -1, "Failed to insert test flow")
>
>         tc_logger.info("Sending table stats request")
>         request = message.table_stats_request()
>         response, pkt = self.controller.transact(request, timeout=2)
>         self.assertTrue(response is not None, "Did not get response")
>         self.assertTrue(response.max_entries is not None "did not receive
> max_entries")
>         self.assertTrue(response.active_count is not None  "did not receive
> active entries")
>         self.assertTrue(response.table_id is not None  "did not receive the
> table id ")
>         tc.debug(response.show())
>
>
> I get this error:
> AttributeError: table_stats_reply instance has no attribute 'max_entries'
> Though the Wireshark trace for table_stats_reply shows that the switch
> replies back with these fields .
>
>
> _______________________________________________
> openflow-discuss mailing list
> openflow-discuss@lists.stanford.edu
> https://mailman.stanford.edu/mailman/listinfo/openflow-discuss
>
_______________________________________________
openflow-discuss mailing list
openflow-discuss@lists.stanford.edu
https://mailman.stanford.edu/mailman/listinfo/openflow-discuss

Reply via email to