OSB check script with WLST

Hi
I have a requirement to produce some output which lists the OSB services currently deployed and their state (enabled or disabled).
Using the CommonServiceConfigurationMBean described here:
http://docs.oracle.com/cd/E28280_01/apirefs.1111/e15033/com/bea/wli/sb/management/configuration/CommonServiceConfigurati…
I wanted to use the isEnabled method to loop through all my OSB services and also print the state.
Unfortunately I have hit an error he documentation states:
     boolean isEnabled(Ref serviceref) throws java.lang.Exception
     Returns true if the service is enabled    
     Parameters:
     serviceref - reference to the service
But when I run it I get: TypeError: isEnabled(): expected 2 args; got 1
How can it expect two arguments when the documentation states only one is required?
Has anyone used this method and have any idea if I have made a simple mistake or whether there is a second parameter and what type it is?
I'm using OSB 11.1.1.7 on Weblogic 10.3.6. As far as I can tell these APIs haven't changed across the versions.
Thanks
Andrew

The script I'm running:
from com.bea.wli.sb.management.configuration import ALSBConfigurationMBean
from com.bea.wli.config import Ref
from java.lang import String
from com.bea.wli.config import Ref
from com.bea.wli.sb.util import Refs
from com.bea.wli.sb.management.configuration import CommonServiceConfigurationMBean
from com.bea.wli.sb.management.configuration import SessionManagementMBean
from com.bea.wli.sb.management.configuration import ProxyServiceConfigurationMBean
from com.bea.wli.sb.management.configuration import BusinessServiceConfigurationMBean
from com.bea.wli.monitoring import StatisticType
from com.bea.wli.monitoring import ServiceDomainMBean
from com.bea.wli.monitoring import ServiceResourceStatistic
from com.bea.wli.monitoring import StatisticValue
from com.bea.wli.monitoring import ResourceType
connect("USERNAME", "PASSWORD","SERVER")
domainRuntime()
#alsbCore = findService(ALBSConfigurationMBean.NAME, ALSBConfigurationMBean.TYPE)
sessionMBean = findService(SessionManagementMBean.NAME,SessionManagementMBean.TYPE)
sessionName="WLSTSession"+ str(System.currentTimeMillis())
sessionMBean.createSession(sessionName)
alsbSession = findService(ALSBConfigurationMBean.NAME + "." + sessionName, ALSBConfigurationMBean.TYPE)
alsbCore = findService(ALSBConfigurationMBean.NAME, ALSBConfigurationMBean.TYPE)
proxyConfigMBean = findService(ProxyServiceConfigurationMBean.NAME + "Andrew Sess",ProxyServiceConfigurationMBean.TYPE)
refs = alsbCore.getRefs(Ref.DOMAIN)
it = refs.iterator()
while it.hasNext():
   r = it.next()
   if r.getTypeId() == Ref.PROJECT_REF:
      print "Project Name : " + (r.getProjectName() )
      allRefs=alsbCore.getRefs(Ref.DOMAIN)
for ref in allRefs:
         typeId = ref.getTypeId()
         if typeId == "ProxyService":
             print "Proxy Services: " + ref.getFullName()
             projectName = Refs.makeParentRef("YodelIVRServices" + "/")
             proxyRef = Refs.makeProxyRef(projectName,"PS_ContactCentreIVRServices" )
             enabled = CommonServiceConfigurationMBean.isEnabled(ref)
for ref in allRefs:
         typeId = ref.getTypeId()
         if typeId == "BusinessService":
             print "Business Services: " + ref.getFullName()
The error in on the line 5th from the bottom. isEnabled(ref) won't accept only the one argument.
I know this prints nothing for the status yet, might as well get it to run before making it output text.
TIA
Andrew

Similar Messages

  • Import subprocess in jython script invoked with WLST

    Weblogic 10.3.6
    I'm trying to figure out if it's impossible for me to use subprocess.pipe and popen when Im invoking the script with WLST. It says there's no module of subprocess. Works fine running it as a python script.
    Thanks!

    i tried with spaces also..and also added context also in the script..but still getting the same error
    import os
    scen_name="DVM"
    scen_ver="001"
    cont="E1APS"
    odiscen="startcmd.bat OdiStartScen -SCEN_NAME="+scen_name+" -SCEN_VERSION="+scen_ver+" -CONTEXT="+cont
    if os.system(odiscen) <> 0:
    raise odiscen

  • OSB - ALSB / WLST / Security / add entry with WLST in  Access Control

    Hello,
    I try to reproduce with WLST script the input from the consol to declare user on Access Control proxy (security).
    sbconsol->$Proxy Service->Security->General Confiruration->Access Control->Transport Access Control->Add Conditions
    * First implementation without success with the com.bea.wli.sb.security.management.configuration.ServiceSecurityConfigurationMBean : accessControlSecurity1()
    * Second try with the service definition of the proxy service but cannot parse with Xpath accessControl Security2()
    any idee ???
    test case :
    prerequisit
    create an ALSB domain 10.3 (admin one with username='weblogic' password='weblogic' url='t3://localhost:7001') and create a proxy service on the default project
    conf/setEnv.cmd
    @CLS
    @echo ON
    @set BEA_HOME=D:\PRODUCT\MIDDLEWARE\SOA\OSB_10.3
    @set WL_HOME=%BEA_HOME%\wlserver_10.3
    @set OSB_HOME=%BEA_HOME%\osb_10.3
    @set SCRIPTING_HOME=E:\PROJETS\RECURANT\EDF\linky\WLST\WORKING\Security
    @set OSB_LIB=%OSB_HOME%/lib/sb-kernel-api.jar;%BEA_HOME%/modules/com.bea.alsb.statistics_1.0.1.0.jar;%OSB_HOME%/lib/sb-kernel-resources.jar;%OSB_HOME%/lib/sb-kernel-common.jar;%OSB_HOME%/lib/sb-kernel-impl.jar;%OSB_HOME%\lib\sb-security.jar;%OSB_HOME%/modules/com.bea.common.configfwk_1.3.0.0.jar;%BEA_HOME%/modules/com.bea.common.configfwk_1.2.0.0.jar;%BEA_HOME%/modules/com.bea.common.configfwk_1.2.1.0.jar;%OSB_HOME%/lib/modules/com.bea.alsb.resources.archive.jar;
    @set TOOL_LIB=%SCRIPTING_HOME%\lib\log4j-1.2.15.jar;%SCRIPTING_HOME%\lib\jsch-0.1.43.jar;%SCRIPTING_HOME%\lib\db2jcc.jar
    @set CLASSPATH=%OSB_LIB%;%TOOL_LIB%;%CLASSPATH%
    @set CLASSPATH=%SCRIPTING_HOME%\lib\db2jcc.jar;%TOOL_LIB%;%CLASSPATH%
    @set MODULE_LIB=%SCRIPTING_HOME%\lib
    @call %WL_HOME%\server\bin\setWLSEnv.cmd > nul 2<&1
    launch.cmd
    @CLS
    @echo OFF
    @SETLOCAL
    @call "conf\setEnv.cmd" > nul 2<&1
    set PWD=%~dp0
    %JAVA_HOME%\bin\java -Dmodule.lib=%MODULE_LIB% weblogic.WLST -skipWLSModuleScanning lib/security.py
    lib/security.py
    from com.bea.wli.monitoring import StatisticType
    from java.util import HashMap
    from java.util import HashSet
    from java.util import ArrayList
    from java.util import Collections
    from java.io import FileInputStream
    from java.io import FileOutputStream
    from java.lang import String
    from java.lang import Boolean
    from com.bea.wli.sb.util import EnvValueTypes
    from com.bea.wli.config.env import EnvValueQuery;
    from com.bea.wli.config import Ref
    from com.bea.wli.config.customization import Customization
    from com.bea.wli.config.customization import EnvValueCustomization
    from com.bea.wli.config.customization import FindAndReplaceCustomization
    from com.bea.wli.sb.management.configuration import SessionManagementMBean
    from com.bea.wli.sb.management.configuration import ALSBConfigurationMBean
    from com.bea.wli.sb.management.query import BusinessServiceQuery
    from com.bea.wli.sb.management.query import ProxyServiceQuery
    from com.bea.wli.sb.management.configuration import ServiceConfigurationMBean
    import os
    # before, create an ALSB domain 10.3 with a proxy service in the default project and add an Acces Control Policy in the consol
    # sbconsol->Project Explorer->default->${proxy service}->Security->Access Control->Create Session->Add Conditions->User->USR_1->Add
    # when we try to modify the Acces Control Policy of the proxy service with the ServiceSecurityConfigurationMBean
    def accessControlSecurity1( domain_name ):
              # connection
              print "\n\n\n***********************************************************************************************"
              connect( 'weblogic', 'weblogic', 't3://localhost:7001')
              domainRuntime()
              # create a session
              sessionName = String("SessionScript"+Long(System.currentTimeMillis()).toString())
              SessionMBean = findService( SessionManagementMBean.NAME ,SessionManagementMBean.TYPE)
              SessionMBean.createSession(sessionName)
              # get the ServiceSecurityConfigurationMBean
              serviceSecurityConfigurationMBean = findService(String("ServiceSecurityConfiguration.").concat(sessionName), "com.bea.wli.sb.security.management.configuration.ServiceSecurityConfigurationMBean")
              # get the XACMLAuthorizer
              working_directory=pwd()
              serverConfig()
              xacmlAuthorizer = cd('/SecurityConfiguration/%s/Realms/myrealm/Authorizers/XACMLAuthorizer' % domain_name )
              cd(working_directory)
              domainRuntime()
              # get service ref
              ConfigurationMBean = findService(String("ALSBConfiguration.").concat(sessionName), "com.bea.wli.sb.management.configuration.ALSBConfigurationMBean")
              bsQuery = ProxyServiceQuery()
              bsQuery.setPath("default/*")
              refs = ConfigurationMBean.getRefs(bsQuery)
              for ref in refs:
                   print 'ref=%s'%ref               
                   # use the security Mbean to add : USER_A,USER_B,USER_C to the policy
                   policyHolder = serviceSecurityConfigurationMBean.newAccessControlPolicyHolderInstance(xacmlAuthorizer)
                   policyHolder.setPolicyExpression("Usr(USER_A,USER_B,USER_C)")     
                   policyScope = serviceSecurityConfigurationMBean.newDefaultMessagePolicyScope(ref)
                   serviceSecurityConfigurationMBean.setAccessControlPolicy(policyScope,policyHolder)
                   # print the service definition
                   servConfMBean = findService( "%s.%s" % (ServiceConfigurationMBean.NAME, sessionName), ServiceConfigurationMBean.TYPE)
                   serviceDefinition = servConfMBean.getServiceDefinition(ref)
                   print serviceDefinition
                   # we can see the security entry in the service definition has follow
                   # <xml-fragment xmlns:ser="http://www.bea.com/wli/sb/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tran="http://www.bea.com/wli/sb/transports" xmlns:env="http://www.bea.com/wli/config/env">
                   # <ser:coreEntry isProxy="true" isEnabled="true" isAutoPublish="false">
                   # <ser:description/>
                   # <ser:security>
                   # <con:access-control-policies xmlns:con="http://www.bea.com/wli/sb/services/security/config">
                   # <con:message-level-policies>
                   # <con1:default-policy xsi:type="con:ProviderPolicyContainerType" xmlns:con="http://www.bea.com/wli/sb/security/accesscontrol/config" xmlns:con1="http://www.bea.com/wli/sb/services/security/config">
                   # <con:policy provider-id="XACMLAuthorizer">
                   # <con:policy-expression>Usr(USER_A,USER_B,USER_C)</con:policy-expression>
                   # </con:policy>
                   # </con1:default-policy>
                   # </con:message-level-policies>
                   # </con:access-control-policies>
                   # </ser:security>
              # but when we commit
              SessionMBean.activateSession(sessionName, "description for session activation")
              # we got the following exception
              # Unexpected error: com.bea.wli.config.session.SessionConflictException
              # No stack trace available.
              # Problem invoking WLST - Traceback (innermost last):
              # File "E:\PROJETS\RECURANT\EDF\linky\WLST\WORKING\Security\lib\security.py", line 246, in ?
              # File "E:\PROJETS\RECURANT\EDF\linky\WLST\WORKING\Security\lib\security.py", line 105, in accessControlSecurity1
              # com.bea.wli.config.session.SessionConflictException: Conflicts for session SessionScript1363339726764
              # [Non-Critical] Concurrent Modification Conflicts
              # NONE
              # [Critical] Resources with validation errors
              # 1 - ProxyService test/PS_TEST_bis CannotCommit
              # + CannotCommit [OSB Security:386836]Unnecessary proxy wide message access control policy found for service "test/PS_TEST_bis". Hint: The service is neither an active security
              # intermediary nor has custom authentication enabled. ServiceDiagnosticLocation[SECURITY_TAB]:DiagnosticLocation:<con:message-level-policies xmlns:ser="http://www.bea.com/wli/sb/services" xml
              # ns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tran="http://www.bea.com/wli/sb/transports" xmlns:env="http://www.bea.com/wli/config/env" xmlns:con="http://www.bea.com/wli/sb/services/security/config">
              # <con1:default-policy xsi:type="con:ProviderPolicyContainerType" xmlns:con="http://www.bea.com/wli/sb/security/accesscontrol/config" xmlns:con1="http://www.bea.com/wli/sb/services/security/
              # config">
              # <con:policy provider-id="XACMLAuthorizer">
              # <con:policy-expression>Usr(USER_A,USER_B,USER_C)</con:policy-expression>
              # </con:policy>
              # </con1:default-policy>
              # </con:message-level-policies>
              # [Info] Informational messages
              # NONE
              # at com.bea.wli.config.session.SessionManager.commitSessionUnlocked(SessionManager.java:358)
              # at com.bea.wli.config.session.SessionManager.commitSession(SessionManager.java:339)
              # at com.bea.wli.config.session.SessionManager.commitSession(SessionManager.java:297)
              # at com.bea.wli.config.session.SessionManager.commitSession(SessionManager.java:306)
              disconnect()                              
    # when we try to modify the Acces Control Policy of the proxy service whith the service XML definition
    def accessControlSecurity2( domain_name ):
              # connection
              print "\n\n\n***********************************************************************************************"
              connect( 'weblogic', 'weblogic', 't3://localhost:7001')
              domainRuntime()
              # create a session
              sessionName = String("SessionScript"+Long(System.currentTimeMillis()).toString())
              SessionMBean = findService( SessionManagementMBean.NAME ,SessionManagementMBean.TYPE)
              SessionMBean.createSession(sessionName)
              # get service ref
              ConfigurationMBean = findService(String("ALSBConfiguration.").concat(sessionName), "com.bea.wli.sb.management.configuration.ALSBConfigurationMBean")               
              bsQuery = ProxyServiceQuery()
              bsQuery.setPath("default/*")
              refs = ConfigurationMBean.getRefs(bsQuery)
              for ref in refs:
                   print 'ref=%s'%ref
                   servConfMBean = findService( "%s.%s" % (ServiceConfigurationMBean.NAME, sessionName), ServiceConfigurationMBean.TYPE)
                   serviceDefinition = servConfMBean.getServiceDefinition(ref)
                   # parsing the proxy definition
                   nsSer = "declare namespace ser='http://www.bea.com/wli/sb/services'"
                   nsXsi = "declare namespace xsi='http://www.w3.org/2001/XMLSchema-instance'"
                   nsTran = "declare namespace tran='http://www.bea.com/wli/sb/transports'"
                   nsEnv = "declare namespace env='http://www.bea.com/wli/config/env'"
                   nsCon = "declare namespace con='http://www.bea.com/wli/sb/services/security/config'"
                   nsCon1 = "declare namespace con1='http://www.bea.com/wli/sb/services/security/config'"
                   # when we try to parse the following Xpath Expression, it' working but not sufficent to access the <con:policy-expression> element
                   confPath = "ser:coreEntry/ser:security/con:access-control-policies/con1:transport-level-policy"
                   confElem = serviceDefinition.selectPath(nsSer + nsXsi + nsTran + nsEnv + nsCon + nsCon1 + confPath )
                   print "WORKING{%s}" % confElem
                   # get the result
                   # <xml-fragment xsi:type="con:ProviderPolicyContainerType" xmlns:con="http://www.bea.com/wli/sb/security/accesscontrol/config" xmlns:con1="http://www.bea.com/wli/sb/services/security/config" xmlns:ser="http://www.bea.com/wli/sb/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tran="http://www.bea.com/wli/sb/transports" xmlns:env="http://www.bea.com/wli/config/env">
                   # <con:policy provider-id="XACMLAuthorizer">
                   # <con:policy-expression>Usr(USER_1,USER_2,USER_3)</con:policy-expression>
                   # </con:policy>
                   # </xml-fragment>
                   # and when we try to acces the <con:policy> element whith the following Xpath expression we got an empty result
                   confPath = "ser:coreEntry/ser:security/con:access-control-policies/con1:transport-level-policy/con:policy"
                   confElem = serviceDefinition.selectPath(nsSer + nsXsi + nsTran + nsEnv + nsCon + nsCon1 + confPath )
                   print "DON'T WORKING{%s}" % confElem
                   # get empty result
                   # array([], org.apache.xmlbeans.XmlObject)
              # want to modify the value like this on the <con:policy-expression> but cannot reach it ...
              #confValue="Usr(USER_A,USER_B,USER_C)"
              #confElem.setStringValue(confValue)
              # commit                
              SessionMBean.activateSession(sessionName, "description for session activation")
              disconnect
    # print the service definition
    def printServiceDefinition( domain_name ):
              # connection
              connect( 'weblogic', 'weblogic', 't3://localhost:7001')
              domainRuntime()
              # create a session
              sessionName = String("SessionScript"+Long(System.currentTimeMillis()).toString())
              SessionMBean = findService( SessionManagementMBean.NAME ,SessionManagementMBean.TYPE)
              SessionMBean.createSession(sessionName)
              # get service ref
              ConfigurationMBean = findService(String("ALSBConfiguration.").concat(sessionName), "com.bea.wli.sb.management.configuration.ALSBConfigurationMBean")               
              bsQuery = ProxyServiceQuery()
              bsQuery.setPath("default/*")
              refs = ConfigurationMBean.getRefs(bsQuery)
              for ref in refs:
                   print 'ref=%s'%ref
                   servConfMBean = findService( "%s.%s" % (ServiceConfigurationMBean.NAME, sessionName), ServiceConfigurationMBean.TYPE)
                   serviceDefinition = servConfMBean.getServiceDefinition(ref)
                   servConfMBean = findService( "%s.%s" % (ServiceConfigurationMBean.NAME, sessionName), ServiceConfigurationMBean.TYPE)
                   serviceDefinition = servConfMBean.getServiceDefinition(ref)
                   print serviceDefinition
              # commit                
              SessionMBean.activateSession(sessionName, "description for session activation")
              disconnect
    #accessControlSecurity1('cluster_domain')
    accessControlSecurity2('cluster_domain')

    Hello,
    I try to reproduce with WLST script the input from the consol to declare user on Access Control proxy (security).
    sbconsol->$Proxy Service->Security->General Confiruration->Access Control->Transport Access Control->Add Conditions
    * First implementation without success with the com.bea.wli.sb.security.management.configuration.ServiceSecurityConfigurationMBean : accessControlSecurity1()
    * Second try with the service definition of the proxy service but cannot parse with Xpath accessControl Security2()
    any idee ???
    test case :
    prerequisit
    create an ALSB domain 10.3 (admin one with username='weblogic' password='weblogic' url='t3://localhost:7001') and create a proxy service on the default project
    conf/setEnv.cmd
    @CLS
    @echo ON
    @set BEA_HOME=D:\PRODUCT\MIDDLEWARE\SOA\OSB_10.3
    @set WL_HOME=%BEA_HOME%\wlserver_10.3
    @set OSB_HOME=%BEA_HOME%\osb_10.3
    @set SCRIPTING_HOME=E:\PROJETS\RECURANT\EDF\linky\WLST\WORKING\Security
    @set OSB_LIB=%OSB_HOME%/lib/sb-kernel-api.jar;%BEA_HOME%/modules/com.bea.alsb.statistics_1.0.1.0.jar;%OSB_HOME%/lib/sb-kernel-resources.jar;%OSB_HOME%/lib/sb-kernel-common.jar;%OSB_HOME%/lib/sb-kernel-impl.jar;%OSB_HOME%\lib\sb-security.jar;%OSB_HOME%/modules/com.bea.common.configfwk_1.3.0.0.jar;%BEA_HOME%/modules/com.bea.common.configfwk_1.2.0.0.jar;%BEA_HOME%/modules/com.bea.common.configfwk_1.2.1.0.jar;%OSB_HOME%/lib/modules/com.bea.alsb.resources.archive.jar;
    @set TOOL_LIB=%SCRIPTING_HOME%\lib\log4j-1.2.15.jar;%SCRIPTING_HOME%\lib\jsch-0.1.43.jar;%SCRIPTING_HOME%\lib\db2jcc.jar
    @set CLASSPATH=%OSB_LIB%;%TOOL_LIB%;%CLASSPATH%
    @set CLASSPATH=%SCRIPTING_HOME%\lib\db2jcc.jar;%TOOL_LIB%;%CLASSPATH%
    @set MODULE_LIB=%SCRIPTING_HOME%\lib
    @call %WL_HOME%\server\bin\setWLSEnv.cmd > nul 2<&1
    launch.cmd
    @CLS
    @echo OFF
    @SETLOCAL
    @call "conf\setEnv.cmd" > nul 2<&1
    set PWD=%~dp0
    %JAVA_HOME%\bin\java -Dmodule.lib=%MODULE_LIB% weblogic.WLST -skipWLSModuleScanning lib/security.py
    lib/security.py
    from com.bea.wli.monitoring import StatisticType
    from java.util import HashMap
    from java.util import HashSet
    from java.util import ArrayList
    from java.util import Collections
    from java.io import FileInputStream
    from java.io import FileOutputStream
    from java.lang import String
    from java.lang import Boolean
    from com.bea.wli.sb.util import EnvValueTypes
    from com.bea.wli.config.env import EnvValueQuery;
    from com.bea.wli.config import Ref
    from com.bea.wli.config.customization import Customization
    from com.bea.wli.config.customization import EnvValueCustomization
    from com.bea.wli.config.customization import FindAndReplaceCustomization
    from com.bea.wli.sb.management.configuration import SessionManagementMBean
    from com.bea.wli.sb.management.configuration import ALSBConfigurationMBean
    from com.bea.wli.sb.management.query import BusinessServiceQuery
    from com.bea.wli.sb.management.query import ProxyServiceQuery
    from com.bea.wli.sb.management.configuration import ServiceConfigurationMBean
    import os
    # before, create an ALSB domain 10.3 with a proxy service in the default project and add an Acces Control Policy in the consol
    # sbconsol->Project Explorer->default->${proxy service}->Security->Access Control->Create Session->Add Conditions->User->USR_1->Add
    # when we try to modify the Acces Control Policy of the proxy service with the ServiceSecurityConfigurationMBean
    def accessControlSecurity1( domain_name ):
              # connection
              print "\n\n\n***********************************************************************************************"
              connect( 'weblogic', 'weblogic', 't3://localhost:7001')
              domainRuntime()
              # create a session
              sessionName = String("SessionScript"+Long(System.currentTimeMillis()).toString())
              SessionMBean = findService( SessionManagementMBean.NAME ,SessionManagementMBean.TYPE)
              SessionMBean.createSession(sessionName)
              # get the ServiceSecurityConfigurationMBean
              serviceSecurityConfigurationMBean = findService(String("ServiceSecurityConfiguration.").concat(sessionName), "com.bea.wli.sb.security.management.configuration.ServiceSecurityConfigurationMBean")
              # get the XACMLAuthorizer
              working_directory=pwd()
              serverConfig()
              xacmlAuthorizer = cd('/SecurityConfiguration/%s/Realms/myrealm/Authorizers/XACMLAuthorizer' % domain_name )
              cd(working_directory)
              domainRuntime()
              # get service ref
              ConfigurationMBean = findService(String("ALSBConfiguration.").concat(sessionName), "com.bea.wli.sb.management.configuration.ALSBConfigurationMBean")
              bsQuery = ProxyServiceQuery()
              bsQuery.setPath("default/*")
              refs = ConfigurationMBean.getRefs(bsQuery)
              for ref in refs:
                   print 'ref=%s'%ref               
                   # use the security Mbean to add : USER_A,USER_B,USER_C to the policy
                   policyHolder = serviceSecurityConfigurationMBean.newAccessControlPolicyHolderInstance(xacmlAuthorizer)
                   policyHolder.setPolicyExpression("Usr(USER_A,USER_B,USER_C)")     
                   policyScope = serviceSecurityConfigurationMBean.newDefaultMessagePolicyScope(ref)
                   serviceSecurityConfigurationMBean.setAccessControlPolicy(policyScope,policyHolder)
                   # print the service definition
                   servConfMBean = findService( "%s.%s" % (ServiceConfigurationMBean.NAME, sessionName), ServiceConfigurationMBean.TYPE)
                   serviceDefinition = servConfMBean.getServiceDefinition(ref)
                   print serviceDefinition
                   # we can see the security entry in the service definition has follow
                   # <xml-fragment xmlns:ser="http://www.bea.com/wli/sb/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tran="http://www.bea.com/wli/sb/transports" xmlns:env="http://www.bea.com/wli/config/env">
                   # <ser:coreEntry isProxy="true" isEnabled="true" isAutoPublish="false">
                   # <ser:description/>
                   # <ser:security>
                   # <con:access-control-policies xmlns:con="http://www.bea.com/wli/sb/services/security/config">
                   # <con:message-level-policies>
                   # <con1:default-policy xsi:type="con:ProviderPolicyContainerType" xmlns:con="http://www.bea.com/wli/sb/security/accesscontrol/config" xmlns:con1="http://www.bea.com/wli/sb/services/security/config">
                   # <con:policy provider-id="XACMLAuthorizer">
                   # <con:policy-expression>Usr(USER_A,USER_B,USER_C)</con:policy-expression>
                   # </con:policy>
                   # </con1:default-policy>
                   # </con:message-level-policies>
                   # </con:access-control-policies>
                   # </ser:security>
              # but when we commit
              SessionMBean.activateSession(sessionName, "description for session activation")
              # we got the following exception
              # Unexpected error: com.bea.wli.config.session.SessionConflictException
              # No stack trace available.
              # Problem invoking WLST - Traceback (innermost last):
              # File "E:\PROJETS\RECURANT\EDF\linky\WLST\WORKING\Security\lib\security.py", line 246, in ?
              # File "E:\PROJETS\RECURANT\EDF\linky\WLST\WORKING\Security\lib\security.py", line 105, in accessControlSecurity1
              # com.bea.wli.config.session.SessionConflictException: Conflicts for session SessionScript1363339726764
              # [Non-Critical] Concurrent Modification Conflicts
              # NONE
              # [Critical] Resources with validation errors
              # 1 - ProxyService test/PS_TEST_bis CannotCommit
              # + CannotCommit [OSB Security:386836]Unnecessary proxy wide message access control policy found for service "test/PS_TEST_bis". Hint: The service is neither an active security
              # intermediary nor has custom authentication enabled. ServiceDiagnosticLocation[SECURITY_TAB]:DiagnosticLocation:<con:message-level-policies xmlns:ser="http://www.bea.com/wli/sb/services" xml
              # ns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tran="http://www.bea.com/wli/sb/transports" xmlns:env="http://www.bea.com/wli/config/env" xmlns:con="http://www.bea.com/wli/sb/services/security/config">
              # <con1:default-policy xsi:type="con:ProviderPolicyContainerType" xmlns:con="http://www.bea.com/wli/sb/security/accesscontrol/config" xmlns:con1="http://www.bea.com/wli/sb/services/security/
              # config">
              # <con:policy provider-id="XACMLAuthorizer">
              # <con:policy-expression>Usr(USER_A,USER_B,USER_C)</con:policy-expression>
              # </con:policy>
              # </con1:default-policy>
              # </con:message-level-policies>
              # [Info] Informational messages
              # NONE
              # at com.bea.wli.config.session.SessionManager.commitSessionUnlocked(SessionManager.java:358)
              # at com.bea.wli.config.session.SessionManager.commitSession(SessionManager.java:339)
              # at com.bea.wli.config.session.SessionManager.commitSession(SessionManager.java:297)
              # at com.bea.wli.config.session.SessionManager.commitSession(SessionManager.java:306)
              disconnect()                              
    # when we try to modify the Acces Control Policy of the proxy service whith the service XML definition
    def accessControlSecurity2( domain_name ):
              # connection
              print "\n\n\n***********************************************************************************************"
              connect( 'weblogic', 'weblogic', 't3://localhost:7001')
              domainRuntime()
              # create a session
              sessionName = String("SessionScript"+Long(System.currentTimeMillis()).toString())
              SessionMBean = findService( SessionManagementMBean.NAME ,SessionManagementMBean.TYPE)
              SessionMBean.createSession(sessionName)
              # get service ref
              ConfigurationMBean = findService(String("ALSBConfiguration.").concat(sessionName), "com.bea.wli.sb.management.configuration.ALSBConfigurationMBean")               
              bsQuery = ProxyServiceQuery()
              bsQuery.setPath("default/*")
              refs = ConfigurationMBean.getRefs(bsQuery)
              for ref in refs:
                   print 'ref=%s'%ref
                   servConfMBean = findService( "%s.%s" % (ServiceConfigurationMBean.NAME, sessionName), ServiceConfigurationMBean.TYPE)
                   serviceDefinition = servConfMBean.getServiceDefinition(ref)
                   # parsing the proxy definition
                   nsSer = "declare namespace ser='http://www.bea.com/wli/sb/services'"
                   nsXsi = "declare namespace xsi='http://www.w3.org/2001/XMLSchema-instance'"
                   nsTran = "declare namespace tran='http://www.bea.com/wli/sb/transports'"
                   nsEnv = "declare namespace env='http://www.bea.com/wli/config/env'"
                   nsCon = "declare namespace con='http://www.bea.com/wli/sb/services/security/config'"
                   nsCon1 = "declare namespace con1='http://www.bea.com/wli/sb/services/security/config'"
                   # when we try to parse the following Xpath Expression, it' working but not sufficent to access the <con:policy-expression> element
                   confPath = "ser:coreEntry/ser:security/con:access-control-policies/con1:transport-level-policy"
                   confElem = serviceDefinition.selectPath(nsSer + nsXsi + nsTran + nsEnv + nsCon + nsCon1 + confPath )
                   print "WORKING{%s}" % confElem
                   # get the result
                   # <xml-fragment xsi:type="con:ProviderPolicyContainerType" xmlns:con="http://www.bea.com/wli/sb/security/accesscontrol/config" xmlns:con1="http://www.bea.com/wli/sb/services/security/config" xmlns:ser="http://www.bea.com/wli/sb/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tran="http://www.bea.com/wli/sb/transports" xmlns:env="http://www.bea.com/wli/config/env">
                   # <con:policy provider-id="XACMLAuthorizer">
                   # <con:policy-expression>Usr(USER_1,USER_2,USER_3)</con:policy-expression>
                   # </con:policy>
                   # </xml-fragment>
                   # and when we try to acces the <con:policy> element whith the following Xpath expression we got an empty result
                   confPath = "ser:coreEntry/ser:security/con:access-control-policies/con1:transport-level-policy/con:policy"
                   confElem = serviceDefinition.selectPath(nsSer + nsXsi + nsTran + nsEnv + nsCon + nsCon1 + confPath )
                   print "DON'T WORKING{%s}" % confElem
                   # get empty result
                   # array([], org.apache.xmlbeans.XmlObject)
              # want to modify the value like this on the <con:policy-expression> but cannot reach it ...
              #confValue="Usr(USER_A,USER_B,USER_C)"
              #confElem.setStringValue(confValue)
              # commit                
              SessionMBean.activateSession(sessionName, "description for session activation")
              disconnect
    # print the service definition
    def printServiceDefinition( domain_name ):
              # connection
              connect( 'weblogic', 'weblogic', 't3://localhost:7001')
              domainRuntime()
              # create a session
              sessionName = String("SessionScript"+Long(System.currentTimeMillis()).toString())
              SessionMBean = findService( SessionManagementMBean.NAME ,SessionManagementMBean.TYPE)
              SessionMBean.createSession(sessionName)
              # get service ref
              ConfigurationMBean = findService(String("ALSBConfiguration.").concat(sessionName), "com.bea.wli.sb.management.configuration.ALSBConfigurationMBean")               
              bsQuery = ProxyServiceQuery()
              bsQuery.setPath("default/*")
              refs = ConfigurationMBean.getRefs(bsQuery)
              for ref in refs:
                   print 'ref=%s'%ref
                   servConfMBean = findService( "%s.%s" % (ServiceConfigurationMBean.NAME, sessionName), ServiceConfigurationMBean.TYPE)
                   serviceDefinition = servConfMBean.getServiceDefinition(ref)
                   servConfMBean = findService( "%s.%s" % (ServiceConfigurationMBean.NAME, sessionName), ServiceConfigurationMBean.TYPE)
                   serviceDefinition = servConfMBean.getServiceDefinition(ref)
                   print serviceDefinition
              # commit                
              SessionMBean.activateSession(sessionName, "description for session activation")
              disconnect
    #accessControlSecurity1('cluster_domain')
    accessControlSecurity2('cluster_domain')

  • How to create a new Oracle OSB project automaticaly with script without IDE

    Hello,
    I want to create automatically an "Oracle service bus project" and an "Oracle service bus configuration project" with scripts (ANT or Maven or ...) without using IDE, without using workshop or Eclipse. I want to create automatically (ANT or Maven) just a skeleton of an OSB project witch i can use after in workshop.
    I want to create 1 "Oracle service bus configuration project" with many "Oracle service bus project" automatically (ANT or Maven or scripts) witch i can use after in workshop. How to create a new Oracle OSB project automaticaly with script without IDE ? How can i do this ?
    I'm using Oracle service bus 10.3.1
    Thank you for your help.

    Thank you for your response,
    I do not want to just create the services (proxy services and business services) but I want to create a template for 40 OSB project with the same scripts ANT/Maven.
    Template="Oracle service bus configuration project" + "Oracle service bus project" + services of 40 OSB projects
    The goal is that I have more than 40 projects to create and just the name of the projects that changes (when I say the name of the project ie the name of the OSB project, the name of proxy services and the name of business services ).
    So I want to give my script (ANT/Maven) the name of 40 OSB project and the script must generate the skeleton of the 40 projects at once time and after generation of skeleton of the 40 project, I will import them in the workshop to add manually mapping and routing and other things that differs from one project to another.
    So i want to generate automatically a skeletons of 40 OSB projects using a script (ANT / Maven) and I give to the script juste the names of the 40 projects.
    I want to create a "Oracle service bus configuration project" and "Oracle service bus project" automatically of 40 OSB projects (ANT or Maven or scripts) witch i can use after in workshop.
    I want to create one 'template' of all 40 projects in the same time, with the same directory structure (Transforlation, Business services, proxy services, WSDL .....) and all 40 project have the same transport, just the names of projects and services witch changes and i can give to the script all names of projects and services and i can give also all WSDL.
    Regards,
    Tarik

  • How to undo activated OSB session with WLST?

    Does anybody know if there´s a chance to undo an activated OSB session with WLST?
    There´s a way to undo an UNactivated session but not an activated one (like the undo session in /sbconsole).
    Thanks in advance.
    Edited by: 956378 on 31-ago-2012 12:48

    "zone copy active-zoneset full-zoneset vsan 2" is the correct command.  It will overwrite the full zoneset (identical) and ready to edit.

  • Rename OSB resource with WLST

    Hi!
    I need help, please... I would like to rename OSB resources (e.g. OSB project name, proxy service,...) with WLST.
    Could anyone help me ho to do this?
    I tried to navigate in WLST but I can't find the OSB resource (for example proxy service) which I wanted to rename. Where should I look for it?
    And which WLST command do I have to execute?
    As I know the commands in WLST are in session, so the changes activate at the same time, don't they?
    Thanks for help in advance!
    Regards,
    Viktor

    Could someone please help me?
    Thanks!

  • Check Box With Tick Mark on Sap Script

    Hello All,
    We need to add a check box with tick mark on Sap Script.Please can anyone let me know how can we add it.
    Regards
    Amruta

    hi amruta,
    The soluti as an image into on to your problem can be to use the symbol icon as told , but this may show in preview not in print.
    I too faced the same problem.
    So what i had done is created a new window with the diemnsions of the chekc box with border thcikness 8 tw and inside that window place a checkmark symbol.
    if this checkmark symbol also does not show up in print preview/  doesshow in print preview and not in print then you can scan a chekcmark image and upload it into business document server as a BMP/ TIFF image and use this image in your checkbox window.
    Hope this solves your problem.
    Warm Regards
    Venugopal.T

  • OSB: Is it possible to change throttling settings with WLST?

    Hi all,
    I am trying to find a solution to change the throttling settings of a business service with WLST, since it is not possible to set it in the customization file.
    I already know the parameter alsbImportPlan.setPreserveExistingOperationalValues(boolean) to preserve or change the operational values with the imported jar file, but I cannot find how to change the parameters separately for a business service (e.g. throttling state, max concurrency).
    Thanks for any help,
    Katja

    Hi Fabio,
    thanks for your approach. Could you give me some more ideas how to do that exactly? What do you mean with "write a code"? With WLST it does not work, I think. So you mean some code to extract the jar, change the xml, package the jar again and then deploy it? We need the changes at deployment time, because the settings have to be adjusted for the different environments.
    Best regards,
    Katja

  • Weblogic Administration Server start with WLST

    Hi Team,
    I am looking for some WLST script to start the WLS Admin server and then check the status of the Adminserver as well.
    When i tried thee command startServer( Adminserver, myserver, domainname, Domaindir )
    its not working the way i want it to.....So if you tell me some way to check if its not running and start it with WLST...
    I can do the same thing using Shell scripting but not WLST..
    Also is there any way in jython language to execute the script from a file.
    i use exec startmyfile.sh but it does not recognize it.
    help appreciated!!

    You can see an overview presentation of WLST here:
    http://www.slideshare.net/jambay/weblogic-server-weblogic-scripting-tool-overview-presentation/
    There is an Oracle By Example (OBE) tutorial for WLST here:
    http://www.oracle.com/technology/obe/fusion_middleware/wls103/SystemMgmt/Command_Line/Command_Line.html
    I think both of these resources would be valuable for you.

  • ECATT Script with SAPGUI Commando works in consolidation but not in prod.

    Hi experts,
    I created a eCATT script with commando SAPGUI Rec. In our consolidation system it works fine but when I try to let it run in production it is not working. User scripting is enabled (in options and in rz11). I am starting the script, the production system is getting opened but afterwards there happens nothing anymore. Also the scriptingsign in the bottom right corner is not active.
    When I am running a script with TCD Rec, it works fine in production. Is there a difference between settings for scripting for TCD Rec and SAPGUI scripting? Do you have any idea which kind of influences there could be that make this difference between TCD Rec and SAPGUI Rec scripts?
    Best regards and thank you in advance!
    Jan

    Hello,
    Ideally we should not run the ecatts in the production system as this would hamper the system environment or change systems.
    Also check in RZ11 enter sapgui/user_scripting , here the values for the last three parameters are set to TRUE.
    Thanks & Best regards,
    Ajay

  • Accessing JDBCSystemResources with WLST

    Hi All,
    I am getting an strange error while reading JDBCSystemResources with WLST. I am trying to read 'JDBCSystemResources/MedRecGlobalDataSource/JDBCResource/MedRecGlobalDataSource/JDBCDriverParams/MedRecGlobalDataS
    ource/DriverName ( and all properties at this level) but I am getting "Key property can not be empty error" (javax.management.MalformedObjectNameException: Key properties cannot be empty)
    Though I am able to traverse to this bean from wlst command line using cd () and lS() gives the value correctly but when I call get(), the above exception is thrown.
    my sample python code is as follows:
    try:
    connect('weblogic','weblogic','t3://127.0.0.1:7011')
    except:
    print "Couldn't establish connection to adminserver."
    print "Please check ADMIN_IP,ADMIN_PORT or AdminServer is running."
    exit()
    redirect('myoutput.txt')
    property='JDBCSystemResources/MedRecGlobalDataSource/JDBCResource/MedRecGlobalDataSource/JDBCDriverParams/MedRecGlobalDataS
    ource/DriverName'
    propertyArray=property.split("/")
    try:
    param=get(property)
    try:
    print('\t' + propertyArray[-1] + '\t' + ':' + '\t' + param.toString())
    except:
    try:
    print('\t' + propertyArray[-1] + '\t' + ':' + '\t' + param)
    except:
    try:
    for x in param: print('\t' + propertyArray[-1] + '\t' + ':' + '\t' +
    x.toString())
    except:
    print('\t' + propertyArray[-1] + '\t' + ':' + '\t' + 'null')
    except:
    dumpStack()
    print(property)
    stopRedirect()
    disconnect()
    exit()
    I am really tensed ....Any help will be highly appreciated. I am using weblogic 9.2

    I don't know if Joe knows anything about your issue from my side is the first time I hear about WLST, anyway it sounds interesting, whenever I have the time to I will take a look at that. By the way be aware that it seems that your problem is not a jdbc related problem but a jmx one and maybe you have to put it in the weblogic.developer.interest.platform forum.
    Have you tried to get that parameter directly accessing the MBean using Java?
    http://edocs.bea.com/wls/docs92/jmx/accessWLS.html
    Edited by jrenck at 06/08/2007 5:44 AM

  • Anyone tried the new Weblogic Scripting Tool (WLST)?

    Has anyone tried using the new WebLogic Scripting Tool (WLST) that was recently
    posted on the dev2dev WebLogic Utilities site: http://dev2dev.bea.com/resourcelibrary/utilitiestools/adminmgmt.jsp
    It looks to be a handy tool that is built upon jython and enables you to easily
    navigate, inspect and manipulate the WebLogic MBean tree on a running server.
    It also has a nice scripting tool which allows you to convert a config.xml file
    into a script that can be run to recreate a domain or specific resources within
    the domain. This is exactly something I have been looking for because we occasionally
    recreate domains or subsets of a domain for testing and POC purposes.
    The utility is fairly well documented and works well for the most part. The only
    issue I have run into so far is that is does not seem to understand JMS Distributed
    Destinations. When I try to convert a config.xml that contains a DD to a script
    it throws a null pointer exception. I have not tried a cluster yet.
    I noticed the utility was authored by someone at BEA. Is there potential that
    BEA will support this in the future if it catches on? Has anyone had experience
    with WLST or jython that would cause you to reccomend (or not) using it?
    Thanks.

    Darryl,
    Thanks for the valuable feedback. My comments are inline.
    Darryl Stoflet wrote:
    As a fairly long time wlshell user who recently started testing wlst there are
    few features I have found lacking in wlst.
    1. For monitoring purposes I am frequently using the -g and -r options to wlshell's
    get command for graphing and repeating respectivelyI haven't looked at -g and -r options in wlshell, but will do so.
    Although there is no graphical monitoring of attributes in wlst, but
    there is certainly some monitoring capability (which will be enhanced
    further in the coming version). Please take a look at the
    monitorAttribute() function.
    wls:/(offline)> help('monitorAttribute')
    Description:
    Monitors the specified attribute every by polling every interval.
    Syntax:
    monitorAttribute(attributeName, interval, monitorFile)
    attributeName = Name of the attribue that you would like to monitor.
    interval = Time (in seconds) to wait before the next fetch
    monitorFile=[optional] File path where the monitored data will be
    written to.
    Example:
    wls:/mydomain/runtime/ServerRuntimes/myserver/ExecuteQueueRuntimes/weblogic.kernel.Default>
    monitorAttribute("ServicedRequestTotalCount",10)
    Press Return to quit monitoring
    Monitoring started for attribute ServicedRequestTotalCount
    wls:/(offline)>
    >
    2. wlshell 2.0 adds the option when connecting to the admin server to also connect
    to all managed servers in that domain. This is a nice feature for monitoring because
    you then have access to all the runtime mbeans in each managed serverYes, this indeed seems to be a very nice feature. We will consider this
    for our next release.
    >
    3. There is not a good way to pass cmd line options(variables) to wlst. In wlshell
    I can send cmd line options via -v. I have tried something similar with wlst using
    -loadProperties but this is a little laborious because I do not necessarily want
    to create a properties file when a passing in only one or two variables. Also
    I find loadProperties lacking somewhat (see 4 below)ok, I just realised that there is indeed a bug in wlst where the command
    line arguments are not being honored. In Jython one can access the
    command line arguments from the sys.argv variable. For example,
    java weblogic.WLST -i foo.py var1 var2 var3
    Initializing WebLogic Scripting Tool (WLST) ...
    Welcome to Weblogic Server Administration Scripting Shell
    Type help() for help on available commands
    wls:/offline> print sys.argv
    ['foo.py', 'var1', 'var2', 'var3']
    wls:/offline>
    But this isn't working properly, please keep using the loadProperties
    untill this has been fixed.
    >
    4) loadProperties treats all created variables as strings. While this is understandable
    from the perspective that getProperty returns a string, it would be nice if wlst
    was smart enough that when a property is numbers only its an int, otherwise a
    string etc.
    wlshell does this logic/conversion for you which really simplifies calling methods
    that expect the particular datatype. To get around this problem you can create a script file say,
    variables.py which would look like,
    # variables that will be used
    theInterpreter.set('var1',10)
    theInterpreter.set('var2','i am a string')
    java weblogic.WLST variables.py
    Initializing WebLogic Scripting Tool (WLST) ...
    Welcome to Weblogic Server Administration Scripting Shell
    Type help() for help on available commands
    wls:/(offline)> print var1
    10
    wls:/(offline)> print var2
    'i am a string'
    >
    5. I'd like to be able to send cmd output etc to a file while running within wlst.
    In wlshell its a simple as adding >> filename to the end of the command. In wlst it is not as simple as doing >>, it is more than that. You can
    choose any output stream to direct your output to. In your case you can
    create a FileOutputStream and route the output to this stream for any
    particular command.
    Example,
    # create a file output stream say fos
    from java.io import FileOutputStream
    fos = FileOutputStream("output.txt")
    # save the default output stream to a variable to
    # switch it back
    sys.stdout=fos
    # Now all output for any function will go to output.txt
    ls()
    cd('foo')
    # after done with your functions switch it back
    sys.stdout=origOutput
    This is the right Jython way to do it. This works for all output streams
    , very useful when you embed an interpreter in a servlet and would like
    to display the output via a PrintStream etc.
    >
    >
    All in all wlst is a nice tool. Personally if the above features were added it
    would be much easier to transistion to wlst for good.
    Also I really like the wlst offline tool. Its nice to be able to do the whole
    create and configure domain process with one tool. Will this be supported. Yes indeed. We are working on merging both the tools into one.
    I do
    not want to rely on it too much if it will not work in future weblogic versions.It will be supported in future release of weblogic.
    Thanks,
    -satya
    >
    Thanks,
    Darryl
    "Steve Hess" <[email protected]> wrote:
    Hello,
    I am the BEA Product Manager behind WLST.
    WLST, as it appears today on dev2dev, is an early release version of
    a tool that
    BEA does intend to support as part of our next major release. We decided
    to issue
    early versions of the tool because of the demand for a supported scripting
    solution,
    and to generate feedback from our user community. I encourage you to
    work with
    WLST, and assure you that this tool represents our current direction
    in management
    scripting.
    Also note, this newsgroup can be used to issue questions, concerns and
    feedback
    about WLST. The engineering and PM team will monitor this group and
    respond to
    your questions as quickly as we can. While we will not be able to respond
    to
    every feature request, we really value your suggestions, and will endeavor
    to
    improve the tool in ways that meet your real-world needs.
    Cheers,
    Steve Hess
    Director, WLS PM
    "George Lupanoff" <[email protected]> wrote:
    Has anyone tried using the new WebLogic Scripting Tool (WLST) that was
    recently
    posted on the dev2dev WebLogic Utilities site: http://dev2dev.bea.com/resourcelibrary/utilitiestools/adminmgmt.jsp
    It looks to be a handy tool that is built upon jython and enables you
    to easily
    navigate, inspect and manipulate the WebLogic MBean tree on a running
    server.
    It also has a nice scripting tool which allows you to convert a config.xml
    file
    into a script that can be run to recreate a domain or specific resources
    within
    the domain. This is exactly something I have been looking for because
    we occasionally
    recreate domains or subsets of a domain for testing and POC purposes.
    The utility is fairly well documented and works well for the most part.
    The only
    issue I have run into so far is that is does not seem to understandJMS
    Distributed
    Destinations. When I try to convert a config.xml that contains a DDto
    a script
    it throws a null pointer exception. I have not tried a cluster yet.
    I noticed the utility was authored by someone at BEA. Is there potential
    that
    BEA will support this in the future if it catches on? Has anyone had
    experience
    with WLST or jython that would cause you to reccomend (or not) using
    it?
    Thanks.

  • My super simple ip checking script

    i have a small home network with a PC running arch that acts as a NAT router; in the near future i am planning on setting up VPN access on this arch box. i would assume that it is imperative to know the external IP address of the router in order to connect. my ISP is comcast (cable) and they seem to be rather active in changing my DHCP'd address i get from them (in the past 6 months i have had 3 different ones). so i wrote this bash script that runs in the background and monitors the IP of the external interface. its pretty self explanatory; the mails to "vtext.com" are so i can have it texted to me. pointers would be welcome. i am not particularly a programmer, much more just an admin. the awk stuff seems messy, like there should be an easier way to isolate strings than that.... but idk. i run it
    #!/bin/bash
    # IP CHECK 2.0 (file name/path: /etc/scripts/ipcheck)
    # runs in the background and
    # requires sleep, mailx & ifconfig
    # assumes external interface named "eth0"
    # current ip output file path - single-line file containing current address (needs to be writable)
    OPATH="/var/ipcheck/currentip"
    # Amount of seconds to wait between checks
    WAITSECS=300 # 5 mins
    # Read previous IP from specified $OPATH file, if it's there
    if [ -f "$OPATH" ]; then
    OLDIP=`cat $OPATH`;
    fi
    # Begin main program loop
    while :
    do
    # retrieve new ip using ifconfig
    NEWIP=`/sbin/ifconfig eth0 | awk 'BEGIN{FS="inet ";RS=" netmask"}/</{print $2}' | tr -d '\\n' | tr -d ' '`
    # print whatever was awk'd and the current date/time to tty11
    echo "========= $NEWIP -- `date`" >> /dev/tty11
    # if a different NEW IP is detected AND it isn't a null value, then do the following:
    # * write the new address out to the OPATH file, replacing the previous value
    # * e-mail the new address to my phone via vtext.com
    # * e-mail both the old and new addresses to my main e-mail account
    # * reset the $OLDIP value as the new one
    if [[ "$OLDIP" != "$NEWIP" && "$NEWIP" != "" ]]; then
    echo $NEWIP > $OPATH
    echo "======= New Address - Old IP: $OLDIP ---- New IP: $NEWIP" >> /dev/tty12
    echo "New IP: $NEWIP" | /usr/bin/mailx [email protected]
    echo "Old IP: $OLDIP" | /usr/bin/mailx -s "New IP: $NEWIP" [email protected]
    OLDIP=$NEWIP
    fi
    # pause in between checks, then start again
    sleep $WAITSECS
    done

    falconindy wrote:
    Isola wrote:
    Here's my IP checking script, modified for mailx
    #!/bin/bash
    curl ifconfig.me | read IP
    [ "x$IP" == "x`tail -n1 /tmp/wanip`" ] && exit 0
    echo New IP: $IP
    echo -n Old IP:
    cat /tmp/wanip
    echo -n Number of times you had this IP before:
    grep $IP /tmp/wanip | wc -l
    } | mailx -s "New IP: $IP" [email protected] [email protected]
    echo $IP >> /tmp/wanip
    This can't possibly work as is... The assignment in the first line happens in a subshell. It's going to be blank in the rest of the script.
    Okay I admit, I just wrote that without testing it
    edit:
    The 2nd line can be changed for this:
    read IP < <(curl ifconfig.me) || exit $?
    Or
    IP=$(curl ifconfig.me) || exit $?
    Last edited by Isola (2012-07-01 00:59:39)

  • Execution of Coded UI scripts with least possible test execution time in Windows7 Operating system using Visual Studio Test Agent 2010 without VS2010 installed

    Hi All,
    We are trying to execute coded UI scripts without Visual Studio installed. We are using “Visual Studio Test Agent 2010” for executing coded UI scripts without VS2010 in Windows 7, it is working fine. Also we verified executing the same script with VS2010
    Premium, it works fine as well.
    Here the challenge we are facing is with the Test execution time.
    When we run the coded UI script with IE11-Windows 7 OS-Visual Studio 2010 Premium it takes
    3min 36sec to complete the execution whereas with IE11-Windows 7 OS-Visual Studio Test Agent 2010  it takes
    6min 40sec for the same script to execute (which is almost double the time it takes while executing using VS2010).
    My question is what may be the reason for this difference? and how we can reduce the test execution time when running from Test Agent 2010?
    Kindly let us know what is the best practice to execute the coded UI scripts with least test execution time in Windows 7 Operating system using Visual Studio Test Agent 2010 without VS2010
    installed.
    Looking forward for your positive response.
    Thanks in advance..!!

    Tina-Shi, Thanks for the information.
    As you mentioned, we tried to execute the coded UI test using Mstest.exe in command on VS2010 Premium and checked on the execution
    time, there was a slight difference.
    Please find below execution time.
    Using Mstest.exe in command on VS2010 Premium/Win7 – 3.47 minutes
    Using VS2010 Premium/Win7 – 3.53 minutes
    Using Test Agent/Win7 – 7.3 minutes
    Also, I closed all the other processes in Task manager before starting up the execution.
    Still , I am facing the same Issue. Could you please suggest any other way to reduce the scripting time of coded UI script execution
    through Test agent 2010.
    Looking forward for your earliest response.

  • Update deployment plan definition with WLST

    Hello,
    I would like to write a script in order to get the existing deployemnt plan of my deployed application (Deployement plan is yet modified, I don't want to use loadApplication). Then I would to update my deployement plan (update/add work manager constraints).
    I can't find any WLST api to do that. The Weblogic console doesn't record the actions when I do it through the console.
    I would like top the the same as this link http://download.oracle.com/docs/cd/E15051_01/wls/docs103/config_scripting/updateplan.html
    But with a deploymenPlan got from the server and not from the filesystem
    The only way I see is to use a Java parser un Jython to update the existing deployemnt plan and then, redeploy the application but This solution is very heavy in term of developpment. It should be more efficient when a built in parser
    Could you please help me giving me some information about how to update deployement plans of a yet deployed application with WLST ?
    Thank you !
    C.

    Thank you for answering.
    In fact, I have found the solution for my use case according to the previous html link
    The WLST plan seems to be accessible only by file system.
    If your application is yet deployed with a deployment plan and you want to update this plan, you have to login on the admin server via WLST,get the application absolute path and the plan absoluth path :
    cd ("AppDeployments/" + INTERNAL_APP_NAME)
    appPath  = cmo.getAbsoluteSourcePath()
    planPath = cmo.getAbsolutePlanPath()and then, load the existing plan :
    plan = loadApplication(appPath, planPath)after that, you can use the api described at the following link http://download.oracle.com/docs/cd/E15051_01/wls/docs103/config_scripting/updateplan.html to update the plan.
    Then, you have to redeploy the application :
    redeploy(APP_NAME)Thank you for helping !
    C.

Maybe you are looking for