clients/tests: test creating and activating VPN connection

This commit is contained in:
Thomas Haller 2018-06-05 20:23:31 +02:00
parent eceaba025f
commit 2e22c931f9
28 changed files with 1286 additions and 16 deletions

View file

@ -152,4 +152,29 @@ clients_tests_expected_files = \
clients/tests/test-client.check-on-disk/test_004-007.expected \
clients/tests/test-client.check-on-disk/test_004-008.expected \
clients/tests/test-client.check-on-disk/test_004-009.expected \
clients/tests/test-client.check-on-disk/test_004-010.expected \
clients/tests/test-client.check-on-disk/test_004-011.expected \
clients/tests/test-client.check-on-disk/test_004-012.expected \
clients/tests/test-client.check-on-disk/test_004-013.expected \
clients/tests/test-client.check-on-disk/test_004-014.expected \
clients/tests/test-client.check-on-disk/test_004-015.expected \
clients/tests/test-client.check-on-disk/test_004-016.expected \
clients/tests/test-client.check-on-disk/test_004-017.expected \
clients/tests/test-client.check-on-disk/test_004-018.expected \
clients/tests/test-client.check-on-disk/test_004-019.expected \
clients/tests/test-client.check-on-disk/test_004-020.expected \
clients/tests/test-client.check-on-disk/test_004-021.expected \
clients/tests/test-client.check-on-disk/test_004-022.expected \
clients/tests/test-client.check-on-disk/test_004-023.expected \
clients/tests/test-client.check-on-disk/test_004-024.expected \
clients/tests/test-client.check-on-disk/test_004-025.expected \
clients/tests/test-client.check-on-disk/test_004-026.expected \
clients/tests/test-client.check-on-disk/test_004-027.expected \
clients/tests/test-client.check-on-disk/test_004-028.expected \
clients/tests/test-client.check-on-disk/test_004-029.expected \
clients/tests/test-client.check-on-disk/test_004-030.expected \
clients/tests/test-client.check-on-disk/test_004-031.expected \
clients/tests/test-client.check-on-disk/test_004-032.expected \
clients/tests/test-client.check-on-disk/test_004-033.expected \
clients/tests/test-client.check-on-disk/test_004-034.expected \
$(NULL)

View file

@ -0,0 +1,13 @@
location: clients/tests/test-client.py:830:test_004()/10
cmd: $NMCLI connection add type vpn con-name con-vpn-1 ifname '*' vpn-type openvpn vpn.data 'key1 = val1, key2 = val2, key3=val3'
lang: C
returncode: 0
stdout: 82 bytes
>>>
Connection 'con-vpn-1' (UUID-con-vpn-1-REPLACED-REPLACED-REP) successfully added.
<<<
stderr: 0 bytes
>>>
<<<

View file

@ -0,0 +1,16 @@
location: clients/tests/test-client.py:833:test_004()/11
cmd: $NMCLI con s
lang: C
returncode: 0
stdout: 268 bytes
>>>
NAME UUID TYPE DEVICE
con-1 5fcfd6d7-1e63-3332-8826-a7eda103792d ethernet --
con-vpn-1 UUID-con-vpn-1-REPLACED-REPLACED-REP vpn --
con-xx1 UUID-con-xx1-REPLACED-REPLACED-REPLA wifi --
<<<
stderr: 0 bytes
>>>
<<<

View file

@ -0,0 +1,16 @@
location: clients/tests/test-client.py:833:test_004()/12
cmd: $NMCLI con s
lang: pl_PL.UTF-8
returncode: 0
stdout: 268 bytes
>>>
NAME UUID TYPE DEVICE
con-1 5fcfd6d7-1e63-3332-8826-a7eda103792d ethernet --
con-vpn-1 UUID-con-vpn-1-REPLACED-REPLACED-REP vpn --
con-xx1 UUID-con-xx1-REPLACED-REPLACED-REPLA wifi --
<<<
stderr: 0 bytes
>>>
<<<

View file

@ -0,0 +1,82 @@
location: clients/tests/test-client.py:835:test_004()/13
cmd: $NMCLI con s con-vpn-1
lang: C
returncode: 0
stdout: 3231 bytes
>>>
connection.id: con-vpn-1
connection.uuid: UUID-con-vpn-1-REPLACED-REPLACED-REP
connection.stable-id: --
connection.type: vpn
connection.interface-name: --
connection.autoconnect: yes
connection.autoconnect-priority: 0
connection.autoconnect-retries: -1 (default)
connection.auth-retries: -1
connection.timestamp: 0
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)
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.ignore-auto-routes: no
ipv4.ignore-auto-dns: no
ipv4.dhcp-client-id: --
ipv4.dhcp-timeout: 0 (default)
ipv4.dhcp-send-hostname: yes
ipv4.dhcp-hostname: --
ipv4.dhcp-fqdn: --
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.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.dhcp-send-hostname: yes
ipv6.dhcp-hostname: --
ipv6.token: --
vpn.service-type: org.freedesktop.NetworkManager.openvpn
vpn.user-name: --
vpn.data: key1 = val1, key2 = val2, key3 = val3
vpn.secrets: <hidden>
vpn.persistent: no
vpn.timeout: 0
proxy.method: none
proxy.browser-only: no
proxy.pac-url: --
proxy.pac-script: --
<<<
stderr: 0 bytes
>>>
<<<

View file

@ -0,0 +1,82 @@
location: clients/tests/test-client.py:835:test_004()/14
cmd: $NMCLI con s con-vpn-1
lang: pl_PL.UTF-8
returncode: 0
stdout: 3241 bytes
>>>
connection.id: con-vpn-1
connection.uuid: UUID-con-vpn-1-REPLACED-REPLACED-REP
connection.stable-id: --
connection.type: vpn
connection.interface-name: --
connection.autoconnect: tak
connection.autoconnect-priority: 0
connection.autoconnect-retries: -1 (default)
connection.auth-retries: -1
connection.timestamp: 0
connection.read-only: nie
connection.permissions: --
connection.zone: --
connection.master: --
connection.slave-type: --
connection.autoconnect-slaves: -1 (default)
connection.secondaries: --
connection.gateway-ping-timeout: 0
connection.metered: nieznane
connection.lldp: default
connection.mdns: -1 (default)
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.ignore-auto-routes: nie
ipv4.ignore-auto-dns: nie
ipv4.dhcp-client-id: --
ipv4.dhcp-timeout: 0 (default)
ipv4.dhcp-send-hostname: tak
ipv4.dhcp-hostname: --
ipv4.dhcp-fqdn: --
ipv4.never-default: nie
ipv4.may-fail: tak
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.ignore-auto-routes: nie
ipv6.ignore-auto-dns: nie
ipv6.never-default: nie
ipv6.may-fail: tak
ipv6.ip6-privacy: -1 (unknown)
ipv6.addr-gen-mode: stable-privacy
ipv6.dhcp-send-hostname: tak
ipv6.dhcp-hostname: --
ipv6.token: --
vpn.service-type: org.freedesktop.NetworkManager.openvpn
vpn.user-name: --
vpn.data: key1 = val1, key2 = val2, key3 = val3
vpn.secrets: <hidden>
vpn.persistent: nie
vpn.timeout: 0
proxy.method: none
proxy.browser-only: nie
proxy.pac-url: --
proxy.pac-script: --
<<<
stderr: 0 bytes
>>>
<<<

View file

@ -0,0 +1,13 @@
location: clients/tests/test-client.py:837:test_004()/15
cmd: $NMCLI con up con-xx1
lang: C
returncode: 0
stdout: 106 bytes
>>>
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/1)
<<<
stderr: 0 bytes
>>>
<<<

View file

@ -0,0 +1,16 @@
location: clients/tests/test-client.py:839:test_004()/16
cmd: $NMCLI con s
lang: C
returncode: 0
stdout: 268 bytes
>>>
NAME UUID TYPE DEVICE
con-xx1 UUID-con-xx1-REPLACED-REPLACED-REPLA wifi wlan0
con-1 5fcfd6d7-1e63-3332-8826-a7eda103792d ethernet --
con-vpn-1 UUID-con-vpn-1-REPLACED-REPLACED-REP vpn --
<<<
stderr: 0 bytes
>>>
<<<

View file

@ -0,0 +1,16 @@
location: clients/tests/test-client.py:839:test_004()/17
cmd: $NMCLI con s
lang: pl_PL.UTF-8
returncode: 0
stdout: 268 bytes
>>>
NAME UUID TYPE DEVICE
con-xx1 UUID-con-xx1-REPLACED-REPLACED-REPLA wifi wlan0
con-1 5fcfd6d7-1e63-3332-8826-a7eda103792d ethernet --
con-vpn-1 UUID-con-vpn-1-REPLACED-REPLACED-REP vpn --
<<<
stderr: 0 bytes
>>>
<<<

View file

@ -0,0 +1,13 @@
location: clients/tests/test-client.py:841:test_004()/18
cmd: $NMCLI con up con-vpn-1
lang: C
returncode: 0
stdout: 106 bytes
>>>
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/2)
<<<
stderr: 0 bytes
>>>
<<<

View file

@ -0,0 +1,16 @@
location: clients/tests/test-client.py:843:test_004()/19
cmd: $NMCLI con s
lang: C
returncode: 0
stdout: 268 bytes
>>>
NAME UUID TYPE DEVICE
con-vpn-1 UUID-con-vpn-1-REPLACED-REPLACED-REP vpn wlan0
con-xx1 UUID-con-xx1-REPLACED-REPLACED-REPLA wifi wlan0
con-1 5fcfd6d7-1e63-3332-8826-a7eda103792d ethernet --
<<<
stderr: 0 bytes
>>>
<<<

View file

@ -0,0 +1,16 @@
location: clients/tests/test-client.py:843:test_004()/20
cmd: $NMCLI con s
lang: pl_PL.UTF-8
returncode: 0
stdout: 268 bytes
>>>
NAME UUID TYPE DEVICE
con-vpn-1 UUID-con-vpn-1-REPLACED-REPLACED-REP vpn wlan0
con-xx1 UUID-con-xx1-REPLACED-REPLACED-REPLA wifi wlan0
con-1 5fcfd6d7-1e63-3332-8826-a7eda103792d ethernet --
<<<
stderr: 0 bytes
>>>
<<<

View file

@ -0,0 +1,102 @@
location: clients/tests/test-client.py:845:test_004()/21
cmd: $NMCLI con s con-vpn-1
lang: C
returncode: 0
stdout: 4283 bytes
>>>
connection.id: con-vpn-1
connection.uuid: UUID-con-vpn-1-REPLACED-REPLACED-REP
connection.stable-id: --
connection.type: vpn
connection.interface-name: --
connection.autoconnect: yes
connection.autoconnect-priority: 0
connection.autoconnect-retries: -1 (default)
connection.auth-retries: -1
connection.timestamp: 0
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)
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.ignore-auto-routes: no
ipv4.ignore-auto-dns: no
ipv4.dhcp-client-id: --
ipv4.dhcp-timeout: 0 (default)
ipv4.dhcp-send-hostname: yes
ipv4.dhcp-hostname: --
ipv4.dhcp-fqdn: --
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.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.dhcp-send-hostname: yes
ipv6.dhcp-hostname: --
ipv6.token: --
vpn.service-type: org.freedesktop.NetworkManager.openvpn
vpn.user-name: --
vpn.data: key1 = val1, key2 = val2, key3 = val3
vpn.secrets: <hidden>
vpn.persistent: no
vpn.timeout: 0
proxy.method: none
proxy.browser-only: no
proxy.pac-url: --
proxy.pac-script: --
GENERAL.NAME: con-vpn-1
GENERAL.UUID: UUID-con-vpn-1-REPLACED-REPLACED-REP
GENERAL.DEVICES: wlan0
GENERAL.STATE: activated
GENERAL.DEFAULT: no
GENERAL.DEFAULT6: no
GENERAL.SPEC-OBJECT: --
GENERAL.VPN: yes
GENERAL.DBUS-PATH: /org/freedesktop/NetworkManager/ActiveConnection/2
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/Settings/Connection/3
GENERAL.ZONE: --
GENERAL.MASTER-PATH: --
VPN.TYPE: openvpn
VPN.USERNAME: --
VPN.GATEWAY: --
VPN.BANNER: --
VPN.VPN-STATE: 0 - unknown
VPN.CFG[1]: key1 = val1
VPN.CFG[2]: key2 = val2
VPN.CFG[3]: key3 = val3
<<<
stderr: 0 bytes
>>>
<<<

View file

@ -0,0 +1,102 @@
location: clients/tests/test-client.py:845:test_004()/22
cmd: $NMCLI con s con-vpn-1
lang: pl_PL.UTF-8
returncode: 0
stdout: 4297 bytes
>>>
connection.id: con-vpn-1
connection.uuid: UUID-con-vpn-1-REPLACED-REPLACED-REP
connection.stable-id: --
connection.type: vpn
connection.interface-name: --
connection.autoconnect: tak
connection.autoconnect-priority: 0
connection.autoconnect-retries: -1 (default)
connection.auth-retries: -1
connection.timestamp: 0
connection.read-only: nie
connection.permissions: --
connection.zone: --
connection.master: --
connection.slave-type: --
connection.autoconnect-slaves: -1 (default)
connection.secondaries: --
connection.gateway-ping-timeout: 0
connection.metered: nieznane
connection.lldp: default
connection.mdns: -1 (default)
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.ignore-auto-routes: nie
ipv4.ignore-auto-dns: nie
ipv4.dhcp-client-id: --
ipv4.dhcp-timeout: 0 (default)
ipv4.dhcp-send-hostname: tak
ipv4.dhcp-hostname: --
ipv4.dhcp-fqdn: --
ipv4.never-default: nie
ipv4.may-fail: tak
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.ignore-auto-routes: nie
ipv6.ignore-auto-dns: nie
ipv6.never-default: nie
ipv6.may-fail: tak
ipv6.ip6-privacy: -1 (unknown)
ipv6.addr-gen-mode: stable-privacy
ipv6.dhcp-send-hostname: tak
ipv6.dhcp-hostname: --
ipv6.token: --
vpn.service-type: org.freedesktop.NetworkManager.openvpn
vpn.user-name: --
vpn.data: key1 = val1, key2 = val2, key3 = val3
vpn.secrets: <hidden>
vpn.persistent: nie
vpn.timeout: 0
proxy.method: none
proxy.browser-only: nie
proxy.pac-url: --
proxy.pac-script: --
GENERAL.NAME: con-vpn-1
GENERAL.UUID: UUID-con-vpn-1-REPLACED-REPLACED-REP
GENERAL.DEVICES: wlan0
GENERAL.STATE: aktywowano
GENERAL.DEFAULT: nie
GENERAL.DEFAULT6: nie
GENERAL.SPEC-OBJECT: --
GENERAL.VPN: tak
GENERAL.DBUS-PATH: /org/freedesktop/NetworkManager/ActiveConnection/2
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/Settings/Connection/3
GENERAL.ZONE: --
GENERAL.MASTER-PATH: --
VPN.TYPE: openvpn
VPN.USERNAME: --
VPN.GATEWAY: --
VPN.BANNER: --
VPN.VPN-STATE: 0 - nieznane
VPN.CFG[1]: key1 = val1
VPN.CFG[2]: key2 = val2
VPN.CFG[3]: key3 = val3
<<<
stderr: 0 bytes
>>>
<<<

View file

@ -0,0 +1,102 @@
location: clients/tests/test-client.py:854:test_004()/23
cmd: $NMCLI con s con-vpn-1
lang: C
returncode: 0
stdout: 4319 bytes
>>>
connection.id: con-vpn-1
connection.uuid: UUID-con-vpn-1-REPLACED-REPLACED-REP
connection.stable-id: --
connection.type: vpn
connection.interface-name: --
connection.autoconnect: yes
connection.autoconnect-priority: 0
connection.autoconnect-retries: -1 (default)
connection.auth-retries: -1
connection.timestamp: 0
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)
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.ignore-auto-routes: no
ipv4.ignore-auto-dns: no
ipv4.dhcp-client-id: --
ipv4.dhcp-timeout: 0 (default)
ipv4.dhcp-send-hostname: yes
ipv4.dhcp-hostname: --
ipv4.dhcp-fqdn: --
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.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.dhcp-send-hostname: yes
ipv6.dhcp-hostname: --
ipv6.token: --
vpn.service-type: org.freedesktop.NetworkManager.openvpn
vpn.user-name: --
vpn.data: key1 = val1, key2 = val2, key3 = val3
vpn.secrets: <hidden>
vpn.persistent: no
vpn.timeout: 0
proxy.method: none
proxy.browser-only: no
proxy.pac-url: --
proxy.pac-script: --
GENERAL.NAME: con-vpn-1
GENERAL.UUID: UUID-con-vpn-1-REPLACED-REPLACED-REP
GENERAL.DEVICES: wlan0
GENERAL.STATE: activated
GENERAL.DEFAULT: no
GENERAL.DEFAULT6: no
GENERAL.SPEC-OBJECT: --
GENERAL.VPN: yes
GENERAL.DBUS-PATH: /org/freedesktop/NetworkManager/ActiveConnection/2
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/Settings/Connection/3
GENERAL.ZONE: --
GENERAL.MASTER-PATH: --
VPN.TYPE: openvpn
VPN.USERNAME: --
VPN.GATEWAY: --
VPN.BANNER: *** VPN connection con-vpn-1 ***
VPN.VPN-STATE: 5 - VPN connected
VPN.CFG[1]: key1 = val1
VPN.CFG[2]: key2 = val2
VPN.CFG[3]: key3 = val3
<<<
stderr: 0 bytes
>>>
<<<

View file

@ -0,0 +1,102 @@
location: clients/tests/test-client.py:854:test_004()/24
cmd: $NMCLI con s con-vpn-1
lang: pl_PL.UTF-8
returncode: 0
stdout: 4337 bytes
>>>
connection.id: con-vpn-1
connection.uuid: UUID-con-vpn-1-REPLACED-REPLACED-REP
connection.stable-id: --
connection.type: vpn
connection.interface-name: --
connection.autoconnect: tak
connection.autoconnect-priority: 0
connection.autoconnect-retries: -1 (default)
connection.auth-retries: -1
connection.timestamp: 0
connection.read-only: nie
connection.permissions: --
connection.zone: --
connection.master: --
connection.slave-type: --
connection.autoconnect-slaves: -1 (default)
connection.secondaries: --
connection.gateway-ping-timeout: 0
connection.metered: nieznane
connection.lldp: default
connection.mdns: -1 (default)
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.ignore-auto-routes: nie
ipv4.ignore-auto-dns: nie
ipv4.dhcp-client-id: --
ipv4.dhcp-timeout: 0 (default)
ipv4.dhcp-send-hostname: tak
ipv4.dhcp-hostname: --
ipv4.dhcp-fqdn: --
ipv4.never-default: nie
ipv4.may-fail: tak
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.ignore-auto-routes: nie
ipv6.ignore-auto-dns: nie
ipv6.never-default: nie
ipv6.may-fail: tak
ipv6.ip6-privacy: -1 (unknown)
ipv6.addr-gen-mode: stable-privacy
ipv6.dhcp-send-hostname: tak
ipv6.dhcp-hostname: --
ipv6.token: --
vpn.service-type: org.freedesktop.NetworkManager.openvpn
vpn.user-name: --
vpn.data: key1 = val1, key2 = val2, key3 = val3
vpn.secrets: <hidden>
vpn.persistent: nie
vpn.timeout: 0
proxy.method: none
proxy.browser-only: nie
proxy.pac-url: --
proxy.pac-script: --
GENERAL.NAME: con-vpn-1
GENERAL.UUID: UUID-con-vpn-1-REPLACED-REPLACED-REP
GENERAL.DEVICES: wlan0
GENERAL.STATE: aktywowano
GENERAL.DEFAULT: nie
GENERAL.DEFAULT6: nie
GENERAL.SPEC-OBJECT: --
GENERAL.VPN: tak
GENERAL.DBUS-PATH: /org/freedesktop/NetworkManager/ActiveConnection/2
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/Settings/Connection/3
GENERAL.ZONE: --
GENERAL.MASTER-PATH: --
VPN.TYPE: openvpn
VPN.USERNAME: --
VPN.GATEWAY: --
VPN.BANNER: *** VPN connection con-vpn-1 ***
VPN.VPN-STATE: 5 - Połączono z VPN
VPN.CFG[1]: key1 = val1
VPN.CFG[2]: key2 = val2
VPN.CFG[3]: key3 = val3
<<<
stderr: 0 bytes
>>>
<<<

View file

@ -0,0 +1,82 @@
location: clients/tests/test-client.py:857:test_004()/25
cmd: $NMCLI -f ALL con s con-vpn-1
lang: C
returncode: 0
stdout: 3231 bytes
>>>
connection.id: con-vpn-1
connection.uuid: UUID-con-vpn-1-REPLACED-REPLACED-REP
connection.stable-id: --
connection.type: vpn
connection.interface-name: --
connection.autoconnect: yes
connection.autoconnect-priority: 0
connection.autoconnect-retries: -1 (default)
connection.auth-retries: -1
connection.timestamp: 0
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)
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.ignore-auto-routes: no
ipv4.ignore-auto-dns: no
ipv4.dhcp-client-id: --
ipv4.dhcp-timeout: 0 (default)
ipv4.dhcp-send-hostname: yes
ipv4.dhcp-hostname: --
ipv4.dhcp-fqdn: --
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.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.dhcp-send-hostname: yes
ipv6.dhcp-hostname: --
ipv6.token: --
vpn.service-type: org.freedesktop.NetworkManager.openvpn
vpn.user-name: --
vpn.data: key1 = val1, key2 = val2, key3 = val3
vpn.secrets: <hidden>
vpn.persistent: no
vpn.timeout: 0
proxy.method: none
proxy.browser-only: no
proxy.pac-url: --
proxy.pac-script: --
<<<
stderr: 0 bytes
>>>
<<<

View file

@ -0,0 +1,82 @@
location: clients/tests/test-client.py:857:test_004()/26
cmd: $NMCLI -f ALL con s con-vpn-1
lang: pl_PL.UTF-8
returncode: 0
stdout: 3241 bytes
>>>
connection.id: con-vpn-1
connection.uuid: UUID-con-vpn-1-REPLACED-REPLACED-REP
connection.stable-id: --
connection.type: vpn
connection.interface-name: --
connection.autoconnect: tak
connection.autoconnect-priority: 0
connection.autoconnect-retries: -1 (default)
connection.auth-retries: -1
connection.timestamp: 0
connection.read-only: nie
connection.permissions: --
connection.zone: --
connection.master: --
connection.slave-type: --
connection.autoconnect-slaves: -1 (default)
connection.secondaries: --
connection.gateway-ping-timeout: 0
connection.metered: nieznane
connection.lldp: default
connection.mdns: -1 (default)
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.ignore-auto-routes: nie
ipv4.ignore-auto-dns: nie
ipv4.dhcp-client-id: --
ipv4.dhcp-timeout: 0 (default)
ipv4.dhcp-send-hostname: tak
ipv4.dhcp-hostname: --
ipv4.dhcp-fqdn: --
ipv4.never-default: nie
ipv4.may-fail: tak
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.ignore-auto-routes: nie
ipv6.ignore-auto-dns: nie
ipv6.never-default: nie
ipv6.may-fail: tak
ipv6.ip6-privacy: -1 (unknown)
ipv6.addr-gen-mode: stable-privacy
ipv6.dhcp-send-hostname: tak
ipv6.dhcp-hostname: --
ipv6.token: --
vpn.service-type: org.freedesktop.NetworkManager.openvpn
vpn.user-name: --
vpn.data: key1 = val1, key2 = val2, key3 = val3
vpn.secrets: <hidden>
vpn.persistent: nie
vpn.timeout: 0
proxy.method: none
proxy.browser-only: nie
proxy.pac-url: --
proxy.pac-script: --
<<<
stderr: 0 bytes
>>>
<<<

View file

@ -0,0 +1,18 @@
location: clients/tests/test-client.py:863:test_004()/27
cmd: $NMCLI -f VPN con s con-vpn-1
lang: C
returncode: 0
stdout: 334 bytes
>>>
vpn.service-type: org.freedesktop.NetworkManager.openvpn
vpn.user-name: --
vpn.data: key1 = val1, key2 = val2, key3 = val3
vpn.secrets: <hidden>
vpn.persistent: no
vpn.timeout: 0
<<<
stderr: 0 bytes
>>>
<<<

View file

@ -0,0 +1,18 @@
location: clients/tests/test-client.py:863:test_004()/28
cmd: $NMCLI -f VPN con s con-vpn-1
lang: pl_PL.UTF-8
returncode: 0
stdout: 335 bytes
>>>
vpn.service-type: org.freedesktop.NetworkManager.openvpn
vpn.user-name: --
vpn.data: key1 = val1, key2 = val2, key3 = val3
vpn.secrets: <hidden>
vpn.persistent: nie
vpn.timeout: 0
<<<
stderr: 0 bytes
>>>
<<<

View file

@ -0,0 +1,24 @@
location: clients/tests/test-client.py:866:test_004()/29
cmd: $NMCLI -f GENERAL con s con-vpn-1
lang: C
returncode: 0
stdout: 667 bytes
>>>
GENERAL.NAME: con-vpn-1
GENERAL.UUID: UUID-con-vpn-1-REPLACED-REPLACED-REP
GENERAL.DEVICES: wlan0
GENERAL.STATE: activated
GENERAL.DEFAULT: no
GENERAL.DEFAULT6: no
GENERAL.SPEC-OBJECT: --
GENERAL.VPN: yes
GENERAL.DBUS-PATH: /org/freedesktop/NetworkManager/ActiveConnection/2
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/Settings/Connection/3
GENERAL.ZONE: --
GENERAL.MASTER-PATH: --
<<<
stderr: 0 bytes
>>>
<<<

View file

@ -0,0 +1,24 @@
location: clients/tests/test-client.py:866:test_004()/30
cmd: $NMCLI -f GENERAL con s con-vpn-1
lang: pl_PL.UTF-8
returncode: 0
stdout: 670 bytes
>>>
GENERAL.NAME: con-vpn-1
GENERAL.UUID: UUID-con-vpn-1-REPLACED-REPLACED-REP
GENERAL.DEVICES: wlan0
GENERAL.STATE: aktywowano
GENERAL.DEFAULT: nie
GENERAL.DEFAULT6: nie
GENERAL.SPEC-OBJECT: --
GENERAL.VPN: tak
GENERAL.DBUS-PATH: /org/freedesktop/NetworkManager/ActiveConnection/2
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/Settings/Connection/3
GENERAL.ZONE: --
GENERAL.MASTER-PATH: --
<<<
stderr: 0 bytes
>>>
<<<

View file

@ -0,0 +1,19 @@
location: clients/tests/test-client.py:869:test_004()/31
cmd: $NMCLI dev show wlan0
lang: C
returncode: 0
stdout: 389 bytes
>>>
GENERAL.DEVICE: wlan0
GENERAL.TYPE: wifi
GENERAL.HWADDR: 5A:88:5E:B6:90:40
GENERAL.MTU: 0
GENERAL.STATE: 20 (unavailable)
GENERAL.CONNECTION: con-vpn-1
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/2
<<<
stderr: 0 bytes
>>>
<<<

View file

@ -0,0 +1,19 @@
location: clients/tests/test-client.py:869:test_004()/32
cmd: $NMCLI dev show wlan0
lang: pl_PL.UTF-8
returncode: 0
stdout: 390 bytes
>>>
GENERAL.DEVICE: wlan0
GENERAL.TYPE: wifi
GENERAL.HWADDR: 5A:88:5E:B6:90:40
GENERAL.MTU: 0
GENERAL.STATE: 20 (niedostępne)
GENERAL.CONNECTION: con-vpn-1
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/2
<<<
stderr: 0 bytes
>>>
<<<

View file

@ -0,0 +1,74 @@
location: clients/tests/test-client.py:872:test_004()/33
cmd: $NMCLI -f all dev show wlan0
lang: C
returncode: 0
stdout: 2948 bytes
>>>
GENERAL.DEVICE: wlan0
GENERAL.TYPE: wifi
GENERAL.NM-TYPE: NMDeviceWifi
GENERAL.VENDOR: --
GENERAL.PRODUCT: --
GENERAL.DRIVER: virtual
GENERAL.DRIVER-VERSION: --
GENERAL.FIRMWARE-VERSION: --
GENERAL.HWADDR: 5A:88:5E:B6:90:40
GENERAL.MTU: 0
GENERAL.STATE: 20 (unavailable)
GENERAL.REASON: 0 (No reason given)
GENERAL.UDI: /sys/devices/virtual/wlan0
GENERAL.IP-IFACE: --
GENERAL.IS-SOFTWARE: no
GENERAL.NM-MANAGED: yes
GENERAL.AUTOCONNECT: yes
GENERAL.FIRMWARE-MISSING: no
GENERAL.NM-PLUGIN-MISSING: no
GENERAL.PHYS-PORT-ID: --
GENERAL.CONNECTION: con-vpn-1
GENERAL.CON-UUID: UUID-con-vpn-1-REPLACED-REPLACED-REP
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/2
GENERAL.METERED: unknown
CAPABILITIES.CARRIER-DETECT: no
CAPABILITIES.SPEED: unknown
CAPABILITIES.IS-SOFTWARE: no
CAPABILITIES.SRIOV: no
WIFI-PROPERTIES.WEP: yes
WIFI-PROPERTIES.WPA: yes
WIFI-PROPERTIES.WPA2: yes
WIFI-PROPERTIES.TKIP: yes
WIFI-PROPERTIES.CCMP: yes
WIFI-PROPERTIES.AP: yes
WIFI-PROPERTIES.ADHOC: yes
WIFI-PROPERTIES.2GHZ: unknown
WIFI-PROPERTIES.5GHZ: unknown
AP[1].IN-USE:
AP[1].SSID: wlan0-ap-3
AP[1].MODE: Infra
AP[1].CHAN: 1
AP[1].RATE: 54 Mbit/s
AP[1].SIGNAL: 88
AP[1].BARS: ****
AP[1].SECURITY: WPA1 WPA2
AP[2].IN-USE:
AP[2].SSID: wlan0-ap-2
AP[2].MODE: Infra
AP[2].CHAN: 1
AP[2].RATE: 54 Mbit/s
AP[2].SIGNAL: 61
AP[2].BARS: ***
AP[2].SECURITY: WPA1 WPA2
AP[3].IN-USE:
AP[3].SSID: wlan0-ap-1
AP[3].MODE: Infra
AP[3].CHAN: 1
AP[3].RATE: 54 Mbit/s
AP[3].SIGNAL: 29
AP[3].BARS: *
AP[3].SECURITY: WPA1 WPA2
CONNECTIONS.AVAILABLE-CONNECTION-PATHS: --
<<<
stderr: 0 bytes
>>>
<<<

View file

@ -0,0 +1,74 @@
location: clients/tests/test-client.py:872:test_004()/34
cmd: $NMCLI -f all dev show wlan0
lang: pl_PL.UTF-8
returncode: 0
stdout: 2991 bytes
>>>
GENERAL.DEVICE: wlan0
GENERAL.TYPE: wifi
GENERAL.NM-TYPE: NMDeviceWifi
GENERAL.VENDOR: --
GENERAL.PRODUCT: --
GENERAL.DRIVER: virtual
GENERAL.DRIVER-VERSION: --
GENERAL.FIRMWARE-VERSION: --
GENERAL.HWADDR: 5A:88:5E:B6:90:40
GENERAL.MTU: 0
GENERAL.STATE: 20 (niedostępne)
GENERAL.REASON: 0 (Nie podano przyczyny)
GENERAL.UDI: /sys/devices/virtual/wlan0
GENERAL.IP-IFACE: --
GENERAL.IS-SOFTWARE: nie
GENERAL.NM-MANAGED: tak
GENERAL.AUTOCONNECT: tak
GENERAL.FIRMWARE-MISSING: nie
GENERAL.NM-PLUGIN-MISSING: nie
GENERAL.PHYS-PORT-ID: --
GENERAL.CONNECTION: con-vpn-1
GENERAL.CON-UUID: UUID-con-vpn-1-REPLACED-REPLACED-REP
GENERAL.CON-PATH: /org/freedesktop/NetworkManager/ActiveConnection/2
GENERAL.METERED: nieznane
CAPABILITIES.CARRIER-DETECT: nie
CAPABILITIES.SPEED: nieznane
CAPABILITIES.IS-SOFTWARE: nie
CAPABILITIES.SRIOV: nie
WIFI-PROPERTIES.WEP: tak
WIFI-PROPERTIES.WPA: tak
WIFI-PROPERTIES.WPA2: tak
WIFI-PROPERTIES.TKIP: tak
WIFI-PROPERTIES.CCMP: tak
WIFI-PROPERTIES.AP: tak
WIFI-PROPERTIES.ADHOC: tak
WIFI-PROPERTIES.2GHZ: nieznane
WIFI-PROPERTIES.5GHZ: nieznane
AP[1].IN-USE:
AP[1].SSID: wlan0-ap-3
AP[1].MODE: Infrastruktura
AP[1].CHAN: 1
AP[1].RATE: 54Mb/s
AP[1].SIGNAL: 88
AP[1].BARS: ****
AP[1].SECURITY: WPA1 WPA2
AP[2].IN-USE:
AP[2].SSID: wlan0-ap-2
AP[2].MODE: Infrastruktura
AP[2].CHAN: 1
AP[2].RATE: 54Mb/s
AP[2].SIGNAL: 61
AP[2].BARS: ***
AP[2].SECURITY: WPA1 WPA2
AP[3].IN-USE:
AP[3].SSID: wlan0-ap-1
AP[3].MODE: Infrastruktura
AP[3].CHAN: 1
AP[3].RATE: 54Mb/s
AP[3].SIGNAL: 29
AP[3].BARS: *
AP[3].SECURITY: WPA1 WPA2
CONNECTIONS.AVAILABLE-CONNECTION-PATHS: --
<<<
stderr: 0 bytes
>>>
<<<

View file

@ -822,6 +822,54 @@ class TestNmcli(NmTestBase):
self.call_nmcli_l(['con', 's', 'con-xx1'],
replace_stdout = replace_stdout)
self.async_wait()
replace_stdout.append((lambda: self.srv.findConnectionUuid('con-vpn-1'), 'UUID-con-vpn-1-REPLACED-REPLACED-REP'))
self.call_nmcli(['connection', 'add', 'type', 'vpn', 'con-name', 'con-vpn-1', 'ifname', '*', 'vpn-type', 'openvpn', 'vpn.data', 'key1 = val1, key2 = val2, key3=val3'],
replace_stdout = replace_stdout)
self.call_nmcli_l(['con', 's'],
replace_stdout = replace_stdout)
self.call_nmcli_l(['con', 's', 'con-vpn-1'],
replace_stdout = replace_stdout)
self.call_nmcli(['con', 'up', 'con-xx1'])
self.call_nmcli_l(['con', 's'],
replace_stdout = replace_stdout)
self.call_nmcli(['con', 'up', 'con-vpn-1'])
self.call_nmcli_l(['con', 's'],
replace_stdout = replace_stdout)
self.call_nmcli_l(['con', 's', 'con-vpn-1'],
replace_stdout = replace_stdout)
self.async_wait()
self.srv.setProperty('/org/freedesktop/NetworkManager/ActiveConnection/2',
'VpnState',
dbus.UInt32(NM.VpnConnectionState.ACTIVATED))
self.call_nmcli_l(['con', 's', 'con-vpn-1'],
replace_stdout = replace_stdout)
self.call_nmcli_l(['-f', 'ALL', 'con', 's', 'con-vpn-1'],
replace_stdout = replace_stdout)
# This only filters 'vpn' settings from the connection profile.
# Contrary to '-f GENERAL' below, it does not show the properties of
# the activated VPN connection. This is a nmcli bug.
self.call_nmcli_l(['-f', 'VPN', 'con', 's', 'con-vpn-1'],
replace_stdout = replace_stdout)
self.call_nmcli_l(['-f', 'GENERAL', 'con', 's', 'con-vpn-1'],
replace_stdout = replace_stdout)
self.call_nmcli_l(['dev', 'show', 'wlan0'],
replace_stdout = replace_stdout)
self.call_nmcli_l(['-f', 'all', 'dev', 'show', 'wlan0'],
replace_stdout = replace_stdout)
###############################################################################

View file

@ -148,6 +148,7 @@ IFACE_VLAN = 'org.freedesktop.NetworkManager.Device.Vlan'
IFACE_WIFI_AP = 'org.freedesktop.NetworkManager.AccessPoint'
IFACE_WIMAX_NSP = 'org.freedesktop.NetworkManager.WiMax.Nsp'
IFACE_ACTIVE_CONNECTION = 'org.freedesktop.NetworkManager.Connection.Active'
IFACE_VPN_CONNECTION = 'org.freedesktop.NetworkManager.VPN.Connection'
IFACE_DNS_MANAGER = 'org.freedesktop.NetworkManager.DnsManager'
IFACE_OBJECT_MANAGER = 'org.freedesktop.DBus.ObjectManager'
@ -288,7 +289,8 @@ class NmUtil:
if t not in [ NM.SETTING_WIRED_SETTING_NAME,
NM.SETTING_WIRELESS_SETTING_NAME,
NM.SETTING_VLAN_SETTING_NAME,
NM.SETTING_WIMAX_SETTING_NAME ]:
NM.SETTING_WIMAX_SETTING_NAME,
NM.SETTING_VPN_SETTING_NAME ]:
raise BusErr.InvalidPropertyException('connection.type: unsupported connection type "%s"' % (t))
try:
@ -312,6 +314,14 @@ class NmUtil:
return s_con[NM.SETTING_CONNECTION_UUID]
return None
@staticmethod
def con_hash_get_type(con_hash):
if NM.SETTING_CONNECTION_SETTING_NAME in con_hash:
s_con = con_hash[NM.SETTING_CONNECTION_SETTING_NAME]
if NM.SETTING_CONNECTION_TYPE in s_con:
return s_con[NM.SETTING_CONNECTION_TYPE]
return None
###############################################################################
class ExportedObj(dbus.service.Object):
@ -409,11 +419,17 @@ class ExportedObj(dbus.service.Object):
if propname not in props:
raise TestError("No property '%s' on '%s' on '%s'" % (propname, dbus_iface, self.path))
if isinstance(self, ActiveConnection) \
and dbus_iface == 'org.freedesktop.NetworkManager.Connection.Active' \
and propname == 'State':
return
else:
permission_granted = False
if isinstance(self, ActiveConnection):
if dbus_iface == IFACE_ACTIVE_CONNECTION:
if propname == PRP_ACTIVE_CONNECTION_STATE:
permission_granted = True
elif dbus_iface == IFACE_VPN_CONNECTION:
if propname == PRP_VPN_CONNECTION_VPN_STATE:
permission_granted = True
if not permission_granted:
raise TestError("Cannot set property '%s' on '%s' on '%s' via D-Bus" % (propname, dbus_iface, self.path))
assert propname in props
@ -845,6 +861,9 @@ PRP_ACTIVE_CONNECTION_DHCP6CONFIG = "Dhcp6Config"
PRP_ACTIVE_CONNECTION_VPN = "Vpn"
PRP_ACTIVE_CONNECTION_MASTER = "Master"
PRP_VPN_CONNECTION_VPN_STATE = 'VpnState'
PRP_VPN_CONNECTION_BANNER = 'Banner'
class ActiveConnection(ExportedObj):
path_counter_next = 1
@ -852,10 +871,13 @@ class ActiveConnection(ExportedObj):
def __init__(self, device, con_inst, specific_object):
is_vpn = (NmUtil.con_hash_get_type(con_inst.con_hash) == NM.SETTING_VPN_SETTING_NAME)
ExportedObj.__init__(self, ExportedObj.create_path(ActiveConnection))
self.device = device
self.con_inst = con_inst
self.is_vpn = is_vpn
self._activation_id = None
@ -875,12 +897,21 @@ class ActiveConnection(ExportedObj):
PRP_ACTIVE_CONNECTION_DEFAULT6: False,
PRP_ACTIVE_CONNECTION_IP6CONFIG: ExportedObj.to_path(None),
PRP_ACTIVE_CONNECTION_DHCP6CONFIG: ExportedObj.to_path(None),
PRP_ACTIVE_CONNECTION_VPN: False,
PRP_ACTIVE_CONNECTION_VPN: is_vpn,
PRP_ACTIVE_CONNECTION_MASTER: ExportedObj.to_path(None),
}
self.dbus_interface_add(IFACE_ACTIVE_CONNECTION, props, ActiveConnection.PropertiesChanged)
if is_vpn:
props = {
PRP_VPN_CONNECTION_VPN_STATE: dbus.UInt32(NM.VpnConnectionState.UNKNOWN),
PRP_VPN_CONNECTION_BANNER: '*** VPN connection %s ***' % (con_inst.get_id()),
}
self.dbus_interface_add(IFACE_VPN_CONNECTION, props, ActiveConnection.VpnPropertiesChanged)
def _set_state(self, state, reason):
state = dbus.UInt32(state)
self._dbus_property_set(IFACE_ACTIVE_CONNECTION, PRP_ACTIVE_CONNECTION_STATE, state)
@ -910,6 +941,11 @@ class ActiveConnection(ExportedObj):
assert self._activation_id is None
self._activation_id = GLib.timeout_add(50, self._activation_step1)
@dbus.service.signal(IFACE_VPN_CONNECTION, signature='a{sv}')
def PropertiesChanged(self, changed):
pass
VpnPropertiesChanged = PropertiesChanged
@dbus.service.signal(IFACE_ACTIVE_CONNECTION, signature='a{sv}')
def PropertiesChanged(self, changed):
pass
@ -918,6 +954,10 @@ class ActiveConnection(ExportedObj):
def StateChanged(self, state, reason):
pass
@dbus.service.signal(IFACE_VPN_CONNECTION, signature='uu')
def VpnStateChanged(self, state, reason):
pass
###############################################################################
PRP_NM_DEVICES = 'Devices'
@ -994,13 +1034,26 @@ class NetworkManager(ExportedObj):
raise BusErr.UnknownConnectionException("Connection not found")
con_hash = con_inst.con_hash
s_con = con_hash[NM.SETTING_CONNECTION_SETTING_NAME]
con_type = NmUtil.con_hash_get_type(con_hash)
device = self.find_device_first(path = devpath)
if not device and s_con[NM.SETTING_CONNECTION_TYPE] == NM.SETTING_VLAN_SETTING_NAME:
ifname = s_con['interface-name']
device = VlanDevice(ifname)
self.add_device(device)
if not device:
if con_type == NM.SETTING_WIRED_SETTING_NAME:
device = self.find_device_first(dev_type = WiredDevice)
elif con_type == NM.SETTING_WIRELESS_SETTING_NAME:
device = self.find_device_first(dev_type = WifiDevice)
elif con_type == NM.SETTING_VLAN_SETTING_NAME:
ifname = con_hash[NM.SETTING_CONNECTION_SETTING_NAME]['interface-name']
device = VlanDevice(ifname)
self.add_device(device)
elif con_type == NM.SETTING_VPN_SETTING_NAME:
for ac in self.active_connections:
if ac.is_vpn:
continue
if ac.device:
device = ac.device
break
if not device:
raise BusErr.UnknownDeviceException("No device found for the requested iface.")
@ -1020,7 +1073,7 @@ class NetworkManager(ExportedObj):
ac = ActiveConnection(device, con_inst, None)
self.active_connection_add(ac)
if s_con[NM.SETTING_CONNECTION_ID] == 'object-creation-failed-test':
if NmUtil.con_hash_get_id(con_hash) == 'object-creation-failed-test':
# FIXME: this is not the right test, to delete the active-connection
# before returning it. It's the wrong order of what NetworkManager
# would do.
@ -1096,7 +1149,7 @@ class NetworkManager(ExportedObj):
def DeviceAdded(self, devpath):
pass
def find_devices(self, ident = _DEFAULT_ARG, path = _DEFAULT_ARG, iface = _DEFAULT_ARG, ip_iface = _DEFAULT_ARG):
def find_devices(self, ident = _DEFAULT_ARG, path = _DEFAULT_ARG, iface = _DEFAULT_ARG, ip_iface = _DEFAULT_ARG, dev_type = _DEFAULT_ARG):
r = None
for d in self.devices:
if ident is not _DEFAULT_ARG:
@ -1112,11 +1165,14 @@ class NetworkManager(ExportedObj):
# ignore iface/ip_iface distinction for now
if d.iface != ip_iface:
continue
if dev_type is not _DEFAULT_ARG:
if not isinstance(d, dev_type):
continue
yield d
def find_device_first(self, ident = _DEFAULT_ARG, path = _DEFAULT_ARG, iface = _DEFAULT_ARG, ip_iface = _DEFAULT_ARG, require = None):
def find_device_first(self, ident = _DEFAULT_ARG, path = _DEFAULT_ARG, iface = _DEFAULT_ARG, ip_iface = _DEFAULT_ARG, dev_type = _DEFAULT_ARG, require = None):
r = None
for d in self.find_devices(ident = ident, path = path, iface = iface, ip_iface = ip_iface):
for d in self.find_devices(ident = ident, path = path, iface = iface, ip_iface = ip_iface, dev_type = dev_type):
r = d
break
if r is None and require: