devon-mar / nornir_routeros

https://nornir-routeros.readthedocs.io/en/latest/
Apache License 2.0
6 stars 2 forks source link

dashes in routeros_command problem #37

Open denisvorlov opened 1 year ago

denisvorlov commented 1 year ago

Hi, I'm faced with problem when I try to configure snmpv3 settings fro example using routeros_command

 task.run(
        task=routeros_command,
        path="/snmp/community",
        command="add",
        addresses="192.168.10.1",
        name="snmpv3user",
        read_access="yes",
        write_access="no",
        security="private",
        authentication-protocol="SHA1",
        authentication-password="auth_string",
        encryption-protocol="AES",
        encryption-password="encr_string"
)

As I understand, I can not use property names in task.run, that containes dash("-") symbol But ROS command parameters are containes dashes So how can I overcome this limitation? Can you clarify this moment please?

devon-mar commented 1 year ago

Hi, I'm faced with problem when I try to configure snmpv3 settings fro example using routeros_command

I think the routeros_config_item task is better suited for this use case.

So how can I overcome this limitation?

If you really want to use routeros_command, I think the following should work:

 task.run(
        task=routeros_command,
        path="/snmp/community",
        command="add",
        addresses="192.168.10.1",
        name="snmpv3user",
        read_access="yes",
        write_access="no",
        security="private",
        **{"authentication-protocol": "SHA1"},
)