def _port_bound(self, port_id, network_id, network_type, physical_network,
                    segmentation_id, port_security_enabled, set_port_sriov):
        """Bind the port to the recived network."""
        super(HyperVNeutronAgent, self)._port_bound(
            port_id, network_id, network_type, physical_network,
            segmentation_id, port_security_enabled, set_port_sriov
        )
        vswitch_map = self._network_vswitch_map[network_id]

        if network_type == h_constant.TYPE_VLAN:
            self._vlan_driver.bind_vlan_port(port_id, segmentation_id)
        elif network_type == h_constant.TYPE_NVGRE and self._nvgre_enabled:
            self._nvgre_ops.bind_nvgre_port(
                segmentation_id, vswitch_map['vswitch_name'], port_id)
        elif network_type == h_constant.TYPE_FLAT:
            pass    # Nothing to do
        elif network_type == h_constant.TYPE_LOCAL:
            pass    # Nothing to do
        else:
            LOG.error('Unsupported network type %s', network_type)

        if self._enable_metrics_collection:
            self._utils.add_metrics_collection_acls(port_id)
            self._port_metric_retries[port_id] = self._metrics_max_retries

        # check if security groups is enabled.
        # if not, teardown the security group rules
        if self._enable_security_groups:
            self._sec_groups_agent.refresh_firewall([port_id])
        else:
            self._utils.remove_all_security_rules(port_id)

        self._utils.set_vswitch_port_mac_spoofing(port_id,
                                                  port_security_enabled)
def _port_bound ( self , port_id , network_id , network_type , physical_network , segmentation_id , port_security_enabled , set_port_sriov ) : super ( HyperVNeutronAgent , self ) . _port_bound ( port_id , network_id , network_type , physical_network , segmentation_id , port_security_enabled , set_port_sriov ) vswitch_map = self . _network_vswitch_map [ network_id ] if network_type == h_constant . TYPE_VLAN : self . _vlan_driver . bind_vlan_port ( port_id , segmentation_id ) elif network_type == h_constant . TYPE_NVGRE and self . _nvgre_enabled : self . _nvgre_ops . bind_nvgre_port ( segmentation_id , vswitch_map [ 'vswitch_name' ] , port_id ) elif network_type == h_constant . TYPE_FLAT : pass elif network_type == h_constant . TYPE_LOCAL : pass else : LOG . error ( 'Unsupported network type %s' , network_type ) if self . _enable_metrics_collection : self . _utils . add_metrics_collection_acls ( port_id ) self . _port_metric_retries [ port_id ] = self . _metrics_max_retries if self . _enable_security_groups : self . _sec_groups_agent . refresh_firewall ( [ port_id ] ) else : self . _utils . remove_all_security_rules ( port_id ) self . _utils . set_vswitch_port_mac_spoofing ( port_id , port_security_enabled )
Bind the port to the recived network.