How to do it...
Perform the following steps:
- Get the packetcable-emulator JAR here: https://nexus.opendaylight.org/content/repositories/opendaylight.release/org/opendaylight/packetcable/packetcable-emulator/1.4.2-Boron-SR2/packetcable-emulator-1.4.2-Boron-SR2.jar
If you want to look into the source code and build the emulator yourself, use the following command to clone the source code repository and assemble the JAR:
$ git clone --branch release/boron-sr2 https://git.opendaylight.org/gerrit/packetcable
$ cd packetcable/packetcable-emulator/
$ mvn assembly:assembly
In the target folder will be the JARs. The one of interest ends with -jar-with-dependencies.jar.
- Create a configuration file in the YAML format containing the following values:
- The CMTS communication port number:
port: 3918
- The maximum number of classifiers per gate this CMTS supports:
numberOfSupportedClassifiers: 4
- Configuration for the service class names:
serviceClassNames:
- direction: UPSTREAM
names:
- extrm_up
- foo_up
- direction: DOWNSTREAM
names:
- extrm_dn
- foo_dn
- Cable modem information:
cmStatuses:
- host: 10.32.110.180
status: true
- host: 10.32.110.179
status: true
- Start the emulator using the JAR and the configuration file as follows:
$ java -cp packetcable-emulator-1.4.2-Boron-SR2-jar-with-dependencies.jar org.pcmm.rcd.impl.CMTS {path to yaml}
22:00:02.966 [main] INFO org.pcmm.concurrent.IWorkerPool - Pool size :32
22:00:02.984 [main] INFO org.pcmm.rcd.impl.AbstractPCMMServer - Server started and listening on port :3918
- Start your OpenDaylight distribution using the karaf script. Using this script will give you access to the Karaf CLI:
$ ./bin/karaf
- Install the user-facing feature responsible for pulling in all dependencies needed to enable user authentication:
opendaylight-user@root>feature:install odl-packetcable-policy-server
It might take a few minutes to complete the installation.
- Before setting any PCMM gates, we need to establish a persistent connection between OpenDaylight and a CTMS/Converged Cable Access Platform (CCAP) (add a CCAP 1 request from the Postman collection).
We're going to connect to one of the simulated devices configured and started previously (you could use your own device here). The request will require the IP address and the port of the device, along with the downstream and upstream service class name.
Finally, you will have to define the ${ID} for the new entry in both the URL and the payload (the ${ID} is a string):
- Type: PUT
- Headers:
Authorization: Basic YWRtaW46YWRtaW4=
- URL: http://localhost:8181/restconf/config/packetcable:ccaps/ccap/${ID}
- Payload:
{
"ccap": [{
"ccapId": "${ID}",
"amId": {
"am-tag": "0xcada",
"am-type": "1"
},
"connection": {
"ipAddress": "10.32.110.180",
"port": "3918"
},
"subscriber-subnets": [
"10.32.110.1/24"
],
"downstream-scns": [
"extrm_dn"
],
"upstream-scns": [
"extrm_up"
]
}]
}
If the connection to a CCAP succeeded, the HTTP request will return 200 OK. You will see a lot of activity in the command line where you started the emulator. The first message is the new connection:
[pool-2-thread-1] INFO org.pcmm.rcd.impl.AbstractPCMMServer - Accepted a new connection from :192.168.2.11:49682
Once the connection is established, a keep-alive mechanism is in place to ensure the connection is still up.
- Verify the status of the connection we just created (operational -Get All CCAPs).
For this request, we're going to use the operational datastore, providing operational data. It reflects current state of the device:
- Type: GET
- Headers:
Authorization: Basic YWRtaW46YWRtaW4=
- URL: http://localhost:8181/restconf/operational/packetcable:ccaps/ccap/${ID}
This request returns the connection information for the device with ${ID}=1. Our device is currently connected:
{
"ccap": [
{
"ccapId": "1",
"connection": {
"connected": true
}
}
]
}
- Let's create a gate now. To do so, we will submit the following request:
Gate w/ classifier
We will use the first cable modem defined in the configuration file for our gate. You will have to define three variables for this request: the ${APPLICATION_CLASSIFIER}, the ${SUBSCRIBER_ID} and the ${GATE_ID}:
- Type: PUT
- Headers:
Authorization: Basic YWRtaW46YWRtaW4=
- URL: http://localhost:8181//restconf/config/packetcable:qos/apps/app/${APPLICATION_CLASSIFIER}/subscribers/subscriber/${SUBSCRIBER_ID}/gates/gate/${GATE_ID}/
- Payload:
{
"gate":
{
"gateId": "${APPLICATION_CLASSIFIER}",
"classifiers":
{
"classifier-container":
[
{
"classifier-id": "1",
"classifier":
{
"srcIp": "10.10.10.0",
"dstIp": "10.32.110.178",
"protocol": "0",
"srcPort": "1234",
"dstPort": "4321",
"tos-byte": "0xa0",
"tos-mask": "0xe0"
}
}
]
},
"gate-spec":
{
"dscp-tos-overwrite": "0xa0",
"dscp-tos-mask": "0xff"
},
"traffic-profile":
{
"service-class-name": "extrm_up"
}
}
}
If the request went well, it will return 200 OK and you will see some activity in the terminal console, saying the gate was successfully processed:
[Thread-0] INFO org.pcmm.rcd.impl.CmtsPepReqStateMan - Returning SUCCESS for gate request [extrm_up] direction [Upstream] for host - 10.32.110.180
- The Complete Rust Programming Reference Guide
- 演進式架構(原書第2版)
- Learn ECMAScript(Second Edition)
- Mastering Zabbix(Second Edition)
- Mastering phpMyAdmin 3.4 for Effective MySQL Management
- Android Development with Kotlin
- C/C++常用算法手冊(第3版)
- Mastering AndEngine Game Development
- Android Native Development Kit Cookbook
- Unity UI Cookbook
- C#開發案例精粹
- Hands-On GUI Programming with C++ and Qt5
- Modular Programming with JavaScript
- SFML Game Development
- 高性能PHP 7