@@ 2378-2396 (lines=19) @@ | ||
2375 | if community: |
|
2376 | cmd.add_element("community", community) |
|
2377 | ||
2378 | if privacy_algorithm is not None or privacy_password: |
|
2379 | _xmlprivacy = cmd.add_element("privacy") |
|
2380 | ||
2381 | if privacy_algorithm is not None: |
|
2382 | if not isinstance( |
|
2383 | privacy_algorithm, self.types.SnmpPrivacyAlgorithm |
|
2384 | ): |
|
2385 | raise InvalidArgumentType( |
|
2386 | function=self.create_credential.__name__, |
|
2387 | argument='privacy_algorithm', |
|
2388 | arg_type=SnmpPrivacyAlgorithm.__name__, |
|
2389 | ) |
|
2390 | ||
2391 | _xmlprivacy.add_element( |
|
2392 | "algorithm", privacy_algorithm.value |
|
2393 | ) |
|
2394 | ||
2395 | if privacy_password: |
|
2396 | _xmlprivacy.add_element("password", privacy_password) |
|
2397 | ||
2398 | if credential_type == CredentialType.PGP_ENCRYPTION_KEY: |
|
2399 | if not public_key: |
|
@@ 2500-2516 (lines=17) @@ | ||
2497 | if community: |
|
2498 | cmd.add_element("community", community) |
|
2499 | ||
2500 | if privacy_algorithm is not None or privacy_password is not None: |
|
2501 | _xmlprivacy = cmd.add_element("privacy") |
|
2502 | ||
2503 | if privacy_algorithm is not None: |
|
2504 | if not isinstance( |
|
2505 | privacy_algorithm, self.types.SnmpPrivacyAlgorithm |
|
2506 | ): |
|
2507 | raise InvalidArgumentType( |
|
2508 | function=self.modify_credential.__name__, |
|
2509 | argument='privacy_algorithm', |
|
2510 | arg_type=SnmpPrivacyAlgorithm.__name__, |
|
2511 | ) |
|
2512 | ||
2513 | _xmlprivacy.add_element("algorithm", privacy_algorithm.value) |
|
2514 | ||
2515 | if privacy_password is not None: |
|
2516 | _xmlprivacy.add_element("password", privacy_password) |
|
2517 | ||
2518 | if public_key: |
|
2519 | _xmlkey = cmd.add_element("key") |