def test_001_convert_to_from_xml_sp():
    xml_str = '''
 <configConfMos cookie="[hidden]" response="yes"> <inConfigs> <pair
 key="org-root/ls-test_sp_123"> <lsServer agentPolicyName=""
 assignState="unassigned" assocState="unassociated" biosProfileName=""
 bootPolicyName="" configQualifier="" configState="not-applied" descr=""
 dn="org-root/ls-test_sp_123" dynamicConPolicyName="" extIPPoolName="ext-mgmt"
 extIPState="none" fltAggr="0" fsmDescr="" fsmFlags="" fsmPrev="nop"
 fsmProgr="100" fsmRmtInvErrCode="none" fsmRmtInvErrDescr="" fsmRmtInvRslt=""
 fsmStageDescr="" fsmStamp="never" fsmStatus="nop" fsmTry="0"
 hostFwPolicyName="" identPoolName="default" intId="80996" kvmMgmtPolicyName=""
 localDiskPolicyName="" maintPolicyName="" mgmtAccessPolicyName=""
 mgmtFwPolicyName="" name="test_sp_123" operBiosProfileName=""
 operBootPolicyName="" operDynamicConPolicyName="" operExtIPPoolName=""
 operHostFwPolicyName="" operIdentPoolName="" operKvmMgmtPolicyName=""
 operLocalDiskPolicyName="" operMaintPolicyName="" operMgmtAccessPolicyName=""
 operMgmtFwPolicyName="" operPowerPolicyName="" operScrubPolicyName=""
 operSolPolicyName="" operSrcTemplName="" operState="unassociated"
 operStatsPolicyName="" operVconProfileName="" operVmediaPolicyName=""
 owner="management" pnDn="" policyLevel="0" policyOwner="local"
 powerPolicyName="default" propAcl="0" resolveRemote="yes" scrubPolicyName=""
 solPolicyName="" srcTemplName="" statsPolicyName="default" status="created"
 svnicConfig="yes" type="instance" usrLbl="" uuid="derived"
 uuidSuffix="0000-000000000000" vconProfileName="" vmediaPolicyName=""/></pair>
 </inConfigs> </configConfMos>
'''
    convert_to_ucs_python(xml=True, request=xml_str, dump_xml=True)
示例#2
0
def test_001_convert_to_from_xml_sp():
    xml_str = '''
 <configConfMos cookie="[hidden]" response="yes"> <inConfigs> <pair
 key="org-root/ls-test_sp_123"> <lsServer agentPolicyName=""
 assignState="unassigned" assocState="unassociated" biosProfileName=""
 bootPolicyName="" configQualifier="" configState="not-applied" descr=""
 dn="org-root/ls-test_sp_123" dynamicConPolicyName="" extIPPoolName="ext-mgmt"
 extIPState="none" fltAggr="0" fsmDescr="" fsmFlags="" fsmPrev="nop"
 fsmProgr="100" fsmRmtInvErrCode="none" fsmRmtInvErrDescr="" fsmRmtInvRslt=""
 fsmStageDescr="" fsmStamp="never" fsmStatus="nop" fsmTry="0"
 hostFwPolicyName="" identPoolName="default" intId="80996" kvmMgmtPolicyName=""
 localDiskPolicyName="" maintPolicyName="" mgmtAccessPolicyName=""
 mgmtFwPolicyName="" name="test_sp_123" operBiosProfileName=""
 operBootPolicyName="" operDynamicConPolicyName="" operExtIPPoolName=""
 operHostFwPolicyName="" operIdentPoolName="" operKvmMgmtPolicyName=""
 operLocalDiskPolicyName="" operMaintPolicyName="" operMgmtAccessPolicyName=""
 operMgmtFwPolicyName="" operPowerPolicyName="" operScrubPolicyName=""
 operSolPolicyName="" operSrcTemplName="" operState="unassociated"
 operStatsPolicyName="" operVconProfileName="" operVmediaPolicyName=""
 owner="management" pnDn="" policyLevel="0" policyOwner="local"
 powerPolicyName="default" propAcl="0" resolveRemote="yes" scrubPolicyName=""
 solPolicyName="" srcTemplName="" statsPolicyName="default" status="created"
 svnicConfig="yes" type="instance" usrLbl="" uuid="derived"
 uuidSuffix="0000-000000000000" vconProfileName="" vmediaPolicyName=""/></pair>
 </inConfigs> </configConfMos>
'''
    convert_to_ucs_python(xml=True, request=xml_str, dump_xml=True)
示例#3
0
def test_007_convert_from_xml():
    xml_str = '''
    <configConfRename
    dn="org-root/ls-test_clone"
    inNewName="test_clone1111"
    inHierarchical="false">
    </configConfRename>
    '''
    convert_to_ucs_python(xml=True, request=xml_str, dump_xml=True)
def test_007_convert_from_xml():
    xml_str = '''
    <configConfRename
    dn="org-root/ls-test_clone"
    inNewName="test_clone1111"
    inHierarchical="false">
    </configConfRename>
    '''
    convert_to_ucs_python(xml=True, request=xml_str, dump_xml=True)
def test_003_convert_from_xml_sp_associate():
    xml_str = '''
<configConfMos
inHierarchical="false">
<inConfigs>
<pair key="org-root/org-Cisco/ls-test_sdk_12345">
<lsServer
agentPolicyName=""
biosProfileName=""
bootPolicyName="WIP_BOOT"

descr=""
dn="org-root/org-Cisco/ls-test_sdk_12345"
dynamicConPolicyName=""
extIPPoolName="ext-mgmt"
extIPState="none"
hostFwPolicyName=""
identPoolName=""
kvmMgmtPolicyName=""
localDiskPolicyName=""
maintPolicyName=""
mgmtAccessPolicyName=""
mgmtFwPolicyName=""
policyOwner="local"
powerPolicyName="default"
resolveRemote="yes"

sacl="addchild,del,mod"
scrubPolicyName=""
solPolicyName=""
srcTemplName=""
statsPolicyName="default"
status="modified"
usrLbl=""
uuid="00000000-0000-0000-0000-000000000099"
vconProfileName=""
vmediaPolicyName="">
<lsBinding


pnDn="sys/chassis-1/blade-7"
restrictMigration="no"
rn="pn"
sacl="addchild,del,mod"
>
</lsBinding>
</lsServer>
</pair>
</inConfigs>
</configConfMos>
'''
    convert_to_ucs_python(xml=True, request=xml_str, dump_xml=True)
示例#6
0
def test_003_convert_from_xml_sp_associate():
    xml_str = '''
<configConfMos
inHierarchical="false">
<inConfigs>
<pair key="org-root/org-Cisco/ls-test_sdk_12345">
<lsServer
agentPolicyName=""
biosProfileName=""
bootPolicyName="WIP_BOOT"

descr=""
dn="org-root/org-Cisco/ls-test_sdk_12345"
dynamicConPolicyName=""
extIPPoolName="ext-mgmt"
extIPState="none"
hostFwPolicyName=""
identPoolName=""
kvmMgmtPolicyName=""
localDiskPolicyName=""
maintPolicyName=""
mgmtAccessPolicyName=""
mgmtFwPolicyName=""
policyOwner="local"
powerPolicyName="default"
resolveRemote="yes"

sacl="addchild,del,mod"
scrubPolicyName=""
solPolicyName=""
srcTemplName=""
statsPolicyName="default"
status="modified"
usrLbl=""
uuid="00000000-0000-0000-0000-000000000099"
vconProfileName=""
vmediaPolicyName="">
<lsBinding


pnDn="sys/chassis-1/blade-7"
restrictMigration="no"
rn="pn"
sacl="addchild,del,mod"
>
</lsBinding>
</lsServer>
</pair>
</inConfigs>
</configConfMos>
'''
    convert_to_ucs_python(xml=True, request=xml_str, dump_xml=True)
示例#7
0
def test_006_convert_from_xml():
    xml_str = '''
    <configConfMos inHierarchical="false">
    <inConfigs>
     <pair key="sys/mgmt/fw-boot-def/bootunit-system">
      <firmwareBootUnit adminState="triggered"
      dn="sys/mgmt/fw-boot-def/bootunit-system" ignoreCompCheck="no"
      mode="install" resetOnActivate="yes" sacl="addchild,del,mod"
      skipValidation="yes" version="3.1(200.13)">
        </firmwareBootUnit>
     </pair>
    </inConfigs>
    </configConfMos>
    '''

    convert_to_ucs_python(xml=True, request=xml_str, dump_xml=True)
def test_006_convert_from_xml():
    xml_str = '''
    <configConfMos inHierarchical="false">
    <inConfigs>
     <pair key="sys/mgmt/fw-boot-def/bootunit-system">
      <firmwareBootUnit adminState="triggered"
      dn="sys/mgmt/fw-boot-def/bootunit-system" ignoreCompCheck="no"
      mode="install" resetOnActivate="yes" sacl="addchild,del,mod"
      skipValidation="yes" version="3.1(200.13)">
        </firmwareBootUnit>
     </pair>
    </inConfigs>
    </configConfMos>
    '''

    convert_to_ucs_python(xml=True, request=xml_str, dump_xml=True)
示例#9
0
def test_005_convert_from_xml():
    xml_str = '''
    <configConfMos inHierarchical="false">
    <inConfigs>
     <pair key="fabric/lan/A/phys-slot-1-port-10">
      <fabricEthLanEp adminSpeed="10gbps" adminState="enabled"
      autoNegotiate="no" dn="fabric/lan/A/phys-slot-1-port-10"
      ethLinkProfileName="default" flowCtrlPolicy="default"
      name="" portId="10" sacl="addchild,del,mod" slotId="1"
      status="created" usrLbl="">
        </fabricEthLanEp>
     </pair>
    </inConfigs>
    </configConfMos>
    '''

    convert_to_ucs_python(xml=True, request=xml_str, dump_xml=True)
def test_005_convert_from_xml():
    xml_str = '''
    <configConfMos inHierarchical="false">
    <inConfigs>
     <pair key="fabric/lan/A/phys-slot-1-port-10">
      <fabricEthLanEp adminSpeed="10gbps" adminState="enabled"
      autoNegotiate="no" dn="fabric/lan/A/phys-slot-1-port-10"
      ethLinkProfileName="default" flowCtrlPolicy="default"
      name="" portId="10" sacl="addchild,del,mod" slotId="1"
      status="created" usrLbl="">
        </fabricEthLanEp>
     </pair>
    </inConfigs>
    </configConfMos>
    '''

    convert_to_ucs_python(xml=True, request=xml_str, dump_xml=True)
示例#11
0
def test_004_convert_from_xml_sp_disassociate():
    xml_str = '''
    <configConfMos
        inHierarchical="false">
    <inConfigs>
    <pair key="org-root/org-Cisco/ls-test_sdk_12345/pn">
    <lsBinding

    dn="org-root/org-Cisco/ls-test_sdk_12345/pn"

    sacl="addchild,del,mod"
    status="deleted">
    </lsBinding>
    </pair>
    </inConfigs>
    </configConfMos>
    '''
    convert_to_ucs_python(xml=True, request=xml_str, dump_xml=True)
def test_004_convert_from_xml_sp_disassociate():
    xml_str = '''
    <configConfMos
        inHierarchical="false">
    <inConfigs>
    <pair key="org-root/org-Cisco/ls-test_sdk_12345/pn">
    <lsBinding

    dn="org-root/org-Cisco/ls-test_sdk_12345/pn"

    sacl="addchild,del,mod"
    status="deleted">
    </lsBinding>
    </pair>
    </inConfigs>
    </configConfMos>
    '''
    convert_to_ucs_python(xml=True, request=xml_str, dump_xml=True)
def test_008_convert_from_xml_dumptofile():
    import os

    xml_str = '''
    <configConfRename
    dn="org-root/ls-test_clone"
    inNewName="test_clone1111"
    inHierarchical="false">
    </configConfRename>
    '''

    logfile = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                           "logfile.txt")
    convert_to_ucs_python(xml=True, request=xml_str, dump_xml=True,
                          dump_to_file=True, dump_file_path=logfile)

    assert os.stat(logfile).st_size != 0

    os.remove(logfile)
示例#14
0
def test_008_convert_from_xml_dumptofile():
    import os

    xml_str = '''
    <configConfRename
    dn="org-root/ls-test_clone"
    inNewName="test_clone1111"
    inHierarchical="false">
    </configConfRename>
    '''

    logfile = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                           "logfile.txt")
    convert_to_ucs_python(xml=True,
                          request=xml_str,
                          dump_xml=True,
                          dump_to_file=True,
                          dump_file_path=logfile)

    assert os.stat(logfile).st_size != 0

    os.remove(logfile)
示例#15
0
#!/usr/bin/env python
'''
Simple script to demonstrate how to Convert to UCS Python while performing tasks
in the UCS Manager GUI

Requires the UCS SDK: pip install ucsmsdk

NOTE: UCSM HTML5 Users - Since there is no Java, take note of the following
https://communities.cisco.com/thread/85792

Michael Petrinovic 2018
'''

from ucsmsdk.utils.converttopython import convert_to_ucs_python

# Log file that you downloaded of the XML Recording
log_path = "/Users/mipetrin/Downloads/mipetrin-clone-3-create-delete_xmlReq.log"

# Call the conversion method and execute it with the log file and print to screen
convert_to_ucs_python(xml=True, path=log_path)

# END
示例#16
0
def main():
    """
    Main routine to be executed
    """
    # Get the CLI arguements
    args = get_parser().parse_args()
    section_platform = args.platform

    parser = SafeConfigParser()

    # Since when the script executes, it is difficult to assume the relative path - as depends on where you run your Python script from.
    # Especially if calling it via absolute path and you're not in the actual directory
    # Hence, use the following to effectively obtain the config file as if it were '../my_credentials.ini'
    parent_configFilePath = os.path.join(
        os.path.abspath(os.path.dirname(__file__)), '..', MY_CONFIG_FILE)
    local_configFilePath = os.path.join(
        os.path.abspath(os.path.dirname(__file__)), '.', MY_CONFIG_FILE)

    # Check if MY_CONFIG_FILE is in the current local directory, otherwise check the parent directory. If missing in both, then fail
    if os.path.exists(local_configFilePath):
        # Use the local directory
        # print ("Found in local directory")
        configFilePath = local_configFilePath
    elif os.path.exists(parent_configFilePath):
        # Use the parent directory
        # print ("Found in parent directory")
        configFilePath = parent_configFilePath
    else:
        # Missing completely. Fail
        print(
            "Unable to locate your Config File: {}. Please ensure that you have it created and available"
            .format(MY_CONFIG_FILE))
        print("Not found in the local directory: {}".format(
            local_configFilePath))
        print("Not found in the Parent directory: {}".format(
            parent_configFilePath))
        exit(0)

    if args.debug:
        print("Config File: {}".format(configFilePath))

    # Attempt to read the configuration file
    try:
        result = parser.read(configFilePath)
    except Exception as e:
        print(str(e))
        exit(0)

    if section_platform not in parser.sections():
        print(
            "Please ensure you select a Platform that you have defined in your {} file"
            .format(MY_CONFIG_FILE))
        print("Current Platforms defined: " + str(parser.sections()))
        exit(0)
    else:
        try:
            UCSM = parser.get(section_platform, 'UCSM')
            USER = parser.get(section_platform, 'USER')
            PASS = parser.get(section_platform, 'PASS')
        except Exception as e:
            print(str(e), ' could not read configuration file')

            for section_name in parser.sections():
                print 'Section:', section_name
                print '  Options:', parser.options(section_name)
                if args.debug:
                    for name, value in parser.items(section_name):
                        print '  %s = %s' % (name, value)
                print
            # Exit due to exception
            exit(0)

    # Rest of normal flow would take place here
    try:
        handle = UcsHandle(UCSM, USER, PASS)

        # Login to UCSM
        handle.login()

        # If successful, print some details
        print("Login was successful")
        print("=" * 50)
        print("UCS Cookie: " + handle.cookie)
        print("UCS IP: " + handle.ip)
        print("UCS Name: " + handle.ucs)
        print("=" * 50)

        # launch the GUI
        ucs_gui_launch(handle)

        # To prevent the conversion function from using an old/previous UCSM Logfile
        # Delay it's execution until the GUI has completed loading before asking the
        # User to hit "Enter" to continue script execution
        time.sleep(7)
        print("=========================================================")
        print("Hit \"Enter\" AFTER the Java GUI has completely loaded...")
        print("=========================================================")
        wait = raw_input()

        # Start the conversion to UCS Python
        convert_to_ucs_python()

    except:
        handle.logout()
        print("Exception occurred")
        raise

    finally:
        print("Executing finally block")
        handle.logout()
示例#17
0
def main():
    convert_to_ucs_python(xml=True, literal_path="C:\\Users\\Administrator\\Downloads\\test01-serviceprofiletemplate_xmlReq.log")
示例#18
0
parser.add_argument('--username', help="username", required=True)
parser.add_argument('--password', help="password", required=True)
args = parser.parse_args()
host, user, password = args.hostname, args.username, args.password


try:
    input = raw_input
except NameError:
    pass

try:
    handle = UcsHandle(host, user, password)
    handle.login()

    ucs_gui_launch(handle)

    time.sleep(5)
    print("================================================")
    print("Hit an Enter here AFTER the Java UI is up and running...")
    print("================================================")
    wait = input()
    convert_to_ucs_python()

except:
    handle.logout()
    raise

finally:
    handle.logout()
示例#19
0
from ucsmsdk.utils.converttopython import convert_to_ucs_python

convert_to_ucs_python(xml=True,
                      literal_path="/Users/idrey/Downloads/xmlReq .log")
示例#20
0
from ucsmsdk.ucshandle import UcsHandle
handle = UcsHandle("192.168.67.148", "admin", "password", secure=False)
handle.login()
#launch GUI
from ucsmsdk.utils.ucsguilaunch import ucs_gui_launch
ucs_gui_launch(handle)

#get ucs commands from the GUI
from ucsmsdk.utils.converttopython import convert_to_ucs_python
convert_to_ucs_python()
def test_002_convert_to_from_xml_sp():
    xml_str = '''
<configConfMos
inHierarchical="false">
<inConfigs>
<pair key="org-root/ls-test1234">
<lsServer
agentPolicyName=""
biosProfileName=""
bootPolicyName="default"

descr=""
dn="org-root/ls-test1234"
dynamicConPolicyName=""
extIPPoolName="ext-mgmt"
extIPState="none"
hostFwPolicyName=""
identPoolName="default"
kvmMgmtPolicyName=""
localDiskPolicyName=""
maintPolicyName=""
mgmtAccessPolicyName=""
mgmtFwPolicyName=""
name="test1234"
policyOwner="local"
powerPolicyName="default"
resolveRemote="yes"

sacl="addchild,del,mod"
scrubPolicyName=""
solPolicyName=""
srcTemplName=""
statsPolicyName="default"
status="created"
usrLbl=""
uuid="0"
vconProfileName=""
vmediaPolicyName="">
<lsVConAssign
adminHostPort="ANY"
adminVcon="any"


order="1"
rn="assign-ethernet-vnic-eth0"
sacl="addchild,del,mod"
status="created,modified"
transport="ethernet"
vnicName="eth0">
</lsVConAssign>
<lsVConAssign
adminHostPort="ANY"
adminVcon="any"


order="2"
rn="assign-fc-vnic-fc0"
sacl="addchild,del,mod"
status="created,modified"
transport="fc"
vnicName="fc0">
</lsVConAssign>
<vnicEther
adaptorProfileName=""
addr="derived"
adminCdnName=""
adminHostPort="ANY"
adminVcon="any"
cdnPropInSync="yes"
cdnSource="vnic-name"


identPoolName="default"
mtu="1500"
name="eth0"
nwCtrlPolicyName=""
nwTemplName=""
order="1"
pinToGroupName=""
qosPolicyName=""
rn="ether-eth0"
sacl="addchild,del,mod"
statsPolicyName="default"

switchId="A">
<vnicEtherIf

defaultNet="yes"

name="default"
rn="if-default"
sacl="addchild,del,mod"
>
</vnicEtherIf>
</vnicEther>
<vnicFc
adaptorProfileName=""
addr="derived"
adminCdnName=""
adminHostPort="ANY"
adminVcon="any"
cdnPropInSync="yes"
cdnSource="vnic-name"


identPoolName=""
maxDataFieldSize="2048"
name="fc0"
nwTemplName=""
order="2"
persBind="disabled"
persBindClear="no"
pinToGroupName=""
qosPolicyName=""
rn="fc-fc0"
sacl="addchild,del,mod"
statsPolicyName="default"

switchId="A">
<vnicFcIf


name="default"
rn="if-default"
sacl="addchild,del,mod"
>
</vnicFcIf>
</vnicFc>
<vnicFcNode
addr="pool-derived"


identPoolName="node-default"
rn="fc-node"
sacl="addchild,del,mod"
>
</vnicFcNode>
<lsPower


rn="power"
sacl="addchild,del,mod"
state="admin-up"
>
</lsPower>
<fabricVCon


fabric="NONE"
id="1"
instType="auto"
placement="physical"
rn="vcon-1"
sacl="addchild,del,mod"
select="all"
share="shared"

transport="ethernet,fc">
</fabricVCon>
<fabricVCon


fabric="NONE"
id="2"
instType="auto"
placement="physical"
rn="vcon-2"
sacl="addchild,del,mod"
select="all"
share="shared"

transport="ethernet,fc">
</fabricVCon>
<fabricVCon


fabric="NONE"
id="3"
instType="auto"
placement="physical"
rn="vcon-3"
sacl="addchild,del,mod"
select="all"
share="shared"
transport="ethernet,fc">
</fabricVCon>
<fabricVCon


fabric="NONE"
id="4"
instType="auto"
placement="physical"
rn="vcon-4"
sacl="addchild,del,mod"
select="all"
share="shared"

transport="ethernet,fc">
</fabricVCon>
</lsServer>
</pair>
</inConfigs>
</configConfMos>

'''
    convert_to_ucs_python(xml=True, request=xml_str, dump_xml=True)
示例#22
0
def test_002_convert_to_from_xml_sp():
    xml_str = '''
<configConfMos
inHierarchical="false">
<inConfigs>
<pair key="org-root/ls-test1234">
<lsServer
agentPolicyName=""
biosProfileName=""
bootPolicyName="default"

descr=""
dn="org-root/ls-test1234"
dynamicConPolicyName=""
extIPPoolName="ext-mgmt"
extIPState="none"
hostFwPolicyName=""
identPoolName="default"
kvmMgmtPolicyName=""
localDiskPolicyName=""
maintPolicyName=""
mgmtAccessPolicyName=""
mgmtFwPolicyName=""
name="test1234"
policyOwner="local"
powerPolicyName="default"
resolveRemote="yes"

sacl="addchild,del,mod"
scrubPolicyName=""
solPolicyName=""
srcTemplName=""
statsPolicyName="default"
status="created"
usrLbl=""
uuid="0"
vconProfileName=""
vmediaPolicyName="">
<lsVConAssign
adminHostPort="ANY"
adminVcon="any"


order="1"
rn="assign-ethernet-vnic-eth0"
sacl="addchild,del,mod"
status="created,modified"
transport="ethernet"
vnicName="eth0">
</lsVConAssign>
<lsVConAssign
adminHostPort="ANY"
adminVcon="any"


order="2"
rn="assign-fc-vnic-fc0"
sacl="addchild,del,mod"
status="created,modified"
transport="fc"
vnicName="fc0">
</lsVConAssign>
<vnicEther
adaptorProfileName=""
addr="derived"
adminCdnName=""
adminHostPort="ANY"
adminVcon="any"
cdnPropInSync="yes"
cdnSource="vnic-name"


identPoolName="default"
mtu="1500"
name="eth0"
nwCtrlPolicyName=""
nwTemplName=""
order="1"
pinToGroupName=""
qosPolicyName=""
rn="ether-eth0"
sacl="addchild,del,mod"
statsPolicyName="default"

switchId="A">
<vnicEtherIf

defaultNet="yes"

name="default"
rn="if-default"
sacl="addchild,del,mod"
>
</vnicEtherIf>
</vnicEther>
<vnicFc
adaptorProfileName=""
addr="derived"
adminCdnName=""
adminHostPort="ANY"
adminVcon="any"
cdnPropInSync="yes"
cdnSource="vnic-name"


identPoolName=""
maxDataFieldSize="2048"
name="fc0"
nwTemplName=""
order="2"
persBind="disabled"
persBindClear="no"
pinToGroupName=""
qosPolicyName=""
rn="fc-fc0"
sacl="addchild,del,mod"
statsPolicyName="default"

switchId="A">
<vnicFcIf


name="default"
rn="if-default"
sacl="addchild,del,mod"
>
</vnicFcIf>
</vnicFc>
<vnicFcNode
addr="pool-derived"


identPoolName="node-default"
rn="fc-node"
sacl="addchild,del,mod"
>
</vnicFcNode>
<lsPower


rn="power"
sacl="addchild,del,mod"
state="admin-up"
>
</lsPower>
<fabricVCon


fabric="NONE"
id="1"
instType="auto"
placement="physical"
rn="vcon-1"
sacl="addchild,del,mod"
select="all"
share="shared"

transport="ethernet,fc">
</fabricVCon>
<fabricVCon


fabric="NONE"
id="2"
instType="auto"
placement="physical"
rn="vcon-2"
sacl="addchild,del,mod"
select="all"
share="shared"

transport="ethernet,fc">
</fabricVCon>
<fabricVCon


fabric="NONE"
id="3"
instType="auto"
placement="physical"
rn="vcon-3"
sacl="addchild,del,mod"
select="all"
share="shared"
transport="ethernet,fc">
</fabricVCon>
<fabricVCon


fabric="NONE"
id="4"
instType="auto"
placement="physical"
rn="vcon-4"
sacl="addchild,del,mod"
select="all"
share="shared"

transport="ethernet,fc">
</fabricVCon>
</lsServer>
</pair>
</inConfigs>
</configConfMos>

'''
    convert_to_ucs_python(xml=True, request=xml_str, dump_xml=True)
示例#23
0
"""
ex_08.py

Purpose:
    UCS Manager Python SDK code generation from GUI XML capture
Author:
    John McDonough ([email protected]) github: (@movinalot)
    Cisco Systems, Inc.
"""

from ucsmsdk.utils.converttopython import convert_to_ucs_python

# Windows
convert_to_ucs_python(xml=True, literal_path='C:\\Users\\demouser\\Downloads\\vlan_ops_xmlReq.log')

# Linux
convert_to_ucs_python(xml=True, literal_path='/Users/demouser/Downloads/vlan_ops_xmlReq.log')