November 8, 2016 · ucsmsdk ucspython

metadata and MO information - ucsmsdk

ucsmsdk now has helper methods to help figure out MO names and dig into the properties and other metadata provided by an object.

from ucsmsdk.ucscoreutils import search_class_id  
from ucsmsdk.ucscoreutils import get_meta_info  

search_class_id is a case-insensitive grep method that searches all MO names.

In [6]: search_class_id("vlan")  
2016-06-11 02:26:01,741 - ucs - INFO - "vlan" did not match any available Class Ids.  
Related Class Ids are:  
----------------------
AdaptorVlan  
FabricBHVlan  
FabricEthVlanPc  
FabricEthVlanPortEp  
FabricOrgVlanPolicy  
FabricPoolableVlan  
FabricPooledVlan  
FabricVlan  
FabricVlanEp  
FabricVlanGroupReq  
FabricVlanPermit  
FabricVlanReq  
SwVlan  
SwVlanGroup  
SwVlanPortNs  
SwVlanPortNsOverride  
SwVlanRef  
VmVlan  
VnicLifVlan  
VnicVlan

Once you have figured the correct MO name, you can use get_meta_info to dig further into the MO.
Below we get meta information for FabricVlan

It starts with a tree view of where FabricVlan fits, it parents and children.
Then it shows MO information
Finally, it shows information about properties of the MO.
Mo Property information:
xml_attribute - the name of the property as expected by the server.

field_type - type of the field

min_version - Ucs server release in which the property was first introduced

access - defines if a property is interal/user-readable/user-writable

property restrictions:
min_length - minimum length for string property type

max_length - maximum length for string property type

pattern - allowed patterns, regexs

value_set - set of allowed values for this property

range_val - range for int/uint values

In [7]: class_meta = get_meta_info("FabricVlan")  
In [8]: print class_meta  
[FabricEthEstc]
[FabricEthEstcCloud]
[FabricEthLan]
[FabricLanCloud]
  |-FabricVlan
     |-FabricEthMonFiltEp
     |-FabricEthMonSrcEp
     |-FabricEthVlanPc
     |  |-FaultInst
     |-FabricEthVlanPortEp
     |  |-FaultInst
     |-FabricPoolableVlan
     |-FabricSwSubGroup
     |  |-FabricEthVlanPortEp
     |  |  |-FaultInst
     |  |-FabricFcoeVsanPortEp
     |     |-FaultInst
     |-FaultInst

ClassId                         FabricVlan  
-------                         ----------
xml_attribute                   :fabricVlan  
rn                              :net-[name]  
min_version                     :1.0(1e)  
access                          :InputOutput  
access_privilege                :['admin', 'ext-lan-config', 'ext-lan-policy']  
parents                         :[u'fabricEthEstc', u'fabricEthEstcCloud', u'fabricEthLan', u'fabricLanCloud']  
children                        :[u'fabricEthMonFiltEp', u'fabricEthMonSrcEp', u'fabricEthVlanPc', u'fabricEthVlanPortEp', u'fabricPoolableVlan', u'fabricSwSubGroup', u'faultInst']

Property                        assoc_primary_vlan_state  
--------                        ------------------------
xml_attribute                   :assocPrimaryVlanState  
field_type                      :string  
min_version                     :2.2(2c)  
access                          :READ_ONLY  
min_length                      :None  
max_length                      :None  
pattern                         :None  
value_set                       :['does-not-exists', 'is-empty', 'is-in-error-state', 'is-not-primary-type', 'ok']  
range_val                       :[]

Property                        assoc_primary_vlan_switch_id  
--------                        ----------------------------
xml_attribute                   :assocPrimaryVlanSwitchId  
field_type                      :string  
min_version                     :2.2(2c)  
access                          :READ_ONLY  
min_length                      :None  
max_length                      :None  
pattern                         :None  
value_set                       :['A', 'B', 'NONE']  
range_val                       :[]

Property                        child_action  
--------                        ------------
xml_attribute                   :childAction  
field_type                      :string  
min_version                     :1.0(1e)  
access                          :INTERNAL  
min_length                      :None  
max_length                      :None  
pattern                         :((deleteAll|ignore|deleteNonPresent),){0,2}(deleteAll|ignore|deleteNonPresent){0,1}  
value_set                       :[]  
range_val                       :[]

Property                        cloud  
--------                        -----
xml_attribute                   :cloud  
field_type                      :string  
min_version                     :2.1(1a)  
access                          :READ_ONLY  
min_length                      :None  
max_length                      :None  
pattern                         :((defaultValue|unknown|fcsanmon|ethlan|ethestclan|fcestc|ethlanmon|fcsan),){0,7}(defaultValue|unknown|fcsanmon|ethlan|ethestclan|fcestc|ethlanmon|fcsan){0,1}  
value_set                       :[]  
range_val                       :[]

Property                        compression_type  
--------                        ----------------
xml_attribute                   :compressionType  
field_type                      :string  
min_version                     :2.1(1a)  
access                          :READ_WRITE  
min_length                      :None  
max_length                      :None  
pattern                         :None  
value_set                       :['excluded', 'included']  
range_val                       :[]

Property                        config_issues  
--------                        -------------
xml_attribute                   :configIssues  
field_type                      :string  
min_version                     :2.1(1a)  
access                          :READ_ONLY  
min_length                      :None  
max_length                      :None  
pattern                         :((defaultValue|not-applicable|conflicting-vlan-access|unsupported-multicast-policy),){0,3}(defaultValue|not-applicable|conflicting-vlan-access|unsupported-multicast-policy){0,1}  
value_set                       :[]  
range_val                       :[]

Property                        default_net  
--------                        -----------
xml_attribute                   :defaultNet  
field_type                      :string  
min_version                     :1.0(1e)  
access                          :READ_WRITE  
min_length                      :None  
max_length                      :None  
pattern                         :None  
value_set                       :['false', 'no', 'true', 'yes']  
range_val                       :[]

Property                        dn  
--------                        --
xml_attribute                   :dn  
field_type                      :string  
min_version                     :1.0(1e)  
access                          :READ_ONLY  
min_length                      :0  
max_length                      :256  
pattern                         :None  
value_set                       :[]  
range_val                       :[]

Property                        ep_dn  
--------                        -----
xml_attribute                   :epDn  
field_type                      :string  
min_version                     :1.0(1e)  
access                          :READ_ONLY  
min_length                      :0  
max_length                      :256  
pattern                         :None  
value_set                       :[]  
range_val                       :[]

Property                        flt_aggr  
--------                        --------
xml_attribute                   :fltAggr  
field_type                      :ulong  
min_version                     :2.1(1a)  
access                          :INTERNAL  
min_length                      :None  
max_length                      :None  
pattern                         :None  
value_set                       :[]  
range_val                       :[]

Property                        id  
--------                        --
xml_attribute                   :id  
field_type                      :uint  
min_version                     :1.0(1e)  
access                          :READ_WRITE  
min_length                      :None  
max_length                      :None  
pattern                         :None  
value_set                       :[]  
range_val                       :['1-4029', '4048-4093']

Property                        if_role  
--------                        -------
xml_attribute                   :ifRole  
field_type                      :string  
min_version                     :1.0(1e)  
access                          :READ_ONLY  
min_length                      :None  
max_length                      :None  
pattern                         :None  
value_set                       :['diag', 'fcoe-nas-storage', 'fcoe-storage', 'fcoe-uplink', 'mgmt', 'monitor', 'nas-storage', 'network', 'network-fcoe-uplink', 'server', 'service', 'storage', 'unknown']  
range_val                       :[]

Property                        if_type  
--------                        -------
xml_attribute                   :ifType  
field_type                      :string  
min_version                     :1.0(1e)  
access                          :READ_ONLY  
min_length                      :None  
max_length                      :None  
pattern                         :None  
value_set                       :['aggregation', 'physical', 'unknown', 'virtual']  
range_val                       :[]

Property                        local  
--------                        -----
xml_attribute                   :local  
field_type                      :ulong  
min_version                     :2.1(2a)  
access                          :READ_ONLY  
min_length                      :None  
max_length                      :None  
pattern                         :None  
value_set                       :[]  
range_val                       :[]

Property                        locale  
--------                        ------
xml_attribute                   :locale  
field_type                      :string  
min_version                     :1.0(1e)  
access                          :READ_ONLY  
min_length                      :None  
max_length                      :None  
pattern                         :((defaultValue|unknown|server|chassis|internal|external),){0,5}(defaultValue|unknown|server|chassis|internal|external){0,1}  
value_set                       :[]  
range_val                       :[]

Property                        mcast_policy_name  
--------                        -----------------
xml_attribute                   :mcastPolicyName  
field_type                      :string  
min_version                     :2.1(1a)  
access                          :READ_WRITE  
min_length                      :None  
max_length                      :None  
pattern                         :[\-\.:_a-zA-Z0-9]{0,16}  
value_set                       :[]  
range_val                       :[]

Property                        name  
--------                        ----
xml_attribute                   :name  
field_type                      :string  
min_version                     :1.0(1e)  
access                          :NAMING  
min_length                      :None  
max_length                      :None  
pattern                         :[\-\.:_a-zA-Z0-9]{1,32}  
value_set                       :[]  
range_val                       :[]

Property                        oper_mcast_policy_name  
--------                        ----------------------
xml_attribute                   :operMcastPolicyName  
field_type                      :string  
min_version                     :2.1(1a)  
access                          :READ_ONLY  
min_length                      :0  
max_length                      :256  
pattern                         :None  
value_set                       :[]  
range_val                       :[]

Property                        oper_state  
--------                        ----------
xml_attribute                   :operState  
field_type                      :string  
min_version                     :2.0(1m)  
access                          :READ_ONLY  
min_length                      :None  
max_length                      :None  
pattern                         :None  
value_set                       :['error-misconfigured', 'ok']  
range_val                       :[]

Property                        overlap_state_for_a  
--------                        -------------------
xml_attribute                   :overlapStateForA  
field_type                      :string  
min_version                     :2.2(2c)  
access                          :READ_ONLY  
min_length                      :None  
max_length                      :None  
pattern                         :None  
value_set                       :['active', 'not-active', 'ok', 'primary-id-mismatch', 'sharing-type-mismatch']  
range_val                       :[]

Property                        overlap_state_for_b  
--------                        -------------------
xml_attribute                   :overlapStateForB  
field_type                      :string  
min_version                     :2.2(2c)  
access                          :READ_ONLY  
min_length                      :None  
max_length                      :None  
pattern                         :None  
value_set                       :['active', 'not-active', 'ok', 'primary-id-mismatch', 'sharing-type-mismatch']  
range_val                       :[]

Property                        peer_dn  
--------                        -------
xml_attribute                   :peerDn  
field_type                      :string  
min_version                     :1.0(1e)  
access                          :READ_ONLY  
min_length                      :0  
max_length                      :256  
pattern                         :None  
value_set                       :[]  
range_val                       :[]

Property                        policy_owner  
--------                        ------------
xml_attribute                   :policyOwner  
field_type                      :string  
min_version                     :2.1(2a)  
access                          :READ_WRITE  
min_length                      :None  
max_length                      :None  
pattern                         :None  
value_set                       :['local', 'pending-policy', 'policy']  
range_val                       :[]

Property                        pub_nw_dn  
--------                        ---------
xml_attribute                   :pubNwDn  
field_type                      :string  
min_version                     :1.4(1i)  
access                          :READ_ONLY  
min_length                      :0  
max_length                      :256  
pattern                         :None  
value_set                       :[]  
range_val                       :[]

Property                        pub_nw_id  
--------                        ---------
xml_attribute                   :pubNwId  
field_type                      :uint  
min_version                     :1.4(1i)  
access                          :READ_ONLY  
min_length                      :None  
max_length                      :None  
pattern                         :None  
value_set                       :[]  
range_val                       :[]

Property                        pub_nw_name  
--------                        -----------
xml_attribute                   :pubNwName  
field_type                      :string  
min_version                     :1.4(1i)  
access                          :READ_WRITE  
min_length                      :0  
max_length                      :510  
pattern                         :None  
value_set                       :[]  
range_val                       :[]

Property                        r_global  
--------                        --------
xml_attribute                   :global  
field_type                      :ulong  
min_version                     :2.1(2a)  
access                          :READ_ONLY  
min_length                      :None  
max_length                      :None  
pattern                         :None  
value_set                       :[]  
range_val                       :[]

Property                        rn  
--------                        --
xml_attribute                   :rn  
field_type                      :string  
min_version                     :1.0(1e)  
access                          :READ_ONLY  
min_length                      :0  
max_length                      :256  
pattern                         :None  
value_set                       :[]  
range_val                       :[]

Property                        sacl  
--------                        ----
xml_attribute                   :sacl  
field_type                      :string  
min_version                     :3.0(2a)  
access                          :READ_ONLY  
min_length                      :None  
max_length                      :None  
pattern                         :((none|del|mod|addchild|cascade),){0,4}(none|del|mod|addchild|cascade){0,1}  
value_set                       :[]  
range_val                       :[]

Property                        sharing  
--------                        -------
xml_attribute                   :sharing  
field_type                      :string  
min_version                     :1.4(1i)  
access                          :READ_WRITE  
min_length                      :None  
max_length                      :None  
pattern                         :None  
value_set                       :['community', 'isolated', 'none', 'primary']  
range_val                       :[]

Property                        status  
--------                        ------
xml_attribute                   :status  
field_type                      :string  
min_version                     :1.0(1e)  
access                          :READ_WRITE  
min_length                      :None  
max_length                      :None  
pattern                         :((removed|created|modified|deleted),){0,3}(removed|created|modified|deleted){0,1}  
value_set                       :[]  
range_val                       :[]

Property                        switch_id  
--------                        ---------
xml_attribute                   :switchId  
field_type                      :string  
min_version                     :1.0(1e)  
access                          :READ_ONLY  
min_length                      :None  
max_length                      :None  
pattern                         :None  
value_set                       :['A', 'B', 'NONE', 'dual']  
range_val                       :[]

Property                        transport  
--------                        ---------
xml_attribute                   :transport  
field_type                      :string  
min_version                     :1.0(1e)  
access                          :READ_ONLY  
min_length                      :None  
max_length                      :None  
pattern                         :((defaultValue|unknown|ether|dce|fc),){0,4}(defaultValue|unknown|ether|dce|fc){0,1}  
value_set                       :[]  
range_val                       :[]

Property                        type  
--------                        ----
xml_attribute                   :type  
field_type                      :string  
min_version                     :1.0(1e)  
access                          :READ_ONLY  
min_length                      :None  
max_length                      :None  
pattern                         :((defaultValue|unknown|lan|san|ipc),){0,4}(defaultValue|unknown|lan|san|ipc){0,1}  
value_set                       :[]  
range_val                       :[]

  • LinkedIn
  • Tumblr
  • Reddit
  • Google+
  • Pinterest
  • Pocket