Ejemplo n.º 1
0
 def _extend_network_dict_provider(self,
                                   context,
                                   network,
                                   multiprovider=None,
                                   bindings=None):
     if not bindings:
         bindings = nsx_db.get_network_bindings(context.session,
                                                network['id'])
     if not multiprovider:
         multiprovider = nsx_db.is_multiprovider_network(
             context.session, network['id'])
     # With NSX plugin 'normal' overlay networks will have no binding
     # TODO(salvatore-orlando) make sure users can specify a distinct
     # phy_uuid as 'provider network' for STT net type
     if bindings:
         if not multiprovider:
             # network came in through provider networks api
             network[pnet.NETWORK_TYPE] = bindings[0].binding_type
             network[pnet.PHYSICAL_NETWORK] = bindings[0].phy_uuid
             network[pnet.SEGMENTATION_ID] = bindings[0].vlan_id
         else:
             # network come in though multiprovider networks api
             network[mpnet.SEGMENTS] = [{
                 pnet.NETWORK_TYPE:
                 binding.binding_type,
                 pnet.PHYSICAL_NETWORK:
                 binding.phy_uuid,
                 pnet.SEGMENTATION_ID:
                 binding.vlan_id
             } for binding in bindings]
Ejemplo n.º 2
0
 def _extend_network_dict_provider(self, context, network,
                                   multiprovider=None, bindings=None):
     if not bindings:
         bindings = nsx_db.get_network_bindings(context.session,
                                                network['id'])
     if not multiprovider:
         multiprovider = nsx_db.is_multiprovider_network(context.session,
                                                         network['id'])
     # With NSX plugin 'normal' overlay networks will have no binding
     # TODO(salvatore-orlando) make sure users can specify a distinct
     # phy_uuid as 'provider network' for STT net type
     if bindings:
         if not multiprovider:
             # network came in through provider networks api
             network[pnet.NETWORK_TYPE] = bindings[0].binding_type
             network[pnet.PHYSICAL_NETWORK] = bindings[0].phy_uuid
             network[pnet.SEGMENTATION_ID] = bindings[0].vlan_id
         else:
             # network come in though multiprovider networks api
             network[mpnet.SEGMENTS] = [
                 {pnet.NETWORK_TYPE: binding.binding_type,
                  pnet.PHYSICAL_NETWORK: binding.phy_uuid,
                  pnet.SEGMENTATION_ID: binding.vlan_id}
                 for binding in bindings]