Esempio n. 1
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)
Esempio n. 2
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)
Esempio n. 3
0
def test_001_sp_minimal():
    from ucscentralsdk.mometa.ls.LsServer import LsServer
    mo = LsServer(parent_mo_or_dn="org-root",
                  vmedia_policy_name="",
                  ext_ip_state="none",
                  bios_profile_name="",
                  mgmt_fw_policy_name="",
                  agent_policy_name="",
                  mgmt_access_policy_name="",
                  dynamic_con_policy_name="",
                  sol_policy_name="",
                  uuid="0",
                  descr="",
                  stats_policy_name="default",
                  ext_ip_pool_name="ext-mgmt",
                  boot_policy_name="",
                  usr_lbl="",
                  host_fw_policy_name="",
                  vcon_profile_name="",
                  ident_pool_name="default",
                  src_templ_name="",
                  local_disk_policy_name="",
                  scrub_policy_name="",
                  power_policy_name="default",
                  maint_policy_name="",
                  name="test_sp")

    handle.add_mo(mo)
    handle.commit()

    ##########################################################
    # Modify a single property in the Sp created above
    # and genertate XML with DIRTY option set
    ##########################################################
    import ucscentralsdk.ucscentralxmlcodec as xc
    from ucscentralsdk.ucscentralcoremeta import WriteXmlOption
    obj = handle.query_dn("org-root/ls-test_sp")
    obj.usr_lbl = "new_label"
    print(xc.to_xml_str(obj.to_xml(option=WriteXmlOption.DIRTY)))
    print(xc.to_xml_str(obj.to_xml(option=WriteXmlOption.ALL_CONFIG)))
    print(xc.to_xml_str(obj.to_xml()))

    ##########################################################
    # Delete the SP
    ##########################################################
    obj = handle.query_dn("org-root/ls-test_sp")
    handle.remove_mo(obj)
    handle.commit()
Esempio n. 4
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)
Esempio n. 5
0
def test_005_create_gmo_from_xml():
    xml_str = '''
    <faultInst descr="TCA: etherTxStats totalBytesDelta = 1005,
    raised above 0" dn="sys/chassis-1/slot-1/host/port-2/fault-F35275"
    status="modified"/>
    '''
    gmo = ucscentralmo.generic_mo_from_xml(xml_str)
    xml_element = gmo.to_xml()
    to_xml_str = xc.to_xml_str(xml_element)
Esempio n. 6
0
def test_004_create_gmo_using_parent_mo():
    args = {"a": 1, "b": 2, "c": 3, "rn": "parent"}
    obj = ucscentralmo.GenericMo("testLsA", "org-root", **args)
    obj1 = ucscentralmo.GenericMo("testLsB", obj, rn="child")
    elem = obj.to_xml()
    xml_str = xc.to_xml_str(elem)

    expected = b'<testLsA a="1" b="2" c="3" dn="org-root/parent" rn="parent"><testLsB dn="org-root/parent/child" rn="child" /></testLsA>'

    assert_equal(xml_str, expected)
Esempio n. 7
0
def test_002_create_gmo_using_param_dict():
    args = {"a": 1, "b": 2, "c": 3}
    obj = ucscentralmo.GenericMo("testLsA", "org-root", **args)
    obj1 = ucscentralmo.GenericMo("testLsB", "org-root", **args)
    obj.child_add(obj1)
    elem = obj.to_xml()
    xml_str = xc.to_xml_str(elem)

    expected = b'<testLsA a="1" b="2" c="3" dn="" rn=""><testLsB a="1" b="2" c="3" dn="" rn="" /></testLsA>'

    assert_equal(xml_str, expected)