Search code examples
opendaylight

opendaylight : getting flow statistics from a java applicaton fails


I am trying to read flow statistics from a java opendaylight application (run's as a karaf feature).

I see the following exception in my Java application (running as an opendaylight feature):

 java.util.concurrent.ExecutionException: org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementationNotAvailableException: 
 No implementation of RPC AbsoluteSchemaPath{path=[(urn:opendaylight:flow:statistics?revision=2013-08-19)get-aggregate-flow-statistics-from-flow-table-for-given-match]} available

The following features are installed in my container:

karaf> feature:list | grep openflow


   odl-openflowplugin-app-forwardingrules-manager  | 0.5.1            |          | Started     | odl-openflowplugin-app-forwardingrules-manager  | OpenDaylight :: Openflow Plugin :: Application -
   odl-openflowplugin-nxm-extensions               | 0.5.1            |          | Started     | odl-openflowplugin-nxm-extensions               | OpenDaylight :: Openflow Plugin :: Nicira Extensi
   odl-openflowplugin-nsf-model                    | 0.5.1            |          | Started     | odl-openflowplugin-nsf-model                    | OpenDaylight :: OpenflowPlugin :: NSF :: Model
   odl-openflowplugin-app-config-pusher            | 0.5.1            |          | Started     | odl-openflowplugin-app-config-pusher            | OpenDaylight :: Openflow Plugin :: Application -
   odl-openflowplugin-southbound                   | 0.5.1            |          | Started     | openflowplugin-0.5.1                            | OpenDaylight :: Openflow Plugin :: Li southbound
   odl-openflowjava-protocol                       | 0.5.1            |          | Started     | odl-openflowjava-0.5.1                          | ODL :: o                  openflowjava :: odl-openflowjava-protocol
   odl-openflowplugin-app-topology                 | 0.5.1            |          | Started     | odl-openflowplugin-app-topology                 | OpenDaylight :: Openflow Plugin :: Application -
   odl-openflowplugin-flow-services                | 0.5.1            |          | Started     | odl-openflowplugin-flow-services                | OpenDaylight :: Openflow Plugin :: Flow Services
   odl-openflowplugin-app-reconciliation-framework | 0.5.1            |          | Started     | odl-openflowplugin-app-reconciliation-framework | OpenDaylight :: Openflow Plugin :: Application -

What service gets invoked in opendaylight when I issue the following REST RPC call?

 curl -v -u admin:admin -X GET http://localhost:8181/restconf/operational/opendaylight-inventory:nodes/node/openflow:1/table/0

My goal is to do the same thing from an opendaylight java application ( running as a service in the container), but I don't know how to do that.

Not sure if I am following the right approach.

Thanks, Ranga


Solution

  • Figured out the answer (for nitrogen release of ODL). The error message in the exception is confusing. Here's how to do it:

    In the code snippet below node is of type InstanceIdentifier

    InstanceIdentifier outNode = node.firstIdentifierOf(Node.class); NodeRef nodeRef = new NodeRef(outNode);

                        GetFlowStatisticsInputBuilder inputBuilder = new GetFlowStatisticsInputBuilder();
    
                        inputBuilder.setFlowName(flow.getFlowName());
                        inputBuilder.setMatch(flow.getMatch());
                        inputBuilder.setTableId(flow.getTableId());
                        inputBuilder.setInstructions(flow.getInstructions());
                        inputBuilder.setNode(nodeRef);
    
    
    
                        GetFlowStatisticsOutput output = directStatisticsService
                                .getFlowStatistics(inputBuilder.build()).get().getResult();
    

    Hope this helps somebody.