Example #1
0
        public void Run()
        {
            var env = new SimRuntime(this)
            {
                MaxSteps = MaxSteps,
                MaxTime  = MaxTime
            };

            if (MaxInactive.HasValue)
            {
                env.MaxInactive = MaxInactive.Value;
            }

            env.Run(Plan);
        }
Example #2
0
        public void Run(Func <SimControl, Task> plan = null)
        {
            var env = new SimRuntime(this)
            {
                MaxSteps = MaxSteps,
                MaxTime  = MaxTime
            };

            if (MaxInactive.HasValue)
            {
                env.MaxInactive = MaxInactive.Value;
            }

            env.Run(plan ?? Plan);
        }
Example #3
0
        public SimCluster(ClusterDef cluster, SimRuntime runtime)
        {
            Runtime = runtime;
            Rand    = Runtime.Rand;

            // we register each link as a network service
            foreach (var(id, def) in cluster.Routes)
            {
                var service   = new ServiceId($"network:{id.Source}->{id.Destinaton}");
                var scheduler = new SimScheduler(Runtime, service);
                Routes.Add(id, new SimRoute(scheduler, this, id, def));
            }

            foreach (var machine in cluster.Services.GroupBy(i => i.Key.Machine))
            {
                var m = new SimMachine(machine.Key, runtime, this);

                foreach (var pair in machine)
                {
                    m.Install(pair.Key, pair.Value);
                }
                Machines.Add(machine.Key, m);
            }
        }
 public SimScheduler(SimRuntime runtime, ServiceId name)
 {
     _runtime = runtime;
     _name    = name;
 }
Example #5
0
 public SimMachine(string name, SimRuntime runtime, SimCluster cluster)
 {
     Name    = name;
     Runtime = runtime;
     Cluster = cluster;
 }
Example #6
0
 public SimControl(SimCluster cluster, SimRuntime runtime)
 {
     Cluster  = cluster;
     _runtime = runtime;
 }