Developer

 View Only
last person joined: yesterday 

Expand all | Collapse all

Getting error while creating VLAN with Aruba SDK pyaoscx version 2.4.1

This thread has been viewed 29 times
  • 1.  Getting error while creating VLAN with Aruba SDK pyaoscx version 2.4.1

    EMPLOYEE
    Posted Oct 04, 2023 12:51 AM

    Getting below error while create VLAN on ubuntu.

    Switch model and firmware:  8325 & GL.10.10.0001P

    [Yesterday 1:04 PM] Sonawane, Pavan

    {
      "level": "info",
      "timestamp": "2023-10-03T07:31:15.29Z",
      "message": "Create VLAN Test 29 started",
      "customer-id": "123",
      "ope-id": "ABC123",
      "x-b3-traceid": "e58ed763-928c-4155-bee9-fdbaaadc15f4",
      "caller": "aruba.v1.manager.vlan_manager:52"
    }
    {
      "level": "info",
      "timestamp": "2023-10-03T07:31:15.29Z",
      "message": "Publish: 847 {'method': 'POST', 'resource_type': 'TASK', 'resource_id': 'e58ed763-928c-4155-bee9-fdbaaadc15f3', 'resource_uri': '/storage-fabric/v1/vlan/1', 'headers': {'x-timestamp': '2023-10-03T07:31:15.29Z', 'x-ope-task-id': 'e58ed763-928c-4155-bee9-fdbaaadc15f3', 'x-b3-traceid': 'e58ed763-928c-4155-bee9-fdbaaadc15f4'}, 'app_type': '', 'parent_task_info': {'id': 'e58ed763-928c-4155-bee9-fdbaaadc15f3', 'name': 'e58ed763-928c-4155-bee9-fdbaaadc15f3', 'type': 'TASK'}, 'resource_details': {'progress': [{'message': 'Create_vlan 10% complete.', 'timestamp': '2023-10-03T07:31:15.29Z'}], 'associatedResources': [], 'parentResource': {}, 'name': 'Test', 'email_id': 'system@hpe.com', 'createdAt': '2023-10-03T07:31:15.29Z', 'timeout_minutes': 5, 'suggested_polling_interval_seconds': 60, 'status': 1, 'state': 2, 'estimated_running_duration_minutes': 2, 'parentTaskInfo': None, 'completedPercentage': '10'}}",
      "customer-id": "123",
      "ope-id": "ABC123",
      "x-b3-traceid": "e58ed763-928c-4155-bee9-fdbaaadc15f4",
      "caller": "sfmcommon.messages.rabbitmq_publisher:228"
    }
    WARNING: This version doesn't support X-Csrf-Token
    SUCCESS: Login succeeded
    {
      "level": "info",
      "timestamp": "2023-10-03T07:31:15.33Z",
      "message": "Publish: 847 {'method': 'POST', 'resource_type': 'TASK', 'resource_id': 'e58ed763-928c-4155-bee9-fdbaaadc15f3', 'resource_uri': '/storage-fabric/v1/vlan/1', 'headers': {'x-timestamp': '2023-10-03T07:31:15.33Z', 'x-ope-task-id': 'e58ed763-928c-4155-bee9-fdbaaadc15f3', 'x-b3-traceid': 'e58ed763-928c-4155-bee9-fdbaaadc15f4'}, 'app_type': '', 'parent_task_info': {'id': 'e58ed763-928c-4155-bee9-fdbaaadc15f3', 'name': 'e58ed763-928c-4155-bee9-fdbaaadc15f3', 'type': 'TASK'}, 'resource_details': {'progress': [{'message': 'Create_vlan 10% complete.', 'timestamp': '2023-10-03T07:31:15.33Z'}], 'associatedResources': [], 'parentResource': {}, 'name': 'Test', 'email_id': 'system@hpe.com', 'createdAt': '2023-10-03T07:31:15.33Z', 'timeout_minutes': 5, 'suggested_polling_interval_seconds': 60, 'status': 1, 'state': 2, 'estimated_running_duration_minutes': 2, 'parentTaskInfo': None, 'completedPercentage': '40'}}",
      "customer-id": "123",
      "ope-id": "ABC123",
      "x-b3-traceid": "e58ed763-928c-4155-bee9-fdbaaadc15f4",
      "caller": "sfmcommon.messages.rabbitmq_publisher:228"
    }
    Retrieving Vlan, name: 'Test 29' ID: '29' and description: 'Test Vlan 29 Desc' from switch
    SUCCESS: Adding Vlan table entry succeeded
    Retrieving Vlan, name: 'Test 29' ID: '29' and description: 'Test Vlan 29 Desc' from switch
    {
      "level": "error",
      "timestamp": "2023-10-03T07:31:15.37Z",
      "message": "AttributeError(\"'PyaoscxFactory' object has no attribute 'get'\")",
      "customer-id": "123",
      "ope-id": "ABC123",
      "x-b3-traceid": "e58ed763-928c-4155-bee9-fdbaaadc15f4",
      "caller": "aruba.v1.manager.vlan_manager:115",
      "error": "Traceback (most recent call last):   File \"/usr/local/lib/python3.10/site-packages/pyaoscx/pyaoscx_factory.py\", line 243, in vlan     vlan_obj.get()   File \"/usr/local/lib/python3.10/site-packages/pyaoscx/pyaoscx_module.py\", line 40, in ensure_connected     return fnct(self, *args, **kwargs)   File \"/usr/local/lib/python3.10/site-packages/pyaoscx/vlan.py\", line 79, in get     data = self._get_data(depth, selector)   File \"/usr/local/lib/python3.10/site-packages/pyaoscx/pyaoscx_module.py\", line 225, in _get_data     raise GenericOperationError(response.text, response.status_code) pyaoscx.exceptions.generic_op_error.GenericOperationError: 'GENERIC OPERATION ERROR: \\n: Code: 404'  During handling of the above exception, another exception occurred:  Traceback (most recent call last):   File \"aruba/v1/manager/vlan_manager.py\", line 83, in create_vlan   File \"/usr/local/lib/python3.10/site-packages/pyaoscx/pyaoscx_factory.py\", line 255, in vlan     vlan_obj.apply()   File \"/usr/local/lib/python3.10/site-packages/pyaoscx/pyaoscx_module.py\", line 40, in ensure_connected     return fnct(self, *args, **kwargs)   File \"/usr/local/lib/python3.10/site-packages/pyaoscx/vlan.py\", line 193, in apply     modified = self.create()   File \"/usr/local/lib/python3.10/site-packages/pyaoscx/pyaoscx_module.py\", line 40, in ensure_connected     return fnct(self, *args, **kwargs)   File \"/usr/local/lib/python3.10/site-packages/pyaoscx/vlan.py\", line 253, in create     return self._post_data(vlan_data)   File \"/usr/local/lib/python3.10/site-packages/pyaoscx/pyaoscx_module.py\", line 253, in _post_data     self.get()   File \"/usr/local/lib/python3.10/site-packages/pyaoscx/pyaoscx_module.py\", line 40, in ensure_connected     return fnct(self, *args, **kwargs)   File \"/usr/local/lib/python3.10/site-packages/pyaoscx/vlan.py\", line 87, in get     self.vsx_sync = data.pop(\"vsx_sync\")   File \"/usr/local/lib/python3.10/site-packages/pyaoscx/vlan.py\", line 262, in vsx_sync     device.get() AttributeError: 'PyaoscxFactory' object has no attribute 'get'"
    }
    {
      "level": "info",
      "timestamp": "2023-10-03T07:31:15.37Z",
      "message": "Publish: 908 {'method': 'POST', 'resource_type': 'TASK', 'resource_id': 'e58ed763-928c-4155-bee9-fdbaaadc15f3', 'resource_uri': '/storage-fabric/v1/vlan/1', 'headers': {'x-timestamp': '2023-10-03T07:31:15.37Z', 'x-ope-task-id': 'e58ed763-928c-4155-bee9-fdbaaadc15f3', 'x-b3-traceid': 'e58ed763-928c-4155-bee9-fdbaaadc15f4'}, 'app_type': '', 'parent_task_info': {'id': 'e58ed763-928c-4155-bee9-fdbaaadc15f3', 'name': 'e58ed763-928c-4155-bee9-fdbaaadc15f3', 'type': 'TASK'}, 'resource_details': {'progress': [{'message': \"Create_vlan encountered: 'PyaoscxFactory' object has no attribute 'get', 40% complete.\", 'timestamp': '2023-10-03T07:31:15.37Z'}], 'associatedResources': [], 'parentResource': {}, 'name': 'Test', 'email_id': 'system@hpe.com', 'createdAt': '2023-10-03T07:31:15.37Z', 'timeout_minutes': 5, 'suggested_polling_interval_seconds': 60, 'status': 2, 'state': 3, 'estimated_running_duration_minutes': 2, 'parentTaskInfo': None, 'completedPercentage': '40'}}",
      "customer-id": "123",
      "ope-id": "ABC123",
      "x-b3-traceid": "e58ed763-928c-4155-bee9-fdbaaadc15f4",
      "caller": "sfmcommon.messages.rabbitmq_publisher:228"
    }
    SUCCESS: Logout succeeded



  • 2.  RE: Getting error while creating VLAN with Aruba SDK pyaoscx version 2.4.1

    MVP GURU
    Posted Oct 04, 2023 06:02 AM

    Hi,

    What your python script do you are using ? 



    ------------------------------
    PowerArubaSW : Powershell Module to use Aruba Switch API for Vlan, VlanPorts, LACP, LLDP...

    PowerArubaCP: Powershell Module to use ClearPass API (create NAD, Guest...)

    PowerArubaCL: Powershell Module to use Aruba Central

    PowerArubaCX: Powershell Module to use ArubaCX API (get interface/vlan/ports info)..

    ACEP / ACMX #107 / ACDX #1281
    ------------------------------



  • 3.  RE: Getting error while creating VLAN with Aruba SDK pyaoscx version 2.4.1

    EMPLOYEE
    Posted Oct 04, 2023 06:20 AM

    Using Python version: 3.10.10




  • 4.  RE: Getting error while creating VLAN with Aruba SDK pyaoscx version 2.4.1

    Posted Oct 09, 2023 05:30 PM

    Can you provide the Python code you're executing that generates this error?



    ------------------------------
    Ti Chiapuzio-Wong (they/them)
    HPE Aruba Networking
    ------------------------------



  • 5.  RE: Getting error while creating VLAN with Aruba SDK pyaoscx version 2.4.1

    EMPLOYEE
    Posted Oct 11, 2023 06:29 AM

    Here is the code.

    session = self.get_session(switch_ip=self.switch_ip)
     factory = PyaoscxFactory(session)
     response = factory.vlan(vlan_id=vlan_id, name=vlan_name, description=description, admin_conf_state=admin_state)

    Note: If I runs this code on python version 3.10.8 it works fine but if runs on python version 3.10.10(Which is default version for all our services)  then getting the above mentioned exception