use of org.mobicents.tools.configuration.LoadBalancerConfiguration in project load-balancer by RestComm.
the class HttpsBalancerWithHttpsServerTest method initialization.
@BeforeClass
public static void initialization() {
balancerRunner = new BalancerRunner();
LoadBalancerConfiguration lbConfig = new LoadBalancerConfiguration();
lbConfig.getSipConfiguration().getInternalLegConfiguration().setUdpPort(5065);
lbConfig.getHttpConfiguration().setHttpsPort(2081);
lbConfig.getSslConfiguration().setKeyStore(HttpsBalancerWithHttpsServerTest.class.getClassLoader().getResource("keystore").getFile());
lbConfig.getSslConfiguration().setKeyStorePassword("123456");
lbConfig.getSslConfiguration().setTrustStore(HttpsBalancerWithHttpsServerTest.class.getClassLoader().getResource("keystore").getFile());
lbConfig.getSslConfiguration().setTrustStorePassword("123456");
balancerRunner.start(lbConfig);
serverArray = new HttpServer[numberNodes];
for (int i = 0; i < serverArray.length; i++) {
serverArray[i] = new HttpServer(7080 + i, 4444 + i, 2222 + i);
serverArray[i].start();
Helper.sleep(1000);
}
Helper.sleep(5000);
}
use of org.mobicents.tools.configuration.LoadBalancerConfiguration in project load-balancer by RestComm.
the class InstanceIdAlgorithmTest method initialization.
@BeforeClass
public static void initialization() {
balancerRunner = new BalancerRunner();
LoadBalancerConfiguration lbConfig = new LoadBalancerConfiguration();
lbConfig.getSipConfiguration().getInternalLegConfiguration().setUdpPort(5065);
balancerRunner.start(lbConfig);
serverArray = new HttpServer[numberNodes];
for (int i = 0; i < numberNodes; i++) {
String id = null;
if (i == 1)
id = "ID1f2a2222772f4195948d040a2ccc648c";
else
id = "ID1f2a2222772f4195948d040a2ccc648" + i;
serverArray[i] = new HttpServer(7080 + i, 4444 + i, id, 2222 + i);
serverArray[i].start();
Helper.sleep(1000);
}
Helper.sleep(5000);
}
use of org.mobicents.tools.configuration.LoadBalancerConfiguration in project load-balancer by RestComm.
the class WithandWithoutInstanseIdTest method initialization.
@BeforeClass
public static void initialization() {
serverArray = new HttpServer[numberNodes];
for (int i = 0; i < numberNodes; i++) {
serverArray[i] = new HttpServer(7080 + i, 4444 + i, instanceId, 2222);
serverArray[i].start();
}
balancerRunner = new BalancerRunner();
LoadBalancerConfiguration lbConfig = new LoadBalancerConfiguration();
lbConfig.getSipConfiguration().getInternalLegConfiguration().setUdpPort(5065);
lbConfig.getSipConfiguration().getAlgorithmConfiguration().setAlgorithmClass(UserBasedAlgorithm.class.getName());
lbConfig.getSipConfiguration().getAlgorithmConfiguration().setSipHeaderAffinityKey("From");
balancerRunner.start(lbConfig);
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
use of org.mobicents.tools.configuration.LoadBalancerConfiguration in project load-balancer by RestComm.
the class ClusterSubdomainAffinityAlgorithmTest method testPartnerFailover.
// Test actual failover by adding a lot of noise nodes and only 1 partner for the original
@Test
public void testPartnerFailover() throws Exception, ParseException {
try {
ClusterSubdomainAffinityAlgorithm algorithm = new ClusterSubdomainAffinityAlgorithm();
algorithm.balancerContext = new BalancerContext();
algorithm.balancerContext.lbConfig = new LoadBalancerConfiguration();
algorithm.balancerContext.lbConfig.getSipConfiguration().getAlgorithmConfiguration().setSubclusterMap(failoverGroup);
algorithm.balancerContext.smppToNodeAlgorithmClassName = algorithm.balancerContext.lbConfig.getSmppConfiguration().getSmppToNodeAlgorithmClass();
algorithm.balancerContext.smppToProviderAlgorithmClassName = algorithm.balancerContext.lbConfig.getSmppConfiguration().getSmppToProviderAlgorithmClass();
algorithm.balancerContext.algorithmClassName = ClusterSubdomainAffinityAlgorithm.class.getName();
InvocationContext ctx = new InvocationContext("0", algorithm.balancerContext);
// ctx.nodes = new CopyOnWriteArrayList<Node>();
ctx.sipNodeMap(false).clear();
for (int q = 0; q < 100; q++) {
Node node = new Node("alphabeticalNoise" + q, "alphabeticalNoise" + q);
ctx.sipNodeMap(false).put(new KeySip(node, false), node);
}
for (int q = 0; q < 100; q++) {
Node node = new Node(q + "alphabeticalNoise" + q, q + "alphabeticalNoise" + q);
ctx.sipNodeMap(false).put(new KeySip(node, false), node);
}
Node originalNode = new Node("original", "original");
Node partnerNode = new Node("partner", "partner");
// This is dead BalancerContext.balancerContext.nodes.add(originalNode);
ctx.sipNodeMap(false).put(new KeySip(partnerNode, false), partnerNode);
for (int q = 0; q < 100; q++) {
Node node = new Node("nonParner" + q, "nonPartner" + q);
ctx.sipNodeMap(false).put(new KeySip(node, false), node);
}
algorithm.callIdMap.put("cid", originalNode);
Request request = SipFactory.getInstance().createMessageFactory().createRequest(inviteRequest);
algorithm.loadSubclusters(failoverGroup);
algorithm.invocationContext = ctx;
Node resultNode = algorithm.processExternalRequest(request, false);
assertEquals("partner", resultNode.getIp());
originalNode = null;
partnerNode = null;
resultNode = null;
} finally {
// BalancerContext.balancerContext.nodes = null;
}
}
use of org.mobicents.tools.configuration.LoadBalancerConfiguration in project load-balancer by RestComm.
the class Ipv6Test method setUp.
public void setUp() throws Exception {
shootistipv4 = new Shootist(ListeningPoint.TCP, 5060, 5033);
shootistipv6 = new Shootist(ListeningPoint.TCP, 5070, 5034, true);
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.getCommonConfiguration().setIpv6Host("::1");
lbConfig.getSipConfiguration().getExternalLegConfiguration().setTcpPort(5060);
lbConfig.getSipConfiguration().getInternalLegConfiguration().setTcpPort(5065);
lbConfig.getSipConfiguration().getExternalLegConfiguration().setIpv6TcpPort(5070);
lbConfig.getSipConfiguration().getInternalLegConfiguration().setIpv6TcpPort(5075);
balancer = new BalancerRunner();
balancer.start(lbConfig);
Thread.sleep(2000);
ipv6Server = new AppServer(true, "node", 4060, "127.0.0.1", 2000, 5070, 5075, "0", ListeningPoint.TCP);
ipv6Server.start();
ipv4Server = new AppServer("node", 4061, "127.0.0.1", 2000, 5060, 5065, "0", ListeningPoint.TCP, 2223);
ipv4Server.start();
Thread.sleep(5000);
}
Aggregations