-
I'm trying to do the equivalent of It appears I want to use Incidentally, if you omit |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Hello @auspex What exactly are you trying to call See examples that add new connections like I highly recommend running the type checker like mypy as it will tell you when you call something with wrong types. |
Beta Was this translation helpful? Give feedback.
-
That's not at all far from what I was doing, but using |
Beta Was this translation helpful? Give feedback.
-
Excellent, thank you. My solution, from your advice, was as simple as: profile = ConnectionProfile(
connection=ConnectionSettings(
autoconnect=True,
connection_id=container,
connection_type='macvlan',
interface_name=container
),
macvlan=MacvlanSettings(
parent=default_route,
mode=1 # vepa
),
ipv4=Ipv4Settings(
dhcp_hostname=container,
method='auto',
)
)
path = await NetworkManagerSettings().add_connection_unsaved(profile.to_dbus())
# Now, NetworkManager should have a profile, but you still have to activate it
await NM.activate_connection(path) (I couldn't find an enum for |
Beta Was this translation helpful? Give feedback.
Hello @auspex
What exactly are you trying to call
add_and_activate_connection
with? It is probably not a correct type.See examples that add new connections like
add-openvpn-connection-async.py
. The important part isconnection_type=ConnectionType.VPN.value
that you want to swap to macvlan andvpn=VpnSettings
that you want to swap formacvlan=MacvlanSettings(...
.I highly recommend running the type checker like mypy as it will tell you when you call something with wrong types.