Skip to content

Commit

Permalink
Arista: remove non-eos ip route (#6085)
Browse files Browse the repository at this point in the history
  • Loading branch information
dhalperi committed Aug 11, 2020
1 parent 4231c78 commit 8dea0bd
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 59 deletions.
Expand Up @@ -1031,15 +1031,9 @@ ip_probe_null
) null_rest_of_line
;

ip_route_stanza
s_ip_route
:
(
IP
| MANAGEMENT
) ROUTE
(
VRF vrf = variable
)? ip_route_tail
ROUTE (VRF vrf = variable)? ip_route_tail
;

ip_route_tail
Expand Down Expand Up @@ -2440,6 +2434,7 @@ s_ip
| s_ip_name_server
| s_ip_nbar
| s_ip_probe
| s_ip_route
| s_ip_routing
| s_ip_tacacs_source_interface
| s_ip_virtual_router
Expand Down Expand Up @@ -3429,7 +3424,6 @@ stanza
| ip_community_list_expanded_stanza
| ip_community_list_standard_stanza
| ip_prefix_list_stanza
| ip_route_stanza
| ipv6_prefix_list_stanza
| ipx_sap_access_list_stanza
| multicast_routing_stanza
Expand Down Expand Up @@ -4374,11 +4368,6 @@ vrfc_address_family
)*
;

vrfc_ip_route
:
IP ROUTE ip_route_tail
;

vrfc_rd
:
RD (AUTO | route_distinguisher) NEWLINE
Expand Down
Expand Up @@ -227,7 +227,6 @@
import org.batfish.datamodel.AaaAuthenticationLoginList;
import org.batfish.datamodel.AuthenticationMethod;
import org.batfish.datamodel.ConcreteInterfaceAddress;
import org.batfish.datamodel.Configuration;
import org.batfish.datamodel.ConfigurationFormat;
import org.batfish.datamodel.DiffieHellmanGroup;
import org.batfish.datamodel.DscpType;
Expand Down Expand Up @@ -699,7 +698,6 @@
import org.batfish.grammar.arista.AristaParser.Ip_prefixContext;
import org.batfish.grammar.arista.AristaParser.Ip_prefix_list_stanzaContext;
import org.batfish.grammar.arista.AristaParser.Ip_prefix_list_tailContext;
import org.batfish.grammar.arista.AristaParser.Ip_route_stanzaContext;
import org.batfish.grammar.arista.AristaParser.Ip_route_tailContext;
import org.batfish.grammar.arista.AristaParser.Ip_ssh_versionContext;
import org.batfish.grammar.arista.AristaParser.Ipsec_authenticationContext;
Expand Down Expand Up @@ -827,6 +825,7 @@
import org.batfish.grammar.arista.AristaParser.S_ip_domain_nameContext;
import org.batfish.grammar.arista.AristaParser.S_ip_name_serverContext;
import org.batfish.grammar.arista.AristaParser.S_ip_pimContext;
import org.batfish.grammar.arista.AristaParser.S_ip_routeContext;
import org.batfish.grammar.arista.AristaParser.S_ip_source_routeContext;
import org.batfish.grammar.arista.AristaParser.S_ip_sshContext;
import org.batfish.grammar.arista.AristaParser.S_ip_tacacs_source_interfaceContext;
Expand Down Expand Up @@ -1374,7 +1373,7 @@ private Vrf currentVrf() {
public void enterArista_configuration(Arista_configurationContext ctx) {
_configuration = new AristaConfiguration();
_configuration.setVendor(_format);
_currentVrf = Configuration.DEFAULT_VRF_NAME;
_currentVrf = AristaConfiguration.DEFAULT_VRF_NAME;
}

@Override
Expand Down Expand Up @@ -3637,16 +3636,6 @@ public void enterIp_prefix_list_stanza(Ip_prefix_list_stanzaContext ctx) {
_configuration.defineStructure(PREFIX_LIST, name, ctx);
}

@Override
public void enterIp_route_stanza(Ip_route_stanzaContext ctx) {
if (ctx.vrf != null) {
_currentVrf = ctx.vrf.getText();
}
if (ctx.MANAGEMENT() != null) {
_currentVrf = AristaConfiguration.MANAGEMENT_VRF_NAME;
}
}

@Override
public void enterIpv6_prefix_list_stanza(Ipv6_prefix_list_stanzaContext ctx) {
String name = ctx.name.getText();
Expand Down Expand Up @@ -3897,6 +3886,18 @@ public void enterS_ip_pim(S_ip_pimContext ctx) {
_no = ctx.NO() != null;
}

@Override
public void enterS_ip_route(S_ip_routeContext ctx) {
if (ctx.vrf != null) {
_currentVrf = ctx.vrf.getText();
}
}

@Override
public void exitS_ip_route(S_ip_routeContext ctx) {
_currentVrf = AristaConfiguration.DEFAULT_VRF_NAME;
}

@Override
public void enterS_ip_ssh(S_ip_sshContext ctx) {
if (_configuration.getCf().getSsh() == null) {
Expand Down Expand Up @@ -4151,7 +4152,7 @@ public void enterS_router_rip(S_router_ripContext ctx) {
public void enterS_snmp_server(S_snmp_serverContext ctx) {
if (_configuration.getSnmpServer() == null) {
SnmpServer snmpServer = new SnmpServer();
snmpServer.setVrf(Configuration.DEFAULT_VRF_NAME);
snmpServer.setVrf(AristaConfiguration.DEFAULT_VRF_NAME);
_configuration.setSnmpServer(snmpServer);
}
}
Expand Down Expand Up @@ -5931,13 +5932,6 @@ public void exitIp_prefix_list_tail(Ip_prefix_list_tailContext ctx) {
_currentPrefixList.addLine(line);
}

@Override
public void exitIp_route_stanza(Ip_route_stanzaContext ctx) {
if (ctx.vrf != null || ctx.MANAGEMENT() != null) {
_currentVrf = Configuration.DEFAULT_VRF_NAME;
}
}

@Override
public void exitIp_route_tail(Ip_route_tailContext ctx) {
Prefix prefix;
Expand Down Expand Up @@ -7049,7 +7043,7 @@ public void exitRo_router_id(Ro_router_idContext ctx) {

@Override
public void exitRo_vrf(Ro_vrfContext ctx) {
_currentVrf = Configuration.DEFAULT_VRF_NAME;
_currentVrf = AristaConfiguration.DEFAULT_VRF_NAME;
_currentOspfProcess = currentVrf().getOspfProcesses().get(_lastKnownOspfProcess);
_lastKnownOspfProcess = null;
}
Expand Down Expand Up @@ -7226,7 +7220,7 @@ public void exitRs_route(Rs_routeContext ctx) {

@Override
public void exitRs_vrf(Rs_vrfContext ctx) {
_currentVrf = Configuration.DEFAULT_VRF_NAME;
_currentVrf = AristaConfiguration.DEFAULT_VRF_NAME;
}

@Override
Expand Down Expand Up @@ -7331,7 +7325,7 @@ public void exitS_no_access_list_standard(S_no_access_list_standardContext ctx)
public void exitS_router_ospf(S_router_ospfContext ctx) {
_currentOspfProcess.computeNetworks(_configuration.getInterfaces().values());
_currentOspfProcess = null;
_currentVrf = Configuration.DEFAULT_VRF_NAME;
_currentVrf = AristaConfiguration.DEFAULT_VRF_NAME;
}

@Override
Expand Down Expand Up @@ -7405,7 +7399,7 @@ public void exitS_vlan_eos(S_vlan_eosContext ctx) {

@Override
public void exitS_vrf_definition(S_vrf_definitionContext ctx) {
_currentVrf = Configuration.DEFAULT_VRF_NAME;
_currentVrf = AristaConfiguration.DEFAULT_VRF_NAME;
}

@Override
Expand Down Expand Up @@ -7928,7 +7922,7 @@ private void initInterface(Interface iface, Interface_nameContext ctx) {
String vrf =
canonicalNamePrefix.equals(AristaConfiguration.MANAGEMENT_INTERFACE_PREFIX)
? AristaConfiguration.MANAGEMENT_VRF_NAME
: Configuration.DEFAULT_VRF_NAME;
: AristaConfiguration.DEFAULT_VRF_NAME;
int mtu = Interface.getDefaultMtu();
iface.setVrf(vrf);
initVrf(vrf);
Expand Down
Expand Up @@ -249,6 +249,7 @@ public final class AristaConfiguration extends VendorConfiguration {

static final int DEFAULT_VRRP_PRIORITY = 100;

public static final String DEFAULT_VRF_NAME = "default";
public static final String MANAGEMENT_VRF_NAME = "management";

static final int MAX_ADMINISTRATIVE_COST = 32767;
Expand Down
40 changes: 21 additions & 19 deletions tests/parsing-tests/unit-tests.ref
Expand Up @@ -1907,28 +1907,30 @@
" VARIABLE:'arista_ip_route'",
" NEWLINE:'\\n'))",
" (stanza",
" (ip_route_stanza",
" (s_ip",
" IP:'ip'",
" ROUTE:'route'",
" (ip_route_tail",
" prefix = IP_PREFIX:'1.2.3.32/29'",
" nexthopint = (interface_name_unstructured",
" VARIABLE:'Null0')",
" NAME:'name'",
" (variable",
" VARIABLE:'bippety' <== mode:M_Name)",
" NEWLINE:'\\n')))",
" (s_ip_route",
" ROUTE:'route'",
" (ip_route_tail",
" prefix = IP_PREFIX:'1.2.3.32/29'",
" nexthopint = (interface_name_unstructured",
" VARIABLE:'Null0')",
" NAME:'name'",
" (variable",
" VARIABLE:'bippety' <== mode:M_Name)",
" NEWLINE:'\\n'))))",
" (stanza",
" (ip_route_stanza",
" (s_ip",
" IP:'ip'",
" ROUTE:'route'",
" (ip_route_tail",
" prefix = IP_PREFIX:'2.3.4.5/32'",
" nexthopip = IP_ADDRESS:'3.4.5.6'",
" NAME:'name'",
" (variable",
" VARIABLE:'boppety' <== mode:M_Name)",
" NEWLINE:'\\n')))",
" (s_ip_route",
" ROUTE:'route'",
" (ip_route_tail",
" prefix = IP_PREFIX:'2.3.4.5/32'",
" nexthopip = IP_ADDRESS:'3.4.5.6'",
" NAME:'name'",
" (variable",
" VARIABLE:'boppety' <== mode:M_Name)",
" NEWLINE:'\\n'))))",
" EOF:<EOF>)"
]
},
Expand Down

0 comments on commit 8dea0bd

Please sign in to comment.