コード例 #1
0
        public Proxy_PIF ToProxy()
        {
            Proxy_PIF result_ = new Proxy_PIF();

            result_.uuid                  = (uuid != null) ? uuid : "";
            result_.device                = (device != null) ? device : "";
            result_.network               = (network != null) ? network : "";
            result_.host                  = (host != null) ? host : "";
            result_.MAC                   = (MAC != null) ? MAC : "";
            result_.MTU                   = MTU.ToString();
            result_.VLAN                  = VLAN.ToString();
            result_.metrics               = (metrics != null) ? metrics : "";
            result_.physical              = physical;
            result_.currently_attached    = currently_attached;
            result_.ip_configuration_mode = ip_configuration_mode_helper.ToString(ip_configuration_mode);
            result_.IP                      = (IP != null) ? IP : "";
            result_.netmask                 = (netmask != null) ? netmask : "";
            result_.gateway                 = (gateway != null) ? gateway : "";
            result_.DNS                     = (DNS != null) ? DNS : "";
            result_.bond_slave_of           = (bond_slave_of != null) ? bond_slave_of : "";
            result_.bond_master_of          = (bond_master_of != null) ? Helper.RefListToStringArray(bond_master_of) : new string[] {};
            result_.VLAN_master_of          = (VLAN_master_of != null) ? VLAN_master_of : "";
            result_.VLAN_slave_of           = (VLAN_slave_of != null) ? Helper.RefListToStringArray(VLAN_slave_of) : new string[] {};
            result_.management              = management;
            result_.other_config            = Maps.convert_to_proxy_string_string(other_config);
            result_.disallow_unplug         = disallow_unplug;
            result_.tunnel_access_PIF_of    = (tunnel_access_PIF_of != null) ? Helper.RefListToStringArray(tunnel_access_PIF_of) : new string[] {};
            result_.tunnel_transport_PIF_of = (tunnel_transport_PIF_of != null) ? Helper.RefListToStringArray(tunnel_transport_PIF_of) : new string[] {};
            result_.ipv6_configuration_mode = ipv6_configuration_mode_helper.ToString(ipv6_configuration_mode);
            result_.IPv6                    = IPv6;
            result_.ipv6_gateway            = (ipv6_gateway != null) ? ipv6_gateway : "";
            result_.primary_address_type    = primary_address_type_helper.ToString(primary_address_type);
            return(result_);
        }
コード例 #2
0
        internal void UpdateFromProxy(Proxy_PIF proxy)
        {
            uuid    = proxy.uuid == null ? null : (string)proxy.uuid;
            device  = proxy.device == null ? null : (string)proxy.device;
            network = proxy.network == null ? null : XenRef <Network> .Create(proxy.network);

            host = proxy.host == null ? null : XenRef <Host> .Create(proxy.host);

            MAC     = proxy.MAC == null ? null : (string)proxy.MAC;
            MTU     = proxy.MTU == null ? 0 : long.Parse((string)proxy.MTU);
            VLAN    = proxy.VLAN == null ? 0 : long.Parse((string)proxy.VLAN);
            metrics = proxy.metrics == null ? null : XenRef <PIF_metrics> .Create(proxy.metrics);

            physical              = (bool)proxy.physical;
            currently_attached    = (bool)proxy.currently_attached;
            ip_configuration_mode = proxy.ip_configuration_mode == null ? (ip_configuration_mode)0 : (ip_configuration_mode)Helper.EnumParseDefault(typeof(ip_configuration_mode), (string)proxy.ip_configuration_mode);
            IP            = proxy.IP == null ? null : (string)proxy.IP;
            netmask       = proxy.netmask == null ? null : (string)proxy.netmask;
            gateway       = proxy.gateway == null ? null : (string)proxy.gateway;
            DNS           = proxy.DNS == null ? null : (string)proxy.DNS;
            bond_slave_of = proxy.bond_slave_of == null ? null : XenRef <Bond> .Create(proxy.bond_slave_of);

            bond_master_of = proxy.bond_master_of == null ? null : XenRef <Bond> .Create(proxy.bond_master_of);

            VLAN_master_of = proxy.VLAN_master_of == null ? null : XenRef <VLAN> .Create(proxy.VLAN_master_of);

            VLAN_slave_of = proxy.VLAN_slave_of == null ? null : XenRef <VLAN> .Create(proxy.VLAN_slave_of);

            management           = (bool)proxy.management;
            other_config         = proxy.other_config == null ? null : Maps.convert_from_proxy_string_string(proxy.other_config);
            disallow_unplug      = (bool)proxy.disallow_unplug;
            tunnel_access_PIF_of = proxy.tunnel_access_PIF_of == null ? null : XenRef <Tunnel> .Create(proxy.tunnel_access_PIF_of);

            tunnel_transport_PIF_of = proxy.tunnel_transport_PIF_of == null ? null : XenRef <Tunnel> .Create(proxy.tunnel_transport_PIF_of);

            ipv6_configuration_mode = proxy.ipv6_configuration_mode == null ? (ipv6_configuration_mode)0 : (ipv6_configuration_mode)Helper.EnumParseDefault(typeof(ipv6_configuration_mode), (string)proxy.ipv6_configuration_mode);
            IPv6                 = proxy.IPv6 == null ? new string[] {} : (string [])proxy.IPv6;
            ipv6_gateway         = proxy.ipv6_gateway == null ? null : (string)proxy.ipv6_gateway;
            primary_address_type = proxy.primary_address_type == null ? (primary_address_type)0 : (primary_address_type)Helper.EnumParseDefault(typeof(primary_address_type), (string)proxy.primary_address_type);
        }
コード例 #3
0
 /// <summary>
 /// Creates a new PIF from a Proxy_PIF.
 /// </summary>
 /// <param name="proxy"></param>
 public PIF(Proxy_PIF proxy)
 {
     this.UpdateFromProxy(proxy);
 }