Skip to content

Commit

Permalink
InterfaceProperties: return incoming filter name (#3413)
Browse files Browse the repository at this point in the history
Return the name of the ACL/filter and not the contents
  • Loading branch information
progwriter committed Mar 18, 2019
1 parent efb05f4 commit f9a81d5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ public class InterfacePropertySpecifier extends PropertySpecifier {
HSRP_GROUPS,
new PropertyDescriptor<>(Interface::getHsrpGroups, Schema.set(Schema.STRING)))
.put(HSRP_VERSION, new PropertyDescriptor<>(Interface::getHsrpVersion, Schema.STRING))
// skip incoming filter
// use incomingFilterName instead of incomingFilter
.put(
INCOMING_FILTER_NAME,
new PropertyDescriptor<>(Interface::getIncomingFilter, Schema.STRING))
new PropertyDescriptor<>(Interface::getIncomingFilterName, Schema.STRING))
.put(INTERFACE_TYPE, new PropertyDescriptor<>(Interface::getInterfaceType, Schema.STRING))
.put(MLAG_ID, new PropertyDescriptor<>(Interface::getMlagId, Schema.INTEGER))
.put(MTU, new PropertyDescriptor<>(Interface::getMtu, Schema.INTEGER))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.batfish.datamodel.questions;

import static org.batfish.datamodel.questions.InterfacePropertySpecifier.INCOMING_FILTER_NAME;
import static org.hamcrest.Matchers.emptyIterable;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasSize;
Expand All @@ -9,6 +10,9 @@
import com.google.common.collect.ImmutableList;
import java.util.Collection;
import java.util.Iterator;
import org.batfish.datamodel.Interface;
import org.batfish.datamodel.IpAccessList;
import org.batfish.datamodel.IpAccessListLine;
import org.junit.Test;

public class InterfacePropertySpecifierTest {
Expand Down Expand Up @@ -48,4 +52,18 @@ public void testMatchingPropertiesSet() {
// should not match shorter
assertThat(new InterfacePropertySpecifier(shorter).getMatchingProperties(), emptyIterable());
}

@Test
public void testIncomingFilterReturnsName() {
IpAccessList acl =
IpAccessList.builder()
.setName("MY_ACL")
.setLines(ImmutableList.of(IpAccessListLine.ACCEPT_ALL))
.build();
Interface i1 = Interface.builder().setName("i1").setIncomingFilter(acl).build();
i1.setInboundFilterName(acl.getName());
assertThat(
InterfacePropertySpecifier.JAVA_MAP.get(INCOMING_FILTER_NAME).getGetter().apply(i1),
equalTo(acl.getName()));
}
}

0 comments on commit f9a81d5

Please sign in to comment.