Ejemplo n.º 1
0
 def test_skip_policy(self):
     policy.reset()
     rules = {'network:get_all': common_policy.parse_rule('!')}
     policy.set_rules(common_policy.Rules(rules))
     api = network.API()
     self.assertRaises(exception.PolicyNotAuthorized,
                       api.get_all, self.context)
     api = network.API(skip_policy_check=True)
     api.get_all(self.context)
Ejemplo n.º 2
0
 def network_api(self):
     # NOTE(danms): We need to instantiate our network_api on first use
     # to avoid the circular dependency that exists between our init
     # and network_api's
     if self._network_api is None:
         self._network_api = network.API()
     return self._network_api
Ejemplo n.º 3
0
def get_metadata_by_address(conductor_api, address):
    ctxt = context.get_admin_context()
    fixed_ip = network.API().get_fixed_ip_by_address(ctxt, address)

    return get_metadata_by_instance_id(conductor_api,
                                       fixed_ip['instance_uuid'],
                                       address,
                                       ctxt)
Ejemplo n.º 4
0
 def _get_nwinfo_old_skool():
     """Support for getting network info without objects."""
     if (instance_ref.get('info_cache') and
             instance_ref['info_cache'].get('network_info') is not None):
         cached_info = instance_ref['info_cache']['network_info']
         if isinstance(cached_info, network_model.NetworkInfo):
             return cached_info
         return network_model.NetworkInfo.hydrate(cached_info)
     try:
         return network.API().get_instance_nw_info(admin_context,
                                                   instance_ref)
     except Exception:
         try:
             with excutils.save_and_reraise_exception():
                 LOG.exception(_LE('Failed to get nw_info'),
                               instance=instance_ref)
         except Exception:
             if ignore_missing_network_data:
                 return
             raise
Ejemplo n.º 5
0
 def __init__(self, network_api=None):
     self.network_api = network_api or network.API()
Ejemplo n.º 6
0
 def __init__(self, network_api=None):
     self.network_api = network_api or network.API(skip_policy_check=True)
Ejemplo n.º 7
0
 def __init__(self):
     self.compute_api = compute.API(skip_policy_check=True)
     self.network_api = network.API(skip_policy_check=True)
     self.cloudpipe = pipelib.CloudPipe(skip_policy_check=True)
     self.setup()
Ejemplo n.º 8
0
 def setUp(self):
     super(ApiTestCase, self).setUp()
     self.network_api = network.API()
     self.context = context.RequestContext('fake-user',
                                           'fake-project')
Ejemplo n.º 9
0
 def __init__(self):
     self.network_api = network.API()
     self.cert_rpcapi = patron.cert.rpcapi.CertAPI()
     super(CertificatesController, self).__init__()
Ejemplo n.º 10
0
 def __init__(self):
     self.compute_api = compute.API()
     self.network_api = network.API()
     self.cloudpipe = pipelib.CloudPipe()
     self.setup()
Ejemplo n.º 11
0
 def __init__(self):
     self.compute_api = compute.API(skip_policy_check=True)
     self.network_api = network.API(skip_policy_check=True)
     super(FloatingIPController, self).__init__()
Ejemplo n.º 12
0
 def __init__(self):
     super(FloatingIPDNSDomainController, self).__init__()
     self.network_api = network.API(skip_policy_check=True)
Ejemplo n.º 13
0
 def __init__(self, ext_mgr=None, *args, **kwargs):
     super(FloatingIPActionController, self).__init__(*args, **kwargs)
     self.compute_api = compute.API()
     self.network_api = network.API()
     self.ext_mgr = ext_mgr
Ejemplo n.º 14
0
 def __init__(self):
     self.compute_api = compute.API(skip_policy_check=True)
     self.network_api = network.API(skip_policy_check=True)
     super(ServerVirtualInterfaceController, self).__init__()
Ejemplo n.º 15
0
 def __init__(self, network_api=None, ext_mgr=None):
     self.network_api = network_api or network.API()
     if ext_mgr:
         self.extended = ext_mgr.is_loaded('os-extended-networks')
     else:
         self.extended = False
Ejemplo n.º 16
0
 def __init__(self):
     self.compute_api = compute.API()
     self.network_api = network.API()
     super(InterfaceAttachmentController, self).__init__()
Ejemplo n.º 17
0
 def __init__(self):
     self.compute_api = compute.API()
     self.network_api = network.API()
     super(ServerVirtualInterfaceController, self).__init__()
Ejemplo n.º 18
0
 def __init__(self):
     super(ExtendedServerVIFNetController, self).__init__()
     self.network_api = network.API()
Ejemplo n.º 19
0
 def __init__(self):
     self.network_api = network.API()
     super(FloatingIPPoolsController, self).__init__()
Ejemplo n.º 20
0
 def __init__(self, *args, **kwargs):
     super(FloatingIPActionController, self).__init__(*args, **kwargs)
     self.compute_api = compute.API(skip_policy_check=True)
     self.network_api = network.API(skip_policy_check=True)
Ejemplo n.º 21
0
 def __init__(self, ext_mgr):
     self.network_api = network.API()
     super(Floating_ip_dns, self).__init__(ext_mgr)
Ejemplo n.º 22
0
 def __init__(self):
     self.compute_api = compute.API()
     self.network_api = network.API()
     super(FloatingIPController, self).__init__()
Ejemplo n.º 23
0
 def __init__(self):
     self.network_api = network.API()
     super(FloatingIPDNSDomainController, self).__init__()