Beispiel #1
0
        public PhysicalNode GetMaxRCNode()
        {
            double       max_rc = 0.0;
            PhysicalNode pn     = null;

            foreach (var item in PhysicalNodeDict)
            {
                if (item.Value.RC > max_rc)
                {
                    max_rc = item.Value.RC;
                    pn     = item.Value;
                }
            }
            return(pn);
        }
Beispiel #2
0
        public string ServicePlacement(string virtual_json_str, string physical_json_str)
        {
            ParseInput(virtual_json_str, JsonStringType.Virtual);
            ParseInput(physical_json_str, JsonStringType.Physical);

            VNG.CalculateAllRC();
            VNG.CalculateAllSAR();
            VNG.SortNodeBySAR();

            OutputMessage output = new OutputMessage();

            while (VNG.SortedVirtualNodeDict.Any())
            {
                PNG.CalculateAllRC();

                VirtualNode  vn = VNG.SortedVirtualNodeDict.Values.First();
                PhysicalNode pn = PNG.GetMaxRCNode();

                if (vn.RC <= pn.RC)
                {
                    DeployVirtualNode(vn, pn);
                    output.NodeMap.Add(vn, pn);
                    VNG.SortedVirtualNodeDict.Remove(vn.ID);
                }
                else
                {
                    output.State   = "failed";
                    output.NodeMap = null;
                    break;
                }
            }
            if (output.State != "failed")
            {
                output.State = "successful";
            }
            return(EncapsulateOutput(output));
        }
Beispiel #3
0
 public void DeployVirtualNode(VirtualNode vn, PhysicalNode pn)
 {
 }