_new_bound_segment
293 def set_binding(self, segment_id, vif_type, vif_details, 294 status=None): 295 # TODO(rkukura) Verify binding allowed, segment in network 296 self._new_bound_segment = segment_id 297 self._binding.vif_type = vif_type 298 self._binding.vif_details = jsonutils.dumps(vif_details) 299 self._new_port_status = status 300 301 def continue_binding(self, segment_id, next_segments_to_bind): 302 # TODO(rkukura) Verify binding allowed, segment in network 303 self._new_bound_segment = segment_id 304 self._next_segments_to_bind = next_segments_to_bind
/usr/lib/python2.7/site-packages/networking_baremetal/plugins/ml2
320 def try_to_bind_segment_for_agent(self, context, segment, agent): 321 """Try to bind with segment for agent. 322 323 :param context: PortContext instance describing the port 324 :param segment: segment dictionary describing segment to bind 325 :param agent: agents_db entry describing agent to bind 326 :returns: True iff segment has been bound for agent 327 328 Neutron segments api-ref: 329 https://developer.openstack.org/api-ref/network/v2/#segments 330 331 Example segment dictionary: {'segmentation_id': 'segmentation_id', 332 'network_type': 'network_type', 333 'id': 'segment_uuid'} 334 335 Called outside any transaction during bind_port() so that 336 derived MechanismDrivers can use agent_db data along with 337 built-in knowledge of the corresponding agent's capabilities 338 to attempt to bind to the specified network segment for the 339 agent. 340 341 If the segment can be bound for the agent, this function must 342 call context.set_binding() with appropriate values and then 343 return True. Otherwise, it must return False. 344 """ 345 if self.check_segment_for_agent(segment, agent): 346 port = context.current 347 provisioning_blocks.add_provisioning_component( 348 context._plugin_context, port['id'], resources.PORT, 349 BAREMETAL_DRV_ENTITY) 350 context.set_binding(segment[api.ID], 351 self.get_vif_type(context, agent, segment), 352 self.get_vif_details(context, agent, segment)) 353 return True 354 else: 355 return False
def get_allowed_network_types(self, agent):
check_segment_for_agent