Lines 186-201
def _get_default_network(ldap_connection):
|
Link Here
|
---|
|
186 |
|
186 |
|
187 |
def set_network(address, mask, first_ip, last_ip, ldap_connection): |
187 |
def set_network(address, mask, first_ip, last_ip, ldap_connection): |
188 |
# open network object |
188 |
# open network object |
189 |
network_obj = udm_objects.get(udm_modules.get('networks/network'), None, ldap_connection, None, UCC_NETWORK_DN) |
189 |
try: |
190 |
|
190 |
network_obj = udm_objects.get(udm_modules.get('networks/network'), None, ldap_connection, None, UCC_NETWORK_DN) |
191 |
if network_obj.exists(): |
191 |
except udm_exceptions.noObject: |
|
|
192 |
pass |
193 |
else: |
192 |
# remove network object if already existing |
194 |
# remove network object if already existing |
193 |
network_obj.remove() |
195 |
network_obj.remove() |
194 |
network_obj = udm_objects.get(udm_modules.get('networks/network'), None, ldap_connection, None, UCC_NETWORK_DN) |
196 |
network_obj = udm_objects.get(udm_modules.get('networks/network'), None, ldap_connection, None) |
195 |
|
197 |
|
196 |
# create network |
198 |
# create network |
197 |
name = udm_uldap.explodeDn(UCC_NETWORK_DN, True)[0] |
199 |
name = ldap.dn.str2dn(UCC_NETWORK_DN)[0][0][1] |
198 |
path = UCC_NETWORK_DN.split(',', 1)[1] |
200 |
path = ldap_connection.parentDn(UCC_NETWORK_DN) |
199 |
network_obj = udm_objects.get(udm_modules.get('networks/network'), None, ldap_connection, udm_uldap.position(path)) |
201 |
network_obj = udm_objects.get(udm_modules.get('networks/network'), None, ldap_connection, udm_uldap.position(path)) |
200 |
network_obj.open() |
202 |
network_obj.open() |
201 |
|
203 |
|
Lines 251-257
def _get_policy_object(policy_dns, module_name, ldap_connection):
|
Link Here
|
---|
|
251 |
try: |
253 |
try: |
252 |
return udm_objects.get(policy_modules[0], None, ldap_connection, None, idn, attributes=attrs) |
254 |
return udm_objects.get(policy_modules[0], None, ldap_connection, None, idn, attributes=attrs) |
253 |
except udm_exceptions.noObject: |
255 |
except udm_exceptions.noObject: |
254 |
return None |
256 |
continue |
255 |
return None |
257 |
return None |
256 |
|
258 |
|
257 |
|
259 |
|
Lines 270-284
def _open_container_policy(container_dn, policy_type, policy_dn, ldap_connection
|
Link Here
|
---|
|
270 |
policy_obj.open() |
272 |
policy_obj.open() |
271 |
else: |
273 |
else: |
272 |
# try to open the policy with the given DN |
274 |
# try to open the policy with the given DN |
273 |
policy_obj = None |
|
|
274 |
try: |
275 |
try: |
275 |
policy_obj = udm_objects.get(udm_modules.get(policy_type), None, ldap_connection, None, policy_dn) |
276 |
policy_obj = udm_objects.get(udm_modules.get(policy_type), None, ldap_connection, None, policy_dn) |
276 |
except udm_exceptions.noObject: |
277 |
except udm_exceptions.noObject: |
277 |
pass |
|
|
278 |
if not policy_obj: |
279 |
# create policy |
278 |
# create policy |
280 |
name = udm_uldap.explodeDn(policy_dn, True)[0] |
279 |
name = ldap.dn.str2dn(policy_dn)[0][0][1] |
281 |
path = policy_dn.split(',', 1)[1] |
280 |
path = ldap_connection.parentDn(policy_dn) |
282 |
policy_obj = udm_objects.get(udm_modules.get(policy_type), None, ldap_connection, udm_uldap.position(path)) |
281 |
policy_obj = udm_objects.get(udm_modules.get(policy_type), None, ldap_connection, udm_uldap.position(path)) |
283 |
policy_obj.open() |
282 |
policy_obj.open() |
284 |
policy_obj['name'] = name |
283 |
policy_obj['name'] = name |