Skip to content

OWLS-96280: Regression : (WDT 2.0) Can not access wls console thru Port Forwarding in Mii Domain #2776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions operator/src/main/resources/scripts/model_wdt_mii_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def getAdministrationPort(server, topology):
def isAdministrationPortEnabledForServer(server, topology):
administrationPortEnabled = False
if 'AdministrationPortEnabled' in server:
administrationPortEnabled = server['AdministrationPortEnabled'] == 'true'
administrationPortEnabled = server['AdministrationPortEnabled']
else:
administrationPortEnabled = isAdministrationPortEnabledForDomain(topology)
return administrationPortEnabled
Expand All @@ -366,7 +366,7 @@ def isAdministrationPortEnabledForDomain(topology):
administrationPortEnabled = False

if 'AdministrationPortEnabled' in topology:
administrationPortEnabled = topology['AdministrationPortEnabled'] == 'true'
administrationPortEnabled = topology['AdministrationPortEnabled']
else:
# AdministrationPortEnabled is not explicitly set so going with the default
# Starting with 14.1.2.0, the domain's AdministrationPortEnabled default is derived from the domain's SecureMode
Expand All @@ -378,11 +378,11 @@ def isAdministrationPortEnabledForDomain(topology):
def isSecureModeEnabledForDomain(topology):
secureModeEnabled = False
if 'SecurityConfiguration' in topology and 'SecureMode' in topology['SecurityConfiguration'] and 'SecureModeEnabled' in topology['SecurityConfiguration']['SecureMode']:
secureModeEnabled = topology['SecurityConfiguration']['SecureMode']['SecureModeEnabled'] == 'true'
secureModeEnabled = topology['SecurityConfiguration']['SecureMode']['SecureModeEnabled']
else:
is_production_mode_enabled = False
if 'ProductionModeEnabled' in topology:
is_production_mode_enabled = topology['ProductionModeEnabled'] == 'true'
is_production_mode_enabled = topology['ProductionModeEnabled']
secureModeEnabled = is_production_mode_enabled and not env.wlsVersionEarlierThan("14.1.2.0")
return secureModeEnabled

Expand Down Expand Up @@ -422,7 +422,7 @@ def _get_ssl_listen_port(server):
ssl = getSSLOrNone(server)
ssl_listen_port = None
model = env.getModel()
if ssl is not None and 'Enabled' in ssl and ssl['Enabled'] == 'true':
if ssl is not None and 'Enabled' in ssl and ssl['Enabled']:
ssl_listen_port = ssl['ListenPort']
if ssl_listen_port is None:
ssl_listen_port = "7002"
Expand Down Expand Up @@ -604,7 +604,7 @@ def customizeManagedIstioNetworkAccessPoint(template, listen_address):
ssl = getSSLOrNone(template)
ssl_listen_port = None
model = env.getModel()
if ssl is not None and 'Enabled' in ssl and ssl['Enabled'] == 'true':
if ssl is not None and 'Enabled' in ssl and ssl['Enabled']:
ssl_listen_port = ssl['ListenPort']
if ssl_listen_port is None:
ssl_listen_port = "7002"
Expand Down Expand Up @@ -669,7 +669,7 @@ def addAdminChannelPortForwardNetworkAccessPoints(server):

ssl = getSSLOrNone(server)
ssl_listen_port = None
if ssl is not None and 'Enabled' in ssl and ssl['Enabled'] == 'true':
if ssl is not None and 'Enabled' in ssl and ssl['Enabled']:
ssl_listen_port = ssl['ListenPort']
if ssl_listen_port is None:
ssl_listen_port = "7002"
Expand Down
26 changes: 26 additions & 0 deletions operator/src/test/python/test_wdt_mii_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,32 @@ def test_readDomainNameFromTopologyYaml(self):
domain_name = model_wdt_mii_filter.env.getDomainName()
self.assertEqual('wls-domain1', domain_name, "Expected domain name to be \'wls-domain1\'")

def test_isAdministrationPortEnabledForDomain(self):
model = self.getModel()
self.assertTrue(model_wdt_mii_filter.isAdministrationPortEnabledForDomain(model['topology']))

def test_isAdministrationPortEnabledForServer(self):
model = self.getModel()

# disable Administration port for domain
model['topology']['AdministrationPortEnabled'] = False

# enable Administration port for server
model['topology']['Server']['admin-server']['AdministrationPortEnabled'] = True

self.assertTrue(model_wdt_mii_filter.isAdministrationPortEnabledForServer(model['topology']['Server']['admin-server'], model['topology']))

def test_isSecureModeEnabledForDomain(self):
model = self.getModel()

# enable secure mode for Domain
model['topology']['SecurityConfiguration'] = {}
model['topology']['SecurityConfiguration']['SecureMode'] = {}
model['topology']['SecurityConfiguration']['SecureMode']['SecureModeEnabled'] = True

self.assertTrue(model_wdt_mii_filter.isSecureModeEnabledForDomain(model['topology']))


def test_istioVersionRequiresLocalHostBindings(self):
model = self.getModel()
self.assertTrue(model_wdt_mii_filter.istioVersionRequiresLocalHostBindings())
Expand Down