Thank you Dario. I agree with what you're saying, it just seems that REST using the requests module seems to match up a little better with the TMSH command structure than the sdk. Taking your advice, the following code worked well. Thank you for your input.
from f5.bigip import ManagementRoot
from getpass import getpass
PASSWORD = getpass()
session = ManagementRoot("lab-ltm", "admin", PASSWORD, token=True)
def node():
nodes = [
{"name": "node-test1", "address": "1.1.1.40"},
{"name": "node-test2", "address": "2.2.2.80"},
]
for node in nodes:
nodes = session.tm.ltm.nodes.node.create(
name=node["name"], address=node["address"], partition="Common"
)
pool()
def pool():
pool = session.tm.ltm.pools.pool.create(name="pool-test", monitor="tcp")
pool_load = session.tm.ltm.pools.pool.load(name="pool-test")
nodes = ["node-test1:80", "node-test2:80"]
for node in nodes:
member_load = pool_load.members_s.members.create(name=node, partition="Common")
virtual()
def virtual():
params = {
"name": "vs-test-virtual",
"destination": "200.200.200.200:8080",
"mask": "255.255.255.255",
"ipProtocol": "tcp",
"pool": "test_pool",
"profiles": [
"http",
"f5-tcp-wan",
{"name": "clientssl", "context": "clientside"},
],
"partition": "Common",
"sourceAddressTranslation": {"type": "automap"},
}
virtual = session.tm.ltm.virtuals.virtual.create(**params)
if __name__ == "__main__":
node()