예제 #1
0
        public static bool AllowNonWindowsFabricPortsTraffic(NonWindowsFabricEndpointSet nonWindowsFabricEndpointSet)
        {
            foreach (KeyValuePair <string, InputEndpointType> nonWindowsFabricPort in nonWindowsFabricEndpointSet.NonWindowsFabricPorts)
            {
                int port = int.Parse(nonWindowsFabricPort.Value.Port, CultureInfo.InvariantCulture);
                if (!AllowNonWindowsFabricPortsTraffic(nonWindowsFabricPort.Key, port))
                {
                    TextLogger.LogError("Failed to allow traffic to non Windows Fabric port. Endpoint name : {0}. Port : {1}.", nonWindowsFabricPort.Key, port);

                    return(false);
                }
            }

            foreach (KeyValuePair <string, FabricEndpointsTypeApplicationEndpoints> nonWindowsFabricPortRange in nonWindowsFabricEndpointSet.NonWindowsFabricPortRanges)
            {
                if (!AllowNonWindowsFabricPortsTraffic(nonWindowsFabricPortRange.Key, nonWindowsFabricPortRange.Value.StartPort, nonWindowsFabricPortRange.Value.EndPort))
                {
                    TextLogger.LogError(
                        "Failed to allow traffic to non Windows Fabric port range. Endpoint name : {0}. Start Port : {1}. End Port : {2}.",
                        nonWindowsFabricPortRange.Key,
                        nonWindowsFabricPortRange.Value.StartPort,
                        nonWindowsFabricPortRange.Value.EndPort);

                    return(false);
                }
            }

            return(true);
        }
예제 #2
0
        internal bool IsNonWindowsFabricEndpointSetChanged(NonWindowsFabricEndpointSet nonWindowsFabricEndpointSet)
        {
            if (nonWindowsFabricEndpointSet == null ||
                nonWindowsFabricEndpointSet.NonWindowsFabricPorts.Count != this.NonWindowsFabricPorts.Count ||
                nonWindowsFabricEndpointSet.NonWindowsFabricPortRanges.Count != this.NonWindowsFabricPortRanges.Count)
            {
                return(true);
            }

            // Note that the name of endpoints are unique
            foreach (KeyValuePair <string, InputEndpointType> nonWindowsFabricPort in nonWindowsFabricEndpointSet.NonWindowsFabricPorts)
            {
                if (!this.NonWindowsFabricPorts.ContainsKey(nonWindowsFabricPort.Key) ||
                    string.Compare(nonWindowsFabricPort.Value.Port, this.NonWindowsFabricPorts[nonWindowsFabricPort.Key].Port, StringComparison.OrdinalIgnoreCase) != 0 ||
                    nonWindowsFabricPort.Value.Protocol != this.NonWindowsFabricPorts[nonWindowsFabricPort.Key].Protocol)
                {
                    return(true);
                }
            }

            foreach (KeyValuePair <string, FabricEndpointsTypeApplicationEndpoints> nonWindowsFabricPortRange in nonWindowsFabricEndpointSet.NonWindowsFabricPortRanges)
            {
                if (!this.NonWindowsFabricPortRanges.ContainsKey(nonWindowsFabricPortRange.Key) ||
                    nonWindowsFabricPortRange.Value.StartPort != this.NonWindowsFabricPortRanges[nonWindowsFabricPortRange.Key].StartPort ||
                    nonWindowsFabricPortRange.Value.EndPort != this.NonWindowsFabricPortRanges[nonWindowsFabricPortRange.Key].EndPort)
                {
                    return(true);
                }
            }

            return(false);
        }
 private static NonWindowsFabricEndpointSet GetNonWindowsFabricEndpointSet()
 {
     return(NonWindowsFabricEndpointSet.GetNonWindowsFabricEndpointSet(RoleEnvironment.CurrentRoleInstance.InstanceEndpoints));
 }