@Test public void testInferMajorVersionFromVersion() { assertThat(inferMajorVersionFromVersion("5.0(3)N2(4.01)"), equalTo(NXOS5)); assertThat(inferMajorVersionFromVersion("5.1(3)N1(1a)"), equalTo(NXOS5)); assertThat(inferMajorVersionFromVersion("5.1(3)N2(1c)"), equalTo(NXOS5)); assertThat(inferMajorVersionFromVersion("5.2(1)N1(9)"), equalTo(NXOS5)); assertThat(inferMajorVersionFromVersion("6.0(2)N2(3)"), equalTo(NXOS6)); assertThat(inferMajorVersionFromVersion("6.0(2)N2(4)"), equalTo(NXOS6)); assertThat(inferMajorVersionFromVersion("6.0(2)N2(5)"), equalTo(NXOS6)); assertThat(inferMajorVersionFromVersion("6.0(2)U3(2)"), equalTo(NXOS6)); assertThat(inferMajorVersionFromVersion("6.0(2)U3(5)"), equalTo(NXOS6)); assertThat(inferMajorVersionFromVersion("6.0(2)U3(7)"), equalTo(NXOS6)); assertThat(inferMajorVersionFromVersion("6.0(2)U6(6)"), equalTo(NXOS6)); assertThat(inferMajorVersionFromVersion("6.2(16)"), equalTo(NXOS6)); assertThat(inferMajorVersionFromVersion("7.0(2)N1(1)"), equalTo(NXOS7)); assertThat(inferMajorVersionFromVersion("7.0(3)I2(2a)"), equalTo(NXOS7)); assertThat(inferMajorVersionFromVersion("7.0(3)I2(2b)"), equalTo(NXOS7)); assertThat(inferMajorVersionFromVersion("7.0(3)I2(3)"), equalTo(NXOS7)); assertThat(inferMajorVersionFromVersion("7.0(3)I3(1)"), equalTo(NXOS7)); assertThat(inferMajorVersionFromVersion("7.0(3)I3(1)"), equalTo(NXOS7)); assertThat(inferMajorVersionFromVersion("7.0(3)I4(1)"), equalTo(NXOS7)); assertThat(inferMajorVersionFromVersion("7.0(3)I4(3)"), equalTo(NXOS7)); assertThat(inferMajorVersionFromVersion("7.0(3)I4(5)"), equalTo(NXOS7)); assertThat(inferMajorVersionFromVersion("7.0(3)I5(1)"), equalTo(NXOS7)); assertThat(inferMajorVersionFromVersion("7.0(3)I5(2)"), equalTo(NXOS7)); assertThat(inferMajorVersionFromVersion("7.0(3)I7(2)"), equalTo(NXOS7)); assertThat(inferMajorVersionFromVersion("7.0(3)I7(4)"), equalTo(NXOS7)); assertThat(inferMajorVersionFromVersion("7.0(5)N1(1a)"), equalTo(NXOS7)); assertThat(inferMajorVersionFromVersion("7.0(5)N1(1a)"), equalTo(NXOS7)); assertThat(inferMajorVersionFromVersion("7.0(6)N1(1)"), equalTo(NXOS7)); assertThat(inferMajorVersionFromVersion("7.0(8)N1(1)"), equalTo(NXOS7)); assertThat(inferMajorVersionFromVersion("7.0(8)N1(1a)"), equalTo(NXOS7)); assertThat(inferMajorVersionFromVersion("7.1(0)N1(1b)"), equalTo(NXOS7)); assertThat(inferMajorVersionFromVersion("7.1(4)N1(1)"), equalTo(NXOS7)); assertThat(inferMajorVersionFromVersion("7.3(0)N1(1)"), equalTo(NXOS7)); assertThat(inferMajorVersionFromVersion("7.3(2)N1(1)"), equalTo(NXOS7)); assertThat(inferMajorVersionFromVersion("9.2(1) Bios:version 05.31"), equalTo(NXOS9)); assertThat(inferMajorVersionFromVersion("9.2(3) Bios:version"), equalTo(NXOS9)); }
@VisibleForTesting static @Nullable NxosMajorVersion inferMajorVersionFromVersion(@Nullable String version) { switch (version.charAt(0)) { case '4': return NxosMajorVersion.NXOS4; case '5': return NxosMajorVersion.NXOS5; case '6': return NxosMajorVersion.NXOS6; case '7': return NxosMajorVersion.NXOS7; case '9': return NxosMajorVersion.NXOS9; default: return null; } }
CiscoNxosPreprocessor extends CiscoNxosParserBaseListener { @VisibleForTesting static @Nullable NxosMajorVersion inferMajorVersionFromVersion(@Nullable String version) { switch (version.charAt(0)) { case '4': return NxosMajorVersion.NXOS4; case '5': return NxosMajorVersion.NXOS5; case '6': return NxosMajorVersion.NXOS6; case '7': return NxosMajorVersion.NXOS7; case '9': return NxosMajorVersion.NXOS9; default: return null; } } }
CiscoNxosPreprocessor extends CiscoNxosParserBaseListener { @VisibleForTesting static @Nullable NxosMajorVersion inferMajorVersionFromVersion(@Nullable String version) { switch (version.charAt(0)) { case '4': return NxosMajorVersion.NXOS4; case '5': return NxosMajorVersion.NXOS5; case '6': return NxosMajorVersion.NXOS6; case '7': return NxosMajorVersion.NXOS7; case '9': return NxosMajorVersion.NXOS9; default: return null; } } CiscoNxosPreprocessor(
      String text,
      CiscoNxosCombinedParser parser,
      Warnings warnings,
      CiscoNxosConfiguration configuration); }
CiscoNxosPreprocessor extends CiscoNxosParserBaseListener { @VisibleForTesting static @Nullable NxosMajorVersion inferMajorVersionFromVersion(@Nullable String version) { switch (version.charAt(0)) { case '4': return NxosMajorVersion.NXOS4; case '5': return NxosMajorVersion.NXOS5; case '6': return NxosMajorVersion.NXOS6; case '7': return NxosMajorVersion.NXOS7; case '9': return NxosMajorVersion.NXOS9; default: return null; } } CiscoNxosPreprocessor(
      String text,
      CiscoNxosCombinedParser parser,
      Warnings warnings,
      CiscoNxosConfiguration configuration); static @Nonnull NxosMajorVersion inferMajorVersion(CiscoNxosConfiguration vc); static @Nonnull NexusPlatform inferPlatform(
      CiscoNxosConfiguration vc,
      NxosMajorVersion majorVersion,
      int numLayer3ExplicitShutdown,
      int numLayer3ExplicitNoShutdown); static boolean getDefaultDefaultSwitchport(
      CiscoNxosConfiguration vc,
      NexusPlatform platform,
      NxosMajorVersion majorVersion,
      int defaultLayer2EvidenceCount,
      int defaultLayer3EvidenceCount); static boolean getNonSwitchportDefaultShutdown(
      NexusPlatform platform, NxosMajorVersion majorVersion); @Override void exitCisco_nxos_configuration(Cisco_nxos_configurationContext ctx); @Override void exitS_version(S_versionContext ctx); @Override void exitBoot_kickstart(Boot_kickstartContext ctx); @Override void exitBoot_nxos(Boot_nxosContext ctx); @Override void exitBoot_system(Boot_systemContext ctx); @Override void enterS_interface_regular(S_interface_regularContext ctx); @Override void exitS_interface_regular(S_interface_regularContext ctx); @Override void exitI_shutdown(I_shutdownContext ctx); @Override void exitI_no_shutdown(I_no_shutdownContext ctx); @Override void exitInos_switchport(Inos_switchportContext ctx); @Override void exitI_switchport_switchport(I_switchport_switchportContext ctx); @Override void exitNo_sysds_switchport(No_sysds_switchportContext ctx); @Override void exitSysds_switchport(Sysds_switchportContext ctx); @Override void exitI_switchport(I_switchportContext ctx); @Override void exitI_ip_address(I_ip_addressContext ctx); @Override void exitI_vrf_member(I_vrf_memberContext ctx); }
CiscoNxosPreprocessor extends CiscoNxosParserBaseListener { @VisibleForTesting static @Nullable NxosMajorVersion inferMajorVersionFromVersion(@Nullable String version) { switch (version.charAt(0)) { case '4': return NxosMajorVersion.NXOS4; case '5': return NxosMajorVersion.NXOS5; case '6': return NxosMajorVersion.NXOS6; case '7': return NxosMajorVersion.NXOS7; case '9': return NxosMajorVersion.NXOS9; default: return null; } } CiscoNxosPreprocessor(
      String text,
      CiscoNxosCombinedParser parser,
      Warnings warnings,
      CiscoNxosConfiguration configuration); static @Nonnull NxosMajorVersion inferMajorVersion(CiscoNxosConfiguration vc); static @Nonnull NexusPlatform inferPlatform(
      CiscoNxosConfiguration vc,
      NxosMajorVersion majorVersion,
      int numLayer3ExplicitShutdown,
      int numLayer3ExplicitNoShutdown); static boolean getDefaultDefaultSwitchport(
      CiscoNxosConfiguration vc,
      NexusPlatform platform,
      NxosMajorVersion majorVersion,
      int defaultLayer2EvidenceCount,
      int defaultLayer3EvidenceCount); static boolean getNonSwitchportDefaultShutdown(
      NexusPlatform platform, NxosMajorVersion majorVersion); @Override void exitCisco_nxos_configuration(Cisco_nxos_configurationContext ctx); @Override void exitS_version(S_versionContext ctx); @Override void exitBoot_kickstart(Boot_kickstartContext ctx); @Override void exitBoot_nxos(Boot_nxosContext ctx); @Override void exitBoot_system(Boot_systemContext ctx); @Override void enterS_interface_regular(S_interface_regularContext ctx); @Override void exitS_interface_regular(S_interface_regularContext ctx); @Override void exitI_shutdown(I_shutdownContext ctx); @Override void exitI_no_shutdown(I_no_shutdownContext ctx); @Override void exitInos_switchport(Inos_switchportContext ctx); @Override void exitI_switchport_switchport(I_switchport_switchportContext ctx); @Override void exitNo_sysds_switchport(No_sysds_switchportContext ctx); @Override void exitSysds_switchport(Sysds_switchportContext ctx); @Override void exitI_switchport(I_switchportContext ctx); @Override void exitI_ip_address(I_ip_addressContext ctx); @Override void exitI_vrf_member(I_vrf_memberContext ctx);  }