Skip to content

Commit e4b71bf

Browse files
committed
Merge branch 'jira-wdt-915-snmp-agent' into 'main'
Add aliases for SNMPAgent, SnmpAgentDeployment, EJBContainer, and Cluster JtaRemoteDomain See merge request weblogic-cloud/weblogic-deploy-tooling!1739
2 parents 9481916 + 84b7620 commit e4b71bf

File tree

12 files changed

+560
-46
lines changed

12 files changed

+560
-46
lines changed

core/src/main/python/wlsdeploy/aliases/alias_entries.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
from wlsdeploy.aliases.model_constants import CALLOUT
5757
from wlsdeploy.aliases.model_constants import DOMAIN_INFO
5858
from wlsdeploy.aliases.model_constants import DOMAIN_INFO_ALIAS
59+
from wlsdeploy.aliases.model_constants import EJB_CONTAINER
5960
from wlsdeploy.aliases.model_constants import HEALTH_SCORE
6061
from wlsdeploy.aliases.model_constants import JOLT_CONNECTION_POOL
6162
from wlsdeploy.aliases.model_constants import JPA
@@ -66,6 +67,8 @@
6667
from wlsdeploy.aliases.model_constants import REMOTE_CONSOLE_HELPER
6768
from wlsdeploy.aliases.model_constants import RESOURCE_MANAGER
6869
from wlsdeploy.aliases.model_constants import RESOURCES
70+
from wlsdeploy.aliases.model_constants import SNMP_AGENT
71+
from wlsdeploy.aliases.model_constants import SNMP_AGENT_DEPLOYMENT
6972
from wlsdeploy.aliases.model_constants import SYSTEM_COMPONENT
7073
from wlsdeploy.aliases.model_constants import TOPOLOGY
7174
from wlsdeploy.aliases.model_constants import WLS_POLICIES
@@ -131,6 +134,7 @@ class AliasEntries(object):
131134

132135
__resources_top_level_folders = [
133136
'CoherenceClusterSystemResource',
137+
EJB_CONTAINER,
134138
'FileStore',
135139
'ForeignJNDIProvider',
136140
'JDBCStore',
@@ -154,6 +158,8 @@ class AliasEntries(object):
154158
'SelfTuning',
155159
'ShutdownClass',
156160
'SingletonService',
161+
SNMP_AGENT,
162+
SNMP_AGENT_DEPLOYMENT,
157163
'StartupClass',
158164
SYSTEM_COMPONENT,
159165
'WebAppContainer',

core/src/main/python/wlsdeploy/aliases/model_constants.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@
106106
DYNAMIC_CLUSTER_SERVER_GROUP_TARGETING_LIMITS = 'DynamicClusterServerGroupTargetingLimits'
107107
DOMAIN_VERSION = 'DomainVersion'
108108
DYNAMIC_SERVERS = 'DynamicServers'
109+
EJB_CONTAINER = 'EJBContainer'
109110
EMBEDDED_LDAP = 'EmbeddedLDAP'
110111
ENABLE_JMS_DB_PERSISTENCE = 'EnableJMSStoreDBPersistence'
111112
ENABLE_JTALOG_DB_PERSISTENCE = 'EnableJTATLogDBPersistence'
@@ -302,6 +303,8 @@
302303
SHUTDOWN_CLASS = 'ShutdownClass'
303304
SINGLETON_SERVICE = 'SingletonService'
304305
SMTP_NOTIFICATION = 'SMTPNotification'
306+
SNMP_AGENT = 'SNMPAgent'
307+
SNMP_AGENT_DEPLOYMENT = 'SnmpAgentDeployment'
305308
SNMP_NOTIFICATION = 'SNMPNotification'
306309
SOURCE_DESTINATION = 'SourceDestination'
307310
SQL_AUTHENTICATOR = 'SQLAuthenticator'

core/src/main/python/wlsdeploy/tool/deploy/common_resources_deployer.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"""
2-
Copyright (c) 2017, 2023, Oracle Corporation and/or its affiliates. All rights reserved.
2+
Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
33
Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44
"""
5+
from wlsdeploy.aliases.model_constants import EJB_CONTAINER
56
from wlsdeploy.aliases.model_constants import FILE_STORE
67
from wlsdeploy.aliases.model_constants import FOREIGN_JNDI_PROVIDER
78
from wlsdeploy.aliases.model_constants import JDBC_STORE
@@ -14,6 +15,8 @@
1415
from wlsdeploy.aliases.model_constants import PATH_SERVICE
1516
from wlsdeploy.aliases.model_constants import SAF_AGENT
1617
from wlsdeploy.aliases.model_constants import SELF_TUNING
18+
from wlsdeploy.aliases.model_constants import SNMP_AGENT
19+
from wlsdeploy.aliases.model_constants import SNMP_AGENT_DEPLOYMENT
1720
from wlsdeploy.aliases.model_constants import WORK_MANAGER
1821
from wlsdeploy.aliases.model_constants import WEBAPP_CONTAINER
1922
from wlsdeploy.aliases.model_constants import WTC_SERVER
@@ -60,6 +63,16 @@ def _add_subfolders(self, model_nodes, location, excludes=None):
6063

6164
Deployer._add_subfolders(self, model_nodes, location, excludes=excludes)
6265

66+
def add_ejb_container(self, parent_dict, location):
67+
"""
68+
Deploy the EJB container elements in the dictionary at the specified location.
69+
:param parent_dict: the dictionary possibly containing EJB container elements
70+
:param location: the location to deploy the elements
71+
"""
72+
ejb_container = dictionary_utils.get_dictionary_element(parent_dict, EJB_CONTAINER)
73+
if len(ejb_container) != 0:
74+
self._add_model_elements(EJB_CONTAINER, ejb_container, location)
75+
6376
def add_file_stores(self, parent_dict, location):
6477
"""
6578
Deploy the file store elements in the dictionary at the specified location.
@@ -150,6 +163,26 @@ def add_saf_agents(self, parent_dict, location):
150163
saf_agents = dictionary_utils.get_dictionary_element(parent_dict, SAF_AGENT)
151164
self._add_named_elements(SAF_AGENT, saf_agents, location)
152165

166+
def add_snmp_agent(self, parent_dict, location):
167+
"""
168+
Deploy the SNMP agent elements in the dictionary at the specified location.
169+
:param parent_dict: the dictionary possibly containing SNMP agent elements
170+
:param location: the location to deploy the elements
171+
"""
172+
snmp_agent = dictionary_utils.get_dictionary_element(parent_dict, SNMP_AGENT)
173+
if len(snmp_agent) != 0:
174+
self._add_model_elements(SNMP_AGENT, snmp_agent, location)
175+
176+
def add_snmp_agent_deployments(self, parent_dict, location):
177+
"""
178+
Deploy the SNMP agent deployment elements in the dictionary at the specified location.
179+
:param parent_dict: the dictionary possibly containing SNMP agent deployment elements
180+
:param location: the location to deploy the elements
181+
"""
182+
deployments = dictionary_utils.get_dictionary_element(parent_dict, SNMP_AGENT_DEPLOYMENT)
183+
if len(deployments) != 0:
184+
self._add_named_elements(SNMP_AGENT_DEPLOYMENT, deployments, location)
185+
153186
def add_self_tuning(self, parent_dict, location):
154187
"""
155188
Deploy the self-tuning elements in the dictionary at the specified location.

core/src/main/python/wlsdeploy/tool/deploy/resources_deployer.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,14 @@ def _add_resources(self, location):
6666
self._add_startup_classes(location)
6767
self._add_shutdown_classes(location)
6868

69+
common_deployer.add_ejb_container(self._resources, location)
6970
common_deployer.add_foreign_jndi_providers(self._resources, location)
7071
common_deployer.add_file_stores(self._resources, location)
7172
common_deployer.add_jdbc_stores(self._resources, location)
7273
common_deployer.add_jms_servers(self._resources, location)
7374
common_deployer.add_saf_agents(self._resources, location)
75+
common_deployer.add_snmp_agent(self._resources, location)
76+
common_deployer.add_snmp_agent_deployments(self._resources, location)
7477
common_deployer.add_path_services(self._resources, location)
7578
common_deployer.add_jolt_connection_pools(self._resources, location)
7679
common_deployer.add_wtc_servers(self._resources, location)

core/src/main/python/wlsdeploy/tool/discover/common_resources_discoverer.py

Lines changed: 10 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ def discover(self):
5555
_logger.entering(class_name=_class_name, method_name=_method_name)
5656
model_folder_name, folder_result = self.get_datasources()
5757
discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result)
58+
59+
self.discover_domain_single_mbean(model_constants.EJB_CONTAINER, self._dictionary)
60+
5861
model_folder_name, folder_result = self.get_foreign_jndi_providers()
5962
discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result)
6063
model_folder_name, folder_result = self.get_mail_sessions()
@@ -65,14 +68,20 @@ def discover(self):
6568
discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result)
6669
model_folder_name, folder_result = self.get_path_services()
6770
discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result)
71+
72+
self.discover_domain_single_mbean(model_constants.SNMP_AGENT, self._dictionary)
73+
self.discover_domain_named_mbeans(model_constants.SNMP_AGENT_DEPLOYMENT, self._dictionary)
74+
6875
JmsResourcesDiscoverer(self._model_context, self._dictionary, self._base_location, wlst_mode=self._wlst_mode,
6976
aliases=self._aliases, credential_injector=self._get_credential_injector()).discover()
77+
7078
model_folder_name, folder_result = self.get_wldf_system_resources()
7179
discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result)
7280
model_folder_name, folder_result = self.get_system_component_resources()
7381
discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result)
7482
model_folder_name, folder_result = self.get_ohs_resources()
7583
discoverer.add_to_model_if_not_empty(self._dictionary, model_folder_name, folder_result)
84+
7685
CoherenceResourcesDiscoverer(self._model_context, self._dictionary, self._base_location,
7786
wlst_mode=self._wlst_mode, aliases=self._aliases,
7887
credential_injector=self._get_credential_injector()).discover()
@@ -184,7 +193,7 @@ def _add_wallet_directory_to_archive(self, datasource, collected_wallet_dictiona
184193
if onprem_wallet_parent_path not in collected_wallet_dictionary:
185194
if onprem_wallet_dir_is_not_flat:
186195
# collect the specific file
187-
#
196+
#
188197
fixed_path = archive_file.addDatabaseWallet(wallet_name, property_value)
189198
path_into_archive = os.path.dirname(fixed_path)
190199
else:
@@ -572,39 +581,6 @@ def _add_wldf_script(self, model_name, model_value, location):
572581
_logger.exiting(class_name=_class_name, method_name=_method_name, result=new_script_name)
573582
return new_script_name
574583

575-
def _get_named_resources(self, folder_name):
576-
"""
577-
Discover each resource of the specified type in the domain.
578-
:return: model name and dictionary for the discovered resources
579-
"""
580-
_method_name = '_get_named_resources'
581-
_logger.entering(folder_name, class_name=_class_name, method_name=_method_name)
582-
583-
result = OrderedDict()
584-
model_top_folder_name = folder_name
585-
location = LocationContext(self._base_location)
586-
location.append_location(model_top_folder_name)
587-
resource_names = self._find_names_in_folder(location)
588-
if resource_names is not None:
589-
_logger.info('WLSDPLY-06364', len(resource_names), folder_name, class_name=_class_name,
590-
method_name=_method_name)
591-
typedef = self._model_context.get_domain_typedef()
592-
name_token = self._aliases.get_name_token(location)
593-
for resource_name in resource_names:
594-
if typedef.is_filtered(location, resource_name):
595-
_logger.info('WLSDPLY-06362', typedef.get_domain_type(), folder_name, resource_name,
596-
class_name=_class_name, method_name=_method_name)
597-
else:
598-
_logger.info('WLSDPLY-06365', folder_name, resource_name, class_name=_class_name,
599-
method_name=_method_name)
600-
location.add_name_token(name_token, resource_name)
601-
result[resource_name] = OrderedDict()
602-
self._populate_model_parameters(result[resource_name], location)
603-
self._discover_subfolders(result[resource_name], location)
604-
location.remove_name_token(name_token)
605-
_logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name)
606-
return model_top_folder_name, result
607-
608584
def _fix_passwords_in_mail_session_properties(self, mail_session_dict):
609585
"""
610586
Look for password properties in the mail session properties string, and replace the password with a fix me token.

core/src/main/python/wlsdeploy/tool/discover/discoverer.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,14 @@ def add_to_remote_map(self, local_name, archive_name, file_type):
112112
else:
113113
_logger.todo('WLSDPLY-06041', file_type, local_name, archive_name)
114114

115+
def discover_domain_named_mbeans(self, model_top_folder_name, model_folder):
116+
model_folder_name, folder_result = self._get_named_resources(model_top_folder_name)
117+
add_to_model_if_not_empty(model_folder, model_folder_name, folder_result)
118+
119+
def discover_domain_single_mbean(self, model_top_folder_name, model_folder):
120+
model_folder_name, folder_result = self.discover_domain_mbean(model_top_folder_name)
121+
add_to_model_if_not_empty(model_folder, model_folder_name, folder_result)
122+
115123
def discover_domain_mbean(self, model_top_folder_name):
116124
"""
117125
Discover the domain specific MBean and its configuration attributes.
@@ -187,6 +195,39 @@ def _populate_model_parameters(self, dictionary, location):
187195

188196
_logger.exiting(class_name=_class_name, method_name=_method_name)
189197

198+
def _get_named_resources(self, folder_name):
199+
"""
200+
Discover each resource of the specified type in the domain.
201+
:return: model name and dictionary for the discovered resources
202+
"""
203+
_method_name = '_get_named_resources'
204+
_logger.entering(folder_name, class_name=_class_name, method_name=_method_name)
205+
206+
result = OrderedDict()
207+
model_top_folder_name = folder_name
208+
location = LocationContext(self._base_location)
209+
location.append_location(model_top_folder_name)
210+
resource_names = self._find_names_in_folder(location)
211+
if resource_names is not None:
212+
_logger.info('WLSDPLY-06364', len(resource_names), folder_name, class_name=_class_name,
213+
method_name=_method_name)
214+
typedef = self._model_context.get_domain_typedef()
215+
name_token = self._aliases.get_name_token(location)
216+
for resource_name in resource_names:
217+
if typedef.is_filtered(location, resource_name):
218+
_logger.info('WLSDPLY-06376', typedef.get_domain_type(), folder_name, resource_name,
219+
class_name=_class_name, method_name=_method_name)
220+
else:
221+
_logger.info('WLSDPLY-06365', folder_name, resource_name, class_name=_class_name,
222+
method_name=_method_name)
223+
location.add_name_token(name_token, resource_name)
224+
result[resource_name] = OrderedDict()
225+
self._populate_model_parameters(result[resource_name], location)
226+
self._discover_subfolders(result[resource_name], location)
227+
location.remove_name_token(name_token)
228+
_logger.exiting(class_name=_class_name, method_name=_method_name, result=model_top_folder_name)
229+
return model_top_folder_name, result
230+
190231
def _uses_is_set(self, location, wlst_param):
191232
"""
192233
Determine if the specified attribute should call WLST.is_set() to be included in the model.

core/src/main/python/wlsdeploy/tool/util/wlst_helper.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ def is_set(self, attribute):
171171
return True
172172
result = mbean.isSet(attribute)
173173
else:
174+
if not self.__has_global('isSet'):
175+
return True
174176
result = self.__load_global('isSet')(attribute)
175177

176178
except (self.__load_global('WLSTException'), offlineWLSTException), e:
@@ -1802,6 +1804,9 @@ def __ls(self, method_name, ls_type, path=None, log_throwing=True):
18021804
def __check_online_connection(self):
18031805
return self.__load_global('WLS_ON').isConnected()
18041806

1807+
def __has_global(self, global_name):
1808+
return wlst_functions is not None and global_name in wlst_functions
1809+
18051810
def __load_global(self, global_name):
18061811
"""
18071812
The WLST globals were stored on entry into the tool instance. Look for the provided name in the

core/src/main/resources/oracle/weblogic/deploy/aliases/category_modules/Cluster.json

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,23 @@
8181
"version": "[12.1.3,)",
8282
"child_folders_type": "single",
8383
"default_name_value": "${NO_NAME_0:%CLUSTER%}",
84-
"folders" : {},
84+
"folders" : {
85+
"JtaRemoteDomain": {
86+
"wlst_type": "J${ta:TA}RemoteDomain${:s}",
87+
"online_bean": "weblogic.management.configuration.JTARemoteDomainMBean",
88+
"version": "[14.1.2,)",
89+
"child_folders_type": "multiple",
90+
"folders": {},
91+
"attributes": {
92+
"Notes": [ { "version": "[10,)", "wlst_mode": "both", "wlst_name": "Notes", "wlst_path": "WP001", "default_value": null, "wlst_type": "string" } ],
93+
"Url": [ { "version": "[10,)", "wlst_mode": "both", "wlst_name": "U${rl:RL}", "wlst_path": "WP001", "default_value": null, "wlst_type": "string" } ]
94+
},
95+
"wlst_attributes_path": "WP001",
96+
"wlst_paths": {
97+
"WP001": "/Cluster${:s}/%CLUSTER%/JTACluster/%JTACLUSTER%/JtaRemoteDomain${:s}/%JTAREMOTEDOMAIN%"
98+
}
99+
}
100+
},
85101
"attributes" : {
86102
"AbandonTimeoutSeconds": [ {"version": "[12.1.3,)", "wlst_mode": "both", "wlst_name": "AbandonTimeoutSeconds", "derived_default": "${:true}", "wlst_path": "WP001", "default_value": 86400, "wlst_type": "integer" } ],
87103
"BeforeCompletionIterationLimit": [ {"version": "[12.1.3,)", "wlst_mode": "both", "wlst_name": "BeforeCompletionIterationLimit", "derived_default": "${:true}", "wlst_path": "WP001", "default_value": 10, "wlst_type": "integer" } ],
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"copyright": "Copyright (c) 2024, Oracle and/or its affiliates.",
3+
"license": "Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl",
4+
"wlst_type": "EJBContainer",
5+
"online_bean": "weblogic.management.configuration.EJBContainerMBean",
6+
"default_name_value": "${NO_NAME_0:%DOMAIN%}",
7+
"folders": {
8+
},
9+
"attributes": {
10+
"ExtraEjbcOptions": [ { "version": "[10,)", "wlst_mode": "both", "wlst_name": "ExtraEjbcOptions", "wlst_path": "WP001", "default_value": null, "wlst_type": "string" } ],
11+
"ExtraRmicOptions": [ { "version": "[10,)", "wlst_mode": "both", "wlst_name": "ExtraRmicOptions", "wlst_path": "WP001", "default_value": null, "wlst_type": "string" } ],
12+
"ForceGeneration": [ { "version": "[10,)", "wlst_mode": "both", "wlst_name": "ForceGeneration", "wlst_path": "WP001", "default_value": false, "wlst_type": "boolean" } ],
13+
"JavaCompiler": [ { "version": "[10,)", "wlst_mode": "both", "wlst_name": "JavaCompiler", "wlst_path": "WP001", "default_value": null, "wlst_type": "string" } ],
14+
"JavaCompilerPostClassPath": [ { "version": "[10,)", "wlst_mode": "both", "wlst_name": "JavaCompilerPostClassPath", "wlst_path": "WP001", "default_value": null, "wlst_type": "string" } ],
15+
"JavaCompilerPreClassPath": [ { "version": "[10,)", "wlst_mode": "both", "wlst_name": "JavaCompilerPreClassPath", "wlst_path": "WP001", "default_value": null, "wlst_type": "string" } ],
16+
"KeepGenerated": [
17+
{ "version": "[10,14.1.2)", "wlst_mode": "both", "wlst_name": "KeepGenerated", "wlst_path": "WP001", "default_value": true, "wlst_type": "boolean" },
18+
{ "version": "[14.1.2,)", "wlst_mode": "both", "wlst_name": "KeepGenerated", "wlst_path": "WP001", "default_value": true, "wlst_type": "boolean", "derived_default": "${true:}" }
19+
],
20+
"Notes": [ { "version": "[10,)", "wlst_mode": "both", "wlst_name": "Notes", "wlst_path": "WP001", "default_value": null, "wlst_type": "string" } ],
21+
"TmpPath": [ { "version": "[10,)", "wlst_mode": "both", "wlst_name": "TmpPath", "wlst_path": "WP001", "default_value": "tmp_ejb", "wlst_type": "string", "uses_path_tokens": true } ],
22+
"VerboseEJBDeploymentEnabled": [ { "version": "[10,)", "wlst_mode": "both", "wlst_name": "VerboseEJBDeploymentEnabled", "wlst_path": "WP001", "default_value": "false", "wlst_type": "string" } ]
23+
},
24+
"wlst_attributes_path": "WP001",
25+
"wlst_paths": {
26+
"WP001": "/EJBContainer/%EJBCONTAINER%"
27+
}
28+
}

0 commit comments

Comments
 (0)