<groupId>org.opendaylight.controller</groupId>
<artifactId>sal-binding-api</artifactId>
<version>1.0-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>flow-management-compatibility</artifactId>
- <version>1.0-SNAPSHOT</version>
- </dependency>
+ </dependency>
<dependency>
<groupId>org.opendaylight.controller.model</groupId>
<artifactId>model-flow-service</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>clustering.services</artifactId>
+ <version>0.4.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal</artifactId>
+ <version>0.5.1-SNAPSHOT</version>
+ </dependency>
</dependencies>
</project>
private ConcurrentMap<Node, List<Group>> nodeGroups;
private ConcurrentMap<GroupKey, Group> inactiveGroups;
- private IClusterContainerServices clusterGroupContainerService = null;
- private ISwitchManager switchGroupManager;
+ private IClusterContainerServices clusterGroupContainerService = null;
private IContainer container;
public GroupConsumerImpl() {
- InstanceIdentifier<? extends DataObject> path = InstanceIdentifier.builder().node(Groups.class).toInstance();
+ InstanceIdentifier<? extends DataObject> path = InstanceIdentifier.builder().node(Groups.class).node(Group.class).toInstance();
groupService = FRMConsumerImpl.getProviderSession().getRpcService(SalGroupService.class);
- clusterGroupContainerService = FRMConsumerImpl.getClusterContainerService();
- switchGroupManager = FRMConsumerImpl.getSwitchManager();
+ clusterGroupContainerService = FRMConsumerImpl.getClusterContainerService();
container = FRMConsumerImpl.getContainer();
if (!(cacheStartup())) {
* @param dataObject
*/
private Status updateGroup(InstanceIdentifier<?> path, Group groupUpdateDataObject) {
- GroupKey groupKey = groupUpdateDataObject.getKey();
+ GroupKey groupKey = groupUpdateDataObject.getKey();
Status groupOperationStatus = validateGroup(groupUpdateDataObject, FRMUtil.operation.UPDATE);
if (!groupOperationStatus.isSuccess()) {
logger.error("Group data object validation failed %s" + groupAddDataObject.getGroupName());
return groupOperationStatus;
}
- validateGroup(groupAddDataObject, FRMUtil.operation.ADD);
+
originalSwGroupView.put(groupKey, groupAddDataObject);
if (groupAddDataObject.isInstall()) {
@Override
public DataCommitTransaction requestCommit(DataModification<InstanceIdentifier<?>, DataObject> modification) {
// We should verify transaction
- System.out.println("Coming in FlowDatacommitHandler");
+ System.out.println("Coming in GroupDatacommitHandler");
internalTransaction transaction = new internalTransaction(modification);
transaction.prepareUpdate();
return transaction;
--- /dev/null
+package org.opendaylight.controller.forwardingrulesmanager_mdsal.consumer.impl;
+
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+import org.opendaylight.controller.clustering.services.CacheConfigException;
+import org.opendaylight.controller.clustering.services.CacheExistException;
+import org.opendaylight.controller.clustering.services.IClusterContainerServices;
+import org.opendaylight.controller.clustering.services.IClusterServices;
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler;
+import org.opendaylight.controller.md.sal.common.api.data.DataModification;
+import org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction;
+import org.opendaylight.controller.sal.common.util.Rpcs;
+import org.opendaylight.controller.sal.core.IContainer;
+import org.opendaylight.controller.sal.core.Node;
+import org.opendaylight.controller.sal.utils.GlobalConstants;
+import org.opendaylight.controller.sal.utils.Status;
+import org.opendaylight.controller.sal.utils.StatusCode;
+import org.opendaylight.controller.switchmanager.ISwitchManager;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.config.rev131024.Meters;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.config.rev131024.meters.MeterKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterAdded;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterRemoved;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterUpdated;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterListener;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.SalMeterService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.BandType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.band.type.Drop;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.band.type.DscpRemark;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.band.type.Experimenter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.config.rev131024.meters.Meter;
+import org.opendaylight.yangtools.concepts.Registration;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.NotificationListener;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MeterConsumerImpl {
+ protected static final Logger logger = LoggerFactory.getLogger(MeterConsumerImpl.class);
+ private MeterEventListener meterEventListener = new MeterEventListener();
+ private Registration<NotificationListener> meterListener;
+ private SalMeterService meterService;
+ private MeterDataCommitHandler commitHandler;
+
+ private ConcurrentMap<MeterKey, Meter> originalSwMeterView;
+ private ConcurrentMap<MeterKey, Meter> installedSwMeterView;
+
+ private ConcurrentMap<Node, List<Meter>> nodeMeters;
+ private ConcurrentMap<MeterKey, Meter> inactiveMeters;
+
+ private IClusterContainerServices clusterMeterContainerService = null;
+ private IContainer container;
+
+ public MeterConsumerImpl() {
+ InstanceIdentifier<? extends DataObject> path = InstanceIdentifier.builder().node(Meters.class).node(Meter.class).toInstance();
+ meterService = FRMConsumerImpl.getProviderSession().getRpcService(SalMeterService.class);
+ clusterMeterContainerService = FRMConsumerImpl.getClusterContainerService();
+
+ container = FRMConsumerImpl.getContainer();
+
+ if (!(cacheStartup())) {
+ logger.error("Unable to allocate/retrieve meter cache");
+ System.out.println("Unable to allocate/retrieve meter cache");
+ }
+
+ if (null == meterService) {
+ logger.error("Consumer SAL Meter Service is down or NULL. FRM may not function as intended");
+ System.out.println("Consumer SAL Meter Service is down or NULL.");
+ return;
+ }
+
+ // For switch/plugin events
+ meterListener = FRMConsumerImpl.getNotificationService().registerNotificationListener(meterEventListener);
+
+ if (null == meterListener) {
+ logger.error("Listener to listen on meter data modifcation events");
+ System.out.println("Listener to listen on meter data modifcation events.");
+ return;
+ }
+
+ commitHandler = new MeterDataCommitHandler();
+ FRMConsumerImpl.getDataProviderService().registerCommitHandler(path, commitHandler);
+ }
+
+
+
+ private boolean allocateMeterCaches() {
+ if (this.clusterMeterContainerService == null) {
+ logger.warn("Meter: Un-initialized clusterMeterContainerService, can't create cache");
+ return false;
+ }
+
+ try {
+ clusterMeterContainerService.createCache("frm.originalSwMeterView",
+ EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL));
+
+ clusterMeterContainerService.createCache("frm.installedSwMeterView",
+ EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL));
+
+ clusterMeterContainerService.createCache("frm.inactiveMeters",
+ EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL));
+
+ clusterMeterContainerService.createCache("frm.nodeMeters",
+ EnumSet.of(IClusterServices.cacheMode.TRANSACTIONAL));
+
+//TODO for cluster mode
+ /* clusterMeterContainerService.createCache(WORK_STATUS_CACHE,
+ EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL, IClusterServices.cacheMode.ASYNC));
+
+ clusterMeterContainerService.createCache(WORK_ORDER_CACHE,
+ EnumSet.of(IClusterServices.cacheMode.NON_TRANSACTIONAL, IClusterServices.cacheMode.ASYNC));*/
+
+ } catch (CacheConfigException cce) {
+ logger.error("Meter CacheConfigException");
+ return false;
+
+ } catch (CacheExistException cce) {
+ logger.error(" Meter CacheExistException");
+ }
+
+ return true;
+ }
+
+ private void nonClusterMeterObjectCreate() {
+ originalSwMeterView = new ConcurrentHashMap<MeterKey, Meter>();
+ installedSwMeterView = new ConcurrentHashMap<MeterKey, Meter>();
+ nodeMeters = new ConcurrentHashMap<Node, List<Meter>>();
+ inactiveMeters = new ConcurrentHashMap<MeterKey, Meter>();
+ }
+
+ @SuppressWarnings({ "unchecked" })
+ private boolean retrieveMeterCaches() {
+ ConcurrentMap<?, ?> map;
+
+ if (this.clusterMeterContainerService == null) {
+ logger.warn("Meter: un-initialized clusterMeterContainerService, can't retrieve cache");
+ nonClusterMeterObjectCreate();
+ return false;
+ }
+
+ map = clusterMeterContainerService.getCache("frm.originalSwMeterView");
+ if (map != null) {
+ originalSwMeterView = (ConcurrentMap<MeterKey, Meter>) map;
+ } else {
+ logger.error("Retrieval of cache(originalSwMeterView) failed");
+ return false;
+ }
+
+ map = clusterMeterContainerService.getCache("frm.installedSwMeterView");
+ if (map != null) {
+ installedSwMeterView = (ConcurrentMap<MeterKey, Meter>) map;
+ } else {
+ logger.error("Retrieval of cache(installedSwMeterView) failed");
+ return false;
+ }
+
+ map = clusterMeterContainerService.getCache("frm.inactiveMeters");
+ if (map != null) {
+ inactiveMeters = (ConcurrentMap<MeterKey, Meter>) map;
+ } else {
+ logger.error("Retrieval of cache(inactiveMeters) failed");
+ return false;
+ }
+
+ map = clusterMeterContainerService.getCache("frm.nodeMeters");
+ if (map != null) {
+ nodeMeters = (ConcurrentMap<Node, List<Meter>>) map;
+ } else {
+ logger.error("Retrieval of cache(nodeMeter) failed");
+ return false;
+ }
+
+ return true;
+ }
+
+ private boolean cacheStartup() {
+ if (allocateMeterCaches()) {
+ if (retrieveMeterCaches()) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Adds Meter to the southbound plugin and our internal database
+ *
+ * @param path
+ * @param dataObject
+ */
+ private Status addMeter(InstanceIdentifier<?> path, Meter meterAddDataObject) {
+ MeterKey meterKey = meterAddDataObject.getKey();
+
+ if (null != meterKey &&
+ validateMeter(meterAddDataObject, FRMUtil.operation.ADD).isSuccess()) {
+ if (meterAddDataObject.isInstall()) {
+ AddMeterInputBuilder meterBuilder = new AddMeterInputBuilder();
+
+ meterBuilder.setContainerName(meterAddDataObject.getContainerName());
+ meterBuilder.setFlags(meterAddDataObject.getFlags());
+ meterBuilder.setMeterBandHeaders(meterAddDataObject.getMeterBandHeaders());
+ meterBuilder.setMeterId(meterAddDataObject.getMeterId());
+ meterBuilder.setNode(meterAddDataObject.getNode());
+ originalSwMeterView.put(meterKey, meterAddDataObject);
+ meterService.addMeter(meterBuilder.build());
+ }
+
+ originalSwMeterView.put(meterKey, meterAddDataObject);
+ }
+ else {
+ return new Status(StatusCode.BADREQUEST, "Meter Key or attribute validation failed");
+ }
+
+ return new Status(StatusCode.SUCCESS);
+ }
+
+ /*
+ * Update Meter to the southbound plugin and our internal database
+ *
+ * @param path
+ * @param dataObject
+ */
+ private Status updateMeter(InstanceIdentifier<?> path, Meter meterUpdateDataObject) {
+ MeterKey meterKey = meterUpdateDataObject.getKey();
+
+ if (null != meterKey &&
+ validateMeter(meterUpdateDataObject, FRMUtil.operation.ADD).isSuccess()) {
+ if (meterUpdateDataObject.isInstall()) {
+ UpdateMeterInputBuilder updateMeterBuilder = new UpdateMeterInputBuilder();
+
+ originalSwMeterView.put(meterKey, meterUpdateDataObject);
+ meterService.updateMeter(updateMeterBuilder.build());
+ }
+
+ originalSwMeterView.put(meterKey, meterUpdateDataObject);
+ }
+ else {
+ return new Status(StatusCode.BADREQUEST, "Meter Key or attribute validation failed");
+ }
+
+ return new Status(StatusCode.SUCCESS);
+ }
+
+ /*
+ * Remove Meter to the southbound plugin and our internal database
+ *
+ * @param path
+ * @param dataObject
+ */
+ private Status RemoveMeter(InstanceIdentifier<?> path, Meter meterUpdateDataObject) {
+ MeterKey meterKey = meterUpdateDataObject.getKey();
+
+ if (null != meterKey &&
+ validateMeter(meterUpdateDataObject, FRMUtil.operation.ADD).isSuccess()) {
+ if (meterUpdateDataObject.isInstall()) {
+ UpdateMeterInputBuilder updateMeterBuilder = new UpdateMeterInputBuilder();
+
+ originalSwMeterView.put(meterKey, meterUpdateDataObject);
+ meterService.updateMeter(updateMeterBuilder.build());
+ }
+
+ originalSwMeterView.put(meterKey, meterUpdateDataObject);
+ }
+ else {
+ return new Status(StatusCode.BADREQUEST, "Meter Key or attribute validation failed");
+ }
+
+ return new Status(StatusCode.SUCCESS);
+ }
+
+ public Status validateMeter(Meter meter, FRMUtil.operation operation) {
+ String containerName;
+ String meterName;
+ Status returnStatus = null;
+ boolean returnResult;
+
+ if (null != meter) {
+ containerName = meter.getContainerName();
+
+ if (null == containerName) {
+ containerName = GlobalConstants.DEFAULT.toString();
+ }
+ else if (!FRMUtil.isNameValid(containerName)) {
+ logger.error("Container Name is invalid %s" + containerName);
+ returnStatus = new Status(StatusCode.BADREQUEST, "Container Name is invalid");
+ return returnStatus;
+ }
+
+ meterName = meter.getMeterName();
+ if (!FRMUtil.isNameValid(meterName)) {
+ logger.error("Meter Name is invalid %s" + meterName);
+ returnStatus = new Status(StatusCode.BADREQUEST, "Meter Name is invalid");
+ return returnStatus;
+ }
+
+ returnResult = doesMeterEntryExists(meter.getKey(), meterName, containerName);
+
+ if (FRMUtil.operation.ADD == operation && returnResult) {
+ logger.error("Record with same Meter Name exists");
+ returnStatus = new Status(StatusCode.BADREQUEST, "Meter record exists");
+ return returnStatus;
+ }
+ else if (!returnResult) {
+ logger.error("Group record does not exist");
+ returnStatus = new Status(StatusCode.BADREQUEST, "Meter record does not exist");
+ return returnStatus;
+ }
+
+ for (int i = 0; i < meter.getMeterBandHeaders().getMeterBandHeader().size(); i++) {
+ if (!meter.getFlags().isMeterBurst()) {
+ if (0 < meter.getMeterBandHeaders().getMeterBandHeader().get(i).getBurstSize()) {
+ logger.error("Burst size should only be associated when Burst FLAG is set");
+ returnStatus = new Status(StatusCode.BADREQUEST, "Burst size should only be associated when Burst FLAG is set");
+ break;
+ }
+ }
+ }
+
+ if (null != returnStatus && !returnStatus.isSuccess()) {
+ return returnStatus;
+ }
+ else {
+ BandType setBandType = null;
+ DscpRemark dscpRemark = null;
+ for (int i = 0; i < meter.getMeterBandHeaders().getMeterBandHeader().size(); i++) {
+ setBandType = meter.getMeterBandHeaders().getMeterBandHeader().get(i).getBandType();
+ if ( setBandType instanceof DscpRemark) {
+ dscpRemark = (DscpRemark)setBandType;
+ if (0 > dscpRemark.getRate()) {
+
+ }
+ }
+ else if (setBandType instanceof Drop) {
+ if (0 < dscpRemark.getPercLevel()) {
+ logger.error("Number of drop Precedence level");
+ }
+ }
+ else if (setBandType instanceof Experimenter) {
+
+ }
+ }
+ }
+ }
+ return new Status(StatusCode.SUCCESS);
+ }
+
+ private boolean doesMeterEntryExists(MeterKey key, String meterName, String containerName) {
+ if (! originalSwMeterView.containsKey(key)) {
+ return false;
+ }
+
+ for (Entry<MeterKey, Meter> entry : originalSwMeterView.entrySet()) {
+ if (entry.getValue().getMeterName().equals(meterName)) {
+ if (entry.getValue().getContainerName().equals(containerName)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+
+ private RpcResult<Void> commitToPlugin(internalTransaction transaction) {
+ for(Entry<InstanceIdentifier<?>, Meter> entry :transaction.additions.entrySet()) {
+
+ if (!addMeter(entry.getKey(),entry.getValue()).isSuccess()) {
+ return Rpcs.getRpcResult(false, null, null);
+ }
+ }
+ for(@SuppressWarnings("unused") Entry<InstanceIdentifier<?>, Meter> entry :transaction.updates.entrySet()) {
+
+ if (!updateMeter(entry.getKey(),entry.getValue()).isSuccess()) {
+ return Rpcs.getRpcResult(false, null, null);
+ }
+ }
+
+ for(InstanceIdentifier<?> removal : transaction.removals) {
+ /* if (!removeMeter(entry.getKey(),entry.getValue()).isSuccess()) {
+ return Rpcs.getRpcResult(false, null, null);
+ }*/
+ }
+
+ return Rpcs.getRpcResult(true, null, null);
+ }
+
+ private final class internalTransaction implements DataCommitTransaction<InstanceIdentifier<?>, DataObject> {
+
+ private final DataModification<InstanceIdentifier<?>, DataObject> modification;
+
+ @Override
+ public DataModification<InstanceIdentifier<?>, DataObject> getModification() {
+ return modification;
+ }
+
+ public internalTransaction(DataModification<InstanceIdentifier<?>, DataObject> modification) {
+ this.modification = modification;
+ }
+
+ Map<InstanceIdentifier<?>, Meter> additions = new HashMap<>();
+ Map<InstanceIdentifier<?>, Meter> updates = new HashMap<>();
+ Set<InstanceIdentifier<?>> removals = new HashSet<>();
+
+ /**
+ * We create a plan which flows will be added, which will be updated and
+ * which will be removed based on our internal state.
+ *
+ */
+ void prepareUpdate() {
+
+ Set<Entry<InstanceIdentifier<?>, DataObject>> puts = modification.getUpdatedConfigurationData().entrySet();
+ for (Entry<InstanceIdentifier<?>, DataObject> entry : puts) {
+ if (entry.getValue() instanceof Meter) {
+ Meter Meter = (Meter) entry.getValue();
+ preparePutEntry(entry.getKey(), Meter);
+ }
+
+ }
+
+ removals = modification.getRemovedConfigurationData();
+ }
+
+ private void preparePutEntry(InstanceIdentifier<?> key, Meter meter) {
+
+ Meter original = originalSwMeterView.get(key);
+ if (original != null) {
+ // It is update for us
+
+ updates.put(key, meter);
+ } else {
+ // It is addition for us
+
+ additions.put(key, meter);
+ }
+ }
+
+ /**
+ * We are OK to go with execution of plan
+ *
+ */
+ @Override
+ public RpcResult<Void> finish() throws IllegalStateException {
+
+ RpcResult<Void> rpcStatus = commitToPlugin(this);
+ // We return true if internal transaction is successful.
+ // return Rpcs.getRpcResult(true, null, Collections.emptySet());
+ return rpcStatus;
+ }
+
+ /**
+ *
+ * We should rollback our preparation
+ *
+ */
+ @Override
+ public RpcResult<Void> rollback() throws IllegalStateException {
+ // NOOP - we did not modified any internal state during
+ // requestCommit phase
+ // return Rpcs.getRpcResult(true, null, Collections.emptySet());
+ return Rpcs.getRpcResult(true, null, null);
+
+ }
+
+ }
+
+ private final class MeterDataCommitHandler implements DataCommitHandler<InstanceIdentifier<?>, DataObject> {
+ @Override
+ public org.opendaylight.controller.md.sal.common.api.data.DataCommitHandler.DataCommitTransaction<InstanceIdentifier<?>, DataObject> requestCommit(
+ DataModification<InstanceIdentifier<?>, DataObject> modification) {
+ // We should verify transaction
+ System.out.println("Coming in MeterDataCommitHandler");
+ internalTransaction transaction = new internalTransaction(modification);
+ transaction.prepareUpdate();
+ return transaction;
+ }
+ }
+
+ final class MeterEventListener implements SalMeterListener {
+
+ List<MeterAdded> addedMeter = new ArrayList<>();
+ List<MeterRemoved> removeMeter = new ArrayList<>();
+ List<MeterUpdated> updatedMeter = new ArrayList<>();
+
+ @Override
+ public void onMeterAdded(MeterAdded notification) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void onMeterRemoved(MeterRemoved notification) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void onMeterUpdated(MeterUpdated notification) {
+ // TODO Auto-generated method stub
+
+ }
+ }
+}
</parent>
<artifactId>compatibility-parent</artifactId>
<packaging>pom</packaging>
- <name>MD-SAL to AD-SAL Adaptation</name>
+ <name>MD-SAL to AD-SAL Adaptation Parent</name>
<scm>
<connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
<developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
return null;
}
- public static def toStatus(RpcResult<Void> result) {
+ public static def toStatus(RpcResult<?> result) {
if (result.isSuccessful()) {
return new Status(StatusCode.SUCCESS);
} else {
import static org.opendaylight.controller.sal.match.MatchType.DL_SRC;
import static org.opendaylight.controller.sal.match.MatchType.DL_TYPE;
-import java.math.BigInteger;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
+
import org.opendaylight.controller.sal.compatibility.MDFlowMapping;
import org.opendaylight.controller.sal.core.NodeConnector;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetNodeConnectorStatisticsInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetNodeConnectorStatisticsInputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.address.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.address.Ipv6Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv6Builder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInputBuilder
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInputBuilder
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsInputBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.VlanCfi
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.ControllerActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.DropActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.FloodActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.FloodAllActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.HwPathActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.LoopbackActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.OutputActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.PopVlanActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.PushVlanActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetDlDstActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetDlSrcActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetDlTypeActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetNextHopActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetNwDstActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetNwSrcActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetNwTosActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetTpDstActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetTpSrcActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetVlanCfiActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetVlanIdActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetVlanPcpActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SwPathActionBuilder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.Address
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.address.Ipv4Builder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.address.Ipv6Builder
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.list.Action
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.list.ActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.VlanCfi
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.ControllerActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodAllActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.HwPathActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.LoopbackActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlTypeActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNextHopActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwDstActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTosActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanCfiActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SwPathActionBuilder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv6Builder
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.ActionList;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.VlanCfi;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.ControllerAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.DropAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.FloodAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.FloodAllAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.HwPathAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.LoopbackAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.OutputAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.PopMplsAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.PopVlanAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.PushMplsAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.PushPbbAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.PushVlanAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetDlDstAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetDlSrcAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetDlTypeAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetMplsTtlAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetNextHopAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetNwDstAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetNwSrcAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetNwTosAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetNwTtlAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetQueueAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetTpDstAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetTpSrcAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetVlanCfiAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetVlanIdAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SetVlanPcpAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.SwPathAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.list.Action;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.address.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.address.Ipv6;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.ActionList;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.VlanCfi;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.ControllerAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DropAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.FloodAllAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.HwPathAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.LoopbackAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlDstAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlSrcAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetDlTypeAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNextHopAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwDstAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTosAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpDstAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetTpSrcAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanCfiAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanPcpAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SwPathAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv6;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;
public static List<org.opendaylight.controller.sal.action.Action> actionFrom(List<Action> actions) {
List<org.opendaylight.controller.sal.action.Action> targetAction = new ArrayList<>();
for (Action action : actions) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.Action sourceAction = action
+ org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action sourceAction = action
.getAction();
if (sourceAction instanceof ControllerAction) {
package org.opendaylight.controller.sal.compatibility.adsal;
+import java.math.BigInteger;
import java.util.concurrent.Future;
import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
import org.opendaylight.controller.sal.flowprogrammer.IFlowProgrammerService;
import org.opendaylight.controller.sal.utils.Status;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.AddFlowOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowRemovedBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.RemoveFlowOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.SalFlowService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.UpdateFlowOutputBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResult;
}
@Override
- public Future<RpcResult<Void>> addFlow(AddFlowInput input) {
+ public Future<RpcResult<AddFlowOutput>> addFlow(AddFlowInput input) {
Flow flow = ToSalConversionsUtils.toFlow(input);
@SuppressWarnings("unchecked")
org.opendaylight.controller.sal.core.Node node = InventoryMapping.toAdNode((InstanceIdentifier<Node>) input
.getNode().getValue());
Status status = delegate.addFlowAsync(node, flow);
- Void rpcResultType = null;
+ AddFlowOutputBuilder builder = new AddFlowOutputBuilder();
+ builder.setTransactionId(new TransactionId(BigInteger.valueOf(status.getRequestId())));
+ AddFlowOutput rpcResultType = builder.build();
return Futures.immediateFuture(Rpcs.getRpcResult(status.isSuccess(), rpcResultType, null));
}
@Override
- public Future<RpcResult<Void>> removeFlow(RemoveFlowInput input) {
+ public Future<RpcResult<RemoveFlowOutput>> removeFlow(RemoveFlowInput input) {
Flow flow = ToSalConversionsUtils.toFlow(input);
@SuppressWarnings("unchecked")
org.opendaylight.controller.sal.core.Node node = InventoryMapping.toAdNode((InstanceIdentifier<Node>) input
.getNode().getValue());
Status status = delegate.removeFlowAsync(node, flow);
- Void rpcResultType = null;
+ RemoveFlowOutputBuilder builder = new RemoveFlowOutputBuilder();
+ builder.setTransactionId(new TransactionId(BigInteger.valueOf(status.getRequestId())));
+ RemoveFlowOutput rpcResultType = builder.build();
return Futures.immediateFuture(Rpcs.getRpcResult(status.isSuccess(), rpcResultType, null));
}
@Override
- public Future<RpcResult<Void>> updateFlow(UpdateFlowInput input) {
+ public Future<RpcResult<UpdateFlowOutput>> updateFlow(UpdateFlowInput input) {
@SuppressWarnings("unchecked")
org.opendaylight.controller.sal.core.Node node = InventoryMapping.toAdNode((InstanceIdentifier<Node>) input
.getNode().getValue());
Flow originalFlow = ToSalConversionsUtils.toFlow(input.getOriginalFlow());
Flow updatedFlow = ToSalConversionsUtils.toFlow(input.getUpdatedFlow());
Status status = delegate.modifyFlowAsync(node, originalFlow, updatedFlow);
- Void rpcResultType = null;
- return Futures.immediateFuture(Rpcs.getRpcResult(status.isSuccess(), rpcResultType, null));
+ UpdateFlowOutputBuilder builder = new UpdateFlowOutputBuilder();
+ builder.setTransactionId(new TransactionId(BigInteger.valueOf(status.getRequestId())));
+ UpdateFlowOutput rpcResultType = builder.build();
+ throw new UnsupportedOperationException("Need to translate AD-SAL status to MD-SAL UpdateFlowOuptut - eaw@cisco.com");
+ // return Futures.immediateFuture(Rpcs.getRpcResult(status.isSuccess(), rpcResultType, null));
}
}
import org.opendaylight.controller.sal.match.Match;
import org.opendaylight.controller.sal.match.MatchType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.NodeFlow;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.*;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.address.Ipv4;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.*;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Layer3Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Layer4Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatch;
}
private void checkOdActions(
- List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.list.Action> actions) {
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actions) {
checkOdAction(actions, FloodAction.class, false);
checkOdAction(actions, FloodAllAction.class, false);
checkOdAction(actions, HwPathAction.class, false);
}
private void checkOdAction(
- List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.list.Action> actions, Class<?> cl,
+ List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actions, Class<?> cl,
boolean b) {
int numOfFoundActions = 0;
- for (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.list.Action action : actions) {
- org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.Action innerAction = action
+ for (org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action action : actions) {
+ org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action innerAction = action
.getAction();
if (cl.isInstance(innerAction)) {
numOfFoundActions++;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.FlowAddedBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.NodeFlow;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.VlanCfi;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.action.*;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.Address;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.address.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.address.address.Ipv6Builder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.list.Action;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.action.list.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.VlanCfi;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.*;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv6Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.InstructionsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
--- /dev/null
+module opendaylight-action-types {
+ namespace "urn:opendaylight:action:types";
+ prefix action;
+
+ import ietf-inet-types {prefix inet; revision-date "2010-09-24";}
+ import ietf-yang-types {prefix yang; revision-date "2010-09-24";}
+ import opendaylight-l2-types {prefix l2t; revision-date "2013-08-27";}
+
+ revision "2013-11-12" {
+ description "Initial revision of action service";
+ }
+
+ typedef vlan-cfi {
+ type int32;
+ }
+
+ grouping address {
+ choice address {
+ case ipv4 {
+ leaf ipv4-address {
+ type inet:ipv4-prefix;
+ }
+ }
+ case ipv6 {
+ leaf ipv6-address {
+ type inet:ipv6-prefix;
+ }
+ }
+ }
+ }
+
+ grouping action-list {
+ list action {
+ key "order";
+ leaf order {
+ type int32;
+ }
+ uses action;
+ }
+ }
+
+ grouping action {
+ choice action {
+ case output-action {
+ leaf-list output-node-connector {
+ type inet:uri;
+ }
+
+ leaf max-length {
+ type uint16 {
+ range "0..65294";
+ }
+ }
+ }
+
+ case controller-action {
+ leaf max-length {
+ type uint16 {
+ range "0..65294";
+ }
+ }
+ }
+
+ case set-queue-action {
+ leaf queue {
+ type string;
+ }
+ }
+
+ case pop-mpls-action {
+ leaf ethernet-type {
+ type uint16; // TODO: define ethertype type
+ }
+ }
+
+ case set-mpls-ttl-action {
+ leaf mpls-ttl {
+ type uint8;
+ }
+ }
+
+ case set-nw-ttl-action {
+ leaf nw-ttl {
+ type uint8;
+ }
+ }
+
+ case push-pbb-action {
+ leaf ethernet-type {
+ type uint16; // TODO: define ethertype type
+ }
+ }
+
+ case pop-pbb-action {
+
+ }
+
+ case push-mpls-action {
+ leaf ethernet-type {
+ type uint16; // TODO: define ethertype type
+ }
+ }
+
+ case dec-mpls-ttl {
+ }
+
+ case dec-nw-ttl {
+ }
+
+ case drop-action {
+ }
+
+ case flood-action {
+ }
+
+ case flood-all-action {
+ }
+
+ case hw-path-action {
+ }
+
+ case loopback-action {
+ }
+
+ case pop-vlan-action {
+ }
+
+ case push-vlan-action {
+ leaf ethernet-type {
+ type uint16; // TODO: define ethertype type
+ }
+ leaf tag { // TPID - 16 bits
+ type int32;
+ }
+ leaf pcp { // PCP - 3 bits
+ type int32;
+ }
+ leaf cfi { // CFI - 1 bit (drop eligible)
+ type vlan-cfi;
+ }
+ leaf vlan-id { // VID - 12 bits
+ type l2t:vlan-id;
+ }
+// leaf tci { //TCI = [PCP + CFI + VID]
+// }
+// leaf header { //header = [TPID + TCI]
+// }
+ }
+
+ case copy-ttl-out {
+ }
+
+ case copy-ttl-in {
+ }
+
+ case set-dl-dst-action {
+ leaf address {
+ type yang:mac-address;
+ }
+ }
+
+ case set-dl-src-action {
+ leaf address {
+ type yang:mac-address;
+ }
+ }
+ case group-action {
+ leaf group {
+ type string;
+ }
+ }
+
+ case set-dl-type-action {
+ leaf dl-type {
+ type l2t:ether-type;
+ }
+ }
+
+ case set-next-hop-action {
+ uses address;
+ }
+
+ case set-nw-dst-action {
+ uses address;
+ }
+
+ case set-nw-src-action{
+ uses address;
+ }
+
+ case set-nw-tos-action {
+ leaf tos {
+ type int32;
+ }
+ }
+
+ case set-tp-dst-action {
+ leaf port {
+ type inet:port-number;
+ }
+ }
+ case set-tp-src-action {
+ leaf port {
+ type inet:port-number;
+ }
+ }
+ case set-vlan-cfi-action {
+ leaf vlan-cfi {
+ type vlan-cfi;
+ }
+ }
+
+ case set-vlan-id-action {
+ leaf vlan-id {
+ type l2t:vlan-id;
+ }
+ }
+
+ case set-vlan-pcp-action {
+ leaf vlan-pcp {
+ type l2t:vlan-pcp;
+ }
+ }
+
+ case sw-path-action {
+ }
+ }
+ }
+}
\ No newline at end of file
prefix flow;
import ietf-inet-types {prefix inet; revision-date "2010-09-24";}
- import ietf-yang-types {prefix yang; revision-date "2010-09-24";}
- import opendaylight-l2-types {prefix l2t; revision-date "2013-08-27";}
+ import ietf-yang-types {prefix yang; revision-date "2010-09-24";}
import opendaylight-match-types {prefix match; revision-date 2013-10-26";}
-
+ import opendaylight-action-types {prefix action;}
revision "2013-10-26" {
description "Initial revision of flow service";
}
-
- typedef vlan-cfi {
- type int32;
- }
-
-
- grouping action-list {
- list action {
+ grouping instruction-list {
+ list instruction {
key "order";
leaf order {
type int32;
}
- uses action;
- }
- }
-
- grouping address {
- choice address {
- case ipv4 {
- leaf ipv4-address {
- type inet:ipv4-prefix;
- }
- }
- case ipv6 {
- leaf ipv6-address {
- type inet:ipv6-prefix;
- }
- }
+ uses instruction;
}
- }
-
- grouping instruction-list {
- list instruction {
- key "order";
- leaf order {
- type int32;
- }
- uses instruction;
- }
}
grouping instruction {
}
case write-actions {
- uses action-list;
+ uses action:action-list;
}
case apply-actions {
- uses action-list;
+ uses action:action-list;
}
case clear-actions {
- uses action-list;
+ uses action:action-list;
}
case meter {
}
}
- grouping action {
- choice action {
- case output-action {
- leaf-list output-node-connector {
- type inet:uri;
- }
-
- leaf max-length {
- type uint16 {
- range "0..65294";
- }
- }
- }
-
- case controller-action {
- leaf max-length {
- type uint16 {
- range "0..65294";
- }
- }
- }
-
- case set-queue-action {
- leaf queue {
- type string;
- }
- }
-
- case pop-mpls-action {
- leaf ethernet-type {
- type uint16; // TODO: define ethertype type
- }
- }
-
- case set-mpls-ttl-action {
- leaf mpls-ttl {
- type uint8;
- }
- }
-
- case set-nw-ttl-action {
- leaf nw-ttl {
- type uint8;
- }
- }
-
- case push-pbb-action {
- leaf ethernet-type {
- type uint16; // TODO: define ethertype type
- }
- }
-
- case pop-pbb-action {
-
- }
-
- case push-mpls-action {
- leaf ethernet-type {
- type uint16; // TODO: define ethertype type
- }
- }
-
- case dec-mpls-ttl {
- }
-
- case dec-nw-ttl {
- }
-
- case drop-action {
- }
-
- case flood-action {
- }
-
- case flood-all-action {
- }
-
- case hw-path-action {
- }
-
- case loopback-action {
- }
-
- case pop-vlan-action {
- }
-
- case push-vlan-action {
- leaf tag { // TPID - 16 bits
- type int32;
- }
- leaf pcp { // PCP - 3 bits
- type int32;
- }
- leaf cfi { // CFI - 1 bit (drop eligible)
- type vlan-cfi;
- }
- leaf vlan-id { // VID - 12 bits
- type l2t:vlan-id;
- }
-// leaf tci { //TCI = [PCP + CFI + VID]
-// }
-// leaf header { //header = [TPID + TCI]
-// }
- }
-
- case copy-ttl-out {
- }
-
- case copy-ttl-in {
- }
-
- case set-dl-dst-action {
- leaf address {
- type yang:mac-address;
- }
- }
-
- case set-dl-src-action {
- leaf address {
- type yang:mac-address;
- }
- }
- case group-action {
- leaf group {
- type string;
- }
- }
-
- case set-dl-type-action {
- leaf dl-type {
- type l2t:ether-type;
- }
- }
-
- case set-next-hop-action {
- uses address;
- }
-
- case set-nw-dst-action {
- uses address;
- }
-
- case set-nw-src-action{
- uses address;
- }
-
- case set-nw-tos-action {
- leaf tos {
- type int32;
- }
- }
-
- case set-tp-dst-action {
- leaf port {
- type inet:port-number;
- }
- }
- case set-tp-src-action {
- leaf port {
- type inet:port-number;
- }
- }
- case set-vlan-cfi-action {
- leaf vlan-cfi {
- type vlan-cfi;
- }
- }
-
- case set-vlan-id-action {
- leaf vlan-id {
- type l2t:vlan-id;
- }
- }
-
- case set-vlan-pcp-action {
- leaf vlan-pcp {
- type l2t:vlan-pcp;
- }
- }
-
- case sw-path-action {
- }
- }
- }
-
typedef flow-mod-flags {
type bits {
bit CHECK_OVERLAP;
bit RESET_COUNTS;
bit NO_PKT_COUNTS;
bit NO_BYT_COUNTS;
+ bit SEND_FLOW_REM;
}
}
leaf flow-name{
type string;
}
+
+ leaf installHw {
+ type boolean;
+ }
+
+ leaf barrier {
+ type boolean;
+ }
+
+ leaf strict {
+ type boolean;
+ default "false";
+ }
+
}
grouping flow-statistics {
prefix group;
import ietf-inet-types {prefix inet; revision-date "2010-09-24";}
- import ietf-yang-types {prefix yang; revision-date "2010-09-24";}
- import opendaylight-flow-types {prefix flow-types;revision-date 2013-10-26";}
+ import ietf-yang-types {prefix yang; revision-date "2010-09-24";}
+ import opendaylight-action-types {prefix action;}
revision "2013-10-18" {
description "Initial revision of group service";
type string;
}
+ leaf install {
+ type boolean;
+ }
+
leaf barrier {
type boolean;
}
type uint32;
}
- container actions {
- list action {
- key "action-order";
- leaf action-order {
- type int32;
- }
-
- uses flow-types:action;
- }
- }
+ uses action:action-list;
}
}
}
}
uses group-types;
+
leaf capabilities {
type enumeration {
enum select-weight;
type binary;
}
}
+
+ grouping "of-metadata" {
+ leaf metadata {
+ type uint64;
+ }
+
+ leaf metadata-mask {
+ type binary;
+ }
+ }
/** Match Groupings **/
grouping "ethernet-match-fields" {
mandatory true;
type l2t:ether-type; // Needs to define that as general model
}
+
leaf mask {
type binary;
}
description "IP Proto (IPv4 or IPv6 Protocol Number).";
type inet:ip-version;
}
- }
-
+ }
+
grouping "ipv4-match-fields" {
leaf ipv4-source {
description "IPv4 source address.";
type inet:ipv4-prefix;
}
+
leaf ipv4-destination {
description "IPv4 destination address.";
type inet:ipv4-prefix;
}
+
}
-
+
grouping "ipv6-match-fields" {
leaf ipv6-source {
description "IPv6 source address.";
type inet:ipv6-prefix;
}
-
+
leaf ipv6-destination {
description "IPv6 destination address.";
type inet:ipv6-prefix;
leaf ipv6-nd-target {
description "IPv6 target address for neighbour discovery message";
- type inet:ipv6-prefix;
+ type inet:ipv6-address;
}
- leaf ipv6-flabel {
- type inet:ipv6-flow-label;
+ container "ipv6-label" {
+ leaf ipv6-flabel {
+ type inet:ipv6-flow-label;
+ }
+
+ leaf flabel-mask {
+ type binary;
+ }
}
leaf ipv6-nd-sll {
type uint8;
}
- leaf pbb-isid {
- description "I-SID in the first PBB service instance tag";
- type uint32;
- }
-
+ container "pbb" {
+ leaf pbb-isid {
+ description "I-SID in the first PBB service instance tag";
+ type uint32;
+ }
+
+ leaf pbb-mask {
+ type binary;
+ }
+ }
}
grouping "tcp-match-fields" {
type uint32;
}
- leaf metadata {
- type uint64;
+ container "metadata" {
+ uses of-metadata;
}
- leaf tunnel-id {
- description "Metadata associated in the logical port";
- type uint64;
+ container "tunnel" {
+ leaf tunnel-id {
+ description "Metadata associated in the logical port";
+ type uint64;
+ }
+
+ leaf tunnel-mask {
+ type binary;
+ }
}
container "ethernet-match" {
uses meter-band-type;
}
+ leaf rate {
+ type uint32;
+ }
+
leaf burst-size {
type uint32;
}
import ietf-inet-types {prefix inet; revision-date "2010-09-24";}
import ietf-yang-types {prefix yang; revision-date "2010-09-24";}
import opendaylight-flow-types {prefix flow;revision-date 2013-10-26";}
-
+ import opendaylight-action-types {prefix action;}
revision "2013-10-26" {
description "Initial revision of table service";
case write-actions {
container write-actions {
- uses flow:action-list;
+ uses action:action-list;
}
}
case write-actions-miss {
container write-actions-miss {
- uses flow:action-list;
+ uses action:action-list;
}
}
case apply-actions {
container apply-actions {
- uses flow:action-list;
+ uses action:action-list;
}
}
case apply-actions-miss {
container apply-actions-miss {
- uses flow:action-list;
+ uses action:action-list;
}
}
import opendaylight-inventory {prefix inv;revision-date "2013-08-19";}
import ietf-inet-types {prefix inet; revision-date "2010-09-24";}
import opendaylight-flow-types {prefix types;revision-date "2013-10-26";}
-
+ import flow-capable-transaction {prefix tr;}
revision "2013-08-19" {
description "Initial revision of flow service";
}
-
typedef flow-table-ref {
type instance-identifier;
}
rpc add-flow {
input {
uses node-flow;
+ uses tr:transaction-aware;
+ }
+ output {
+ uses tr:transaction-aware;
}
}
rpc remove-flow {
input {
uses node-flow;
+ uses tr:transaction-aware;
+ }
+ output {
+ uses tr:transaction-aware;
}
}
rpc update-flow {
input {
uses flow-update;
+ uses tr:transaction-aware;
+ }
+ output {
+ uses tr:transaction-aware;
}
}