コード例 #1
0
 public void Connect(string receiverId, int demandedCapacity)
 {
     _callingPartyCallController.SendCallRequest(ClientName, receiverId, demandedCapacity);
 }
コード例 #2
0
        public void TestMessageTransfer()
        {
            var directory = new Directory(NameServer.Address);

            _controlPlaneElements.Add(new Row(NameServer.Address, ControlPlaneElementType.Directory), directory);

            var policy = new Policy(NameServer.Address);

            _controlPlaneElements.Add(new Row(NameServer.Address, ControlPlaneElementType.Policy), policy);

            var ncc1Address = new NetworkAddress("1");
            var ncc1        = new NetworkCallController(ncc1Address);

            _controlPlaneElements.Add(new Row(ncc1Address, ControlPlaneElementType.NCC), ncc1);

            var ncc2Address = new NetworkAddress("2");
            var ncc2        = new NetworkCallController(ncc2Address);

            _controlPlaneElements.Add(new Row(ncc2Address, ControlPlaneElementType.NCC), ncc2);

            var cpccAAddress = new NetworkAddress("1.1.1");
            var cpccA        = new CallingPartyCallController(cpccAAddress);

            _controlPlaneElements.Add(new Row(cpccAAddress, ControlPlaneElementType.CPCC), cpccA);
            directory.UpdateDirectory("A", cpccAAddress, new SubnetworkPointPool(cpccAAddress.Append(1)));

            var cpccBAddress = new NetworkAddress("2.1.2");
            var cpccB        = new CallingPartyCallController(cpccBAddress);

            _controlPlaneElements.Add(new Row(cpccBAddress, ControlPlaneElementType.CPCC), cpccB);
            directory.UpdateDirectory("B", cpccBAddress, new SubnetworkPointPool(cpccBAddress.Append(1)));

            var cc1Address = new NetworkAddress("1");
            var cc1        = new ConnectionController(cc1Address);

            _controlPlaneElements.Add(new Row(cc1Address, ControlPlaneElementType.CC), cc1);

            var cc2Address = new NetworkAddress("2");
            var cc2        = new ConnectionController(cc2Address);

            _controlPlaneElements.Add(new Row(cc2Address, ControlPlaneElementType.CC), cc2);

            var rc2Address = new NetworkAddress("2");
            var rc2        = new RoutingController(rc2Address);

            _controlPlaneElements.Add(new Row(rc2Address, ControlPlaneElementType.RC), rc2);

            directory.MessageToSend += PassMessage;
            policy.MessageToSend    += PassMessage;
            ncc1.MessageToSend      += PassMessage;
            ncc2.MessageToSend      += PassMessage;
            cpccA.MessageToSend     += PassMessage;
            cpccB.MessageToSend     += PassMessage;
            cc1.MessageToSend       += PassMessage;
            cc2.MessageToSend       += PassMessage;
            rc2.MessageToSend       += PassMessage;

            directory.UpdateState += UpdateState;
            policy.UpdateState    += UpdateState;
            ncc1.UpdateState      += UpdateState;
            ncc2.UpdateState      += UpdateState;
            cpccA.UpdateState     += UpdateState;
            cpccB.UpdateState     += UpdateState;
            cc1.UpdateState       += UpdateState;
            cc2.UpdateState       += UpdateState;
            rc2.UpdateState       += UpdateState;

            cpccA.SendCallRequest("A", "B", 20);

            Thread.Sleep(10000);
        }