original_docstring: Configure the interface in VPP per the binding request.
  
          Because we may be restarting the agent on a VPP that is already
          running, do this defensively: interfaces that we do not know
          about may have had some of their binding done.  Acting in this
          way, we can be sure that the interface is now correctly bound
          regardless of what may have transpired previously.
  
          This may be called at any time because of a request from
          the mechanism driver, or it may be called during resync
          when state already exists in VPP but in either case we fix
          what we find and draw out from that a picture of the current
          state, including whether (in the case of vhostuser interfaces)
          the far end of the socket has attached to VPP.
          
docstring: Configure the interface in VPP per the binding request.
  Because we may be restarting the agent on a VPP that is already
  running, do this defensively: interfaces that we do not know
  about may have had some of their binding done.  Acting in this
  way, we can be sure that the interface is now correctly bound
  regardless of what may have transpired previously.
  
  This may be called at any time because of a request from
  the mechanism driver, or it may be called during resync
  when state already exists in VPP but in either case we fix
  what we find and draw out from that a picture of the current
  state, including whether (in the case of vhostuser interfaces)
  the far end of the socket has attached to VPP.
docstring_tokens: Configure the interface in VPP per the binding request . Because we may be restarting the agent on a VPP that is already running do this defensively : interfaces that we do not know about may have had some of their binding done . Acting in this way we can be sure that the interface is now correctly bound regardless of what may have transpired previously . This may be called at any time because of a request from the mechanism driver or it may be called during resync when state already exists in VPP but in either case we fix what we find and draw out from that a picture of the current state including whether ( in the case of vhostuser interfaces ) the far end of the socket has attached to VPP .
code: def bind_interface_on_host(self, if_type, uuid, mac, physnet,
                                 net_type, seg_id):
          """Configure the interface in VPP per the binding request.
  
          Because we may be restarting the agent on a VPP that is already
          running, do this defensively: interfaces that we do not know
          about may have had some of their binding done.  Acting in this
          way, we can be sure that the interface is now correctly bound
          regardless of what may have transpired previously.
  
          This may be called at any time because of a request from
          the mechanism driver, or it may be called during resync
          when state already exists in VPP but in either case we fix
          what we find and draw out from that a picture of the current
          state, including whether (in the case of vhostuser interfaces)
          the far end of the socket has attached to VPP.
          """
  
          # In order, we create the network bridge, the interface for
          # the far end, and we add it to the bridge.  Any of these
          # may have been done before; the functions we call correct
          # any previous state they find.
  
          net_data = self.net_driver.ensure_network(physnet, net_type, seg_id)
          if net_data is None:
              LOG.error('port bind is not possible as physnet '
                        'could not be configured')
              # Returning None allows us to deal with the uplink
              # side of a failed binding in the caller.
              # For resyncs, the port exists but it's not in a bridge domain
              # and is down, which is the best we can offer.
              return None
          if net_type == TYPE_GPE and self.gpe is None:
              LOG.error('port bind - GPE is not enabled')
              return None
  
          net_br_idx = net_data['bridge_domain_id']
          props = self.ensure_interface_on_host(if_type, uuid, mac)
          iface_idx = props['iface_idx']
          self.ensure_interface_in_vpp_bridge(net_br_idx, iface_idx)
          # Ensure local mac to VNI mapping for GPE
          if net_type == TYPE_GPE and self.gpe is not None:
              LOG.debug('Adding local GPE mapping for seg_id:%s and mac:%s',
                        seg_id, mac)
              self.gpe.add_local_gpe_mapping(seg_id, mac)
  
          props['net_data'] = net_data
          LOG.debug('Bound vpp interface with sw_idx:%s on '
                    'bridge domain:%s',
                    iface_idx, net_br_idx)
          return props
code_tokens: def bind_interface_on_host ( self , if_type , uuid , mac , physnet , net_type , seg_id ) : net_data = self . net_driver . ensure_network ( physnet , net_type , seg_id ) if net_data is None : LOG . error ( 'port bind is not possible as physnet ' 'could not be configured' ) return None if net_type == TYPE_GPE and self . gpe is None : LOG . error ( 'port bind - GPE is not enabled' ) return None net_br_idx = net_data [ 'bridge_domain_id' ] props = self . ensure_interface_on_host ( if_type , uuid , mac ) iface_idx = props [ 'iface_idx' ] self . ensure_interface_in_vpp_bridge ( net_br_idx , iface_idx ) if net_type == TYPE_GPE and self . gpe is not None : LOG . debug ( 'Adding local GPE mapping for seg_id:%s and mac:%s' , seg_id , mac ) self . gpe . add_local_gpe_mapping ( seg_id , mac ) props [ 'net_data' ] = net_data LOG . debug ( 'Bound vpp interface with sw_idx:%s on ' 'bridge domain:%s' , iface_idx , net_br_idx ) return props
short_docstring: Configure the interface in VPP per the binding request.
short_docstring_tokens: Configure the interface in VPP per the binding request .
comment: """Configure the interface in VPP per the binding request.
  
          Because we may be restarting the agent on a VPP that is already
          running, do this defensively: interfaces that we do not know
          about may have had some of their binding done.  Acting in this
          way, we can be sure that the interface is now correctly bound
          regardless of what may have transpired previously.
  
          This may be called at any time because of a request from
          the mechanism driver, or it may be called during resync
          when state already exists in VPP but in either case we fix
          what we find and draw out from that a picture of the current
          state, including whether (in the case of vhostuser interfaces)
          the far end of the socket has attached to VPP.
          """$SEP$# In order, we create the network bridge, the interface for$SEP$# the far end, and we add it to the bridge.  Any of these$SEP$# may have been done before; the functions we call correct$SEP$# any previous state they find.$SEP$# Returning None allows us to deal with the uplink$SEP$# side of a failed binding in the caller.$SEP$# For resyncs, the port exists but it's not in a bridge domain$SEP$# and is down, which is the best we can offer.$SEP$# Ensure local mac to VNI mapping for GPE