Forum Discussion
LTConfig::Field::get_values question
In [297]: b.LTConfig.Field.get_value.params
Out[297]:
[(class_instance_key, u'LTConfig.ClassInstanceKey'),
(field_instance_name, u'string')]
In [298]: syslog_instance = b.LTConfig.Class.typefactory.create('LTConfig.ClassInstanceKey')
In [299]: syslog_instance
Out[299]:
(LTConfig.ClassInstanceKey){
container = None
container_class = None
class_name = None
name = None
}
In [300]: syslog_instance.class_name = "syslog"
In [301]: syslog_instance.name = "syslog"
In [302]: b.LTConfig.Field.get_value(class_instance_key = syslog_instance, field_instance_name = 'include')
Out[302]: destination loghost { udp(10.20.5.11 port (514)); udp(10.20.4.167 port (514)); };
In [303]:
In [303]: b.LTConfig.Field.get_values.params
Out[303]:
[(class_instance_keys, u'LTConfig.ClassInstanceKeySequence'),
(field_instance_names, u'Common.StringSequenceSequence')]
In [304]: class_instance_key_seq = b.LTConfig.Class.typefactory.create('LTConfig.ClassInstanceKeySequence')
In [305]: class_instance_key_seq
Out[305]:
(LTConfig.ClassInstanceKeySequence){
_arrayType = ""
_offset = ""
_id = ""
_href=""
_arrayType = ""
}
In [306]: class_instance_key_seq.item = [ syslog_instance ]
In [307]: class_instance_key_seq
Out[307]:
(LTConfig.ClassInstanceKeySequence){
_arrayType = ""
_offset = ""
_id = ""
_href=""
item[] =
(LTConfig.ClassInstanceKey){
container = None
container_class = None
class_name = "syslog"
name = "syslog"
},
}
In [308]: field_instance_names_seq = b.LTConfig.Class.typefactory.create('Common.StringSequenceSequence')
In [309]: field_instance_names_seq
Out[309]:
(Common.StringSequenceSequence){
_arrayType = ""
_offset = ""
_id = ""
_href=""
_arrayType = ""
}
In [310]: field_instance_names_seq.item = [ 'include' ]
In [311]: field_instance_names_seq
Out[311]:
(Common.StringSequenceSequence){
_arrayType = ""
_offset = ""
_id = ""
_href=""
item[] =
"include",
}
In [312]: b.LTConfig.Field.get_values(class_instance_keys = class_instance_key_seq, field_instance_names = field_instance_names_seq )
Out[312]: [[]]
Note: I don't get an error but don't get any return values. Much less when trying to get multiple fields,
6 Replies
- hoolio
Cirrostratus
Am missing something stupid.
Magic 8 ball says maybe. Joe? - This looks to me like Python which is foreign to me. Anyone with PyControl knowledge that can shed any insight here. One of these days I'll have to brush up on Python...
- Alex__Applebaum
Employee
Yeah, must be something specific to python or pycontrol I'm not getting as powershell works just fine.
PS C:\Users\user> $LTField.get_values( ($syslog_class_instance) , (,('authpriv_from','authpriv_to','include')) )
notice
emerg
destination loghost { udp(10.20.5.11 port (514)); udp(10.20.4.167 port (514)); }; - Alex__Applebaum
Employee
Ahhh Duhhh. Was something stupid as suspected. After doing it in perl and powershell just fine and looking at the xml going across the wire, finally figured it out. I just had to double wrap that python object (can't just feed it an array syntax like perl/powershell, etc.).
Perl:
$soapResponse = $Field->get_values(
SOAP::Data->name( class_instance_keys => [ $class_instance_key ] ),
SOAP::Data->name( field_instance_names => [ [@fields] ] )
);
Python:
In [13]: field_instance_names_seq = b.LTConfig.Class.typefactory.create('Common.StringSequence')
In [14]: field_instance_names_seq.item = ['include']
In [15]: field_instance_names_seq_seq = b.LTConfig.Class.typefactory.create('Common.StringSequenceSequence')
In [17]: field_instance_names_seq_seq
Out[17]:
(Common.StringSequenceSequence){
_arrayType = ""
_offset = ""
_id = ""
_href = ""
_arrayType = ""
}
In [18]: field_instance_names_seq_seq.item = field_instance_names_seq
In [19]: field_instance_names_seq_seq
Out[19]:
(Common.StringSequenceSequence){
_arrayType = ""
_offset = ""
_id = ""
_href = ""
item =
(Common.StringSequence){
_arrayType = ""
_offset = ""
_id = ""
_href = ""
item[] =
"include",
}
}
In [20]: b.LTConfig.Field.get_values(class_instance_keys = class_instance_key_seq, field_instance_names = field_instance_names_seq_seq )
Out[20]: [[destination loghost { udp(10.20.5.11 port (514)); udp(10.20.4.167 port (514)); };]]
In [21]: field_instance_names_seq.item = ['include','authpriv_from','authpriv_to']
In [22]: field_instance_names_seq_seq
Out[22]:
(Common.StringSequenceSequence){
_arrayType = ""
_offset = ""
_id = ""
_href = ""
item =
(Common.StringSequence){
_arrayType = ""
_offset = ""
_id = ""
_href = ""
item[] =
"include",
"authpriv_from",
"authpriv_to",
}
}
In [23]: b.LTConfig.Field.get_values(class_instance_keys = class_instance_key_seq, field_instance_name
Out[23]:
[[destination loghost { udp(10.20.5.11 port (514)); udp(10.20.4.167 port (514)); };,
notice,
emerg]]
In [24]: - Todd_Cromwell_9
Nimbostratus
You may want to isolate this LTConfig code from other parts of your application so it is easy to switch out. We have gotten requests for canned (specific) interfaces for some of the items now supported via LTConfig. We are evaluating whether it is actually worth spending heaps of effort to make an internal bridge that would make the old LTConfig access work if and when we do this.
While thinking about this, I posted a query some months ago asking who was using LTConfig, and got either no response or minimal response (can't remember) -- that suggested the answer would be people would welcome a canned interface and we'd disappoint pretty much no one if we simply discontinued the LTConfig access ("killed" or "deprecated immediately") rather than following our normal deprecation policy. LTConfig has always been a little less conceptually secure in terms of changes than the rest of iControl, since it is a window to stuff behind iControl internally, yes, like the rest of iControl, but in this case we get run-time failures if the stuff changes behind iControl rather than compile-time. iControl has a very extensive regression test suite, but I don't off the top of my head remember how extensive our checking of the LTConfig classes is.- John_Gruber_432Historic F5 AccountSo 15 months later... is there a canned interface to set the syslog servers yet?
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com