Creating or updating a site-level value of a substitution parameter

Suppose that you created a browser test with the global substitution parameters UserName and Password but require the values of those parameters to be different on each Backbone site where the test is deployed. Your first step should be to take a snapshot of the current state of the browser test by sending a GetParameterizedMonitors() request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:prov="http://www.gomeznetworks.com/schemas/provisioning">
   <soapenv:Header/>
   <soapenv:Body>
      <prov:GetParameterizedTestsRequest>
         <prov:Credentials>
            <prov:UserName>testuser</prov:UserName>
            <prov:Password>testpassword</prov:Password>
         </prov:Credentials>
         <prov:ParameterizedTestFilter>
            <prov:MonitorId>208123</prov:MonitorId>
         </prov:ParameterizedTestFilter>
      </prov:GetParameterizedTestsRequest>
   </soapenv:Body>
</soapenv:Envelope>

The response appears below:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <GetParameterizedTestsResponse
           xmlns="http://www.gomeznetworks.com/schemas/provisioning">
         <ResponseStatus>SUCCESS</ResponseStatus>
         <ParameterizedMonitor monitorId="208123"
                               createDate="2012-03-26T20:46:05.207"
                               modifyDate="2012-03-26T20:46:06.657"
                               monitorStatus="Active">
            <SubstitutionParameters>
               <SubstitutionParameter id="0" name="UserName" value="myusername"/>
               <SubstitutionParameter id="1" name="Password" value="mypassword"/>
            </SubstitutionParameters>
            <MonitorSites>
               <MonitorSite siteId="886"/>
            </MonitorSites>
         </ParameterizedMonitor>
      </GetParameterizedTestsResponse>
   </soap:Body>
</soap:Envelope>

The response shows that the test has only been deployed to one Backbone site (886). Currently, a site-level value could be added for that site, but there is probably a need to deploy the monitor to more Backbone sites prior to setting site-level values for each Backbone site. The Test Management API provides two methods for augmenting the number of Backbone sites where a test is deployed. First, you can obtain the list of Backbone sites available to the account by issuing the GetSites() query:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:prov="http://www.gomeznetworks.com/schemas/provisioning">
   <soapenv:Header/>
   <soapenv:Body>
      <prov:GetSitesRequest>
         <prov:Credentials>
            <prov:UserName>testuser</prov:UserName>
            <prov:Password>testpassword</prov:Password>
         </prov:Credentials>
      </prov:GetSitesRequest>
   </soapenv:Body>
</soapenv:Envelope>

The response appears below:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <GetSitesResponse
           xmlns="http://www.gomeznetworks.com/schemas/provisioning">
         <ResponseStatus>SUCCESS</ResponseStatus>
         <MonitorSites>
            <MonitorSite siteId="777" siteName="TPNTS7 - MA: Boston" city="Lexington"
                         state="MA" countryCode="US" ipV6Enabled="false"/>
            <MonitorSite siteId="850" siteName="TPNDC9BAE1 - Boston MA - SAVVIS" city="WALTHAM"
                         state="MA" countryCode="US" ipV6Enabled="true"/>
            <MonitorSite siteId="865" siteName="TPNPEKSA12 - Beijing China test" city="Beijing"
                         state="" countryCode="CN" ipV6Enabled="false"/>
            <MonitorSite siteId="866" siteName="TPNPEKSA02 - Beijing China test" city="Beijing"
                         state="" countryCode="CN" ipV6Enabled="false"/>
            <MonitorSite siteId="867" siteName="TPNTS18 - Boston, MA - Savvis" city="Waltham"
                         state="MA" countryCode="US" ipV6Enabled="false"/>
            <MonitorSite siteId="868" siteName="TPNTS17 - Boston, MA - Savvis" city="Waltham"
                         state="MA" countryCode="US" ipV6Enabled="false"/>
            <MonitorSite siteId="872" siteName="TPNTS16BA01 - Boston, MA - Savvis" city="Boston"
                         state="MA" countryCode="US" ipV6Enabled="false"/>
            <MonitorSite siteId="873" siteName="G7 Test Private Agent (NEW)" city="Boston"
                         state="MA" countryCode="US" ipV6Enabled="false"/>
            <MonitorSite siteId="880" siteName="TPNTS13 - Boston, MA - Savvis" city="Boston"
                         state="MA" countryCode="US" ipV6Enabled="false"/>
            <MonitorSite siteId="881" siteName="TPNTS12 - Boston, MA - Savvis" city="Boston"
                         state="MA" countryCode="US" ipV6Enabled="true"/>
            <MonitorSite siteId="884" siteName="TPNTS10 - Boston, MA - Savvis" city="Boston"
                         state="MA" countryCode="US" ipV6Enabled="false"/>
            <MonitorSite siteId="885" siteName="TPNTS9 - Boston, MA - Savvis" city="Boston"
                         state="MA" countryCode="US" ipV6Enabled="false"/>
            <MonitorSite siteId="886" siteName="TPNTS8 - Boston, MA - Savvis" city="Boston"
                         state="MA" countryCode="US" ipV6Enabled="false"/>
            <MonitorSite siteId="887" siteName="TPNTS11 - Boston, MA - Savvis" city="Boston"
                         state="MA" countryCode="US" ipV6Enabled="true"/>
         </MonitorSites>
      </GetSitesResponse>
   </soap:Body>
</soap:Envelope>

If the monitor must support IP version 6, you will have to pay attention to the value of ipV6Enabled for each MonitorSite in the response and only choose monitor sites that so qualify.

Now that you know what sites are available, you may update the monitor with the following request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:prov="http://www.gomeznetworks.com/schemas/provisioning">
 <soapenv:Header/>
 <soapenv:Body>
    <prov:UpdateTestParametersRequest>
       <prov:Credentials>
          <prov:UserName>testuser</prov:UserName>
          <prov:Password>testpassword</prov:Password>
       </prov:Credentials>
       <!--1 or more repetitions:-->
       <prov:PartialUpdate monitorId="208123">
          <prov:MonitorSites>
            <prov:MonitorSite siteId="777" siteName="TPNTS7 - MA: Boston"
                    city="Lexington" state="MA" countryCode="US" ipV6Enabled="false"/>
            <prov:MonitorSite siteId="865" siteName="TPNPEKSA12 - Beijing China test"
                    city="Beijing" state="" countryCode="CN" ipV6Enabled="false"/>
            <prov:MonitorSite siteId="866" siteName="TPNPEKSA02 - Beijing China test"
                    city="Beijing" state="" countryCode="CN" ipV6Enabled="false"/>
            <prov:MonitorSite siteId="867" siteName="TPNTS18 - Boston, MA - Savvis"
                    city="Waltham" state="MA" countryCode="US" ipV6Enabled="false"/>
            <prov:MonitorSite siteId="868" siteName="TPNTS17 - Boston, MA - Savvis"
                    city="Waltham" state="MA" countryCode="US" ipV6Enabled="false"/>
            <prov:MonitorSite siteId="872" siteName="TPNTS16BA01 - Boston, MA - Savvis"
                    city="Boston" state="MA" countryCode="US" ipV6Enabled="false"/>
            <prov:MonitorSite siteId="873" siteName="G7 Test Private Agent (NEW)"
                    city="Boston" state="MA" countryCode="US" ipV6Enabled="false"/>
            <prov:MonitorSite siteId="880" siteName="TPNTS13 - Boston, MA - Savvis"
                    city="Boston" state="MA" countryCode="US" ipV6Enabled="false"/>
            <prov:MonitorSite siteId="881" siteName="TPNTS12 - Boston, MA - Savvis"
                    city="Boston" state="MA" countryCode="US" ipV6Enabled="true"/>
            <prov:MonitorSite siteId="884" siteName="TPNTS10 - Boston, MA - Savvis"
                    city="Boston" state="MA" countryCode="US" ipV6Enabled="false"/>
            <prov:MonitorSite siteId="885" siteName="TPNTS9 - Boston, MA - Savvis"
                    city="Boston" state="MA" countryCode="US" ipV6Enabled="false"/>
            <prov:MonitorSite siteId="886" siteName="TPNTS8 - Boston, MA - Savvis"
                    city="Boston" state="MA" countryCode="US" ipV6Enabled="false"/>
            <prov:MonitorSite siteId="887" siteName="TPNTS11 - Boston, MA - Savvis"
                    city="Boston" state="MA" countryCode="US" ipV6Enabled="true"/>
            </prov:MonitorSites>
         </prov:PartialUpdate>
      </prov:UpdateTestParametersRequest>
   </soapenv:Body>
</soapenv:Envelope>

Once this request completes successfully, the monitor will now be deployed to all the sites in the previous request (and to no other sites, regardless how the monitor was previously configured).

Issuing the GetTests() query or the GetParamerizedTests() query will further confirm that the monitor is now deployed to the new sites. However, this further confirmation should not be necessary, for the monitor update would fail if the test could not be deployed to any of the sites in the update request.

Now that the monitor has been deployed to multiple sites, the site-level substitution parameters can be created. The following request would do the job:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:prov="http://www.gomeznetworks.com/schemas/provisioning">
   <soapenv:Header/>
   <soapenv:Body>
      <prov:AddOrUpdateSubstitutionParametersRequest>
         <prov:Credentials>
            <prov:UserName>testuser</prov:UserName>
            <prov:Password>testpassword</prov:Password>
         </prov:Credentials>
         <!--1 or more repetitions:-->
         <prov:ParameterizedMonitor monitorId="263717">
            <prov:MonitorSites>
               <!--Zero or more repetitions:-->
               <prov:MonitorSite siteId="777">
                  <SubstitutionParameters>
                     <SubstitutionParameter id="0" name="UserName" value="user1"/>
                     <SubstitutionParameter id="1" name="Password" value="password1"/>
                  </SubstitutionParameters>
               </prov:MonitorSite>
               <prov:MonitorSite siteId="865">
                  <SubstitutionParameters>
                     <SubstitutionParameter id="0" name="UserName" value="user2"/>
                     <SubstitutionParameter id="1" name="Password" value="password2"/>
                  </SubstitutionParameters>
               </prov:MonitorSite>
               <prov:MonitorSite siteId="866">
                  <SubstitutionParameters>
                     <SubstitutionParameter id="0" name="UserName" value="user3"/>
                     <SubstitutionParameter id="1" name="Password" value="password3"/>
                  </SubstitutionParameters>
               </prov:MonitorSite>
               <prov:MonitorSite siteId="867">
                  <SubstitutionParameters>
                     <SubstitutionParameter id="0" name="UserName" value="user4"/>
                     <SubstitutionParameter id="1" name="Password" value="password4"/>
                  </SubstitutionParameters>
               </prov:MonitorSite>
               <prov:MonitorSite siteId="868">
                  <SubstitutionParameters>
                     <SubstitutionParameter id="0" name="UserName" value="user5"/>
                     <SubstitutionParameter id="1" name="Password" value="password5"/>
                  </SubstitutionParameters>
               </prov:MonitorSite>
               <prov:MonitorSite siteId="872">
                  <SubstitutionParameters>
                     <SubstitutionParameter id="0" name="UserName" value="user6"/>
                     <SubstitutionParameter id="1" name="Password" value="password6"/>
                  </SubstitutionParameters>
               </prov:MonitorSite>
               <prov:MonitorSite siteId="873">
                  <SubstitutionParameters>
                     <SubstitutionParameter id="0" name="UserName" value="user7"/>
                     <SubstitutionParameter id="1" name="Password" value="password7"/>
                  </SubstitutionParameters>
               </prov:MonitorSite>
               <prov:MonitorSite siteId="880">
                  <SubstitutionParameters>
                     <SubstitutionParameter id="0" name="UserName" value="user8"/>
                     <SubstitutionParameter id="1" name="Password" value="password8"/>
                  </SubstitutionParameters>
               </prov:MonitorSite>
               <prov:MonitorSite siteId="881">
                  <SubstitutionParameters>
                     <SubstitutionParameter id="0" name="UserName" value="user9"/>
                     <SubstitutionParameter id="1" name="Password" value="password9"/>
                  </SubstitutionParameters>
               </prov:MonitorSite>
               <prov:MonitorSite siteId="884">
                  <SubstitutionParameters>
                     <SubstitutionParameter id="0" name="UserName" value="user10"/>
                     <SubstitutionParameter id="1" name="Password" value="password10"/>
                  </SubstitutionParameters>
               </prov:MonitorSite>
               <prov:MonitorSite siteId="885">
                  <SubstitutionParameters>
                     <SubstitutionParameter id="0" name="UserName" value="user11"/>
                     <SubstitutionParameter id="1" name="Password" value="password11"/>
                  </SubstitutionParameters>
               </prov:MonitorSite>
               <prov:MonitorSite siteId="886">
                  <SubstitutionParameters>
                     <SubstitutionParameter id="0" name="UserName" value="user12"/>
                     <SubstitutionParameter id="1" name="Password" value="password12"/>
                  </SubstitutionParameters>
               </prov:MonitorSite>
               <prov:MonitorSite siteId="887">
                  <SubstitutionParameters>
                     <SubstitutionParameter id="0" name="UserName" value="user13"/>
                     <SubstitutionParameter id="1" name="Password" value="password13"/>
                  </SubstitutionParameters>
               </prov:MonitorSite>
            </prov:MonitorSites>
         </prov:ParameterizedMonitor>
      </prov:AddOrUpdateSubstitutionParametersRequest>
   </soapenv:Body>
</soapenv:Envelope>

You may be concerned about deploying a test that requires site-level substitution parameters before the values of those parameters can be provisioned. However, there is no need. A test can be provisioned in the inactive state and then activated after the site-level substitution parameters have been created.

The same request that creates the site-level substitution parameters can also be issued to change existing values. The Test Management API will automatically insert or update the site-level substitution parameters as necessary.