public static MatchHeaderSpace matchSrc(Ip ip) { return matchSrc(ip.toIpSpace()); }
AclLineMatchExpr matchExpr = matchSrc(realSource.toIpSpace());
public static MatchHeaderSpace matchSrc(Prefix prefix) { return matchSrc(prefix.toIpSpace()); }
public static MatchHeaderSpace matchSrcPrefix(String prefix) { return matchSrc(Prefix.parse(prefix).toIpSpace()); }
public static MatchHeaderSpace matchSrcIp(String ip) { return matchSrc(Ip.parse(ip).toIpSpace()); }
@Override public Optional<Transformation.Builder> toIncomingTransformation(Map<String, NatPool> natPools) { /* * No named ACL in rule, but need to match src/dest to global/local according * to direction and rule type */ AclLineMatchExpr matchExpr; TransformationStep step; switch (getAction()) { case SOURCE_INSIDE: matchExpr = AclLineMatchExprs.matchDst(_globalNetwork); step = TransformationStep.shiftDestinationIp(_localNetwork); break; case SOURCE_OUTSIDE: matchExpr = AclLineMatchExprs.matchSrc(_globalNetwork); step = TransformationStep.shiftSourceIp(_localNetwork); break; default: return Optional.empty(); } return Optional.of(Transformation.when(matchExpr).apply(step)); } }
@Override public Optional<Transformation.Builder> toOutgoingTransformation( Map<String, IpAccessList> ipAccessLists, Map<String, NatPool> natPools, @Nullable Set<String> insideInterfaces, Configuration c) { /* * No named ACL in rule, but need to match src/dest to global/local according * to direction and rule type */ AclLineMatchExpr matchExpr; TransformationStep step; switch (getAction()) { case SOURCE_INSIDE: matchExpr = AclLineMatchExprs.matchSrc(_localNetwork); step = TransformationStep.shiftSourceIp(_globalNetwork); break; case SOURCE_OUTSIDE: matchExpr = AclLineMatchExprs.matchDst(_localNetwork); step = TransformationStep.shiftDestinationIp(_globalNetwork); break; default: return Optional.empty(); } if (insideInterfaces != null) { matchExpr = AclLineMatchExprs.and(matchExpr, new MatchSrcInterface(insideInterfaces)); } return Optional.of(Transformation.when(matchExpr).apply(step)); }
.setLines( ImmutableList.of( IpAccessListLine.rejecting(AclLineMatchExprs.matchSrc(natPoolIp)))) .build());