"""
create_ucs_sp_template.py

Purpose:
    UCS Manager Create a UCS Service Profile Template
Author:
    John McDonough (jomcdono@cisco.com) github: (@movinalot)
    Cisco Systems, Inc.
"""

from ucsmsdk.ucshandle import UcsHandle
from ucsmsdk.mometa.ls.LsServer import LsServer
from ucsmsdk.mometa.org.OrgOrg import OrgOrg

HANDLE = UcsHandle(
    "sandbox-ucsm1.cisco.com",
    "admin",
    "password"
)

HANDLE.login()

ORG_ORG = OrgOrg(
    parent_mo_or_dn='org-root',
    name="devnet",
)
HANDLE.add_mo(ORG_ORG, modify_present=True)
HANDLE.commit()

SP_TEMPLATE = LsServer(
    parent_mo_or_dn='org-root/org-devnet',
    name="devcore_template",
    type="updating-template"
)

HANDLE.add_mo(SP_TEMPLATE, modify_present=True)
HANDLE.commit()

HANDLE.logout()

[((335, 392), 'ucsmsdk.ucshandle.UcsHandle', 'UcsHandle', (['"""sandbox-ucsm1.cisco.com"""', '"""admin"""', '"""password"""'], {}), "('sandbox-ucsm1.cisco.com', 'admin', 'password')\n", (344, 392), False, 'from ucsmsdk.ucshandle import UcsHandle\n'), ((434, 483), 'ucsmsdk.mometa.org.OrgOrg.OrgOrg', 'OrgOrg', ([], {'parent_mo_or_dn': '"""org-root"""', 'name': '"""devnet"""'}), "(parent_mo_or_dn='org-root', name='devnet')\n", (440, 483), False, 'from ucsmsdk.mometa.org.OrgOrg import OrgOrg\n'), ((570, 672), 'ucsmsdk.mometa.ls.LsServer.LsServer', 'LsServer', ([], {'parent_mo_or_dn': '"""org-root/org-devnet"""', 'name': '"""devcore_template"""', 'type': '"""updating-template"""'}), "(parent_mo_or_dn='org-root/org-devnet', name='devcore_template',\n    type='updating-template')\n", (578, 672), False, 'from ucsmsdk.mometa.ls.LsServer import LsServer\n')]