Comment 1 for bug 2033280

Revision history for this message
Gregory Thiemonge (gthiemonge) wrote :

A simple script to use the driver-agent:

---
import sys
import yaml

from octavia_lib.api.drivers.driver_lib import DriverLibrary

dl = DriverLibrary()

try:
    resource_type = sys.argv[1]
    resource_id = sys.argv[2]
except:
    print(f"{sys.argv[0]} <resource_type> <resource_id>")
    sys.exit(1)

func = getattr(dl, f"get_{resource_type}")
ret = func(resource_id)

try:
    print(f"class {ret.__class__.__name__}")
    print(yaml.dump(ret.to_dict(recurse=True), default_flow_style=False))
except:
    print(f"Invalid return value {ret}")
---

$ python test-driver-agent.py pool 28bbfc3e-db6a-4f58-b7d3-6ee1fc90931e
class Pool
admin_state_up: true
alpn_protocols: null
ca_tls_container_data: null
ca_tls_container_ref: null
crl_container_data: null
crl_container_ref: null
description: null
healthmonitor: null
lb_algorithm: ROUND_ROBIN
listener_id: f1ebac18-9f59-4820-9d5e-4ac42bfe37e8
loadbalancer_id: a10f0339-1475-452b-8f1c-364b7923fb86
members: []
name: pool1
pool_id: 28bbfc3e-db6a-4f58-b7d3-6ee1fc90931e
project_id: 86f57e2e56874381a0d586263fc8d900
protocol: TCP
session_persistence: null
tls_ciphers: null
tls_container_data: null
tls_container_ref: null
tls_enabled: false
tls_versions: null