def _configure_nve_member(self, vni, device_id, mcast_group, host_id):
        """Add "member vni" configuration to the NVE interface.

        Called during update postcommit port event.
        """
        host_nve_connections = self._get_switch_nve_info(host_id)

        for switch_ip in host_nve_connections:

            # If configured to set global VXLAN values then
            #   If this is the first database entry for this switch_ip
            #   then configure the "interface nve" entry on the switch.
            if cfg.CONF.ml2_cisco.vxlan_global_config:
                nve_bindings = nxos_db.get_nve_switch_bindings(switch_ip)
                if len(nve_bindings) == 1:
                    LOG.debug("Nexus: create NVE interface")
                    loopback = self._nexus_switches.get(
                        (switch_ip, 'nve_src_intf'), '0')
                    self.driver.enable_vxlan_feature(switch_ip,
                                                     const.NVE_INT_NUM,
                                                     loopback)

            # If this is the first database entry for this (VNI, switch_ip)
            # then configure the "member vni #" entry on the switch.
            member_bindings = nxos_db.get_nve_vni_switch_bindings(
                vni, switch_ip)
            if len(member_bindings) == 1:
                LOG.debug("Nexus: add member")
                self.driver.create_nve_member(switch_ip, const.NVE_INT_NUM,
                                              vni, mcast_group)
    def _configure_nve_member(self, vni, device_id, mcast_group, host_id):
        """Add "member vni" configuration to the NVE interface.

        Called during update postcommit port event.
        """
        host_nve_connections = self._get_switch_nve_info(host_id)

        for switch_ip in host_nve_connections:

            # If configured to set global VXLAN values then
            #   If this is the first database entry for this switch_ip
            #   then configure the "interface nve" entry on the switch.
            if cfg.CONF.ml2_cisco.vxlan_global_config:
                nve_bindings = nxos_db.get_nve_switch_bindings(switch_ip)
                if len(nve_bindings) == 1:
                    LOG.debug("Nexus: create NVE interface")
                    loopback = self._nexus_switches.get(
                                        (switch_ip, 'nve_src_intf'), '0')
                    self.driver.enable_vxlan_feature(switch_ip,
                        const.NVE_INT_NUM, loopback)

            # If this is the first database entry for this (VNI, switch_ip)
            # then configure the "member vni #" entry on the switch.
            member_bindings = nxos_db.get_nve_vni_switch_bindings(vni,
                                                                  switch_ip)
            if len(member_bindings) == 1:
                LOG.debug("Nexus: add member")
                self.driver.create_nve_member(switch_ip, const.NVE_INT_NUM,
                                              vni, mcast_group)
    def _delete_nve_member(self, vni, device_id, mcast_group, host_id):
        """Remove "member vni" configuration from the NVE interface.

        Called during delete postcommit port event.
        """
        host_nve_connections = self._get_switch_nve_info(host_id)
        for switch_ip in host_nve_connections:
            if not nxos_db.get_nve_vni_switch_bindings(vni, switch_ip):
                self.driver.delete_nve_member(switch_ip, const.NVE_INT_NUM,
                                              vni)
            if (cfg.CONF.ml2_cisco.vxlan_global_config
                    and not nxos_db.get_nve_switch_bindings(switch_ip)):
                self.driver.disable_vxlan_feature(switch_ip)
    def _delete_nve_member(self, vni, device_id, mcast_group, host_id):
        """Remove "member vni" configuration from the NVE interface.

        Called during delete postcommit port event.
        """
        host_nve_connections = self._get_switch_nve_info(host_id)
        for switch_ip in host_nve_connections:
            if not nxos_db.get_nve_vni_switch_bindings(vni, switch_ip):
                self.driver.delete_nve_member(switch_ip,
                    const.NVE_INT_NUM, vni)
            if (cfg.CONF.ml2_cisco.vxlan_global_config and
                not nxos_db.get_nve_switch_bindings(switch_ip)):
                self.driver.disable_vxlan_feature(switch_ip)
Пример #5
0
    def _configure_nve_member(self, vni, device_id, mcast_group, host_id):
        """Add "member vni" configuration to the NVE interface.

        Called during update postcommit port event.
        """
        host_nve_connections = self._get_switch_nve_info(host_id)

        for switch_ip in host_nve_connections:
            if self.is_switch_configurable(switch_ip) is False:
                self.reset_switch_retry_count(switch_ip)
                continue
            # If configured to set global VXLAN values then
            #   If this is the first database entry for this switch_ip
            #   then configure the "interface nve" entry on the switch.
            if cfg.CONF.ml2_cisco.vxlan_global_config:
                nve_bindings = nxos_db.get_nve_switch_bindings(switch_ip)
                if len(nve_bindings) == 1:
                    LOG.debug("Nexus: create NVE interface")
                    loopback = self._nexus_switches.get(
                                        (switch_ip, 'nve_src_intf'), '0')
                    try:
                        self.driver.enable_vxlan_feature(switch_ip,
                            const.NVE_INT_NUM, loopback)
                    except Exception:
                        with excutils.save_and_reraise_exception() as ctxt:
                            ctxt.reraise = (
                                self.choose_to_reraise_driver_exception(
                                    switch_ip, 'enable_vxlan_feature'))
                        continue

            # If this is the first database entry for this (VNI, switch_ip)
            # then configure the "member vni #" entry on the switch.
            member_bindings = nxos_db.get_nve_vni_switch_bindings(vni,
                                                                  switch_ip)
            if len(member_bindings) == 1:
                LOG.debug("Nexus: add member")
                try:
                    self.driver.create_nve_member(switch_ip, const.NVE_INT_NUM,
                                                  vni, mcast_group)
                except Exception:
                    with excutils.save_and_reraise_exception() as ctxt:
                        ctxt.reraise = (
                            self.choose_to_reraise_driver_exception(switch_ip,
                                'create_nve_member'))
    def _configure_nve_member(self, vni, device_id, mcast_group, host_id):
        """Add "member vni" configuration to the NVE interface.

        Called during update postcommit port event.
        """
        host_nve_connections = self._get_switch_nve_info(host_id)

        for switch_ip in host_nve_connections:
            if self.is_switch_configurable(switch_ip) is False:
                self.reset_switch_retry_count(switch_ip)
                continue
            # If configured to set global VXLAN values then
            #   If this is the first database entry for this switch_ip
            #   then configure the "interface nve" entry on the switch.
            if cfg.CONF.ml2_cisco.vxlan_global_config:
                nve_bindings = nxos_db.get_nve_switch_bindings(switch_ip)
                if len(nve_bindings) == 1:
                    LOG.debug("Nexus: create NVE interface")
                    loopback = self._nexus_switches.get(
                        (switch_ip, 'nve_src_intf'), '0')
                    try:
                        self.driver.enable_vxlan_feature(
                            switch_ip, const.NVE_INT_NUM, loopback)
                    except Exception:
                        with excutils.save_and_reraise_exception() as ctxt:
                            ctxt.reraise = (
                                self.choose_to_reraise_driver_exception(
                                    switch_ip, 'enable_vxlan_feature'))
                        continue

            # If this is the first database entry for this (VNI, switch_ip)
            # then configure the "member vni #" entry on the switch.
            member_bindings = nxos_db.get_nve_vni_switch_bindings(
                vni, switch_ip)
            if len(member_bindings) == 1:
                LOG.debug("Nexus: add member")
                try:
                    self.driver.create_nve_member(switch_ip, const.NVE_INT_NUM,
                                                  vni, mcast_group)
                except Exception:
                    with excutils.save_and_reraise_exception() as ctxt:
                        ctxt.reraise = (
                            self.choose_to_reraise_driver_exception(
                                switch_ip, 'create_nve_member'))
Пример #7
0
    def _delete_nve_member(self, vni, device_id, mcast_group, host_id):
        """Remove "member vni" configuration from the NVE interface.

        Called during delete postcommit port event.
        """
        host_nve_connections = self._get_switch_nve_info(host_id)
        for switch_ip in host_nve_connections:
            if self.is_switch_configurable(switch_ip) is False:
                continue
            try:
                if not nxos_db.get_nve_vni_switch_bindings(vni, switch_ip):
                    self.driver.delete_nve_member(switch_ip,
                        const.NVE_INT_NUM, vni)
                if (cfg.CONF.ml2_cisco.vxlan_global_config and
                    not nxos_db.get_nve_switch_bindings(switch_ip)):
                    self.driver.disable_vxlan_feature(switch_ip)
            except Exception:
                with excutils.save_and_reraise_exception() as ctxt:
                    ctxt.reraise = (
                        self.choose_to_reraise_driver_exception(switch_ip,
                            '(delete_nve_member||disable_vxlan_feature)'))