use of org.opendaylight.genius.mdsalutil.matches.MatchMetadata in project netvirt by opendaylight.
the class ElanInterfaceManager method getMatchesForElanTag.
private List<MatchInfo> getMatchesForElanTag(long elanTag, boolean isSHFlagSet) {
List<MatchInfo> mkMatches = new ArrayList<>();
// Matching metadata
mkMatches.add(new MatchMetadata(ElanUtils.getElanMetadataLabel(elanTag, isSHFlagSet), MetaDataUtil.METADATA_MASK_SERVICE_SH_FLAG));
return mkMatches;
}
use of org.opendaylight.genius.mdsalutil.matches.MatchMetadata in project netvirt by opendaylight.
the class AclServiceUtils method buildMatchesForLPortTagAndRemoteAclTag.
public static List<MatchInfoBase> buildMatchesForLPortTagAndRemoteAclTag(Integer lportTag, Integer remoteAclTag, Class<? extends ServiceModeBase> serviceMode) {
List<MatchInfoBase> matches = new ArrayList<>();
if (serviceMode != null && serviceMode.isAssignableFrom(ServiceModeEgress.class)) {
matches.add(AclServiceUtils.buildLPortTagMatch(lportTag, serviceMode));
matches.add(AclServiceUtils.buildRemoteAclTagMetadataMatch(remoteAclTag));
} else {
// In case of ingress service mode, only metadata is used for
// matching both lportTag and aclTag. Hence performing "or"
// operation on both lportTag and aclTag metadata.
BigInteger metaData = MetaDataUtil.getLportTagMetaData(lportTag).or(getRemoteAclTagMetadata(BigInteger.valueOf(remoteAclTag)));
BigInteger metaDataMask = MetaDataUtil.METADATA_MASK_LPORT_TAG.or(MetaDataUtil.METADATA_MASK_REMOTE_ACL_TAG);
matches.add(new MatchMetadata(metaData, metaDataMask));
}
return matches;
}
use of org.opendaylight.genius.mdsalutil.matches.MatchMetadata in project netvirt by opendaylight.
the class ExternalRoutersListener method buildOutboundFlowEntity.
protected FlowEntity buildOutboundFlowEntity(BigInteger dpId, long routerId) {
LOG.debug("buildOutboundFlowEntity : called for dpId {} and routerId{}", dpId, routerId);
List<MatchInfo> matches = new ArrayList<>();
matches.add(MatchEthernetType.IPV4);
matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(routerId), MetaDataUtil.METADATA_MASK_VRFID));
List<InstructionInfo> instructions = new ArrayList<>();
List<ActionInfo> actionsInfos = new ArrayList<>();
actionsInfos.add(new ActionPuntToController());
instructions.add(new InstructionApplyActions(actionsInfos));
instructions.add(new InstructionWriteMetadata(MetaDataUtil.getVpnIdMetadata(routerId), MetaDataUtil.METADATA_MASK_VRFID));
String flowRef = getFlowRefOutbound(dpId, NwConstants.OUTBOUND_NAPT_TABLE, routerId);
BigInteger cookie = getCookieOutboundFlow(routerId);
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.OUTBOUND_NAPT_TABLE, flowRef, 5, flowRef, 0, 0, cookie, matches, instructions);
LOG.debug("installOutboundMissEntry : returning flowEntity {}", flowEntity);
return flowEntity;
}
use of org.opendaylight.genius.mdsalutil.matches.MatchMetadata in project netvirt by opendaylight.
the class ExternalRoutersListener method buildSnatFlowEntityForPrmrySwtch.
private FlowEntity buildSnatFlowEntityForPrmrySwtch(BigInteger dpId, String routerName, long routerId) {
LOG.debug("buildSnatFlowEntityForPrmrySwtch : called for primary NAPT switch dpId {}, routerName {}", dpId, routerName);
List<MatchInfo> matches = new ArrayList<>();
matches.add(MatchEthernetType.IPV4);
matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(routerId), MetaDataUtil.METADATA_MASK_VRFID));
List<InstructionInfo> instructions = new ArrayList<>();
instructions.add(new InstructionGotoTable(NwConstants.OUTBOUND_NAPT_TABLE));
String flowRef = getFlowRefSnat(dpId, NwConstants.PSNAT_TABLE, routerName);
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.PSNAT_TABLE, flowRef, NatConstants.DEFAULT_PSNAT_FLOW_PRIORITY, flowRef, 0, 0, NwConstants.COOKIE_SNAT_TABLE, matches, instructions);
LOG.debug("buildSnatFlowEntityForPrmrySwtch : Returning SNAT Flow Entity {}", flowEntity);
return flowEntity;
}
use of org.opendaylight.genius.mdsalutil.matches.MatchMetadata in project netvirt by opendaylight.
the class ExternalRoutersListener method buildSnatFlowEntityWithUpdatedVpnIdForPrimrySwtch.
public FlowEntity buildSnatFlowEntityWithUpdatedVpnIdForPrimrySwtch(BigInteger dpId, String routerName, long changedVpnId) {
LOG.debug("buildSnatFlowEntityWithUpdatedVpnIdForPrimrySwtch : called for dpId {}, routerName {} " + "changed VPN ID {}", dpId, routerName, changedVpnId);
List<MatchInfo> matches = new ArrayList<>();
matches.add(MatchEthernetType.IPV4);
matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(changedVpnId), MetaDataUtil.METADATA_MASK_VRFID));
List<InstructionInfo> instructions = new ArrayList<>();
instructions.add(new InstructionGotoTable(NwConstants.OUTBOUND_NAPT_TABLE));
String flowRef = getFlowRefSnat(dpId, NwConstants.PSNAT_TABLE, routerName);
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.PSNAT_TABLE, flowRef, NatConstants.DEFAULT_PSNAT_FLOW_PRIORITY, flowRef, 0, 0, NwConstants.COOKIE_SNAT_TABLE, matches, instructions);
LOG.debug("buildSnatFlowEntityWithUpdatedVpnIdForPrimrySwtch : Returning SNAT Flow Entity {}", flowEntity);
return flowEntity;
}
Aggregations