Forum Discussion

E_Lenny_Brown_1's avatar
E_Lenny_Brown_1
Icon for Nimbostratus rankNimbostratus
Oct 11, 2004

Can I get a code example

Can I get a code example showing:

 

 

ITCMGlobalLB.Wideip.add_pool_virtual_server

 

 

in perl (SDK 4.6.2)?

 

 

Thanks

 

Lenny Brown

 

  • Here you go. I've hard coded in the values. For this method to work you need to make sure the following:

     

     

    1. The Wideip already exists.

     

    2. The Pool is created within the Wideip.

     

    3. The Virtual Server is defined as a Server (BIG-IP, Host, 3-DNS, EDGE-FX, Router).

     

    4. If you want dependencies, the depends array must point to valid defined servers as well.

     

     

    With that being said, here is some code that will do the trick. You will get Error messages to the effect of ITCMGlobalLB::NotExist or ITCMGlobalLB::DuplicateEntry if you submit invalid parameters or a VS that is already defined in the Wip Pool.

     

     

    Hope this helps!

     

     

    -Joe

     

     

       
     sub addWideipPoolVS()    
     {    
         Build up parameters    
        my $wideip_name = "mywip.foo.com";    
        my $pool_name = "web_servers";    
          
        my $vs_source = { addr => "123.123.123.1", port => "80" };    
        my $vs_trans = { addr => "10.10.10.1", port => "80" };    
        my $vs_depends = { addr => "192.168.11.149", port => "80" };    
        my $vs_ratio = 0;    
        my $vs_status = 0;  ENABLE    
        my $vs_state = 0;  STAT_BLUE    
          
        my $vsAttr =    
        {    
           source => $vs_source,    
           translated => $vs_trans,    
           depends => [$vs_depends],    
           ratio => $vs_ratio,    
           status => $vs_status,    
           state => $vs_state    
        };    
              
        $soapResponse = $Wideip->add_pool_virtual_server    
        (    
           SOAP::Data->name(wideip_name => $wideip_name),    
           SOAP::Data->name(pool_name => $pool_name),    
           SOAP::Data->name(vs => $vsAttr)    
        );    
        if ( $soapResponse->fault )    
        {    
           print $soapResponse->faultcode, " ", $soapResponse->faultstring, "\n";    
        }    
        else    
        {    
           print "Pool Virtual Server added successfully.\n";    
        }    
     }