From 002caa9fb3b65f1ae64df25cc39c3de130403e76 Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Mon, 28 Feb 2022 12:19:02 -0800 Subject: [PATCH] add fedora tests --- .../fedora32/nmcli-connection-show-ens33.json | 1 + .../fedora32/nmcli-connection-show-ens33.out | 148 ++++++++++++++++++ .../fedora32/nmcli-device-show-ens33.json | 1 + .../fedora32/nmcli-device-show-ens33.out | 26 +++ .../fixtures/fedora32/nmcli-device-show.json | 1 + tests/fixtures/fedora32/nmcli-device-show.out | 39 +++++ tests/test_nmcli.py | 36 +++++ 7 files changed, 252 insertions(+) create mode 100644 tests/fixtures/fedora32/nmcli-connection-show-ens33.json create mode 100644 tests/fixtures/fedora32/nmcli-connection-show-ens33.out create mode 100644 tests/fixtures/fedora32/nmcli-device-show-ens33.json create mode 100644 tests/fixtures/fedora32/nmcli-device-show-ens33.out create mode 100644 tests/fixtures/fedora32/nmcli-device-show.json create mode 100644 tests/fixtures/fedora32/nmcli-device-show.out diff --git a/tests/fixtures/fedora32/nmcli-connection-show-ens33.json b/tests/fixtures/fedora32/nmcli-connection-show-ens33.json new file mode 100644 index 00000000..97355923 --- /dev/null +++ b/tests/fixtures/fedora32/nmcli-connection-show-ens33.json @@ -0,0 +1 @@ +[{"connection_id":"ens33","connection_uuid":"fbea23dd-6738-403f-b3a5-5d4a3444216a","connection_stable_id":null,"connection_type":"802-3-ethernet","connection_interface_name":"ens33","connection_autoconnect":"yes","connection_autoconnect_priority":0,"connection_autoconnect_retries":-1,"connection_autoconnect_retries_text":"default","connection_multi_connect":0,"connection_multi_connect_text":"default","connection_auth_retries":-1,"connection_timestamp":1646019157,"connection_read_only":"no","connection_permissions":null,"connection_zone":null,"connection_master":null,"connection_slave_type":null,"connection_autoconnect_slaves":-1,"connection_autoconnect_slaves_text":"default","connection_secondaries":null,"connection_gateway_ping_timeout":0,"connection_metered":"unknown","connection_lldp":"default","connection_mdns":-1,"connection_mdns_text":"default","connection_llmnr":-1,"connection_llmnr_text":"default","connection_wait_device_timeout":-1,"802_3_ethernet_port":null,"802_3_ethernet_speed":0,"802_3_ethernet_duplex":null,"802_3_ethernet_auto_negotiate":"no","802_3_ethernet_mac_address":null,"802_3_ethernet_cloned_mac_address":null,"802_3_ethernet_generate_mac_address_mask":null,"802_3_ethernet_mac_address_blacklist":null,"802_3_ethernet_mtu":"auto","802_3_ethernet_s390_subchannels":null,"802_3_ethernet_s390_nettype":null,"802_3_ethernet_s390_options":null,"802_3_ethernet_wake_on_lan":"default","802_3_ethernet_wake_on_lan_password":null,"ipv4_method":"auto","ipv4_dns":null,"ipv4_dns_search":null,"ipv4_dns_options":null,"ipv4_dns_priority":0,"ipv4_addresses":null,"ipv4_gateway":null,"ipv4_routes":null,"ipv4_route_metric":-1,"ipv4_route_table":0,"ipv4_route_table_text":"unspec","ipv4_routing_rules":null,"ipv4_ignore_auto_routes":"no","ipv4_ignore_auto_dns":"no","ipv4_dhcp_client_id":null,"ipv4_dhcp_iaid":null,"ipv4_dhcp_timeout":0,"ipv4_dhcp_timeout_text":"default","ipv4_dhcp_send_hostname":"yes","ipv4_dhcp_hostname":null,"ipv4_dhcp_fqdn":null,"ipv4_dhcp_hostname_flags":"0x0","ipv4_dhcp_hostname_flags_text":"none","ipv4_never_default":"no","ipv4_may_fail":"yes","ipv4_dad_timeout":-1,"ipv4_dad_timeout_text":"default","ipv6_method":"auto","ipv6_dns":null,"ipv6_dns_search":null,"ipv6_dns_options":null,"ipv6_dns_priority":0,"ipv6_addresses":null,"ipv6_gateway":null,"ipv6_routes":null,"ipv6_route_metric":-1,"ipv6_route_table":0,"ipv6_route_table_text":"unspec","ipv6_routing_rules":null,"ipv6_ignore_auto_routes":"no","ipv6_ignore_auto_dns":"no","ipv6_never_default":"no","ipv6_may_fail":"yes","ipv6_ip6_privacy":-1,"ipv6_ip6_privacy_text":"unknown","ipv6_addr_gen_mode":"stable-privacy","ipv6_ra_timeout":0,"ipv6_ra_timeout_text":"default","ipv6_dhcp_duid":null,"ipv6_dhcp_iaid":null,"ipv6_dhcp_timeout":0,"ipv6_dhcp_timeout_text":"default","ipv6_dhcp_send_hostname":"yes","ipv6_dhcp_hostname":null,"ipv6_dhcp_hostname_flags":"0x0","ipv6_dhcp_hostname_flags_text":"none","ipv6_token":null,"proxy_method":"none","proxy_browser_only":"no","proxy_pac_url":null,"proxy_pac_script":null,"name":"ens33","uuid":"fbea23dd-6738-403f-b3a5-5d4a3444216a","devices":"ens33","ip_iface":"ens33","state":"activated","default":"yes","default6":"yes","spec_object":null,"vpn":"no","dbus_path":"/org/freedesktop/NetworkManager/ActiveConnection/2","con_path":"/org/freedesktop/NetworkManager/Settings/1","zone":null,"master_path":null,"ip4_address_1":"10.0.0.178/24","ip4_gateway":"10.0.0.1","ip4_route_1":{"dst":"0.0.0.0/0","nh":"10.0.0.1","mt":100},"ip4_route_2":{"dst":"10.0.0.0/24","nh":"0.0.0.0","mt":100},"ip4_dns_1":"75.75.75.75","ip4_dns_2":"75.75.76.76","ip4_domain_1":"hsd1.ca.comcast.net","dhcp4_option_1":{"name":"dhcp_lease_time","value":172800},"dhcp4_option_2":{"name":"domain_name","value":"hsd1.ca.comcast.net"},"dhcp4_option_3":{"name":"domain_name_servers","value":"75.75.75.75 75.75.76.76"},"dhcp4_option_4":{"name":"expiry","value":1646191487},"dhcp4_option_5":{"name":"ip_address","value":"10.0.0.178"},"dhcp4_option_6":{"name":"next_server","value":"10.0.0.1"},"dhcp4_option_7":{"name":"requested_broadcast_address","value":1},"dhcp4_option_8":{"name":"requested_domain_name","value":1},"dhcp4_option_9":{"name":"requested_domain_name_servers","value":1},"dhcp4_option_10":{"name":"requested_domain_search","value":1},"dhcp4_option_11":{"name":"requested_host_name","value":1},"dhcp4_option_12":{"name":"requested_interface_mtu","value":1},"dhcp4_option_13":{"name":"requested_ms_classless_static_routes","value":1},"dhcp4_option_14":{"name":"requested_nis_domain","value":1},"dhcp4_option_15":{"name":"requested_nis_servers","value":1},"dhcp4_option_16":{"name":"requested_ntp_servers","value":1},"dhcp4_option_17":{"name":"requested_rfc3442_classless_static_routes","value":1},"dhcp4_option_18":{"name":"requested_root_path","value":1},"dhcp4_option_19":{"name":"requested_routers","value":1},"dhcp4_option_20":{"name":"requested_static_routes","value":1},"dhcp4_option_21":{"name":"requested_subnet_mask","value":1},"dhcp4_option_22":{"name":"requested_time_offset","value":1},"dhcp4_option_23":{"name":"requested_wpad","value":1},"dhcp4_option_24":{"name":"routers","value":"10.0.0.1"},"dhcp4_option_25":{"name":"subnet_mask","value":"255.255.255.0"},"ip6_address_1":"2601:641:482:9cc0::2d6d/128","ip6_address_2":"fe80::9263:6fcc:6db6:8b56/64","ip6_gateway":"fe80::f88c:f4ff:fef1:d8f9","ip6_route_1":{"dst":"fd29:95c1:bb51::/64","nh":"fe80::1453:e8bf:c07a:2ca8","mt":100},"ip6_route_2":{"dst":"2601:641:482:9cc0::/60","nh":"::","mt":100},"ip6_route_3":{"dst":"::/0","nh":"fe80::f88c:f4ff:fef1:d8f9","mt":100},"ip6_route_4":{"dst":"ff00::/8","nh":"::","mt":256,"table":255},"ip6_route_5":{"dst":"fe80::/64","nh":"::","mt":100},"ip6_route_6":{"dst":"2601:641:482:9cc0::2d6d/128","nh":"::","mt":100},"ip6_dns_1":"2001:558:feed::1","ip6_dns_2":"2001:558:feed::2","dhcp6_option_1":{"name":"dhcp6_name_servers","value":"2001:558:feed::1 2001:558:feed::2"},"dhcp6_option_2":{"name":"ip6_address","value":"2601:641:482:9cc0::2d6d"}}] diff --git a/tests/fixtures/fedora32/nmcli-connection-show-ens33.out b/tests/fixtures/fedora32/nmcli-connection-show-ens33.out new file mode 100644 index 00000000..876b57e9 --- /dev/null +++ b/tests/fixtures/fedora32/nmcli-connection-show-ens33.out @@ -0,0 +1,148 @@ +connection.id: ens33 +connection.uuid: fbea23dd-6738-403f-b3a5-5d4a3444216a +connection.stable-id: -- +connection.type: 802-3-ethernet +connection.interface-name: ens33 +connection.autoconnect: yes +connection.autoconnect-priority: 0 +connection.autoconnect-retries: -1 (default) +connection.multi-connect: 0 (default) +connection.auth-retries: -1 +connection.timestamp: 1646019157 +connection.read-only: no +connection.permissions: -- +connection.zone: -- +connection.master: -- +connection.slave-type: -- +connection.autoconnect-slaves: -1 (default) +connection.secondaries: -- +connection.gateway-ping-timeout: 0 +connection.metered: unknown +connection.lldp: default +connection.mdns: -1 (default) +connection.llmnr: -1 (default) +connection.wait-device-timeout: -1 +802-3-ethernet.port: -- +802-3-ethernet.speed: 0 +802-3-ethernet.duplex: -- +802-3-ethernet.auto-negotiate: no +802-3-ethernet.mac-address: -- +802-3-ethernet.cloned-mac-address: -- +802-3-ethernet.generate-mac-address-mask:-- +802-3-ethernet.mac-address-blacklist: -- +802-3-ethernet.mtu: auto +802-3-ethernet.s390-subchannels: -- +802-3-ethernet.s390-nettype: -- +802-3-ethernet.s390-options: -- +802-3-ethernet.wake-on-lan: default +802-3-ethernet.wake-on-lan-password: -- +ipv4.method: auto +ipv4.dns: -- +ipv4.dns-search: -- +ipv4.dns-options: -- +ipv4.dns-priority: 0 +ipv4.addresses: -- +ipv4.gateway: -- +ipv4.routes: -- +ipv4.route-metric: -1 +ipv4.route-table: 0 (unspec) +ipv4.routing-rules: -- +ipv4.ignore-auto-routes: no +ipv4.ignore-auto-dns: no +ipv4.dhcp-client-id: -- +ipv4.dhcp-iaid: -- +ipv4.dhcp-timeout: 0 (default) +ipv4.dhcp-send-hostname: yes +ipv4.dhcp-hostname: -- +ipv4.dhcp-fqdn: -- +ipv4.dhcp-hostname-flags: 0x0 (none) +ipv4.never-default: no +ipv4.may-fail: yes +ipv4.dad-timeout: -1 (default) +ipv6.method: auto +ipv6.dns: -- +ipv6.dns-search: -- +ipv6.dns-options: -- +ipv6.dns-priority: 0 +ipv6.addresses: -- +ipv6.gateway: -- +ipv6.routes: -- +ipv6.route-metric: -1 +ipv6.route-table: 0 (unspec) +ipv6.routing-rules: -- +ipv6.ignore-auto-routes: no +ipv6.ignore-auto-dns: no +ipv6.never-default: no +ipv6.may-fail: yes +ipv6.ip6-privacy: -1 (unknown) +ipv6.addr-gen-mode: stable-privacy +ipv6.ra-timeout: 0 (default) +ipv6.dhcp-duid: -- +ipv6.dhcp-iaid: -- +ipv6.dhcp-timeout: 0 (default) +ipv6.dhcp-send-hostname: yes +ipv6.dhcp-hostname: -- +ipv6.dhcp-hostname-flags: 0x0 (none) +ipv6.token: -- +proxy.method: none +proxy.browser-only: no +proxy.pac-url: -- +proxy.pac-script: -- +GENERAL.NAME: ens33 +GENERAL.UUID: fbea23dd-6738-403f-b3a5-5d4a3444216a +GENERAL.DEVICES: ens33 +GENERAL.IP-IFACE: ens33 +GENERAL.STATE: activated +GENERAL.DEFAULT: yes +GENERAL.DEFAULT6: yes +GENERAL.SPEC-OBJECT: -- +GENERAL.VPN: no +GENERAL.DBUS-PATH: /org/freedesktop/NetworkManager/ActiveConnection/2 +GENERAL.CON-PATH: /org/freedesktop/NetworkManager/Settings/1 +GENERAL.ZONE: -- +GENERAL.MASTER-PATH: -- +IP4.ADDRESS[1]: 10.0.0.178/24 +IP4.GATEWAY: 10.0.0.1 +IP4.ROUTE[1]: dst = 0.0.0.0/0, nh = 10.0.0.1, mt = 100 +IP4.ROUTE[2]: dst = 10.0.0.0/24, nh = 0.0.0.0, mt = 100 +IP4.DNS[1]: 75.75.75.75 +IP4.DNS[2]: 75.75.76.76 +IP4.DOMAIN[1]: hsd1.ca.comcast.net +DHCP4.OPTION[1]: dhcp_lease_time = 172800 +DHCP4.OPTION[2]: domain_name = hsd1.ca.comcast.net +DHCP4.OPTION[3]: domain_name_servers = 75.75.75.75 75.75.76.76 +DHCP4.OPTION[4]: expiry = 1646191487 +DHCP4.OPTION[5]: ip_address = 10.0.0.178 +DHCP4.OPTION[6]: next_server = 10.0.0.1 +DHCP4.OPTION[7]: requested_broadcast_address = 1 +DHCP4.OPTION[8]: requested_domain_name = 1 +DHCP4.OPTION[9]: requested_domain_name_servers = 1 +DHCP4.OPTION[10]: requested_domain_search = 1 +DHCP4.OPTION[11]: requested_host_name = 1 +DHCP4.OPTION[12]: requested_interface_mtu = 1 +DHCP4.OPTION[13]: requested_ms_classless_static_routes = 1 +DHCP4.OPTION[14]: requested_nis_domain = 1 +DHCP4.OPTION[15]: requested_nis_servers = 1 +DHCP4.OPTION[16]: requested_ntp_servers = 1 +DHCP4.OPTION[17]: requested_rfc3442_classless_static_routes = 1 +DHCP4.OPTION[18]: requested_root_path = 1 +DHCP4.OPTION[19]: requested_routers = 1 +DHCP4.OPTION[20]: requested_static_routes = 1 +DHCP4.OPTION[21]: requested_subnet_mask = 1 +DHCP4.OPTION[22]: requested_time_offset = 1 +DHCP4.OPTION[23]: requested_wpad = 1 +DHCP4.OPTION[24]: routers = 10.0.0.1 +DHCP4.OPTION[25]: subnet_mask = 255.255.255.0 +IP6.ADDRESS[1]: 2601:641:482:9cc0::2d6d/128 +IP6.ADDRESS[2]: fe80::9263:6fcc:6db6:8b56/64 +IP6.GATEWAY: fe80::f88c:f4ff:fef1:d8f9 +IP6.ROUTE[1]: dst = fd29:95c1:bb51::/64, nh = fe80::1453:e8bf:c07a:2ca8, mt = 100 +IP6.ROUTE[2]: dst = 2601:641:482:9cc0::/60, nh = ::, mt = 100 +IP6.ROUTE[3]: dst = ::/0, nh = fe80::f88c:f4ff:fef1:d8f9, mt = 100 +IP6.ROUTE[4]: dst = ff00::/8, nh = ::, mt = 256, table=255 +IP6.ROUTE[5]: dst = fe80::/64, nh = ::, mt = 100 +IP6.ROUTE[6]: dst = 2601:641:482:9cc0::2d6d/128, nh = ::, mt = 100 +IP6.DNS[1]: 2001:558:feed::1 +IP6.DNS[2]: 2001:558:feed::2 +DHCP6.OPTION[1]: dhcp6_name_servers = 2001:558:feed::1 2001:558:feed::2 +DHCP6.OPTION[2]: ip6_address = 2601:641:482:9cc0::2d6d diff --git a/tests/fixtures/fedora32/nmcli-device-show-ens33.json b/tests/fixtures/fedora32/nmcli-device-show-ens33.json new file mode 100644 index 00000000..0f722b60 --- /dev/null +++ b/tests/fixtures/fedora32/nmcli-device-show-ens33.json @@ -0,0 +1 @@ +[{"device":"ens33","type":"ethernet","hwaddr":"00:0C:29:66:16:68","mtu":1500,"state":100,"state_text":"connected","connection":"ens33","con_path":"/org/freedesktop/NetworkManager/ActiveConnection/2","wired_properties_carrier":"on","ip4_address_1":"10.0.0.178/24","ip4_gateway":"10.0.0.1","ip4_route_1":{"dst":"0.0.0.0/0","nh":"10.0.0.1","mt":100},"ip4_route_2":{"dst":"10.0.0.0/24","nh":"0.0.0.0","mt":100},"ip4_dns_1":"75.75.75.75","ip4_dns_2":"75.75.76.76","ip4_domain_1":"hsd1.ca.comcast.net","ip6_address_1":"2601:641:482:9cc0::2d6d/128","ip6_address_2":"fe80::9263:6fcc:6db6:8b56/64","ip6_gateway":"fe80::f88c:f4ff:fef1:d8f9","ip6_route_1":{"dst":"fd29:95c1:bb51::/64","nh":"fe80::1453:e8bf:c07a:2ca8","mt":100},"ip6_route_2":{"dst":"2601:641:482:9cc0::/60","nh":"::","mt":100},"ip6_route_3":{"dst":"::/0","nh":"fe80::f88c:f4ff:fef1:d8f9","mt":100},"ip6_route_4":{"dst":"ff00::/8","nh":"::","mt":256,"table":255},"ip6_route_5":{"dst":"fe80::/64","nh":"::","mt":100},"ip6_route_6":{"dst":"2601:641:482:9cc0::2d6d/128","nh":"::","mt":100},"ip6_dns_1":"2001:558:feed::1","ip6_dns_2":"2001:558:feed::2"}] diff --git a/tests/fixtures/fedora32/nmcli-device-show-ens33.out b/tests/fixtures/fedora32/nmcli-device-show-ens33.out new file mode 100644 index 00000000..987d1b4f --- /dev/null +++ b/tests/fixtures/fedora32/nmcli-device-show-ens33.out @@ -0,0 +1,26 @@ +GENERAL.DEVICE: ens33 +GENERAL.TYPE: ethernet +GENERAL.HWADDR: 00:0C:29:66:16:68 +GENERAL.MTU: 1500 +GENERAL.STATE: 100 (connected) +GENERAL.CONNECTION: ens33 +GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/2 +WIRED-PROPERTIES.CARRIER: on +IP4.ADDRESS[1]: 10.0.0.178/24 +IP4.GATEWAY: 10.0.0.1 +IP4.ROUTE[1]: dst = 0.0.0.0/0, nh = 10.0.0.1, mt = 100 +IP4.ROUTE[2]: dst = 10.0.0.0/24, nh = 0.0.0.0, mt = 100 +IP4.DNS[1]: 75.75.75.75 +IP4.DNS[2]: 75.75.76.76 +IP4.DOMAIN[1]: hsd1.ca.comcast.net +IP6.ADDRESS[1]: 2601:641:482:9cc0::2d6d/128 +IP6.ADDRESS[2]: fe80::9263:6fcc:6db6:8b56/64 +IP6.GATEWAY: fe80::f88c:f4ff:fef1:d8f9 +IP6.ROUTE[1]: dst = fd29:95c1:bb51::/64, nh = fe80::1453:e8bf:c07a:2ca8, mt = 100 +IP6.ROUTE[2]: dst = 2601:641:482:9cc0::/60, nh = ::, mt = 100 +IP6.ROUTE[3]: dst = ::/0, nh = fe80::f88c:f4ff:fef1:d8f9, mt = 100 +IP6.ROUTE[4]: dst = ff00::/8, nh = ::, mt = 256, table=255 +IP6.ROUTE[5]: dst = fe80::/64, nh = ::, mt = 100 +IP6.ROUTE[6]: dst = 2601:641:482:9cc0::2d6d/128, nh = ::, mt = 100 +IP6.DNS[1]: 2001:558:feed::1 +IP6.DNS[2]: 2001:558:feed::2 diff --git a/tests/fixtures/fedora32/nmcli-device-show.json b/tests/fixtures/fedora32/nmcli-device-show.json new file mode 100644 index 00000000..9146c8fa --- /dev/null +++ b/tests/fixtures/fedora32/nmcli-device-show.json @@ -0,0 +1 @@ +[{"device":"ens33","type":"ethernet","hwaddr":"00:0C:29:66:16:68","mtu":1500,"state":100,"state_text":"connected","connection":"ens33","con_path":"/org/freedesktop/NetworkManager/ActiveConnection/2","wired_properties_carrier":"on","ip4_address_1":"10.0.0.178/24","ip4_gateway":"10.0.0.1","ip4_route_1":{"dst":"0.0.0.0/0","nh":"10.0.0.1","mt":100},"ip4_route_2":{"dst":"10.0.0.0/24","nh":"0.0.0.0","mt":100},"ip4_dns_1":"75.75.75.75","ip4_dns_2":"75.75.76.76","ip4_domain_1":"hsd1.ca.comcast.net","ip6_address_1":"2601:641:482:9cc0::2d6d/128","ip6_address_2":"fe80::9263:6fcc:6db6:8b56/64","ip6_gateway":"fe80::f88c:f4ff:fef1:d8f9","ip6_route_1":{"dst":"fd29:95c1:bb51::/64","nh":"fe80::1453:e8bf:c07a:2ca8","mt":100},"ip6_route_2":{"dst":"2601:641:482:9cc0::/60","nh":"::","mt":100},"ip6_route_3":{"dst":"::/0","nh":"fe80::f88c:f4ff:fef1:d8f9","mt":100},"ip6_route_4":{"dst":"ff00::/8","nh":"::","mt":256,"table":255},"ip6_route_5":{"dst":"fe80::/64","nh":"::","mt":100},"ip6_route_6":{"dst":"2601:641:482:9cc0::2d6d/128","nh":"::","mt":100},"ip6_dns_1":"2001:558:feed::1","ip6_dns_2":"2001:558:feed::2"},{"device":"lo","type":"loopback","hwaddr":"00:00:00:00:00:00","mtu":65536,"state":10,"state_text":"unmanaged","connection":null,"con_path":null,"ip4_address_1":"127.0.0.1/8","ip4_gateway":null,"ip6_address_1":"::1/128","ip6_gateway":null,"ip6_route_1":{"dst":"::1/128","nh":"::","mt":256}}] diff --git a/tests/fixtures/fedora32/nmcli-device-show.out b/tests/fixtures/fedora32/nmcli-device-show.out new file mode 100644 index 00000000..907d2786 --- /dev/null +++ b/tests/fixtures/fedora32/nmcli-device-show.out @@ -0,0 +1,39 @@ +GENERAL.DEVICE: ens33 +GENERAL.TYPE: ethernet +GENERAL.HWADDR: 00:0C:29:66:16:68 +GENERAL.MTU: 1500 +GENERAL.STATE: 100 (connected) +GENERAL.CONNECTION: ens33 +GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/2 +WIRED-PROPERTIES.CARRIER: on +IP4.ADDRESS[1]: 10.0.0.178/24 +IP4.GATEWAY: 10.0.0.1 +IP4.ROUTE[1]: dst = 0.0.0.0/0, nh = 10.0.0.1, mt = 100 +IP4.ROUTE[2]: dst = 10.0.0.0/24, nh = 0.0.0.0, mt = 100 +IP4.DNS[1]: 75.75.75.75 +IP4.DNS[2]: 75.75.76.76 +IP4.DOMAIN[1]: hsd1.ca.comcast.net +IP6.ADDRESS[1]: 2601:641:482:9cc0::2d6d/128 +IP6.ADDRESS[2]: fe80::9263:6fcc:6db6:8b56/64 +IP6.GATEWAY: fe80::f88c:f4ff:fef1:d8f9 +IP6.ROUTE[1]: dst = fd29:95c1:bb51::/64, nh = fe80::1453:e8bf:c07a:2ca8, mt = 100 +IP6.ROUTE[2]: dst = 2601:641:482:9cc0::/60, nh = ::, mt = 100 +IP6.ROUTE[3]: dst = ::/0, nh = fe80::f88c:f4ff:fef1:d8f9, mt = 100 +IP6.ROUTE[4]: dst = ff00::/8, nh = ::, mt = 256, table=255 +IP6.ROUTE[5]: dst = fe80::/64, nh = ::, mt = 100 +IP6.ROUTE[6]: dst = 2601:641:482:9cc0::2d6d/128, nh = ::, mt = 100 +IP6.DNS[1]: 2001:558:feed::1 +IP6.DNS[2]: 2001:558:feed::2 + +GENERAL.DEVICE: lo +GENERAL.TYPE: loopback +GENERAL.HWADDR: 00:00:00:00:00:00 +GENERAL.MTU: 65536 +GENERAL.STATE: 10 (unmanaged) +GENERAL.CONNECTION: -- +GENERAL.CON-PATH: -- +IP4.ADDRESS[1]: 127.0.0.1/8 +IP4.GATEWAY: -- +IP6.ADDRESS[1]: ::1/128 +IP6.GATEWAY: -- +IP6.ROUTE[1]: dst = ::1/128, nh = ::, mt = 256 diff --git a/tests/test_nmcli.py b/tests/test_nmcli.py index b0f75718..22248af1 100644 --- a/tests/test_nmcli.py +++ b/tests/test_nmcli.py @@ -44,6 +44,15 @@ class MyTests(unittest.TestCase): with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/nmcli-general-permissions.out'), 'r', encoding='utf-8') as f: self.centos_7_7_nmcli_general_permissions = f.read() + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/fedora32/nmcli-connection-show-ens33.out'), 'r', encoding='utf-8') as f: + self.fedora32_nmcli_connection_show_ens33 = f.read() + + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/fedora32/nmcli-device-show-ens33.out'), 'r', encoding='utf-8') as f: + self.fedora32_nmcli_device_show_ens33 = f.read() + + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/fedora32/nmcli-device-show.out'), 'r', encoding='utf-8') as f: + self.fedora32_nmcli_device_show = f.read() + # output with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/nmcli-connection-all.json'), 'r', encoding='utf-8') as f: @@ -76,6 +85,15 @@ class MyTests(unittest.TestCase): with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/centos-7.7/nmcli-general-permissions.json'), 'r', encoding='utf-8') as f: self.centos_7_7_nmcli_general_permissions_json = json.loads(f.read()) + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/fedora32/nmcli-connection-show-ens33.json'), 'r', encoding='utf-8') as f: + self.fedora32_nmcli_connection_show_ens33_json = json.loads(f.read()) + + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/fedora32/nmcli-device-show-ens33.json'), 'r', encoding='utf-8') as f: + self.fedora32_nmcli_device_show_ens33_json = json.loads(f.read()) + + with open(os.path.join(THIS_DIR, os.pardir, 'tests/fixtures/fedora32/nmcli-device-show.json'), 'r', encoding='utf-8') as f: + self.fedora32_nmcli_device_show_json = json.loads(f.read()) + def test_nmcli_nodata(self): @@ -150,6 +168,24 @@ class MyTests(unittest.TestCase): """ self.assertEqual(jc.parsers.nmcli.parse(self.centos_7_7_nmcli_general_permissions, quiet=True), self.centos_7_7_nmcli_general_permissions_json) + def test_nmcli_connection_show_ens33_fedora32(self): + """ + Test 'nmcli connection show ens33' on fedora32 + """ + self.assertEqual(jc.parsers.nmcli.parse(self.fedora32_nmcli_connection_show_ens33, quiet=True), self.fedora32_nmcli_connection_show_ens33_json) + + def test_nmcli_device_show_ens33_fedora32(self): + """ + Test 'nmcli device show ens33' on fedora32 + """ + self.assertEqual(jc.parsers.nmcli.parse(self.fedora32_nmcli_device_show_ens33, quiet=True), self.fedora32_nmcli_device_show_ens33_json) + + def test_nmcli_device_show_ens33_fedora32(self): + """ + Test 'nmcli device show' on fedora32 + """ + self.assertEqual(jc.parsers.nmcli.parse(self.fedora32_nmcli_device_show, quiet=True), self.fedora32_nmcli_device_show_json) + if __name__ == '__main__': unittest.main()