Skip to content

Commit

Permalink
Cisco IOS enable autostate for extended VLANs (#8596)
Browse files Browse the repository at this point in the history
Co-Authored-By: Nobutaka Niiya <nobutaka.niiya@ista-ltd.co.jp>
Co-Authored-By: Nobutaka Niiya <nniiya@cisco.com>
  • Loading branch information
3 people committed Nov 22, 2022
1 parent adb8a5d commit ae2f3a8
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,10 @@ public final class CiscoConfiguration extends VendorConfiguration {
/** Name of the generated static route resolution policy, implementing IOS resolution filtering */
public static final String RESOLUTION_POLICY_NAME = "~RESOLUTION_POLICY~";

private static final int VLAN_NORMAL_MAX_CISCO = 1005;
/** Maximum VLAN number for which autostate is applied by default on IOS */
private static final int VLAN_NORMAL_MAX_CISCO = 4096;

/** Minimum VLAN number for which autostate is applied by default on IOS */
private static final int VLAN_NORMAL_MIN_CISCO = 2;

public static String computeBgpDefaultRouteExportPolicyName(String vrf, String peer) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7003,4 +7003,26 @@ public void testBgpPeerSessionInheritance() throws IOException {
hasReferencedStructure(
filename, BGP_TEMPLATE_PEER_SESSION, "INDIRECT-PARENT", BGP_INHERITED_SESSION));
}

@Test
public void testDownSwitchVirtualInterface() throws IOException {
String hostname = "ios_svi";

CiscoConfiguration vc = parseCiscoConfig(hostname, ConfigurationFormat.CISCO_IOS);
vc.toVendorIndependentConfigurations();

assertThat(vc.getInterfaces().get("GigabitEthernet0/0").getActive(), equalTo(false));
assertThat(vc.getInterfaces().get("GigabitEthernet0/1").getActive(), equalTo(false));
assertThat(vc.getInterfaces().get("Vlan100").getActive(), equalTo(true));
assertThat(vc.getInterfaces().get("Vlan3000").getActive(), equalTo(true));

// Task17 Test
Batfish batfish = getBatfishForConfigurationNames(hostname);
Configuration c = batfish.loadConfigurations(batfish.getSnapshot()).get(hostname);

assertThat(c.getAllInterfaces().get("GigabitEthernet0/0").getActive(), equalTo(false));
assertThat(c.getAllInterfaces().get("GigabitEthernet0/1").getActive(), equalTo(false));
assertThat(c.getAllInterfaces().get("Vlan100").getActive(), equalTo(false));
assertThat(c.getAllInterfaces().get("Vlan3000").getActive(), equalTo(false));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
!
hostname ios_svi
!
vlan 100,3000
!
interface Vlan100
ip address 192.168.100.254 255.255.255.0
no shutdown
!
interface Vlan3000
ip address 192.168.200.254 255.255.255.0
no shutdown
!
interface GigabitEthernet0/0
switchport mode access
switchport access vlan 100
shutdown
!
interface GigabitEthernet0/1
switchport mode access
switchport access vlan 3000
shutdown
!

9 changes: 6 additions & 3 deletions tests/parsing-tests/unit-tests-vimodel.ref
Original file line number Diff line number Diff line change
Expand Up @@ -47093,7 +47093,7 @@
},
"Vlan1006" : {
"name" : "Vlan1006",
"active" : true,
"active" : false,
"additionalArpIps" : {
"class" : "org.batfish.datamodel.EmptyIpSpace"
},
Expand All @@ -47105,6 +47105,7 @@
"vlan1006"
],
"hmm" : false,
"inactiveReason" : "AUTOSTATE_FAILURE",
"lineUp" : true,
"mtu" : 1500,
"proxyArp" : true,
Expand All @@ -47120,7 +47121,7 @@
},
"Vlan1234" : {
"name" : "Vlan1234",
"active" : true,
"active" : false,
"additionalArpIps" : {
"class" : "org.batfish.datamodel.EmptyIpSpace"
},
Expand All @@ -47132,6 +47133,7 @@
"vlan1234"
],
"hmm" : false,
"inactiveReason" : "AUTOSTATE_FAILURE",
"lineUp" : true,
"mtu" : 1500,
"proxyArp" : true,
Expand All @@ -47147,7 +47149,7 @@
},
"Vlan4094" : {
"name" : "Vlan4094",
"active" : true,
"active" : false,
"additionalArpIps" : {
"class" : "org.batfish.datamodel.EmptyIpSpace"
},
Expand All @@ -47159,6 +47161,7 @@
"vlan4094"
],
"hmm" : false,
"inactiveReason" : "AUTOSTATE_FAILURE",
"lineUp" : true,
"mtu" : 1500,
"proxyArp" : true,
Expand Down

0 comments on commit ae2f3a8

Please sign in to comment.