aos-switch-ansible-collection icon indicating copy to clipboard operation
aos-switch-ansible-collection copied to clipboard

arubaoss_interface.py - missleading example

Open Bernhardvleen opened this issue 2 years ago • 8 comments

Hi, when configuring interfaces, we can not set state enabled - there is an option admin_stat, but I am not sure what admin_stat exactly does.

from examples section:

  • name: delete qos from port arubaoss_interface: interface: 5 qos_policy: "my_qos" enable: False

yields error message:

"msg": "Unsupported parameters for (arubaoss_interface) module: enable. Supported parameters include: interface, api_version, username, acl_type, qos_policy, host, acl_id, provider, admin_stat, qos_direction, state, use_ssl, validate_certs, ssh_keyfile, description, port, timeout, password, acl_direction."

in switch config we can put keyword disable (enable most likely is default)

please advice how can we set an interface to disabled state within playbook using this collection and interface module? maybe you can give me a hint where to find some documentation about the option admin_stat as well, so we can make sure there is no overlap / confusion from this.

I guess it is state - we can set to delete or create while create is default. is delete the same as disable?

many thanks in advance!

Bernhardvleen avatar Aug 29 '22 13:08 Bernhardvleen

Yes, there is an error on example

can you try

state: delete

?

admin_stat is for admin port tatus

alagoutte avatar Aug 29 '22 13:08 alagoutte

I tried using state: delete - unfortunately it does not yield the disabled line in the resulting config on the switch for me..

Bernhardvleen avatar Aug 30 '22 10:08 Bernhardvleen

I tried using state: delete - unfortunately it does not yield the disabled line in the resulting config on the switch for me..

What the result ?

alagoutte avatar Aug 30 '22 19:08 alagoutte

from ansible-playbook run with verbosity I can see that we send:

"state": "delete",

but after that we get back:

"is_port_enabled": true,

(see the whole response below)

am I expecting the wrong thing here?

webui and CLI show that indeed the interface is enabled..

 Status and Counters - Port Counters for port 1

  Name  : test int
  MAC Address      : xxxxxxxxx
  Link Status      : Down
  Port Enabled     : Yes

ansible result:

changed: [aosswitch_1] => {
    "changed": true,
    "config_mode": "PCM_AUTO",
    "header": {
        "connection": "close",
        "content-type": "application/json",
        "cookies": {},
        "cookies_string": "",
        "msg": "OK (unknown bytes)",
        "requestid": "",
        "server": "eHTTP v2.0",
        "status": 200,
        "transfer-encoding": "chunked",
        "url": "http://10.10.0.254:80/rest/v7.0/ports/1"
    },
    "id": "1",
    "invocation": {
        "module_args": {
            "acl_direction": null,
            "acl_id": null,
            "acl_type": "AT_STANDARD_IPV4",
            "admin_stat": null,
            "api_version": "v7.0",
            "description": "test int",
            "host": "10.10.0.254",
            "interface": "1",
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "port": 80,
            "provider": {
                "api_version": null,
                "host": "10.10.0.254",
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "port": 80,
                "ssh_keyfile": null,
                "timeout": 600,
                "transport": "aossapi",
                "use_proxy": false,
                "use_ssl": false,
                "username": "ladmin",
                "validate_certs": false
            },
            "qos_direction": "QPPD_INBOUND",
            "qos_policy": null,
            "ssh_keyfile": null,
            "state": "delete",
            "timeout": 600,
            "use_ssl": false,
            "username": "ladmin",
            "validate_certs": false
        }
    },
    "is_dsnoop_port_trusted": false,
    "is_flow_control_enabled": false,
    "is_port_enabled": true,
    "is_port_up": false,
    "lacp_status": "LAS_DISABLED",
    "name": "test int",
    "trunk_group": "",
    "trunk_mode": "PTT_NONE",
    "uri": "/ports/1"
}

Bernhardvleen avatar Aug 31 '22 10:08 Bernhardvleen

you want to disable a port ? or remove qos ?

it is disable a port, you need to use

’’’ interface: X admin_stat: False ’’’

alagoutte avatar Aug 31 '22 19:08 alagoutte

yes this option works, thank you @alagoutte for your help!

the result of setting admin_stat: false is Port Enabled : No

the example within the module code should be changed.

Bernhardvleen avatar Sep 01 '22 12:09 Bernhardvleen

Yes, good idea to have a better example (you can push fix for example!)

alagoutte avatar Sep 01 '22 17:09 alagoutte

please be aware, that <state: delete> did not remove the interface for me - not sure what was the reason for this (see above result of my test).

Bernhardvleen avatar Sep 05 '22 08:09 Bernhardvleen