the big cleanup: deprecate federica driver
[sfa.git] / sfa / openstack / shell.py
1 import sys
2 import socket
3 import gettext
4 from urlparse import urlparse
5 from sfa.util.sfalogging import logger
6 from sfa.util.config import Config
7
8 try:
9     from sfa.openstack.client import GlanceClient, NovaClient, KeystoneClient
10     has_nova = True
11 except:
12     has_nova = False
13
14
15 class Shell:
16     """
17     A simple native shell to a nova backend. 
18     This class can receive all nova calls to the underlying testbed
19     """
20
21     # dont care about limiting calls yet
22     direct_calls = []
23     alias_calls = {}
24
25     # use the 'capability' auth mechanism for higher performance when the PLC
26     # db is local
27     def __init__(self, config=None):
28         if not config:
29             config = Config()
30         if has_nova:
31             # instantiate managers
32             self.auth_manager = KeystoneClient(config=config)
33             self.image_manager = GlanceClient(config=config)
34             self.nova_manager = NovaClient(config=config)
35         else:
36             logger.debug('nova access - REST')
37             raise SfaNotImplemented('nova access - Rest')