@@ -168,12 +168,14 @@ def call_home_proxy_config(handle, url, port="80", **kwargs):
168
168
Args:
169
169
handle (UcscHandle)
170
170
url (String) : URL for the call home proxy
171
+ To clear proxy config, set this as empty string ("")
171
172
port (String) : port number for the call home proxy
173
+ To clear proxy config, set this as empty string ("")
172
174
**kwargs: Any additional key-value pair of managed object(MO)'s
173
175
property and value, which are not part of regular args.
174
176
This should be used for future version compatibility.
175
177
Returns:
176
- SmartcallhomeHttpProxy : ManagedObject
178
+ SmartcallhomeHttpProxy : ManagedObject or None
177
179
178
180
Raises:
179
181
UcscOperationError: If SmartcallhomeHttpProxy is not present
@@ -182,16 +184,20 @@ def call_home_proxy_config(handle, url, port="80", **kwargs):
182
184
call_home_proxy_config(handle, url="www.testproxy.com", port=80)
183
185
"""
184
186
185
- mo = handle .query_dn (ucsc_base_dn + "/call-home/proxy" )
186
- if not mo :
187
- raise UcscOperationError ("call_home_proxy_config" ,
188
- "call home proxy is not available." )
189
-
190
- mo .url = url
191
- mo .port = port
187
+ from ucscsdk .mometa .smartcallhome .SmartcallhomeHttpProxy import \
188
+ SmartcallhomeHttpProxy
189
+ mo = SmartcallhomeHttpProxy (parent_mo_or_dn = ucsc_base_dn + "/call-home" ,
190
+ url = url ,
191
+ port = port )
192
192
193
193
mo .set_prop_multiple (** kwargs )
194
194
195
+ if url == "" or port == "" :
196
+ mo .port = None
197
+ handle .remove_mo (mo )
198
+ handle .commit ()
199
+ return
200
+
195
201
handle .add_mo (mo , modify_present = True )
196
202
handle .commit ()
197
203
return mo
0 commit comments