1#    (c) Copyright 2014 Cisco Systems Inc.
2#    All Rights Reserved.
3#
4#    Licensed under the Apache License, Version 2.0 (the "License"); you may
5#    not use this file except in compliance with the License. You may obtain
6#    a copy of the License at
7#
8#         http://www.apache.org/licenses/LICENSE-2.0
9#
10#    Unless required by applicable law or agreed to in writing, software
11#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13#    License for the specific language governing permissions and limitations
14#    under the License.
15#
16from oslo_config import cfg
17
18from cinder.volume import configuration
19
20cisco_zone_opts = [
21    cfg.StrOpt('cisco_fc_fabric_address',
22               default='',
23               help='Management IP of fabric'),
24    cfg.StrOpt('cisco_fc_fabric_user',
25               default='',
26               help='Fabric user ID'),
27    cfg.StrOpt('cisco_fc_fabric_password',
28               default='',
29               help='Password for user',
30               secret=True),
31    cfg.PortOpt('cisco_fc_fabric_port',
32                default=22,
33                help='Connecting port'),
34    cfg.StrOpt('cisco_zoning_policy',
35               default='initiator-target',
36               help='overridden zoning policy'),
37    cfg.BoolOpt('cisco_zone_activate',
38                default=True,
39                help='overridden zoning activation state'),
40    cfg.StrOpt('cisco_zone_name_prefix',
41               help='overridden zone name prefix'),
42    cfg.StrOpt('cisco_zoning_vsan',
43               help='VSAN of the Fabric'),
44]
45
46CONF = cfg.CONF
47CONF.register_opts(cisco_zone_opts, group='CISCO_FABRIC_EXAMPLE')
48
49
50def load_fabric_configurations(fabric_names):
51    fabric_configs = {}
52    for fabric_name in fabric_names:
53        config = configuration.Configuration(cisco_zone_opts, fabric_name)
54        fabric_configs[fabric_name] = config
55
56    return fabric_configs
57