Ejemplo n.º 1
0
    def delete_network_precommit(self, mech_context):
        """Delete Network from the plugin specific database table."""

        LOG.debug("delete_network_precommit: called")

        network = mech_context.current
        network_id = network['id']
        vlan_id = network['provider:segmentation_id']
        tenant_id = network['tenant_id']

        context = mech_context._plugin_context

        try:
            brocade_db.delete_network(context, network_id)
        except Exception:
            LOG.exception(
                _LE("Brocade Mechanism: failed to delete network in db"))
            raise Exception(
                _("Brocade Mechanism: delete_network_precommit failed"))

        LOG.info(_LI("delete network (precommit): %(network_id)s"
                     " with vlan = %(vlan_id)s"
                     " for tenant %(tenant_id)s"),
                {'network_id': network_id,
                 'vlan_id': vlan_id,
                 'tenant_id': tenant_id})
Ejemplo n.º 2
0
    def delete_network_precommit(self, mech_context):
        """Delete Network from the plugin specific database table."""

        LOG.debug("delete_network_precommit: called")

        network = mech_context.current
        network_id = network['id']
        vlan_id = network['provider:segmentation_id']
        tenant_id = network['tenant_id']

        context = mech_context._plugin_context

        try:
            brocade_db.delete_network(context, network_id)
        except Exception:
            LOG.exception(
                _LE("Brocade Mechanism: failed to delete network in db"))
            raise Exception(
                _("Brocade Mechanism: delete_network_precommit failed"))

        LOG.info(
            _LI("delete network (precommit): %(network_id)s"
                " with vlan = %(vlan_id)s"
                " for tenant %(tenant_id)s"), {
                    'network_id': network_id,
                    'vlan_id': vlan_id,
                    'tenant_id': tenant_id
                })
Ejemplo n.º 3
0
    def create_network_postcommit(self, mech_context):
        """Create Network as a portprofile on the switch."""

        LOG.debug("create_network_postcommit: called")

        network = mech_context.current
        # use network_id to get the network attributes
        # ONLY depend on our db for getting back network attributes
        # this is so we can replay postcommit from db
        context = mech_context._plugin_context

        network_id = network['id']
        network = brocade_db.get_network(context, network_id)
        network_type = network['network_type']
        tenant_id = network['tenant_id']
        vlan_id = network['vlan']

        try:
            self._driver.create_network(self._switch['address'],
                                        self._switch['username'],
                                        self._switch['password'], vlan_id)
        except Exception:
            LOG.exception(_LE("Brocade NOS driver: failed in create network"))
            brocade_db.delete_network(context, network_id)
            raise Exception(
                _("Brocade Mechanism: create_network_postcommmit failed"))

        LOG.info(
            _LI("created network (postcommit): %(network_id)s"
                " of network type = %(network_type)s"
                " with vlan = %(vlan_id)s"
                " for tenant %(tenant_id)s"), {
                    'network_id': network_id,
                    'network_type': network_type,
                    'vlan_id': vlan_id,
                    'tenant_id': tenant_id
                })
Ejemplo n.º 4
0
    def create_network_postcommit(self, mech_context):
        """Create Network as a portprofile on the switch."""

        LOG.debug("create_network_postcommit: called")

        network = mech_context.current
        # use network_id to get the network attributes
        # ONLY depend on our db for getting back network attributes
        # this is so we can replay postcommit from db
        context = mech_context._plugin_context

        network_id = network['id']
        network = brocade_db.get_network(context, network_id)
        network_type = network['network_type']
        tenant_id = network['tenant_id']
        vlan_id = network['vlan']

        try:
            self._driver.create_network(self._switch['address'],
                                        self._switch['username'],
                                        self._switch['password'],
                                        vlan_id)
        except Exception:
            LOG.exception(_LE("Brocade NOS driver: failed in create network"))
            brocade_db.delete_network(context, network_id)
            raise Exception(
                _("Brocade Mechanism: create_network_postcommmit failed"))

        LOG.info(_LI("created network (postcommit): %(network_id)s"
                     " of network type = %(network_type)s"
                     " with vlan = %(vlan_id)s"
                     " for tenant %(tenant_id)s"),
                {'network_id': network_id,
                 'network_type': network_type,
                 'vlan_id': vlan_id,
                 'tenant_id': tenant_id})