@Override public AclLineMatchExpr visitOriginatingFromDevice(OriginatingFromDevice originatingFromDevice) { return new NotMatchExpr(originatingFromDevice); }
@Override public AclLineMatchExpr visitMatchSrcInterface(MatchSrcInterface matchSrcInterface) { return new NotMatchExpr(matchSrcInterface); }
@Override public AclLineMatchExpr visitPermittedByAcl(PermittedByAcl permittedByAcl) { return new NotMatchExpr(permittedByAcl); }
@Override public AclLineMatchExpr visitMatchHeaderSpace(MatchHeaderSpace matchHeaderSpace) { return new NotMatchExpr(matchHeaderSpace); }
/** * Smart constructor for {@link NotMatchExpr} that does constant-time simplifications (i.e. when * expr is {@link #TRUE} or {@link #FALSE}). */ public static AclLineMatchExpr not(AclLineMatchExpr expr) { if (expr == TRUE) { return FALSE; } if (expr == FALSE) { return TRUE; } if (expr instanceof NotMatchExpr) { return ((NotMatchExpr) expr).getOperand(); } return new NotMatchExpr(expr); }
@Override public AclLineMatchExpr visitNotMatchExpr(NotMatchExpr notMatchExpr) throws CircularReferenceException, UndefinedReferenceException { return new NotMatchExpr(visit(notMatchExpr.getOperand())); }
@Override public AclLineMatchExpr visitNotMatchExpr(NotMatchExpr notMatchExpr) { return new NotMatchExpr(notMatchExpr.getOperand().accept(this)); }
@Override public final AclLineMatchExpr visitNotMatchExpr(NotMatchExpr notMatchExpr) { AclLineMatchExpr subExpr = notMatchExpr.getOperand().accept(this); if (subExpr == TrueExpr.INSTANCE) { return FalseExpr.INSTANCE; } else if (subExpr == FalseExpr.INSTANCE) { return TrueExpr.INSTANCE; } else { return new NotMatchExpr(subExpr); } }
@Override public AclLineMatchExpr visitNotMatchExpr(NotMatchExpr notMatchExpr) { return new NotMatchExpr(notMatchExpr.getOperand().accept(this)); }
notHeaderSpace -> { MatchHeaderSpace matchHeaderSpace = new MatchHeaderSpace(notHeaderSpace); NotMatchExpr notMatchExpr = new NotMatchExpr(matchHeaderSpace); conjunctsBuilder.add(notMatchExpr); conjunctsProvenance.put(
@Test public void testSingleExpr() { // Test that the NotMatchExpr returns the opposite of the underlying ACL line NotMatchExpr exprNotTrue = new NotMatchExpr(TrueExpr.INSTANCE); NotMatchExpr exprNotFalse = new NotMatchExpr(FalseExpr.INSTANCE); // Confirm boolean expr NOT true = false assertThat(exprNotTrue, not(matches(createFlow(), ""))); // Confirm boolean expr NOT false = true assertThat(exprNotFalse, matches(createFlow(), "")); } }
new IpAccessListLine( LineAction.DENY, new NotMatchExpr(new PermittedByAcl(e.getKey(), true)), e.getKey() + "DENY")); new IpAccessListLine( LineAction.DENY, new NotMatchExpr(new PermittedByAcl(ACL_NAME_GLOBAL_POLICY, true)), "GLOBAL_POLICY_REJECT"));
ImmutableList.of( IpAccessListLine.accepting() .setMatchCondition(new NotMatchExpr(new PermittedByAcl("acl0"))) .build())) .setName("acl3")
ImmutableList.of( IpAccessListLine.accepting() .setMatchCondition(new NotMatchExpr(ipSpaceReference)) .build())) .setName("acl3") new AndMatchExpr(ImmutableList.of(dereferencedIpSpace)), new OrMatchExpr(ImmutableList.of(dereferencedIpSpace)), new NotMatchExpr(dereferencedIpSpace))));
IpAccessListLine.accepting() .setMatchCondition( new NotMatchExpr(new MatchSrcInterface(ImmutableList.of("iface3")))) .build())) .build();