Search in sources :

Example 41 with AppServer

use of org.mobicents.tools.sip.balancer.AppServer in project load-balancer by RestComm.

the class MediaFailureTest method setUp.

public void setUp() throws Exception {
    shootist = new Shootist(ListeningPoint.TCP, 5060);
    balancer = new BalancerRunner();
    LoadBalancerConfiguration lbConfig = new LoadBalancerConfiguration();
    lbConfig.getSipStackConfiguration().getSipStackProperies().setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT", "off");
    lbConfig.getSipStackConfiguration().getSipStackProperies().setProperty("gov.nist.javax.sip.TRACE_LEVEL", "32");
    lbConfig.getSipStackConfiguration().getSipStackProperies().setProperty("gov.nist.javax.sip.DEBUG_LOG", "logs/sipbalancerforwarderdebug.txt");
    lbConfig.getSipStackConfiguration().getSipStackProperies().setProperty("gov.nist.javax.sip.SERVER_LOG", "logs/sipbalancerforwarder.xml");
    lbConfig.getSipStackConfiguration().getSipStackProperies().setProperty("gov.nist.javax.sip.THREAD_POOL_SIZE", "2");
    lbConfig.getSipStackConfiguration().getSipStackProperies().setProperty("gov.nist.javax.sip.REENTRANT_LISTENER", "true");
    lbConfig.getSipStackConfiguration().getSipStackProperies().setProperty("gov.nist.javax.sip.CANCEL_CLIENT_TRANSACTION_CHECKED", "false");
    lbConfig.getSipConfiguration().getExternalLegConfiguration().setTcpPort(5060);
    lbConfig.getSipConfiguration().getInternalLegConfiguration().setTcpPort(5065);
    ArrayList<Integer> statusRemoval = new ArrayList<Integer>();
    statusRemoval.add(503);
    lbConfig.getSipConfiguration().setResponseStatusCodeNodeRemoval(statusRemoval);
    lbConfig.getSipConfiguration().setMaxNumberResponsesWithError(2);
    lbConfig.getSipConfiguration().setMaxErrorTime(3000000l);
    balancer.start(lbConfig);
    goodServer = new AppServer("node0", 4060, "127.0.0.1", 2000, 5060, 5065, "0", ListeningPoint.TCP, 2223);
    badServer = new AppServer("node1", 4061, "127.0.0.1", 2000, 5060, 5065, "0", ListeningPoint.TCP, false, true);
    goodServer.start();
    Thread.sleep(5000);
    badServer.start();
    Thread.sleep(5000);
}
Also used : AppServer(org.mobicents.tools.sip.balancer.AppServer) BalancerRunner(org.mobicents.tools.sip.balancer.BalancerRunner) LoadBalancerConfiguration(org.mobicents.tools.configuration.LoadBalancerConfiguration) ArrayList(java.util.ArrayList) Shootist(org.mobicents.tools.sip.balancer.operation.Shootist)

Example 42 with AppServer

use of org.mobicents.tools.sip.balancer.AppServer in project load-balancer by RestComm.

the class NoInternalAddressTest method setUp.

@Before
public void setUp() throws Exception {
    shootist = new Shootist();
    balancer = new BalancerRunner();
    LoadBalancerConfiguration lbConfig = new LoadBalancerConfiguration();
    lbConfig.getCommonConfiguration().setHost(null);
    lbConfig.getSipConfiguration().getExternalLegConfiguration().setHost("127.0.0.1");
    lbConfig.getSipConfiguration().getInternalLegConfiguration().setUdpPort(5065);
    balancer.start(lbConfig);
    for (int q = 0; q < servers.length; q++) {
        servers[q] = new AppServer("node" + q, 4060 + q, "127.0.0.1", 2000, 5060, 5065, "0", ListeningPoint.UDP, 2222 + q);
        servers[q].start();
    }
    Thread.sleep(5000);
}
Also used : AppServer(org.mobicents.tools.sip.balancer.AppServer) BalancerRunner(org.mobicents.tools.sip.balancer.BalancerRunner) LoadBalancerConfiguration(org.mobicents.tools.configuration.LoadBalancerConfiguration) ListeningPoint(javax.sip.ListeningPoint) Before(org.junit.Before)

Example 43 with AppServer

use of org.mobicents.tools.sip.balancer.AppServer in project load-balancer by RestComm.

the class RegexTest method setUp.

public void setUp() throws Exception {
    shootist = new Shootist(ListeningPoint.TCP, 5060);
    balancer = new BalancerRunner();
    LoadBalancerConfiguration lbConfig = new LoadBalancerConfiguration();
    lbConfig.getSipConfiguration().getExternalLegConfiguration().setUdpPort(5060);
    lbConfig.getSipConfiguration().getInternalLegConfiguration().setTcpPort(5065);
    lbConfig.getSipConfiguration().getAlgorithmConfiguration().setAlgorithmClass(UserBasedAlgorithm.class.getCanonicalName());
    lbConfig.getSipConfiguration().getAlgorithmConfiguration().setSipHeaderAffinityKey("From");
    balancer.start(lbConfig);
    node0 = new AppServer("node0", 4060, "127.0.0.1", 2000, 5060, 5065, "0", ListeningPoint.TCP, 2222);
    node1 = new AppServer("node1", 4061, "127.0.0.1", 2000, 5060, 5065, "0", ListeningPoint.TCP, 2223);
    node0.start();
    Thread.sleep(1000);
    node1.start();
    Thread.sleep(1000);
}
Also used : AppServer(org.mobicents.tools.sip.balancer.AppServer) BalancerRunner(org.mobicents.tools.sip.balancer.BalancerRunner) LoadBalancerConfiguration(org.mobicents.tools.configuration.LoadBalancerConfiguration) UserBasedAlgorithm(org.mobicents.tools.sip.balancer.UserBasedAlgorithm) Shootist(org.mobicents.tools.sip.balancer.operation.Shootist)

Example 44 with AppServer

use of org.mobicents.tools.sip.balancer.AppServer in project load-balancer by RestComm.

the class RegisterWithNexmoPropertyTest method testRegisterWithNexmoProperty.

@Test
public void testRegisterWithNexmoProperty() throws Exception {
    EventListener failureEventListener = new EventListener() {

        @Override
        public void uasAfterResponse(int statusCode, AppServer source) {
        }

        @Override
        public void uasAfterRequestReceived(String method, AppServer source) {
            if (method.equals(SIPRequest.REGISTER))
                register = source;
        }

        @Override
        public void uacAfterRequestSent(String method, AppServer source) {
        }

        @Override
        public void uacAfterResponse(int statusCode, AppServer source) {
        }
    };
    for (AppServer as : servers) as.setEventListener(failureEventListener);
    shootist.sendInitial("KostyaNosach", "here.com", SIPRequest.REGISTER, null, null, null);
    Thread.sleep(3000);
    assertNotNull(register);
    assertEquals(200, shootist.responses.get(0).getStatusCode());
}
Also used : AppServer(org.mobicents.tools.sip.balancer.AppServer) EventListener(org.mobicents.tools.sip.balancer.EventListener) Test(org.junit.Test)

Example 45 with AppServer

use of org.mobicents.tools.sip.balancer.AppServer in project load-balancer by RestComm.

the class RollingUpgradeTest method setUp.

@Before
public void setUp() {
    shootist = new Shootist();
    String externalIpLBString = "";
    String internalIpLBString = "";
    for (int q = 0; q < numBalancers; q++) {
        balancers[q] = prepBalancer(q);
        externalIpLBString += "127.0.0.1:" + 5 + q + "60,";
        internalIpLBString += "127.0.0.1:" + 5 + q + "65,";
    }
    for (int q = 0; q < servers.length; q++) {
        servers[q] = new AppServer("node" + q, 4060 + q, "127.0.0.1", 2000, 5060, 5065, "0", ListeningPoint.UDP, 2222 + q);
        servers[q].setBalancers(loadbalancers);
        servers[q].start();
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    externalIpLoadBalancer = new UDPPacketForwarder(9988, externalIpLBString, "127.0.0.1");
    externalIpLoadBalancer.start();
    internalIpLoadBalancer = new UDPPacketForwarder(9922, internalIpLBString, "127.0.0.1");
    internalIpLoadBalancer.start();
    Helper.sleep(5000);
}
Also used : AppServer(org.mobicents.tools.sip.balancer.AppServer) UDPPacketForwarder(org.mobicents.tools.sip.balancer.UDPPacketForwarder) Shootist(org.mobicents.tools.sip.balancer.operation.Shootist) ListeningPoint(javax.sip.ListeningPoint) Before(org.junit.Before)

Aggregations

AppServer (org.mobicents.tools.sip.balancer.AppServer)72 Test (org.junit.Test)41 EventListener (org.mobicents.tools.sip.balancer.EventListener)37 ListeningPoint (javax.sip.ListeningPoint)27 Before (org.junit.Before)26 BalancerRunner (org.mobicents.tools.sip.balancer.BalancerRunner)26 Shootist (org.mobicents.tools.sip.balancer.operation.Shootist)26 LoadBalancerConfiguration (org.mobicents.tools.configuration.LoadBalancerConfiguration)24 SipURI (javax.sip.address.SipURI)16 SinglePointTest (org.mobicents.tools.sip.balancer.SinglePointTest)11 WorstCaseUdpTestAffinityAlgorithm (org.mobicents.tools.sip.balancer.WorstCaseUdpTestAffinityAlgorithm)7 UDPPacketForwarder (org.mobicents.tools.sip.balancer.UDPPacketForwarder)5 UserBasedAlgorithm (org.mobicents.tools.sip.balancer.UserBasedAlgorithm)5 ArrayList (java.util.ArrayList)2 SipException (javax.sip.SipException)2 Response (javax.sip.message.Response)2 CongestionControlMessageValve (org.mobicents.ext.javax.sip.congestion.CongestionControlMessageValve)1 Node (org.mobicents.tools.heartbeat.api.Node)1 ActiveStandbyAlgorithm (org.mobicents.tools.sip.balancer.ActiveStandbyAlgorithm)1 HeaderConsistentHashBalancerAlgorithm (org.mobicents.tools.sip.balancer.HeaderConsistentHashBalancerAlgorithm)1