blob: 6e37241ce15cf1c79c4c9088e0775afed1e00e35 [file] [log] [blame]
Oleksiy Petrenkocaad2032018-04-20 14:42:46 +03001try:
2 import os_client_config
3 from keystoneauth1 import exceptions as ka_exceptions
4 REQUIREMENTS_MET = True
5except ImportError:
6 REQUIREMENTS_MET = False
7
8from neutronv2 import networks
9from neutronv2 import subnetpools
10from neutronv2 import auto_alloc
11from neutronv2 import subnets
12
13network_get_details = networks.network_get_details
14network_update = networks.network_update
15network_delete = networks.network_delete
16network_list = networks.network_list
17network_create = networks.network_create
18network_bulk_create = networks.network_bulk_create
19
20subnetpool_get_details = subnetpools.subnetpool_get_details
21subnetpool_update = subnetpools.subnetpool_update
22subnetpool_delete = subnetpools.subnetpool_delete
23subnetpool_list = subnetpools.subnetpool_list
24subnetpool_create = subnetpools.subnetpool_create
25
26auto_alloc_get_details = auto_alloc.auto_alloc_get_details
27auto_alloc_delete = auto_alloc.auto_alloc_delete
28
29subnet_list = subnets.subnet_list
30subnet_create = subnets.subnet_create
31subnet_bulk_create = subnets.subnet_bulk_create
32subnet_get_details = subnets.subnet_get_details
33subnet_update = subnets.subnet_update
34subnet_delete = subnets.subnet_delete
35
36
37__all__ = (
38 'network_get_details', 'network_update', 'network_delete', 'network_list',
39 'network_create', 'network_bulk_create', 'subnetpool_get_details',
40 'subnetpool_update', 'subnetpool_delete', 'subnetpool_list',
41 'subnetpool_create', 'auto_alloc_get_details', 'auto_alloc_delete',
42 'subnet_list', 'subnet_create', 'subnet_bulk_create', 'subnet_get_details',
43 'subnet_update', 'subnet_delete',
44)
45
46
47def __virtual__():
48 """Only load neutronv2 if requirements are available."""
49 if REQUIREMENTS_MET:
50 return 'neutronv2'
51 else:
52 return False, ("The neutronv2 execution module cannot be loaded: "
53 "os_client_config or keystoneauth are unavailable.")