DataPower

DataPower

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Soma Script to get the list of users in Datapower appliances

    Posted Mon September 16, 2024 10:03 AM
    Hi
     
    Can anyone share me soma script to get list of users in Datapower appliances
     
    Thanks and appreciate your help

    I have tried this soma request

    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
       <env:Body>
          <dp:request domain="default" xmlns:dp="http://www.datapower.com/schemas/management">
               <dp:get-config class="UserSummary"/>
          </dp:request>
       </env:Body>
    </env:Envelope>



    ------------------------------
    Bhargav Chaluvadi
    ------------------------------


  • 2.  RE: Soma Script to get the list of users in Datapower appliances

    Posted Mon September 16, 2024 12:27 PM

    Change your config class from "UserSummary" to simply "User".



    ------------------------------
    Joseph Morgan
    CEO - Independent
    Joseph Morgan
    Dallas TX
    ------------------------------



  • 3.  RE: Soma Script to get the list of users in Datapower appliances

    Posted Tue September 17, 2024 05:39 AM
    Edited by Hermann Stamm-Wilbrandt Tue September 17, 2024 05:41 AM

    Joseph is right. I use "xmllint -format ..." to nicely format the XML response:

    $ cat u.xml 
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
       <env:Body>
          <dp:request domain="default" xmlns:dp="http://www.datapower.com/schemas/management">
               <dp:get-config class="User"/>
          </dp:request>
       </env:Body>
    </env:Envelope>
    $ 
    $ doSoma stammw:foobar u.xml dp-hermann-work.fyre.ibm.com:5550 2>err | xmllint -format -
    <?xml version="1.0" encoding="UTF-8"?>
    <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
      <env:Body>
        <dp:response xmlns:dp="http://www.datapower.com/schemas/management">
          <dp:timestamp>2024-09-17T05:38:04-04:00</dp:timestamp>
          <dp:config>
            <User xmlns:env="http://www.w3.org/2003/05/soap-envelope" name="admin" intrinsic="true">
              <mAdminState read-only="true">enabled</mAdminState>
              <UserSummary>Administrator</UserSummary>
              <AccessLevel read-only="true">privileged</AccessLevel>
            </User>
            <User xmlns:env="http://www.w3.org/2003/05/soap-envelope" name="stammw">
              <mAdminState>enabled</mAdminState>
              <UserSummary/>
              <AccessLevel>privileged</AccessLevel>
            </User>
            <User xmlns:env="http://www.w3.org/2003/05/soap-envelope" name="user1">
              <mAdminState>enabled</mAdminState>
              <AccessLevel>group-defined</AccessLevel>
              <GroupName class="UserGroup">unknown</GroupName>
            </User>
          </dp:config>
        </dp:response>
      </env:Body>
    </env:Envelope>
    $ 

    And this is "doSoma" script used:

    $ cat `which doSoma`
    #!/bin/bash
    curl -k -u $1 --data-binary @$2 https://$3/service/mgmt/current $4
    $ 
    



    ------------------------------
    Hermann Stamm-Wilbrandt
    Compiler Level 3 support, IBM DataPower Gateways
    IBM
    Boeblingen
    ------------------------------



  • 4.  RE: Soma Script to get the list of users in Datapower appliances

    Posted Tue September 17, 2024 08:28 AM

    Hello Hermann and Joseph, Good Day!

    It worked for me and able to get the user account details from DataPower appliance. Do we have any reference documentation for soma over internet.

    Thank you very much.

    Bhargav Chaluvadi,



    ------------------------------
    Bhargav Chaluvadi
    ------------------------------



  • 5.  RE: Soma Script to get the list of users in Datapower appliances

    Posted Tue September 17, 2024 10:03 AM
    Edited by Hermann Stamm-Wilbrandt Tue September 17, 2024 10:04 AM

    I once wrote a blog post on that topic with doc links and method to generate sample requests for all possible XML management requests:
    https://stamm-wilbrandt.de/en/blog/XML%20Management%20sample%20requests.html


    In short, it is all documented in these files:

    store:///
    !
    +--xml-mgmt.wsdl
       !
       +--xml-mgmt-ops.xsd
          !
          +--xml-mgmt-b2b.xsd
          !
          +--xml-mgmt.xsd
             !
             +--xml-mgmt-base.xsd



    ------------------------------
    Hermann Stamm-Wilbrandt
    Compiler Level 3 support, IBM DataPower Gateways
    IBM
    Boeblingen
    ------------------------------



  • 6.  RE: Soma Script to get the list of users in Datapower appliances

    Posted Wed October 09, 2024 12:40 AM

    Hi Hermann, 

    Can we create the User Accunt in Datapower using soma, Thanks in advance!



    ------------------------------
    bhargav chaluvadi
    ------------------------------



  • 7.  RE: Soma Script to get the list of users in Datapower appliances

    Posted Mon October 14, 2024 12:02 PM

    Hi Bhargav,

    I've been on vacation leave, and so haven't had access to see your 2nd request here.  I hope you have resolved your query by now, but, just in case, a basic SOMA request to create a user is:

    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
         <soapenv:Body>
            <dp:request xmlns:dp="http://www.datapower.com/schemas/management" domain="default">
    			<dp:set-config>
    				<User name="PUT_USER_NAME_HERE">
                        <mAdminState>enabled</mAdminState>
                        <Password>AN_INITIAL_PASSWORD</Password>
                        <SuppressPasswordChange>off</SuppressPasswordChange>
    					<AccessLevel>group-defined</AccessLevel>
    					<GroupName>A_USER_GROUP_NAME</GroupName>
    				</User>
    			</dp:set-config>
    		</dp:request>
    	</soapenv:Body>
    </soapenv:Envelope>
    

    You can send this like the request you sent, obviously replacing the all caps entries with the values you need.   There are other fields you can populate in that rquest, so don't read it as the end-all of creating a user.

    On a side-note, though, you could spend years writing your own toolset, and the overall cost of designing, testing, and maintenance is far more than what you'd pay for an existing commercial solution.  Have you looked into those?

    If not, go take a look, of course, at DPOD.  It is the most comprehensive monitoring solution for DataPower.  It's fast, sleek, and very informative.  However, it likely isn't as actionable as you need.  MyArch has a product called "dpBuddy" you can look into.   Unless they've added something recently, it is all command-line so enables you to build scripts.   There is a small learning curve to get all their command line stuff figured out, but I know of no limitations.   

    KumbaSoft has a product called "DPAA" you can check out as well.  It is super-fast, highly interactive, and you can do almost everything with a few clicks of the mouse.    Though there is no actionable tool even remotely more productive than "DPAA", it does not support the kind of scripting some want.

    So, you might want to look into it.



    ------------------------------
    Joseph Morgan
    CEO - Independent
    Joseph Morgan
    Dallas TX
    ------------------------------