コード例 #1
0
 def get(self):
     creds = QSCreds()
     csapi = CloudShellAPISession(creds.Host, creds.Un, creds.Pw, creds.Dom)
     fAM = csapi.ExportFamiliesAndModels()
     root = ET.fromstring(fAM.Configuration)
     ns = {
         "qs":
         "http://schemas.qualisystems.com/ResourceManagement/ExportImportConfigurationSchema.xsd"
     }
     famList = []
     modList = []
     attList = []
     for f in root.findall(".//qs:ResourceFamily", ns):
         famList.append(f.get("Name"))
     for m in root.findall(".//qs:ResourceModel", ns):
         modList.append(m.get("Name"))
     for a in root.findall(".//qs:AttributeInfo", ns):
         attList.append(a.get("Name"))
     self.render("index.html",
                 title="Resource Maker",
                 wsip="6661",
                 possibleFamily=famList,
                 possibleModel=modList,
                 possibleAtts=attList)
from cloudshell.api.cloudshell_api import CloudShellAPISession
import xml.etree.ElementTree as ET

user = "******"
password = "******"
server = "localhost"
domain = "Global"

api = CloudShellAPISession(host=server,
                           username=user,
                           password=password,
                           domain=domain)
model_data_str = api.ExportFamiliesAndModels().Configuration
xml_data = ET.fromstring(model_data_str)