/usr/lib/python2.7/dist-packages/pypowervm/const.py is in python-pypowervm 1.1.10-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | # Copyright 2014, 2015 IBM Corp.
#
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Pervasive, widely-used constants."""
import six
_DEFAULT_SCHEMA_VERSION = 'V1_0'
_SCHEMA_VER120 = 'V1_2_0'
_SCHEMA_VER130 = 'V1_3_0'
_SCHEMA_VER140 = 'V1_4_0'
_SCHEMA_VER150 = 'V1_5_0'
_SCHEMA_VER160 = 'V1_6_0'
_SCHEMA_VER170 = 'V1_7_0'
_ATTR_SCHEMA_VER = 'schemaVersion'
_ATTR_KSV = 'ksv'
DEFAULT_SCHEMA_ATTR = {_ATTR_SCHEMA_VER: _DEFAULT_SCHEMA_VERSION}
ATTR_KSV120 = {_ATTR_KSV: _SCHEMA_VER120}
ATTR_KSV130 = {_ATTR_KSV: _SCHEMA_VER130}
ATTR_KSV140 = {_ATTR_KSV: _SCHEMA_VER140}
ATTR_KSV150 = {_ATTR_KSV: _SCHEMA_VER150}
ATTR_KSV160 = {_ATTR_KSV: _SCHEMA_VER160}
ATTR_KSV170 = {_ATTR_KSV: _SCHEMA_VER170}
ATTR_SCHEMA_KSV130 = {_ATTR_KSV: _SCHEMA_VER130,
_ATTR_SCHEMA_VER: _SCHEMA_VER130}
API_BASE_PATH = '/rest/api/'
LOGON_PATH = API_BASE_PATH + 'web/Logon'
TYPE_TEMPLATE = 'application/vnd.ibm.powervm.%s+xml; type=%s'
# The following is interpolated *twice*. The first time, we insert either the
# Password element or the GenerateX-API-SessionFile element after the UserID.
# We don't want to interpolate 'userid' until the second interpolation, which
# happens at runtime in the Session's login routine.
_LOGONREQUEST_TEMPLATE_TEMPLATE = six.u(
'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n' +
'<LogonRequest xmlns="http://www.ibm.com/xmlns/systems/power/firmware/' +
'web/mc/2012_10/" schemaVersion="V1_0">\n' +
' <UserID>%%(userid)s</UserID>\n' +
' %(pass_or_file)s\n' +
'</LogonRequest>')
_PASS_TEMPLATE = '<Password>%(passwd)s</Password>'
_SESS_FILE = '<GenerateX-API-SessionFile>true</GenerateX-API-SessionFile>'
# LogonRequest template to be used for password-based authentication
LOGONREQUEST_TEMPLATE_PASS = _LOGONREQUEST_TEMPLATE_TEMPLATE % dict(
pass_or_file=_PASS_TEMPLATE)
# LogonRequest template to be used for file-based authentication
LOGONREQUEST_TEMPLATE_FILE = _LOGONREQUEST_TEMPLATE_TEMPLATE % dict(
pass_or_file=_SESS_FILE)
ATOM_NS = 'http://www.w3.org/2005/Atom'
XSI_NS = 'http://www.w3.org/2001/XMLSchema-instance'
WEB_NS = 'http://www.ibm.com/xmlns/systems/power/firmware/web/mc/2012_10/'
PCM_NS = 'http://www.ibm.com/xmlns/systems/power/firmware/pcm/mc/2012_10/'
UOM_BASE_NS = 'http://www.ibm.com/xmlns/systems/power/firmware/uom/mc'
UOM_NS = UOM_BASE_NS + '/2012_10/'
# Match a UUID anywhere in the search string
UUID_REGEX = '%(x)s{8}-%(x)s{4}-%(x)s{4}-%(x)s{4}-%(x)s{12}' % {
'x': '[A-Fa-f0-9]'}
# Entire search string must be a UUID and nothing more
UUID_REGEX_WORD = '^%s$' % UUID_REGEX
# XPath to the UUID of a metadata-having XML object
UUID_XPATH = 'Metadata/Atom/AtomID'
SUFFIX_TYPE_DO = 'do'
LINK = 'link'
PORT_DEFAULT_BY_PROTO = {
'http': 12080,
'https': 12443
}
SERVICE_BY_NS = {
WEB_NS: 'web',
UOM_NS: 'uom',
PCM_NS: 'pcm'
}
class HTTPStatus(object):
"""Small subset of HTTP status codes as used by PowerVM."""
OK_NO_CONTENT = 204
NO_CHANGE = 304
UNAUTHORIZED = 401
NOT_FOUND = 404
ETAG_MISMATCH = 412
INTERNAL_ERROR = 500
SERVICE_UNAVAILABLE = 503
class MaxLen(object):
"""Maximum lengths for various PowerVM entities."""
# FileName.Pattern
FILENAME_DEFAULT = 79
VOPT_NAME = 37
VDISK_NAME = 15
class XAG(object):
"""Enumeration of all extended attribute group strings."""
ALL = 'All'
NONE = 'None'
ADV = 'Advanced'
ENERGY = 'EnergyManagement'
HYP = 'Hypervisor'
NVRAM = 'NVRAM'
SYS_NET = 'SystemNetwork'
TIER_THRESH = 'TierThreshold'
VIO_FMAP = 'ViosFCMapping'
VIO_NET = 'ViosNetwork'
VIO_SMAP = 'ViosSCSIMapping'
VIO_STOR = 'ViosStorage'
VNIC = 'VNIC'
|