From 82378e0bd72b207d219208ed7025cd8350ac2abf Mon Sep 17 00:00:00 2001 From: clerie Date: Fri, 17 Jun 2022 00:08:40 +0200 Subject: [PATCH] Add user device realation changes --- mitel_ommclient2/client.py | 24 +++++++++++++++++++ mitel_ommclient2/messages/__init__.py | 1 + .../messages/setppuserdevrelation.py | 20 ++++++++++++++++ ommcli | 8 +++++++ 4 files changed, 53 insertions(+) create mode 100644 mitel_ommclient2/messages/setppuserdevrelation.py diff --git a/mitel_ommclient2/client.py b/mitel_ommclient2/client.py index 14ddd70..7e54f12 100644 --- a/mitel_ommclient2/client.py +++ b/mitel_ommclient2/client.py @@ -295,6 +295,30 @@ class OMMClient2: return None return r.childs.user[0] + def set_user_relation_dynamic(self, uid): + """ + Set PP user to PP device relation to dynamic type + + :param uid: User id + """ + m = messages.SetPPUserDevRelation() + m.uid = uid + m.relType = types.PPRelTypeType("Dynamic") + r = self.connection.request(m) + r.raise_on_error() + + def set_user_relation_fixed(self, uid): + """ + Set PP user to PP device relation to fixed type + + :param uid: User id + """ + m = messages.SetPPUserDevRelation() + m.uid = uid + m.relType = types.PPRelTypeType("Fixed") + r = self.connection.request(m) + r.raise_on_error() + def set_user_sipauth(self, uid, sipAuthId, sipPw): """ Set PP user sip credentials diff --git a/mitel_ommclient2/messages/__init__.py b/mitel_ommclient2/messages/__init__.py index 7bcd136..5ef9a96 100644 --- a/mitel_ommclient2/messages/__init__.py +++ b/mitel_ommclient2/messages/__init__.py @@ -143,6 +143,7 @@ from .open import Open, OpenResp from .ping import Ping, PingResp from .setpp import SetPP, SetPPResp from .setppuser import SetPPUser, SetPPUserResp +from .setppuserdevrelation import SetPPUserDevRelation, SetPPUserDevRelationResp def construct(request): """ diff --git a/mitel_ommclient2/messages/setppuserdevrelation.py b/mitel_ommclient2/messages/setppuserdevrelation.py new file mode 100644 index 0000000..6dee709 --- /dev/null +++ b/mitel_ommclient2/messages/setppuserdevrelation.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 + +from . import Request, Response, request_type, response_type +from ..types import PPRelTypeType + + +@request_type +class SetPPUserDevRelation(Request): + FIELDS = { + "uid": int, + "relType": PPRelTypeType, + } + + +@response_type +class SetPPUserDevRelationResp(Response): + FIELDS = { + "uid": int, + "relType": PPRelTypeType, + } diff --git a/ommcli b/ommcli index 6bf7fca..c0c9829 100755 --- a/ommcli +++ b/ommcli @@ -138,6 +138,14 @@ if __name__ == "__main__": "num": str, }) + parser_get_account = add_parser("set_user_relation_dynamic", func=c.set_user_relation_dynamic, args={ + "uid": int, + }) + + parser_get_account = add_parser("set_user_relation_fixed", func=c.set_user_relation_fixed, args={ + "uid": int, + }) + parser_get_account = add_parser("set_user_sipauth", func=c.set_user_sipauth, args={ "uid": int, "sipAuthId": str,