package org.opendaylight.openflowplugin.applications.frm.impl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesKey;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import java.util.Collections;
}
if (flowNode.isPresent()) {
- /* Tables - have to be pushed before groups */
- // CHECK if while pusing the update, updateTableInput can be null to emulate a table add
- List<Table> tableList = flowNode.get().getTable() != null
- ? flowNode.get().getTable() : Collections.<Table> emptyList() ;
- for (Table table : tableList) {
- final KeyedInstanceIdentifier<Table, TableKey> tableIdent =
- nodeIdent.child(Table.class, table.getKey());
- this.provider.getTableCommiter().update(tableIdent, table, null ,nodeIdent) ;
- }
-
+ /* Tables - have to be pushed before groups */
+ // CHECK if while pusing the update, updateTableInput can be null to emulate a table add
+ List<Table> tableList = flowNode.get().getTable() != null
+ ? flowNode.get().getTable() : Collections.<Table> emptyList() ;
+ for (Table table : tableList) {
+ TableKey tableKey = table.getKey();
+ KeyedInstanceIdentifier<TableFeatures, TableFeaturesKey> tableFeaturesII
+ = nodeIdent.child(Table.class, tableKey).child(TableFeatures.class, new TableFeaturesKey(tableKey.getId()));
+ for (TableFeatures tableFeatures : table.getTableFeatures()) {
+ provider.getTableFeaturesCommiter().update(tableFeaturesII, tableFeatures, null, nodeIdent);
+ }
+ }
+
/* Groups - have to be first */
List<Group> groups = flowNode.get().getGroup() != null
? flowNode.get().getGroup() : Collections.<Group> emptyList();
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.SalGroupService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterService;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.SalTableService;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
private ForwardingRulesCommiter<Flow> flowListener;
private ForwardingRulesCommiter<Group> groupListener;
private ForwardingRulesCommiter<Meter> meterListener;
- private ForwardingRulesCommiter<Table> tableListener;
+ private ForwardingRulesCommiter<TableFeatures> tableListener;
private FlowNodeReconciliation nodeListener;
public ForwardingRulesManagerImpl(final DataBroker dataBroker,
public void start() {
this.flowListener = new FlowForwarder(this, dataService);
-
+
this.groupListener = new GroupForwarder(this, dataService);
this.meterListener = new MeterForwarder(this, dataService);
-
+
this.tableListener = new TableForwarder(this, dataService);
this.nodeListener = new FlowNodeReconciliationImpl(this, dataService);
LOG.info("ForwardingRulesManager has started successfully.");
}
@Override
- public ForwardingRulesCommiter<Table> getTableCommiter() {
+ public ForwardingRulesCommiter<TableFeatures> getTableFeaturesCommiter() {
return tableListener;
}
package org.opendaylight.openflowplugin.applications.frm.impl;
-import org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper;
+import java.util.Collections;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.table.update.OriginalTableBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.table.update.UpdatedTableBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableRef;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures;
+import org.opendaylight.openflowplugin.common.wait.SimpleTaskRetryLooper;
import java.util.concurrent.Callable;
import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.openflowplugin.applications.frm.ForwardingRulesManager;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
-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.table.service.rev131026.UpdateTableInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.table.update.OriginalTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.table.update.UpdatedTableBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableRef;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.Preconditions;
-public class TableForwarder extends AbstractListeningCommiter<Table> {
+public class TableForwarder extends AbstractListeningCommiter<TableFeatures> {
private static final Logger LOG = LoggerFactory.getLogger(TableForwarder.class);
private ListenerRegistration<TableForwarder> listenerRegistration;
public TableForwarder (final ForwardingRulesManager manager, final DataBroker db) {
- super(manager, Table.class);
+ super(manager, TableFeatures.class);
Preconditions.checkNotNull(db, "DataBroker can not be null!");
- final DataTreeIdentifier<Table> treeId = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, getWildCardPath());
+ final DataTreeIdentifier<TableFeatures> treeId = new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, getWildCardPath());
try {
SimpleTaskRetryLooper looper = new SimpleTaskRetryLooper(ForwardingRulesManagerImpl.STARTUP_LOOP_TICK,
}
@Override
- protected InstanceIdentifier<Table> getWildCardPath() {
+ protected InstanceIdentifier<TableFeatures> getWildCardPath() {
return InstanceIdentifier.create(Nodes.class).child(Node.class)
- .augmentation(FlowCapableNode.class).child(Table.class);
+ .augmentation(FlowCapableNode.class).child(Table.class).child(TableFeatures.class);
}
@Override
- public void remove(final InstanceIdentifier<Table> identifier, final Table removeDataObj,
+ public void remove(final InstanceIdentifier<TableFeatures> identifier, final TableFeatures removeDataObj,
final InstanceIdentifier<FlowCapableNode> nodeIdent) {
// DO Nothing
}
@Override
- public void update(final InstanceIdentifier<Table> identifier,
- final Table original, final Table update,
+ public void update(final InstanceIdentifier<TableFeatures> identifier,
+ final TableFeatures original, final TableFeatures update,
final InstanceIdentifier<FlowCapableNode> nodeIdent) {
LOG.debug( "Received the Table Update request [Tbl id, node Id, original, upd" +
" " + identifier + " " + nodeIdent + " " + original + " " + update );
- final Table originalTable = (original);
- Table updatedTable ;
+ final TableFeatures originalTableFeatures = original;
+ TableFeatures updatedTableFeatures ;
if( null == update)
- updatedTable = (original);
+ updatedTableFeatures = original;
else
- updatedTable = (update);
+ updatedTableFeatures = update;
final UpdateTableInputBuilder builder = new UpdateTableInputBuilder();
builder.setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class)));
- builder.setTableRef(new TableRef(identifier));
+
+ InstanceIdentifier<Table> iiToTable = identifier.firstIdentifierOf(Table.class);
+ builder.setTableRef(new TableRef(iiToTable));
builder.setTransactionUri(new Uri(provider.getNewTransactionId()));
- builder.setUpdatedTable((new UpdatedTableBuilder(updatedTable)).build());
+ builder.setUpdatedTable(new UpdatedTableBuilder().setTableFeatures(
+ Collections.singletonList(updatedTableFeatures)).build());
- builder.setOriginalTable((new OriginalTableBuilder(originalTable)).build());
+ builder.setOriginalTable(new OriginalTableBuilder().setTableFeatures(
+ Collections.singletonList(originalTableFeatures)).build());
LOG.debug( "Invoking SalTableService " ) ;
if( this.provider.getSalTableService() != null )
}
@Override
- public void add(final InstanceIdentifier<Table> identifier, final Table addDataObj,
+ public void add(final InstanceIdentifier<TableFeatures> identifier, final TableFeatures addDataObj,
final InstanceIdentifier<FlowCapableNode> nodeIdent) {
//DO NOthing
}