Пример #1
0
def test_004_equipmentPOST_globalid():
    import ucsmsdk.ucsxmlcodec as xc

    xml_str = """
    <equipmentPOST childAction="deleteNonPresent" code="POST-2298"

    created="2015-10-27T08:13:03.068" descr="No Errors" globalId="2298"
    localId="No Errors" method="POST" name="" recoverable="recoverable"
    recoveryAction="none" rn="code-2298" severity="info"
    type="adaptor: Cisco Systems Inc N20-AC0002" value="0"/>
    """

    xc.from_xml_str(xml_str)
Пример #2
0
def test_004_equipmentPOST_globalid():
    import ucsmsdk.ucsxmlcodec as xc

    xml_str = '''
    <equipmentPOST childAction="deleteNonPresent" code="POST-2298"

    created="2015-10-27T08:13:03.068" descr="No Errors" globalId="2298"
    localId="No Errors" method="POST" name="" recoverable="recoverable"
    recoveryAction="none" rn="code-2298" severity="info"
    type="adaptor: Cisco Systems Inc N20-AC0002" value="0"/>
    '''

    xc.from_xml_str(xml_str)
Пример #3
0
def test_003_StorageLocalDiskPartition():
    xml_str = '''<storageController childAction="deleteNonPresent" controllerStatus="unknown" deviceRaidSupport="yes" faultMonitoring="supported" hwRevision="1064E(B3)" id="1" lc="allocated" locationDn="" model="SAS1064E PCI-Express Fusion-MPT SAS" oobControllerId="not-applicable" oobInterfaceSupported="no" operQualifierReason="N/A" operState="unknown" operability="unknown" pciAddr="01:00.0" pciSlot="" perf="unknown" power="unknown" presence="equipped" raidSupport="RAID0, RAID1" rebuildRate="unknown" revision="0" rn="storage-SAS-1" serial="" thermal="unknown" type="SAS" vendor="LSI Logic   Symbios Logic" voltage="unknown"> <storageLocalDiskConfigDef childAction="deleteNonPresent" descr="" flexFlashRAIDReportingState="disable" flexFlashState="disable" intId="none" mode="any-configuration" name="" policyLevel="0" policyOwner="local" protectConfig="no" rn="local-disk-config"> <storageLocalDiskPartition childAction="deleteNonPresent" descr="" intId="none" name="" order="1" policyLevel="0" policyOwner="local" rn="partition" size="unknown" type="none"/></storageLocalDiskConfigDef></storageController>
    '''

    obj = xc.from_xml_str(xml_str)
    xml_element = obj.to_xml()
    xc.to_xml_str(xml_element)
Пример #4
0
def test_002_StorageLocalDiskPartition():
    xml_str = '''<configResolveClass cookie="1447403324/24f7c591-2b3e-4bf4-8cee-716d3b4297b1" response="yes" classId="storageLocalDiskPartition"> <outConfigs>  <storageLocalDiskPartition childAction="deleteNonPresent" descr="" dn="org-root/local-disk-config-default/partition" intId="29002" name="" order="1" policyLevel="0" policyOwner="local" size="unknown" type="none"/>  <storageLocalDiskPartition childAction="deleteNonPresent" descr="" dn="sys/chassis-1/blade-2/board/storage-SAS-1/local-disk-config/partition" intId="none" name="" order="1" policyLevel="0" policyOwner="local" size="unknown" type="none"/> </outConfigs> </configResolveClass>
    '''

    obj = xc.from_xml_str(xml_str)
    xml_element = obj.to_xml()
    xc.to_xml_str(xml_element)
Пример #5
0
def test_003_StorageLocalDiskPartition():
    xml_str = '''<storageController childAction="deleteNonPresent" controllerStatus="unknown" deviceRaidSupport="yes" faultMonitoring="supported" hwRevision="1064E(B3)" id="1" lc="allocated" locationDn="" model="SAS1064E PCI-Express Fusion-MPT SAS" oobControllerId="not-applicable" oobInterfaceSupported="no" operQualifierReason="N/A" operState="unknown" operability="unknown" pciAddr="01:00.0" pciSlot="" perf="unknown" power="unknown" presence="equipped" raidSupport="RAID0, RAID1" rebuildRate="unknown" revision="0" rn="storage-SAS-1" serial="" thermal="unknown" type="SAS" vendor="LSI Logic   Symbios Logic" voltage="unknown"> <storageLocalDiskConfigDef childAction="deleteNonPresent" descr="" flexFlashRAIDReportingState="disable" flexFlashState="disable" intId="none" mode="any-configuration" name="" policyLevel="0" policyOwner="local" protectConfig="no" rn="local-disk-config"> <storageLocalDiskPartition childAction="deleteNonPresent" descr="" intId="none" name="" order="1" policyLevel="0" policyOwner="local" rn="partition" size="unknown" type="none"/></storageLocalDiskConfigDef></storageController>
    '''

    obj = xc.from_xml_str(xml_str)
    xml_element = obj.to_xml()
    xc.to_xml_str(xml_element)
Пример #6
0
def test_002_StorageLocalDiskPartition():
    xml_str = '''<configResolveClass cookie="1447403324/24f7c591-2b3e-4bf4-8cee-716d3b4297b1" response="yes" classId="storageLocalDiskPartition"> <outConfigs>  <storageLocalDiskPartition childAction="deleteNonPresent" descr="" dn="org-root/local-disk-config-default/partition" intId="29002" name="" order="1" policyLevel="0" policyOwner="local" size="unknown" type="none"/>  <storageLocalDiskPartition childAction="deleteNonPresent" descr="" dn="sys/chassis-1/blade-2/board/storage-SAS-1/local-disk-config/partition" intId="none" name="" order="1" policyLevel="0" policyOwner="local" size="unknown" type="none"/> </outConfigs> </configResolveClass>
    '''

    obj = xc.from_xml_str(xml_str)
    xml_element = obj.to_xml()
    xc.to_xml_str(xml_element)
Пример #7
0
def test_001_create_gmo_from_xml():
    xml = '''
    <testLsA a="1" b="2" c="3" dn="org-root/" rn="">
     <testLsB a="1" b="2" c="3" dn="org-root/" rn="" />
     <testLsC a="1" b="2" c="3" dn="org-root/" rn="" >
      <testLsD a="1" b="2" c="3" dn="org-root/" rn="" />
     </testLsC>
    </testLsA>'''
    obj = xc.from_xml_str(xml)
    assert_equal(obj.__class__.__name__, 'GenericMo')
Пример #8
0
def test_001_StorageLocalDiskPartition():
    xml_str = '''
    <storageLocalDiskPartition childAction="deleteNonPresent" descr=""
    dn="org-root/local-disk-config-default/partition" intId="29002" name=""
    order="1" policyLevel="0" policyOwner="local" size="unknown" type="none"/>
    '''

    obj = xc.from_xml_str(xml_str)
    xml_element = obj.to_xml()
    xc.to_xml_str(xml_element)
Пример #9
0
def test_001_StorageLocalDiskPartition():
    xml_str = '''
    <storageLocalDiskPartition childAction="deleteNonPresent" descr=""
    dn="org-root/local-disk-config-default/partition" intId="29002" name=""
    order="1" policyLevel="0" policyOwner="local" size="unknown" type="none"/>
    '''

    obj = xc.from_xml_str(xml_str)
    xml_element = obj.to_xml()
    xc.to_xml_str(xml_element)
Пример #10
0
def test_001_create_gmo_from_xml():
    xml = '''
    <testLsA a="1" b="2" c="3" dn="org-root/" rn="">
     <testLsB a="1" b="2" c="3" dn="org-root/" rn="" />
     <testLsC a="1" b="2" c="3" dn="org-root/" rn="" >
      <testLsD a="1" b="2" c="3" dn="org-root/" rn="" />
     </testLsC>
    </testLsA>'''
    obj = xc.from_xml_str(xml)
    assert_equal(obj.__class__.__name__, 'GenericMo')
Пример #11
0
def test_002_knownmo_unknownprop():
    xml_str = '''
    <lsServer agentPolicyName=""
    name="ra11"
    type="instance"
    usrLbl="b"
    unknownProps="unknown"/>'''

    obj = xc.from_xml_str(xml_str)
    obj.unknownProps = "known"
    xml_element = obj.to_xml(option=WriteXmlOption.DIRTY)
    print xc.to_xml_str(xml_element)
Пример #12
0
def test_002_knownmo_unknownprop():
    xml_str = '''
    <lsServer agentPolicyName=""
    name="ra11"
    type="instance"
    usrLbl="b"
    rn = "ls-ra11"
    unknownProps="unknown"/>'''

    obj = xc.from_xml_str(xml_str)
    obj.unknownProps = "known"
    xml_element = obj.to_xml(option=WriteXmlOption.DIRTY)
    print(xc.to_xml_str(xml_element))
Пример #13
0
def test_001_knownmo_unknownprop():
    xml_str = '''
    <lsServer agentPolicyName=""
    name="ra11"
    type="instance"
    usrLbl="b"
    unknownProps="unknown"/>'''

    obj = xc.from_xml_str(xml_str)
    obj.unknownProps = "known"
    xml_element = obj.to_xml()
    expected = '<lsServer agentPolicyName="" dn="ls-ra11" name="ra11" type="instance" unknownProps="known" usrLbl="b" />'
    result_str = xc.to_xml_str(xml_element)
    assert_equal(result_str, expected)
Пример #14
0
def test_001_knownmo_unknownprop():
    xml_str = '''
    <lsServer agentPolicyName=""
    name="ra11"
    type="instance"
    usrLbl="b"
    rn = "ls-ra11"
    unknownProps="unknown"/>'''

    obj = xc.from_xml_str(xml_str)
    obj.unknownProps = "known"
    xml_element = obj.to_xml()
    expected = b'<lsServer agentPolicyName="" dn="ls-ra11" name="ra11" type="instance" unknownProps="known" usrLbl="b" />'
    result_str = xc.to_xml_str(xml_element)
    assert_equal(result_str, expected)
Пример #15
0
def test_001_mo_from_xml():
    import ucsmsdk.ucsxmlcodec as xc

    response_str = '''
        <configResolveClasses cookie="1441601790/263349a7-1897-4df0-aff3-bc27c7316862" response="yes" classId="memoryUnit">
        <outConfigs>

        <memoryUnit adminState="policy" array="1" bank="1" capacity="4096" childAction="deleteNonPresent" clock="1333"
        dn="sys/chassis-1/blade-2/board/memarray-1/mem-9" formFactor="DIMM" id="9" latency="0.800000" location="DIMM_E1" locationDn="" model="M393B5170FH0-YH9" operQualifier="" operQualifierReason="N/A" operState="operable"
        operability="operable" perf="unknown" power="not-supported" presence="equipped" revision="0" serial="0x835CE6DB"
        set="0" speed="unspecified" thermal="ok" type="Other" vendor="0x80CE" visibility="yes" voltage="not-supported"
        width="64">

        <memoryUnitEnvStats childAction="deleteNonPresent" intervals="58982460" rn="dimm-env-stats" suspect="no"
        temperature="20.000000" temperatureAvg="20.000000" temperatureMax="20.000000" temperatureMin="20.000000"
        thresholded="" timeCollected="2015-09-07T10:31:06.608" update="262146">

        <memoryUnitEnvStatsHist1 childAction="deleteNonPresent" id="1" mostRecent="no" rn="1" suspect="no"
        temperature="28.000000" temperatureAvg="25.599997" temperatureMax="28.000000" temperatureMin="24.000000"
        thresholded="" timeCollected="2015-09-07T09:43:53.262">

        <memoryUnitEnvStatsHist2 childAction="deleteNonPresent" id="1" mostRecent="no" rn="1" suspect="no"
        temperature="28.000000" temperatureAvg="25.599997" temperatureMax="28.000000" temperatureMin="24.000000"
        thresholded="" timeCollected="2015-09-07T09:43:53.262">
        </memoryUnitEnvStatsHist2>

        </memoryUnitEnvStatsHist1>

        </memoryUnitEnvStats>
        </memoryUnit>
        </outConfigs>
        </configResolveClasses>
    '''

    response = xc.from_xml_str(response_str)
    assert_equal(response.out_configs.child[0].__class__.__name__,
                 'MemoryUnit')
    assert_equal(response.out_configs.child[0].child[0].__class__.__name__,
                 'MemoryUnitEnvStats')
    assert_equal(
        response.out_configs.child[0].child[0].child[0].__class__.__name__,
        'GenericMo')
    assert_equal(
        response.out_configs.child[0].child[0].child[0].child[0].__class__.
        __name__, 'GenericMo')
Пример #16
0
def test_001_mo_from_xml():
    import ucsmsdk.ucsxmlcodec as xc

    response_str = """
        <configResolveClasses cookie="1441601790/263349a7-1897-4df0-aff3-bc27c7316862" response="yes" classId="memoryUnit">
        <outConfigs>

        <memoryUnit adminState="policy" array="1" bank="1" capacity="4096" childAction="deleteNonPresent" clock="1333"
        dn="sys/chassis-1/blade-2/board/memarray-1/mem-9" formFactor="DIMM" id="9" latency="0.800000" location="DIMM_E1" locationDn="" model="M393B5170FH0-YH9" operQualifier="" operQualifierReason="N/A" operState="operable"
        operability="operable" perf="unknown" power="not-supported" presence="equipped" revision="0" serial="0x835CE6DB"
        set="0" speed="unspecified" thermal="ok" type="Other" vendor="0x80CE" visibility="yes" voltage="not-supported"
        width="64">

        <memoryUnitEnvStats childAction="deleteNonPresent" intervals="58982460" rn="dimm-env-stats" suspect="no"
        temperature="20.000000" temperatureAvg="20.000000" temperatureMax="20.000000" temperatureMin="20.000000"
        thresholded="" timeCollected="2015-09-07T10:31:06.608" update="262146">

        <memoryUnitEnvStatsHist1 childAction="deleteNonPresent" id="1" mostRecent="no" rn="1" suspect="no"
        temperature="28.000000" temperatureAvg="25.599997" temperatureMax="28.000000" temperatureMin="24.000000"
        thresholded="" timeCollected="2015-09-07T09:43:53.262">

        <memoryUnitEnvStatsHist2 childAction="deleteNonPresent" id="1" mostRecent="no" rn="1" suspect="no"
        temperature="28.000000" temperatureAvg="25.599997" temperatureMax="28.000000" temperatureMin="24.000000"
        thresholded="" timeCollected="2015-09-07T09:43:53.262">
        </memoryUnitEnvStatsHist2>

        </memoryUnitEnvStatsHist1>

        </memoryUnitEnvStats>
        </memoryUnit>
        </outConfigs>
        </configResolveClasses>
    """

    response = xc.from_xml_str(response_str)
    assert_equal(response.out_configs.child[0].__class__.__name__, "MemoryUnit")
    assert_equal(response.out_configs.child[0].child[0].__class__.__name__, "MemoryUnitEnvStats")
    assert_equal(response.out_configs.child[0].child[0].child[0].__class__.__name__, "GenericMo")
    assert_equal(response.out_configs.child[0].child[0].child[0].child[0].__class__.__name__, "GenericMo")