Developer

 View Only
last person joined: 5 hours ago 

Expand all | Collapse all

Creating template in Aruba Central with Pycentral

This thread has been viewed 11 times
  • 1.  Creating template in Aruba Central with Pycentral

    Posted Jul 27, 2023 05:14 PM

    In the variable file I included _sys_serial and _sys_lan_mac , and have been receiving the following error:

    'code': 400, 'msg': ['The user admin in the administrators group is required.']

    Confirmed the user account that is sending the POST has the following role configured:

    'role': 'Account Administrator'

    Is there a separate role that needs to be configured for the below script to succeed?

    from pycentral.base import ArubaCentralBase
    from pycentral.configuration import Templates
    
    
    central = ArubaCentralBase(central_info=central_info,
                               ssl_verify=True)
    
    
    # Create Templates instance
    templates = Templates()
    
    
    # Parameters for creating a new template
    group_name = "new-group"
    template_name = "test-temp"
    template_filename = ".\Template_vars.csv"
    device_type = "CX"  # Default is 'IAP'
    version = "<version>"  # Default is 'ALL'
    model = "<model>"  # Default is 'ALL'
    
    
    # Create a new template
    response = templates.create_template(
        conn=central,
        group_name=group_name,
        template_name=template_name,
        template_filename=template_filename,
        device_type=device_type,
    )
    
    
    # Check the response
    if 'code' in response and response['code'] == 'SUCCESS':
        print(f"Template {template_name} created successfully.")
    else:
        print(f"Failed to create template {template_name}. Response: {response}")


  • 2.  RE: Creating template in Aruba Central with Pycentral

    Posted Aug 18, 2023 12:58 PM

    The error message you're receiving, "The user admin in the administrators group is required," seems to indicate that the user account making the POST request doesn't have the necessary administrative privileges to perform the actions in the script. You mentioned that the user account has the "Account Administrator" role, but it appears that there might be additional roles or permissions required to create templates and perform related actions in the Aruba Central environment.

    Here are a few steps you can take to address this issue:

    1. Verify Administrative Privileges: Double-check whether the "Account Administrator" role has all the necessary permissions for creating templates and performing related actions. There might be specific permissions related to templates or device configuration that need to be enabled.

    2. Check API Permissions: Verify whether the user account's role has API permissions enabled. Some actions might require specific API permissions to be granted in addition to role-based permissions.

    3. Contact Aruba Support: If you're certain that the user account's role and permissions are configured correctly, it might be helpful to reach out to Aruba support. They can provide specific guidance on the required permissions and roles for the actions you're trying to perform using the API.

    4. Debugging the Error Message: Sometimes, error messages can be a bit misleading or not entirely informative. If possible, try to dig deeper into the API response and see if there's more detailed information about the specific permission that's missing or the context of the error.

    5. Documentation and Examples: Review the official Aruba Central API documentation and examples related to creating templates. They might provide insights into any additional requirements or permissions needed for successful template creation.

    6. Testing with Different Role: As a troubleshooting step, you could temporarily elevate the user account's role to a higher administrative level (if possible) to see if the script works with those additional privileges. This can help narrow down whether it's a permissions issue or if there might be a configuration problem specific to the "Account Administrator" role.

    Ultimately, Aruba support or documentation will likely provide the most accurate guidance for resolving this issue, as they would have insights into the specific permissions and roles required for the actions you're trying to perform.