# Copyright (c) - 2014, Clinton Knight. 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.
from lxml import etree
CONNECTION_INFO = {
'hostname': 'hostname',
'transport_type': 'https',
'port': 443,
'username': 'admin',
'password': 'passw0rd'
}
NODE_NAME = 'fake_node'
VSERVER_NAME = 'fake_vserver'
ADMIN_VSERVER_NAME = 'fake_admin_vserver'
NODE_VSERVER_NAME = 'fake_node_vserver'
ROOT_VOLUME_AGGREGATE_NAME = 'fake_root_aggr'
ROOT_VOLUME_NAME = 'fake_root_volume'
SHARE_AGGREGATE_NAME = 'fake_aggr1'
SHARE_AGGREGATE_NAMES = ['fake_aggr1', 'fake_aggr2']
SHARE_NAME = 'fake_share'
SNAPSHOT_NAME = 'fake_snapshot'
PARENT_SHARE_NAME = 'fake_parent_share'
PARENT_SNAPSHOT_NAME = 'fake_parent_snapshot'
USER_NAME = 'fake_user'
PORT = 'e0a'
VLAN = '1001'
VLAN_PORT = 'e0a-1001'
IP_ADDRESS = '10.10.10.10'
NETMASK = '255.255.255.0'
NET_ALLOCATION_ID = 'fake_allocation_id'
LIF_NAME_TEMPLATE = 'os_%(net_allocation_id)s'
LIF_NAME = LIF_NAME_TEMPLATE % {'net_allocation_id': NET_ALLOCATION_ID}
EMS_MESSAGE = {
'computer-name': 'fake_host',
'event-id': '0',
'event-source': 'fake driver',
'app-version': 'fake app version',
'category': 'fake category',
'event-description': 'fake description',
'log-level': '6',
'auto-support': 'false',
}
NO_RECORDS_RESPONSE = etree.XML("""
0
""")
VSERVER_GET_ITER_RESPONSE = etree.XML("""
%(fake_vserver)s
1
""" % {'fake_vserver': VSERVER_NAME})
VSERVER_GET_ROOT_VOLUME_NAME_RESPONSE = etree.XML("""
%(root_volume)s
%(fake_vserver)s
1
""" % {'root_volume': ROOT_VOLUME_NAME, 'fake_vserver': VSERVER_NAME})
VSERVER_GET_RESPONSE = etree.XML("""
aggr0
manila
45678592
aggr0
6448431104
manila
%(vserver)s
""" % {'vserver': VSERVER_NAME})
VSERVER_DATA_LIST_RESPONSE = etree.XML("""
%(vserver)s
data
1
""" % {'vserver': VSERVER_NAME})
VSERVER_AGGREGATES = {'aggr0': 45678592, 'manila': 6448431104}
VSERVER_GET_RESPONSE_NO_AGGREGATES = etree.XML("""
%(vserver)s
""" % {'vserver': VSERVER_NAME})
ONTAPI_VERSION_RESPONSE = etree.XML("""
1
19
""")
LICENSE_V2_LIST_INFO_RESPONSE = etree.XML("""
none
Cluster Base License
false
cluster3
base
1-80-000008
license
none
NFS License
false
cluster3-01
nfs
1-81-0000000000000004082368507
license
none
CIFS License
false
cluster3-01
cifs
1-81-0000000000000004082368507
license
none
iSCSI License
false
cluster3-01
iscsi
1-81-0000000000000004082368507
license
none
FCP License
false
cluster3-01
fcp
1-81-0000000000000004082368507
license
none
SnapRestore License
false
cluster3-01
snaprestore
1-81-0000000000000004082368507
license
none
SnapMirror License
false
cluster3-01
snapmirror
1-81-0000000000000004082368507
license
none
FlexClone License
false
cluster3-01
flexclone
1-81-0000000000000004082368507
license
none
SnapVault License
false
cluster3-01
snapvault
1-81-0000000000000004082368507
license
""")
LICENSES = [
'base', 'cifs', 'fcp', 'flexclone', 'iscsi', 'nfs', 'snapmirror',
'snaprestore', 'snapvault'
]
VOLUME_COUNT_RESPONSE = etree.XML("""
vol0
cluster3-01
%(root_volume)s
%(fake_vserver)s
2
""" % {'root_volume': ROOT_VOLUME_NAME, 'fake_vserver': VSERVER_NAME})
CIFS_SECURITY_SERVICE = {
'type': 'active_directory',
'password': 'fake_password',
'user': 'fake_user',
'domain': 'fake_domain',
'dns_ip': 'fake_dns_ip',
}
LDAP_SECURITY_SERVICE = {
'type': 'ldap',
'password': 'fake_password',
'server': 'fake_server',
'id': 'fake_id',
}
KERBEROS_SECURITY_SERVICE = {
'type': 'kerberos',
'password': 'fake_password',
'user': 'fake_user',
'server': 'fake_server',
'id': 'fake_id',
'domain': 'fake_domain',
'dns_ip': 'fake_dns_ip',
}
KERBEROS_SERVICE_PRINCIPAL_NAME = 'nfs/fake-vserver.fake_domain@FAKE_DOMAIN'
INVALID_SECURITY_SERVICE = {
'type': 'fake',
}
SYSTEM_NODE_GET_ITER_RESPONSE = etree.XML("""
%s
1
""" % NODE_NAME)
NET_PORT_GET_ITER_RESPONSE = etree.XML("""
full
full
auto
true
true
true
up
00:0c:29:fc:04:d9
1500
%(node_name)s
full
none
1000
e0a
physical
data
full
full
auto
true
true
true
up
00:0c:29:fc:04:e3
1500
%(node_name)s
full
none
1000
e0b
physical
data
full
full
auto
true
true
true
up
00:0c:29:fc:04:ed
1500
%(node_name)s
full
none
1000
e0c
physical
data
full
full
auto
true
true
true
up
00:0c:29:fc:04:f7
1500
%(node_name)s
full
none
1000
e0d
physical
data
4
""" % {'node_name': NODE_NAME})
PORTS = ['e0a', 'e0b', 'e0c', 'e0d']
NET_INTERFACE_GET_ITER_RESPONSE = etree.XML("""
192.168.228.42
ipv4
up
%(node)s
e0c
none
none
system-defined
disabled
mgmt
%(node)s
e0c
cluster_mgmt
true
true
d3230112-7524-11e4-8608-123478563412
false
%(netmask)s
24
up
cluster_mgmt
c192.168.228.0/24
system_defined
cluster3
192.168.228.43
ipv4
up
%(node)s
e0d
none
system-defined
nextavail
mgmt
%(node)s
e0d
mgmt1
true
true
0ccc57cc-7525-11e4-8608-123478563412
false
%(netmask)s
24
up
node_mgmt
n192.168.228.0/24
system_defined
cluster3-01
%(address)s
ipv4
up
%(node)s
%(vlan)s
nfs
cifs
none
system-defined
nextavail
data
%(node)s
%(vlan)s
%(lif)s
false
true
db4d91b6-95d9-11e4-8608-123478563412
false
%(netmask)s
24
up
data
d10.0.0.0/24
system_defined
%(vserver)s
3
""" % {
'lif': LIF_NAME,
'vserver': VSERVER_NAME,
'node': NODE_NAME,
'address': IP_ADDRESS,
'netmask': NETMASK,
'vlan': VLAN_PORT
})
LIF_NAMES = ['cluster_mgmt', 'mgmt1', LIF_NAME]
LIFS = [
{'address': '192.168.228.42',
'home-node': NODE_NAME,
'home-port': 'e0c',
'interface-name': 'cluster_mgmt',
'netmask': NETMASK,
'role': 'cluster_mgmt',
'vserver': 'cluster3'
},
{'address': '192.168.228.43',
'home-node': NODE_NAME,
'home-port': 'e0d',
'interface-name': 'mgmt1',
'netmask': NETMASK,
'role': 'node_mgmt',
'vserver': 'cluster3-01'
},
{'address': IP_ADDRESS,
'home-node': NODE_NAME,
'home-port': VLAN_PORT,
'interface-name': LIF_NAME,
'netmask': NETMASK,
'role': 'data',
'vserver': VSERVER_NAME
}
]
NET_INTERFACE_GET_ONE_RESPONSE = etree.XML("""
%(lif)s
%(vserver)s
1
""" % {'lif': LIF_NAME, 'vserver': VSERVER_NAME})
AGGR_GET_NAMES_RESPONSE = etree.XML("""
/aggr0/plex0
/aggr0/plex0/rg0
aggr0
/manila/plex0
/manila/plex0/rg0
/manila/plex0/rg1
manila
2
""")
AGGR_NAMES = ['aggr0', 'manila']
AGGR_GET_SPACE_RESPONSE = etree.XML("""
/aggr0/plex0
/aggr0/plex0/rg0
45678592
943718400
aggr0
/manila/plex0
/manila/plex0/rg0
/manila/plex0/rg1
6448435200
7549747200
manila
2
""")
AGGR_GET_ITER_RESPONSE = etree.XML("""
false
64_bit
1758646411
aggr
512
30384
96
30384
30384
30384
243191
96
0
4082368507
cluster3-01
4082368507
cluster3-01
off
0
active
block
3
cfo
true
false
true
false
false
false
unmirrored
online
1
true
false
/aggr0/plex0
normal,active
block
false
false
false
/aggr0/plex0/rg0
0
0
0
on
16
raid_dp, normal
raid_dp
online
false
0
0
true
true
0
0
0
0
0
0
0
0
0
245760
0
95
45670400
943718400
898048000
0
898048000
897802240
1
0
0
aggr0
15863632-ea49-49a8-9c88-2bd2d57c6d7a
cluster3-01
unknown
false
64_bit
706602229
aggr
528
31142
96
31142
31142
31142
1945584
96
0
4082368507
cluster3-01
4082368507
cluster3-01
off
0
active
block
10
sfo
false
false
true
false
false
false
unmirrored
online
1
true
false
/manila/plex0
normal,active
block
false
false
false
/manila/plex0/rg0
0
0
block
false
false
false
/manila/plex0/rg1
0
0
0
on
8
raid4, normal
raid4
online
false
0
0
true
true
0
0
0
0
0
0
0
0
0
425984
0
15
6448431104
7549747200
1101316096
0
1101316096
1100890112
2
0
0
manila
2a741934-1aaf-42dd-93ca-aaf231be108a
cluster3-01
not_striped
2
""")
VOLUME_GET_NAME_RESPONSE = etree.XML("""
%(volume)s
%(vserver)s
1
""" % {'volume': SHARE_NAME, 'vserver': VSERVER_NAME})
VOLUME_GET_VOLUME_PATH_RESPONSE = etree.XML("""
/%(volume)s
""" % {'volume': SHARE_NAME})
VOLUME_GET_VOLUME_PATH_CIFS_RESPONSE = etree.XML("""
\\%(volume)s
""" % {'volume': SHARE_NAME})
VOLUME_JUNCTION_PATH = '/' + SHARE_NAME
VOLUME_JUNCTION_PATH_CIFS = '\\' + SHARE_NAME
SNAPSHOT_GET_ITER_NOT_BUSY_RESPONSE = etree.XML("""
false
%(snap)s
%(volume)s
%(vserver)s
1
""" % {'snap': SNAPSHOT_NAME, 'volume': SHARE_NAME, 'vserver': VSERVER_NAME})
SNAPSHOT_GET_ITER_BUSY_RESPONSE = etree.XML("""
true
%(snap)s
%(volume)s
%(vserver)s
1
""" % {'snap': SNAPSHOT_NAME, 'volume': SHARE_NAME, 'vserver': VSERVER_NAME})
NFS_EXPORT_RULES = ['10.10.10.10', '10.10.10.20']
NFS_EXPORTFS_LIST_RULES_2_NO_RULES_RESPONSE = etree.XML("""
""")
NFS_EXPORTFS_LIST_RULES_2_RESPONSE = etree.XML("""
%(path)s
65534
false
%(host1)s
%(host2)s
%(host1)s
%(host2)s
%(host1)s
%(host2)s
sys
""" % {
'path': VOLUME_JUNCTION_PATH,
'host1': NFS_EXPORT_RULES[0],
'host2': NFS_EXPORT_RULES[1],
})