7
7
from oracle .weblogic .deploy .logging import WLSDeployLogEndHandler
8
8
9
9
from wlsdeploy .aliases .model_constants import CLUSTER
10
+ from wlsdeploy .aliases .model_constants import CROSS_DOMAIN
11
+ from wlsdeploy .aliases .model_constants import DOMAIN_INFO
10
12
from wlsdeploy .aliases .model_constants import DYNAMIC_SERVERS
13
+ from wlsdeploy .aliases .model_constants import REMOTE_DOMAIN
14
+ from wlsdeploy .aliases .model_constants import REMOTE_HOST
15
+ from wlsdeploy .aliases .model_constants import REMOTE_PASSWORD
16
+ from wlsdeploy .aliases .model_constants import REMOTE_RESOURCE
17
+ from wlsdeploy .aliases .model_constants import REMOTE_USER
11
18
from wlsdeploy .aliases .model_constants import SERVER_TEMPLATE
12
19
from wlsdeploy .aliases .model_constants import TOPOLOGY
20
+ from wlsdeploy .aliases .model_constants import WLS_USER_PASSWORD_CREDENTIAL_MAPPINGS
13
21
from wlsdeploy .exception import exception_helper
14
22
from wlsdeploy .logging .platform_logger import PlatformLogger
15
23
from wlsdeploy .util import dictionary_utils
@@ -21,8 +29,6 @@ class ContentValidator(object):
21
29
These checks are done after alias folder and attribute checks.
22
30
These checks should be performed against a detokenized, merged model.
23
31
Tho model may be a sparse model. For example, it could referencce targets from another model.
24
-
25
- Dynamic clusters is currently the only validation.
26
32
"""
27
33
_class_name = 'ContentValidator'
28
34
_logger = PlatformLogger ('wlsdeploy.validate' )
@@ -60,6 +66,7 @@ def validate_model_content(self, model_dict):
60
66
# be tokenized in Prepare Model, do not call validate_user_passwords() from here.
61
67
#
62
68
self .validate_dynamic_clusters (model_dict )
69
+ self .validate_credential_mappings (model_dict )
63
70
64
71
def validate_dynamic_clusters (self , model_dict ):
65
72
"""
@@ -87,3 +94,34 @@ def validate_dynamic_clusters(self, model_dict):
87
94
88
95
else :
89
96
server_templates .append (server_template )
97
+
98
+ def validate_credential_mappings (self , model_dict ):
99
+ """
100
+ Validate the content of the WLSUserPasswordCredentialMappings section of the model.
101
+ This does not include simple single-attribute validation such as value ranges,
102
+ those are handled in domain_info_validator.__validate_wls_credential_mappings_section
103
+ :param model_dict: the model to be validated
104
+ """
105
+ domain_info_folder = dictionary_utils .get_dictionary_element (model_dict , DOMAIN_INFO )
106
+ mappings_folder = dictionary_utils .get_dictionary_element (domain_info_folder ,
107
+ WLS_USER_PASSWORD_CREDENTIAL_MAPPINGS )
108
+
109
+ cross_domain_dict = dictionary_utils .get_dictionary_element (mappings_folder , CROSS_DOMAIN )
110
+ for mapping_name , mapping_dict in cross_domain_dict .iteritems ():
111
+ self .__validate_required_field (mapping_dict , REMOTE_USER , CROSS_DOMAIN , mapping_name )
112
+ self .__validate_required_field (mapping_dict , REMOTE_PASSWORD , CROSS_DOMAIN , mapping_name )
113
+ self .__validate_required_field (mapping_dict , REMOTE_DOMAIN , CROSS_DOMAIN , mapping_name )
114
+
115
+ remote_resources_dict = dictionary_utils .get_dictionary_element (mappings_folder , REMOTE_RESOURCE )
116
+ for mapping_name , mapping_dict in remote_resources_dict .iteritems ():
117
+ self .__validate_required_field (mapping_dict , REMOTE_USER , REMOTE_RESOURCE , mapping_name )
118
+ self .__validate_required_field (mapping_dict , REMOTE_PASSWORD , REMOTE_RESOURCE , mapping_name )
119
+ self .__validate_required_field (mapping_dict , REMOTE_HOST , REMOTE_RESOURCE , mapping_name )
120
+
121
+ def __validate_required_field (self , dictionary , field_name , parent_folder_name , folder_name ):
122
+ _method_name = '__validate_required_field'
123
+
124
+ if field_name not in dictionary :
125
+ self ._logger .severe ('WLSDPLY-05210' , field_name , parent_folder_name , folder_name ,
126
+ class_name = self ._class_name , method_name = _method_name )
127
+
0 commit comments