import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.PacketProcessingService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.OpendaylightQueueStatisticsService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService;
import org.opendaylight.yangtools.concepts.CompositeObjectRegistration;
import org.opendaylight.yangtools.concepts.CompositeObjectRegistration.CompositeObjectRegistrationBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
private RoutedRpcRegistration<SalFlowService> flowRegistration;
private RoutedRpcRegistration<SalGroupService> groupRegistration;
+
+ private RoutedRpcRegistration<SalTableService> tableRegistration;
private RoutedRpcRegistration<SalMeterService> meterRegistration;
groupRegistration = ctx.addRoutedRpcImplementation(SalGroupService.class, this);
groupRegistration.registerPath(NodeContext.class, getIdentifier());
builder.add(groupRegistration);
+
+ tableRegistration = ctx.addRoutedRpcImplementation(SalTableService.class, this);
+ tableRegistration.registerPath(NodeContext.class, getIdentifier());
+ builder.add(tableRegistration);
packetRegistration = ctx.addRoutedRpcImplementation(PacketProcessingService.class, this);
packetRegistration.registerPath(NodeContext.class, getIdentifier());
version = context.getPrimaryConductor().getVersion();
}
+
@Override
public Future<RpcResult<AddFlowOutput>> addFlow(AddFlowInput input) {
// Convert the AddFlowInput to FlowModInput
@Override
public Future<RpcResult<UpdateTableOutput>> updateTable(
- UpdateTableInput input) {
+ UpdateTableInput input) {
// Get the Xid. The same Xid has to be sent in all the Multipart requests
Long xid = this.getSessionContext().getNextXid();
//Convert the list of all MD-SAL table feature object into OF library object
List<TableFeatures> ofTableFeatureList = TableFeaturesConvertor.toTableFeaturesRequest(input.getUpdatedTable()) ;
- int totalNoOfTableFeatureEntry = ofTableFeatureList.size();
+
MultipartRequestTableFeaturesCaseBuilder caseRequest = new MultipartRequestTableFeaturesCaseBuilder();
MultipartRequestTableFeaturesBuilder tableFeaturesRequest = new MultipartRequestTableFeaturesBuilder();
- // Slice the multipart request based on the configuration parameter, which is the no. of TableFeatureList element
- // to be put in one multipart message. Default is 5
- // This parameter must be set based on switch's Buffer capacity
-
- List<TableFeatures> tmpOfTableFeatureList = null ;
- String tableFeatureListCount = System.getProperty( "of.tableFeaturesCountPerMultipart", "5") ;
- int noOfEntriesInMPR = Integer.parseInt(tableFeatureListCount) ;
-
- int index = 0 ;
- while(totalNoOfTableFeatureEntry-index > 0 ) {
- if( (totalNoOfTableFeatureEntry-index) > noOfEntriesInMPR ) {
- mprInput.setFlags(new MultipartRequestFlags(true));
- tmpOfTableFeatureList = ofTableFeatureList.subList(index, index + noOfEntriesInMPR);
- }
- else {
- // Last multipart request
- mprInput.setFlags(new MultipartRequestFlags(false));
- tmpOfTableFeatureList = ofTableFeatureList.subList(index, totalNoOfTableFeatureEntry );
- }
-
- tableFeaturesRequest.setTableFeatures(tmpOfTableFeatureList) ;
+ mprInput.setFlags(new MultipartRequestFlags(true));
+
+ tableFeaturesRequest.setTableFeatures(ofTableFeatureList) ;
+
//Set request body to main multipart request
caseRequest.setMultipartRequestTableFeatures(tableFeaturesRequest.build());
mprInput.setMultipartRequestBody(caseRequest.build());
//Send the request, no cookies associated, use any connection
- LOG.debug("Send Table Feature request :{}",tmpOfTableFeatureList);
+ LOG.debug("Send Table Feature request :{}",ofTableFeatureList);
this.messageService.multipartRequest(mprInput.build(), null);
- index += noOfEntriesInMPR ;
- tmpOfTableFeatureList = null ; // To avoid any corrupt data
- }
+
//Extract the Xid only from the Future for the last RPC and
- // send it back to the NSF
+ // send it back to the NSF
LOG.debug("Returning the result and transaction id to NSF");
LOG.debug("Return results and transaction id back to caller");
UpdateTableOutputBuilder output = new UpdateTableOutputBuilder();
import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
-import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.osgi.framework.BundleContext;
pc = session;
dataBrokerService = session.getSALService(DataBrokerService.class);
ctx.registerService(CommandProvider.class.getName(), this, null);
- createTestNode();
- createTestTable();
+ // createTestNode();
+ // createTestTable();
}
private void createUserNode(String nodeRef) {
DataModification modification = dataBrokerService.beginTransaction();
InstanceIdentifier<Table> path1 = InstanceIdentifier.builder(Nodes.class)
- .child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class).child(Table.class, new TableKey(table.getId())).build() ;
+ .child(Node.class, testNode.getKey()).augmentation(FlowCapableNode.class).
+ child(Table.class, new TableKey(table.getId())).build() ;
modification.putOperationalData(nodeToInstanceId(testNode), testNode);