Пример #1
0
        public override string SaveChanges(Session session, string opaqueRef, Network server)
        {
            if (opaqueRef == null)
            {
                Proxy_Network p = this.ToProxy();
                return(session.proxy.network_create(session.uuid, p).parse());
            }
            else
            {
                if (!Helper.AreEqual2(_name_label, server._name_label))
                {
                    Network.set_name_label(session, opaqueRef, _name_label);
                }
                if (!Helper.AreEqual2(_name_description, server._name_description))
                {
                    Network.set_name_description(session, opaqueRef, _name_description);
                }
                if (!Helper.AreEqual2(_MTU, server._MTU))
                {
                    Network.set_MTU(session, opaqueRef, _MTU);
                }
                if (!Helper.AreEqual2(_other_config, server._other_config))
                {
                    Network.set_other_config(session, opaqueRef, _other_config);
                }
                if (!Helper.AreEqual2(_tags, server._tags))
                {
                    Network.set_tags(session, opaqueRef, _tags);
                }

                return(null);
            }
        }
Пример #2
0
        internal void UpdateFromProxy(Proxy_Network proxy)
        {
            uuid               = proxy.uuid == null ? null : (string)proxy.uuid;
            name_label         = proxy.name_label == null ? null : (string)proxy.name_label;
            name_description   = proxy.name_description == null ? null : (string)proxy.name_description;
            allowed_operations = proxy.allowed_operations == null ? null : Helper.StringArrayToEnumList <network_operations>(proxy.allowed_operations);
            current_operations = proxy.current_operations == null ? null : Maps.convert_from_proxy_string_network_operations(proxy.current_operations);
            VIFs               = proxy.VIFs == null ? null : XenRef <VIF> .Create(proxy.VIFs);

            PIFs = proxy.PIFs == null ? null : XenRef <PIF> .Create(proxy.PIFs);

            MTU                  = proxy.MTU == null ? 0 : long.Parse((string)proxy.MTU);
            other_config         = proxy.other_config == null ? null : Maps.convert_from_proxy_string_string(proxy.other_config);
            bridge               = proxy.bridge == null ? null : (string)proxy.bridge;
            blobs                = proxy.blobs == null ? null : Maps.convert_from_proxy_string_XenRefBlob(proxy.blobs);
            tags                 = proxy.tags == null ? new string[] {} : (string [])proxy.tags;
            default_locking_mode = proxy.default_locking_mode == null ? (network_default_locking_mode)0 : (network_default_locking_mode)Helper.EnumParseDefault(typeof(network_default_locking_mode), (string)proxy.default_locking_mode);
        }
Пример #3
0
        public Proxy_Network ToProxy()
        {
            Proxy_Network result_ = new Proxy_Network();

            result_.uuid               = (uuid != null) ? uuid : "";
            result_.name_label         = (name_label != null) ? name_label : "";
            result_.name_description   = (name_description != null) ? name_description : "";
            result_.allowed_operations = (allowed_operations != null) ? Helper.ObjectListToStringArray(allowed_operations) : new string[] {};
            result_.current_operations = Maps.convert_to_proxy_string_network_operations(current_operations);
            result_.VIFs               = (VIFs != null) ? Helper.RefListToStringArray(VIFs) : new string[] {};
            result_.PIFs               = (PIFs != null) ? Helper.RefListToStringArray(PIFs) : new string[] {};
            result_.MTU                  = MTU.ToString();
            result_.other_config         = Maps.convert_to_proxy_string_string(other_config);
            result_.bridge               = (bridge != null) ? bridge : "";
            result_.blobs                = Maps.convert_to_proxy_string_XenRefBlob(blobs);
            result_.tags                 = tags;
            result_.default_locking_mode = network_default_locking_mode_helper.ToString(default_locking_mode);
            return(result_);
        }
Пример #4
0
        public Proxy_Network ToProxy()
        {
            Proxy_Network result_ = new Proxy_Network();

            result_.uuid               = uuid ?? "";
            result_.name_label         = name_label ?? "";
            result_.name_description   = name_description ?? "";
            result_.allowed_operations = (allowed_operations != null) ? Helper.ObjectListToStringArray(allowed_operations) : new string[] {};
            result_.current_operations = Maps.convert_to_proxy_string_network_operations(current_operations);
            result_.VIFs               = (VIFs != null) ? Helper.RefListToStringArray(VIFs) : new string[] {};
            result_.PIFs               = (PIFs != null) ? Helper.RefListToStringArray(PIFs) : new string[] {};
            result_.MTU                  = MTU.ToString();
            result_.other_config         = Maps.convert_to_proxy_string_string(other_config);
            result_.bridge               = bridge ?? "";
            result_.managed              = managed;
            result_.blobs                = Maps.convert_to_proxy_string_XenRefBlob(blobs);
            result_.tags                 = tags;
            result_.default_locking_mode = network_default_locking_mode_helper.ToString(default_locking_mode);
            result_.assigned_ips         = Maps.convert_to_proxy_XenRefVIF_string(assigned_ips);
            return(result_);
        }
Пример #5
0
 /// <summary>
 /// Creates a new Network from a Proxy_Network.
 /// </summary>
 /// <param name="proxy"></param>
 public Network(Proxy_Network proxy)
 {
     this.UpdateFromProxy(proxy);
 }