diff --git a/example/diameter-ro/diameter-stack-config/jdiameter-config.xml b/example/diameter-ro/diameter-stack-config/jdiameter-config.xml new file mode 100644 index 000000000..3f7b2cd54 --- /dev/null +++ b/example/diameter-ro/diameter-stack-config/jdiameter-config.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/diameter-ro/du/pom.xml b/example/diameter-ro/du/pom.xml new file mode 100644 index 000000000..0fa815e90 --- /dev/null +++ b/example/diameter-ro/du/pom.xml @@ -0,0 +1,68 @@ + + 4.0.0 + + + example-DiameterRo-parent + org.mobicents.examples + 2.0.0-SNAPSHOT + + + example-DiameterRo-DU + + + + example-DiameterRo-sbb + org.mobicents.examples + ${pom.version} + + + + + + + org.mobicents.tools + maven-du-plugin + true + + + + + copy-dependencies + generate-descriptor + + + + + + maven-antrun-plugin + + + deploy-DU + install + + run + + + + + + + + + undeploy-DU + clean + + run + + + + + + + + + + + + + diff --git a/example/diameter-ro/du/src/main/resources/services/service.xml b/example/diameter-ro/du/src/main/resources/services/service.xml new file mode 100644 index 000000000..1cbad7059 --- /dev/null +++ b/example/diameter-ro/du/src/main/resources/services/service.xml @@ -0,0 +1,21 @@ + + + + + + + + Example DiameterRo Service + org.mobicents + 1.0 + + + TrainingexampleDiameterRo + org.mobicents + 2.0 + + + 0 + + + diff --git a/example/diameter-ro/pom.xml b/example/diameter-ro/pom.xml new file mode 100644 index 000000000..142e8aa53 --- /dev/null +++ b/example/diameter-ro/pom.xml @@ -0,0 +1,46 @@ + + + 4.0.0 + pom + + org.mobicents.servers.jainslee + restcomm-slee-parent + 7.0.11 + + + example-DiameterRo-parent + org.mobicents.examples + 2.0.0-SNAPSHOT + + Mobicents :: Examples :: ${pom.artifactId} + + + sbb + du + + + + + + maven-eclipse-plugin + org.mobicents.tools + false + + + + + xml-apis:xml-apis + jtidy:jtidy + + + true + + + mobicents-slee-ex1 + + + + + + + diff --git a/example/diameter-ro/readme.txt b/example/diameter-ro/readme.txt new file mode 100644 index 000000000..0b77f109d --- /dev/null +++ b/example/diameter-ro/readme.txt @@ -0,0 +1,33 @@ + +Overview: +In this example we will see how services are deployed +How Sbb handle DiameterRo events like : RoCreditControlRequest, RoCreditControlAnswer + + +Prerequisites: + ++ Deploy Diameter-base Resource Adaptor + ++ Deploy Diameter-Ro Resource Adaptor + ++ Deploy Diameter Stack + ++ Download seagull to simulate diameter traffic + +How to deploy this example: + ++ Go to jain-slee.diameter/example/diameter-ro and enter "mvn clean install" . + ++ Copy the jar file to JBOSS deployment directory. + ++ Check and confirm the SBB is installed successfullly to JAIN-SLEE through console http://localhost:8080/slee-management-console/ + +How to configure diameter stack at jain-slee: + + ++ cp jain-slee.diameter/example/diameter-ro/diameter-stack-config* /modules/system/layers/base/org/restcomm/diameter/lib/main/config/ + ++ start jain-slee + +How to generate diameter traffic by seagull: + + ++ Download seagull and unzip at jain-slee.diameter/example/diameter-ro/seagull + ++ Go to jain-slee.diameter/example/diameter-ro/seagull/scenario + ++ export LD_LIBRARY_PATH=jain-slee.diameter/example/diameter-ro/seagull/ + ++ mkdir jain-slee.diameter/example/diameter-ro/seagull/logs + ++ touch ../scenario/msisdn.csv + ++ ../seagull -bg -conf ../config/mem_conf.client.xml -dico ../config/base_cc.xml -scen ../scenario/ccr-cca.long.client.xml -log ../logs/car-caa.client.log -llevel T -ctrl 127.0.0.1:9090 -ctrldicopath ../config + + + diff --git a/example/diameter-ro/sbb/pom.xml b/example/diameter-ro/sbb/pom.xml new file mode 100644 index 000000000..ec60ec098 --- /dev/null +++ b/example/diameter-ro/sbb/pom.xml @@ -0,0 +1,39 @@ + + + 4.0.0 + + + example-DiameterRo-parent + org.mobicents.examples + 2.0.0-SNAPSHOT + + + example-DiameterRo-sbb + + + + org.mobicents.resources + lab-ratype + ${pom.version} + + + org.mobicents.resources + mobicents-slee-ra-diameter-ro-events + 2.8.18 + jar + + + org.mobicents.resources + restcomm-slee-ra-diameter-ro-ratype + 7.1.24 + jar + + + org.mobicents.servers.jainslee.api + jain-slee-11-ext + 7.1.83 + jar + + + + diff --git a/example/diameter-ro/sbb/src/main/java/org/mobicents/slee/training/examplediameterro/BounceSbb.java b/example/diameter-ro/sbb/src/main/java/org/mobicents/slee/training/examplediameterro/BounceSbb.java new file mode 100644 index 000000000..74c14c37c --- /dev/null +++ b/example/diameter-ro/sbb/src/main/java/org/mobicents/slee/training/examplediameterro/BounceSbb.java @@ -0,0 +1,45 @@ +/* + * *************************************************** + * * + * Mobicents: The Open Source JSLEE Platform * + * * + * Distributable under LGPL license. * + * See terms of license at gnu.org. * + * * + *************************************************** + */ +package org.mobicents.slee.training.examplediameterro; + +import javax.slee.ActivityContextInterface; + +import net.java.slee.resource.diameter.ro.events.RoCreditControlRequest; + +/** + * @author Anh Dao + */ +public abstract class BounceSbb extends CommonSbb { + + public BounceSbb() { + super(BounceSbb.class.getSimpleName()); + } + + public void sbbRolledBack(javax.slee.RolledBackContext rolledBackContext) { + tracer.info("sbbRolledBack called."); + tracer.info("--> "+rolledBackContext.getActivityContextInterface()); + tracer.info("--> "+rolledBackContext.getEvent()); + tracer.info("--> "+rolledBackContext.isRemoveRolledBack()); + } + + public void sbbExceptionThrown(Exception exception, Object obj, + javax.slee.ActivityContextInterface activityContextInterface) { + tracer.info("sbbExceptionThrown called."); + exception.printStackTrace(); + tracer.info("--> "+obj); + tracer.info("--> "+activityContextInterface); + } + public void onCreditControlRequest(RoCreditControlRequest event, ActivityContextInterface ac) { + tracer.info("onCreditControlRequest called."); + tracer.info("--> "+event.getSessionId()); + tracer.info("--> "+event.toString()); + } +} diff --git a/example/diameter-ro/sbb/src/main/java/org/mobicents/slee/training/examplediameterro/CommonSbb.java b/example/diameter-ro/sbb/src/main/java/org/mobicents/slee/training/examplediameterro/CommonSbb.java new file mode 100644 index 000000000..6b8cf088a --- /dev/null +++ b/example/diameter-ro/sbb/src/main/java/org/mobicents/slee/training/examplediameterro/CommonSbb.java @@ -0,0 +1,139 @@ +/* + * *************************************************** + * * + * Mobicents: The Open Source JSLEE Platform * + * * + * Distributable under LGPL license. * + * See terms of license at gnu.org. * + * * + *************************************************** + */ +package org.mobicents.slee.training.examplediameterro; + +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.NamingException; +import javax.slee.CreateException; +import javax.slee.Sbb; +import javax.slee.SbbContext; +import javax.slee.SbbID; +import javax.slee.facilities.Tracer; +import javax.slee.resource.ResourceAdaptorTypeID; +import net.java.slee.resource.diameter.ro.RoAvpFactory; +import net.java.slee.resource.diameter.ro.RoProvider; +import org.mobicents.slee.SbbContextExt; + +/** + * CommonSbb is the base SBB for all the Sbb's used in examples + * + * @author amit bhayani + * + */ + +public abstract class CommonSbb implements Sbb { + + private String className = null; + + protected Tracer tracer; + // the identifier for this sbb + private SbbID sbbId; + + // the sbb's sbbContext + private SbbContextExt sbbContextExt; // This SBB's SbbContext + + //private RoActivityContextInterfaceFactory roAcif; + + private RoAvpFactory roavpFactory; + protected RoProvider roProvider; + + /** Creates a new instance of BounceSbb */ + public CommonSbb(String className) { + this.className = className; + } + + public void setSbbContext(SbbContext sbbContext) { + + this.sbbContextExt = (SbbContextExt) sbbContext; + sbbId = sbbContextExt.getSbb(); + this.tracer = sbbContextExt.getTracer(this.className); + + if (this.tracer.isFineEnabled()) { + this.tracer.fine("setSbbContext() called. " + this); + } + + try { + Context ctx = (Context) new InitialContext() + .lookup("java:comp/env"); + + // get the reference to the RAFrameProvider class which implements + ResourceAdaptorTypeID raroTypeID = new ResourceAdaptorTypeID("Diameter Ro", "java.net", "0.8.1"); + this.roProvider = (RoProvider) sbbContextExt.getResourceAdaptorInterface(raroTypeID, "DiameterRo"); + //this.roAcif = (RoActivityContextInterfaceFactory) sbbContextExt.getActivityContextInterfaceFactory(raTypeID); + + this.roavpFactory = this.roProvider.getRoAvpFactory(); + } catch (NamingException ne) { + this.tracer.severe("NamingException received ", ne); + } + } + + public void unsetSbbContext() { + if (this.tracer.isFineEnabled()) { + this.tracer.fine("unsetSbbContext() called. " + this); + } + } + + public void sbbCreate() throws javax.slee.CreateException { + if (this.tracer.isFineEnabled()) { + this.tracer.fine("sbbCreate() called. " + this); + } + } + + public void sbbPostCreate() throws CreateException { + if (this.tracer.isFineEnabled()) { + this.tracer.fine("sbbCreate() called " + this); + } + } + + public void sbbActivate() { + if (this.tracer.isFineEnabled()) { + this.tracer.fine("sbbActivate() called " + this); + } + } + + public void sbbPassivate() { + if (this.tracer.isFineEnabled()) { + this.tracer.fine("sbbPassivate() called " + this); + } + } + + public void sbbRemove() { + if (this.tracer.isFineEnabled()) { + this.tracer.fine("sbbRemove() called " + this); + } + } + + public void sbbLoad() { + if (this.tracer.isFineEnabled()) { + this.tracer.fine("sbbLoad() called " + this); + } + } + + public void sbbStore() { + if (this.tracer.isFineEnabled()) { + this.tracer.fine("sbbStore() called " + this); + } + } + + public void sbbRolledBack(javax.slee.RolledBackContext rolledBackContext) { + if (this.tracer.isFineEnabled()) { + this.tracer.fine("sbbRolledBack() called " + this); + } + } + + public void sbbExceptionThrown(Exception exception, Object obj, + javax.slee.ActivityContextInterface activityContextInterface) { + if (this.tracer.isFineEnabled()) { + this.tracer.fine("sbbExceptionThrown() called " + this); + } + } +} diff --git a/example/diameter-ro/sbb/src/main/resources/META-INF/sbb-jar.xml b/example/diameter-ro/sbb/src/main/resources/META-INF/sbb-jar.xml new file mode 100644 index 000000000..f1e0071a4 --- /dev/null +++ b/example/diameter-ro/sbb/src/main/resources/META-INF/sbb-jar.xml @@ -0,0 +1,48 @@ + + + + + + SBB for example DiameterRo + + TrainingexampleDiameterRo + org.mobicents + 2.0 + + + + + org.mobicents.slee.training.examplediameterro.BounceSbb + + + + + + + CreditControlRequest + + net.java.slee.resource.diameter.ro.events.RoCreditControlRequest + java.net + 0.8 + + + + + + + Diameter Ro + java.net + 0.8.1 + + + slee/resources/DiameterRoResourceAdaptor/java.net/0.8.1/acif + + + slee/resources/diameter-ro-client-ra-interface + DiameterRo + + + + + diff --git a/example/diameter-ro/seagull/config/base_cc.xml b/example/diameter-ro/seagull/config/base_cc.xml new file mode 100644 index 000000000..f1bcd81f2 --- /dev/null +++ b/example/diameter-ro/seagull/config/base_cc.xml @@ -0,0 +1,518 @@ + + + + + + + + + + + + + + + +
+ + + + + + + +
+ + +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/example/diameter-ro/seagull/config/conf.client.xml b/example/diameter-ro/seagull/config/conf.client.xml new file mode 100644 index 000000000..214172977 --- /dev/null +++ b/example/diameter-ro/seagull/config/conf.client.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/diameter-ro/seagull/config/jdiameter-config.xml b/example/diameter-ro/seagull/config/jdiameter-config.xml new file mode 100644 index 000000000..241a30929 --- /dev/null +++ b/example/diameter-ro/seagull/config/jdiameter-config.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/diameter-ro/seagull/config/mem_conf.client.xml b/example/diameter-ro/seagull/config/mem_conf.client.xml new file mode 100644 index 000000000..9d00cd90f --- /dev/null +++ b/example/diameter-ro/seagull/config/mem_conf.client.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/diameter-ro/seagull/config/remote-ctrl.xml b/example/diameter-ro/seagull/config/remote-ctrl.xml new file mode 100644 index 000000000..f5973e39f --- /dev/null +++ b/example/diameter-ro/seagull/config/remote-ctrl.xml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
diff --git a/example/diameter-ro/seagull/scenario/ccr-cca.long.client.xml b/example/diameter-ro/seagull/scenario/ccr-cca.long.client.xml new file mode 100644 index 000000000..d06ca3aff --- /dev/null +++ b/example/diameter-ro/seagull/scenario/ccr-cca.long.client.xml @@ -0,0 +1,286 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/example/diameter-ro/seagull/scenario/msisdn.csv b/example/diameter-ro/seagull/scenario/msisdn.csv new file mode 100644 index 000000000..07fbe622b --- /dev/null +++ b/example/diameter-ro/seagull/scenario/msisdn.csv @@ -0,0 +1,11 @@ +"string"; +"351910000000"; +"351911111111"; +"351912222222"; +"351913333333"; +"351914444444"; +"351915555555"; +"351916666666"; +"351917777777"; +"351918888888"; +"351919999999";