Developer

last person joined: 6 days ago 

Expand all | Collapse all

Unable to create a VLAN in Aruba 2530 using Ansible Aruba switch module

This thread has been viewed 2 times
  • 1.  Unable to create a VLAN in Aruba 2530 using Ansible Aruba switch module

    Posted May 10, 2019 03:02 AM

    Hi!

    Cannot get this to work, help much appreciated. 

    Switches I am testing it with are HP J9772A 2530-48G-PoEP. Software revision YA.16.06.0006.

    Using following simple playbook. Second task works, but first doesn`t.

     

    ilia@psg-ans01:~/ANS$ cat pb_test.yml

    ---

    - hosts: all

      tasks:

        - name: Create VLAN 300

          arubaoss_vlan:

            command: config_vlan

            vlan_id: 300

            name: "vlan300"

     

        - name: Update Switch System Attributes

          arubaoss_system_attributes:

            hostname: "TestSW"

     

    Error messages are as following:

    ilia@psg-ans01:~/ANS$ ansible-playbook pb_test.yml -i inv_switch1.yml

     

    PLAY [all] **********************************************************************************************************************************************************************************************************************************

     

    TASK [Gathering Facts] **********************************************************************************************************************************************************************************************************************

    ok: [switch1]

     

    TASK [Create VLAN 300] **********************************************************************************************************************************************************************************************************************

    fatal: [switch1]: FAILED! => {"body": "{\"message\":\"Invalid parameters\"}", "changed": false, "connection": "close", "content-type": "application/json", "msg": "HTTP Error 400: Bad Request", "requestid": "", "server": "eHTTP v2.0", "status": 400, "transfer-encoding": "chunked", "url": "http://192.168.1.11:80/rest/v5.0/vlans"}

    [WARNING]: Could not create retry file '/home/ilia/ANS/pb_test.retry'.         [Errno 13] Permission denied: u'/home/ilia/ANS/pb_test.retry'

     

     

    PLAY RECAP **********************************************************************************************************************************************************************************************************************************

    switch1                    : ok=1    changed=0    unreachable=0    failed=1

     

    I also tried all tasks from example files including others that use VLAN submodule. They work OK and I was able to delete test VLAN just fine.

    Direct call(via browser) on http://192.168.1.11/rest/v5.0/vlans works:

    {"collection_result":{"total_elements_count":1,"filtered_elements_count":1},"vlan_element":[{"uri":"/vlans/1","vlan_id":1,"name":"DEFAULT_VLAN","status":"VS_PORT_BASED","type":"VT_STATIC","is_voice_enabled":false,"is_jumbo_enabled":false,"is_dsnoop_enabled":false,"is_management_vlan":false}]}

    PS: Tiffany - thanks for tutorials, carry on!



  • 2.  RE: Unable to create a VLAN in Aruba 2530 using Ansible Aruba switch module

    EMPLOYEE
    Posted May 10, 2019 10:44 AM

    from the surface I can see the task is missing a line of code. I run the create vlan task as: 

    tasks:
    - name: Configure VLAN 10
    arubaoss_vlan:
    vlan_id: 10
    name: "vlan10"
    config: create
    command: config_vlan



  • 3.  RE: Unable to create a VLAN in Aruba 2530 using Ansible Aruba switch module

    Posted May 12, 2019 08:03 PM

    Thank you, Kelvinj. While comparing different examples available online I noticed that most of them have config parameter set, so I tried that as well. Unfortunately, it doesn`t fix things for me. Here is a clean run with nothing else to make sure:

    root@psg-ans01:/home/ilia/ANS# cat pb_test.yml
    ---
    - hosts: all
    tasks:
    - name: Create VLAN 30
    arubaoss_vlan:
    vlan_id: 30
    name: "ddd"
    config: "create"
    command: config_vlan
    root@psg-ans01:/home/ilia/ANS# ansible-playbook pb_test.yml -i inv_switch1.yml

    PLAY [all] **********************************************************************************************************************************************************************************************************************************

    TASK [Gathering Facts] **********************************************************************************************************************************************************************************************************************
    ok: [switch1]

    TASK [Create VLAN 30] ***********************************************************************************************************************************************************************************************************************
    fatal: [switch1]: FAILED! => {"body": "{\"message\":\"Invalid parameters\"}", "changed": false, "connection": "close", "content-type": "application/json", "msg": "HTTP Error 400: Bad Request", "requestid": "", "server": "eHTTP v2.0", "status": 400, "transfer-encoding": "chunked", "url": "http://192.168.1.11:80/rest/v5.0/vlans"}
    to retry, use: --limit @/home/ilia/ANS/pb_test.retry

    PLAY RECAP **********************************************************************************************************************************************************************************************************************************
    switch1 : ok=1 changed=0 unreachable=0 failed=1

    root@psg-ans01:/home/ilia/ANS#



  • 4.  RE: Unable to create a VLAN in Aruba 2530 using Ansible Aruba switch module

    MVP GURU
    Posted May 13, 2019 06:28 AM

    Do you have check the rest debug log ?

     

    There is no already a vlan ddd ?



  • 5.  RE: Unable to create a VLAN in Aruba 2530 using Ansible Aruba switch module

    Posted May 13, 2019 11:57 PM

    Thanks, Alexis, good lead. Can see following output in logs:

    ...

    0011:03:46:43.81 rest RestSrv-2:Method = GET, URI =
    /rest/v5.0/vlans/params['vlan_id']
    0011:03:46:43.81 rest RestSrv-2:status = 404, reason = Not Found

    ...

    0011:03:46:43.98 rest RestSrv-2:Method = GET, URI = /rest/v5.0/vlans/30
    0011:03:46:43.99 rest RestSrv-2:status = 404, reason = Not Found

    ...

    It makes sence why second call is failing as there is no vlan 30. But what should I see as a responce to /rest/v5.0/vlans/params['vlan_id']? And where is a call to create vlan 30?

     

    When I amd trying to browse to http://192.168.1.11:80/rest/v5.0/vlans/params['vlan_id'] I am getting same 404 error. 

     

    When I am browsing to http://192.168.1.11:80/rest/v5.0/vlans I am getting following:

    0011:04:09:24.87 rest tHttpd:REST request redirected to REST server
    0011:04:09:24.87 rest tHttpd:Send REST request message to REST control task
    0011:04:09:24.87 rest tHttpd:tHttpd is unblocked with necessary cleanup
    0011:04:09:24.87 rest mrest_ctrl:Request for parse header
    0011:04:09:24.87 rest mrest_ctrl:Request for parse header after method GET
    0011:04:09:24.87 rest mrest_ctrl:uri len = 16
    0011:04:09:24.87 rest mrest_ctrl: PARSE header Cookie value : (null)
    0011:04:09:24.87 rest mrest_ctrl:Validate operation: operation is allowed 0
    0011:04:09:24.87 rest mrest_ctrl:Rest valid Operation.
    0011:04:09:24.87 rest RestSrv-2:Method = GET, URI = /rest/v5.0/vlans
    0011:04:09:24.88 rest mrest_ctrl:read len 131
    0011:04:09:24.88 rest mrest_ctrl:bytes_pending 0, nsent 131
    0011:04:09:24.88 rest mrest_ctrl:read len 501
    0011:04:09:24.88 rest mrest_ctrl:bytes_pending 0, nsent 501
    0011:04:09:24.88 rest mrest_ctrl:read len 0
    0011:04:09:24.88 rest mrest_ctrl:REST response is sent
    0011:04:09:24.88 rest mrest_ctrl:REST request processed successfully

     

    Switch has almost default config, so no vlan with name ddd or id 30:

    TestSW1# sh run

    Running configuration:

    ; J9772A Configuration Editor; Created on release #YA.16.06.0006
    ; Ver #13:44.00.04.19.02.13.98.82.34.61.18.28.f3.84.9c.63.ff.37.27:43
    hostname "TestSW1"
    aruba-central disable
    web-management ssl
    snmp-server community "public" unrestricted
    snmp-server community "test" operator unrestricted
    snmp-server contact "9253237651" location "Santa Clara"
    vlan 1
    name "DEFAULT_VLAN"
    untagged 1-52
    ip address dhcp-bootp
    exit
    vlan 20
    name "VLAN20"
    ip address 10.10.30.40 255.255.255.0
    exit
    spanning-tree
    spanning-tree mode rapid-pvst
    no tftp server
    no dhcp config-file-update
    no dhcp image-file-update
    no dhcp tr69-acs-url
    password manager

     

     



  • 6.  RE: Unable to create a VLAN in Aruba 2530 using Ansible Aruba switch module

    MVP GURU
    Posted May 14, 2019 05:30 AM

    What rest log when you try with ansible ?

    do you have try to make a pcap capture ? (on the ansible server)

     

    Do you have check the login/password ? (need to be connected to create a vlan)



  • 7.  RE: Unable to create a VLAN in Aruba 2530 using Ansible Aruba switch module
    Best Answer

    Posted May 14, 2019 07:04 PM

    Hi!

     

    I believe the cause of your issue is due to Issue #10. This is due to the fact that the platform 2530 does not have the feature to allow for dhcp server to be enabled on a VLAN, therefore it rejects this data and the REST command fails.

     

    I've pushed a temporary fix to the Github by commenting out that parameter. Please uninstall and reinstall the Aruba Switching Modules after executing a git pull in the cloned repo.

     

    If you're in the aruba-ansible-modules directory, execute the following commands:

    git pull
    
    sudo python aos_wired_module_installer/aos_wired_module_installer.py -r
    
    sudo python aos_wired_module_installer/aos_wired_module_installer.py 

    Let me know if you're still seeing the issue :)

     

     



  • 8.  RE: Unable to create a VLAN in Aruba 2530 using Ansible Aruba switch module

    Posted May 15, 2019 08:40 PM

    It works now!

    Thanks!