2 * Copyright (c) 2016 Red Hat, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.netvirt.aclservice.utils;
11 import com.google.common.base.Optional;
12 import java.math.BigInteger;
13 import java.util.ArrayList;
14 import java.util.HashMap;
15 import java.util.Iterator;
16 import java.util.List;
18 import java.util.concurrent.ExecutionException;
19 import java.util.concurrent.Future;
20 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
21 import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
22 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
23 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
24 import org.opendaylight.genius.mdsalutil.MDSALUtil;
25 import org.opendaylight.genius.mdsalutil.MatchFieldType;
26 import org.opendaylight.genius.mdsalutil.MatchInfo;
27 import org.opendaylight.genius.mdsalutil.MatchInfoBase;
28 import org.opendaylight.genius.mdsalutil.MetaDataUtil;
29 import org.opendaylight.genius.mdsalutil.NwConstants;
30 import org.opendaylight.genius.mdsalutil.NxMatchFieldType;
31 import org.opendaylight.genius.mdsalutil.NxMatchInfo;
32 import org.opendaylight.genius.mdsalutil.packet.IPProtocols;
33 import org.opendaylight.netvirt.aclservice.api.utils.AclInterface;
34 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.AccessLists;
35 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.Ipv4Acl;
36 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.Acl;
37 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.AclKey;
38 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.Ace;
39 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
40 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
41 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
42 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
43 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
44 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
45 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
46 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
47 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetDpidFromInterfaceInput;
48 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetDpidFromInterfaceInputBuilder;
49 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.GetDpidFromInterfaceOutput;
50 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.rpcs.rev160406.OdlInterfaceRpcService;
51 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceBindings;
52 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeBase;
53 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceTypeFlowBased;
54 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.StypeOpenflow;
55 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.StypeOpenflowBuilder;
56 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfo;
57 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfoKey;
58 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices;
59 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServicesBuilder;
60 import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServicesKey;
61 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
62 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.InterfaceAcl;
63 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.IpPrefixOrAddress;
64 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.SecurityRuleAttr;
65 import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.interfaces._interface.AllowedAddressPairs;
66 import org.opendaylight.yangtools.yang.binding.DataObject;
67 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
68 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder;
69 import org.opendaylight.yangtools.yang.common.RpcResult;
70 import org.slf4j.Logger;
71 import org.slf4j.LoggerFactory;
73 @SuppressWarnings("deprecation")
74 public final class AclServiceUtils {
76 private static final Logger LOG = LoggerFactory.getLogger(AclServiceUtils.class);
78 private AclServiceUtils() { }
81 * Retrieves the Interface from the datastore.
82 * @param broker the data broker
83 * @param interfaceName the interface name
84 * @return the interface.
86 public static Optional<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces
87 .Interface> getInterface(DataBroker broker, String interfaceName) {
88 return read(broker, LogicalDatastoreType.CONFIGURATION, getInterfaceIdentifier(interfaceName));
92 * Builds the interface identifier.
93 * @param interfaceName the interface name.
94 * @return the interface identifier.
96 public static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508
97 .interfaces.Interface> getInterfaceIdentifier(String interfaceName) {
98 return InstanceIdentifier.builder(Interfaces.class)
100 org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces
101 .Interface.class, new InterfaceKey(interfaceName)).build();
105 * Retrieves the object from the datastore.
106 * @param broker the data broker.
107 * @param datastoreType the data store type.
108 * @param path the wild card path.
109 * @return the required object.
111 public static <T extends DataObject> Optional<T> read(
112 DataBroker broker, LogicalDatastoreType datastoreType, InstanceIdentifier<T> path) {
114 Optional<T> result = Optional.absent();
115 ReadOnlyTransaction tx = broker.newReadOnlyTransaction();
117 result = tx.read(datastoreType, path).checkedGet();
118 } catch (ReadFailedException e) {
119 LOG.warn("Failed to read InstanceIdentifier {} from {}", path, datastoreType, e);
127 * Retrieves the acl matching the key from the data store.
129 * @param broker the data broker
130 * @param aclKey the acl key
133 public static Acl getAcl(DataBroker broker, String aclKey) {
134 Optional<Acl> optAcl = read(broker,
135 LogicalDatastoreType.CONFIGURATION, getAclInstanceIdentifier(aclKey));
136 if (optAcl.isPresent()) {
142 /** Creates the Acl instance identifier.
144 * @param aclKey the acl key
145 * @return the instance identifier
147 public static InstanceIdentifier<Acl> getAclInstanceIdentifier(String aclKey) {
148 return InstanceIdentifier
149 .builder(AccessLists.class)
151 new AclKey(aclKey,Ipv4Acl.class))
156 * Get the data path number for the interface.
157 * @param interfaceManagerRpcService interfaceManagerRpcService instance.
158 * @param ifName the interface name.
161 public static BigInteger getDpnForInterface(OdlInterfaceRpcService interfaceManagerRpcService, String ifName) {
162 BigInteger nodeId = BigInteger.ZERO;
164 GetDpidFromInterfaceInput dpIdInput =
165 new GetDpidFromInterfaceInputBuilder().setIntfName(ifName).build();
166 Future<RpcResult<GetDpidFromInterfaceOutput>> dpIdOutput =
167 interfaceManagerRpcService.getDpidFromInterface(dpIdInput);
168 RpcResult<GetDpidFromInterfaceOutput> dpIdResult = dpIdOutput.get();
169 if (dpIdResult.isSuccessful()) {
170 nodeId = dpIdResult.getResult().getDpid();
172 LOG.error("Could not retrieve DPN Id for interface {}", ifName);
174 } catch (NullPointerException | InterruptedException | ExecutionException e) {
175 LOG.error("Exception when getting dpn for interface {}", ifName, e);
181 * Retrieves the interface state.
182 * @param dataBroker the data broker.
183 * @param interfaceName the interface name.
184 * @return the interface state.
186 public static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state
187 .Interface getInterfaceStateFromOperDS(DataBroker dataBroker, String interfaceName) {
188 InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508
189 .interfaces.state.Interface> ifStateId = buildStateInterfaceId(interfaceName);
190 Optional<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508
191 .interfaces.state.Interface> ifStateOptional = MDSALUtil.read(LogicalDatastoreType
192 .OPERATIONAL, ifStateId, dataBroker);
193 if (!ifStateOptional.isPresent()) {
197 return ifStateOptional.get();
201 * Build the interface state.
202 * @param interfaceName the interface name.
203 * @return the interface state.
205 public static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508
206 .interfaces.state.Interface> buildStateInterfaceId(String interfaceName) {
207 InstanceIdentifierBuilder<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508
208 .interfaces.state.Interface> idBuilder = InstanceIdentifier.builder(InterfacesState.class)
209 .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces
210 .state.Interface.class, new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces
211 .rev140508.interfaces.state.InterfaceKey(interfaceName));
212 return idBuilder.build();
216 * Checks whether port security is enabled for the port.
217 * @param port the port.
218 * @return the port security is enabled/not.
220 public static boolean isPortSecurityEnabled(AclInterface port) {
221 return port.isPortSecurityEnabled();
225 * Checks whether port security is enabled for the port.
226 * @param port the port.
227 * @return the list of security groups.
229 public static List<Uuid> getInterfaceAcls(Interface port) {
231 LOG.error("Port is Null");
234 InterfaceAcl aclInPort = port.getAugmentation(InterfaceAcl.class);
235 if (aclInPort == null) {
236 LOG.error("getSecurityGroupInPortList: no security group associated}",
240 return aclInPort.getSecurityGroups();
244 * Retrieves the security rule attribute augmentation from the access list.
245 * @param ace the access list entry
246 * @return the security rule attributes
248 public static SecurityRuleAttr getAccesssListAttributes(Ace ace) {
250 LOG.error("Ace is Null");
253 SecurityRuleAttr aceAttributes = ace.getAugmentation(SecurityRuleAttr.class);
254 if (aceAttributes == null) {
255 LOG.error("Ace is null");
258 return aceAttributes;
262 * Returns the DHCP match.
264 * @param srcPort the source port.
265 * @param dstPort the destination port.
266 * @param lportTag the lport tag
267 * @return list of matches.
269 public static List<MatchInfoBase> buildDhcpMatches(int srcPort, int dstPort, int lportTag) {
270 List<MatchInfoBase> matches = new ArrayList<>(6);
271 matches.add(new MatchInfo(MatchFieldType.eth_type,
272 new long[] { NwConstants.ETHTYPE_IPV4 }));
273 matches.add(new MatchInfo(MatchFieldType.ip_proto,
274 new long[] { IPProtocols.UDP.intValue() }));
275 matches.add(new MatchInfo(MatchFieldType.udp_dst,
276 new long[] { dstPort }));
277 matches.add(new MatchInfo(MatchFieldType.udp_src,
278 new long[] { srcPort}));
279 matches.add(AclServiceUtils.buildLPortTagMatch(lportTag));
284 * Builds the service id.
286 * @param interfaceName the interface name
287 * @param serviceIndex the service index
288 * @param serviceMode the service mode
289 * @return the instance identifier
291 public static InstanceIdentifier<BoundServices> buildServiceId(String interfaceName, short serviceIndex,
292 Class<? extends ServiceModeBase> serviceMode) {
293 return InstanceIdentifier.builder(ServiceBindings.class)
294 .child(ServicesInfo.class, new ServicesInfoKey(interfaceName, serviceMode))
295 .child(BoundServices.class, new BoundServicesKey(serviceIndex)).build();
299 * Gets the bound services.
301 * @param serviceName the service name
302 * @param servicePriority the service priority
303 * @param flowPriority the flow priority
304 * @param cookie the cookie
305 * @param instructions the instructions
306 * @return the bound services
308 public static BoundServices getBoundServices(String serviceName, short servicePriority, int flowPriority,
309 BigInteger cookie, List<Instruction> instructions) {
310 StypeOpenflowBuilder augBuilder = new StypeOpenflowBuilder().setFlowCookie(cookie).setFlowPriority(flowPriority)
311 .setInstruction(instructions);
312 return new BoundServicesBuilder().setKey(new BoundServicesKey(servicePriority)).setServiceName(serviceName)
313 .setServicePriority(servicePriority).setServiceType(ServiceTypeFlowBased.class)
314 .addAugmentation(StypeOpenflow.class, augBuilder.build()).build();
317 public static List<Uuid> getUpdatedAclList(List<Uuid> updatedAclList, List<Uuid> currentAclList) {
318 if (updatedAclList == null) {
321 List<Uuid> newAclList = new ArrayList<>(updatedAclList);
322 if (currentAclList == null) {
325 List<Uuid> origAclList = new ArrayList<>(currentAclList);
326 for (Iterator<Uuid> iterator = newAclList.iterator(); iterator.hasNext();) {
327 Uuid updatedAclUuid = iterator.next();
328 for (Uuid currentAclUuid :origAclList) {
329 if (updatedAclUuid.getValue().equals(currentAclUuid.getValue())) {
337 public static List<AllowedAddressPairs> getUpdatedAllowedAddressPairs(
338 List<AllowedAddressPairs> updatedAllowedAddressPairs,
339 List<AllowedAddressPairs> currentAllowedAddressPairs) {
340 if (updatedAllowedAddressPairs == null) {
343 List<AllowedAddressPairs> newAllowedAddressPairs = new ArrayList<>(updatedAllowedAddressPairs);
344 if (currentAllowedAddressPairs == null) {
345 return newAllowedAddressPairs;
347 List<AllowedAddressPairs> origAllowedAddressPairs = new ArrayList<>(currentAllowedAddressPairs);
348 for (Iterator<AllowedAddressPairs> iterator = newAllowedAddressPairs.iterator(); iterator.hasNext();) {
349 AllowedAddressPairs updatedAllowedAddressPair = iterator.next();
350 for (AllowedAddressPairs currentAllowedAddressPair : origAllowedAddressPairs) {
351 if (updatedAllowedAddressPair.getKey().equals(currentAllowedAddressPair.getKey())) {
357 return newAllowedAddressPairs;
360 public static List<AllowedAddressPairs> getPortAllowedAddresses(Interface port) {
362 LOG.error("Port is Null");
365 InterfaceAcl aclInPort = port.getAugmentation(InterfaceAcl.class);
366 if (aclInPort == null) {
367 LOG.error("getSecurityGroupInPortList: no security group associated to Interface port: {}", port.getName());
370 return aclInPort.getAllowedAddressPairs();
373 public static BigInteger getDpIdFromIterfaceState(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf
374 .interfaces.rev140508.interfaces.state.Interface interfaceState) {
375 BigInteger dpId = null;
376 List<String> ofportIds = interfaceState.getLowerLayerIf();
377 if (ofportIds != null && !ofportIds.isEmpty()) {
378 NodeConnectorId nodeConnectorId = new NodeConnectorId(ofportIds.get(0));
379 dpId = BigInteger.valueOf(MDSALUtil.getDpnIdFromPortName(nodeConnectorId));
385 * Builds the ip matches.
387 * @param ipPrefixOrAddress the ip prefix or address
388 * @param ipv4MatchType the ipv4 match type
391 public static List<MatchInfoBase> buildIpMatches(IpPrefixOrAddress ipPrefixOrAddress,
392 MatchFieldType ipv4MatchType) {
393 List<MatchInfoBase> flowMatches = new ArrayList<>();
394 flowMatches.add(new MatchInfo(MatchFieldType.eth_type, new long[] {NwConstants.ETHTYPE_IPV4}));
395 IpPrefix ipPrefix = ipPrefixOrAddress.getIpPrefix();
396 if (ipPrefix != null) {
397 if (ipPrefix.getIpv4Prefix().getValue() != null) {
398 String[] ipaddressValues = ipPrefix.getIpv4Prefix().getValue().split("/");
399 flowMatches.add(new MatchInfo(ipv4MatchType, new String[] {ipaddressValues[0], ipaddressValues[1]}));
404 IpAddress ipAddress = ipPrefixOrAddress.getIpAddress();
405 if (ipAddress.getIpv4Address() != null) {
407 .add(new MatchInfo(ipv4MatchType, new String[] {ipAddress.getIpv4Address().getValue(), "32"}));
416 * Gets the lport tag match.
418 * @param lportTag the lport tag
419 * @return the lport tag match
421 public static MatchInfo buildLPortTagMatch(int lportTag) {
422 return new MatchInfo(MatchFieldType.metadata,
423 new BigInteger[] {MetaDataUtil.getLportTagMetaData(lportTag), MetaDataUtil.METADATA_MASK_LPORT_TAG});
426 public static List<Ace> getAceWithRemoteAclId(DataBroker dataBroker, AclInterface port, Uuid remoteAcl) {
427 List<Ace> remoteAclRuleList = new ArrayList<>();
428 List<Uuid> aclList = port.getSecurityGroups();
429 for (Uuid aclId : aclList) {
430 Acl acl = getAcl(dataBroker, aclId.getValue());
431 List<Ace> aceList = acl.getAccessListEntries().getAce();
432 for (Ace ace : aceList) {
433 Uuid tempRemoteAcl = getAccesssListAttributes(ace).getRemoteGroupId();
434 if (tempRemoteAcl != null && tempRemoteAcl.equals(remoteAcl)) {
435 remoteAclRuleList.add(ace);
439 return remoteAclRuleList;
442 public static Map<String, List<MatchInfoBase>> getFlowForRemoteAcl(Uuid remoteAclId, String ignoreInterfaceId,
443 Map<String, List<MatchInfoBase>>
444 flowMatchesMap, boolean
445 isSourceIpMacMatch) {
446 List<AclInterface> interfaceList = AclDataUtil.getInterfaceList(remoteAclId);
447 if (flowMatchesMap == null || interfaceList == null || interfaceList.isEmpty()) {
450 Map<String, List<MatchInfoBase>> updatedFlowMatchesMap = new HashMap<>();
451 for (String flowName : flowMatchesMap.keySet()) {
452 List<MatchInfoBase> flows = flowMatchesMap.get(flowName);
453 for (AclInterface port : interfaceList) {
454 if (port.getInterfaceId().equals(ignoreInterfaceId)) {
457 //get allow address pair
458 List<AllowedAddressPairs> allowedAddressPair = port.getAllowedAddressPairs();
459 // iterate over allow address pair and update match type
460 for (AllowedAddressPairs aap : allowedAddressPair) {
461 List<MatchInfoBase> matchInfoBaseList = updateAAPMatches(isSourceIpMacMatch, flows, aap);
462 String flowId = flowName + "_remoteACL_interface_" + port.getInterfaceId() + "_aap_" + aap.getKey();
463 updatedFlowMatchesMap.put(flowId, matchInfoBaseList);
469 return updatedFlowMatchesMap;
472 public static Map<String, List<MatchInfoBase>> getFlowForAllowedAddresses(List<AllowedAddressPairs>
473 syncAllowedAddresses,
474 Map<String, List<MatchInfoBase>>
475 flowMatchesMap, boolean
476 isSourceIpMacMatch) {
477 if (flowMatchesMap == null) {
480 Map<String, List<MatchInfoBase>> updatedFlowMatchesMap = new HashMap<>();
481 for (String flowName : flowMatchesMap.keySet()) {
482 List<MatchInfoBase> flows = flowMatchesMap.get(flowName);
483 // iterate over allow address pair and update match type
484 for (AllowedAddressPairs aap : syncAllowedAddresses) {
485 List<MatchInfoBase> matchInfoBaseList = updateAAPMatches(isSourceIpMacMatch, flows, aap);
486 String flowId = flowName + "_remoteACL_interface_aap_" + aap.getKey();
487 updatedFlowMatchesMap.put(flowId, matchInfoBaseList);
491 return updatedFlowMatchesMap;
494 private static List<MatchInfoBase> updateAAPMatches(boolean isSourceIpMacMatch, List<MatchInfoBase> flows,
495 AllowedAddressPairs aap) {
496 List<MatchInfoBase> matchInfoBaseList;
497 if (isSourceIpMacMatch) {
498 flows.remove(MatchFieldType.ipv4_source);
499 matchInfoBaseList = AclServiceUtils.buildIpMatches(aap.getIpAddress(), MatchFieldType.ipv4_source);
501 flows.remove(MatchFieldType.ipv4_destination);
502 matchInfoBaseList = AclServiceUtils.buildIpMatches(aap.getIpAddress(), MatchFieldType.ipv4_destination);
504 matchInfoBaseList.addAll(flows);
505 return matchInfoBaseList;
508 public static MatchInfoBase popMatchInfoByType(List<MatchInfoBase> flows, MatchFieldType type) {
509 MatchInfoBase mib = getMatchInfoByType(flows, type);
516 public static MatchInfoBase getMatchInfoByType(List<MatchInfoBase> flows, MatchFieldType type) {
517 for (MatchInfoBase mib : flows) {
518 if (mib instanceof MatchInfo) {
519 if (((MatchInfo)mib).getMatchField() == type) {
527 public static MatchInfoBase getMatchInfoByType(List<MatchInfoBase> flows, NxMatchFieldType type) {
528 for (MatchInfoBase mib : flows) {
529 if (mib instanceof NxMatchInfo) {
530 if (((NxMatchInfo)mib).getMatchField() == type) {
538 public static boolean containsMatchFieldType(List<MatchInfoBase> flows, MatchFieldType type) {
539 MatchInfoBase mib = getMatchInfoByType(flows, type);
546 public static boolean containsMatchFieldType(List<MatchInfoBase> flows, NxMatchFieldType type) {
547 MatchInfoBase mib = getMatchInfoByType(flows, type);