Forum Discussion

fanghe_315215's avatar
fanghe_315215
Icon for Altocumulus rankAltocumulus
Nov 10, 2017

How to configure data-group item via Pyhon?

import urllib3
from f5.bigip import ManagementRoot
from f5.bigip import Ltm

urllib3.disable_warnings()
mgmt = ManagementRoot("10.16.0.11", "admin", "t&v'6%>D{Gb>^KB")
print(mgmt)
ltm = mgmt.tm.ltm
print(ltm)

rule_collection = ltm.rules.get_collection()

print(rule_collection)

data_collection = ltm.data_group.get_collection()

print(data_collection)

pool_collection = ltm.pools.get_collection()

print(pool_collection)
`

/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 /Users/howard/PycharmProjects/F5/main.py

 

< object at 0x102243898>

 

< object at 0x103848978>

 

[< object at 0x103834d68>, < object at 0x103834eb8>, < object at 0x1038489e8>, < object at 0x103848dd8>, < object at 0x1038486a0>, < object at 0x1038485f8>, < object at 0x103848470>, < object at 0x103848908>, < object at 0x103877160>, < object at 0x1038772e8>, < object at 0x1038773c8>, < object at 0x1038774a8>, < object at 0x103877588>, < object at 0x103877668>, < object at 0x103877748>, < object at 0x103877828>, < object at 0x103877908>, < object at 0x103834fd0>, < object at 0x103848518>]

 

[{'reference': {'link': ''}}, {'reference': {'link': ''}}]

 

[< object at 0x1038487f0>, < object at 0x103848710>, < object at 0x103877470>, < object at 0x103877d68>]

 

Process finished with exit code 0

 

Why data-group return not the same as others,plzzzzzz help me how to show data-group item ,Thanks

 

  • data_collection = ltm.data_group.internals.get_collection()
    trustadditem = ltm.data_group.internals.internal.load(name='trustedAddresses', partition='Common')
    trustaddrecords = trustadditem.records
    for i in trustaddrecords:
        print(i)
    
  • data_collection = ltm.data_group.internals.get_collection()
    trustadditem = ltm.data_group.internals.internal.load(name='trustedAddresses', partition='Common')
    trustaddrecords = trustadditem.records
    for i in trustaddrecords:
        print(i)