X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fadsal%2Fsal%2Fapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fcore%2FContainerFlow.java;fp=opendaylight%2Fadsal%2Fsal%2Fapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fcore%2FContainerFlow.java;h=0000000000000000000000000000000000000000;hb=50f88249a65c52ba56a48852b71ce432fed2bbeb;hp=aeb9fe718b6c22c58deeed0810f011d8269855ef;hpb=abfa9a03550cbe9fccc4420684dced175dd6d119;p=controller.git diff --git a/opendaylight/adsal/sal/api/src/main/java/org/opendaylight/controller/sal/core/ContainerFlow.java b/opendaylight/adsal/sal/api/src/main/java/org/opendaylight/controller/sal/core/ContainerFlow.java deleted file mode 100644 index aeb9fe718b..0000000000 --- a/opendaylight/adsal/sal/api/src/main/java/org/opendaylight/controller/sal/core/ContainerFlow.java +++ /dev/null @@ -1,148 +0,0 @@ - -/* - * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.controller.sal.core; - -import java.io.Serializable; - -import org.opendaylight.controller.sal.action.Action; -import org.opendaylight.controller.sal.action.SetDlType; -import org.opendaylight.controller.sal.action.SetNwDst; -import org.opendaylight.controller.sal.action.SetNwSrc; -import org.opendaylight.controller.sal.action.SetTpDst; -import org.opendaylight.controller.sal.action.SetTpSrc; -import org.opendaylight.controller.sal.action.SetVlanId; -import org.opendaylight.controller.sal.flowprogrammer.Flow; -import org.opendaylight.controller.sal.match.Match; -import org.opendaylight.controller.sal.match.MatchType; - -/** - * Express a container flow - * - * - * - */ -@Deprecated -public class ContainerFlow implements Serializable { - private static final long serialVersionUID = 1L; - private Match match; - - public ContainerFlow(Match match) { - this.match = match; - } - - /** - * Returns a copy of the Match defined by this Container Flow - * - * @return Match - */ - public Match getMatch() { - return match.clone(); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((match == null) ? 0 : match.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj == null) { - return false; - } - if (getClass() != obj.getClass()) { - return false; - } - ContainerFlow other = (ContainerFlow) obj; - if (match == null) { - if (other.match != null) { - return false; - } - } else if (!match.equals(other.match)) { - return false; - } - return true; - } - - @Override - public String toString() { - return "Container Flow [" + match.toString() + "]"; - } - - /** - * Returns whether the specified flow is allowed - * - * @return true if the flow is allowed, false otherwise - */ - public boolean allowsFlow(Flow flow) { - Match target = flow.getMatch(); - - // Check if flow's match is allowed - if (!this.allowsMatch(target)) { - return false; - } - - // Now check if the flow's actions are not allowed - // Create a Match which summarizes the list of actions - if (flow.getActions() == null) { - return true; - } - Match actionMatch = new Match(); - for (Action action : flow.getActions()) { - switch (action.getType()) { - case SET_VLAN_ID: - actionMatch.setField(MatchType.DL_VLAN, - ((Integer) ((SetVlanId) action).getVlanId()) - .shortValue()); - break; - case SET_DL_TYPE: - actionMatch.setField(MatchType.DL_TYPE, - ((Integer) ((SetDlType) action).getDlType()) - .shortValue()); - break; - case SET_NW_SRC: - actionMatch.setField(MatchType.NW_SRC, ((SetNwSrc) action) - .getAddress()); - break; - case SET_NW_DST: - actionMatch.setField(MatchType.NW_DST, ((SetNwDst) action) - .getAddress()); - break; - case SET_TP_SRC: - actionMatch.setField(MatchType.TP_SRC, - ((Integer) ((SetTpSrc) action).getPort()).shortValue()); - break; - case SET_TP_DST: - actionMatch.setField(MatchType.TP_DST, - ((Integer) ((SetTpDst) action).getPort()).shortValue()); - break; - default: - // This action cannot conflict - } - } - - return this.allowsMatch(actionMatch); - } - - /** - * Returns whether the specified match is allowed - * - * @param match the match to test - * @return true if the match is allowed, false otherwise - */ - public boolean allowsMatch(Match target) { - return !target.conflictWithFilter(this.match); - } -}