protected Collection<InputEndpointContext> GetInputEndpoints()
        {
            var role = VM.GetInstance();

            var networkConfiguration = role.ConfigurationSets
                                           .OfType<NetworkConfigurationSet>()
                                           .SingleOrDefault();

            if (networkConfiguration == null)
            {
                networkConfiguration = new NetworkConfigurationSet();
                role.ConfigurationSets.Add(networkConfiguration);
            }

            if (networkConfiguration.InputEndpoints == null)
            {
                networkConfiguration.InputEndpoints = new Collection<InputEndpoint>();
            }

            var inputEndpoints = networkConfiguration.InputEndpoints;

            Collection<InputEndpointContext> endpoints = new Collection<InputEndpointContext>();
            foreach (InputEndpoint ep in inputEndpoints)
            {
                InputEndpointContext endpointCtx = new InputEndpointContext
                {
                    LBSetName = ep.LoadBalancedEndpointSetName,
                    LocalPort = ep.LocalPort,
                    Name = ep.Name,
                    Port = ep.Port,
                    Protocol = ep.Protocol,
                    Vip = ep.Vip,
                    Acl = ep.EndpointAccessControlList,
                    EnableDirectServerReturn = ep.EnableDirectServerReturn,
                    InternalLoadBalancerName = ep.LoadBalancerName,
                    IdleTimeoutInMinutes = ep.IdleTimeoutInMinutes,
                    LoadBalancerDistribution = ep.LoadBalancerDistribution,
                    VirtualIPName = ep.VirtualIPName
                };

                if (ep.LoadBalancerProbe != null && string.IsNullOrEmpty(endpointCtx.LBSetName) == false)
                {
                    endpointCtx.ProbePath = ep.LoadBalancerProbe.Path;
                    endpointCtx.ProbePort = ep.LoadBalancerProbe.Port;
                    endpointCtx.ProbeProtocol = ep.LoadBalancerProbe.Protocol;
                    endpointCtx.ProbeIntervalInSeconds = ep.LoadBalancerProbe.IntervalInSeconds;
                    endpointCtx.ProbeTimeoutInSeconds = ep.LoadBalancerProbe.TimeoutInSeconds;
                }

                endpoints.Add(endpointCtx);
            }

            return endpoints;
        }
        public bool CheckInputEndpointContext(InputEndpointContext context)
        {
            bool ret = false;

            if (ParamSet == ParameterSet.NoLB)
            {
                ret = (context.Name == this.EndpointName);
            }
            else 
            {
                ret = (context.LBSetName == this.LBSetName);
            }

            ret = ret && context.Protocol == this.EndpointProtocol.ToString()
                && context.LocalPort == this.EndpointLocalPort
                && context.Port == this.EndpointPublicPort             
                && context.EnableDirectServerReturn == this.DirectServerReturn;

            if(context.Acl == null)
            {
                if(this.Acl != null
                    && this.Acl != new NetworkAclObject())
                {
                    ret = false;
                }
            }
            else if (this.Acl != null)
            {
                foreach (var rule in this.Acl)
                {
                    if(!context.Acl.Rules.Contains(rule))
                    {
                        ret = false;
                    }
                }
            }
            else
            {
                ret = false;
            }


            if (ParamSet == ParameterSet.CustomProbe)
            {
                ret = ret && context.LBSetName == this.LBSetName
                    && context.ProbePort == this.ProbePort
                    && context.ProbeProtocol == this.ProbeProtocol.ToString();

                ret = ret && ( this.ProbeInterval.HasValue 
                                ? context.ProbeIntervalInSeconds == this.ProbeInterval 
                                : context.ProbeIntervalInSeconds == 15 );

                ret = ret && ( this.ProbeTimeout.HasValue
                                ? context.ProbeTimeoutInSeconds == this.ProbeTimeout
                                : context.ProbeTimeoutInSeconds == 31 );
            }

            return ret;
        }