def update_network(self, context, id, network):
        self._check_provider_update(context, network["network"])
        segmentation_id = network["network"]["segmentation_id"]
        LOG.debug("update_network: segmentation id = %s", segmentation_id)
        session = context.session
        with session.begin(subtransactions=True):
            binding = rgos_vlanmgr.get_network_binding(session, id)
            if binding.network_type == constants.TYPE_VLAN:
                rgos_vlanmgr.release_vlan(
                    session, binding.physical_network, binding.segmentation_id, self.network_vlan_ranges
                )
                rgos_vlanmgr.reserve_specific_vlan(session, binding.physical_network, segmentation_id)
                session.delete(binding)
                session.flush()
                rgos_vlanmgr.add_network_binding(
                    session, id, binding.network_type, binding.physical_network, segmentation_id
                )

        session = context.session
        with session.begin(subtransactions=True):
            net = super(RgosQuantumPlugin, self).update_network(context, id, network)
            self._process_l3_update(context, network["network"], id)
            self._extend_network_dict_provider(context, net)
            self._extend_network_dict_l3(context, net)
        return net
 def delete_network(self, context, id):
     session = context.session
     with session.begin(subtransactions=True):
         binding = rgos_vlanmgr.get_network_binding(session, id)
         super(RgosQuantumPlugin, self).delete_network(context, id)
         if binding.network_type == constants.TYPE_VLAN:
             rgos_vlanmgr.release_vlan(
                 session, binding.physical_network, binding.segmentation_id, self.network_vlan_ranges
             )
         # the network_binding record is deleted via cascade from
         # the network record, so explicit removal is not necessary
     if self.agent_rpc:
         self.notifier.network_delete(self.rpc_context, id)