FlowWildCardsV10 - removed .ALL value 19/3819/2
authorMichal Polkorab <michal.polkorab@pantheon.sk>
Wed, 18 Dec 2013 13:44:45 +0000 (14:44 +0100)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 19 Dec 2013 09:52:02 +0000 (09:52 +0000)
DO NOT MERGE until https://git.opendaylight.org/gerrit/#/c/3816/ is merged

Signed-off-by: Michal Polkorab <michal.polkorab@pantheon.sk>
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/ModelDrivenSwitchImpl.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/MatchConvertorV10Impl.java

index a1c7018004748ff965a9fac768966dda22c7f814..000a11902ca1105b8eee69feb2e4ef5a0464b5c6 100644 (file)
@@ -1130,7 +1130,7 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
         
         if(version == OFConstants.OFP_VERSION_1_0){
             LOG.info("Target node is running openflow version 1.0");
-            FlowWildcardsV10 wildCard = new FlowWildcardsV10(true,false,false,false,false,false,false,false,false,false,false);
+            FlowWildcardsV10 wildCard = new FlowWildcardsV10(true,true,true,true,true,true,true,true,true,true);
             mprFlowRequestBuilder.setMatchV10(new MatchV10Builder().setWildcards(wildCard).build());
         }
         if(version == OFConstants.OFP_VERSION_1_3){
@@ -1187,7 +1187,7 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
         
         //TODO: repeating code
         if(version == OFConstants.OFP_VERSION_1_0){
-            FlowWildcardsV10 wildCard = new FlowWildcardsV10(true,false,false,false,false,false,false,false,false,false,false);
+            FlowWildcardsV10 wildCard = new FlowWildcardsV10(true,true,true,true,true,true,true,true,true,true);
             mprFlowRequestBuilder.setMatchV10(new MatchV10Builder().setWildcards(wildCard).build());
         }
         if(version == OFConstants.OFP_VERSION_1_3){
@@ -1293,7 +1293,7 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
         
         //TODO: repeating code
         if(version == OFConstants.OFP_VERSION_1_0){
-            FlowWildcardsV10 wildCard = new FlowWildcardsV10(true,false,false,false,false,false,false,false,false,false,false);
+            FlowWildcardsV10 wildCard = new FlowWildcardsV10(true,true,true,true,true,true,true,true,true,true);
             mprAggregateRequestBuilder.setMatchV10(new MatchV10Builder().setWildcards(wildCard).build());
         }
         if(version == OFConstants.OFP_VERSION_1_3){
index df2fed4d5ca0ea7636175c49920a957c0afbf61d..034ed75a80f207dd463f1b3e14ed93e7bf70d456 100644 (file)
@@ -42,7 +42,6 @@ public class MatchConvertorV10Impl implements MatchConvertor<MatchV10> {
     @Override
     public MatchV10 convert(Match match) {
         MatchV10Builder matchBuilder = new MatchV10Builder();
-        boolean _aLL = true; // NO MATCHING (all match items are wildcarded) by default
         boolean _dLDST = true;
         boolean _dLSRC = true;
         boolean _dLTYPE = true;
@@ -71,25 +70,21 @@ public class MatchConvertorV10Impl implements MatchConvertor<MatchV10> {
         
         EthernetMatch ethernetMatch = match.getEthernetMatch();
         if(ethernetMatch!= null){
-            _aLL = false;
             _dLDST = convertEthernetDlDst(matchBuilder, ethernetMatch);
             _dLSRC = convertEthernetDlSrc(matchBuilder, ethernetMatch);
             _dLTYPE = convertEthernetDlType(matchBuilder, ethernetMatch);
         }
         VlanMatch vlanMatch = match.getVlanMatch();
         if(vlanMatch!= null){
-            _aLL = false;
             _dLVLAN = convertDlVlan(matchBuilder, vlanMatch);
             _dLVLANPCP = convertDlVlanPcp(matchBuilder, vlanMatch);
         }
         Long inPort = match.getInPort();
         if(inPort!=null){
-            _aLL = false;
             _iNPORT = convertInPortMatch(matchBuilder, inPort);
         }
         Layer3Match l3Match = match.getLayer3Match();
         if(l3Match != null){
-            _aLL = false;
             if(l3Match instanceof Ipv4Match){
                 Ipv4Match ipv4 = (Ipv4Match)l3Match;
                 _tPSRC = convertL3Ipv4SrcMatch(matchBuilder, ipv4);
@@ -98,13 +93,11 @@ public class MatchConvertorV10Impl implements MatchConvertor<MatchV10> {
         }
         IpMatch ipMatch = match.getIpMatch();
         if(ipMatch!=null){
-            _aLL = false;
             _nWPROTO = convertNwProto(matchBuilder, ipMatch);
             _nWTOS = convertNwTos(matchBuilder, ipMatch);
         }
         Layer4Match layer4Match = match.getLayer4Match();
         if (layer4Match != null) {
-            _aLL = false;
             if (layer4Match instanceof TcpMatch) {
                 TcpMatch tcpMatch = (TcpMatch) layer4Match;
                 _tPSRC = convertL4TpSrcMatch(matchBuilder, tcpMatch);
@@ -116,11 +109,9 @@ public class MatchConvertorV10Impl implements MatchConvertor<MatchV10> {
             }
         }
         
-        
         FlowWildcardsV10 wildCards = new FlowWildcardsV10(
-                _aLL, _dLDST, _dLSRC, _dLTYPE, _dLVLAN, 
+                _dLDST, _dLSRC, _dLTYPE, _dLVLAN, 
                 _dLVLANPCP, _iNPORT, _nWPROTO, _nWTOS, _tPDST, _tPSRC);
-        checkWildCards(wildCards);
         matchBuilder.setWildcards(wildCards);
         
         return matchBuilder.build();
@@ -340,36 +331,4 @@ public class MatchConvertorV10Impl implements MatchConvertor<MatchV10> {
         return true;
     }
 
-    /**
-     * checks consistency between flag ALL and other flags (true = wildcard is on; false = use match value):
-     * <ul>
-     *   <li>if wc.ALL == true then all other flags must be set to true</li>
-     *   <li>if wc.ALL == false then at least one of other flags must be set to false</li>
-     * </ul>
-     * @param wildCards [wc]
-     */
-    private static void checkWildCards(FlowWildcardsV10 wc) {
-        boolean atLeastOneNonWildCard = false
-                || ! wc.isINPORT()
-                || ! wc.isDLVLAN()
-                || ! wc.isDLSRC()
-                || ! wc.isDLDST()
-                || ! wc.isDLTYPE()
-                || ! wc.isNWPROTO()
-                || ! wc.isTPSRC()
-                || ! wc.isTPDST()
-                || ! wc.isDLVLANPCP()
-                || ! wc.isNWTOS();
-        
-        if (atLeastOneNonWildCard && wc.isALL()) {
-            throw new IllegalStateException(
-                    "[wildcard.all == true] conflicts with at least one non wildcard flag: "+wc);
-        }
-        
-        if (!atLeastOneNonWildCard && !wc.isALL()) {
-            throw new IllegalStateException(
-                    "[wildcard.all == false] conflicts with all set to wildcard flags: "+wc);
-        }
-    }
-
 }