Forum Discussion

jj24_43946's avatar
jj24_43946
Icon for Nimbostratus rankNimbostratus
Jun 23, 2011

Help with LocalLB::VirtualServer::add_rule

Hi there,

 

I'm trying to apply an existing iRule to an existing monitor. Though I don't get an error, I don't see the iRules being applied.

 

 

my DS looks like this:

 

 

my @VirtualServerRules;

 

if ( $f5_vs_name =~ m/Https/ ) {

 

my $VirtualServerRule = {

 

rule_name => 'HA_https_splash_redirect',

 

priority => 1

 

};

 

push ( @VirtualServerRules, $VirtualServerRule );

 

$VirtualServerRule = {

 

rule_name => 'SSL_Renegotiate_Disable',

 

priority => 1

 

};

 

push ( @VirtualServerRules, $VirtualServerRule );

 

}

 

else {

 

my $VirtualServerRule = {

 

rule_name => 'HA_http_splash_redirect',

 

priority => 1

 

};

 

push ( @VirtualServerRules, $VirtualServerRule );

 

}

 

 

 

my $soapResponse = $VirtualServer->add_rule

 

(

 

SOAP::Data->name(virtual_servers => [$f5_vs_name]),

 

SOAP::Data->name(rules => @VirtualServerRules),

 

);

 

 

print "iRules for virtual server $f5_vs_name applied successfully\n"

 

}

 

 

Would someone happen to have a perl sample handy for applying irules to monitors?? Thanks a lot!

 

  • Here's how I've done it in the past.

    sub addVSRule()
    {
        my ($virtual, $rulename, $priority) = (@_);
        if ( ("" eq $virtual) or ("" eq $rulename) or ("" eq $priority) )
        {
            usage();
        }
        
        $VirtualServerRule = {
            rule_name => $rulename,
            priority => $priority
        };
        push @VirtualServerRuleList, $VirtualServerRule;
        push @VirtualServerRuleAofA, [@VirtualServerRuleList];
        
        $soapResponse = $VirtualServer->add_rule(
            SOAP::Data->name(virtual_servers => [$virtual]),
            SOAP::Data->name(rules => [@VirtualServerRuleAofA])
        );
        &checkResponse($soapResponse);
    }

    -Joe