diff --git a/changelog/undistributed/changelog_show_clock_iosxe_20220614115332.rst b/changelog/undistributed/changelog_show_clock_iosxe_20220614115332.rst new file mode 100644 index 0000000000..07b40155bb --- /dev/null +++ b/changelog/undistributed/changelog_show_clock_iosxe_20220614115332.rst @@ -0,0 +1,6 @@ +-------------------------------------------------------------------------------- + Fix +-------------------------------------------------------------------------------- +* IOSXE + * Modified ShowClock: + * Modified regex to allow timezones that use UTC offset (+/-). diff --git a/sdk_generator/outputs/github_parser.json b/sdk_generator/outputs/github_parser.json index 36adca3f96..d0cdf06275 100644 --- a/sdk_generator/outputs/github_parser.json +++ b/sdk_generator/outputs/github_parser.json @@ -18090,7 +18090,7 @@ "package": "genie.libs.parser", "schema": "{\n'statistics': {\n 'sent': {\n 'total': <class 'int'>,\n 'requests': <class 'int'>,\n 'replies': <class 'int'>,\n 'l2_requests': <class 'int'>,\n 'l2_replies': <class 'int'>,\n 'gratuitous': <class 'int'>,\n 'tunneled': <class 'int'>,\n 'dropped': <class 'int'>,\n 'drops_details': {\n 'mbuf_operation_failed': <class 'int'>,\n Optional (str) context_not_created: <class 'int'>,\n Optional (str) invalid_context: <class 'int'>,\n Optional (str) invalid_ifindex: <class 'int'>,\n Optional (str) invalid_src_ip: <class 'int'>,\n Optional (str) invalid_dest_ip: <class 'int'>,\n Optional (str) destnination_is_our_own_ip: <class 'int'>,\n Optional (str) unattached_ip: <class 'int'>,\n Optional (str) adjacency_couldnt_be_added: <class 'int'>,\n Optional (str) null_source_ip: <class 'int'>,\n Optional (str) null_source_mac: <class 'int'>,\n Optional (str) client_enqueue_failed: <class 'int'>,\n Optional (str) dest_not_reachable_for_proxy_arp: <class 'int'>,\n Optional (str) dest_unreachable_for_enhanced_proxy: <class 'int'>,\n Optional (str) destnination_on_l2_port_tracked: <class 'int'>,\n Optional (str) invalid_local_proxy_arp: <class 'int'>,\n Optional (str) invalid_proxy_arp: <class 'int'>,\n Optional (str) vip_is_not_active: <class 'int'>,\n Optional (str) arp_refresh_skipped_over_core_and_flooded: <class 'int'>,\n },\n },\n 'received': {\n 'total': <class 'int'>,\n 'requests': <class 'int'>,\n 'replies': <class 'int'>,\n 'l2_requests': <class 'int'>,\n 'l2_replies': <class 'int'>,\n 'proxy_arp': <class 'int'>,\n 'local_proxy_arp': <class 'int'>,\n Optional (str) enhanced_proxy_arp: <class 'int'>,\n Optional (str) anycast_proxy_arp: <class 'int'>,\n Optional (str) l2_port_track_proxy_arp: <class 'int'>,\n 'tunneled': <class 'int'>,\n Optional (str) fastpath: <class 'int'>,\n Optional (str) snooped: <class 'int'>,\n 'dropped': <class 'int'>,\n Optional (str) dropped_server_port: <class 'int'>,\n 'drops_details': {\n 'context_not_created': <class 'int'>,\n 'invalid_context': <class 'int'>,\n Optional (str) invalid_hardwaretype: <class 'int'>,\n 'invalid_layer2_address_length': <class 'int'>,\n 'invalid_source_ip_address': <class 'int'>,\n 'no_mem_to_create_per_intf_structure': <class 'int'>,\n 'invalid_layer3_address_length': <class 'int'>,\n 'source_address_mismatch_with_subnet': <class 'int'>,\n 'directed_broadcast_source': <class 'int'>,\n 'invalid_destination_ip_address': <class 'int'>,\n 'non_local_destination_ip_address': <class 'int'>,\n 'invalid_source_mac_address': <class 'int'>,\n 'source_mac_address_is_our_own': <class 'int'>,\n 'received_before_arp_initialization': <class 'int'>,\n 'l2_packet_on_untrusted_l2_port': <class 'int'>,\n 'packet_with_vip_on_standby_fhrp': <class 'int'>,\n 'requests_came_for_exising_entries': <class 'int'>,\n 'requests_came_on_a_l2_interface': <class 'int'>,\n 'l2fm_query_failed_for_a_l2address': <class 'int'>,\n 'dropping_due_to_tunneling_failures': <class 'int'>,\n Optional (str) glean_requests_recv_count: <class 'int'>,\n Optional (str) arp_refresh_requests_received_from_clients: <class 'int'>,\n Optional (str) number_of_signals_received_from_l2rib: <class 'int'>,\n 'non_active_fhrp_dest_ip': <class 'int'>,\n 'grat_arp_received_on_proxy': <class 'int'>,\n 'invalid_protocol_packet': <class 'int'>,\n 'appeared_on_a_wrong_interface': <class 'int'>,\n 'incorrect_length': <class 'int'>,\n Optional (str) source_ip_address_is_our_own: <class 'int'>,\n },\n },\n 'adjacency': {\n 'adjacency_adds': <class 'int'>,\n 'adjacency_deletes': <class 'int'>,\n 'adjacency_timeouts': <class 'int'>,\n Optional (str) failed_due_to_limits: <class 'int'>,\n },\n },\n}", "uid": "show_ip_arp_statistics", - "url": "https://github.com/CiscoTestAutomation/genieparser/tree/master/src/genie/libs/parser/nxos/show_arp.py#L434" + "url": "https://github.com/CiscoTestAutomation/genieparser/tree/master/src/genie/libs/parser/nxos/show_arp.py#L435" } }, "show ip arp statistics vrf {vrf}": { @@ -18101,7 +18101,7 @@ "package": "genie.libs.parser", "schema": "{\n'statistics': {\n 'sent': {\n 'total': <class 'int'>,\n 'requests': <class 'int'>,\n 'replies': <class 'int'>,\n 'l2_requests': <class 'int'>,\n 'l2_replies': <class 'int'>,\n 'gratuitous': <class 'int'>,\n 'tunneled': <class 'int'>,\n 'dropped': <class 'int'>,\n 'drops_details': {\n 'mbuf_operation_failed': <class 'int'>,\n Optional (str) context_not_created: <class 'int'>,\n Optional (str) invalid_context: <class 'int'>,\n Optional (str) invalid_ifindex: <class 'int'>,\n Optional (str) invalid_src_ip: <class 'int'>,\n Optional (str) invalid_dest_ip: <class 'int'>,\n Optional (str) destnination_is_our_own_ip: <class 'int'>,\n Optional (str) unattached_ip: <class 'int'>,\n Optional (str) adjacency_couldnt_be_added: <class 'int'>,\n Optional (str) null_source_ip: <class 'int'>,\n Optional (str) null_source_mac: <class 'int'>,\n Optional (str) client_enqueue_failed: <class 'int'>,\n Optional (str) dest_not_reachable_for_proxy_arp: <class 'int'>,\n Optional (str) dest_unreachable_for_enhanced_proxy: <class 'int'>,\n Optional (str) destnination_on_l2_port_tracked: <class 'int'>,\n Optional (str) invalid_local_proxy_arp: <class 'int'>,\n Optional (str) invalid_proxy_arp: <class 'int'>,\n Optional (str) vip_is_not_active: <class 'int'>,\n Optional (str) arp_refresh_skipped_over_core_and_flooded: <class 'int'>,\n },\n },\n 'received': {\n 'total': <class 'int'>,\n 'requests': <class 'int'>,\n 'replies': <class 'int'>,\n 'l2_requests': <class 'int'>,\n 'l2_replies': <class 'int'>,\n 'proxy_arp': <class 'int'>,\n 'local_proxy_arp': <class 'int'>,\n Optional (str) enhanced_proxy_arp: <class 'int'>,\n Optional (str) anycast_proxy_arp: <class 'int'>,\n Optional (str) l2_port_track_proxy_arp: <class 'int'>,\n 'tunneled': <class 'int'>,\n Optional (str) fastpath: <class 'int'>,\n Optional (str) snooped: <class 'int'>,\n 'dropped': <class 'int'>,\n Optional (str) dropped_server_port: <class 'int'>,\n 'drops_details': {\n 'context_not_created': <class 'int'>,\n 'invalid_context': <class 'int'>,\n Optional (str) invalid_hardwaretype: <class 'int'>,\n 'invalid_layer2_address_length': <class 'int'>,\n 'invalid_source_ip_address': <class 'int'>,\n 'no_mem_to_create_per_intf_structure': <class 'int'>,\n 'invalid_layer3_address_length': <class 'int'>,\n 'source_address_mismatch_with_subnet': <class 'int'>,\n 'directed_broadcast_source': <class 'int'>,\n 'invalid_destination_ip_address': <class 'int'>,\n 'non_local_destination_ip_address': <class 'int'>,\n 'invalid_source_mac_address': <class 'int'>,\n 'source_mac_address_is_our_own': <class 'int'>,\n 'received_before_arp_initialization': <class 'int'>,\n 'l2_packet_on_untrusted_l2_port': <class 'int'>,\n 'packet_with_vip_on_standby_fhrp': <class 'int'>,\n 'requests_came_for_exising_entries': <class 'int'>,\n 'requests_came_on_a_l2_interface': <class 'int'>,\n 'l2fm_query_failed_for_a_l2address': <class 'int'>,\n 'dropping_due_to_tunneling_failures': <class 'int'>,\n Optional (str) glean_requests_recv_count: <class 'int'>,\n Optional (str) arp_refresh_requests_received_from_clients: <class 'int'>,\n Optional (str) number_of_signals_received_from_l2rib: <class 'int'>,\n 'non_active_fhrp_dest_ip': <class 'int'>,\n 'grat_arp_received_on_proxy': <class 'int'>,\n 'invalid_protocol_packet': <class 'int'>,\n 'appeared_on_a_wrong_interface': <class 'int'>,\n 'incorrect_length': <class 'int'>,\n Optional (str) source_ip_address_is_our_own: <class 'int'>,\n },\n },\n 'adjacency': {\n 'adjacency_adds': <class 'int'>,\n 'adjacency_deletes': <class 'int'>,\n 'adjacency_timeouts': <class 'int'>,\n Optional (str) failed_due_to_limits: <class 'int'>,\n },\n },\n}", "uid": "show_ip_arp_statistics_vrf_vrf", - "url": "https://github.com/CiscoTestAutomation/genieparser/tree/master/src/genie/libs/parser/nxos/show_arp.py#L434" + "url": "https://github.com/CiscoTestAutomation/genieparser/tree/master/src/genie/libs/parser/nxos/show_arp.py#L435" } }, "show ip arp summary": { @@ -18130,7 +18130,7 @@ "package": "genie.libs.parser", "schema": "{\n'resolved': <class 'int'>,\n'incomplete': <class 'int'>,\n'throttled': <class 'int'>,\n'unknown': <class 'int'>,\n'total': <class 'int'>,\n}", "uid": "show_ip_arp_summary", - "url": "https://github.com/CiscoTestAutomation/genieparser/tree/master/src/genie/libs/parser/nxos/show_arp.py#L274" + "url": "https://github.com/CiscoTestAutomation/genieparser/tree/master/src/genie/libs/parser/nxos/show_arp.py#L275" } }, "show ip arp summary vrf {vrf}": { @@ -18141,7 +18141,7 @@ "package": "genie.libs.parser", "schema": "{\n'resolved': <class 'int'>,\n'incomplete': <class 'int'>,\n'throttled': <class 'int'>,\n'unknown': <class 'int'>,\n'total': <class 'int'>,\n}", "uid": "show_ip_arp_summary_vrf_vrf", - "url": "https://github.com/CiscoTestAutomation/genieparser/tree/master/src/genie/libs/parser/nxos/show_arp.py#L274" + "url": "https://github.com/CiscoTestAutomation/genieparser/tree/master/src/genie/libs/parser/nxos/show_arp.py#L275" } }, "show ip arp vrf {vrf}": { @@ -47916,7 +47916,7 @@ "package": "genie.libs.parser", "schema": "{\n'bay': <class 'str'>,\n'fru': <class 'str'>,\n'node': <class 'str'>,\n'chassis': <class 'str'>,\n'slot': {\n <class 'int'>: {\n 'compliance': {\n 'secure_boot': <class 'str'>,\n 'tam_service': <class 'str'>,\n 'ldwm_envelope': <class 'str'>,\n 'num_btlstage': <class 'int'>,\n 'bivlen': <class 'int'>,\n 'register_pcr0_disabled': <class 'str'>,\n 'register_pcr8_disabled': <class 'str'>,\n },\n 'signature': {\n 'version': <class 'int'>,\n 'value': <class 'str'>,\n },\n },\n },\n}", "uid": "show_system_integrity_all_compliance_nonce_nonce", - "url": "https://github.com/CiscoTestAutomation/genieparser/tree/master/src/genie/libs/parser/iosxe/show_system.py#L326" + "url": "https://github.com/CiscoTestAutomation/genieparser/tree/master/src/genie/libs/parser/iosxe/show_system.py#L327" } }, "show system integrity all measurement nonce {nonce}": { @@ -47945,7 +47945,7 @@ "package": "genie.libs.parser", "schema": "{\n'bay': <class 'str'>,\n'fru': <class 'str'>,\n'node': <class 'str'>,\n'chassis': <class 'str'>,\n'slot': {\n <class 'int'>: {\n 'platform': <class 'str'>,\n 'boot_hashes': {\n Any (str) *: <class 'str'>,\n },\n 'os': {\n 'version': <class 'str'>,\n 'hashes': {\n Any (str) *: <class 'str'>,\n },\n },\n 'registers': {\n 'PCR0': <class 'str'>,\n 'PCR8': <class 'str'>,\n },\n 'signature': {\n 'version': <class 'int'>,\n 'value': <class 'str'>,\n },\n },\n },\n}", "uid": "show_system_integrity_all_measurement_nonce_nonce", - "url": "https://github.com/CiscoTestAutomation/genieparser/tree/master/src/genie/libs/parser/iosxe/show_system.py#L99" + "url": "https://github.com/CiscoTestAutomation/genieparser/tree/master/src/genie/libs/parser/iosxe/show_system.py#L100" } }, "show system integrity all trust_chain nonce {nonce}": { @@ -47974,7 +47974,7 @@ "package": "genie.libs.parser", "schema": "{\n'bay': <class 'str'>,\n'fru': <class 'str'>,\n'node': <class 'str'>,\n'chassis': <class 'str'>,\n'slot': {\n <class 'int'>: {\n 'crca_certificate': <class 'str'>,\n 'cmca_certificate': <class 'str'>,\n 'sudi_certificate': <class 'str'>,\n 'signature': {\n 'version': <class 'int'>,\n 'value': <class 'str'>,\n },\n },\n },\n}", "uid": "show_system_integrity_all_trust_chain_nonce_nonce", - "url": "https://github.com/CiscoTestAutomation/genieparser/tree/master/src/genie/libs/parser/iosxe/show_system.py#L484" + "url": "https://github.com/CiscoTestAutomation/genieparser/tree/master/src/genie/libs/parser/iosxe/show_system.py#L485" } }, "show system internal l2fwder Mac": { diff --git a/src/genie/libs/parser/iosxe/show_system.py b/src/genie/libs/parser/iosxe/show_system.py index 83813a1c28..7dfbbfc5a8 100755 --- a/src/genie/libs/parser/iosxe/show_system.py +++ b/src/genie/libs/parser/iosxe/show_system.py @@ -52,11 +52,10 @@ def cli(self, output=None): # initial regexp pattern # 05:26:38.035 EST Wed JAN 4 2019 # *05:26:38.035 EST Wed JAN 4 2019 - p1 = re.compile( - r"^\*?(?P<time>[\d\:\.]+) +(?P<timezone>\w+)" - " +(?P<day_of_week>\w+) +(?P<month>\w+) +" - "(?P<day>\d+) +(?P<year>\d+)$" - ) + # 05:26:38.035 UTC+2 Wed JAN 4 2019 + p1 = re.compile(r'^\*?(?P<time>[\d\:\.]+) +(?P<timezone>\S+) ' + r'+(?P<day_of_week>\w+) +(?P<month>\w+) +(?P<day>\d+) ' + r'+(?P<year>\d+)$') for line in out.splitlines(): line = line.strip() @@ -65,7 +64,9 @@ def cli(self, output=None): m = p1.match(line) if m: group = m.groupdict() - ret_dict.update({k: str(v) for k, v in group.items()}) + group['day_of_week'] = group['day_of_week'].capitalize() + group['month'] = group['month'].capitalize() + ret_dict.update({k: v for k, v in group.items()}) continue return ret_dict @@ -626,4 +627,3 @@ def yang(self, nonce="", output=None): elif sub_child2.tag.endswith('version'): sign_dict.update({'version': int(sub_child2.text)}) return ret_dict - diff --git a/src/genie/libs/parser/iosxe/tests/ShowClock/cli/equal/golden_output1_expected.py b/src/genie/libs/parser/iosxe/tests/ShowClock/cli/equal/golden_output1_expected.py new file mode 100644 index 0000000000..5ff8504aa0 --- /dev/null +++ b/src/genie/libs/parser/iosxe/tests/ShowClock/cli/equal/golden_output1_expected.py @@ -0,0 +1,8 @@ +expected_output = { + "day": "4", + "month": "Jan", + "time": "05:26:38.035", + "day_of_week": "Wed", + "year": "2019", + "timezone": "UTC+2", +} diff --git a/src/genie/libs/parser/iosxe/tests/ShowClock/cli/equal/golden_output1_output.txt b/src/genie/libs/parser/iosxe/tests/ShowClock/cli/equal/golden_output1_output.txt new file mode 100644 index 0000000000..39b8926695 --- /dev/null +++ b/src/genie/libs/parser/iosxe/tests/ShowClock/cli/equal/golden_output1_output.txt @@ -0,0 +1,5 @@ +Router#show clock +Load for five secs: 1%/0%; one minute: 2%; five minutes: 3% +Time source is NTP, 05:26:38.035 UTC+2 Wed JAN 4 2019 + +05:26:38.035 UTC+2 Wed JAN 4 2019 \ No newline at end of file