@Test public void testExecuteNonBgpRoute() { SetOrigin so = new SetOrigin(new LiteralOrigin(OriginType.INCOMPLETE, 1L)); NetworkFactory nf = new NetworkFactory(); Configuration c = nf.configurationBuilder() .setConfigurationFormat(ConfigurationFormat.CISCO_NX) .setHostname("c") .build(); assertThat(so.execute(Environment.builder(c).build()), notNullValue()); }
@Override @Nonnull public Result execute(Environment environment) { if (!(environment.getOutputRoute() instanceof BgpRoute.Builder<?, ?>)) { return new Result(); } BgpRoute.Builder<?, ?> bgpRoute = (BgpRoute.Builder<?, ?>) environment.getOutputRoute(); OriginType originType = _origin.evaluate(environment); bgpRoute.setOriginType(originType); if (environment.getWriteToIntermediateBgpAttributes()) { environment.getIntermediateBgpAttributes().setOriginType(originType); } return new Result(); }
SetOrigin extends Statement { @Override @Nonnull public Result execute(Environment environment) { if (!(environment.getOutputRoute() instanceof BgpRoute.Builder<?, ?>)) { return new Result(); } BgpRoute.Builder<?, ?> bgpRoute = (BgpRoute.Builder<?, ?>) environment.getOutputRoute(); OriginType originType = _origin.evaluate(environment); bgpRoute.setOriginType(originType); if (environment.getWriteToIntermediateBgpAttributes()) { environment.getIntermediateBgpAttributes().setOriginType(originType); } return new Result(); } }
SetOrigin extends Statement { @Override @Nonnull public Result execute(Environment environment) { if (!(environment.getOutputRoute() instanceof BgpRoute.Builder<?, ?>)) { return new Result(); } BgpRoute.Builder<?, ?> bgpRoute = (BgpRoute.Builder<?, ?>) environment.getOutputRoute(); OriginType originType = _origin.evaluate(environment); bgpRoute.setOriginType(originType); if (environment.getWriteToIntermediateBgpAttributes()) { environment.getIntermediateBgpAttributes().setOriginType(originType); } return new Result(); } SetOrigin(OriginExpr origin); }
SetOrigin extends Statement { @Override @Nonnull public Result execute(Environment environment) { if (!(environment.getOutputRoute() instanceof BgpRoute.Builder<?, ?>)) { return new Result(); } BgpRoute.Builder<?, ?> bgpRoute = (BgpRoute.Builder<?, ?>) environment.getOutputRoute(); OriginType originType = _origin.evaluate(environment); bgpRoute.setOriginType(originType); if (environment.getWriteToIntermediateBgpAttributes()) { environment.getIntermediateBgpAttributes().setOriginType(originType); } return new Result(); } SetOrigin(OriginExpr origin); @Override T accept(StatementVisitor<T, U> visitor, U arg); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Override @Nonnull Result execute(Environment environment); @JsonProperty(PROP_ORIGIN_TYPE) OriginExpr getOriginType(); }
SetOrigin extends Statement { @Override @Nonnull public Result execute(Environment environment) { if (!(environment.getOutputRoute() instanceof BgpRoute.Builder<?, ?>)) { return new Result(); } BgpRoute.Builder<?, ?> bgpRoute = (BgpRoute.Builder<?, ?>) environment.getOutputRoute(); OriginType originType = _origin.evaluate(environment); bgpRoute.setOriginType(originType); if (environment.getWriteToIntermediateBgpAttributes()) { environment.getIntermediateBgpAttributes().setOriginType(originType); } return new Result(); } SetOrigin(OriginExpr origin); @Override T accept(StatementVisitor<T, U> visitor, U arg); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Override @Nonnull Result execute(Environment environment); @JsonProperty(PROP_ORIGIN_TYPE) OriginExpr getOriginType();  }