nigelm / broadworks_ocip

Broadworks OCI-P API
Other
16 stars 12 forks source link

GroupAccessDeviceAddRequest14 fails #8

Closed kikohnl closed 2 years ago

kikohnl commented 2 years ago

Description

attempting to add a GroupAccessDeviceAddRequest14

Tell us what happened, what went wrong, and what you expected to happen.

returns an error

ValueError: invalid field type for access_device_credentials. got [<broadworks_ocip.types.DeviceManagementUserNamePassword16 object at 0x7f3367ec3790>], expected: <class 'broadworks_ocip.types.DeviceManagementUserNamePassword16'>

What I Did


Paste the command(s) you ran and the output.

def GroupAccessDeviceAddRequest14Webex(sp, grp, tn, devtype, devname):
    try:
        api.command("GroupAccessDeviceAddRequest14",service_provider_id=sp, group_id=grp, device_name=devname, 
            device_type=devtype, protocol='SIP 2.0',transport_protocol='Unspecified', use_custom_user_name_password=True, 
            access_device_credentials=[api.get_type_object('DeviceManagementUserNamePassword16',
            user_name=tn, password=get_random_password() ), ],
        )

        return True

    except OCIErrorResponse as err:
        print("Unable to add access device {} to enterprise {} group {}, Error is {}".format(tn, sp, grp, err.message))

If there was a crash, please include the traceback here.

kotis@ASC:~/broadworks_ocip$ ./addwebex.py  -t 7025551313 -e L000006 -g  OAL000006GRP1 
AddWebex 1.0

TN 7025551313, Enterprise L000006, First None, Last None, Email None 
Got user id 7025551313 and status False
User level IM&P enabled
Traceback (most recent call last):
  File "./addwebex.py", line 286, in <module>
    main()
  File "./addwebex.py", line 222, in main
    status=GroupAccessDeviceAddRequest14Webex(dent, dgrp, tn, devicetype, devname)
  File "./addwebex.py", line 123, in GroupAccessDeviceAddRequest14Webex
    api.command("GroupAccessDeviceAddRequest14",service_provider_id=sp, group_id=grp, device_name=devname, 
  File "/home/kotis/broadworks_ocip/broadworks_ocip/api.py", line 365, in command
    self.send_command(command, **kwargs)
  File "/home/kotis/broadworks_ocip/broadworks_ocip/api.py", line 220, in send_command
    xml = self.get_command_xml(command, **kwargs)
  File "/home/kotis/broadworks_ocip/broadworks_ocip/api.py", line 202, in get_command_xml
    cmd = self.get_command_object(command, **kwargs)
  File "/home/kotis/broadworks_ocip/broadworks_ocip/api.py", line 185, in get_command_object
    cmd = cls(session_id=self.session_id, **kwargs)
  File "/home/kotis/.local/lib/python3.8/site-packages/classforge/classes.py", line 43, in __init__
    self._cf_fields[k]._INTERNAL_set(self, k, v, from_init=True)
  File "/home/kotis/.local/lib/python3.8/site-packages/classforge/fields.py", line 104, in _INTERNAL_set
    raise ValueError("invalid field type for %s. got %s, expected: %s" % (name, value, self.type))
ValueError: invalid field type for access_device_credentials. got [<broadworks_ocip.types.DeviceManagementUserNamePassword16 object at 0x7f3367ec3790>], expected: <class 'broadworks_ocip.types.DeviceManagementUserNamePassword16'>
kikohnl commented 2 years ago

Stupid mistake:

access_device_credentials=[api.get_type_object('DeviceManagementUserNamePassword16',

should be: access_device_credentials=api.get_type_object('DeviceManagementUserNamePassword16',