Network modify algorithm


     <update network>
          update comment
          update dhcp_service

          <update dhcp options>
               for each old.dhcp.option
                    delete dhcp.option
               done

               for each new.dhcp.option
                    insert dhcp.option
               done

          <update groups>
               for each group.to.delete
                    delete group
               end
               for each group.to.insert
                    insert group
               end

          <update addr. spaces>
               for each addr.space.to.delete
                    delete addr.space0
                    remove addr.space.dhcp.addresses from oldNet1
               end

               for each addr.space.to.insert
                    <insert addr.space2>
                         insert low_res, high_res and comment

                         for each group
                              insert group
                         end

                         for each dhcp.options
                              insert dhcp.option
                         end

                         calculate blocks of dhcp.ips

                         for each dhcp.ip.block
                              reserve dhcp.ip.block
                         end

                         for each dhcp.ip
                              accept dhcp.ip4
                         end
               end

               for each addr.space.to.update
                    <udpate addr.space>
                         update low_res, high_res and comment

                         for each group.to.delete
                              delete group
                         end
                         for each group.to.insert
                              insert group
                         end

                         for each old.dhcp.options
                              delete dhcp.option
                         end
                         for each new.dhcp.options
                              insert dhcp.option
                         end

                         for each dhcp.ip.to.delete
                              delete dhcp.ip3
                         end
                         for each dhcp.ip.to.insert
                              reserve dhcp.ip
                              accept dhcp.ip4
                         end
                         for each dhcp.ip.to.update
                              update dhcp.ip.status5
                         end
               end

          <update names>
               for each name.to.delete6
                    delete name
               end

               for each name.to.insert7
                    reserve name.to.insert
                    accept name.to.insert
               end

     --------------------------------------------------------------------------------
     0. Deleting addr. space will delete all associated ip addresses and their names
     1. Removing dhcp ip will remove associated names as well. Removing dhcp ip is
        nessesary in order to properly calculate dhcp.ips.to.delete, dhcp.ips.to.insert
        and dhcp.ips.to.update and also names.to.delete, names.to.insert and
        names.to.update
     2. It won't insert names.
     3. Removing dhcp ip will remove associated names as well.
     4. It won't insert names.
     5. It won't affect names, only status.
     6. It will remove corresponding MXs and aliases as well.
     7. It is assumed that names used in network does not have aliases and/or mxs.