Skip to content

Commit

Permalink
add test lost in the merge
Browse files Browse the repository at this point in the history
  • Loading branch information
dhalperi committed Feb 19, 2021
1 parent c5d09bb commit c5db23f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4861,6 +4861,7 @@ public void exitPopsf_interface(Popsf_interfaceContext ctx) {

@Override
public void exitPopsf_local_preference(Popsf_local_preferenceContext ctx) {
todo(ctx.getParent());
_currentPsTerm
.getFroms()
.setFromLocalPreference(new PsFromLocalPreference(toLong(ctx.localpref)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@
import org.batfish.representation.juniper.NoPortTranslation;
import org.batfish.representation.juniper.PatPool;
import org.batfish.representation.juniper.PolicyStatement;
import org.batfish.representation.juniper.PsFromLocalPreference;
import org.batfish.representation.juniper.PsThenLocalPreference;
import org.batfish.representation.juniper.PsThenLocalPreference.Operator;
import org.batfish.representation.juniper.RoutingInstance;
Expand Down Expand Up @@ -3534,6 +3535,22 @@ public void testJuniperPolicyStatementPrefixListDisjunction() {
assertThat(result.getBooleanValue(), equalTo(false));
}

@Test
public void testJuniperPolicyStatementTermFromExtraction() {
JuniperConfiguration c = parseJuniperConfig("juniper-policy-statement-from");
{
PolicyStatement policy =
c.getMasterLogicalSystem().getPolicyStatements().get("LOCAL_PREFERENCE_POLICY");
assertThat(policy.getTerms(), hasKeys("TMIN", "TMAX"));
assertThat(
policy.getTerms().get("TMIN").getFroms().getFromLocalPreference(),
equalTo(new PsFromLocalPreference(0)));
assertThat(
policy.getTerms().get("TMAX").getFroms().getFromLocalPreference(),
equalTo(new PsFromLocalPreference(MAX_LOCAL_PREFERENCE)));
}
}

@Test
public void testJuniperPolicyStatementTermThenExtraction() {
JuniperConfiguration c = parseJuniperConfig("juniper-policy-statement-then");
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#
set system host-name juniper-policy-statement-from
#
set policy-options policy-statement LOCAL_PREFERENCE_POLICY term TMIN from local-preference 0
set policy-options policy-statement LOCAL_PREFERENCE_POLICY term TMAX from local-preference 4294967295
#

0 comments on commit c5db23f

Please sign in to comment.