Adding a iRule to a Virtual Server
I was trying to write a script to allow me to add an existing iRule to an existing Virtual Server. I am receiving the following error when I run the script: 'Could not find element by name: rule_name'. Any help would be appreciated.
Below is the script:
!/usr/bin/env python
import sys
import pycontrol.pycontrol as pc
b = pc.BIGIP(
hostname = "F5l",
username = "username",
password = "Password",
fromurl = True,
wsdls = ['LocalLB.VirtualServer'])
c = b.LocalLB.VirtualServer
def convert_rule(z,rule):
rule_seq = z.LocalLB.VirtualServer.typefactory.create('LocalLB.VirtualServer.VirtualServerRuleSequence')
rule_set = z.LocalLB.VirtualServer.typefactory.create('LocalLB.VirtualServer.VirtualServerRule')
rule_set.rule_name = rule
rule_set.priority = 500
rule_seq = [rule_set]
return rule_seq
c.add_rule(['VIP'],convert_rule(b,'iRule'))